servlets
tags question: http://stackoverflow.com/q/22505347
tags question: http://stackoverflow.com/q/22599868
tags question: http://stackoverflow.com/q/22517659
tags question: http://stackoverflow.com/q/22644563
tags question: http://stackoverflow.com/q/22489227
tags question: http://stackoverflow.com/q/22525654
tags question: http://stackoverflow.com/q/22624152
tags question: http://stackoverflow.com/q/22533365
tags question: http://stackoverflow.com/q/22604639
tags question: http://stackoverflow.com/q/22499516
tags question: http://stackoverflow.com/q/22548288
tags question: http://stackoverflow.com/q/22627538
tags question: http://stackoverflow.com/q/22589954
tags question: http://stackoverflow.com/q/22489761
tags question: http://stackoverflow.com/q/22569942
tags question: http://stackoverflow.com/q/22644292
tags question: http://stackoverflow.com/q/22640445
tags question: http://stackoverflow.com/q/22618766
tags question: http://stackoverflow.com/q/22576416
tags question: http://stackoverflow.com/q/22584504
tags question: http://stackoverflow.com/q/22592689
tags question: http://stackoverflow.com/q/22631787
tags question: http://stackoverflow.com/q/22552614
tags question: http://stackoverflow.com/q/22511732
tags question: http://stackoverflow.com/q/22595709
tags question: http://stackoverflow.com/q/22562528
tags question: http://stackoverflow.com/q/22576193
tags question: http://stackoverflow.com/q/22496258
tags question: http://stackoverflow.com/q/22527080
tags question: http://stackoverflow.com/q/22571508
tags question: http://stackoverflow.com/q/22627788
tags question: http://stackoverflow.com/q/22555112
tags question: http://stackoverflow.com/q/22615581
tags question: http://stackoverflow.com/q/22582839
tags question: http://stackoverflow.com/q/22524699
tags question: http://stackoverflow.com/q/22604986
tags question: http://stackoverflow.com/q/22495634
tags question: http://stackoverflow.com/q/22603262
tags question: http://stackoverflow.com/q/22641639
tags question: http://stackoverflow.com/q/22629294
tags question: http://stackoverflow.com/q/22527866
tags question: http://stackoverflow.com/q/22568255
tags question: http://stackoverflow.com/q/22634428
tags question: http://stackoverflow.com/q/22530272
tags question: http://stackoverflow.com/q/22511386
tags question: http://stackoverflow.com/q/22542404
tags question: http://stackoverflow.com/q/22550728
tags question: http://stackoverflow.com/q/22627628
tags question: http://stackoverflow.com/q/22533620
tags question: http://stackoverflow.com/q/22632212
tags question: http://stackoverflow.com/q/22550703
tags question: http://stackoverflow.com/q/22616752
tags question: http://stackoverflow.com/q/22544152
tags question: http://stackoverflow.com/q/22535988
tags question: http://stackoverflow.com/q/22608626
tags question: http://stackoverflow.com/q/22503899
tags question: http://stackoverflow.com/q/22525256
tags question: http://stackoverflow.com/q/22595216
tags question: http://stackoverflow.com/q/22605590
tags question: http://stackoverflow.com/q/22501261
tags question: http://stackoverflow.com/q/22642012
tags question: http://stackoverflow.com/q/22646917
tags question: http://stackoverflow.com/q/22489175
tags question: http://stackoverflow.com/q/22558047
tags question: http://stackoverflow.com/q/22523545
tags question: http://stackoverflow.com/q/22600275
tags question: http://stackoverflow.com/q/22514070
tags question: http://stackoverflow.com/q/22500558
tags question: http://stackoverflow.com/q/22567133
tags question: http://stackoverflow.com/q/22509374
tags question: http://stackoverflow.com/q/22560343
tags question: http://stackoverflow.com/q/22631462
tags question: http://stackoverflow.com/q/22553314
tag name: servlets
tags question: http://stackoverflow.com/q/22619924
tags question: http://stackoverflow.com/q/22498138
tags question: http://stackoverflow.com/q/22602143
tags question: http://stackoverflow.com/q/22609150
tags question: http://stackoverflow.com/q/22524055
tags question: http://stackoverflow.com/q/22573757

http://stackoverflow.com/a/22488047
has body: You need to register the ActionListener with your button for the actionPerformed method to be invoked count.addActionListener(this);
upvote count: 1
answers question: http://stackoverflow.com/q/22487953
accepted answer of: http://stackoverflow.com/q/22487953
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/22546834
upvote count: 0
has comment: http://stackoverflow.com/comment/34314911
tagged with: push
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/34315049
favorite count: 0
has title: How to push Stack content to an array in Java?
tagged with: element
has comment: http://stackoverflow.com/comment/34314940
accepted answer: http://stackoverflow.com/a/22547283
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34315037
tagged with: stack
tagged with: java
downvote count: 1
type: Question
score: -1
has answer: http://stackoverflow.com/a/22547283
has body: I have a method that I want to write which has an integer stack as a parameter and I want to push all content from this stack into an integer array that I create within the method. How do I do this? public void test(StackADT&lt;Integer&gt; stack) { SimpleListADT&lt;Integer&gt; values = new ArraySimpleList&lt;Integer&gt;(); // I want to push the content of the stack in the parameter to the list // using a loop; the stacks will contain integers but they will be represented // as strings, not sure if I have the for loop set up correctly for (int i = 0; i &lt; stack.size();i++) { String s = stack.get(i); values.addToRear(s); // not sure what to put in the body of the loop here, I know the above is // incorrect because there's no get(int) method for stacks, I just need a // push in the right direction } }

http://stackoverflow.com/a/22498094
upvote count: 2
answers question: http://stackoverflow.com/q/22498065
downvote count: 0
has body: You don't need to throws Exception in this case because ArithmeticException is a RuntimeException, the compiler doesn't know it'll be thrown, so it doesn't force you to deal with it. See: Cases where you should do that, if you have an exception that's not a runtime exception, and you don't surround the line that might throw the exception with try-catch clause, then you'll have to declare the method to be throws ThatException.
type: Answer
score: 2

http://stackoverflow.com/a/43675832
has body: This happened to me as well. I was confused by the location of build.gradle file: I thought it should be located in src/main/java/hello, because it is mentioned right after the instruction to create this sub-directory structure. It should be placed in the root folder containing src folder. Once I did that and called "gradle build" from the root folder and not "./gradlew build" as the guide instructs, build was successful. I did not perform the standard installation for gradle, just downloaded the binaries, maybe this is the reason that "./gradlew build" failed for me.
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22528114
downvote count: 0

http://stackoverflow.com/comment/34281230
comment on: http://stackoverflow.com/a/22527919
type: Comment
has text: We need to be sure whether it's equivalent or not :/
score: 0
type: AnswerComment

http://stackoverflow.com/a/22513995
has body: The subclasses DecimalFormat and ChoiceFormat have a method toPattern(), so you must check using instanceof and call toPattern() String pattern = null; if (numberFormat instanceof DecimalFormat) { pattern = ((DecimalFormat)numberFormat).toPattern(); } Consider DecimalFormat.toLocalizedPattern() too
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/22513607
answers question: http://stackoverflow.com/q/22513607
upvote count: 7
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34274024
has text: can you refer this http://stackoverflow.com/questions/20316526/combine-two-integer-arrays-into-one-array-in-java it might be helpful to you
score: 0
comment on: http://stackoverflow.com/q/22523971
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34416493
type: QuestionComment
has text: I've also been reading on scheduling incremental updates. They seem to fit what I need too, although a little more complex to implement: First I'd need to go through the whole index removing deleted entries/categories, then instead of creating a new index and add a doc for each entry/category I'd query the index first to check if a doc exists for that entry/category, and if it doesn't I'd append it to the index. But I don't know if this would be more efficient than rebuilding the whole index...
comment on: http://stackoverflow.com/q/22595561
score: 0
type: Comment

http://stackoverflow.com/comment/34421222
type: Comment
type: QuestionComment
score: 0
has text: can you share the Form code.
comment on: http://stackoverflow.com/q/22606950

http://stackoverflow.com/a/22639750
has comment: http://stackoverflow.com/comment/60451718
type: Answer
upvote count: 1
score: 1
has body: There is another solution: public class MyGuiceServletConfig extends GuiceServletContextListener { @Override protected Injector getInjector() { return Guice.createInjector( new ServletModule() { @Override protected void configureServlets() { install(new MyGuiceModule()); serve("*").with(Test.class); bind(Test.class).in(Singleton.class); } } ); } } This way you can create single module which uses other modules. Sometimes this is more readable.
answers question: http://stackoverflow.com/q/22634939
has comment: http://stackoverflow.com/comment/60454142
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22634939
has comment: http://stackoverflow.com/comment/34480134

http://stackoverflow.com/q/22609743
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: canvas
downvote count: 0
has title: trying to make object of class and then to display.setCurrent(Class) but not working
tagged with: java-me
favorite count: 0
has body: I am trying to make a new object from StartGame and show in the GameMidlet class, but whenever I click on the OK button to display the content of StartGame, the screen doesn't show anything, instead showing just the same GameMidlet menu. Please help me find where the bug is. Thank you in advance. public class GameMidlet extends MIDlet implements CommandListener, ItemCommandListener { GameCanvas gameCanvasNew; Display display; StartGame startGame; Command restartCommand; Vector mGameCanvasList; GameCanvas gameCanvasSecond; private Form formMenu; private Command exitCommand; private Command okCommand; private Command exitCommandGame; private StringItem menuItem; private StringItem siNewGameItem; private StringItem siResume; private StringItem siExit; public void startApp() { formMenu = new Form("Start Menu", new Item[] {getNewGameItem(), getResumeItem(), getExitItem()}); display = Display.getDisplay(this); display.setCurrent(formMenu); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable d) { } public StringItem getNewGameItem(){ if(siNewGameItem == null){ siNewGameItem = new StringItem("New Game","", Item.BUTTON); siNewGameItem.addCommand(getOkCommand()); siNewGameItem.setItemCommandListener(this); } return siNewGameItem; } public StringItem getResumeItem(){ if(siResume == null){ siResume = new StringItem("Resume", "", Item.BUTTON); siResume.addCommand(getOkCommand()); siResume.setItemCommandListener(this); } return siResume; } public StringItem getExitItem(){ if(siExit == null){ siExit = new StringItem("Exit","",Item.BUTTON); siExit.addCommand(getExitCommand()); siExit.setItemCommandListener(this); } return siExit; } public Command getOkCommand(){ if(okCommand == null){ okCommand = new Command("OK", Command.OK, 0); } return okCommand; } public Command getExitCommand(){ if(exitCommand == null){ exitCommand = new Command("Exit", Command.EXIT, 0); } return exitCommand; } public void commandActio…
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/34413418
score: 0
has text: I cant do that, As it is existing application where i have to make changes
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22602210

http://stackoverflow.com/a/22517347
has body: Generally in linked lists an element contains a reference to the next element in the list. Your Element class doesn't seem to have any way to reference the next element in the list. The wikipedia entry on linked lists might be a good place to start: http://en.wikipedia.org/wiki/Linked_list
answers question: http://stackoverflow.com/q/22517301
type: Answer
score: 0

http://stackoverflow.com/a/22551602
answers question: http://stackoverflow.com/q/22551547
has body: You need to change this line to read your file fin = new FileInputStream(yourfile);
accepted answer of: http://stackoverflow.com/q/22551547
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34410544
type: Comment
type: QuestionComment
has text: Have you tried calling `finish()` and `System.exit(1)` on the main/launcher Activity after processing the Exception?
score: 1
comment on: http://stackoverflow.com/q/22600668

http://stackoverflow.com/a/22598531
score: 2
downvote count: 0
has body: Edit: Try the following: int rowCount = 0; int rows = rowsNumber; int cols = colsNumber; double[][] twoD = new double[rows][cols]; while ( ( line=bufferedReader.readLine() ) != null ) { String[] allIds = line.split( tabSplit ); String[] allFloats = new String[allIds.length-2]; System.arraycopy(allIds, 2, allFloats, 0, allIds.length-2); for (int i = 0; i&lt;cols; i++) { twoD[rowCount][i] = Double.parseDouble(allFloats[i]); } rowCount++ }
has comment: http://stackoverflow.com/comment/34406853
upvote count: 2
has comment: http://stackoverflow.com/comment/34407446
has comment: http://stackoverflow.com/comment/34406862
has comment: http://stackoverflow.com/comment/34406806
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22598451
has comment: http://stackoverflow.com/comment/34407061
answers question: http://stackoverflow.com/q/22598451
type: Answer
has comment: http://stackoverflow.com/comment/34407283

http://stackoverflow.com/comment/34415448
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22596272
has text: Thanks. I solved the problem with flags as you told. :) , feeling good!

http://stackoverflow.com/comment/34410564
type: Comment
has text: Bob, suggest you update your code above. It is no longer clear to me what you are doing.
type: AnswerComment
comment on: http://stackoverflow.com/a/22549590
score: 0

http://stackoverflow.com/q/22530345
score: 12
tagged with: java
downvote count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22530536
has title: Does Java 8 support functions as first class objects?
tagged with: functional-programming
has answer: http://stackoverflow.com/a/22530505
has body: I've read today about the Java 8 release. But I don't understand fully the concept of reference methods in Java 8. Does this mean that Java now has the support of functions as first class objects? I have seen, how to construct a reference to function. But it seems to me, that the Converter object they provide has quite limited functionality. Is it now possible in Java: to pass the function as the argument to another function? to return the function as the return value from another function? and what about closures? Are they implemented fully like in functional languages, or they do have some limitations? It seems to me that there are some limitations (you cannot change the value of the variable you reference in a closure, it must be marked as final and etc).
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22530544
has answer: http://stackoverflow.com/a/22530499
answer count: 4
upvote count: 13

http://stackoverflow.com/q/22492670
has comment: http://stackoverflow.com/comment/34245984
answer count: 1
has answer: http://stackoverflow.com/a/22493015
has comment: http://stackoverflow.com/comment/34219616
has comment: http://stackoverflow.com/comment/34219716
has comment: http://stackoverflow.com/comment/34219875
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22493015
has comment: http://stackoverflow.com/comment/34219764
type: Question
has comment: http://stackoverflow.com/comment/34219727
tagged with: java
has body: I've been trying to draw a String variable from another class with the g.drawString(); method. Here is my code: g2.drawString(lang.menu[i], MainPanel.SCREEN_WIDTH / 2, MainPanel.SCREEN_HEIGHT / 2 + i * 22); I have tried having the Lang.menu[] String static and not static but it doesn't seem to effect it at all. Any help? Lang.menu[]: public String[] menu;{ if(Main.langPicked == 1){ menu[0] = "Singleplayer"; menu[1] = "Multiplayer"; menu[2] = "Options"; menu[3] = "Exit Game"; }else if(Main.langPicked == 2){ menu[0] = "Solo"; menu[1] = "Multijoueur"; menu[2] = "Options"; menu[3] = "Quitter Le Jeu"; }else if(Main.langPicked == 3){ menu[0] = "Singleplayer"; menu[1] = "Multiplayer"; menu[2] = "Opties"; menu[3] = "Verlaat Het Spel"; } }
has title: How To Draw A String Variable with g.drawString();?
score: 0

http://stackoverflow.com/a/22582067
score: 23
has body: I changed the val private val t = 20 to a constant definition private final val t = 20 and got a significant performance boost, now it seems that both versions perform almost equally [on my system, see update and comments]. I have not looked into into the bytecode, but if you use val t = 20 you can see using javap that there is a method (and that version is as slow as the one with the private val). So I assume that even a private val involves calling a method, and that's not directly comparable with a final in Java. Update On my system I got these results Java version : time: 14725 Scala version: time: 13228 Using OpenJDK 1.7 on a 32-Bit Linux. In my experience Oracle's JDK on a 64-Bit system does actually perform better, so this probably explains that other measurements yield even better results in favour of the Scala version. As for the Scala version performing better I assume that tail recursion optimization does have an effect here (see Phil's answer, if the Java version is rewritten to use a loop instead of recursion, it performs equally again).
downvote count: 0
has comment: http://stackoverflow.com/comment/38191865
answers question: http://stackoverflow.com/q/22581163
has comment: http://stackoverflow.com/comment/34377221
has comment: http://stackoverflow.com/comment/34378217
has comment: http://stackoverflow.com/comment/34377097
type: Answer
upvote count: 23
has comment: http://stackoverflow.com/comment/34376907
has comment: http://stackoverflow.com/comment/38206463
has comment: http://stackoverflow.com/comment/34379399

http://stackoverflow.com/comment/34247995
score: 0
has text: Thank you very much for help and your time. It works perfectly now. The problem was really in borders that I was setting to null. :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22504904

android
tags question: http://stackoverflow.com/q/22500684
tags question: http://stackoverflow.com/q/22514889
tags question: http://stackoverflow.com/q/22529419
tags question: http://stackoverflow.com/q/22531961
tags question: http://stackoverflow.com/q/22619037
tags question: http://stackoverflow.com/q/22626403
tags question: http://stackoverflow.com/q/22500031
tags question: http://stackoverflow.com/q/22591607
tags question: http://stackoverflow.com/q/22598328
tags question: http://stackoverflow.com/q/22590988
tags question: http://stackoverflow.com/q/22575297
tags question: http://stackoverflow.com/q/22592208
tags question: http://stackoverflow.com/q/22598314
tags question: http://stackoverflow.com/q/22594175
tags question: http://stackoverflow.com/q/22537654
tags question: http://stackoverflow.com/q/22581189
tags question: http://stackoverflow.com/q/22528816
tags question: http://stackoverflow.com/q/22552947
tags question: http://stackoverflow.com/q/22608769
tags question: http://stackoverflow.com/q/22494397
tags question: http://stackoverflow.com/q/22535957
tags question: http://stackoverflow.com/q/22546197
tags question: http://stackoverflow.com/q/22574243
tags question: http://stackoverflow.com/q/22612401
tags question: http://stackoverflow.com/q/22544585
tags question: http://stackoverflow.com/q/22564034
tags question: http://stackoverflow.com/q/22553582
tags question: http://stackoverflow.com/q/22522407
tags question: http://stackoverflow.com/q/22646841
tags question: http://stackoverflow.com/q/22569725
tags question: http://stackoverflow.com/q/22614014
tags question: http://stackoverflow.com/q/22609944
tags question: http://stackoverflow.com/q/22511732
tags question: http://stackoverflow.com/q/22591854
tags question: http://stackoverflow.com/q/22641781
tags question: http://stackoverflow.com/q/22624856
tags question: http://stackoverflow.com/q/22646338
tags question: http://stackoverflow.com/q/22550201
tags question: http://stackoverflow.com/q/22608365
tags question: http://stackoverflow.com/q/22571166
tags question: http://stackoverflow.com/q/22583471
tags question: http://stackoverflow.com/q/22601414
tags question: http://stackoverflow.com/q/22640385
tags question: http://stackoverflow.com/q/22591620
tags question: http://stackoverflow.com/q/22589582
tags question: http://stackoverflow.com/q/22576474
tags question: http://stackoverflow.com/q/22616079
tags question: http://stackoverflow.com/q/22523959
tags question: http://stackoverflow.com/q/22497324
tags question: http://stackoverflow.com/q/22645937
tags question: http://stackoverflow.com/q/22555374
tags question: http://stackoverflow.com/q/22640257
tags question: http://stackoverflow.com/q/22528380
tags question: http://stackoverflow.com/q/22536081
tags question: http://stackoverflow.com/q/22576709
tags question: http://stackoverflow.com/q/22589425
tags question: http://stackoverflow.com/q/22523274
tags question: http://stackoverflow.com/q/22527784
tags question: http://stackoverflow.com/q/22620692
tags question: http://stackoverflow.com/q/22636681
tags question: http://stackoverflow.com/q/22552353
tags question: http://stackoverflow.com/q/22526497
tags question: http://stackoverflow.com/q/22547557
tags question: http://stackoverflow.com/q/22588671
tags question: http://stackoverflow.com/q/22546657
tags question: http://stackoverflow.com/q/22599204
tags question: http://stackoverflow.com/q/22577468
tags question: http://stackoverflow.com/q/22644109
tags question: http://stackoverflow.com/q/22554922
tags question: http://stackoverflow.com/q/22487972
tags question: http://stackoverflow.com/q/22503838
tags question: http://stackoverflow.com/q/22636550
tags question: http://stackoverflow.com/q/22500113
tags question: http://stackoverflow.com/q/22584620
tags question: http://stackoverflow.com/q/22617933
tags question: http://stackoverflow.com/q/22598092
tags question: http://stackoverflow.com/q/22573301
tags question: http://stackoverflow.com/q/22549220
tags question: http://stackoverflow.com/q/22534089
tags question: http://stackoverflow.com/q/22584949

http://stackoverflow.com/q/22584027
answer count: 2
tagged with: amazon-mws
has answer: http://stackoverflow.com/a/22629873
has body: I'm working with amazon mws feed api in java and I'm having some problem while sending a ProductImage feed to amazon. This is the xml I'm sending: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> ABCDORD0001 Main http://vocearancio.ingdirect.it/wp-content/uploads/2013/01/bici-1.jpeg And this is the web service response (only the interesting part): 1 Error 5000 XML Parsing Error at Line 2, Column 15: Found unexpected element 'ProductImage' while parsing the start of this 'AmazonEnvelope' document. Children of this element will be ignored by the parser.. I don't understand why he ignores the ProductImage tag, I'm following an example in the documentation and it should be fine. I'm sending the feed with request.setFeedType("_POST_PRODUCT_IMAGE_DATA_"); Is it because I'm missing the Envelope part? I thought the java API did that, I had no problem with other feeds (even tough the product doesn't show in the sellecentral inventory). This was my POST_PRODUCT_DATA feed (the fist that I should be sending, not the one above) that returned with no errors: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> ABCDORD0001 2014-11-10T00:00:00.000+01:00 2014-11-10T00:00:00.000+01:00 New <Title>titolo_articolo brand_item descrizione_articolo_dett sotto_categoria I hope someone can help.
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/17423769
accepted answer: http://stackoverflow.com/a/22629873
tagged with: xsd
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22594232
has answer: http://stackoverflow.com/a/22594232
tagged with: java
type: Question
has title: Amazon Marketplace API ProductImage Feed unexpected element error while parsing xml
score: 0

http://stackoverflow.com/comment/34437835
has text: I mean, if I were to use Condition, what scenario would I need to have to use Condition? I don't understand why a thread would ever need to wait for another thread to finish, given that each thread locks the object and releases the lock in the finally clause. Other threads will wait for the previous thread to finish either way, right?
type: Comment
comment on: http://stackoverflow.com/a/22614772
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34366588
comment on: http://stackoverflow.com/a/22576386
score: 0
type: AnswerComment
has text: @AndrewThompson Oops! :-) And thanks for the help. Now it fully compiles and works correctly.
type: Comment

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/22499283
tags question: http://stackoverflow.com/q/22578486
tags question: http://stackoverflow.com/q/22547168
tags question: http://stackoverflow.com/q/22505315
tags question: http://stackoverflow.com/q/22545142
tag name: jfreechart
tags question: http://stackoverflow.com/q/22633629
tags question: http://stackoverflow.com/q/22597446

http://stackoverflow.com/comment/34453083
has text: +1 Adding to this: In more performance limited environments, one common optimization with this is to define a custom mutable counter class that wraps a primitive `int`, so that the count can be updated without creating a `new Integer`. There is also `MutableInt` in Apache Commons.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22624167

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

http://stackoverflow.com/q/22522340
has answer: http://stackoverflow.com/a/22522381
tagged with: resultset
has body: I have a java application which keeps data in a database (MySQL), and I use JSON to transmit data in a proper form. I can fetch and insert data into a JSONArray, but whenever the ResultSet cursor reaches to the last column of the first row, execution is ended. And I have two rows in the table, SQL query is executed successfully. I've tried to fix the issue by using many loops, conditions, etc. but the Resultset inside those loops either returns a NullPointer or SQLSyntaxError. I never succeded, so I would appreciate it if you could reply my question. The original java class without the loops public class JsonSuccessReport { public JsonSuccessReport() { } private Connection connection; private Statement statement; public void GenerateSuccessReportAsJson(String idNumber) throws SQLException { String query = "SELECT USERS.idnumber, SUCCESS_REPORT.subject_name, " + "SUCCESS_REPORT.hours, SUCCESS_REPORT.midterm, " + "SUCCESS_REPORT.`final`, SUCCESS_REPORT.average, " + "SUCCESS_REPORT.attandance, SUCCESS_REPORT.semester, " + "SUCCESS_REPORT.academic_year " + "FROM USERS " + "INNER JOIN SUCCESS_REPORT " + "ON USERS.iduser=SUCCESS_REPORT.`USERS_iduser` " + "WHERE USERS.idnumber=" + idNumber; ResultSet rs = null; try { connection = ConnectionFactory.getConnection(); statement = connection.createStatement(); rs = statement.executeQuery(query); JsonObject jsonResponse = new JsonObject(); JsonArray data = new JsonArray(); if (rs.next()) { JsonArray row = new JsonArray(); row.add(new JsonPrimitive(rs.getString("subject_name"))); row.add(new JsonPrimitive(rs.getString("hours"))); row.add(new JsonPrimitive(rs.getString("midterm"))); row.add(new JsonPrimitive(rs.getString("final"))); row.add(new JsonPrimitive(rs.getString("average"))); row.add(new JsonPrimitive(rs.getString("attandance"))); row.add(new JsonPrimitive(rs.getString("semester"))); row.add(new JsonPrimitive(rs.getString("academic_year"))); data.add(row); } jsonResponse.add("jsonSuccessReport", data); System.out.println(…
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
accepted answer: http://stackoverflow.com/a/22522381
type: Question
score: 0
has title: Using same ResultSet for every row inside JSONArray
tagged with: sql
answer count: 1

http://stackoverflow.com/comment/82565629
type: Comment
has text: @glennjackman Could somebody make an answer? I would like to get this out of the list of unanswered questions.
comment on: http://stackoverflow.com/q/22503769
score: 0
type: QuestionComment

java
tags question: http://stackoverflow.com/q/22518396
tags question: http://stackoverflow.com/q/22565869
tags question: http://stackoverflow.com/q/22561869
tags question: http://stackoverflow.com/q/22588187
tags question: http://stackoverflow.com/q/22591305
tags question: http://stackoverflow.com/q/22497907
tags question: http://stackoverflow.com/q/22519276
tags question: http://stackoverflow.com/q/22618446
tags question: http://stackoverflow.com/q/22527187
tags question: http://stackoverflow.com/q/22644746
tags question: http://stackoverflow.com/q/22636753
tags question: http://stackoverflow.com/q/22578556
tags question: http://stackoverflow.com/q/22513053
tags question: http://stackoverflow.com/q/22529843
tags question: http://stackoverflow.com/q/22588175
tags question: http://stackoverflow.com/q/22580149
tags question: http://stackoverflow.com/q/22598438
tags question: http://stackoverflow.com/q/22559439
tags question: http://stackoverflow.com/q/22580415
tags question: http://stackoverflow.com/q/22594447
tags question: http://stackoverflow.com/q/22544249
tags question: http://stackoverflow.com/q/22499930
tags question: http://stackoverflow.com/q/22623557
tags question: http://stackoverflow.com/q/22598968
tags question: http://stackoverflow.com/q/22602217
tags question: http://stackoverflow.com/q/22600489
tags question: http://stackoverflow.com/q/22589055
tags question: http://stackoverflow.com/q/22595480
tags question: http://stackoverflow.com/q/22613314
tags question: http://stackoverflow.com/q/22579387
tags question: http://stackoverflow.com/q/22492000
tags question: http://stackoverflow.com/q/22596297
tags question: http://stackoverflow.com/q/22626977
tags question: http://stackoverflow.com/q/22590148
tags question: http://stackoverflow.com/q/22492159
tags question: http://stackoverflow.com/q/22637528
tags question: http://stackoverflow.com/q/22630207
tags question: http://stackoverflow.com/q/22646371
tags question: http://stackoverflow.com/q/22626197
tags question: http://stackoverflow.com/q/22638249
tags question: http://stackoverflow.com/q/22570921
tags question: http://stackoverflow.com/q/22527204
tags question: http://stackoverflow.com/q/22624454
tags question: http://stackoverflow.com/q/22570258
tags question: http://stackoverflow.com/q/22538330
tags question: http://stackoverflow.com/q/22595470
tags question: http://stackoverflow.com/q/22574305
tags question: http://stackoverflow.com/q/22626997
tags question: http://stackoverflow.com/q/22553133
tags question: http://stackoverflow.com/q/22495434
tags question: http://stackoverflow.com/q/22611540
tags question: http://stackoverflow.com/q/22637651
tags question: http://stackoverflow.com/q/22546684
tags question: http://stackoverflow.com/q/22599435
tags question: http://stackoverflow.com/q/22515540
tags question: http://stackoverflow.com/q/22574396
tags question: http://stackoverflow.com/q/22644146
tags question: http://stackoverflow.com/q/22619924
tags question: http://stackoverflow.com/q/22498138
tags question: http://stackoverflow.com/q/22498085
tags question: http://stackoverflow.com/q/22503005
tags question: http://stackoverflow.com/q/22602143
tags question: http://stackoverflow.com/q/22501765
tags question: http://stackoverflow.com/q/22512865
tags question: http://stackoverflow.com/q/22488194
tags question: http://stackoverflow.com/q/22641472
tags question: http://stackoverflow.com/q/22560163
tags question: http://stackoverflow.com/q/22558161
tags question: http://stackoverflow.com/q/22519006
tags question: http://stackoverflow.com/q/22646961
tags question: http://stackoverflow.com/q/22599719
tags question: http://stackoverflow.com/q/22513427
tags question: http://stackoverflow.com/q/22590357
tags question: http://stackoverflow.com/q/22550534
tags question: http://stackoverflow.com/q/22539229
tags question: http://stackoverflow.com/q/22646235
tags question: http://stackoverflow.com/q/22586835
tags question: http://stackoverflow.com/q/22642961
tags question: http://stackoverflow.com/q/22645836
tags question: http://stackoverflow.com/q/22524178

http://stackoverflow.com/q/22565869
has comment: http://stackoverflow.com/comment/34347723
tagged with: jackson
favorite count: 0
has body: I'm working with a rather complex use case with Boolean Queries. In this particular case, I need to be able to store JSON in Scala classes to help make queries throughout several APIs. It's rather easy to create sophisticated JSON structures for these queries, but structuring them into Jackson-friendly classes has been a little challenging. (Seems non-trivial in a type-safe language) Here's a JSON sample: { "bool": { "must": [{ "or": [ { "term": { "tz": "America/Vancouver" } }, { "and": [ { "term": { "gender": "female" } }, { "term": { "age": 30 } } ] } ] }] } } You can see above there are nested operators. So building something to model this is rather tricky. Is there a repo that has already solved this problem? Does anyone have a simple solution? case class Condition( @(JsonProperty@field)("and") val and: Option[List[FormulaCondition]], @(JsonProperty@field)("or") val or: Option[List[FormulaCondition]], @(JsonProperty@field)("field") val field: Option[String], @(JsonProperty@field)("comparison") val comparison: Option[String], @(JsonProperty@field)("value") val value: Option[String] ) So far I've just created a base class called Condition that handles all string fields, but this far from an elegant solution. If the "term" is an Int instead of a String this class fails. Really appreciate your help on this.
answer count: 0
downvote count: 0
tagged with: scala
type: UnansweredQuestion
tagged with: boolean-expression
has title: Scala Jackson/Jerkson deserialize a complex boolean query (AST)?
type: Question
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34347951
upvote count: 1

http://stackoverflow.com/comment/81057330
score: 0
type: Comment
has text: In Ubuntu 16.04, openjfx package places it in <JRE_HOME>/lib/ext/jfxrt.jar , exactly as described here.
comment on: http://stackoverflow.com/a/22516005
type: AnswerComment

http://stackoverflow.com/comment/34410763
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22600556
has text: You can also get rid of the three lines that have `finalImage` in them; they're not doing anything.

http://stackoverflow.com/comment/34959597
has text: Great, Finally you have done it.
score: 0
comment on: http://stackoverflow.com/q/22563331
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22605636
tagged with: java
tagged with: eclipse
downvote count: 0
tagged with: console
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22605979
score: 1
favorite count: 0
tagged with: terminal
linked to: http://stackoverflow.com/q/104254
has comment: http://stackoverflow.com/comment/34419093
has comment: http://stackoverflow.com/comment/34418969
has title: Why does my Java program work in console and not in Eclipse?
upvote count: 1
answer count: 1
has body: I wanted to know why does my Java program work in console when I do : javac Main.java java Main ...and not in Eclipse, as I have this error : Exception in thread "main" java.lang.NullPointerException at codePin.main.main(main.java:48) --> char passwordArray[] = console.readPassword("Enter pin: "); Here's my code : package codePin; import java.io.*; import java.util.*; public class main { static public boolean readPinsData(File dataFile, ArrayList&lt;Integer&gt; data) { boolean err = false; try { Scanner scanner = new Scanner(dataFile); String line; while (scanner.hasNext()) { line = scanner.nextLine(); try { data.add(Integer.parseInt(line)); } catch (NumberFormatException e) { e.printStackTrace(); err = true; } } scanner.close(); } catch (FileNotFoundException e) { e.printStackTrace(); err = true; } return err; } public static void main(String[] args) { System.out.println("-----------------------"); System.out.println("APPLICATIONS BESOINS"); System.out.println("-----------------------"); Console console = System.console(); System.out.println(console == null); int pinSize = 0; int nbTry = 0; boolean authenticated = false; do { do { char passwordArray[] = console.readPassword("Enter pin: "); //This is the line causing the error pinSize = passwordArray.length; if (pinSize != 4) { System.out.println("Pin must be 4 digits"); } else { System.out.println("Checking..."); } ArrayList&lt;Integer&gt; pins = new ArrayList&lt;Integer&gt;(); readPinsData(new File("bdd.txt"), pins); String[] thePins = new String[pins.size()]; for (int i = 0; i &lt; thePins.length; i++) { thePins[i] = pins.get(i).toString(); } String passEntered = String.valueOf(passwordArray); for (int i = 0; i &lt; thePins.length; i++) { if (passEntered.equals(thePins[i]) &amp;&amp; pinSize == 4) { System.out.println(":)"); authenticated = true; break; } } } while (pinSize != 4); if (!authenticated &amp;&amp; pinSize == 4) { System.out.println(":("); nbTry++; } } while (nbTry &lt; 3 &amp;&amp; !authenticated); }…
has comment: http://stackoverflow.com/comment/34420133
accepted answer: http://stackoverflow.com/a/22605979

http://stackoverflow.com/comment/46328704
comment on: http://stackoverflow.com/a/29040610
type: Comment
has text: And separating content and design is simply best practise. Would you _really_ want to change the localization just because the designer decided he wants the headlines in uppercase instead of capitalized string? d) I am totally aware of the fact that calling toUpper (which converts _all_ characters in a String to the uppercase equivalents, if applicable) is very different from capitalization, which converts the first character of each word in a string (or, to be more exact, each character following a word boundary) to its uppercase equivalent.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34484766
has text: Thanks i think that should work but when i type in the imagebutton i get the error "imageShare" cannot be resolved or is not a field"?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22642078

http://stackoverflow.com/q/22603153
linked to: http://stackoverflow.com/q/7856959
favorite count: 0
upvote count: 9
has comment: http://stackoverflow.com/comment/34414987
tagged with: android
has body: I have been able to change colour of an activity background (see this post). Now a requirement is to do the same with background image. I mean I can click a button, select an option and change the current Activity background image to the new one. Here is what I have done: private SharedPreferences prefs; private static final String SELECTED_ITEM = "SelectedItem"; private Editor sharedPrefEditor; btnchangeColor = (ImageButton) findViewById(R.id.btnchangeColor); btnchangeColor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final CharSequence[] items={getString(R.string.default),getString(R.string.pix1), getString(R.string.pix2))}; AlertDialog.Builder builder = new AlertDialog.Builder( ContentView.this); builder.setTitle((getResources().getString(R.string.color_switch))); builder.setPositiveButton((R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.setSingleChoiceItems(items, getSelectedItem(), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { wvContent = (WebView) findViewById(R.id.wvContent); int bg_color=0; if(getString(R.string.default).equals(items[which])) { wvContent.setBackgroundColor(0); BitmapDrawable bg = (BitmapDrawable)getResources().getDrawable(R.drawable.default); bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT); wvContent.setBackgroundDrawable(bg); bg_color=R.drawable.default; } else if(getString(R.string.pix1).equals(items[which])) { wvContent.setBackgroundColor(0); BitmapDrawable bg = (BitmapDrawable)getResources().getDrawable(R.drawable.pix1); bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT); wvContent.setBackgroundDrawable(bg); bg_color=R.drawable.pix1; } else if(getString(R.string.pix2).equals(items[which])) { wvContent.setBackgroundColor(0); BitmapDrawable bg = (BitmapDrawable)getResources().getDrawable(R.drawable.pix2); bg.setTileModeXY(TileMode.REPEAT, TileMode.R…
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/22603205
has comment: http://stackoverflow.com/comment/34417180
tagged with: java
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/34417425
has comment: http://stackoverflow.com/comment/34416404
has answer: http://stackoverflow.com/a/22603270
type: Question
score: 9
tagged with: android-layout
has answer: http://stackoverflow.com/a/22603205
accepted answer: http://stackoverflow.com/a/22603350
answer count: 3
has title: How to programmatically change the background image of an Android Activity
has answer: http://stackoverflow.com/a/22603350
has comment: http://stackoverflow.com/comment/34417863
has comment: http://stackoverflow.com/comment/34416987
linked to: http://stackoverflow.com/q/22574678

http://stackoverflow.com/q/22550668
score: 5
has comment: http://stackoverflow.com/comment/34356355
answer count: 1
has answer: http://stackoverflow.com/a/23205103
accepted answer: http://stackoverflow.com/a/23205103
downvote count: 0
favorite count: 0
has body: In my code, I am interested about listening to changes to a SimpleDoubleProperty. Here's the signature for it's addListener method: public void addListener(ChangeListener&lt;? super Number&gt; listener) How does a property that fires changes to a Double value, require it's listener to listen to Number or one of it's super types?. Shouldn't it be defined like that: public void addListener(ChangeListener&lt;? extends Double&gt; listener) An example class that has the property: HasObservableProperty.java public class HasObservableProperty { private final SimpleDoubleProperty progress = new SimpleDoubleProperty(); ... public void addProgressChangeListener(ChangeListener&lt;? super Number&gt; listener) { progress.addListener(listener); } } And so it goes, I have a listener defined as: class ProgressBarNotifier implements ChangeListener&lt;Number&gt; { private final ProgressBar progress_bar; public ProgressBarNotifier(ProgressBar bar) { progress_bar = bar; } @Override public void changed(ObservableValue&lt;? extends Number&gt; progress, Number oldValue, Number newValue) { progress_bar.setProgress((Double)newValue); } } See how I was forced to cast the changed value to Double: progress_bar.setProgress((Double)newValue); This shouldn't be the case if the addListener method had the suggested signature. So, the question is, is SimpleDoubleProperty.addListener method wrongly declared? PS: what applies to SimpleDoubleProperty seems to apply to other observables, like SimpleStringProperty.
has comment: http://stackoverflow.com/comment/34348995
has title: Is the JavaFX SimpleDoubleProperty.addListener method wrongly declared?
has comment: http://stackoverflow.com/comment/34322768
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34350469
upvote count: 5
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/34327379
type: Question
has comment: http://stackoverflow.com/comment/34346780

http://stackoverflow.com/comment/34411424
type: Comment
score: 1
type: QuestionComment
has text: Have you tried it? You could save us some time if you tried it and posted the results.
comment on: http://stackoverflow.com/q/22601195

http://stackoverflow.com/a/22539109
type: Answer
has comment: http://stackoverflow.com/comment/34414244
score: 2
has comment: http://stackoverflow.com/comment/34300918
has comment: http://stackoverflow.com/comment/34301482
has body: You need to specify a CharacterSet when creating the BufferedReader, otherwise the platform default encoding is used: BufferedReader br = new BufferedReader(new FileReader(inputFile),"UTF-8");
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22538964

http://stackoverflow.com/a/22524145
score: 0
type: Answer
has body: How about just changing the first j=1 to j=2 and changing the first j=5 to j=4, so that you get one less zero from each of those loops?
answers question: http://stackoverflow.com/q/22523999

http://stackoverflow.com/comment/34224450
has text: so you means that your data should be persistent when your app is kill by user ??? if yes then you have to store your editttext value in sharedPrefrences .
score: 1
comment on: http://stackoverflow.com/q/22495434
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22491368
upvote count: 4
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34218095
has comment: http://stackoverflow.com/comment/34217560
accepted answer: http://stackoverflow.com/a/22545101
favorite count: 0
has answer: http://stackoverflow.com/a/22491644
type: Question
has comment: http://stackoverflow.com/comment/34217904
answer count: 2
has comment: http://stackoverflow.com/comment/34217566
has comment: http://stackoverflow.com/comment/34217846
tagged with: design-patterns
possible better answer: http://stackoverflow.com/a/22491644
has comment: http://stackoverflow.com/comment/34217681
tagged with: oop
has comment: http://stackoverflow.com/comment/34218006
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/34217668
has answer: http://stackoverflow.com/a/22545101
has comment: http://stackoverflow.com/comment/34217414
has comment: http://stackoverflow.com/comment/34218045
has body: I have two similar concrete classes that are provided by two different third parties (I cannot modify them). Is it ok if I use the classic GoF adapter pattern but instead have my adapter extend the concrete target class? Or is this bad? Example: public class A { public void doSomething() { // some code } } public class B { public void similarDoSomethingMethod() { // some code } } public class BAdapter extends A { private B b; public BAdapter(B b) { this.b = b; } @Overrides public void doSomething() { b.similarDoSomethingMethod(); } }
has title: Ok to use adapter pattern on concrete classes?

http://stackoverflow.com/comment/34359851
type: QuestionComment
has text: many many many many years ago I had to deal with a bioinformatics dataset in XML that was something near the size of yours. I remember I've used some obscure experimental java library that could infer the table structure from the XML DTD, parse the XML and generate the CSV for each table. Despite it was a quite big file, there were something like 4-6 tables only. I was using mysql at that time. I remember that mysqlimport for CSV was the fastest thing I ever seen (like of course any other native DBMS import tool) to push this data into the DB. Not a pretty way to do the job, but fast.
type: Comment
comment on: http://stackoverflow.com/q/22569306
score: 0

http://stackoverflow.com/comment/34430276
has text: Implement [Comparable](http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html)?
comment on: http://stackoverflow.com/q/22611891
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/a/22624655
type: Answer
has body: Answer here: Upgrade vRaptor to 3.5.3 java.lang.NoClassDefFoundError: br/com/caelum/vraptor/validator/Validator from: @andregnhoato (Brasileiro LINDO DO MEU CORAÇÃO) Figured out what was happening with the upgrade process. I'm using the project, a jar that manages instances of EntityManager vraptor-jpa, when I kept the update, it occasioned the error. Compatibility could be: vraptor in version 3.4.2, use the plugin vraptor-jpa-4.0.0.jar vraptor in version 3.5.3, the plugin uses vraptor-jpa-1.0.1.jar This change was enough to solve the problem.
answers question: http://stackoverflow.com/q/22623597
score: 0

http://stackoverflow.com/comment/34423706
type: Comment
type: QuestionComment
has text: @ OGP: I'd put that information right up front in the question. What do you mean by *"apparently"* the view of the browser? It's your code, you should know what `obj` is, specifically and certainly.
comment on: http://stackoverflow.com/q/22608017
score: 0

http://stackoverflow.com/comment/34450688
comment on: http://stackoverflow.com/q/22622979
type: Comment
type: QuestionComment
has text: Where exactly do you want to go after the authentication? You are currently breaking out of the loop, which sends it to the code below, but... there is no code below.
score: 0

decimalformat
tags question: http://stackoverflow.com/q/22631089
type: Tag
tag name: decimalformat

http://stackoverflow.com/a/22545677
answers question: http://stackoverflow.com/q/22545644
has comment: http://stackoverflow.com/comment/34313530
has comment: http://stackoverflow.com/comment/34313671
has comment: http://stackoverflow.com/comment/34313423
has comment: http://stackoverflow.com/comment/34312693
has comment: http://stackoverflow.com/comment/34313933
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34312946
has comment: http://stackoverflow.com/comment/34312671
has comment: http://stackoverflow.com/comment/34313478
has comment: http://stackoverflow.com/comment/34313232
type: Answer
has comment: http://stackoverflow.com/comment/34313610
has comment: http://stackoverflow.com/comment/34313482
has comment: http://stackoverflow.com/comment/84386151
has comment: http://stackoverflow.com/comment/34313282
has comment: http://stackoverflow.com/comment/34313061
has comment: http://stackoverflow.com/comment/34312712
has comment: http://stackoverflow.com/comment/34312678
has comment: http://stackoverflow.com/comment/84386284
has body: Using the old java date api (not recommended, see comments): int sec = .... // Date d = new Date(sec * 1000L); SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); // HH for 0-23 df.setTimeZone(TimeZone.getTimeZone("GMT")); String time = df.format(d); See also SimpleDateFormat. Note: as per comments, if the number of seconds exceeds the number of seconds in a day (86400) that won't work as expected. In that case a different approach must be taken. EDIT: If you're using JDK 8 you can write: int sec = ... Duration duration = Duration.ofSeconds(sec); This duration object better represents what you're talking about. I am trying to find out how to format it as you want to but I have had no luck so far. EDIT 2: prior to JDK 8 you can use the Joda API: int sec = ... Period period = new Period(sec * 1000L); String time = PeriodFormat.getDefault().print(period); // you can customize the format if this one doesn't cut it That's probably the most elegant solution. See also this. EDIT 3: As per comments, I explicitly added the time zone.
score: 16
accepted answer of: http://stackoverflow.com/q/22545644
upvote count: 16

http://stackoverflow.com/comment/34277086
type: Comment
type: QuestionComment
score: 1
has text: The JVM should be deferring to the highest authority. The Jars in the ext directory get loaded first, so when the class loaders go looking class, they check the parents first...from memory...so they should find the classes from the ext directory first
comment on: http://stackoverflow.com/q/22523644

http://stackoverflow.com/a/32227068
score: 0
upvote count: 1
downvote count: 1
type: Answer
has body: As object? equals public boolean equals(Object obj) Returns true if and only if the argument is not null and is a Boolean object that represents the same boolean value as this object. Overrides: equals in class Object Parameters: obj - the object to compare with. Returns: true if the Boolean objects represent the same value; false otherwise. boolean a = true; boolean b = false; System.out.println("a.equals(b):" + ((Object)a).equals( ((Object)b) )); Output: a.equals(b):false
answers question: http://stackoverflow.com/q/22491853

http://stackoverflow.com/q/22496418
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/2943556
has title: why is class.forname(com.mysql.jdbc.Driver) written in a db connection class?
favorite count: 0
has comment: http://stackoverflow.com/comment/34226036
linked to: http://stackoverflow.com/q/19390942
tagged with: jdbc
type: UnansweredQuestion
downvote count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/8053095
has body: I have written a dbconnection.java class and it has a static block where i load the driver class static { try { Class.forName(com.mysql.jdbc.Driver); } catch(ClassNotFoundException e) { e.printStackTrace(); } } I know that this static block is written to register the driver. but even when i comment this static block and try to make a database connection it is getting connected. So i wanted to know What Is The Importance or Significance of writing this static block.
has answer: http://stackoverflow.com/a/22496618
has answer: http://stackoverflow.com/a/22496668
duplicate of: http://stackoverflow.com/q/8053095
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/34226020

http://stackoverflow.com/a/22596603
score: -2
has comment: http://stackoverflow.com/comment/34403311
has comment: http://stackoverflow.com/comment/34405990
has comment: http://stackoverflow.com/comment/34404175
has comment: http://stackoverflow.com/comment/34405529
has comment: http://stackoverflow.com/comment/34403349
upvote count: 2
has comment: http://stackoverflow.com/comment/34403134
has body: Should I reconsider the common best-practice advice to never use bitfields? Yes. You should generally reconsider any advice that contains the words "always" or "never", no matter if it is "common" or not so common.
has comment: http://stackoverflow.com/comment/34405558
has comment: http://stackoverflow.com/comment/34405792
answers question: http://stackoverflow.com/q/22596495
downvote count: 4
has comment: http://stackoverflow.com/comment/34403367
has comment: http://stackoverflow.com/comment/34406374
has comment: http://stackoverflow.com/comment/34403775
has comment: http://stackoverflow.com/comment/34405734
has comment: http://stackoverflow.com/comment/34403867
has comment: http://stackoverflow.com/comment/34407142
has comment: http://stackoverflow.com/comment/34413470
type: Answer

http://stackoverflow.com/q/22595349
has title: Is adding code just for unit testing sake accepted practice
answer count: 2
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/34400898
favorite count: 0
has answer: http://stackoverflow.com/a/22595612
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6060848
score: 2
has comment: http://stackoverflow.com/comment/34470400
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/1180044
has body: I am testing two objects using junits, and it appears that I need to override equals in the object so that junit can do a valid assertEquals. But other than junits, there no place in code I need to ever compare two objects. Thus, keeping unit testing aside, I never really need to use the overriden equals. This means I am adding code only for unit testing. Is this a necessary evil ? Is there any work around ?
has comment: http://stackoverflow.com/comment/34400878
has answer: http://stackoverflow.com/a/22595622

http://stackoverflow.com/comment/34340020
score: 0
comment on: http://stackoverflow.com/q/22553611
type: Comment
has text: Because in the JAVA API, they alway use List in double colon examples. I just wonder if double colon can be used in Map.
type: QuestionComment

http://stackoverflow.com/q/22554425
linked to: http://stackoverflow.com/q/22573958
upvote count: 3
has title: where can I download Java 8 base profile?
has comment: http://stackoverflow.com/comment/34471202
answer count: 1
has answer: http://stackoverflow.com/a/22554785
favorite count: 0
type: UnansweredQuestion
tagged with: java-8
score: 3
downvote count: 0
tagged with: java
has body: I am under the impression that with version 8, we would be able to download parts of the jdk we need and it will be full functional. I am unable to locate java 8 compact profile anywhere. (not the early access versions)
type: Question

http://stackoverflow.com/comment/34340754
comment on: http://stackoverflow.com/q/22535252
score: 0
type: QuestionComment
type: Comment
has text: Hence my extreme confusion. I'm still at a loss.

http://stackoverflow.com/comment/34319879
type: QuestionComment
has text: You want a 3D cube, that can be rotated, etc??
comment on: http://stackoverflow.com/q/22549690
score: 0
type: Comment

http://stackoverflow.com/comment/34276567
type: Comment
type: QuestionComment
has text: Have you set the project's language level to Java 7? Seems as though you're trying to compile it with a lower language level.
comment on: http://stackoverflow.com/q/22525162
score: 0

http://stackoverflow.com/comment/34464132
type: QuestionComment
has text: @anish excuse me, which is the difference?
comment on: http://stackoverflow.com/q/22630766
score: 0
type: Comment

http://stackoverflow.com/q/22539015
accepted answer: http://stackoverflow.com/a/22539452
has title: Object methods in android extended array adapter
tagged with: android
tagged with: java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22539452
tagged with: android-arrayadapter
tagged with: listview
score: 0
has body: I am having the following object in my activity class: /** * Item object */ class OrderItem { /** * Private params */ private String item_name; private Double item_price; private Integer quantity; public void OrderItem(String name, Double price, Integer qt){ /** * Init the object properties */ this.item_name = name; this.item_price = price; this.quantity = qt; } /** * Getters and setters */ public String getName(){ return this.item_name; } public void setName(String name){ this.item_name = name; } public Double getPrice(){ return this.item_price; } public void setPrice(Double price){ this.item_price = price; } public Integer getQuantity(){ return this.quantity; } public void setQuantity(Integer qt){ this.quantity = qt; } } and I am using this object to update a ListView item. So I've set up a custom adapter for the list, to handle the current object, and add the data to the given view. Here is the code of my adapter: class OrderObjectAdapter&lt;OrderItem&gt; extends ArrayAdapter&lt;OrderItem&gt;{ private final Context context; private final List&lt;OrderItem&gt; object; public OrderObjectAdapter(Context context,List&lt;OrderItem&gt; object){ super(context, R.layout.order_object_layout, object); this.context = context; this.object = object; } @Override public View getView(int position, View conertView, ViewGroup parent){ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.order_object_layout, parent, false); /** Gather items from the view */ TextView p_name = (TextView) rowView.findViewById(R.id.product_name); TextView p_value = (TextView) rowView.findViewById(R.id.product_value); TextView p_quantity = (TextView) rowView.findViewById(R.id.product_quantity); /** Asign data to the text views */ OrderItem item = (OrderItem) object.get(position); p_name.setText(""); return rowView; } } and this is how I use it: /** * Init the order_items adapter */ order_details_list_view = (ListVi…
answer count: 1

http://stackoverflow.com/q/22621535
answer count: 2
has comment: http://stackoverflow.com/comment/34448279
tagged with: arrays
downvote count: 0
favorite count: 0
tagged with: serialization
linked to: http://stackoverflow.com/q/2836646
has answer: http://stackoverflow.com/a/22621651
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34448622
upvote count: 2
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/22621651
has comment: http://stackoverflow.com/comment/34448475
has answer: http://stackoverflow.com/a/22621622
accepted answer: http://stackoverflow.com/a/22621622
has body: Lets supose I define a class public class PointFloat { float x; float y; } Then I instantiate an array PointFloat[] points = new PointFloat[10]; At this point I have an array of ten PointFloat Objects. Lets supose that some code assigns values x and y to every pointfloats. What I need is to store that array in a VARBINARY in a Mysql database. To accomplish this I would need to convert this array of PointFloats to byte[] so I can insert into the database using a PreparedStatement Nothing new for me to use a PreparedStatement but first time using objects serialization. How do you convert an array of PointFloat of any size to a byte[]?. Please keep it as simple as possible. Thank you very much for reading.
has comment: http://stackoverflow.com/comment/34450782
has title: Java. Serialization an array

http://stackoverflow.com/a/28447898
downvote count: 2
score: 0
has body: by default servlets are intrinsic multithreaded. so only single instance be created and will be accessed by multiple threads.
type: Answer
answers question: http://stackoverflow.com/q/22544152
upvote count: 2

http://stackoverflow.com/q/22509488
has answer: http://stackoverflow.com/a/22512136
has comment: http://stackoverflow.com/comment/34247699
answer count: 3
possible better answer: http://stackoverflow.com/a/22512136
has comment: http://stackoverflow.com/comment/34260305
linked to: http://stackoverflow.com/q/23381764
tagged with: generics
has answer: http://stackoverflow.com/a/23880278
favorite count: 0
has comment: http://stackoverflow.com/comment/36780388
score: 32
accepted answer: http://stackoverflow.com/a/23880278
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34252444
tagged with: java
has comment: http://stackoverflow.com/comment/34248594
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22534231
has comment: http://stackoverflow.com/comment/34253886
has body: This class compiles ok in Java 7, but not in Java 8: public class Foo { public static void main(String[] args) throws Exception { //compiles fine in Java 7 and Java 8: Class&lt;? extends CharSequence&gt; aClass = true ? String.class : StringBuilder.class; CharSequence foo = foo(aClass); //Inlining the variable, compiles in Java 7, but not in Java 8: CharSequence foo2 = foo(true ? String.class : StringBuilder.class); } static &lt;T&gt; T foo(Class&lt;T&gt; clazz) throws Exception { return clazz.newInstance(); } } Compilation error: Error:(9, 29) java: method foo in class Foo cannot be applied to given types; required: java.lang.Class found: true ? Str[...]class reason: inferred type does not conform to equality constraint(s) inferred: java.lang.StringBuilder equality constraints(s): java.lang.StringBuilder,java.lang.String Why has this stopped working in Java 8? Is it intentional / a side effect of some other feature, or is it simply a compiler bug?
has title: Generics compilation error with ternary operator in Java 8, but not in Java 7
upvote count: 33
has comment: http://stackoverflow.com/comment/34260379
linked to: http://stackoverflow.com/q/5385743
has comment: http://stackoverflow.com/comment/34259746

http://stackoverflow.com/comment/34419203
has text: @ a_horse_with_no_name i am using sql server.As per my understanding select will create the lock during execution of statement not for whole transaction
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22605546
type: QuestionComment

http://stackoverflow.com/q/22572090
has answer: http://stackoverflow.com/a/22572543
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34359679
tagged with: string
has body: Consider the string below: 1.2+3.4*(3.2+2.3)-12.1/3.4*1.8+5.7 How do I extract each double and each sign into an array,like the one below ? a[1]=1.2,a[2]=+,a[3]=3.4,a[4]=*,a[5]=(...
favorite count: 0
score: 0
has title: Extracting digits and signs into an array?
has answer: http://stackoverflow.com/a/22572780
answer count: 4
has comment: http://stackoverflow.com/comment/34360059
has comment: http://stackoverflow.com/comment/34359432
has comment: http://stackoverflow.com/comment/34359606
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34359580
has answer: http://stackoverflow.com/a/22572274
tagged with: java
has answer: http://stackoverflow.com/a/22572243
type: Question

http://stackoverflow.com/comment/34484288
score: 0
type: Comment
type: QuestionComment
has text: Well that's embarrassing! I am now sure I'm to tired to write anymore code.
comment on: http://stackoverflow.com/q/22641901

http://stackoverflow.com/comment/34359815
comment on: http://stackoverflow.com/a/22569900
type: AnswerComment
has text: `forEach()` always implies `unordered()`, and `forEachOrdered()` typically prevents parallelism.
score: 0
type: Comment

http://stackoverflow.com/comment/34438159
type: AnswerComment
comment on: http://stackoverflow.com/a/22616197
type: Comment
score: 2
has text: No, your query is written in SQL. The `INSERT` statement is clearly a SQL statement. You are using Java in order to construct the text of your query and send it to the DB.

http://stackoverflow.com/a/22579064
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22552646
upvote count: 1
has body: Why output of numeric field, at table above, show java.math.BigDecimal? As per Oracle documentation on Datatypes and their Java Mappings: NUMBER: The NUMBER class provides conversions between the Oracle Number (lnxnum_t) data type and Java types byte[], byte, short, integer, long, float, double, String, BigInteger, and BigDecimal. Understanding Type Maps: The type map relates a Java class to the SQL type name of an Oracle object. This is a one-to-one mapping that is stored in a hash table as a key-value pair. When you read data from an Oracle object, the JDBC driver considers the type map to determine which Java class to use to materialize the data from the SQL object type. When you write data to an Oracle object, the JDBC driver gets the SQL type name from the Java class by calling the getSQLTypeName() method of the SQLData interface. The actual conversion between SQL and Java is handled by the driver. This is default behaviour and you can find it on the getObject methods underlying return type. For a data type of NUMBER the return type is java.math.BigDecimal. +-----------------+------------------------+------------------------+ | Oracle SQL Type | getObject() | getOracleObject() | | | Underlying Return Type | Underlying Return Type | +-----------------+------------------------+------------------------+ | CHAR | String | oracle.sql.CHAR | | VARCHAR2 | String | oracle.sql.CHAR | | LONG | String | oracle.sql.CHAR | | NUMBER | java.math.BigDecimal | oracle.sql.NUMBER | | RAW | byte[] | oracle.sql.RAW | | LONGRAW | byte[] | oracle.sql.RAW | | DATE | java.sql.Timestamp | oracle.sql.DATE | +-----------------+------------------------+------------------------+ An example of understanding the Java return types on database specific data types are shown in an example on the Summary page referred below. Similar example was presented in my previous answer on this post. Conclusion: Return types are database driver specific. If you want to cast them for your convenience or for a…

http://stackoverflow.com/a/22543967
score: 1
has comment: http://stackoverflow.com/comment/34311559
has comment: http://stackoverflow.com/comment/34312641
answers question: http://stackoverflow.com/q/22543701
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22543701
upvote count: 1
type: Answer
has body: What is the purpose of the unique word ID? Is the word itself not unique enough since you are not keeping duplicates? A very basic way would be to keep a counter going as you are checking new words. For each word that doesn't already exist you could increase the counter and use the new value as the unique id. Lastly, might I suggest you use a HashMap instead. It would allow you to both insert and retrieve words in O(1) time. I am not entirely sure what you are going for, but I think the HashMap might give you more range. Edit2: It would be something a little more along these lines. This should help you out. public static Set&lt;DataPair&gt; getAllWords(String[] tempsArray) { Set&lt;DataPair&gt; set = new HashSet&lt;&gt;(); for (String row : tempsArray) { // PARSE YOUR STRING DATA // the way you were doing it seemed fine but something like this String[] rowArray = row.split(" "); String word = row[1]; int id = Integer.parseInt(row[0]); DataPair pair = new DataPair(word, id); set.add(pair); } return set; } class DataPair { private String word; private int id; public DataPair(String word, int id) { this.word = word; this.id = id; } public boolean equals(Object o) { if (o instanceof DataPair) { return ((DataPair) o).word.equals(word) &amp;&amp; ((DataPair) o).id == id; } return false; } }
has comment: http://stackoverflow.com/comment/34310708
downvote count: 0

http://stackoverflow.com/a/22597151
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22597067
answers question: http://stackoverflow.com/q/22597067
type: Answer
score: 2
upvote count: 2
has body: The fact that a TreeSet(Collection) constructor exists at all is an additional convenience to begin with. Internally, the implementation simply calls the Comparator constructor then addAll(). I'd imagine they simply did not include further conveniences. There is no particular reason why such a constructor couldn't exist. However, conceptually, it is a little odd to specify both a source collection and an initial comparator, since constructing a TreeSet by specifying a collection to the constructor, to me at least, indicates that the resulting TreeSet will be a copy of the input set (in that it contains the same elements) - simply by convention. Being able to supply a Comparator in addition to a Collection allows for the possibility that the new TreeSet does not end up containing the same elements if, e.g., the input was another TreeSet but the new Comparator makes some elements identical. To that end, forcing you to call addAll() in such a case also forces you to use code that clearly indicates your intentions. That said, if the natural ordering of the items in the source collection conflict with any comparator that a source set may have used, it still presents the same possibility when TreeSet(Collection) is used. Edit: The previous statement isn't quite true. If the source set is the type of set that uses a custom comparator, then it is actually a SortedSet, and the TreeSet(SortedSet) constructor is used instead, which takes on the same comparator as the source set. So unless you go out of your way to construct a non-SortedSet middle-man, the current collection of TreeSet constructors will not let you create a TreeSet that leads to a different set of elements than the source had. In other words: By not providing the Collection+Comparator constructor you are asking about, the designers have also eliminated the possibility of changing the comparator via constructor; thus a newly constructed TreeSet will always have the same elements in it as the source collection, i…
type: AcceptedAnswer

http://stackoverflow.com/comment/87633585
score: 0
type: AnswerComment
has text: what is the relevant string in the output in the op which reveals this to be the threading issue?
type: Comment
comment on: http://stackoverflow.com/a/24255649

http://stackoverflow.com/a/22627482
has comment: http://stackoverflow.com/comment/34458811
type: Answer
has comment: http://stackoverflow.com/comment/34459745
has comment: http://stackoverflow.com/comment/34459976
has body: Interesting picture :). I think "set min to item "pass" of "listToSort" basically means: min=listToSort[pass]
has comment: http://stackoverflow.com/comment/34458959
score: 0
answers question: http://stackoverflow.com/q/22627017

http://stackoverflow.com/a/22636274
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22635171
has body: This is my approach. I broke the whole interaction up into three methods: The first "tells the story". The second handles the input of the new floor and the third takes the elevator to the destination floor. Thus each method has a clear responsibility and can be altered at a later stage if needs be. // Handles the whole thing public static void elevatorAction() { int currentFloor = 1; int destinationFloor; while(true) { destinationFloor = selectNewFloor(); goToDestinationFloor(currentFloor, destinationFloor); System.out.println("The elevator has arrived"); currentFloor = destinationFloor; } } // Handles the traveling public static void goToDestinationFloor(int currentFloor, int destinationFloor) { int increment; if(currentFloor == destinationFloor) { return; } increment = (currentFloor &lt; destinationFloor? 1: -1); while(currentFloor != destinationFloor) { currentFloor += increment; System.out.println("..." + currentFloor); } } // Lets the user select a new destination floor for the elevator public static int selectNewFloor() { Scanner scnr = new Scanner(System.in); int tempNewFloor; System.out.println("Please choose your destination floor."); while((true) { tempNewFloor = scnr.nextInt(); if(tempNewFloor &lt; 0 || tempNewFloor &gt; 7) { System.out.println("Next floor: " + tempNewFloor); break; } else { System.out.println("Invalid input: Please choose a floor between 1 and 7"); } } }

http://stackoverflow.com/comment/34494534
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22647619
type: Comment
has text: First of all, you should tag this with what _language_ this code is supposed to be in. Second of all, why are you using a _loop_ to count, when as deanosaur already said (well, almost) a simple _subtraction_ could give you the same info much easier?

http://stackoverflow.com/comment/40579560
has text: I also use v7 with min-sdk=11 but "windowContentOverlay" gives "No resource found that matches the given name: attr 'windowContentOverlay'" error in Eclipse. Any help?
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22615043
type: AnswerComment

http://stackoverflow.com/comment/34307555
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22541060
type: QuestionComment
has text: @Sun W Kim I am not clear which appdata directory you are talking about? could you explain a bit more, doing this solved your problem?

http://stackoverflow.com/q/22535868
score: 0
has answer: http://stackoverflow.com/a/22536007
has body: EDIT: you guys are really fast at answering. I love it. I can not believe I missed the fact that I tried instantiating the NumberFormat class meanwhile when I previously used it, I didn't do that. I stared at this code for so long too. Looks like I have a lot to learn when it comes to paying close attention to detail. Thanks, everyone. I'm using the NumberFormat class (or method, I'm still getting used to the terminology), but when I compile the program I get a "cannot find symbol" pointing at the decimal in "NumberFormat.getPercentInstance();" but I don't underhand why. Here's the code: import java.util.Scanner; import java.text.NumberFormat; public class StudentAverages { //---------------------------------------------------------------- // Reads a grade from the user and prints averages accordingly. //---------------------------------------------------------------- public static void main (String [] args) { Scanner scan = new Scanner(System.in); NumberFormat fmt = new NumberFormat.getPercentInstance(); System.out.print("Enter the name of the first student: "); String name1 = scan.nextLine(); int lab1, lab2, lab3, min = 0; System.out.print("Enter the lab assignment grades of "+name1+": "); lab1 = scan.nextInt(); lab2 = scan.nextInt(); lab3 = scan.nextInt(); System.out.print("Enter the project grades of "+name1+": "); int proj1 = scan.nextInt(); int proj2 = scan.nextInt(); System.out.print("Enter the midterm grade of "+name1+ ": "); double mid1 = scan.nextDouble(); System.out.print("Enter the final grade of "+name1+": "); double fin1 = scan.nextDouble(); // fin used so as to not confuse with CONSTANT final double avgLab1 = (lab1 + lab2 + lab3) / 3; double avgProj1 = (proj1 + proj2) / 2; double grade1 = (25 * avgLab1 + 40 * avgProj1 + 15 * mid1 + 20 * fin1) / 10000; System.out.println(); System.out.println("Student's name " + name1); System.out.println("Lab average for "+name1+": " + avgLab1); System.out.println("Project average for "+name1+": " + avgProj1); System.…
answer count: 3
possible better answer: http://stackoverflow.com/a/22535932
has answer: http://stackoverflow.com/a/22535932
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22535938
tagged with: java
type: Question
tagged with: syntax-error
tagged with: number-formatting
has title: Why am I getting a "cannot find symbol" when I compile?
accepted answer: http://stackoverflow.com/a/22535938

http://stackoverflow.com/comment/34281316
has text: I have looked into the ics, they are creating individual events for the next 2 years, along with that they are adding `RECURRENCE-ID;VALUE=DATE:20160308' and i still don't know what they meant by that.!
comment on: http://stackoverflow.com/a/22500159
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34288537
score: 1
type: QuestionComment
has text: "I create a stream": how? "I calcul[ate] the checksum for it": how? Code please
comment on: http://stackoverflow.com/q/22532217
type: Comment

http://stackoverflow.com/q/22626465
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34456820
type: Question
tagged with: javascript
score: 0
linked to: http://stackoverflow.com/q/7592758
type: UnansweredQuestion
has body: I am new in javascript. How should be Arraylist of values in java assigned to javascript array? or what are the ways to retrieve Arraylist values in java and store it in javascript variable? Thanks.
has comment: http://stackoverflow.com/comment/34456814
has title: Retrieving Arraylist values in java and store them to javascript array

http://stackoverflow.com/q/22594303
tagged with: web-services
score: 2
tagged with: java
linked to: http://stackoverflow.com/q/2811001
has answer: http://stackoverflow.com/a/22594367
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has body: I am a newbie to SOAP services, I want to extract XML from the following SOAP response which belongs to corresponding SOAP request, so my XML is contained in a String tag. I want to extract the xml from the String Tag. Please give me the solution with an example <?xml version="1.0" encoding="UTF-8"?> STRING 0.00 N/A <Time>N/A N/A N/A N/A N/A N/A N/A N/A N/A - N/A N/A N/A STRING
upvote count: 2
type: UnansweredQuestion
has title: How to Parse SOAP Response from a third party server using Java
tagged with: soap

http://stackoverflow.com/q/22639998
has comment: http://stackoverflow.com/comment/34480396
tagged with: class
tagged with: abstract
has body: I have a problem with my abstract class. Here is my interface: package dovilesUzduotis4; import java.util.ArrayList; public interface Interface1 { void a(ArrayList&lt;K&gt; kM, String g); } and abstract class: package dovilesUzduotis4; import java.util.ArrayList; public abstract class Service implements Interface1 { public void iK(ArrayList&lt;Ks&gt; kM, String g){ K aK = new K(g); kM.add(aK); } } But when I try to use service.iK(kM,g); in main I get the error "service cannot be resolved". How can I correct that?
has answer: http://stackoverflow.com/a/22640485
has comment: http://stackoverflow.com/comment/34480401
answer count: 4
has title: How to use Abstract Class/ Interface correctly?
type: UnansweredQuestion
score: 0
tagged with: interface
has answer: http://stackoverflow.com/a/22640601
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22640057
has answer: http://stackoverflow.com/a/22640287

http://stackoverflow.com/q/22618451
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/34442436
has body: I need to print an array using a loop inside a method. My code works but only for one number. I need to print the array with x increasing by 1 and y increasing by 5. the code should look like this feet meters | meters feet 1.0 0.305 | 20.0 65.574 2.0 0.610 | 25.0 81.967 ... 9.0 2.745 | 60.0 196.721 10.0 3.050 | 65.0 213.115 this is my code double x = 1.0; double y = 20.0; double k = footToMeter(x);//gets footToMeter double m = meterToFoot(y); System.out.print("Feet\tMeters\t| Meters\tFeet"); System.out.printf("\n%.1f\t%.3f\t| %.1f\t%.3f",x,k,y,m); }//close main public static double footToMeter(double foot) { double meter = 0.0; for (int i=0; i&lt;10; i++) { meter = 0.305 * foot; } foot++; return meter; }//close footToMeter public static double meterToFoot(double meter) { double foot = 0.0; for (int i=0; i&lt;65; i++) { foot = 3.279 * meter; } meter++; return foot; }//close meterToFoot
type: Question
tagged with: for-loop
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/22618671
has comment: http://stackoverflow.com/comment/34442961
favorite count: 0
has comment: http://stackoverflow.com/comment/34442501
has title: Print an array using a method that has a loop
accepted answer: http://stackoverflow.com/a/22618671
score: -4
upvote count: 1
tagged with: methods
has comment: http://stackoverflow.com/comment/34442767
has comment: http://stackoverflow.com/comment/34442390
has comment: http://stackoverflow.com/comment/34442503
type: AnsweredQuestion

http://stackoverflow.com/comment/34249413
comment on: http://stackoverflow.com/q/22510425
score: 0
type: Comment
type: QuestionComment
has text: @Goot No, I don't. I have a build.xml and a web.xml, but no pom.xml.

http://stackoverflow.com/q/22560566
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/50714133
downvote count: 0
score: 6
has answer: http://stackoverflow.com/a/22563306
has answer: http://stackoverflow.com/a/22561335
has body: hi i am newbie in java programming but here's my problem i am designing GUI which does some calculation and need to show the inputs and outputs in J table then export them into excel file the code working like charm but when i open the excel file i find it empty .. j Table import java.awt.Desktop; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.UnsupportedEncodingException; import javax.swing.JFileChooser; public class Export extends javax.swing.JFrame { public Export() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {"Channel Model", global.channel_model, global.channel_model}, {"System Bandwidth (MHz)", global.band_width_index, global.band_width_index}, {"Cell Edge Rate (Kbps)", global.Rreq_UL, global.Rreq_DL}, {"Cell edge MCS", global.mcs, global.mcs}, {"Antenna Configuration", global.DL_antenna_config, global.DL_antenna_config}, {"Total RB Number", global.number_of_RB, global.number_of_RB}, {"Tx", "", null}, {"Max Power (dBm)", global.UE_Tx_power, global.UE_Tx_power}, {"Cable Loss (dB)", global.cable_loss, global.cable_loss}, {"Body Loss (dB)", global.body_loss, global.body_loss}, {"Antenna Gain (dB)", global.UE_antennaGain, global.UE_antennaGain}, {"EIRB (dB)", "", null}, {"Rx", null, null}, {"Antenna Gain (dB)", global.UE_antennaGain, global.UE_antennaGain}, {"Cable Loss (dB)", global.cable_loss, global.cable_loss}, {"Body Loss (dB)", global.body_loss, global.body_loss}, {"Noise Figure (dB)", global.UE_noiseFigure, global.UE_noiseFigure}, {"Thermal Noise (dB)", null, null}, {"Interference Margin (dB)", global.Biul, global.Bidl}, {"SINR (dB)",…
type: AnsweredQuestion
tagged with: button
possible better answer: http://stackoverflow.com/a/22563306
favorite count: 0
type: Question
tagged with: swing
upvote count: 6
has title: Export Jtable in excel file
tagged with: excel
accepted answer: http://stackoverflow.com/a/22561335

http://stackoverflow.com/comment/55679626
comment on: http://stackoverflow.com/a/22584273
has text: In both cases HashSet is used which is a poor choice. e.g. add 0 to 10 to a HashSet in any order and it will happen to place them in sorted order. i.e. HashSet isn't so random.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22547408
answers question: http://stackoverflow.com/q/22547344
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34315998
upvote count: 1
has body: I think you've painted over them. This is a singularly awful way to treat your UI code; just what is it you are trying to accomplish by having two rectangles with hard-coded colors at hard-coded positions in your panel?
type: Answer

http://stackoverflow.com/a/22639160
answers question: http://stackoverflow.com/q/22639021
type: Answer
has body: //load desired Class at runtime Class classObj = Class.forName("xyz.abc.YourClassName"); Object obj = classObj .newInstance(); //invoke specific method at runtime for( String methodName : result.keySet() ){ Method method = cls.getDeclaredMethod(methodName , noparams); method.invoke(obj, null); }
score: 0

http://stackoverflow.com/comment/34396835
comment on: http://stackoverflow.com/q/22593162
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html
score: 1

http://stackoverflow.com/a/22580614
type: Answer
answers question: http://stackoverflow.com/q/22563248
has body: Make your AsyncTask extend AsyncTask&lt;String, Void, String&gt;.
has comment: http://stackoverflow.com/comment/34446902
score: 0

http://stackoverflow.com/comment/34492842
comment on: http://stackoverflow.com/q/22646612
type: Comment
type: QuestionComment
has text: I cut down some of the code. Can people please not downvote so quickly? I am a beginner, it takes some time to look things up and think about things. Thank you.
score: 0

http://stackoverflow.com/a/22506960
score: 0
type: Answer
has body: Assuming there are no duplicates, there will be N choose 2 = N(N-1)/2 different pairs, which is clearly O(N^2). Avoiding duplicates can be done by first removing duplicates in the original list (this would be an additional O(N log N) operation). Note that this would remove any pairs of equal values though.
answers question: http://stackoverflow.com/q/22506750
has comment: http://stackoverflow.com/comment/34243069

http://stackoverflow.com/comment/34243069
score: 0
type: Comment
has text: Removing duplicates would be `O(n)` as you can just dump the contents into a `Set` which has an `O(1)` `add()`.
comment on: http://stackoverflow.com/a/22506960
type: AnswerComment

http://stackoverflow.com/q/22611013
favorite count: 0
tagged with: sql
has answer: http://stackoverflow.com/a/22612618
tagged with: sqlite
tagged with: netbeans
score: 6
type: AnsweredQuestion
downvote count: 0
has title: Java-Sqlite Truncate all Database tables
tagged with: java
possible better answer: http://stackoverflow.com/a/22612618
has body: How to Truncate All Tables in Sqlite Database using Java? I know i can do this { ... String table_name1 = "Delete From table_name1"; String table_name2 = "Delete From table_name2"; String table_name3 = "Delete From table_name3"; String table_name4 = "Delete From table_name4"; String table_name5 = "Delete From table_name5"; stmt.executeUpdate(table_name1); ... } I can execute all these Strings to do the task but it increases the Lines of Code. Is there a way to Truncate all tables in a Database with a single command, without separately typing there names?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22611075
accepted answer: http://stackoverflow.com/a/22611075
upvote count: 6

http://stackoverflow.com/comment/34304088
comment on: http://stackoverflow.com/q/22517529
type: Comment
type: QuestionComment
has text: Hi Rembo, I am not getting the CustomPassword. Does that mean that its not creating CustomPassword.class.Why this class is not getting created
score: 0

http://stackoverflow.com/q/22520979
favorite count: 0
has comment: http://stackoverflow.com/comment/34269038
has answer: http://stackoverflow.com/a/22520998
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/22521177
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34268874
has body: I am getting NullPointerException and I don't know why. LinkedList&lt;Character&gt;[][] list = new LinkedList[n][n]; for (int j = 0; j &lt; n; ++j) { for (int m = 0; m &lt; 1; m++) { // Here is the problem list[j][m].add("" + (characterArray[j])); } } I want to add characters from an array to the list. When I run it it says NullPointerException. I don't know how to initialize the list.
has answer: http://stackoverflow.com/a/22521177
score: 0
possible better answer: http://stackoverflow.com/a/22520998
has title: linked list NullPointerException

http://stackoverflow.com/a/22599498
upvote count: 1
has body: I recommend you to rethink a little bit your code and take a look at the following tips Using Comparator or Comparable interfaces These interfaces helps you out with the sorting of your collections, lists and etc, i.e, the Comparator interface allows you to impose ordering to your collection with a hand from Collections.sort and Arrays.sort operations. You must define the implementation of you Comparator, based on you target class(Person), then define the ordering by any field you want: class PersonSort implements Comparator&lt;Person&gt;{ @Override public int compare(Person p1, Person p2) { return p1.getAge() - p2.getAge(); }} Then you are allowed to force its ordering via Arrays.sort(T[], Comparator): Arrays.sort(yourArray, new PersonSort()); I also recommend you to take a look at Oracle's Collection Framework Tutorial. You will find information over ordering, implementations and etc.
downvote count: 0
answers question: http://stackoverflow.com/q/22599285
type: Answer
score: 1

http://stackoverflow.com/a/22552813
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22531429
has body: You can add custom fields on the fly in JBilling. No programming required. Please confirm your jBilling version. If it is 3.1 or higher, you will see a 'Meta Fields' link under 'Configuration' main menu in the jBilling GUI. On the Meta Fields configuration page, you may select an Entity first (CUSTOMER, PRODUCT in your case) and add/edit meta fields. You can also configure Data Types, default values, mandatory flag as well.
type: Answer
accepted answer of: http://stackoverflow.com/q/22531429
downvote count: 0

http://stackoverflow.com/q/22646917
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34493157
type: Question
has answer: http://stackoverflow.com/a/22647135
has title: Client's queries to the Server are shown in the URL : what can I do to avoid that?
tagged with: java
tagged with: servlets
answer count: 2
has comment: http://stackoverflow.com/comment/34578060
tagged with: client-server
upvote count: 1
downvote count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/22647075
accepted answer: http://stackoverflow.com/a/22647075
linked to: http://stackoverflow.com/q/4615039
favorite count: 0
score: 0
possible better answer: http://stackoverflow.com/a/22647135
has comment: http://stackoverflow.com/comment/34493074
tagged with: http://stackoverflow.com/tag/html
has body: I've written a Bank application in java , the server side uses Mysql &amp; JSP pages . When I pass queries from the client side to the server side , the inputs that I entered are shown in the URL address . For example : As you can see , the username and password are shown in the address bar . I want to avoid that . What would be the best approach to accomplish that ? FYI : The screen shots are from inside Eclipse J2EE. This project is pretty big , so if some code is needed , please say which is needed and I'd attach it.

http://stackoverflow.com/comment/34387672
type: Comment
comment on: http://stackoverflow.com/a/22575461
type: AnswerComment
has text: 'http://www.google.com and 1=1'. When I give this URL to browser it does give a webpage. So should I get a parsed HTML code when I chain 'get()' method to 'Jsoup.connect()' ?
score: 0

http://stackoverflow.com/comment/34366458
type: AnswerComment
has text: please to delete this answer, JLabel (and JFrame) can't receive any KeyEvents, simple isn't fosusable, then can't react to KeyEvents
type: Comment
comment on: http://stackoverflow.com/a/22576386
score: 1

http://stackoverflow.com/q/22582537
accepted answer: http://stackoverflow.com/a/22582622
linked to: http://stackoverflow.com/q/4403542
has answer: http://stackoverflow.com/a/22582622
has title: Modulo not showing right value
type: AnsweredQuestion
tagged with: java
has body: -46 modulo 7 is 3, but I get -4. Why? int sa=-46; int p=7; System.out.println(sa);//-46 sa=sa%p; System.out.println(sa);//-4 Edit: This is how I solved it (sa) % p + p) % p;
type: Question
tagged with: modulo
answer count: 1
has comment: http://stackoverflow.com/comment/34377951
score: 0
has comment: http://stackoverflow.com/comment/34377999

http://stackoverflow.com/comment/34424167
type: QuestionComment
comment on: http://stackoverflow.com/q/22608626
type: Comment
has text: use ajax...dats the only way..
score: 0

http://stackoverflow.com/q/22583338
tagged with: android-activity
favorite count: 0
accepted answer: http://stackoverflow.com/a/22583787
tagged with: android
tagged with: lifecycle
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22583787
tagged with: java
has title: Activity lifecycle to back up information to a file
type: Question
has body: I want my function to back up information to a file any time the current running activity was disrupted in any way, but i am confused which activity lifecycle to use; should i use paused activity or stopped activity? btw, in this link there are detailed information about this activities but I just couldn't be sure. http://developer.android.com/guide/components/activities.html#Lifecycle Thank you.
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34379622

http://stackoverflow.com/a/22656572
has body: For people that need the same configuration, here you can find how I solved this problem, integrating Hibernate with Spring. com.some.package.dao com.some.package.model com.some.package.SpecificClass config-hibernate-mapping.xml <tx:annotation-driven transaction-manager="transactionManager" /> @Service @Transactional public class SpecificClass { // write your method, everyone of them will be transactional // and there will be a commit in case of success or rollback in case of exception }
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22615020
answers question: http://stackoverflow.com/q/22615020

http://stackoverflow.com/comment/34404574
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22597316
has text: it works for the GET curl -i -X GET http://localhost:8080/listrs/
score: 0

http://stackoverflow.com/comment/34465270
type: Comment
has text: Also consider `TextLayout`, seen [here](http://stackoverflow.com/a/4287269/230513).
score: 1
comment on: http://stackoverflow.com/q/22628357
type: QuestionComment

http://stackoverflow.com/q/22611105
score: 6
tagged with: jaxb
tagged with: web-services
type: Question
type: AnsweredQuestion
has body: I have some code that works, but I am looking for a better way to do it. I have a RESTful web API that I want to support JSON, XML, and TEXT media types. The JSON and XML is easy with a JAXB annotated "bean" class. I just got text/plain to work, but I wish Jersey was a little more intelligent and would be able to convert a list of my beans, List<Machine> to a string using toString. Here is the Resource class. The JSON and XML media types use a JAXB annotated bean class. The text plain uses a custom string format (basically the stdout representation of a command). @Path("/machines") public class MachineResource { private final MachineManager manager; @Inject public MachineResource(MachineManager manager) { this.manager = manager; } @GET @Path("details/") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public List<Machine> details() { return manager.details(); } @GET @Path("details/") @Produces({ MediaType.TEXT_PLAIN }) public String detailsText() { StringBuilder text = new StringBuilder(); for(Machine machine : manager.details()) { text.append(machine.toString()); } return text.toString(); } Is there a better way to do this with Jersey automatically converting to a string, so I only have to implement one method here? (That can handle all 3 media types) I see that I can implement a MessageBodyWriter, but that seems like a lot more trouble. EDIT: If it matters, I am using the embedded Jetty and Jersey options. Thanks!
tagged with: jersey
upvote count: 6
possible better answer: http://stackoverflow.com/a/22618921
answer count: 2
accepted answer: http://stackoverflow.com/a/22612857
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/22612857
has title: Create a text/plain Jersey response
has answer: http://stackoverflow.com/a/22618921
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/34278995
type: QuestionComment
has text: Make sure that you are not invalidating the session and also not removing the attribute from session by calling session.removeAttribute(
comment on: http://stackoverflow.com/q/22526848
score: 1
type: Comment

http://stackoverflow.com/a/22634300
answers question: http://stackoverflow.com/q/22622332
upvote count: 1
type: Answer
has body: The interesting aspect of your code is that even if it likes a, it "doesn't like your variables" if b is then not good enough. Obviously you're not actually concerned about having two else statements in the code; it's the duplication of the "don't like" code that you seek to avoid. The following will do the trick and is useful if you don't mind throwing away the value of b. if (a &gt; 5) Print("Very well, a &gt; 5"); else b = 0; if (b &gt; 7) Print("Even better, b &gt; 7"); else Print("I don't like your variables"); If you need to retain the value of b then then you can use an additional variable. var evenBetter = (b &gt; 7); if (a &gt; 5) Print("Very well, a &gt; 5"); else evenBetter = false; if (evenBetter) Print("Even better, b &gt; 7"); else Print("I don't like your variables"); Here's a version which doesn't precalculate b's goodness until required. This is better when the test is expensive or if it could produce side effects. It also does away with an else, if that really is important. ;-) var evenBetter = false; if (a &gt; 5) { Print("Very well, a &gt; 5"); evenBetter = (b &gt; 7); } if (evenBetter) Print("Even better, b &gt; 7"); else Print("I don't like your variables"); The downside of this "splitting out" method is that a sloppy reader may assume that the second if statement has nothing to do with a and thus fail to note the unusual case that "don't like your variables" occurs when a is good but b is not.
downvote count: 0
score: 1

http://stackoverflow.com/comment/34386813
type: Comment
has text: yes true, thank you for the answer. but my question is about if getter method and both of the field `a` (if you debug the code you can see there are two variables called `a`) live with in the child object how is calls to the parent class `a` what is the solving mechanism ?
score: 1
comment on: http://stackoverflow.com/a/22587389
type: AnswerComment

http://stackoverflow.com/comment/34478855
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22639079
has text: First of all, you will have to give us some relevant code, like how the JPanel is created. Also inheritance is an "is a" relationship, so it doesn't make sense to have a `Team` inherit from `Player` as a `Team` is not a `Player`.
score: 0

http://stackoverflow.com/comment/34398741
score: 0
has text: You would have to elaborate on *failed to create the list I want*. Any exceptions which you get or just a broken UX?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22594175

http://stackoverflow.com/comment/34366514
has text: perhabs through the message, when I trow the exception? But I don't know it, that's why i'm asking
comment on: http://stackoverflow.com/a/22576426
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22595404
possible better answer: http://stackoverflow.com/a/22595495
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22595434
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34400982
tagged with: user-interface
tagged with: arrays
has body: In my GUI class I have an array of textfields, which I initialized in this class constructor. The code is as follows JTextField[] arrayOne= new JTextField [10]; for(int a = 0;a &lt; 10;a++) { arrayOne[a] = new JTextField(String.valueOf(0)); arrayOne[a].setBounds(189 + a * 50, 156, 39, 23); arrayOne[a].setVisible(true); } The problem is, that when I run my GUI, it does not show these text fields. Why not?
score: 0
has answer: http://stackoverflow.com/a/22595434
has answer: http://stackoverflow.com/a/22595495
tagged with: textfield
has title: Java - array of text fields not displaying

http://stackoverflow.com/a/22504140
has comment: http://stackoverflow.com/comment/34238367
answers question: http://stackoverflow.com/q/22503994
score: 0
has body: It is pass by value. This code: public static void main(final String... args) { String s = "foo"; tryAndModify(s); System.out.println(s); } private static void tryAndModify(String s) { s = "bar"; } will print foo. s is a reference to a String object, sure. But this is a value as a method call parameter. It is quite a separate concept to "pass by reference" like C++ has, for instance.
type: Answer

http://stackoverflow.com/q/22575028
tagged with: extends
has title: Confusing Java extend
has answer: http://stackoverflow.com/a/22575063
has answer: http://stackoverflow.com/a/22575070
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/22575070
type: Question
has body: I am trying to understand the usage of Java extend.... I created a sample testing code to under how it works.... public class Parent { public String Msg="Original"; public String getMsg() { return Msg; } public void setMsg(String msg) { Msg = msg; } public void printing(){ System.out.println(Msg); } } public class Child extends Parent{ public HashMap&lt;String, String&gt; Msg2; public Integer Msg3; public HashMap&lt;String, String&gt; getMsg2() { return Msg2; } public void setMsg2(HashMap&lt;String, String&gt; msg2) { Msg2 = msg2; } public void printing(){ System.out.println("1 : " + Msg); System.out.println( Msg2 ); } public static void main(String[] args) { Child a = new Child(); System.out.println(a.Msg.getClass()); // able to detect variable from parent System.out.println(a.Msg2.getClass()); // Not able to detected, even variable from // same instance object child System.out.println(a.Msg3.getClass()); // Not able to detected, even variable from // same instance object child a.printing(); } } I getting confuse why Msg variable from parent object can detected easy. While Msg2 and Msg 3 coming from the same instance Child -> a can't recognize it's own variable. The error message getting from Msg2 or Msg 3 is, Exception in thread "main" java.lang.NullPointerException Is there anyone able to explain why java behave in such way ? Thank you....
accepted answer: http://stackoverflow.com/a/22575063
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22575082

http://stackoverflow.com/q/22507957
tagged with: java
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22618205
has answer: http://stackoverflow.com/a/22668573
score: 8
upvote count: 9
has title: Java BufferedWriter Creating Null Characters
has comment: http://stackoverflow.com/comment/34436703
has comment: http://stackoverflow.com/comment/34437457
linked to: http://stackoverflow.com/q/923863
has answer: http://stackoverflow.com/a/22619097
has body: I've been using Java's BufferedWriter to write to a file to parse out some input. When I open the file after, however, there seems to be added null characters. I tried specifying the encoding as "US-ASCII" and "UTF8" but I get the same result. Here's my code snippet: Scanner fileScanner = new Scanner(original); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "US-ASCII")); while(fileScanner.hasNextLine()) { String next = fileScanner.nextLine(); next = next.replaceAll(".*\\x0C", ""); //remove up to ^L out.write(next); out.newLine(); } out.flush(); out.close(); Maybe the issue isn't even with the BufferedWriter? I've narrowed it down to this code block because if I comment it out, there are no null-characters in the output file. If I do a regex replace in VIM the file is null-character free (:%s/.*^L//g). Let me know if you need more information. Thanks! EDIT: hexdump of a normal line looks like: 0000000 5349 2a41 3030 202a But when this code is run the hexdump looks like: 0000000 5330 2a49 4130 202a I'm not sure why things are getting mixed up. EDIT: Also, even if the file doesn't match the regex and runs through that block of code, it comes out with null characters. EDIT: Here's a hexdump of the first few lines of a diff: http://pastie.org/pastes/8964701/text command was: diff -y testfile.hexdump expectedoutput.hexdump The rest of the lines are different like the last two.
has comment: http://stackoverflow.com/comment/34432440
favorite count: 0
has comment: http://stackoverflow.com/comment/34623363
has comment: http://stackoverflow.com/comment/34438215
has answer: http://stackoverflow.com/a/22613177
has comment: http://stackoverflow.com/comment/34436880
has comment: http://stackoverflow.com/comment/34380648
has comment: http://stackoverflow.com/comment/34429966
has comment: http://stackoverflow.com/comment/34585559
tagged with: null-character
answer count: 4
accepted answer: http://stackoverflow.com/a/22613177
linked to: http://stackoverflow.com/q/82726
type: AnsweredQuestion
tagged with: bufferedwriter
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/22618205

http://stackoverflow.com/comment/34487518
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22613177
type: Comment
has text: Thanks for the help! I need to be more observant with my hexdumps.

http://stackoverflow.com/comment/34354747
type: Comment
has text: @MarkoTopolnik If it turns out to help, you can then again do a `forEachOrdered()` instead of `forEach()` to ensure order. The only question that remains then is whether you still get any performance benefits...
comment on: http://stackoverflow.com/a/22569529
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34324957
has text: Also, if I might ask, what does "out" do?
comment on: http://stackoverflow.com/a/22552944
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/78485961
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/138367879
answers question: http://stackoverflow.com/q/22566433
has body: General Request URL: http://localhost:8080/education/students Request Method: POST Status Code: 415 Remote Address: [::1]:8080 Referrer Policy: strict-origin-when-cross-origin Response Headres Accept: application/json, application/*+json Connection: keep-alive Content-Type: application/json Date: Wed, 15 May 2024 18:30:40 GMT Keep-Alive: timeout=60 Request Headers Accept: / Accept-Encoding: gzip, deflate, br Accept-Language: en-US;q=0.8,en;q=0.7 Connection: keep-alive Content-Length: 109 Content-Type: text/plain;charset=UTF-8 Transfer-Encoding: chunked I had the same problem, everything is fine, only I got 415-unsupported-media-type-error because I didn't say that I wanted to send application/json. In Request Headers, I say that I sent Content-Type: text/plain;charset=UTF-8, but I said Request Headers I should tell you that I want to send you application/json, application/*+json

http://stackoverflow.com/comment/34285978
type: Comment
comment on: http://stackoverflow.com/a/22530171
has text: but i dont understand if i use synchronized(map) only one thread can access it.then why it is being used Collections.synchronized(map).this i am not understanding,i want to know both will work same or differently
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34414642
has text: I'm using jboss-as-7.1.1.Final and it's taking a long time too using the `[JBOSS_HOME]\bin\standalone.bat` script (on Windows). Debug log does not appear to show any errors. Server doesn't actually start at all.
comment on: http://stackoverflow.com/q/22522379
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22510764
accepted answer: http://stackoverflow.com/a/22510908
tagged with: date
linked to: http://stackoverflow.com/q/3526485
has answer: http://stackoverflow.com/a/22510828
answer count: 3
duplicate of: http://stackoverflow.com/q/3526485
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/34253931
favorite count: 0
has body: I have a String representing a date with format yyyy/mm/dd and want to calculate the number of days between that day and today. How is this done? So It may be something like String aDate = "1934/05/24"
has comment: http://stackoverflow.com/comment/34250134
possible better answer: http://stackoverflow.com/a/22512338
has comment: http://stackoverflow.com/comment/80878468
has answer: http://stackoverflow.com/a/22510908
has answer: http://stackoverflow.com/a/22512338
linked to: http://stackoverflow.com/q/1555262
has title: Calculate days between today and string of format yyyy/mm/dd in Java
linked to: http://stackoverflow.com/q/3299972
type: AnsweredQuestion
score: 1
duplicate of: http://stackoverflow.com/q/1555262
tagged with: java
has comment: http://stackoverflow.com/comment/34250027
linked to: http://stackoverflow.com/q/20098644
upvote count: 1
type: Question
tagged with: jodatime

http://stackoverflow.com/q/22609855
tagged with: http
has comment: http://stackoverflow.com/comment/34455435
has answer: http://stackoverflow.com/a/22609962
tagged with: java
accepted answer: http://stackoverflow.com/a/22610015
answer count: 4
type: Question
type: AnsweredQuestion
tagged with: sockets
has body: I'm trying to develop an app for instant messaging (like whatsapp). I'm very confused about what type of connection i should use: socket, http or other? Do i have to use non-standard java API? For server i use java and for client i use andoid (java). I have already tried socket connection but without success. I don't get error but nothing happens because the device and the server are not connected(i don't know why). This is my client class (android) that sends messages: public class SendMsg implements Runnable { private Socket socket; String msg; public SendMsg(String msg){ this.msg=msg; } @Override public void run() { try { socket = new Socket("ip_globale_server",5000); socket.setSoTimeout(5000); BufferedWriter writer= new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); writer.write(msg); writer.flush(); } catch (IOException e){ System.err.println("Connection error"); } finally{ if (socket!=null) { try{socket.close();} catch(IOException e){} } } } } this is my java server class that waits for connection: public class ReceiveMsg implements Runnable { ServerSocket server= null; Socket connection=null; InputStream in; InputStreamReader inr; StringBuilder smsg; public void run() { System.out.print("Server has started"); try { server = new ServerSocket(5000); System.out.println("I'm waiting for connection"); connection = server.accept(); System.out.println("I'm connected with "+ connection.toString()); in = connection.getInputStream(); inr = new InputStreamReader(in,"ASCII"); for (int c= inr.read();c!=-1; c= inr.read()){ smsg.append((char)c); } //this class is for storing the message new Store (smsg.toString(),1,2); } catch(IOException ex){} finally { try{ if (server != null) server.close(); if (server != null) server.close(); } catch(IOException e){ } } Could you help me to get start please. Thank you in advance.
tagged with: android
tagged with: instant-messaging
has answer: http://stackoverflow.com/a/22610015
has answer: http://stackoverflow.com/a/22610178
has title: Connection between server and android
score: 0
has comment: http://stackoverflow.com/comment/34426482
possible better answer: http://stackoverflow.com/a/22609899
has comment: http://stackoverflow.com/comment/34426934
has answer: http://stackoverflow.com/a/22609899

swing
tags question: http://stackoverflow.com/q/22595540
tags question: http://stackoverflow.com/q/22592399
tags question: http://stackoverflow.com/q/22596219
tags question: http://stackoverflow.com/q/22570794
tags question: http://stackoverflow.com/q/22620807
tags question: http://stackoverflow.com/q/22500279
tags question: http://stackoverflow.com/q/22637528
tags question: http://stackoverflow.com/q/22570921
tags question: http://stackoverflow.com/q/22595306
tags question: http://stackoverflow.com/q/22633243
tags question: http://stackoverflow.com/q/22597259
tags question: http://stackoverflow.com/q/22513032
tags question: http://stackoverflow.com/q/22592946
tags question: http://stackoverflow.com/q/22642173
tags question: http://stackoverflow.com/q/22604547
tags question: http://stackoverflow.com/q/22497281
tags question: http://stackoverflow.com/q/22639079
tags question: http://stackoverflow.com/q/22569995
tags question: http://stackoverflow.com/q/22511613
tags question: http://stackoverflow.com/q/22543633
tags question: http://stackoverflow.com/q/22604038
tags question: http://stackoverflow.com/q/22595579
tags question: http://stackoverflow.com/q/22559280
tags question: http://stackoverflow.com/q/22588105
tags question: http://stackoverflow.com/q/22586080
tags question: http://stackoverflow.com/q/22561016
tags question: http://stackoverflow.com/q/22520020
tags question: http://stackoverflow.com/q/22488945
tags question: http://stackoverflow.com/q/22604053
tags question: http://stackoverflow.com/q/22592941
tags question: http://stackoverflow.com/q/22616764
tags question: http://stackoverflow.com/q/22623143
tags question: http://stackoverflow.com/q/22615387
tags question: http://stackoverflow.com/q/22602531
tags question: http://stackoverflow.com/q/22594745
tags question: http://stackoverflow.com/q/22580743
tags question: http://stackoverflow.com/q/22547244
tags question: http://stackoverflow.com/q/22631256
tags question: http://stackoverflow.com/q/22591157
tags question: http://stackoverflow.com/q/22625093
tags question: http://stackoverflow.com/q/22645453
tags question: http://stackoverflow.com/q/22626640
tags question: http://stackoverflow.com/q/22492651
tags question: http://stackoverflow.com/q/22585373
tags question: http://stackoverflow.com/q/22581246
tags question: http://stackoverflow.com/q/22594826
tags question: http://stackoverflow.com/q/22601195
tags question: http://stackoverflow.com/q/22504355
tags question: http://stackoverflow.com/q/22642401
tags question: http://stackoverflow.com/q/22583304
tags question: http://stackoverflow.com/q/22629616
tags question: http://stackoverflow.com/q/22605095
tags question: http://stackoverflow.com/q/22592768
tags question: http://stackoverflow.com/q/22622954
tags question: http://stackoverflow.com/q/22624249
tags question: http://stackoverflow.com/q/22540579
tags question: http://stackoverflow.com/q/22585828
tags question: http://stackoverflow.com/q/22609375
tags question: http://stackoverflow.com/q/22570592
tags question: http://stackoverflow.com/q/22539800
tags question: http://stackoverflow.com/q/22610157
tags question: http://stackoverflow.com/q/22596182
tags question: http://stackoverflow.com/q/22565292
tags question: http://stackoverflow.com/q/22639787
tags question: http://stackoverflow.com/q/22614795
tags question: http://stackoverflow.com/q/22623001
tags question: http://stackoverflow.com/q/22639939
tags question: http://stackoverflow.com/q/22556701
tags question: http://stackoverflow.com/q/22502047
tags question: http://stackoverflow.com/q/22520531
tags question: http://stackoverflow.com/q/22576051
tags question: http://stackoverflow.com/q/22490855
tags question: http://stackoverflow.com/q/22528582
tags question: http://stackoverflow.com/q/22605561
tags question: http://stackoverflow.com/q/22626436
tags question: http://stackoverflow.com/q/22582598
tags question: http://stackoverflow.com/q/22640854
tags question: http://stackoverflow.com/q/22492304
tags question: http://stackoverflow.com/q/22515814
tags question: http://stackoverflow.com/q/22508993

http://stackoverflow.com/q/22546868
tagged with: java
has comment: http://stackoverflow.com/comment/34314961
has answer: http://stackoverflow.com/a/29833335
type: Question
has comment: http://stackoverflow.com/comment/34314831
has title: No code input window in Netbeans 8 for Java
favorite count: 0
answer count: 6
has body: I am trying to learn Java using the Netbeans 8.0 IDE. On creating a new project and .java file, instead of getting a main code input window, the main window (where the start page tab is on 1st launching netbeans), shows a checked history button, and compare mode, but nowhere to input code. I have looked at videos, and followed the exact same few simple steps that they did, but of the code template they get, instead I get this "history" tab, and nowhere to input code.
has answer: http://stackoverflow.com/a/44954781
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/41323528
downvote count: 1
has answer: http://stackoverflow.com/a/28914973
has comment: http://stackoverflow.com/comment/47793040
linked to: http://stackoverflow.com/q/44953723
has answer: http://stackoverflow.com/a/48472859
tagged with: netbeans
has answer: http://stackoverflow.com/a/53069278
type: UnansweredQuestion

dynamic-programming
tags question: http://stackoverflow.com/q/22514963
tags question: http://stackoverflow.com/q/22583314
type: Tag
tag name: dynamic-programming

http://stackoverflow.com/q/22594212
has comment: http://stackoverflow.com/comment/34400358
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22594308
score: 2
upvote count: 3
tagged with: java
has title: Detecting Common Elements in an Unsorted Array
has comment: http://stackoverflow.com/comment/34398944
has answer: http://stackoverflow.com/a/22594321
downvote count: 1
has comment: http://stackoverflow.com/comment/34403176
has comment: http://stackoverflow.com/comment/34400341
type: Question
has answer: http://stackoverflow.com/a/22594516
tagged with: algorithm
tagged with: arrays
answer count: 3
has body: I found a code which will detect common elements in an unsorted array. The program runs in linear time! But i did not understand the logic of the program. It would be very helpful if some one could explain the logic of the program. Here is the code: public class DeleteUnsortedDataFromArray { public static List&lt;Integer&gt; findDuplicatesArray(int[] sequence){ int bitarray = 0; for(int i=0; i&lt; sequence.length; i++){ int x = 1; x = x &lt;&lt; sequence[i]; if((bitarray &amp; x) != 0){ System.out.println("Duplicate found in given array: " + sequence[i]); } else { bitarray = bitarray | x; } } return null; } public static void main(String[] args) { int[] input = {1,1,2,3}; findDuplicatesArray(input); } }
favorite count: 0

http://stackoverflow.com/comment/34368451
type: Comment
comment on: http://stackoverflow.com/a/22577169
score: 1
type: AnswerComment
has text: UserLoggedInScreen is in the manifest file and was loading properly before adding the extra data. You have highlighted the same as me in regards to what was wrong and your correct I was using the incorrect TextView. It should have been one I created in UserLoggedInScreen (the recipient) not txtUserName or userName from the starting activity. It's also working now. Thanks for the quick responses.

http://stackoverflow.com/comment/34304475
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22539550
type: AnswerComment
has text: @ZacharyRW You have copied the same loop twice. It should be two different loops - inside different methods, with different limits, and different purposes. Take a look at [this link](http://ideone.com/zYgvHG) for your re-arranged program running on ideone.

http://stackoverflow.com/comment/34274751
type: Comment
has text: then how could I use those helper functions in my HTML pages.?
comment on: http://stackoverflow.com/q/22524286
score: 0
type: QuestionComment

http://stackoverflow.com/q/22606478
has comment: http://stackoverflow.com/comment/34454423
tagged with: java
tagged with: grails
score: 0
has title: Terribly slow on Grails app
has comment: http://stackoverflow.com/comment/34460555
answer count: 2
has comment: http://stackoverflow.com/comment/34437857
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/22606535
has comment: http://stackoverflow.com/comment/34420852
has comment: http://stackoverflow.com/comment/34421303
linked to: http://stackoverflow.com/q/97197
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34454404
has body: The performance of grails app is terribly slow. It needs at least 5-7 seconds to load a page. Sometimes will prompt me OutOfMemory and then server error 500 for every page. The terribly slow performance seriously affects my work and I am unable to test and develop the project in an acceptable time. I have to deal with this problem first. I tried to: Config the settings in idea64.exe.vmoptions and idea.exe.vmoptions like the settings in development handbook. Config the settings of Java in Java Control Panel that I added a Runtime Parameters –Xms-4096m. Config the settings of %GRAILS_HOME%\bin\startGrails.bat, GRAILS_OPTS. However, this situation is not improveing. I am using Win7-64 bit, 8GB Ram, Intellij 13.0.2 to develop. Please help. Thank you very much!!
has answer: http://stackoverflow.com/a/22753043
type: Question
tagged with: performance

http://stackoverflow.com/a/22499706
type: Answer
upvote count: 3
score: 3
has body: Link.setForeground sets the normal text color, the actual link color can't be set and uses the OS defaults. The Forms controls org.eclipse.ui.forms.widgets.Hyperlink and ImageHyperlink used in conjunction with HyperlinkGroup do allow the colors (and underlining) to be set.
downvote count: 0
answers question: http://stackoverflow.com/q/22498771

http://stackoverflow.com/q/22601036
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/34411350
tagged with: java-8
answer count: 4
has answer: http://stackoverflow.com/a/53269529
has answer: http://stackoverflow.com/a/22601500
type: AnsweredQuestion
score: 41
has comment: http://stackoverflow.com/comment/34411147
downvote count: 0
tagged with: java-stream
tagged with: java
has comment: http://stackoverflow.com/comment/34411971
possible better answer: http://stackoverflow.com/a/45083384
type: Question
upvote count: 41
has comment: http://stackoverflow.com/comment/34411376
has answer: http://stackoverflow.com/a/60835727
has answer: http://stackoverflow.com/a/45083384
has body: I am trying to get an IntStream out of an n dimensional int arrays. Is there a nice API way to do it? I know the concatenate method for two streams.
has title: Stream from two dimensional array in java
favorite count: 0
accepted answer: http://stackoverflow.com/a/22601500

http://stackoverflow.com/q/22637621
has body: I run Hadoop 2.2.0.2.0.6.0-101 on a local node, CentOS. My MapReduce job compiles in Eclipse when I include neccessary jars from /usr/lib/hadoop and /usr/lib/hive as dependencies in Eclipse project. Finding neccessary jars is a real quest! And grep is my only tool for this job, doing things like grep -ri -l "FacebookService" /usr/lib/hadoop Notwithstanding I get exceptions when I try to run my app on the same local node where I compile it. I am giving up trying to find neccessary jars - after one exception is fixed comes a new one. Now, after having fixed about 10 exceptions by adding jars from /usr/lib/hadoop and /usr/lib/hive I got a real good one: java.io.IOException: Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses. Interesting part: When I add all jars from these directories my program runs! This last solution does not work in my case, as I need to create self-sufficient package to run my app on another, distributed Hadoop installation. What is the right way to deploy Hadoop MapReduce job? How should I set Hadoop CLASSPATH to run MapReduce job on any node?
answer count: 1
tagged with: jar
favorite count: 0
has answer: http://stackoverflow.com/a/22643456
has title: Right way to package and deploy Hadoop MapReduce job?
tagged with: deployment
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34481518
tagged with: java
type: Question
tagged with: mapreduce
upvote count: 2
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/22643456

http://stackoverflow.com/comment/34481697
score: 0
comment on: http://stackoverflow.com/q/22640653
type: Comment
type: QuestionComment
has text: Read the documentation, of course!

http://stackoverflow.com/comment/34451443
score: 0
comment on: http://stackoverflow.com/a/22619776
type: Comment
has text: @programmerNOOB - It's unwise to use the same variable name as both a local variable/parameter and an instance field name.
type: AnswerComment

http://stackoverflow.com/q/22594069
downvote count: 2
answer count: 1
has body: I have this code, and when I press space, it goes all weird. I have tested it, and jump() is being called when I press space. I don't receive an error for anything. public static void update(int delta) { if (!grounded &amp;&amp; !jumping) y += gravity; if (y &gt; 275) { grounded = true; jumpTime = 0; } if (jumping &amp;&amp; jumpTime &lt; maxJumpTime) { y -= jumpPower; jumpTime++; } if (jumpTime &gt; maxJumpTime) { jumping = false; jumpTime = 0; } if (jumping) { grounded = false; } } public static void jump(int power) { if (grounded) { jumpPower = power; grounded = false; jumping = true; } else return; } The variables are: x y gravity (1) jumpTime maxJumpTime (5) jumpPower (1).
favorite count: 0
has title: Jumping Doesn't Work Slick2D
has answer: http://stackoverflow.com/a/22595004
upvote count: 0
type: UnansweredQuestion
type: Question
score: -2
tagged with: java
tagged with: slick2d

http://stackoverflow.com/comment/34388690
type: Comment
comment on: http://stackoverflow.com/q/22588491
score: 1
type: QuestionComment
has text: You need two threads here.

http://stackoverflow.com/q/22623821
favorite count: 0
has answer: http://stackoverflow.com/a/22624047
accepted answer: http://stackoverflow.com/a/22624047
type: AnsweredQuestion
tagged with: recursion
possible better answer: http://stackoverflow.com/a/22623959
score: 3
tagged with: linked-list
has answer: http://stackoverflow.com/a/22623959
upvote count: 3
tagged with: java
type: Question
answer count: 2
has title: Java remove an element from linked list recursion
downvote count: 0
tagged with: data-structures
tagged with: stack-overflow
has body: For this assignment given to me, I am supposed to move through a linked list of size 1,000,000 iteratively and recursively. I have the iterative part down but I am confused on the recursive part. I have the concept down but I have told my teacher that I cannot recursively do it because I will inevitably get a stack overflow error. He says I should not be getting that problem but I am totally stuck. Any tips would be great as I have no idea what I am doing wrong. public static void main(String[] args) { System.out.println("Please enter how many random numbers you want to generate: "); Scanner prompt = new Scanner(System.in); int amount = prompt.nextInt(); Random rnd = new Random(); System.out.println("Creating list..."); for (int i = 0; i &lt; amount; i++) { randomList.add(rnd.nextInt(100)); } System.out.println("Going through list..."); iterateNumbers(); long startTimeRec = System.nanoTime(); recursiveNumbers(randomList); long elapsedTimeRec = System.nanoTime() - startTimeRec; double seconds = (double)elapsedTimeRec / 1000000000.0; System.out.println("Recursively, the function took " + seconds + " seconds."); prompt.close(); } //create the linked list public static LinkedList&lt;Integer&gt; randomList = new LinkedList&lt;Integer&gt;(); private static void iterateNumbers() { long startTime = System.nanoTime(); for (int i = 0; i &lt; randomList.size(); i++) { randomList.remove(); } long elapsedTime = System.nanoTime() - startTime; double seconds = (double)elapsedTime / 1000000000.0; System.out.println("Iteratively, the function took " + seconds + " seconds."); } private static void recursiveNumbers(LinkedList&lt;Integer&gt; current) { if (current.isEmpty() == true) { return; } else { current.removeFirst(); recursiveNumbers(current); } } }
has comment: http://stackoverflow.com/comment/34452601

http://stackoverflow.com/q/22592275
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34400013
tagged with: dygraphs
answer count: 0
score: 0
tagged with: java
has title: dygraph error - this.rawData_ is undefined
type: Question
tagged with: jquery
has body: I am using dygraph to generate graph using csv file and getting below error at firebug. TypeError: this.rawData_ is undefined I investigated the issue and found that csv is not being loaded entirely and label formatting is being done. Hence I have used drawCallback. graph_obj_2 = new Dygraph( document.getElementById("graphdiv2"), "http://localhost:8080/report_2.csv", // path to CSV file { //options legend: 'always', animatedZooms: true, drawCallback: function(g, is_initial) { if (!is_initial) { return;} }, axes: { x: { valueFormatter: function(x) { var label; switch (x){ case 1: label = '0'; break; case 2: label = '1'; break; case 3: label = '2'; break; case 4: label = '3'; break; }return label; }, axisLabelFormatter: function(x) { var label; switch (x){ case 1: label = '0'; break; case 2: label = '1'; break; case 3: label = '2'; break; case 4: label = '3'; break; }return label; }, } } }); Please help me to fix this error. Please note that you will get this error only if you are using csv file(not inline data) and labels of your choice. Please consider that all parentheses has been closed properly.
has comment: http://stackoverflow.com/comment/34400918

hiveql
tag name: hiveql
type: Tag
tags question: http://stackoverflow.com/q/22591305

http://stackoverflow.com/comment/34490222
type: Comment
has text: Your two endpoints will be a horror to map properly. How can one decide which pattern to use?
type: AnswerComment
comment on: http://stackoverflow.com/a/22644882
score: 0

http://stackoverflow.com/q/22575354
has comment: http://stackoverflow.com/comment/34446907
has comment: http://stackoverflow.com/comment/34364838
tagged with: java
has comment: http://stackoverflow.com/comment/34508367
accepted answer: http://stackoverflow.com/a/22575814
type: Question
has title: search string as integer from array
has comment: http://stackoverflow.com/comment/34364880
has comment: http://stackoverflow.com/comment/34364786
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34364773
has comment: http://stackoverflow.com/comment/34364823
has answer: http://stackoverflow.com/a/22575814
has answer: http://stackoverflow.com/a/22575653
has body: I have retrieve all the strings from file and place them in array through splitting method. i want to know how to search int from array which is of type String. here is the txt file and my code: student id= : 12 name : nokia student id : 123 name : usb my code: import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Read { @SuppressWarnings("resource") public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new FileReader(new File("test.txt"))); try { // String line = br.readLine(); String line = br.readLine(); List&lt;String&gt; list = new ArrayList&lt;String&gt;(); while(line != null) { // list.add(line); // add lines in list for (String token : line.split(":")) { // Splitting each line with ':' if (!token.trim().equals("student name")) { // Adding token to list conditionally. list.add(token); } } line = br.readLine(); // read next line } String [] stringArr= list.toArray(new String[0]); list.add(stringArr[0]); String [] a = null; Scanner in ; in = new Scanner(System.in); String b= in.next(); for(int i=0; i&lt;stringArr.length; i++){ if(stringArr[i]== b){ System.out.print(stringArr[i-1]); System.out.println(stringArr[i]); System.out.print(stringArr[i+1]); System.out.println(stringArr[i+2]); System.out.print(stringArr[i+3]); System.out.print(stringArr[i+4]); System.out.print(stringArr[i+5]); } // System.out.print(stringArr[2]); } } finally { br.close(); } } } This is not printing my requirement. My requirement, it should print like this: Enter ID: 1 output result is Student ID:1 Name : nokia
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22575653

http://stackoverflow.com/q/22521636
favorite count: 0
has comment: http://stackoverflow.com/comment/34302397
type: Question
score: 5
tagged with: android
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34304979
tagged with: lang
has answer: http://stackoverflow.com/a/26025374
tagged with: debugging
upvote count: 5
tagged with: runtime
type: UnansweredQuestion
has body: I ran into the following situation where I cannot debug the android app. I can run it but cannot debug it. I started brand new project copied everything and it worked (meaning was able to debug) but got this again. I tried both on emulator and my phone but no avail. I am using Android Studio 0.5.1 it fails at the very beginning. i don't feel like it has entered MainActivity. The moment app launches, I get "Unfortunately btbnie has stopped working" message. Appreciate any help/direction... 03-19 21:10:24.334 31799-31799/com.learn.btnine.btbnine I/System.out? Sending WAIT chunk 03-19 21:10:24.334 31799-31799/com.learn.btnine.btbnine W/ActivityThread? Application com.learn.btnine.btbnine is waiting for the debugger on port 8100... 03-19 21:10:25.034 31799-31809/com.learn.btnine.btbnine I/art? Debugger is active 03-19 21:10:25.144 31799-31799/com.learn.btnine.btbnine I/System.out? Debugger has connected 03-19 21:10:25.144 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:25.344 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:25.544 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:25.744 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:25.944 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:26.144 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:26.344 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:26.544 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:26.754 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:26.954 31799-31799/com.learn.btnine.btbnine I/System.out? waiting for debugger to settle... 03-19 21:10:27.154 31799-31799/com.learn.btnine…
downvote count: 0
has comment: http://stackoverflow.com/comment/37964464
has title: Cannot debug, Fatal signal 6 (SIGABRT) at 0x00007c37 (code=-6)

http://stackoverflow.com/comment/34299604
has text: you have an unused class-field in `CategoryExt`. ;D
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22538124
type: QuestionComment

http://stackoverflow.com/a/22578183
has comment: http://stackoverflow.com/comment/34369928
has comment: http://stackoverflow.com/comment/34369675
type: Answer
has comment: http://stackoverflow.com/comment/34369831
has comment: http://stackoverflow.com/comment/34369680
has body: You could use CardLayout instead of that approach. You will be able to switch between different panels very easy and efficiently. It's also wort of mentioning that use of CardLayout is less verbose approach.
upvote count: 4
score: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22578155

http://stackoverflow.com/comment/34257886
type: QuestionComment
has text: The type arguments are different.
comment on: http://stackoverflow.com/q/22515108
score: 0
type: Comment

http://stackoverflow.com/comment/34382336
score: 0
type: Comment
type: QuestionComment
has text: What types are in `getValues()`? Do they those items have a proper `equals()` method?
comment on: http://stackoverflow.com/q/22584807

http://stackoverflow.com/a/22640485
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22639998
has body: This topic is suitable only for deletion. ArrayList operates on Ks type, and you guys are putting inside it an K type object... You should extend this class, or make it not abstract (by implementing interface) if you want to instantiate it.

http://stackoverflow.com/a/22572531
answers question: http://stackoverflow.com/q/22572523
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22572523
has body: Where do you create a JPanel object for the panel variable? Answer: You don't. So change this: private JPanel panel; to this: private JPanel panel = new JPanel(); More importantly, you need to learn the general concepts of how to debug a NPE (NullPointerException). You should inspect the line carefully that throws it, find out which variable is null, and then trace back into your code to see why. You will run into these again and again, trust me. As an aside: don't give your classes the same names as important core Java classes. For instance by naming your class GridLayout, you will now have trouble using the java.awt.GridLayout class without completely specifying the class name. You will thus want to change your class name to something else, say MyGridLayout.

http://stackoverflow.com/comment/34377692
comment on: http://stackoverflow.com/q/22564664
type: QuestionComment
type: Comment
has text: result.doc is the fich1 content append fich2 and fich3.
score: 0

http://stackoverflow.com/q/22566054
tagged with: java
tagged with: annotations
has comment: http://stackoverflow.com/comment/34426396
has title: spring autowire not working No qualifying bean of type Injection of autowired dependencies failed;
tagged with: autowired
has body: This error appears whenever I try to run my code. I looked all over google for an answer for the past week but my class project is due soon and I need some assistance. I have @service and component scan and I implemented the service class. What else could be the problem. I checked all over google. I spent too many days trying to debug this error to no avail and my deadline is coming. Please help, Much obliged for any help. :) org.springframework.beans.factory.BeanCreationException: Error creating bean with name'springSecurityFilterChain' defined in ServletContext resource [/WEB-INF/spring/spring-security.xml]: Cannot resolve reference to bean 'userAuthenticationFilter' while setting bean property 'filterChainMap' with key [Root bean: class [org.springframework.security.web.util.AnyRequestMatcher]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'userAuthenticationFilter' defined in ServletContext resource [/WEB-INF/spring/spring-security.xml]: Cannot resolve reference to bean 'customAuthMgr' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customAuthMgr' defined in ServletContext resource [/WEB-INF/spring/spring-security.xml]: Cannot resolve reference to bean 'authenticationProvider' while setting bean property 'providers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected a.b.c.d.projectName.service.UserInfoInterface a.b.c.d.projectNam…
answer count: 1
has comment: http://stackoverflow.com/comment/34347993
has comment: http://stackoverflow.com/comment/38024752
has comment: http://stackoverflow.com/comment/34350704
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34352910
has comment: http://stackoverflow.com/comment/34423549
upvote count: 4
has comment: http://stackoverflow.com/comment/34348538
downvote count: 0
tagged with: spring-security
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27655049
has comment: http://stackoverflow.com/comment/43726143
tagged with: spring-mvc
score: 4

http://stackoverflow.com/q/22495558
linked to: http://stackoverflow.com/q/9100125
has comment: http://stackoverflow.com/comment/86541567
answer count: 4
downvote count: 6
tagged with: java.util.scanner
linked to: http://stackoverflow.com/q/8116872
tagged with: java
has answer: http://stackoverflow.com/a/22495669
type: Question
has answer: http://stackoverflow.com/a/22495899
has answer: http://stackoverflow.com/a/22495594
has answer: http://stackoverflow.com/a/22495673
has body: import java.util.Scanner; import java.util.Random; public class blackJack { public static void main(String[] args){ Scanner input = new Scanner(System.in); int cards[] = {2,3,4,5,6,7,8,9,10}; String card[] = {"H", "D", "C", "S"}; String suit[] = {"A","K","Q","J"}; //System.out.println(cards[2]); Random random = new Random(); System.out.println(cards[random.nextInt(cards.length)] +card[random.nextInt(card.length)]); } } I'm trying to create a random from cards and suit, because you can have either have a int of hearts, spades, clubs or diamonds or you can Ace of hearts, spades, clubs or diamonds.
has comment: http://stackoverflow.com/comment/34224504
upvote count: 0
score: -6
has title: How to write a simple random playing-card generator in java?
favorite count: 0
linked to: http://stackoverflow.com/q/1519736
type: UnansweredQuestion

http://stackoverflow.com/q/22612172
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34688708
has body: I have the requirement to generate PDF file with 120 columns(all columns should be on a single page).I am using iText. When I generate pdf columns gets overlapped. My Questions are: 1)Is there any way to put horizontal scroll bar to navigate between the columns ? 2)How do we prevent overlapping of columns? I have seen the similar question in this site (How to export n number columns as headings for PDF in Java?) but the link mentioned in the answer there (http://itext-general.2136553.n4.nabble.com/What-is-the-maximum-page-size-for-PDF-in-iText-td2150839.html%22) is inactive. Please suggest me on this.
answer count: 2
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/22955737
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/26271848
accepted answer: http://stackoverflow.com/a/22955737
has answer: http://stackoverflow.com/a/26271848
has title: How to export n number columns for PDF in Java?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5645770
tagged with: java
tagged with: itext
upvote count: 1
has comment: http://stackoverflow.com/comment/35048118

http://stackoverflow.com/q/22496268
tagged with: java
has title: Whats the sql query for retrieving data from database between two dates, if the date values are stored on a variable?
tagged with: mysql
type: Question
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22496323
accepted answer: http://stackoverflow.com/a/22496323
tagged with: sql
possible better answer: http://stackoverflow.com/a/22496461
has body: I have been using MS access database, and i used this code to fetch records from the database on which it was working perfect. But now, as i changed my database to mysql, this piece of code is not fetching records from database. The database connections are working. The dates entered in the textbox are stored to a variable and i want to use that variables to fetch records from the database. Thanks for the help in advance. java.util.Date StartDate=(java.util.Date)textField1.getValue(); java.util.Date EndDate=(java.util.Date)textField2.getValue(); java.sql.Date startDate = new java.sql.Date(StartDate.getTime()); java.sql.Date endDate = new java.sql.Date(EndDate.getTime()); PreparedStatement ps = conn.prepareStatement("select * from table_nm where 'Date1 BETWEEN #startDate# AND #endDate#' "); ResultSet rs = ps.executeQuery(); while(i8rs.next()) { Date i8Date = rs.getDate("Date1"); String i8ItemName = rs.getString("Item_Name"); int i8Quantity = rs.getInt("Quantity"); Double i8Rate = rs.getDouble("Rate"); Double i8total = rs.getDouble("Total"); Object[] row = new Object[5]; row[0] = i8Date; row[1] = i8ItemName; row[2] = i8Quantity; row[3] = i8Rate; row[4] = i8total; tableModel.addRow(row); }
has answer: http://stackoverflow.com/a/22496461
downvote count: 0
has comment: http://stackoverflow.com/comment/34225769
has comment: http://stackoverflow.com/comment/34225749
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/34256397
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22514156
score: 1
has text: Aside of other problems, you need to take user input within your function instead.

http://stackoverflow.com/q/22540976
has comment: http://stackoverflow.com/comment/34304270
tagged with: jcombobox
tagged with: swing
tagged with: tablecellrenderer
answer count: 1
has comment: http://stackoverflow.com/comment/34304454
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22583256
has comment: http://stackoverflow.com/comment/34304562
has title: How to put JComboBox into JTable to show List<String> per row
linked to: http://stackoverflow.com/q/3256086
tagged with: jtable
type: Question
type: AnsweredQuestion
has body: I need to put JComboBox into JTable. The JComboBox should contain a list of entries corresponding to particular row. For instance: Position | Skills Programmer | List&lt;String{Java,C,C++} Web Programmer | List&lt;String{javaScript,PHP,MySQL} I populate the table with Object[][] data. One of columns of data contains List&lt;String&gt;. I wrote the following renderer. However, the problem is that it outputs the content of JComboBox in each row is the same. DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer() { public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column ); if ( value instanceof List&lt;?&gt;) { int vColIndex = 5; TableColumn col = table.getColumnModel().getColumn(vColIndex); col.setCellEditor(new ComboBoxEditor(((ArrayList&lt;?&gt;) value).toArray())); col.setCellRenderer(new ComboBoxRenderer(((ArrayList&lt;?&gt;) value).toArray())); } return this; } }; table = new JTable(model); for (int i = 0; i &lt; table.getColumnCount(); ++i) { table.getColumnModel().getColumn(i).setCellRenderer(cellRenderer); } ComboBox renderers: class ComboBoxRenderer extends JComboBox implements TableCellRenderer { public ComboBoxRenderer(Object[] objects) { super(objects); } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (isSelected) { setForeground(table.getSelectionForeground()); super.setBackground(table.getSelectionBackground()); } else { setForeground(table.getForeground()); setBackground(table.getBackground()); } // Select the current value setSelectedItem(value); return this; } } class ComboBoxEditor extends DefaultCellEditor { public ComboBoxEditor(Object[] objects) { super(new JComboBox(objects)); } }
accepted answer: http://stackoverflow.com/a/22583256

http://stackoverflow.com/comment/34380334
has text: I'm afraid we haven't learned how to use a debugger in my class.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22583179

http://stackoverflow.com/a/22512052
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22512004
score: 1
upvote count: 1
type: AcceptedAnswer
has body: There is no element with id listView1 inside activity_main.xml that's why listView is null.
type: Answer
answers question: http://stackoverflow.com/q/22512004

http://stackoverflow.com/q/22641708
upvote count: 0
has body: How can I hide the navigation bar in an Android app? My tablet uses Android 4.1.2 Thanks!
answer count: 1
has comment: http://stackoverflow.com/comment/34483577
linked to: http://stackoverflow.com/q/12469721
accepted answer: http://stackoverflow.com/a/22642118
favorite count: 0
has comment: http://stackoverflow.com/comment/34483907
tagged with: android
has comment: http://stackoverflow.com/comment/34483721
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
downvote count: 2
has title: Hiding Navigation bar
has answer: http://stackoverflow.com/a/22642118
type: Question
score: -2

http://stackoverflow.com/comment/34464412
type: AnswerComment
comment on: http://stackoverflow.com/a/22597988
type: Comment
has text: Well, did you take a look at the links I mentioned above? The alternative described there is using two persistence units addressing the same tabels. One uses the @Multitenant attribute, the other one does not.
score: 0

http://stackoverflow.com/q/22533031
score: 0
answer count: 2
tagged with: netbeans-7.4
tagged with: java
type: UnansweredQuestion
tagged with: derby
has answer: http://stackoverflow.com/a/22679333
linked to: http://stackoverflow.com/q/21418694
has body: I developed a project in Netbeans Platform Application i.e. like Modules. When i run my project from Netbeans 7.4, it works fine and doesn't show any DB exception. Now i created a installer using Netbeans 7.4 for my project. wen i install it, the DB is also installed but its not recognizing the DB and my connection url is public final static String connectionURL = "jdbc:derby:ProjectDB;create=true;user=user;password=p@ssword";. When i copy paste the DB alone in a location eg: " d:\project DB " and change the code as connectionURL = "jdbc:derby:D:\\project DB; create=true; user=user; password=p@ss" it works fine. But i need to create along with the installer or want my project to recognize the DB. When i searched i got the below links https://platform.netbeans.org/tutorials/70/nbm-crud.html https://platform.netbeans.org/tutorials/nbm-crud.html but dint get a solution.
has title: Embed Derby DB with Netbeans Platform Application - Module
type: Question
has comment: http://stackoverflow.com/comment/34322587
has comment: http://stackoverflow.com/comment/34307831
tagged with: jdbc
tagged with: netbeans
has answer: http://stackoverflow.com/a/22609792

http://stackoverflow.com/comment/35269724
has text: Ok, thank you for the answer. I have to admit that I never did researches in that way since it seemed pretty logic to me that you had to clone the repo to do these sort of commands.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22632027
type: Comment

http://stackoverflow.com/a/22631610
type: AcceptedAnswer
has body: MessageListener onMessage is called from the context of the dispatch thread inside of the Session that created the Consumer. It doesn't really matter how many threads you create because the thread that's actually invoking the onMessage call is always the same. In your case the extra threads will do no real work for you since the message continue to come from the same three Connection / Session instances so you have three session threads dispatching the same messages in either case.
answers question: http://stackoverflow.com/q/22627685
type: Answer
accepted answer of: http://stackoverflow.com/q/22627685
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/22547808
has comment: http://stackoverflow.com/comment/34719684
has comment: http://stackoverflow.com/comment/37704425
accepted answer of: http://stackoverflow.com/q/22519596
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/22519596
score: 8
has comment: http://stackoverflow.com/comment/47514246
has body: After much playing around with the numerous discussions fixes posted - all of which didn't do the trick - I resorted to using dtrace to see what files were being accessed by javac when the command was run. In terminal (you need XCode installed) sudo dtrace -s /dev/stdin syscall::open*:entry { printf("%s %s", execname, copyinstr(arg0)); } &lt;Ctrl-D&gt; The running the command line in another terminal instance I found buried in the file accessing activity for javac - which is pretty extensive considering the command line options give you the impression that you are restricting where it looks for files - I found open:entry javac /Users/me/Library/Java/Extensions/tools.jar I didn't realise I had a local extensions folder..... Deleting the contents of it fixed the problem. So, it is a version mismatch caused by old jars - as others have discovered - the problem in my case was finding them
has comment: http://stackoverflow.com/comment/48507202
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34407904
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22599170
has text: What is the error? And how are you running this?
score: 0

http://stackoverflow.com/comment/44550453
comment on: http://stackoverflow.com/a/23267681
has text: @Pacerier probably because you have installed JDK before JRE ? could really be anything. The bottom line is to get the right path after you have installed both.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22545753
has comment: http://stackoverflow.com/comment/34328216
has comment: http://stackoverflow.com/comment/34364700
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34314363
has body: The perfect question to introduce Viewport, which has been added today. Viewports are made especially to deal with this very problem. Have a look at this news and the wiki page to see how those work. However, those are only available in the nightly build. What you are actually doing at the moment, is implementing the "ScreenViewport" yourself, which always keeps the size of the screen, which leads to no stretching, but it will show more or less of your world. What you are probably looking for, is FitViewport or maybe StretchViewport. Those offer you a virtual screen size and will scale this to fit your screen.
has comment: http://stackoverflow.com/comment/34364579
type: Answer
accepted answer of: http://stackoverflow.com/q/22545396
upvote count: 1
answers question: http://stackoverflow.com/q/22545396
score: 1

http://stackoverflow.com/a/22590063
type: Answer
has comment: http://stackoverflow.com/comment/34391926
answers question: http://stackoverflow.com/q/22589653
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22589653
score: 1
has body: You really shouldn't do it like that. My recommendation is to do it like this Bitmap myPic = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); myPic = Bitmap.createScaledBitmap(myPic,50,50, true); BitmapDrawable draw = new BitmapDrawable(this.getResources(), myPic); View myView = (View) findViewById (R.id.view1); myView.setBackground(draw); This way you pass your View a drawable as a background. If you really want to set a Bitmap as your source then you should make an ImageView
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/69447194
has text: Stackoverflow documentation would be a perfect place for this doc
comment on: http://stackoverflow.com/q/22528767
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34410498
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22600666
has text: This works especially well if the number you want (6) is much smaller than the possible options (49). If they are close, it will perform poorly as it becomes harder to draw "new numbers".
score: 4

http://stackoverflow.com/q/22589653
accepted answer: http://stackoverflow.com/a/22590063
has comment: http://stackoverflow.com/comment/34390901
has comment: http://stackoverflow.com/comment/34390832
score: 0
has body: For example .. Bitmap myPic = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); Bitmap newPic = Bitmap.createScaledBitmap(myPic, 50, 50, true); Canvas myCanv = new Canvas(newPic); View myView = (View)findViewById(R.id.view1); myView.draw(myCanv); is something like the above feasible?
answer count: 1
has title: Is it possible to create a bitmap, add it to canvas and draw it using view.draw?
tagged with: android
has answer: http://stackoverflow.com/a/22590063
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/34390811
tagged with: java

http://stackoverflow.com/comment/34379209
comment on: http://stackoverflow.com/a/22575937
type: AnswerComment
has text: Almost there :) remove the else block (including the count++) and move the first count++ before the second if. The way it is now, you add a new line after the 65th byte instead of the 64th ASCII char.
type: Comment
score: 1

http://stackoverflow.com/comment/34264642
type: Comment
comment on: http://stackoverflow.com/a/22518402
score: 0
type: AnswerComment
has text: Well i want to eventually build it into a large quiz with hundreds of questions which is why i thought a database would be the best way to go for testing so i would already know how to do it when it comes to creating a full version of the app.

http://stackoverflow.com/a/36362597
answers question: http://stackoverflow.com/q/22505624
score: 1
upvote count: 1
downvote count: 0
type: Answer
has body: I think I have your answer: Basically, you need to change the naming strategy for you JPA provider. How you do this will depend on how you setup your project. In my case, using spring boot data I set a property in my application.properties to spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.EJB3NamingStrategy Without more details from you I can't give more specifics on how to do this.

http://stackoverflow.com/comment/34372675
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22579613
has text: I would urge you to take a look at Spring Boot which can vastly reduce the amount of configuration you need to write for Spring applications (whether they are web or standalone application). Take a look at this link https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-simple

http://stackoverflow.com/comment/34294178
has text: how does my_lists.get(my_lists.size()) not throw index out of bounds exception?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22535423
score: 0

http://stackoverflow.com/a/22635440
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22635188
has body: Yes. clear will remove references to objects in the list, at least the ArrayList implementation of list will do so. However if your whole List object is going out of scope anyways, you don't gain anything.

http://stackoverflow.com/q/22612347
tagged with: jdbc
has body: I've got a Java web application which runs fine for about 2 days. After that it hangs with OOM heap space errors. A thread dump gives the following information about the heap: Heap par new generation total 38336K, used 38181K [0x00000000d5a00000, 0x00000000d8390000, 0x00000000d8390000) eden space 34112K, 100% used [0x00000000d5a00000, 0x00000000d7b50000, 0x00000000d7b50000) from space 4224K, 96% used [0x00000000d7b50000, 0x00000000d7f49628, 0x00000000d7f70000) to space 4224K, 0% used [0x00000000d7f70000, 0x00000000d7f70000, 0x00000000d8390000) concurrent mark-sweep generation total 481728K, used 481727K [0x00000000d8390000, 0x00000000f5a00000, 0x00000000f5a00000) concurrent-mark-sweep perm gen total 38172K, used 22900K [0x00000000f5a00000, 0x00000000f7f47000, 0x0000000100000000) I made a heapdump which I read with VisualVM. This shows me that there is a massive amount (1.2 million) of StatementImpl instances which take up a lot of memory. Some information about the application: 16 sql connections 32 insert statements per second About 200 procedure calls per second All inserts and procedure calls go divided over those 16 connections. I never close the connections, since I keep using them. I'm 100% sure I close all Statements and PreparedStatements. What could be the cause of the large amount of StatementImpl instances?
answer count: 0
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/34431263
score: 0
has comment: http://stackoverflow.com/comment/34431935
has title: Java tomcat6 OOM, massive amount of com.mysql.jdbc.StatementImpl instances
has comment: http://stackoverflow.com/comment/34697248
type: UnansweredQuestion

http://stackoverflow.com/comment/34312203
type: AnswerComment
has text: Yes, this was exactly what I was looking for and makes complete sense. Thank you.
comment on: http://stackoverflow.com/a/22542631
score: 0
type: Comment

http://stackoverflow.com/q/22637468
type: UnansweredQuestion
has body: I have a bit of a math puzzler on my hands. I have a random value of X, where X is a double (potentially decimal value) that is 0 &lt; x &lt; 20, and an incremental integer value of Y in a loop that for purposed of this question we will cap at 1000. I want to reduce the value of X by an incremental percentage based on the current value of Y. Initially I was doing this. getrand() is an external function that returns a NEW value for X on every iteration of the loop. Integer y = 0; while (y &lt; 1000) { y = y + 1; Double x = getRand(); // any decimal value between 0 and 20 x = x / y; // the value of X,Y then gets plotted on a map doPlot(x,y); } While this works, the initial reduction of X is X / 2, then X / 3.. and so on. I would much prefer a linear(ish) or quadratic curve style reduction of X, that starts off as a small reduction of X and becomes larger as Y grows larger, and X should never be negative. Keep in mind that X could potentially be a decimal value that is &lt; 1. I still want to reduce it by a percentage. I've thought of a number of things I could do, but my code got all filled up with conditional statements to check the value of X. How can I accomplish this in short and efficient Java? Thanks! To edify - The X value is a NEW random double between 0 and 20 on EACH iteration of the loop, it is not a static value. X could be 0.00000001 or it could be 19.999999
has comment: http://stackoverflow.com/comment/34476833
has answer: http://stackoverflow.com/a/22637557
has answer: http://stackoverflow.com/a/22637937
tagged with: random
tagged with: integer
has comment: http://stackoverflow.com/comment/34477552
type: Question
tagged with: double
answer count: 2
has comment: http://stackoverflow.com/comment/34477727
score: 0
tagged with: math
tagged with: java
has title: Reduce the value of a random value of X over incremental increase in the value of Y in Java
has comment: http://stackoverflow.com/comment/34475834

http://stackoverflow.com/q/22523770
tagged with: validation
answer count: 1
downvote count: 0
has title: short way to ask for confirmation Java
favorite count: 0
has answer: http://stackoverflow.com/a/22523850
upvote count: 1
type: AnsweredQuestion
tagged with: performance
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22523850
type: Question
has body: I'm trying to find a way to ask the user a yes/no question that validates that the input is only yes (y/Y) or no (n/N). I'm trying to cut down on variables, while still keeping it readable. So far this is what I've come up with: import java.util.Scanner; public class InputValidation { public static void main(String[] args) { Scanner input = new Scanner(System.in); String answer; do { System.out.print("Do you wish to proceed? (Y/N): "); answer = input.next().trim().toUpperCase(); yesAnswer = answer.equals("Y"); } while (answer.matches("[YN]")); if (yesAnswer) { // Do something } else { // Do something else } } } I'm not necessarily looking for the least amount of characters; more something that's short and flexible. Any ideas?

http://stackoverflow.com/comment/34228206
score: 0
has text: You needn't do that, since `IllegalArgumentException` is an unchecked exception
type: Comment
comment on: http://stackoverflow.com/a/22497766
type: AnswerComment

http://stackoverflow.com/a/22509129
has comment: http://stackoverflow.com/comment/34247301
answers question: http://stackoverflow.com/q/22509066
type: Answer
upvote count: 2
has body: You are creating a local variable called wiersz inside the WTP constructor. Change the line to this.wiersz = new int[n+1]; in the WTP constructor.
has comment: http://stackoverflow.com/comment/34247087
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34247648
accepted answer of: http://stackoverflow.com/q/22509066
has comment: http://stackoverflow.com/comment/34247018

http://stackoverflow.com/a/22616798
type: Answer
answers question: http://stackoverflow.com/q/22615322
has body: Trying to measure time spans in the microsecond range is hard (or practically impossible). The resolution of the timer that is used in the System.nanoTime() call is limited, and depends on the operating system (more details can easily be found, e.g. at System.currentTimeMillis vs System.nanoTime ) Additionally, there may be arbitrary interferences, ranging from the ones that are bound to the JVM (namely, a garbage collection run), over the user-generated ones (some additional thread that you have running somewhere else in your program), to the "external" ones, like your mail client popping up the "You have mail" window, or a delay that is caused by the MP3 player that is running in the background as an amusement during the boring, boring benchmarking run ;-) A profiler is obviously the first choice for identifying bottlenecks in a complex system. And in this case, a profiler may be helpful in order to "zoom" into the method: Any method call that is done from this method could be the reason for the "spikes". For example, a call like sensorValue.getSignalValue(i) or bs.getMacAddress() could do some weird hardware interrupt accesses via a native library... or maybe randomly launch "MineSweeper" in the background, who knows. An interesting question would also be what you actually want to measure. Given the question, it may sound naive, but: Why do the spikes matter? Is the spike itself really a problem, or just an artifact that attracted your curiosity? I can not imagine that it is relevant in practice wheter whether the execution time of this method for 100 calls is 100x1ms or 99x1ms+1x2ms. If this is intended for some sort of "microbenchmarking", you should at least compute the average time over 100 calls anyhow (and preferably use a microbenchmarking framework).
score: 0

notifications
tags question: http://stackoverflow.com/q/22591166
tags question: http://stackoverflow.com/q/22585696
tags question: http://stackoverflow.com/q/22614912
tag name: notifications
tags question: http://stackoverflow.com/q/22510816
type: Tag
tags question: http://stackoverflow.com/q/22635597

http://stackoverflow.com/a/22646454
upvote count: 1
has comment: http://stackoverflow.com/comment/34492381
accepted answer of: http://stackoverflow.com/q/22646328
answers question: http://stackoverflow.com/q/22646328
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34492354
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/34492505
has body: The simplest way to use this is to use the Random.nextFloat() method for this, and then check which range the random number between 0-1 falls in. Based on your question comments, you probably want something more like this: Random r = new Random(); p[0]=0.2; p[1]=0.4; p[2]=0.15; p[3]=0.25; float myVal = r.nextFloat(); float probSum = 0.0; for (int i = 0; i &lt; p.length; p++) { probSum += p[i]; if (myVal &lt;= probSum) { return i; } } return p.length-1; Obviously you can pretty this up, but this is a general idea that should work.

http://stackoverflow.com/q/22613829
linked to: http://stackoverflow.com/q/24426635
has body: Sometimes when I go to reboot my application to test, I am thrown a fatal excepton. Doesn't happen all the time and I'm testing through my device not an emulator, just as I always do. I'm not seeing a line where my code is erroring out so not sure what to do from here? 03-24 16:26:24.692: E/AndroidRuntime(1407): FATAL EXCEPTION: main 03-24 16:26:24.692: E/AndroidRuntime(1407): Process: com.jameswilson.fairbook, PID: 1407 03-24 16:26:24.692: E/AndroidRuntime(1407): java.lang.RuntimeException: Unable to instantiate application com.jameswilson.fairbook.FairBookApplication: java.lang.IllegalStateException: Unable to get package info for com.jameswilson.fairbook; is package not installed? 03-24 16:26:24.692: E/AndroidRuntime(1407): at android.app.LoadedApk.makeApplication(LoadedApk.java:516) 03-24 16:26:24.692: E/AndroidRuntime(1407): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317) 03-24 16:26:24.692: E/AndroidRuntime(1407): at android.app.ActivityThread.access$1500(ActivityThread.java:135) 03-24 16:26:24.692: E/AndroidRuntime(1407): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 03-24 16:26:24.692: E/AndroidRuntime(1407): at android.os.Handler.dispatchMessage(Handler.java:102) 03-24 16:26:24.692: E/AndroidRuntime(1407): at android.os.Looper.loop(Looper.java:136) 03-24 16:26:24.692: E/AndroidRuntime(1407): at android.app.ActivityThread.main(ActivityThread.java:5017) 03-24 16:26:24.692: E/AndroidRuntime(1407): at java.lang.reflect.Method.invokeNative(Native Method) 03-24 16:26:24.692: E/AndroidRuntime(1407): at java.lang.reflect.Method.invoke(Method.java:515) 03-24 16:26:24.692: E/AndroidRuntime(1407): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 03-24 16:26:24.692: E/AndroidRuntime(1407): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 03-24 16:26:24.692: E/AndroidRuntime(1407): at dalvik.system.NativeStart.main(Native Method) 03-24 16:26:24.692: E/AndroidRuntime(…
tagged with: android
upvote count: 6
answer count: 0
has comment: http://stackoverflow.com/comment/34452491
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/34440775
linked to: http://stackoverflow.com/q/26210695
has comment: http://stackoverflow.com/comment/68407916
type: Question
duplicate of: http://stackoverflow.com/q/10150899
tagged with: java
tagged with: eclipse
has title: Unable to instantiate application, Unable to get package info, Package not installed?
has comment: http://stackoverflow.com/comment/52247624
has comment: http://stackoverflow.com/comment/50571614
downvote count: 0
linked to: http://stackoverflow.com/q/10150899
favorite count: 0

http://stackoverflow.com/q/22488310
type: UnansweredQuestion
tagged with: basic-authentication
has comment: http://stackoverflow.com/comment/34217398
answer count: 0
has comment: http://stackoverflow.com/comment/34218663
tagged with: java
has body: I am trying to connect to a page that requires http basic authentication. I have already accomplished that by passing the credentials through the request header in the web client. But my first goal is to be able to read the contents of the "Authentication Required" pop up dialogue box. Second would be to fill out the username and password and then finally click on the "login" button in the dialogue. Everytime I try to access such page using HtmlUnit It gives me 401 Unauthorized page , the page that you get after you click on "cancel" or "login" with invalid credentials. Does HtmlUnit API have the capability to access the contents of the basic authentication pop up dialogue ? Appreciate your assistance/suggestions.
type: Question
has comment: http://stackoverflow.com/comment/34213830
has comment: http://stackoverflow.com/comment/34217540
has title: HtmlUnit Accessing Basic Authentication Dialogue
has comment: http://stackoverflow.com/comment/34218074
score: 0
tagged with: htmlunit
has comment: http://stackoverflow.com/comment/34250568
tagged with: web

http://stackoverflow.com/comment/34240694
type: Comment
type: QuestionComment
has text: I mean "different Adobe Reader versions"
score: 0
comment on: http://stackoverflow.com/q/22505148

http://stackoverflow.com/comment/34442510
has text: @JonSkeet Does it have something to do with the size and look and feel?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22618165

http://stackoverflow.com/comment/34257423
type: QuestionComment
has text: @spydon it does, but i need this to be user set..
score: 0
comment on: http://stackoverflow.com/q/22514136
type: Comment

http://stackoverflow.com/a/22631497
has body: See the javadoc for Object's .equals(): The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true). Which means, if you don't override it in your class, this is what you get. The JLS is still right about what it says; however it is up to implementations to define their own .equals() contract. (and of course, if you override .equals(), you should override .hashCode() as well)
has comment: http://stackoverflow.com/comment/34465478
accepted answer of: http://stackoverflow.com/q/22631448
type: Answer
has comment: http://stackoverflow.com/comment/34465289
has comment: http://stackoverflow.com/comment/34465995
has comment: http://stackoverflow.com/comment/34465685
has comment: http://stackoverflow.com/comment/34465831
answers question: http://stackoverflow.com/q/22631448
has comment: http://stackoverflow.com/comment/34465522
has comment: http://stackoverflow.com/comment/34465625
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34276400
has text: What do you mean by *absolute value*? There is a method `String.format()`, that works like `printf()`.
comment on: http://stackoverflow.com/a/22525365
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34468591
has text: is there not possible without cipher..??If no then any possible solution?
comment on: http://stackoverflow.com/q/22633253
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34418101
comment on: http://stackoverflow.com/a/22604862
score: 0
type: AnswerComment
type: Comment
has text: Why are you assuming it as POJO? Class can also contain public data members.

http://stackoverflow.com/q/22526593
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34278239
has answer: http://stackoverflow.com/a/22526673
type: Question
has answer: http://stackoverflow.com/a/22526990
has title: Sort HashMap keys and store in ArrayList
tagged with: hashmap
downvote count: 0
has body: I need to do the task of sorting HashMap keys which will be String always and store them in an ArrayList. I have written below piece of code public static List&lt;String&gt; getSortedListByKeys(HashMap&lt;String,String&gt; keysDictionary) { List&lt;String&gt; sortedKeysList = null; SortedSet&lt;String&gt; sortedKeysSet = null; if(keysDictionary == null || keysDictionary.size() == 0){ return null; } sortedKeysSet = new TreeSet&lt;&gt;(keysDictionary.keySet()); sortedKeysList = new ArrayList&lt;&gt;(sortedKeysSet); return sortedKeysList; } I have run it and it is working fine. Just want to know if there is any better way to achieve the same
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34278216
answer count: 3
has answer: http://stackoverflow.com/a/22527093
has comment: http://stackoverflow.com/comment/34278303
possible better answer: http://stackoverflow.com/a/22526990
upvote count: 2
accepted answer: http://stackoverflow.com/a/22526673

http://stackoverflow.com/comment/34442647
comment on: http://stackoverflow.com/a/22617974
type: AnswerComment
score: 0
type: Comment
has text: @ultra_buckner post the whole code i can't see where your listview is initialized?

http://stackoverflow.com/comment/34461519
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22629294
has text: can you post the file structure of your application?
score: 0

http://stackoverflow.com/a/22517841
has comment: http://stackoverflow.com/comment/34263347
has comment: http://stackoverflow.com/comment/34263530
type: Answer
has comment: http://stackoverflow.com/comment/34263289
score: 3
has comment: http://stackoverflow.com/comment/34263110
has comment: http://stackoverflow.com/comment/34263441
upvote count: 3
answers question: http://stackoverflow.com/q/22517765
has body: If you want to use a standard object, use a HashSet. It has O(1) access time in an ideal case. It can degrade if there are collisions (In theory to O(n)). Since you know the set of strings beforehand, you can play with the load-factor a little bit to minimize collisions. In theory, you can also provide a custom hash function by wrapping the strings in an custom object (that would allow you to optimize the function to the distribution of the strings). But unless your strings are somehow really special, I think it would be an overkill. If you want to/can use a third-party library: you can either use a trie or a finite state automaton. They will be really fast. What I would recommend: Use HashSet first as it comes with every java. If you see you need something faster, look for a reasonable implementation of a trie. But I expect you will see that the hashset is fast enough.
has comment: http://stackoverflow.com/comment/34263540
has comment: http://stackoverflow.com/comment/34263456
downvote count: 0

http://stackoverflow.com/a/22542256
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22537084
has body: Try this...its only for 1 row, but you get the idea..this is inside vertical linear layout.. <ImageView android:id="@+id/imageView1" android:layout_width="0dp" android:layout_weight="1" android:src="@drawable/ic_launcher" android:layout_height="wrap_content" /> <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="1dp" android:src="@drawable/ic_launcher" android:layout_weight="1" android:layout_gravity="center_horizontal"/> <ImageView android:id="@+id/imageView3" android:layout_width="0dp" android:layout_weight="1" android:src="@drawable/ic_launcher" android:layout_height="wrap_content" /> <ImageView android:id="@+id/imageView4" android:layout_width="0dp" android:layout_weight="1" android:src="@drawable/ic_launcher" android:layout_height="wrap_content" />
downvote count: 0
has comment: http://stackoverflow.com/comment/34340741
has comment: http://stackoverflow.com/comment/34335598
type: Answer

http://stackoverflow.com/comment/34241123
score: 0
type: Comment
has text: @tobias_k Thanks, that's definitely better. Edited the post.
comment on: http://stackoverflow.com/a/22505630
type: AnswerComment

http://stackoverflow.com/comment/34393241
has text: @BigFatProgrammer: The naive solution is to not use threads. If you want sequential behaviour, then don't use parallelisation.
comment on: http://stackoverflow.com/a/22591115
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22642875
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/52435857
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/20773888
type: Question
linked to: http://stackoverflow.com/q/15383244
has title: Runtime Error: Main method not found in class ImageTool, please define the main method as: public static void main(String[] args)
has body: Why does my code (compiles fine) gives me the following error? Main method not found in class ImageTool, please define the main method as: public static void main(String[] args) Code: public class ImageTool { public static void main(String[] args) { if (args.length &lt;1) { System.out.println("Please type in an argument"); System.exit(-1); } if (args[0].equals("--dump")) { String filename = args[1]; int[][] image = readGrayscaleImage(filename); print2DArray(image); } else if (args[0].equals("--reflectV")) { String filename = args[1]; int[][] image = readGrayscaleImage(filename); int[][] reflect = reflectV(image); //reflectV method must be written String outputFilename = args[2]; writeGrayscaleImage(outputFilename,reflect); } }
has answer: http://stackoverflow.com/a/22642936

http://stackoverflow.com/q/22577914
has answer: http://stackoverflow.com/a/56931618
tagged with: email
has body: i m new here.. i m trying to send username and password to user's email id but it showing me an error about address which i have checked but its correct. here is my emailutility code: Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(userName)); InternetAddress[] toAddresses = { new InternetAddress(toAddress) }; msg.setRecipients(Message.RecipientType.TO, toAddresses); msg.setSubject(subject); msg.setSentDate(new Date()); msg.setText(message); and this is my emailsending servlet code: Logic.EmailUtility.sendEmail(host, port, user, pass, email, subject, message); resultMessage = "The username and password has been sent successfully"; connection con = new connection(); con.getConnection(); String query = "insert into users (usertype,en_no,password) values(?,?,?)"; PreparedStatement ps = con.getConnection().prepareStatement(query) ; and showing me the following error: javax.mail.internet.AddressException: Illegal address in string ``'' at javax.mail.internet.InternetAddress.&lt;init&gt;(InternetAddress.java:110) at Logic.EmailUtility.sendEmail(EmailUtility.java:50) at Servlet.EmailSendingServlet.doPost(EmailSendingServlet.java:110) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorB…
has answer: http://stackoverflow.com/a/74651686
favorite count: 0
has answer: http://stackoverflow.com/a/22577975
accepted answer: http://stackoverflow.com/a/25801512
downvote count: 1
possible better answer: http://stackoverflow.com/a/22577975
type: AnsweredQuestion
has title: javax.mail.internet.AddressException: Illegal address in string ``''
tagged with: java
upvote count: 10
type: Question
score: 9
answer count: 6
has answer: http://stackoverflow.com/a/23378000
has answer: http://stackoverflow.com/a/25801512
has answer: http://stackoverflow.com/a/25778290

http://stackoverflow.com/q/22609355
type: Question
has answer: http://stackoverflow.com/a/22609512
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/39273928
upvote count: 1
has comment: http://stackoverflow.com/comment/34425759
answer count: 6
tagged with: hosting
has title: How to connect to online mysql database from Java desktop app
tagged with: java
has answer: http://stackoverflow.com/a/39272618
has answer: http://stackoverflow.com/a/22610008
tagged with: mysql
has answer: http://stackoverflow.com/a/38347951
has answer: http://stackoverflow.com/a/22609441
tagged with: eclipse
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34425919
linked to: http://stackoverflow.com/q/2121829
has body: I pave paid hosting, and i added my database to it. I am trying to connect to this online database from my java desktop application but, i got exception: Communications link failure. here is my code: public Kviz_DAO(){ try{ Class.forName("com.mysql.jdbc.Driver"); konekcija = DriverManager.getConnection("jdbc:mysql://penal.ba:2082/mydatabasename?"+ "user=mydbuser&amp;password=mydbpassword"); } catch(Exception ex){ ex.printStackTrace(); } } Can anyone tell me what i'm doing wrong.
has comment: http://stackoverflow.com/comment/34425627

http://stackoverflow.com/a/22523398
has comment: http://stackoverflow.com/comment/34273189
has comment: http://stackoverflow.com/comment/34273141
answers question: http://stackoverflow.com/q/22523325
score: 0
type: Answer
has body: You have not added end tag for two EditText for school id and psupervisor id: &lt;EditText android:id="@+id/school" android:layout_width="400dp" android:layout_height="35dp" android:layout_marginTop="-8dp" android:layout_alignLeft="@+id/name" android:inputType="textCapWords|textPersonName" android:background="#0000" android:textAppearance="@style/TextStyle1" android:ellipsize="start" android:maxLines = "1" android:lines = "1" android:layout_below="@+id/name" /&gt; // Here &lt;EditText android:id="@+id/psupervisor" android:layout_width="400dp" android:layout_height="35dp" android:layout_marginTop="-9dp" android:layout_alignLeft="@+id/school" android:inputType="textCapWords|textPersonName" android:background="#0000" android:textAppearance="@style/TextStyle1" android:ellipsize="start" android:maxLines = "1" android:lines = "1" android:layout_below="@+id/school" /&gt; // Here Also, you need to use : &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/editFormLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFF" android:orientation="vertical" &gt; // Remove /&gt; from here

http://stackoverflow.com/a/22494896
has comment: http://stackoverflow.com/comment/34223733
type: Answer
has body: Change int resId = getResources().getInteger(R.id.btn_picture); to int resId = R.id.btn_picture; because R.id.btn_picture is already an integer id for view so no need to use getResources().getInteger;
answers question: http://stackoverflow.com/q/22494714
score: 0

http://stackoverflow.com/a/22526904
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22526819
has body: Hash codes should be equal if objects are equal (the reverse is not true, however). Since sn1.equals(sn2) // true We can conclude that sn1.hashCode() == sn2.hashCode() // true
upvote count: 3
score: 3

http://stackoverflow.com/q/22528675
tagged with: long-integer
answer count: 1
has comment: http://stackoverflow.com/comment/34283314
has comment: http://stackoverflow.com/comment/34286735
downvote count: 1
has answer: http://stackoverflow.com/a/22530077
has title: Why does java.lang.Long's .longValue() cast its (long) instance value to long?
upvote count: 27
favorite count: 0
has comment: http://stackoverflow.com/comment/34282163
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34281981
has comment: http://stackoverflow.com/comment/34282276
linked to: http://stackoverflow.com/q/20922867
has body: I have been investigating the java.lang.Long class source code. Consider this: public final class Long extends Number implements Comparable&lt;Long&gt; { .... private final long value; .... public long longValue() { return (long)value; } .... } What is the reason to cast long to long? Why not reralize serialize (?) it into Number class in this case? P.S.1 source code link I have these possible explanations: Carelessness of developers Compliance with some unified code style It was made for some special case, but I don't understand why. P.S.2 my java version - 1.7.0_45-b18 P.S.3 just for information: Integer: public final class Integer extends Number implements Comparable&lt;Integer&gt; { .... private final int value; .... public int intValue() { return value; } .... } Short: public final class Short extends Number implements Comparable&lt;Short&gt; { .... private final short value; .... public short shortValue() { return value; } .... } and same for Byte and Character. (None of these cast like-to-like.) Is it a problem, or may it just be forgotten?
has comment: http://stackoverflow.com/comment/34282050
has comment: http://stackoverflow.com/comment/34287126
has comment: http://stackoverflow.com/comment/34282239
has comment: http://stackoverflow.com/comment/34391232
tagged with: numbers
has comment: http://stackoverflow.com/comment/34391196
tagged with: java
has comment: http://stackoverflow.com/comment/34282035
type: Question
has comment: http://stackoverflow.com/comment/34304380
score: 26
has comment: http://stackoverflow.com/comment/36179677

http://stackoverflow.com/comment/34386773
type: QuestionComment
has text: You have problem in your logic, you just iterate from 2 to n once, but you should have one function which checks whether number is prime or not, and call that function inside loop.
comment on: http://stackoverflow.com/q/22587381
score: 0
type: Comment

http://stackoverflow.com/comment/34219472
comment on: http://stackoverflow.com/q/22492214
score: 0
type: Comment
type: QuestionComment
has text: of course I don't have another copy there. Shouldn't it gives me an error when I use processQuery instead of invertedIndex.processQuery? I am not used to java, C# would definitely gives me a compile error. The test class is in another file, another folder. still ...

http://stackoverflow.com/q/22511600
has title: cannot access jar library
has comment: http://stackoverflow.com/comment/34266058
tagged with: java
has comment: http://stackoverflow.com/comment/34251919
type: Question
has comment: http://stackoverflow.com/comment/34265774
has comment: http://stackoverflow.com/comment/34266034
has comment: http://stackoverflow.com/comment/34265128
has comment: http://stackoverflow.com/comment/34264570
score: 0
has comment: http://stackoverflow.com/comment/34265397
has body: I am working on a program that uses OCR to read an invoice and sort it accordingly. The program works fine in NetBeans, it works fine when i run from command prompt. However if i just right-click and run the jar application, the GUI will open, but when I click the button that would activate the OCR program (using ASPRISE for anyone who is familiar) it will not "scan" the invoice. I'm using a trial right now so i can pitch it to my company, don't have the 1500 lying around to purchase the license. When the jar library is accessed it pops up with a dialog box asking if you want to purchase the license. It does not do this unless you run the program in NetBeans or from the command prompt. It does not throw any exceptions with command prompt open...so the program is not accessing the jar file outside of a command prompt/IDE. If an ideal fix is unavailable, i would even settle for a solution to adding a command prompt window to open with the program if possible.
tagged with: ocr
has comment: http://stackoverflow.com/comment/34264548
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34265645

http://stackoverflow.com/q/22519315
tagged with: java
has comment: http://stackoverflow.com/comment/34266480
has comment: http://stackoverflow.com/comment/34266365
tagged with: jlayer
has body: I'm using tritonus, mp3spi, and jl1.0.1 . When I try and debug OR run in Eclipse (OSX) it throws a NullPointerException. But on Windows it works just fine. Any advice? I'd love to get this working to develop cross-platform. The part that makes it strange is it's only on Mac. java.lang.NullPointerException at com.plake.audio.JukeBox.load(JukeBox.java:26) at com.plake.gamestate.MenuState.&lt;init&gt;(MenuState.java:59) at com.plake.gamestate.GameStateManager.loadState(GameStateManager.java:85) at com.plake.gamestate.GameStateManager.&lt;init&gt;(GameStateManager.java:49) at com.plake.main.GamePanel.init(GamePanel.java:54) at com.plake.main.GamePanel.run(GamePanel.java:59) at java.lang.Thread.run(Thread.java:695) JukeBox: public static void load(final String s, final String n) { try { if (JukeBox.clips.get(n) != null) { return; } final AudioInputStream ais = AudioSystem.getAudioInputStream(JukeBox.class.getResourceAsStream(s)); final AudioFormat baseFormat = ais.getFormat(); final AudioFormat decodeFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, baseFormat.getSampleRate(), 16, baseFormat.getChannels(), baseFormat.getChannels() * 2, baseFormat.getSampleRate(), false); final AudioInputStream dais = AudioSystem.getAudioInputStream(decodeFormat, ais); final Clip clip = AudioSystem.getClip(); clip.open(dais); JukeBox.clips.put(n, clip); } catch (Exception e) { e.printStackTrace(); } } Error is after the if statement
score: 0
answer count: 0
has title: Strange error when loading MP3 on OSX
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34266308
type: Question
tagged with: audio

http://stackoverflow.com/comment/34560124
type: QuestionComment
has text: @Marco13: Can you advice me how to use the `pack` ? It says pack the "classes" using it, but the usage expects jars to be mentioned, not java classes!
type: Comment
comment on: http://stackoverflow.com/q/22597183
score: 0

http://stackoverflow.com/a/25062279
type: Answer
has body: The answer of using a Map was a little unclear to me... how do you convert an arbitrary JSON String to a Map in a way that Spring Data will persist it as-is? I found that using a property of type "com.mongodb.DBObject" works. Then set your property using JSON.parse: profile = (DBObject) JSON.parse(arbitraryJSONString)
has comment: http://stackoverflow.com/comment/46288240
answers question: http://stackoverflow.com/q/22633828
has comment: http://stackoverflow.com/comment/46306005
score: 0

http://stackoverflow.com/q/22534080
tagged with: tomcat
tagged with: console
has title: Where does the Tomcat 7.0 console output go?
type: UnansweredQuestion
tagged with: windows
tagged with: service
answer count: 0
has body: I installed the latest tomcat 7 Windows service on windows 7 as an admin user. Tomcat Documentation doesn't say which file the console output gets redirected to. How can I find out ? I issued a thread/stack dump request as per this redhat article. but would like to know where the jvm thread dump ended in. I looked for catalina.out but I couldn't find it in the TOMCAT install dir or installDir\logs dir.
has comment: http://stackoverflow.com/comment/34397121
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34595181
score: 0

http://stackoverflow.com/comment/34497850
type: AnswerComment
comment on: http://stackoverflow.com/a/22627619
type: Comment
score: 1
has text: How can i make the panel background not transparent?

http://stackoverflow.com/a/22517314
score: 3
has comment: http://stackoverflow.com/comment/34262209
type: Answer
has comment: http://stackoverflow.com/comment/34262432
has body: here's the explanation: num1 = rand.nextInt(7) + 1; //This generates a random number between 1 and 7 (because rand.nextInt(n); returns a random number between 0 and n, then first number in a phone number can't be zero, that's why +1 is added. num4 = rand.nextInt(643) + 100; // This one generates a random number between 1 and 643 and add 100 (because it can be 0 - 99 but that don't give us a number of 3 digits), so we add 100 and it will give us a number of 3 digits. num5 = rand.nextInt(1001) + 1000; // returns a random number of 4 digits between 1000 and 1001, so basicaly: 1000 or 1001. String number = "" + num1 + num2 + num3 + "-" + num4 + "-" + num5; //this will be the example: number = "367-783-1001"; System.out.println("Your assigned phone number is: " + number); Your assigned phone number is: 367-783-1001 It concatenates them because we're adding them into a String (text variable) instead of int (number variable) The way they're adding the numbers is correct Yeah if you add "" to the beggining the compiler will parse from int to String (I don't know why), but you can change it to: String number = String.valueOf(num1) + String.valueOf(num2) + String.valueOf(num3) + "-" + String.valueOf(num4) + "-" + String.valueOf(num5); Or: String number = Integer.toString(num1) + Integer.toString(num2) + Integer.toString(num3) + "-" + Integer.toString(num4) + "-" + Integer.toString(num5);
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34262089
answers question: http://stackoverflow.com/q/22517074

http://stackoverflow.com/comment/34343936
type: Comment
type: QuestionComment
has text: What is the error message?
comment on: http://stackoverflow.com/q/22563609
score: 5

http://stackoverflow.com/q/22507736
accepted answer: http://stackoverflow.com/a/22868061
score: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34612633
favorite count: 0
has title: Incomplete file download when using Windows (Java)
has comment: http://stackoverflow.com/comment/34246831
has comment: http://stackoverflow.com/comment/34245158
has comment: http://stackoverflow.com/comment/34245239
has body: I can't realize why my file download function perfectly works on Linux, but on Windows it only downloads 1-2 KB of file and finishes. What am I doing wrong? I've already tried approx. 3 examples from Stack Overflow, but no result. Big thanks, you'll save my mind! public static void get(String URL, String filename) throws IOException, ArithmeticException { URL connection = new URL(URL); HttpURLConnection conn; conn = (HttpURLConnection) connection.openConnection(); conn.setRequestMethod("GET"); conn.connect(); InputStream in = conn.getInputStream(); OutputStream writer = new FileOutputStream(filename); byte buffer[] = new byte[55000]; int c = in.read(buffer); while (c &gt; 0) { writer.write(buffer, 0, c); c = in.read(buffer); } writer.flush(); writer.close(); in.close(); }
has comment: http://stackoverflow.com/comment/34245847
upvote count: 2
has answer: http://stackoverflow.com/a/22868061
tagged with: java
has comment: http://stackoverflow.com/comment/34244761
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34245067

http://stackoverflow.com/a/22584169
upvote count: 3
has comment: http://stackoverflow.com/comment/34418598
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22583785
has body: You need to specify files to compile (space delimited if multiple). If just by name, they must be in the current folder. The path concept will not work here, all files that must be compiled should be directly specified in the input. Normally javac compiler alone is only used if you only need to compile one or two files as proof of concept. Use more advanced command line tool like ant (works under Windows) for the real world size projects.

http://stackoverflow.com/q/22538210
has title: Is it possible to include Javac lint in the Android lint report?
tagged with: gradle
type: Question
tagged with: java
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22540512
has body: When generating the Android lint report using ./gradlew lintDebug, the javac lint errors such as deprecation or unchecked conversions are not included in the report. I currently am just enabling these javac options when compiling: (build.gradle) tasks.withType(Compile) { options.compilerArgs &lt;&lt; "-Xlint:unchecked" &lt;&lt; "-Xlint:deprecation" } But the problem with this is that the error messages are sent to the console, not to the lint report. It is really a trivial matter, but it would be nice if all lint showed up in the same place. My current lintDebug output: $ ./gradlew lintDebug :&lt;Project Name&gt;:preBuild :&lt;Project Name&gt;:preDebugBuild :&lt;Project Name&gt;:checkDebugManifest :&lt;Project Name&gt;:preReleaseBuild :&lt;Project Name&gt;:prepareFrAvianeyFacebookAndroidApi370Library :&lt;Project Name&gt;:prepareDebugDependencies :&lt;Project Name&gt;:compileDebugAidl :&lt;Project Name&gt;:compileDebugRenderscript :&lt;Project Name&gt;:generateDebugBuildConfig :&lt;Project Name&gt;:mergeDebugAssets :&lt;Project Name&gt;:generateDebugResValues UP-TO-DATE :&lt;Project Name&gt;:generateDebugResources :&lt;Project Name&gt;:mergeDebugResources :&lt;Project Name&gt;:processDebugManifest :&lt;Project Name&gt;:processDebugResources :&lt;Project Name&gt;:generateDebugSources :&lt;Project Name&gt;:compileDebugJava /path/to/some/File.java:136: warning: [unchecked] unchecked conversion Iterator&lt;String&gt; keyIterator = errors.keys(); ^ required: Iterator&lt;String&gt; found: Iterator 1 warning :&lt;Project Name&gt;:compileLint :&lt;Project Name&gt;:lintDebug Wrote HTML report to file:/path/to/lint-results-debug.html Wrote XML report to /path/to/lint-results-debug.xml BUILD SUCCESSFUL Total time: 3.936 secs And my lint-results-debug.xml file: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;issues format="4" by="lint 22.6.1"&gt; &lt;issue id="IconDensities" /&gt; &lt;!-- Along with the information about the IconDensities lint --&gt; &lt;/issues&gt;
tagged with: android
has answer: http://stackoverflow.com/a/22540512
type: AnsweredQuestion

http://stackoverflow.com/comment/34460618
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22616276
has text: I wouldn't recommend to get JSF do the "progress" thing... I think you might need a client-side solution.. maybe like this http://www.gayadesign.com/diy/queryloader-preload-your-website-in-style/
score: 0

http://stackoverflow.com/q/22643808
has title: Update swing JEditorPane from runnable class
tagged with: settext
score: 2
tagged with: runnable
downvote count: 0
has comment: http://stackoverflow.com/comment/34488999
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/22647122
has comment: http://stackoverflow.com/comment/34487760
tagged with: swing
has answer: http://stackoverflow.com/a/22651988
has body: I am writing this java server program with Swing using intellij idea and I am trying to create a thread from my main class that will start a server and update a JEditorPane in another class. So far my code is a long the lines of. public class ServerClass implements Runnable { private ClassWithLog statusLog = new ClassWithLog(); public ServerClass() { startServer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { startServer(); } }); } private void startServer() { new Thread(this).start(); } public void run() { .. Receive packet stuff here .. statusLog.updateData("Received..."); } } Than I have my logging class which is a different form that contains code like so: public class ClassWithLog { public ClassWithLog() { .. all the action listeners for swing.. } public void updateData(String data) { logControl.setText(logControl.getText() + data); } } I set a breakpoint in the updateData method and I see that data is getting my string I need but when logControl sets the text it is not showing in the form? Any help would be appreciated thanks!
tagged with: java
has comment: http://stackoverflow.com/comment/34487904
has comment: http://stackoverflow.com/comment/34487679
type: Question
answer count: 2

http://stackoverflow.com/a/25214278
has comment: http://stackoverflow.com/comment/39272005
upvote count: 2
has comment: http://stackoverflow.com/comment/39271781
has body: The solution in the accepted answer didn't work for me; I got the error: tools.jar: No such file or directory. However, I found a working solution here. In short, I installed the latest version of the jdk from Oracle website and this solves the problem.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/39272057
downvote count: 0
has comment: http://stackoverflow.com/comment/39272097
answers question: http://stackoverflow.com/q/22493736

http://stackoverflow.com/a/22626893
answers question: http://stackoverflow.com/q/22626845
accepted answer of: http://stackoverflow.com/q/22626845
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34457679
has body: When you call your helper function you have to pass in the response object. Reason being that JSPs gets translated to Java Code, which is then compiled so it can run on JVM. Things between &lt;%!...%&gt; will get translated into helper methods that has different context than the code in &lt;%...%&gt;. Your jsp will get translated into something like this: public class MyJsp { public void doPost(HttpServletRrequest request, HttpServletResponse response) { /* tons of code compiled off JSP */ sendSMS(...) } private void sendSMS(String nickName, String setAnmae...) { String acctInfo="xxx"; response.sendRedirect(...); // error, there is no response object in the local context } } Something like this would work %@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %&gt; &lt;%@ page import="javax.mail.*"%&gt; &lt;%@ page import="javax.mail.internet.*"%&gt; &lt;%@ page import="javax.activation.*"%&gt; &lt;%@ page import="java.util.*,java.io.*"%&gt; &lt;%@ page language="java" %&gt; &lt;%@ page import="com.mysql.jdbc.Driver" %&gt; &lt;%@ page import="java.sql.*" %&gt; &lt;% sendSMS(arg1, arg2, arg3, ar4, response) %&gt; &lt;%! public void sendSMS(String nickName, String setAname, String currAname, String toPhone, ServletResponse response){ String acctInfo="xxx"; String acctPwd="xxx"; String contents="Message from Miss U:( \n Please be reminded that your friend:"+nickName+" is OUT of your setting area: "+setAname+". The current area is "+currAname+"."; String smsURL="http://api.accessyou.com/sms/sendsms-utf8.php?msg="+contents+"&amp;phone="+toPhone+"&amp;pwd="+acctPwd+"&amp;accountno="+acctInfo; response.sendRedirect(smsURL); } %&gt; Notice how in sendSMS you don't have direct access to the request and response object.
has comment: http://stackoverflow.com/comment/34457647
upvote count: 1
type: AcceptedAnswer

recursion
type: Tag
tags question: http://stackoverflow.com/q/22548565
tags question: http://stackoverflow.com/q/22639421
tags question: http://stackoverflow.com/q/22567471
tags question: http://stackoverflow.com/q/22609726
tags question: http://stackoverflow.com/q/22583517
tags question: http://stackoverflow.com/q/22492000
tags question: http://stackoverflow.com/q/22615851
tags question: http://stackoverflow.com/q/22639797
tag name: recursion
tags question: http://stackoverflow.com/q/22614967
tags question: http://stackoverflow.com/q/22625885
tags question: http://stackoverflow.com/q/22521953
tags question: http://stackoverflow.com/q/22642912
tags question: http://stackoverflow.com/q/22598647
tags question: http://stackoverflow.com/q/22573024
tags question: http://stackoverflow.com/q/22515368
tags question: http://stackoverflow.com/q/22495908
tags question: http://stackoverflow.com/q/22543308
tags question: http://stackoverflow.com/q/22597903
tags question: http://stackoverflow.com/q/22537502
tags question: http://stackoverflow.com/q/22646557
tags question: http://stackoverflow.com/q/22529590
tags question: http://stackoverflow.com/q/22623821
tags question: http://stackoverflow.com/q/22560622
tags question: http://stackoverflow.com/q/22538198
tags question: http://stackoverflow.com/q/22642231
tags question: http://stackoverflow.com/q/22624858
tags question: http://stackoverflow.com/q/22610249
tags question: http://stackoverflow.com/q/22624983

http://stackoverflow.com/a/22543481
score: 3
downvote count: 0
type: Answer
upvote count: 3
has body: A simple regex to use: ^[A-Za-z]{2}/[0-9]{4}$ String regex = "^[A-Za-z]{2}/[0-9]{4}$"; String test = "ab/1232"; if (test.matches(regex)) { // my regex matches }
answers question: http://stackoverflow.com/q/22543314

http://stackoverflow.com/a/22501382
accepted answer of: http://stackoverflow.com/q/22501005
has body: The result name attribute should be unique per action configuration, so the action is able to return this result. Using a stream result type requires to provide a getter for the stream introduced by the inputName parameter. The content type returned is text/html so you need to parse this text via javascript. You can use JSON.parse(data). The data will be available to you if you make an Ajax request to the server like $.ajax() by providing the URL mapped to the action. On the success function handler you will get the data. For the difference and explanation how to use a stream result vs json result to return json string to the client javascript see this answer.
answers question: http://stackoverflow.com/q/22501005
type: Answer
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/34335003
comment on: http://stackoverflow.com/a/22558488
score: 0
type: AnswerComment
has text: Why? If you have an ESB it has to provide for you an implenetation, you just need to ask it to return a JMS connection factory. Your task just to work with contract, and you are a JMS client, not a server. Right, if your ESB server is ActiveMQ, you can use it's client to connect to the server. But for me it looks a bit odd: what is a reason of ESB, if your client application depends on concrete implementation.
type: Comment

http://stackoverflow.com/comment/34386794
score: 2
has text: HashMaps are not sorted. They store elements in an unpredictable order. Where did you get the idea that HashMaps are sorted?
comment on: http://stackoverflow.com/q/22587427
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34504734
comment on: http://stackoverflow.com/q/22646308
score: 0
type: Comment
type: QuestionComment
has text: First of all make sure your assets folder is marked as `source` folder. If it is the assets folder of your android project i think it is allready set as `source`. Next thing: The `Gdx.files.Internal` looks INSIDE every source folder. This means if inside your assets there is a folder named `data` you have to say "data/mario.png", not "assets/data/mario.png". Also take care about the case (case sensitive) and the extension (.png, .jpg...)

http://stackoverflow.com/a/34162032
answers question: http://stackoverflow.com/q/22618582
type: Answer
upvote count: 2
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/71428261
has body: In Windows: -XX:ErrorFile=C:\targetDir\hs_err_pid_%%p.log

http://stackoverflow.com/comment/34227750
score: 0
type: QuestionComment
has text: OK, why don't you just create a normal `PersonTable` and call `table.createTable(null, null);`? If your construct above can actually capture the IllegalArgumentException then it should work.
type: Comment
comment on: http://stackoverflow.com/q/22497349

http://stackoverflow.com/q/22496393
has comment: http://stackoverflow.com/comment/34226236
tagged with: sockets
has comment: http://stackoverflow.com/comment/34230347
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34226243
has comment: http://stackoverflow.com/comment/34226047
has comment: http://stackoverflow.com/comment/34251806
score: 0
has body: Im making a chat program. i got the client to server connection working but i cant get the server to send to all sockets. Since Im using ObjectOutputStream i cant use PrintWriter which was the way I did it before, Heres my code thanks for the help Server import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; import java.util.HashSet; import java.util.logging.Level; import java.util.logging.Logger; public class Server { public Server clients[] = new Server[50]; public static String user; private static final int PORT = 4000; private static HashSet&lt;String&gt; names = new HashSet&lt;String&gt;(); private static HashSet&lt;PrintWriter&gt; writers = new HashSet&lt;&gt;(); public static void main(String[] args) throws Exception{ System.out.println("The chatroom is running..."); ServerSocket listener = new ServerSocket(PORT); try{ while(true){ new Handler(listener.accept()).start(); } } catch(Exception e){ System.err.println(e); } finally{ listener.close(); } } private static class Handler extends Thread{ private String name; private Socket socket; //private BufferedReader in; //private PrintWriter out; public ObjectOutputStream out; public ObjectInputStream in; public void send(Message msg) throws IOException{ out.writeObject(msg); out.flush(); } public void Announce(String type, String sender, String content){ Message msg = new Message(type, sender, content, "All"); } public Handler(Socket socket){ this.socket = socket; } public void run(){ try { out = new ObjectOutputStream(socket.getOutputStream()); out.flush(); in = (new ObjectInputStream(socket.getInputStream())); out.writeObject(new Message("SUBMITNAME", "blank", "blank", "blank")); while(true){ Message msg = (Message) in.readObject(); if(msg.sender == null){ return; } if(!names.contains(msg.sender)){ names.add(msg.sender); System.out.println(names.toString()); System.out.println("The object…
has title: Java send to all sockets
has comment: http://stackoverflow.com/comment/34225982
has comment: http://stackoverflow.com/comment/34226187
has comment: http://stackoverflow.com/comment/34226078

http://stackoverflow.com/comment/34379116
type: Comment
has text: Thank you for your reply! Unfortunately this onResume() method crushed my app at the start already. I have no idea why, I just copy-paste it o.O
comment on: http://stackoverflow.com/a/22582935
score: 0
type: AnswerComment

http://stackoverflow.com/a/22527445
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22527259
has comment: http://stackoverflow.com/comment/34424303
accepted answer of: http://stackoverflow.com/q/22527259
type: AcceptedAnswer
downvote count: 0
has body: It'd be nice if u'd write your SQL Developer version. And its not database related, but merely settings of SQL Developer. This behavior customizable in preferences (Tools/Preferences): DATABASE/NLS/Date Format. By default it set to DD.MM.RR, change it to the one you like.

http://stackoverflow.com/q/22624931
has answer: http://stackoverflow.com/a/22774566
accepted answer: http://stackoverflow.com/a/22774566
has comment: http://stackoverflow.com/comment/34454443
has body: I currently have an application running that uses java Spring to handle sessions. I have the following code, which handles all the sessions for me. @RequestMapping(value = "/login", method = GET) public @ResponseBody UserCredentials startLoginProcess(HttpSession session) { //initiate session if none exists } @RequestMapping(value = "/login", method = POST) @ResponseStatus(value = HttpStatus.OK) public void login(@RequestBody UserCredentials user, HttpSession session) { //do login stuff } @RequestMapping(value = "/logout", method = GET) @ResponseStatus(value = HttpStatus.OK) public void logout(HttpSession session) { session.invalidate(); } The key here is the logout which calls invalidate(). This should mark the session as invalid. However, when a call is made after invalidate using the same session, the server sends a response with a 200 OK and a new set-cookie header. I instead want an error to be thrown such as a 403 or something to state that the cookie is now invalid. What are some ways I can do this? To be a little more specific, I would like the login GET call to handle creating new sessions if none exists, but all other calls should throw some type of error if the session is invalid. Apparently there is no isInvalid method on HttpSession.
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/34454739
has comment: http://stackoverflow.com/comment/34454638
has comment: http://stackoverflow.com/comment/34454279
has comment: http://stackoverflow.com/comment/34456382
tagged with: spring-mvc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22627738
tagged with: spring-boot
downvote count: 0
has answer: http://stackoverflow.com/a/22627738
score: 1
tagged with: java
has title: Returning an error on invalid HttpSession Java Spring
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34470696
has answer: http://stackoverflow.com/a/22624981
tagged with: session

http://stackoverflow.com/comment/34314159
type: QuestionComment
has text: You get `0`, *where?*
comment on: http://stackoverflow.com/q/22546026
score: 0
type: Comment

http://stackoverflow.com/q/22516331
possible better answer: http://stackoverflow.com/a/22516464
favorite count: 0
has answer: http://stackoverflow.com/a/22516423
accepted answer: http://stackoverflow.com/a/22516423
has comment: http://stackoverflow.com/comment/34472378
tagged with: java-8
tagged with: method-reference
tagged with: java
has answer: http://stackoverflow.com/a/22516464
has body: So Java 8 introduces method references and the docs describe the four types. My question is what's the difference between the two instance types? Reference to an instance method of a particular object. Reference to an instance method of an arbitrary object of a particular type. Both refer to references but what's significantly different? Is it that the type inference used to resolve them is different? Is it significant that (in their examples) one is a closure and the other is a lambda? Is it something to do with the number of arguments on a method?
upvote count: 24
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22555641
score: 24
answer count: 3
has title: What's the difference between instance method reference types in Java 8?
downvote count: 0

http://stackoverflow.com/a/22510543
upvote count: 1
has body: It is order of n O(n) and not O(logn). It because the run time increases linearly with the increase in n For more information take a look at this graph and hopefully you will understand why it is not logn https://www.cs.auckland.ac.nz/software/AlgAnim/fig/log_graph.gif
score: 1
answers question: http://stackoverflow.com/q/22510477
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34401627
type: AnswerComment
type: Comment
has text: `INSERT` as its name used on insertion. If you want to update you must use `UPDATE`.
comment on: http://stackoverflow.com/a/22595309
score: 0

http://stackoverflow.com/q/22578814
downvote count: 0
type: UnansweredQuestion
tagged with: maven
linked to: http://stackoverflow.com/q/5751561
linked to: http://stackoverflow.com/q/1612854
type: Question
has body: I have an multi-module project in maven, and when I run normal goals on it, everything works fine. For testing, I have an module mytest, and this module is run fine when I run mvn package in the parent directory. But for not compiling and running everything everytime, I would prefer to run the tests standalone, and to take the packaged files as the dependencies. But if I try to do so using mvn test -Dtest=simpleTest in the test-submodule-directory, the tests are not run, because it can't find the dependencies. After a mvn install in the parent-directory, it finds them, but uses the artifacts from the repository - a behaviour I do not want, because I have to run install everytime. And if I try to run the tests from the parent directory with mvn test -Dtest=simpleTest, it does not find the tests in the other modules, and stops, or, if I add an project-list with -pl test, it just does not find the dependencies again. Is there any way to run a maven test in a specific submodule, that has dependencies for other submodules, without installing the submodules to the local repository? It would be possible to archieve this by building the comand-line-call for the test onself, but that seems very time-consuming. /EDIT: To describe the problem more exactly, I'll add source of a minimal project. There is a parent pom: 4.0.0 minimalproject minimalproject 0.1-SNAPSHOT pom minimalproject datamodule testmodule a Pom for the module that needs to be tested (in a real-world project, there would be more similiar modules): 4.0.0 minimalproject datamodule 0.1-SNAPSHOT jar datamodule and a Pom for the modules that tests: 4.0.0 minimalproject testmodule 0.1-SNAPSHOT jar testmodule minimalproject datamodule 0.1-SNAPSHOT junit junit-dep 4.8.2 test There are now two classes, one in datamodule/src/main/java: public class Thing{ int i = 5; } and one in testmodule/src/test/java: import org.junit.Test; import junit.framework.Assert; public class MyTest{ @Test public void testThing(){ Thing t = new…
has comment: http://stackoverflow.com/comment/34438357
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34376629
upvote count: 1
answer count: 1
has title: Resolving dependencies ad-hoc in multi-module maven project
favorite count: 0
has answer: http://stackoverflow.com/a/22616624

http://stackoverflow.com/comment/34391281
type: AnswerComment
comment on: http://stackoverflow.com/a/22589651
score: 0
type: Comment
has text: Ok let I download it for 64 bit

http://stackoverflow.com/a/22502960
type: Answer
has comment: http://stackoverflow.com/comment/34241494
has comment: http://stackoverflow.com/comment/34237184
has comment: http://stackoverflow.com/comment/34239151
has comment: http://stackoverflow.com/comment/34237222
has comment: http://stackoverflow.com/comment/34237874
score: 1
answers question: http://stackoverflow.com/q/22502869
upvote count: 1
has comment: http://stackoverflow.com/comment/34236516
has comment: http://stackoverflow.com/comment/34236871
has body: try { jObj = new JSONObject(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } this is wrong. You are getting a JSONArray but you are converting it to JSONObject. Change it in try { if (json != null) return new JSONArray(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); }
accepted answer of: http://stackoverflow.com/q/22502869
has comment: http://stackoverflow.com/comment/34236921
has comment: http://stackoverflow.com/comment/34242544
has comment: http://stackoverflow.com/comment/34236745
has comment: http://stackoverflow.com/comment/34236476
has comment: http://stackoverflow.com/comment/34239518
has comment: http://stackoverflow.com/comment/34239909
has comment: http://stackoverflow.com/comment/34240339
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34237120
has comment: http://stackoverflow.com/comment/34236649
has comment: http://stackoverflow.com/comment/34240124

http://stackoverflow.com/comment/34443915
comment on: http://stackoverflow.com/q/22619270
has text: Have you deployed your code to the server?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/22528032
downvote count: 0
answer count: 0
tagged with: classloader
has comment: http://stackoverflow.com/comment/34281064
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/34280904
score: 1
has body: I`m developing client that uses library Overthere 2.3.1. With local machine client works perfectly. But when I try to call same code included to EJB 3.0, I've got exception that not all required classes have been loaded. I`ve looked over the source and found that the class contains Protocol annotation scanner (https://github.com/hierynomus/scannit) with hardcoded class name: Scannit scannit = new Scannit(Configuration.config() .scan("com.xebialabs") .with(new AbstractScanner[] { new TypeAnnotationScanner() })); The command Thread.currentThread().getContextClassLoader().getResources("com/xebialabs") returns null. Looks like EJB runs in a separate classloader which does not have access to all the jars. The EJB is packed to EAR with following structure: EAR --META-INF ----sda-dd.xml ----SAP_MANIFEST.MF ----MANIFEST.MF ----application-j2ee-engine.xml --ejb.jar --extlibs.jars The MANIFEST.MF file don`t contain any reference to external libs in CLASS-PATH. The EAR project is deployed to Application server successfully. The EJB.jar also contains META-INF/MANIFEST.MF with value "Class-Path: ." by default. I`ve already tried playing around with CLASS-PATH in manifest files, but have no luck. Could anyone help me, how to build project with all external libs to be loaded while EJB runs? What have I missed with resources and classloaders?
tagged with: java
tagged with: netweaver
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34281425
has title: EAR and EJB classloader error with Overthere
has comment: http://stackoverflow.com/comment/34339642
tagged with: ejb-3.0
has comment: http://stackoverflow.com/comment/34282349

http://stackoverflow.com/a/22670762
has body: I think the toast message with that is "failed to load (invalid request)" probably because you have not updated the string INSERT_YOUR_AD_UNIT_ID_HERE with a real ad unit id, which you have to get by signing up for an account with AdMob or another provider of ads and requesting an id for your app.
answers question: http://stackoverflow.com/q/22589074
score: 0
type: Answer

http://stackoverflow.com/q/22542959
type: AnsweredQuestion
has body: I couldn't any other threads that answer this question, but I'm wondering what's the difference between let's say: public static void main(String[] args) { new GUIObject(); } or: public static void main(String[] args) { SwingUtilies.invokeLater(new Runnable() { public void run() { new GUIObject(); } }); } I have been doing the first all this time, but I see some videos on YouTube that does the latter, and it seems to do the same thing.
tagged with: java
accepted answer: http://stackoverflow.com/a/22543156
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22543113
has answer: http://stackoverflow.com/a/22543113
score: 0
tagged with: runnable
tagged with: user-interface
has title: Difference between using runnable to make GUI vs Anonymous object
has answer: http://stackoverflow.com/a/22543156

http://stackoverflow.com/a/22587389
has body: The getA() method is defined in the superclass only, and can only access members of the superclass. It cannot know about the a of the subclass, so the a of the subclass cannot shadow it. Whether the member a of the subclass is private or public is not relevant. You will see the same behavior if you declare a to be private in the child class. Update: Here is an attempt to answer the more general question: How are members which are defined in both parent and subclasses resolved? Consider the following extension of the OP's example: class A { public int a = 10; public int getA() { return a; } public void setA(int a) { this.a = a; } } class B extends A { public int a = 20; } class C extends B { public int getA() { return a; } } public class Demo { public static void main(String args[]) { B a = new B(); System.out.println(a.getA()); C c = new C(); System.out.println(c.getA()); } } Here, we see the output 10 and 20, which implies that class C's getA() method is reading class B's version of a. Now let us see what happens if we make B's version of A private. class B extends A { private int a = 20; } If we try to compile, we will get a compiler error: Demo.java:18: error: a has private access in B The experiment above seems to suggest that each class will attempt to resolve a by looking at either itself or go up the class hierarchy until it finds the first a. If that a is visible to it (meaning public or protected), then it will return it. If that a is not visible, then it will simply not compile.
downvote count: 0
has comment: http://stackoverflow.com/comment/34387356
has comment: http://stackoverflow.com/comment/34387430
has comment: http://stackoverflow.com/comment/34386866
type: AcceptedAnswer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/22587330
has comment: http://stackoverflow.com/comment/34387245
answers question: http://stackoverflow.com/q/22587330
type: Answer
has comment: http://stackoverflow.com/comment/34386813
has comment: http://stackoverflow.com/comment/34387116
score: 6

http://stackoverflow.com/comment/34437298
type: Comment
type: QuestionComment
has text: The third bullet down in the [Lucene 4.0 Migration Guide](http://lucene.apache.org/core/4_0_0/MIGRATE.html) provides an example of using `DocsEnum` instead of `TermDocs`.
comment on: http://stackoverflow.com/q/22615627
score: 0

http://stackoverflow.com/comment/65811272
score: 0
comment on: http://stackoverflow.com/a/39236810
type: AnswerComment
type: Comment
has text: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes

http://stackoverflow.com/q/22508337
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34246040
has answer: http://stackoverflow.com/a/22508483
tagged with: eclipse
type: Question
has body: I converted my eclipse project to maven by creating a pom.xml file. I built the .war file by maven build command by specifying the goal clean compile install and it build successfully. Now when I am running it on appache tomcate it throws no class found exceptions as I check .war/WEB-INF/classes folder is empty. Why classes folder is empty? Is this the reason why .war is not running on apache. Please let me know if you need any further details Pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 mycom myproject 0.0.1-SNAPSHOT war com Maven project <spring.version>3.2.0.RELEASE</spring.version> terracotta-repository http://repo.terracotta.org/maven2 true org.springframework.security spring-security-web ${spring.version} org.springframework.security spring-security-config ${spring.version} org.springframework spring-context ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-core ${spring.version} org.springframework spring-test ${spring.version} test javax.servlet servlet-api 2.5 javax.servlet.jsp jsp-api 2.1 provided junit junit 4.8.2 test org.codehaus.jackson jackson-core-asl 1.9.13 org.codehaus.jackson jackson-mapper-asl 1.9.13 rome rome 1.0 org.quartz-scheduler quartz 2.1.0 org.mybatis mybatis 3.1.1 org.mybatis mybatis-spring 1.1.1 org.mybatis.generator mybatis-generator-core 1.3.0 joda-time joda-time 2.1 joda-time joda-time-jsptags 1.1.1 com.mortennobel java-image-scaling 0.8.5 mysql mysql-connector-java 5.1.24 log4j log4j 1.2.15 com.sun.jmx jmxri com.sun.jdmk jmxtools javax.jms jms Codehaus Snapshots http://snapshots.repository.codehaus.org/ true true jemm.organise.net org.codehaus.mojo tomcat-maven-plugin 2.2 http://127.0.0.1:8080/manager/text TomcatServer /myproject org.apache.maven.plugins maven-war-plu…
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/34246019
accepted answer: http://stackoverflow.com/a/22508483
has title: No classes found in classes folder inside war
has comment: http://stackoverflow.com/comment/34246990
upvote count: 3
has comment: http://stackoverflow.com/comment/34246178
tagged with: maven
tagged with: war
has comment: http://stackoverflow.com/comment/34246002
type: AnsweredQuestion

http://stackoverflow.com/comment/34221309
type: AnswerComment
score: 0
type: Comment
has text: Thanks so far! :-) So i just need to find a different way of adding ppl to the list in an amount compared to their tickets. Or is a vector able to store both values to fit my raffle-system? Any Ideas from you?
comment on: http://stackoverflow.com/a/22493548

http://stackoverflow.com/comment/34462744
type: AnswerComment
type: Comment
has text: doesn't matter. `Exception` will still catch the `NumberFormatException`. But okay, i'll modify it.(I don't think `NullPointerException` or an `ArrayIndexOutOfBoundsException` can happen inside that 2 lines try block :))
score: 1
comment on: http://stackoverflow.com/a/22629868

hibernate
tags question: http://stackoverflow.com/q/22581324
tags question: http://stackoverflow.com/q/22540525
tags question: http://stackoverflow.com/q/22637108
tags question: http://stackoverflow.com/q/22491012
tags question: http://stackoverflow.com/q/22570995
tags question: http://stackoverflow.com/q/22617518
tags question: http://stackoverflow.com/q/22537107
tags question: http://stackoverflow.com/q/22581366
tags question: http://stackoverflow.com/q/22567246
tags question: http://stackoverflow.com/q/22609547
tags question: http://stackoverflow.com/q/22534293
tags question: http://stackoverflow.com/q/22523684
tags question: http://stackoverflow.com/q/22503786
tags question: http://stackoverflow.com/q/22586217
tags question: http://stackoverflow.com/q/22595138
tags question: http://stackoverflow.com/q/22608634
tags question: http://stackoverflow.com/q/22493344
tags question: http://stackoverflow.com/q/22605958
tags question: http://stackoverflow.com/q/22550463
tags question: http://stackoverflow.com/q/22525078
tags question: http://stackoverflow.com/q/22646248
tags question: http://stackoverflow.com/q/22646661
tags question: http://stackoverflow.com/q/22637715
tags question: http://stackoverflow.com/q/22638104
tags question: http://stackoverflow.com/q/22536035
tags question: http://stackoverflow.com/q/22521660
tags question: http://stackoverflow.com/q/22643098
tags question: http://stackoverflow.com/q/22553920
tags question: http://stackoverflow.com/q/22644614
tags question: http://stackoverflow.com/q/22537226
tags question: http://stackoverflow.com/q/22561384
tags question: http://stackoverflow.com/q/22512268
tags question: http://stackoverflow.com/q/22534650
tags question: http://stackoverflow.com/q/22504853
tags question: http://stackoverflow.com/q/22508604
tags question: http://stackoverflow.com/q/22619648
tags question: http://stackoverflow.com/q/22614943
tags question: http://stackoverflow.com/q/22564326
tags question: http://stackoverflow.com/q/22616950
tags question: http://stackoverflow.com/q/22536284
tags question: http://stackoverflow.com/q/22567830
tags question: http://stackoverflow.com/q/22616043
tags question: http://stackoverflow.com/q/22552201
tags question: http://stackoverflow.com/q/22553739
tags question: http://stackoverflow.com/q/22620323
tags question: http://stackoverflow.com/q/22577526
tags question: http://stackoverflow.com/q/22636654
tags question: http://stackoverflow.com/q/22513152
tags question: http://stackoverflow.com/q/22555855
tags question: http://stackoverflow.com/q/22582907
tag name: hibernate
tags question: http://stackoverflow.com/q/22637651
tags question: http://stackoverflow.com/q/22524672
tags question: http://stackoverflow.com/q/22626898
tags question: http://stackoverflow.com/q/22628376
tags question: http://stackoverflow.com/q/22647598
tags question: http://stackoverflow.com/q/22607704
tags question: http://stackoverflow.com/q/22530253
tags question: http://stackoverflow.com/q/22634535
tags question: http://stackoverflow.com/q/22533779
tags question: http://stackoverflow.com/q/22599876
tags question: http://stackoverflow.com/q/22632607
tags question: http://stackoverflow.com/q/22522995
tags question: http://stackoverflow.com/q/22586576
tags question: http://stackoverflow.com/q/22528027
tags question: http://stackoverflow.com/q/22551159
tags question: http://stackoverflow.com/q/22504703
tags question: http://stackoverflow.com/q/22547238
tags question: http://stackoverflow.com/q/22550823
tags question: http://stackoverflow.com/q/22539586
tags question: http://stackoverflow.com/q/22574239
tags question: http://stackoverflow.com/q/22492229
tags question: http://stackoverflow.com/q/22622085
tags question: http://stackoverflow.com/q/22557396
tags question: http://stackoverflow.com/q/22511870
tags question: http://stackoverflow.com/q/22583810
tags question: http://stackoverflow.com/q/22525433
tags question: http://stackoverflow.com/q/22560782
tags question: http://stackoverflow.com/q/22539800
tags question: http://stackoverflow.com/q/22562518

http://stackoverflow.com/a/22500411
answers question: http://stackoverflow.com/q/22500236
score: 0
type: Answer
has body: char is of 2 byte , if byte number is out of range -128 to 127 ,

http://stackoverflow.com/a/22509150
score: 1
upvote count: 1
has body: I think the problem lies in the variables of Authenticator in SendMail.java....bu i don't know what the problem actually is...... Your problem is here: pass = jPasswordField1.getPassword().toString(); This won't convert the char array retrieved by getPassword() method in the way you want to because it's calling toString() method on an array. You should replace that line by this one: pass = String.valueOf(jPasswordField1.getPassword()); Also be aware that using Session.getDefaultInstance() method is discouraged. It's highly recommended use Session.getInstance() method instead because of this: The Session.getDefaultInstance method creates a new Session the first time it's called, using the Properties that are passed. Subsequent calls will return that original Session and ignore any Properties you pass in. If you want to create different Sessions with different properties, Session.getDefaultInstance won't do that. [...] Always use Session.getInstance to avoid this problem. It is well explained in JavaMail API FAQ. You can also see the consequences of using Session.getDefaultInstance() exemplified in this Q&amp;A hotmail login error in java (IDE: Netbeans) Off-topic The use of multiple JFrame's is also discouraged. See this topic: The Use of Multiple JFrames, Good/Bad Practice?
downvote count: 0
answers question: http://stackoverflow.com/q/22508308
type: Answer

http://stackoverflow.com/q/22509997
tagged with: multithreading
has answer: http://stackoverflow.com/a/32679117
tagged with: web-services
has answer: http://stackoverflow.com/a/22513433
has title: Drools singleton StatefulKnowledgeSession as a web service
tagged with: java
has answer: http://stackoverflow.com/a/22510866
type: Question
score: 5
tagged with: drools
upvote count: 5
answer count: 3
downvote count: 0
has body: I am working with Drools 5.6.0 and I’m ready to upgrade to 6.0 so this issue is relevant for both versions. I have googled a lot about using Drools in a multithreaded environment and I am still unsure how to proceed. In the following scenario I’m trying to find a way to use a singleton StatefulKnowledgeSession pre-initialized with a large number of static facts as business logic for a web service. I would like to know if there is a best practice for the scenario further described below. I create a StatefulKnowlegdeSession singleton when the server starts Right at the initialization I insert over 100.000 Facts into the StatefulKnowlegdeSession. I call these „static facts“ since they will not ever be modified by the rules. Static facts act more like a set of big lookup tables. Now the rule engine is placed into a web service (Tomcat). The web service receives a Request object which will be inserted into the KnowledgeSession. After fireAllRules() I expect the KnowledgeSession to calculate an output object which is to be returned as web service Response. The calculation of the Response makes use of the static facts. The rules create a lot of temporary objects which are inserted into the working memory using insertLogical(). This makes sure that all garbage will be removed from working memory as soon as I retract the original Request object at the end of the web service call. Now the question is how I will make this work in a multithreaded server? As far as possible I would like to use only one StatefulKnowledgeSession instance (a singleton) because the static facts are BIG and it could become a memory issue. I cannot use StatelessKnowledgeSessions freshly created at the beginning of each web service call because inserting all the static facts would take too long. I am aware of the fact that StatefulKnowlegdeSession is not thread safe. Also, the partitioning option is not supported any more. However, different WorkingMemoryEntryPoints / EntryPoints can be used from diffe…
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34299052
type: Comment
type: QuestionComment
has text: You should have another *handler* as field in your class that will *handle* the next work.
comment on: http://stackoverflow.com/q/22538132
score: 0

http://stackoverflow.com/q/22636652
tagged with: maven
has comment: http://stackoverflow.com/comment/34521926
has title: JPAContainer with maven?
answer count: 0
tagged with: java
tagged with: vaadin
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/34491556
score: 0
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34513052
has body: I've a problem with maven when add dependecy to JPAContainer-addon. The problem is thats returns a exception. //archetype mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.1.12 -DgroupId=br.ind.ibg -DartifactId=ibg_curriculuns_2 -Dversion=1.0 -Dpackaging=war //exception SEVERE: Servlet.service() for servlet [br.ind.ibg.MyVaadinUI$Servlet] in context with path [/ibg_curriculuns_2] threw exception [com.vaadin.server.ServiceException: java.lang.NoSuchMethodError: com.vaadin.event.EventRouter.fireEvent(Ljava/util/EventObject;Lcom/vaadin/server/ErrorHandler;)V] with root cause java.lang.NoSuchMethodError: com.vaadin.event.EventRouter.fireEvent(Ljava/util/EventObject;Lcom/vaadin/server/ErrorHandler;)V at com.vaadin.server.VaadinService.onVaadinSessionStarted(VaadinService.java:783) at com.vaadin.server.VaadinService.createAndRegisterSession(VaadinService.java:740) at com.vaadin.server.VaadinService.doFindOrCreateVaadinSession(VaadinService.java:696) at com.vaadin.server.VaadinService.findOrCreateVaadinSession(VaadinService.java:637) at com.vaadin.server.VaadinService.findVaadinSession(VaadinService.java:501) at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1376) at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.in…
type: UnansweredQuestion
tagged with: vaadin7

http://stackoverflow.com/comment/34406378
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22598367
type: Comment
has text: but why 0.0 in volume and calculate??

http://stackoverflow.com/a/22604173
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22603967
answers question: http://stackoverflow.com/q/22603967
has comment: http://stackoverflow.com/comment/34416563
has body: You can implement your own toString method that returns tab delimited string something like public static String toString(Object[] array) { StringBuilder builder = new StringBuilder(); for(Object o: array) { builder.append(o+"\t"); } return builder.toString().trim(); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34418492
type: Answer
score: 2

http://stackoverflow.com/q/22645648
downvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34490719
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34490841
has comment: http://stackoverflow.com/comment/34490678
tagged with: constants
upvote count: 0
has answer: http://stackoverflow.com/a/22645755
has comment: http://stackoverflow.com/comment/34490670
has comment: http://stackoverflow.com/comment/34490830
tagged with: java
type: Question
tagged with: arrays
score: -1
has body: I'm a really basic beginner at Java and I've been trying to figure out how to declare arrays. If I want to use a constant int SIZE that is set equal to 5, would it be any different from declaring a regular array? From what I've learned, this is one way to declare an array: int intArray[] = new int[3]; And this would give an array from 1 to 3, I think...
has title: How to declare an int array with a constant?

http://stackoverflow.com/a/22621345
type: Answer
answers question: http://stackoverflow.com/q/22621194
has body: He has simply used the complete qualified name for the Date class, including the package name "java.util". Based only on what we see here, there is no reason for him to have done this. The only real justification would be if there is another class, in another package, also called Date, and he needs to be able to distinguish the two. Or perhaps he's just making a point for some reason, that the Date class is in that particular package.
score: 0

http://stackoverflow.com/a/22560561
has body: You can take advantage of the I in the SOLID principles, the Interface Segregation Principle. Use 2 interfaces, one for the public stuff and one for the private stuff. Only expose the object to your user as the public interface. When you need the private methods just cast it to the other interface. package some.exposed.package; public interface PublicRenderable { public void publicRenderableMethod(); } package some.package.you.dont.expose; public interface PrivateRenderable { public void privateRenderableMethod(); } public class RenderObject implements PublicRenderable, PrivateRenderable { public void publicRendereableMethod() { // implementation } public void privateRenderableMethod() { // implementation } } package some.exposed.package; public class PublicRenderObjectFactory { public PublicRenderable getRenderable() { return new RenderObject(); } } And your List can be a List&lt;PrivateRenderable&gt;.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22560454
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/34340273

http://stackoverflow.com/comment/63291013
has text: I am having the same issue. Did you solve it?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22557274
type: QuestionComment

xslt
tags question: http://stackoverflow.com/q/22614392
tags question: http://stackoverflow.com/q/22577509
tags question: http://stackoverflow.com/q/22505068
tags question: http://stackoverflow.com/q/22498033
tags question: http://stackoverflow.com/q/22591483
tags question: http://stackoverflow.com/q/22539126
tags question: http://stackoverflow.com/q/22529161
tag name: xslt
tags question: http://stackoverflow.com/q/22503769
type: Tag

http://stackoverflow.com/a/72601644
score: 0
has body: Got my writer like this : TIFFImageWriterSpi tiffSpi = new TIFFImageWriterSpi(); ImageWriter imageWriter = tiffSpi.createWriterInstance();
type: Answer
answers question: http://stackoverflow.com/q/22523644

http://stackoverflow.com/q/22493609
has title: Testing Sort Array Methods
favorite count: 0
tagged with: quicksort
has comment: http://stackoverflow.com/comment/34221298
score: 2
has comment: http://stackoverflow.com/comment/34221184
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22493666
accepted answer: http://stackoverflow.com/a/22493666
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34221315
tagged with: arrays
answer count: 1
tagged with: mergesort
has comment: http://stackoverflow.com/comment/34221381
has body: I'm writing a program that tests if a sort function sorts a program properly. I have to have it test the quick sort and merge sort methods. Also it must ask the user which method they would like to test and make an array of random objects. Why won't my program run properly? It just spits out the same array for the quick sort and it randomly re arranges them for the merge sort. Is the problem my sorting methods or my tester method? Someone please help. import java.util.Random; import java.util.Scanner; public class sortArrays { public static void main (String[] args) { Random gen = new Random(); int[] a = new int[20]; Scanner reader = new Scanner(System.in); String choice; int left = a[0]; int right = a[19]; int[] buffer = new int [a.length]; for (int i = 0; i &lt; a.length; i++) a[i] = gen.nextInt(100); printArray(a); System.out.println("Type quick to test the quick sort method."); System.out.println("Type merge to test the merge sort method."); choice = reader.nextLine(); if (choice.equals("quick")) quickSort(a, left, right); else if (choice.equals("merge")) mergeSort(a, buffer, 0, 9, 19); printArray(a); } private static void printArray(int[] a) { for(int i : a) System.out.print(i + " "); System.out.println(""); } private static void quickSort (int[] a, int left, int right) { if (left &gt;= right) return; int i = left; int j = right; int pivotValue = a[(left + right) / 2]; while (i &lt; j) { while (a[i] &lt; pivotValue) i++; while (pivotValue &lt; a[j]) j--; if (i &lt;= j) { int temp = a[i]; a[i] = a[j]; a[j] = temp; i++; j--; } } quickSort(a, left, j); quickSort(a, i, right); } private static void mergeSort(int[] a, int[] copyBuffer, int low, int middle, int high) { int i1 = low, i2 = middle + 1; for(int i = low; i &lt;= high; i++) { if(i1 &gt; middle) copyBuffer [i] = a[i2++]; else if(i2 &gt; high) copyBuffer[i] = a[i1++]; else if(a[i1] &lt; a[i2]) copyBuffer[i] = a[i1++]; else copyBuffer[i] = a[i2++]; } for(int i = low; i &lt;= high; i++) a[i] = copyBuffer[i]; }…

http://stackoverflow.com/comment/34277415
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22526020
has text: Isn't it obvious the context path is missing?

http://stackoverflow.com/comment/34285427
comment on: http://stackoverflow.com/q/22530272
has text: Then it is a bug in the remote applications which don't decode JSON Strings correctly; you should report that to them
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22645140
has title: Separating Yourkit sessions
score: 0
tagged with: yourkit
answer count: 2
tagged with: profiling
has body: I have some segment of code I want to profile on many different inputs (~1000) so it doesn't make sense to manually run each test and save the results. I'm using yourkit in combination with Eclipse to profile. Is there any way to create "new sessions" for profiling? I want to be able to separate each run so that would make the most sense.
has answer: http://stackoverflow.com/a/22707233
accepted answer: http://stackoverflow.com/a/22707233
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22685389
tagged with: eclipse
has answer: http://stackoverflow.com/a/22685389

http://stackoverflow.com/q/22591768
has comment: http://stackoverflow.com/comment/34394457
tagged with: android
has answer: http://stackoverflow.com/a/22591906
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34394450
tagged with: java
tagged with: eclipse
tagged with: android-emulator
type: Question
has body: I am trying to create a simple android application in eclipse. The emulator works fine when I tried to run the “Hello world” that is automatically created by eclipse and it works fine. But when I tried to create a simple program and run it, the emulator pop-up “Unfortunately the OddOrEven has stopped”. I also tried to my android phone but they have the same error. What should I do? I am just a beginner trying to learn how to make android application. This is my android manifest file: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> This is my mainactivity file: package com.IDB.oddoreven; 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.widget.Button; import android.widget.*; //import android.os.Build; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText input = (EditText) findViewById(R.id.tbInput); final TextView output = (TextView) findViewById(R.id.tbResult); Button check = (Button) findViewById(R.id.btnCheck); check.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Double num = Double.parseDouble(input.getText().toString()); num = Double.parseDouble(calc.multiNum(num)); output.setText(num+""); } }); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // …
has title: android emulator - unfortunately "App name", has stopped. in eclipse
answer count: 1

http://stackoverflow.com/a/22628143
score: 0
answers question: http://stackoverflow.com/q/22627859
type: Answer
has body: its just name fragment_main or activity_main if you wish you can give your GF :D name also, i.e when you add a layout file to res/layout path an entry will be maid in R.java say you create main.xml in res/layout, and when you clean your project an entry R.layout.main will be added to R.java its just the name whatever you give to file. may be you getting error because that file not there or might be that file don't hold layout in it.

http://stackoverflow.com/q/22559439
has body: I built my code successfully and then I had a problem. This is my code: package EmailSending; import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class launcher { public static void main(String[] args){ final String username = "my-email@yandex.ru"; final String password = "my-password"; String to = "to-email@mail.ru"; String from = "from-email@yandex.ru"; String host = "localhost"; Properties properties = System.getProperties(); properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.starttls.enable", "true"); properties.put("mail.smtp.host", host); Session session = Session.getInstance(properties); try{ MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject("This is the Subject Line!"); message.setText("This is actual message"); Transport.send(message); System.out.println("Sent message successfully...."); }catch (MessagingException mex) { mex.printStackTrace(); } } } There is an error at this line: Session session = Session.getInstance(properties); This is an output message: run: Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger at javax.mail.Session.initLogger(Session.java:227) at javax.mail.Session.&lt;init&gt;(Session.java:212) at javax.mail.Session.getInstance(Session.java:265) at EmailSending.launcher.main(launcher.java:34) Caused by: java.lang.ClassNotFoundException: com.sun.mail.util.MailLogger at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 4 more Java Result: 1…
has comment: http://stackoverflow.com/comment/34344558
has answer: http://stackoverflow.com/a/22568712
accepted answer: http://stackoverflow.com/a/22568712
has comment: http://stackoverflow.com/comment/34351208
linked to: http://stackoverflow.com/q/34413
type: AnsweredQuestion
has title: How to watch a full output error message in NetBeans
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34345452
type: Question
linked to: http://stackoverflow.com/q/1167888
tagged with: jakarta-mail
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34345600
favorite count: 0
tagged with: netbeans

http://stackoverflow.com/a/22577601
answers question: http://stackoverflow.com/q/22577473
score: 0
has body: Use this code. It will work.. String str = "&lt;h1&gt;Hi buddy!!you @ $ did a Great job . &lt;h1&gt;"; String str1 = str.replaceAll("&lt;[^&gt;]+&gt;", ""); String str2 = str1.replaceAll("[^\\p{L}\\p{M}]", " "); System.out.println(str2);
has comment: http://stackoverflow.com/comment/34368815
type: Answer

http://stackoverflow.com/comment/34423604
type: QuestionComment
has text: Hopefully the third line is actually memcacheService.put("terminologyList", terminologyList)
comment on: http://stackoverflow.com/q/22608213
score: 0
type: Comment

methods
tags question: http://stackoverflow.com/q/22585998
tags question: http://stackoverflow.com/q/22519482
tags question: http://stackoverflow.com/q/22509556
tag name: methods
tags question: http://stackoverflow.com/q/22514947
tags question: http://stackoverflow.com/q/22579309
tags question: http://stackoverflow.com/q/22519990
tags question: http://stackoverflow.com/q/22596041
tags question: http://stackoverflow.com/q/22596465
type: Tag
tags question: http://stackoverflow.com/q/22588491
tags question: http://stackoverflow.com/q/22509052
tags question: http://stackoverflow.com/q/22586762
tags question: http://stackoverflow.com/q/22622238
tags question: http://stackoverflow.com/q/22615822
tags question: http://stackoverflow.com/q/22496337
tags question: http://stackoverflow.com/q/22613444
tags question: http://stackoverflow.com/q/22576430
tags question: http://stackoverflow.com/q/22587601
tags question: http://stackoverflow.com/q/22584841
tags question: http://stackoverflow.com/q/22523478
tags question: http://stackoverflow.com/q/22588756
tags question: http://stackoverflow.com/q/22571278
tags question: http://stackoverflow.com/q/22603048
tags question: http://stackoverflow.com/q/22496035
tags question: http://stackoverflow.com/q/22515152
tags question: http://stackoverflow.com/q/22584851
tags question: http://stackoverflow.com/q/22543308
tags question: http://stackoverflow.com/q/22586898
tags question: http://stackoverflow.com/q/22599285
tags question: http://stackoverflow.com/q/22598294
tags question: http://stackoverflow.com/q/22581407
tags question: http://stackoverflow.com/q/22647619
tags question: http://stackoverflow.com/q/22618451
tags question: http://stackoverflow.com/q/22568838
tags question: http://stackoverflow.com/q/22638762

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/22611747
tags question: http://stackoverflow.com/q/22642619
tags question: http://stackoverflow.com/q/22549690
tags question: http://stackoverflow.com/q/22578337
tags question: http://stackoverflow.com/q/22587537
tags question: http://stackoverflow.com/q/22493108
tags question: http://stackoverflow.com/q/22596287
tags question: http://stackoverflow.com/q/22588251
tags question: http://stackoverflow.com/q/22504593
type: Tag
tags question: http://stackoverflow.com/q/22512050
tags question: http://stackoverflow.com/q/22592180
tags question: http://stackoverflow.com/q/22596219
tags question: http://stackoverflow.com/q/22623001
tags question: http://stackoverflow.com/q/22530660
tags question: http://stackoverflow.com/q/22559918
tags question: http://stackoverflow.com/q/22588444
tags question: http://stackoverflow.com/q/22507635
tags question: http://stackoverflow.com/q/22572120

http://stackoverflow.com/comment/34259686
comment on: http://stackoverflow.com/a/22514567
type: AnswerComment
score: 0
type: Comment
has text: When you say open them in two different DOS consoles does it just open in the DOS console if you type in the name. I hate to say it but it has been a while since I have used a DOS console.

http://stackoverflow.com/comment/34406137
type: Comment
has text: I have just read through the [link that you posted](http://stackoverflow.com/questions/4279787/how-can-i-pass-values-between-a-dialog-and-an-activity/4279847#4279847) in your question and the author of the linked answer surrounds his interface method call with a `if( mDialogResult != null ){` nullcheck.. I guess he had a reason for that ;-)
comment on: http://stackoverflow.com/a/22597657
score: 0
type: AnswerComment

http://stackoverflow.com/a/22629592
score: 4
accepted answer of: http://stackoverflow.com/q/22628862
type: AcceptedAnswer
has body: The EntityManagerFactory instance is expensive to create, the EntityManager ones are not. In a Java SE web application, most cases can be handled with only one EntityManagerFactory instance. You can initialize the EntityManagerFactory in the contextInitialized method of a ServletContextListener and store the instance in a context attribute (context.setAttribute(key, emf)): public class CustomServletContextListener implements ServletContextListener { private EntityManagerFactory entityManagerFactory; @Override public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); entityManagerFactory = Persistence.createEntityManagerFactory("UnitName"); context.setAttribute("someKey", entityManagerFactory); } @Override public void contextDestroyed(ServletContextEvent sce) { /* Some method that cleanly destroys * your entity manager factory */ closeEntityManagerFactory(); } } Later, you can retrieve the EntityManagerFactory instance using context.getAttribute("someKey") and create EntityManager instance where needed. Finally, in order to get your ServerContextListener implementation to work, simply register it in your web.xml: com.company.listeners.CustomServletContextListener Note: whether you need short-lived or long-lived EntityManager instances depends on the scopes of your application. In typical web-applications, short-lived ones that span the requests are more sensible. Refer to Java Persistence with Hibernate by Bauer and King, Manning for different strategies regarding EntityManager instances. The text addresses both Hibernate and JPA in parallel.
answers question: http://stackoverflow.com/q/22628862
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/22603164
tagged with: java
has comment: http://stackoverflow.com/comment/34415163
possible better answer: http://stackoverflow.com/a/22603239
type: Question
has answer: http://stackoverflow.com/a/22603226
accepted answer: http://stackoverflow.com/a/22603226
has body: When we override equals method we write the code as below public boolean equals(Object obj) { //why do we need to use this piece of code **if (obj == this) { return true; }** // How does the above two lines help. Instead I do not want to have the == on an object comparison //I prefer to remove the above 2 lines. Will it cause any issue? if (obj == null || obj.getClass() != this.getClass()) { return false; } Person guest = (Person) obj; return id == guest.id &amp;&amp; (firstName == guest.firstName || (firstName != null &amp;&amp; firstName.equals(guest.getFirstName()))) &amp;&amp; (lastName == guest.lastName || (lastName != null &amp;&amp; lastName .equals(guest.getLastName()))); }
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34414954
favorite count: 0
has answer: http://stackoverflow.com/a/22603225
has comment: http://stackoverflow.com/comment/34414879
has answer: http://stackoverflow.com/a/22603239
has title: why equals method must have equality operator comparison
has comment: http://stackoverflow.com/comment/34415197
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22603231

http://stackoverflow.com/q/22558363
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22725265
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22725265
type: Question
has body: Is there a better way that allows me to initialize three-dimensional ArrayList? List&lt;List&lt;List&lt;String&gt;&gt;&gt; lista = new ArrayList&lt;List&lt;List&lt;String&gt;&gt;&gt;(3); for (int i=0;i&lt;3;i++){ List&lt;List&lt;String&gt;&gt; lista2 = new ArrayList&lt;List&lt;String&gt;&gt;(4); for (int j=0;j&lt;4;j++)lista2.add(new ArrayList&lt;String&gt;(5)); lista.add(lista2); }
downvote count: 0
has comment: http://stackoverflow.com/comment/34333887
favorite count: 0
tagged with: arraylist
answer count: 1
tagged with: initialization
has comment: http://stackoverflow.com/comment/34333888
upvote count: 1
has title: Best way to initialize three dimension List

http://stackoverflow.com/q/22490330
has title: Architecture for a drawer layout app
has body: I am building an app with a drawer layout similar to the Android Facebook app. I am wondering what the best method for architecture is. Should I have a main activity which is responsible for the action bar, and then have it use fragments to display the content of each menu item, or should I be using one activity to manage the action bar, and then have each menu item kick off entirely separate activities? I could also imagine building multiple activities, which each have to manage the action bar. This option seems the worst.
tagged with: java
downvote count: 1
accepted answer: http://stackoverflow.com/a/22659749
type: Question
possible better answer: http://stackoverflow.com/a/22545093
has answer: http://stackoverflow.com/a/22544886
has answer: http://stackoverflow.com/a/22659749
has answer: http://stackoverflow.com/a/22545093
score: 0
upvote count: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22545053
answer count: 4
has comment: http://stackoverflow.com/comment/34491069
type: AnsweredQuestion

http://stackoverflow.com/comment/34407597
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22546743
type: Comment
has text: If you need to display the list, then you're going to need the `JList`. Getting the content into a `java.util.List` will make manipulating the content as simple as you can get. You could simply move between elements with a next/prev button, but you would need to maintain a index value to determine the current record...

http://stackoverflow.com/q/22633195
type: UnansweredQuestion
has body: I'm using a HSQLDB to make a small program (with JavaFX gui) and I'm currently trying to get the "reservation" part to work (the user can add new ones or search for existing ones in a restricted period of time). For that I already added a few dates beforehand (I'm using a database.sql script), e.g.: INSERT INTO reservations(begin, end) VALUES ('2013-08-01', '2013-08-31') I already wrote a few methods (create, update, delete, search, findAll) and now I'm kind of stuck on the "create" part. I want to insert new reservations into the DB with pstmt = con.prepareStatement("INSERT INTO reservations(begin, end) VALUES (?,?)"); but I'm having problems creating new Dates that I can insert. pstmt.setDate(1, (java.sql.Date) beg); Doesn't work (I'm using java.util.Date objects to save the exported dates from the DB), it just aborts my tests (jUnit). Calendar cal1 = Calendar.getInstance(); cal1.set(2014, 0, 1); Date beginn = cal1.getTime(); only creates dates in the form of: Wed Jan 01 12:23:15 CET 2014 But (and I don't know how exactly dates are saved in HSQLDB) I want the date to be "YYYY-MM-DD". So, what's the best way of converting the calendar dates into the format I need (and caste them? Unfortunately, casting a String to Date doesn't work). And: Is my approach of using java.util.Date dates okay if I'm going to use JavaFX to let the user select a starting and an end date?
has comment: http://stackoverflow.com/comment/34488655
score: 1
tagged with: java
upvote count: 1
tagged with: calendar
has comment: http://stackoverflow.com/comment/34487621
type: Question
downvote count: 0
tagged with: date
tagged with: sql
answer count: 1
tagged with: hsqldb
has title: HSQLDB: Insert/Get Date with java
favorite count: 0
has answer: http://stackoverflow.com/a/22633457

http://stackoverflow.com/comment/34270291
score: 0
comment on: http://stackoverflow.com/q/22521649
type: Comment
type: QuestionComment
has text: Each element of that array is an "object" (Map) containing TWO name/value pairs. (Why the heck they use such a stupid scheme I have no idea.) Also, the final row is miscoded -- it should almost certainly be "att_2_value".

http://stackoverflow.com/q/22498397
has title: is the default constructor is declaring is compulsary?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22498462
has answer: http://stackoverflow.com/a/22498492
possible better answer: http://stackoverflow.com/a/22498435
tagged with: java
has answer: http://stackoverflow.com/a/22498435
has answer: http://stackoverflow.com/a/22499593
accepted answer: http://stackoverflow.com/a/22499593
has answer: http://stackoverflow.com/a/22591932
type: Question
has comment: http://stackoverflow.com/comment/34242645
has answer: http://stackoverflow.com/a/22498482
has comment: http://stackoverflow.com/comment/34229045
has answer: http://stackoverflow.com/a/22498461
answer count: 7
has comment: http://stackoverflow.com/comment/34238044
has body: We all Know that the JVM provides us a default constructor in the every java program. But if we declare any other type of constructor then it does not provide the any type of default constructor. So, my question is that is it compulsory to declare default constructor when we declare any other type of constructor in our program. If YES then explain Why? If NO then also explain Why? Give the Solution with proper suitable example.
score: 4
downvote count: 1
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/34238075
has comment: http://stackoverflow.com/comment/34228954

http://stackoverflow.com/a/22566400
has comment: http://stackoverflow.com/comment/34349251
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34348673
has comment: http://stackoverflow.com/comment/34348410
answers question: http://stackoverflow.com/q/22566340
has comment: http://stackoverflow.com/comment/34348468
accepted answer of: http://stackoverflow.com/q/22566340
type: Answer
has comment: http://stackoverflow.com/comment/34348728
has comment: http://stackoverflow.com/comment/34349183
score: 2
has body: If you want to add the array position to the ArrayList on each iteration, your add() call must be inside the loop: do { // ... storedMembers.add(position); } while(...); Edit: for (int i = 0; i &lt; storedMembers.size(); i ++) // ... if (!checkIfPositionIsOccupied(position)) storedMembers.add(position); }
downvote count: 0

http://stackoverflow.com/a/22644929
upvote count: 3
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22644707
score: 3
has body: uses less intuitive language (stream, filter, and forEach instead of for and if I don't really find them less intuitive. Moreover, wait for few months, those will be mostly used terms you will hear in Java. In fact, once you are comfortable with lambdas, you'll see how amazingly it cleansifies your code, that uses complex logic inside loops. So are there any advantages to using lambdas instead of iterators, when the code isn't cleaner? For example, are there any performance gains? One obvious advantage of streams and lambdas that comes to my mind is, it gives you the power of parallel execution more easily using Stream.parallelStream(). Also internal iteration of streams gives control of how iteration happens to the API. It can choose to evaluate intermediate operations lazily, parallely, sequentially, etc. Moreover, functional programming has it's own advantage. You can pass around logics in the form of lambdas, which used to be done using anonymous classes earlier. That way, some functionality can be easily re-used. Although there are certain disadvantages too, when comparing with normal for loop. If your loop is modifying some local variable, then you can't get it converted to forEach and lambdas version (at least not directly), because variables used inside lambdas needs to be effectively final. More details can be found on java.util.stream javadoc.

http://stackoverflow.com/q/22624133
type: UnansweredQuestion
type: Question
tagged with: libgdx
score: 1
tagged with: java
tagged with: eclipse
has body: Eclipse (using LibGdx) show this error message every time when a sound (MP3) is played. is it normal?
upvote count: 1
has comment: http://stackoverflow.com/comment/34452837
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34457428
answer count: 0
downvote count: 0
has title: SoundPool error when playing sound

http://stackoverflow.com/comment/34221115
type: QuestionComment
has text: We don't have a crystal ball. There are at least a dozen things that I can think of that could affect the performance of your code having nothing to do with its design, and you're focusing on the design without showing us some code as a baseline.
score: 0
comment on: http://stackoverflow.com/q/22493120
type: Comment

http://stackoverflow.com/comment/34764833
score: 0
type: AnswerComment
type: Comment
has text: The method "probeContentType" is a method of java.nio.file.spi.FileTypeDetector, not of java.nio.file.Files.
comment on: http://stackoverflow.com/a/22665643

http://stackoverflow.com/q/22584669
has comment: http://stackoverflow.com/comment/34381957
upvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34393416
tagged with: memory-management
downvote count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34381991
has comment: http://stackoverflow.com/comment/34381879
has comment: http://stackoverflow.com/comment/34392522
has comment: http://stackoverflow.com/comment/34392987
type: Question
has body: I have a multi-threaded program that does heavy memory allocation. The performance is fine on a quad-core i7 CPU and the speed up is around 3.9X. But, when the program is executed on a 12-core Xeon CPU, the speedup value does not go beyond 5.5X. I should mention that the GC seems not to be a problem because VisualGC reports below 1 seconds for GC after more than 100 seconds of execution. The main memory usage belongs to the Eden section of heap and other sections hardly get used. The code does massive int array allocations and performs some arithmetic operations on them. It is somehow like state-space exploring and allocation of new instances cannot be avoided. As you know, the standard memory allocators of both Windows and Linux show unsatisfactory performance for multi-threaded programs and good alternatives like tcmalloc and Hoard are available for C/C++. Since the parallel section consists of fully independent tasks and the GC time is very low, I doubted that the main reason should be the bad performance of JVM's memory allocator when too many threads compete for allocation. Does anybody have experience with JVM's allocator in massive multithreaded programs and can give advise on how I can overcome this problem?? P.S. I have tested the code using JVM 6,7, and 8. The allocation rate is also very high (around 10 millions per second) but as I mentioned the Eden section is heavily used and the working set is less than a Gigabyte.
tagged with: java
has answer: http://stackoverflow.com/a/22783163
has comment: http://stackoverflow.com/comment/34398018
has comment: http://stackoverflow.com/comment/34394105
score: 5
answer count: 1
has comment: http://stackoverflow.com/comment/34437669
has title: Multithreading Performance of JVM's Memory Allocator
tagged with: jvm
favorite count: 0

http://stackoverflow.com/a/22599909
downvote count: 0
type: Answer
upvote count: 1
has body: It is not bad idea. You can convert BigDecimal into double for this purpose.
accepted answer of: http://stackoverflow.com/q/22599882
score: 1
answers question: http://stackoverflow.com/q/22599882
type: AcceptedAnswer

http://stackoverflow.com/q/22581716
downvote count: 2
tagged with: object
has comment: http://stackoverflow.com/comment/34376642
tagged with: java
type: Question
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/34376748
has title: copying instances to avoid changing java instance state
has body: Suppose I have a class public class Test{ Point[] pq = null; public Test(int Capacity) { Point[] pq = new Point[Capacity]; } public static void main(String[] args) { Point point = new Point(); // suppose it has a given state `state` equal to 0 Test test = new Test(1); test.pq[0] = point; // here test[0] has a `state` equal to 0 point.state = 1 //Suppose now I change the `state` of the point instance variable to 1 } ...} public class Point{ public Integer state = 0; ... } I changed the state of the point instance variable to 1 then test.pq[0].state is now equal to 1. How can I prevent my code from this behavior ? Edit 1, in the Point class, I added getter and setters and turned public Integer state into private Integer state = 0, I added this public void copy(Point point){ this.setState(point.getState()) } when I call Test test = new Test(1); test.pq[0].copy(point);, I still get te same problem
has comment: http://stackoverflow.com/comment/34376819
has comment: http://stackoverflow.com/comment/34376481
has answer: http://stackoverflow.com/a/22582025
answer count: 1
has comment: http://stackoverflow.com/comment/34376487
favorite count: 0
has comment: http://stackoverflow.com/comment/34376752
type: UnansweredQuestion

http://stackoverflow.com/comment/34376206
comment on: http://stackoverflow.com/q/22581060
has text: I understand the difference, but which convention should I follow when I'm on an interview? Which implementation the interviewer expects?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/62090660
comment on: http://stackoverflow.com/a/22565302
score: 1
type: AnswerComment
has text: Thank you for this! I'd spent several hours debugging a related issue, and when the lightbulb finally went off of "oh, I wonder if it's because...", your post was the first thing I found that confirmed my suspicions, allowed me to write a small test to confirm it, and provided a simple solution. Thanks again!
type: Comment

http://stackoverflow.com/q/22598451
tagged with: parsing
possible better answer: http://stackoverflow.com/a/22598576
score: 1
has title: Parsing floats from table into a 2D array
upvote count: 1
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22598531
tagged with: java
has body: I have a file that contains a square table of floats. The file is an example, therefore the number of rows and columns may change in the other files for reading. I am getting an out-of-bounds exception and can't figure out what the problem is. while ((line=bufferedReader.readLine())!=null){ String[] allIds = line.split(tabSplit); String[] allFloats = new String[allIds.length-2]; //i do "length-2" because the first two columns in the table are not numbers and are supposed to be ignored. System.arraycopy(allIds, 2, allFloats, 0, allIds.length-2); int rows = rowsNumber; int cols = colsNumber; //i have "rows" and "cols" values already extracted from the file and they return the correct integers. double [][]twoD = new double[rows][cols]; int rowCount = 0; for (int i = 0; i&lt;rows; i++) { twoD[rowCount][i] = Double.parseDouble(allFloats[i]); } rowCount++; } } The table i have looks something like this, but with more rows and columns: #18204 name01 2.67 2.79 2.87 2.7 #12480 name02 4.01 3.64 4.06 4.24 #21408 name03 3.4 3.55 3.34 3.58 #a2u47 name04 7.4 7.52 7.62 7.23 #38590 name05 7.63 7.29 8 7.72 When I print allFloats, it returns each row in a separate array correctly. I don't understand why I get an error when I try to create a 2D array.
answer count: 2
downvote count: 0
favorite count: 0
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/22598576
has answer: http://stackoverflow.com/a/22598531

http://stackoverflow.com/comment/34358253
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22571457
type: Comment
has text: Unfortunately, those two requirements are at odds with each other :-\

http://stackoverflow.com/q/22534267
accepted answer: http://stackoverflow.com/a/22534394
has answer: http://stackoverflow.com/a/22534981
has comment: http://stackoverflow.com/comment/34292045
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34292043
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34292181
type: Question
upvote count: 1
favorite count: 0
has body: How do you make Long return decimal? long i = 10; long g = 1028; long gf =(long) i/ (long)g; System.out.println(gf) Current answer: 0 Desire Answer : 0.001 // round to 0.000
answer count: 3
has title: Make Long Variable Return Decimal Answer in Java
has comment: http://stackoverflow.com/comment/34292232
possible better answer: http://stackoverflow.com/a/22534411
downvote count: 0
has comment: http://stackoverflow.com/comment/34292112
has answer: http://stackoverflow.com/a/22534411
has answer: http://stackoverflow.com/a/22534394

http://stackoverflow.com/q/22532217
score: 0
tagged with: java
upvote count: 1
answer count: 1
downvote count: 1
tagged with: checksum
has comment: http://stackoverflow.com/comment/34288368
has comment: http://stackoverflow.com/comment/34288537
has body: First : I have a string which contains an accented character . Second : I calcul the checksum for it . private static String checkSumInStream(String Str, String checksumAlgorithm) throws Exception { InputStream stream = new ByteArrayInputStream(Str.getBytes()); MessageDigest digest = MessageDigest.getInstance(checksumAlgorithm); InputStream input = null; StringBuffer sb = new StringBuffer(); try{ input = stream; byte[] buffer = new byte[8192]; do { int read = input.read(buffer); if(read &lt;= 0) break; digest.update(buffer, 0, read); } while(true); byte[] sum = digest.digest(); for (int i = 0; i &lt; sum.length; i++) { sb.append(Integer.toString((sum[i] &amp; 0xff) + 0x100, 16).substring(1)); } }catch(IOException io) { }finally{ if(input != null) input.close(); } return sb.toString(); } Then i write the string in text file and i I recalcul the checksum of the file private String checkSum(File file,String checksumAlgorithm) throws Exception { MessageDigest digest = MessageDigest.getInstance(checksumAlgorithm); InputStream input = null; input = new FileInputStream(file); byte[] buffer = new byte[8192]; do { int read = input.read(buffer); if(read &lt;= 0) break; digest.update(buffer, 0, read); } while(true); input.close(); byte[] sum = digest.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i &lt; sum.length; i++) { sb.append(Integer.toString((sum[i] &amp; 0xff) + 0x100, 16).substring(1)); } return sb.toString(); } --> Result : the comparison between checksum of an output steam and the file doesn't match when text contains an accented character .
has title: Checksum doesn't match when computed string contains accented characters
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22533531
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22533531

http://stackoverflow.com/q/22504593
linked to: http://stackoverflow.com/q/7218309
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22507549
score: 2
upvote count: 2
has body: I would like to know if there is any algorithm that does something like this: Given a specific surface it divides it into smaller rectangles of the same size. Something like this example figure: The grey area is the surface, and the red squares is the partition itself. I am thinking if there is a optimized way to do this. A very bad approach would be a for loop in all the pixels and check if there is a rectangle for that specific spot, if not, would create a rectangle, and so on.. Maybe someone knows a algorithm already done? or a better solution? Thanks alot in advance ;)
tagged with: graphics
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22507549
tagged with: rectangles
possible better answer: http://stackoverflow.com/a/22504666
tagged with: java
tagged with: partition
has answer: http://stackoverflow.com/a/22504666
has title: Java Partition Surface into Little Squares
tagged with: image
type: Question
answer count: 2

http://stackoverflow.com/a/22558730
has body: Your for loop does not execute because the loop condition i&lt;=100 is never met with an initial value of i=999. Since you want your loop to count downwards, change for(i=999; i&lt;=100; i=i-1) to for(i=999; i&gt;=100; i=i-1)
upvote count: 4
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/22558689

http://stackoverflow.com/comment/34424228
score: 0
type: Comment
type: QuestionComment
has text: The array contains the `Dog` objects right? Because this statement of yours *If you have an array ( cannot be ArrayList ) that will be used to store specific things such as "dog type", "dog name" and "dog age".* is quite confusing.
comment on: http://stackoverflow.com/q/22608601

http://stackoverflow.com/q/22572701
accepted answer: http://stackoverflow.com/a/22578839
type: Question
has answer: http://stackoverflow.com/a/22578839
score: 0
has title: Is it common to have dependency between facade layer?
answer count: 1
has body: My application have the follow layer: - Facade - Business Object - Repository (Spring JPA Data) Let's suppose the follow classes: @Component public class MessageFacade implements MessageService { @Autowired private GarageBO garageBO; @Autowired private MessageBO messageBO; public void createFeedbackMessage(...) { messageBO.createFeedbackMessage(...); garageBO.createFeedback(...); } } @Component public class ServiceOrderFacade implements ServiceOrderService { @Autowired private ServiceOrderBO serviceOrderBO; @Autowired private MessageBO messageBO; @Autowired private GarageBO garageBO; public void createServiceOrder(...) { serviceOrderBO.createServiceOrder(...); messageBO.createFeedbackMessage(...); garageBO.createFeedback(...); } } Observing the createFeedbackMessage method in MessageFacade i have: 1) The createFeedbackMessage method in MessageBO it's responsible to create an email with the feedback survey LINK; 2) The createFeedbackMessage method in garageBO creates the Feedback ENTITY with the questions and responses; On createServiceOrder method in ServiceOrderFacade i need to call an method of ServiceOrderBO and after i need to have the same behavior of createFeedbackMessage method in MessageFacade. Is it a bad idea to create a dependency between ServiceOrderFacade -> MessageFacade ? The code would be: @Component public class ServiceOrderFacade implements ServiceOrderService { @Autowired private ServiceOrderBO serviceOrderBO; @Autowired private MessageBO messageBO; @Autowired private GarageBO garageBO; public void createServiceOrder(...) { serviceOrderBO.createServiceOrder(...); getMessageService().createFeedbackMessage(...); } }
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22588890
upvote count: 2
has body: Thank you for your responses! Think the following would be better) SearchRequestBuilder searchRequestBuilder = client.prepareSearch() .setIndices("mongoindex") .setTypes("files") .setQuery(QueryBuilders.queryString("anyword")) .addField("file.file"); SearchResponse response = searchRequestBuilder.execute().actionGet(); System.out.println(response.toString());
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22581317

http://stackoverflow.com/comment/34354808
has text: You may also find the following article useful on how to deal with InterruptedException: http://www.ibm.com/developerworks/library/j-jtp05236/
comment on: http://stackoverflow.com/q/22569411
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22511413
tagged with: apache-poi
downvote count: 0
tagged with: dsl
has answer: http://stackoverflow.com/a/22556960
has answer: http://stackoverflow.com/a/68706947
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/27411046
accepted answer: http://stackoverflow.com/a/27411046
has body: Does anyone know a good library written in java providing a fluid wrapper around Apache POI? The Ugly Duckling entry on the POI case studies page (last entry) refers to something like this.
has title: DSL wrapper library for apache POI in Java
possible better answer: http://stackoverflow.com/a/68706947

http://stackoverflow.com/comment/34366074
has text: yup, closing the resource :)
comment on: http://stackoverflow.com/q/22576068
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/65361715
comment on: http://stackoverflow.com/a/22555012
has text: Great solution! It can be taken a step further by making this the default behavior. Create a class called `org.mockito.configuration.MockitoConfiguration` that extends `DefaultMockitoConfiguration`. (Mockito instantiates this class via reflection). Override the `getDefaultAnswer` method to return an instance of your custom `OptionalAnswer`. Now when you create the mock using `mock(MyObject.class)` you'll get the custom answer behavior.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22595372
favorite count: 0
tagged with: android
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22595788
upvote count: 1
type: Question
tagged with: nested-class
has body: I'm following this tutorial, but after completing step 6, I'm left with an error: "MyGestureDetector cannot be resolved to a type" when I try to instantiate a "new MyGestureDetector()". Code: package com.example.rotatingdialer; import android.os.Bundle; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.view.GestureDetector; import android.view.GestureDetector.SimpleOnGestureListener; import android.view.Menu; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.widget.ImageView; public class MainActivity extends Activity { private static Bitmap imageOriginal, imageScaled; private static Matrix matrix; private ImageView dialer; private int dialerHeight, dialerWidth; private GestureDetector detector; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // load the image only once if (imageOriginal == null) { imageOriginal = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); } // initialize the matrix only once if (matrix == null) { matrix = new Matrix(); } else { // not needed, you can also post the matrix immediately to restore the old state matrix.reset(); } detector = new GestureDetector(this, new MyGestureDetector()); dialer = (ImageView) findViewById(R.id.imageView_ring); dialer.setOnTouchListener(new MyOnTouchListener()); dialer.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { // method called more than once, but the values only need to be initialized one time if (dialerHeight == 0 || dialerWidth == 0) { dialerHeight = dialer.getHeight(); dialerWidth = dialer.getWidth(); // resize Matrix resize = new Matrix(); resize.postScale((float)Math.min(dialerWidth, dialerHeight) / (…
tagged with: java
has title: Nested class cannot be resolved to a type
accepted answer: http://stackoverflow.com/a/22595788
downvote count: 0
answer count: 1

http://stackoverflow.com/q/22640472
has answer: http://stackoverflow.com/a/22640537
tagged with: subclass
has answer: http://stackoverflow.com/a/22640780
tagged with: return-type
type: AnsweredQuestion
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/34481590
accepted answer: http://stackoverflow.com/a/22640537
type: Question
has body: I have an abstract class UIObject looking the following: public abstract class UIObject { private final int tabOrder; public UIObject(int tabOrder) { this.tabOrder = tabOrder; } public int getTabOrder() { return this.tabOrder; } } and there are some objects which have UIObject as superclass. In some service class I've also got a method goTo() which looks like this: public UIObject goTo(UIObject object) { //some fancy code here return object; } Now, I want to return the specific object which has been passed to the function. (I know, this sounds stupid, but it's got a senseful reason, trust me.) But since the passed objects are all different subclasses of UIObject, this method does not work that way. I strongy believe, I have done something like this before, thus I think this is an easy thing. Correct me if I'm wrong.
has title: How to return an extended object (subclass)? Actually, how to return the exact object which has been passed to a method?
tagged with: abstract-class
answer count: 2
tagged with: generics
possible better answer: http://stackoverflow.com/a/22640780

http://stackoverflow.com/comment/34446920
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22620664
has text: I don't have Java 8 handy, so I can't test this easily; but what happens if you cast the third argument to `Object[]` ?
type: Comment

http://stackoverflow.com/q/22646486
score: 2
type: AnsweredQuestion
tagged with: gradle-custom-plugin
tagged with: java
tagged with: gradle
type: Question
linked to: http://stackoverflow.com/q/22584869
downvote count: 0
has title: Execute Java class with separate classpath from Gradle plugin
answer count: 1
has body: In my plugin I need to execute static bootstrapping method from an external JAR to perform an analysis. Currently I call it directly from code with MutationCoverageReport.main(arg), but this forces me to create a compile time dependency in my plugin which is hard to modify (choose a different JAR version) when executing the plugin. I would like to call it using reflection and found some examples in Gradle code like WorkerProcessBuilder or JavaExecHandleBuilder. Nevertheless they are in org.gradle.process.internal package and I'm not sure if it is recommended to use it from the external plugin. Question. What is the recommended way for Gradle plugin to run arbitrary Java method from external class with specified classpath? Btw, I would prefer to not use an Ant task as it is a separate project and another layer of abstraction with its potential bugs and limitations.
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/22649935
accepted answer: http://stackoverflow.com/a/22649935

http://stackoverflow.com/comment/34464980
type: AnswerComment
score: 0
type: Comment
has text: thanks for your help but it doesn't work. It still chrashes when starting.
comment on: http://stackoverflow.com/a/22630639

http://stackoverflow.com/a/22643494
has comment: http://stackoverflow.com/comment/34486767
type: Answer
has comment: http://stackoverflow.com/comment/34487027
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22643381
accepted answer of: http://stackoverflow.com/q/22643381
has body: Does this mean that their complete source code (in compiled form, of course) will be included in my final APK? Yes, for your default debug build. Release builds run through ProGuard, which can rip out some of the unused Java code. unlike the base Android libraries, these Google libraries aren't present on Android devices, are they? Correct.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22631811
has title: How to create Alfresco Share Java-backed media viewer?
upvote count: 1
tagged with: spring
answer count: 1
tagged with: java
type: UnansweredQuestion
tagged with: alfresco-share
downvote count: 0
score: 1
favorite count: 0
tagged with: alfresco
type: Question
has answer: http://stackoverflow.com/a/22632399
has body: I have investiagted Alfresco media-viewers project and also read a lot of documentation on WebScripts. My idea is to create a Java-backed viewer for the Alfresco Share. The underlying Java code will be a bit complicated - it has to handle additional URLs to load own resources form the bundle to use them. The ideal solution is to integrate Java code as Spring Controller and handle URL mapping with @RequestMapping annotation (or through servlet-mapping xml node). If someone know how Programming with Surf can be used in this case it also would be very helpful.
tagged with: surf

http://stackoverflow.com/q/22610526
has answer: http://stackoverflow.com/a/55919772
tagged with: arraylist
has title: How to append elements at the end of ArrayList in Java?
score: 35
upvote count: 35
has comment: http://stackoverflow.com/comment/34427765
has comment: http://stackoverflow.com/comment/34427875
has comment: http://stackoverflow.com/comment/34427963
tagged with: append
favorite count: 0
has answer: http://stackoverflow.com/a/46989301
has answer: http://stackoverflow.com/a/59186938
has comment: http://stackoverflow.com/comment/34427643
answer count: 4
has comment: http://stackoverflow.com/comment/34427825
has answer: http://stackoverflow.com/a/22612588
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34427630
tagged with: java
possible better answer: http://stackoverflow.com/a/59186938
has body: I am wondering, how do I append an element to the end of an ArrayList in Java? Here is the code I have so far: public class Stack { private ArrayList<String> stringList = new ArrayList<String>(); RandomStringGenerator rsg = new RandomStringGenerator(); private void push(){ String random = rsg.randomStringGenerator(); ArrayList.add(random); } } randomStringGenerator is a method which generates a random String. I basically want to always append the random string at the end of the ArrayList, much like a stack (Hence the name "push").
type: Question
has comment: http://stackoverflow.com/comment/34427711
downvote count: 0
accepted answer: http://stackoverflow.com/a/22612588

http://stackoverflow.com/comment/34449368
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22622332
score: 3
has text: There's no "magic" way of doing this. You're going to have to choose one of those "overkill" options: create a method, declare a flag, encapsulate it in a lambda/anonymouse method, etc.

http://stackoverflow.com/a/22531730
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34287384
type: Answer
answers question: http://stackoverflow.com/q/22531710
downvote count: 0
has body: move String getNewDate = date.toString(); String getNewTitle = nameTextBox.getText().toString(); String getNewTime = timeTextBox.getText().toString(); String getNewDetails = detailsTextBox.getText().toString(); inside onCreate, after findViewById

http://stackoverflow.com/q/22520648
score: 0
linked to: http://stackoverflow.com/q/9554636
answer count: 2
has comment: http://stackoverflow.com/comment/34268190
has comment: http://stackoverflow.com/comment/34274471
tagged with: frame
accepted answer: http://stackoverflow.com/a/22520892
has body: I am making a java program, and I need to close a frame. When I click on the search icon, an ActionListener will react and will make the same frame with 4 extra buttons. So now I have got 2 frames (1 with 4 extra buttons on the top and 1 that doesn't). How can iI close the frame that has no button, so that "frame" closes and "frame1" will stay open? My code: http://pastebin.com/ZKnfRt2Y I tried frame.dispose(); but that didn't work.
possible better answer: http://stackoverflow.com/a/22520889
has comment: http://stackoverflow.com/comment/34268166
has answer: http://stackoverflow.com/a/22520889
has comment: http://stackoverflow.com/comment/34268246
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34268374
has comment: http://stackoverflow.com/comment/34268314
has title: Java, closing a frame from another frame/class
tagged with: jframe
has comment: http://stackoverflow.com/comment/34268247
tagged with: swing
has answer: http://stackoverflow.com/a/22520892
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34268313
has comment: http://stackoverflow.com/comment/34268424

http://stackoverflow.com/comment/34307278
type: AnswerComment
has text: path != domain - this answer mixes them up
score: 2
type: Comment
comment on: http://stackoverflow.com/a/22542437

http://stackoverflow.com/a/22583404
has body: The short answer is: Yes. Since you have a wrapper function isResident, you could also implement a wrapper addResident and declare resident as private
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22583079

http://stackoverflow.com/q/22522721
tagged with: windows
has answer: http://stackoverflow.com/a/22523125
favorite count: 0
has answer: http://stackoverflow.com/a/22529522
type: UnansweredQuestion
tagged with: yajsw
has answer: http://stackoverflow.com/a/27178819
score: 1
tagged with: java
tagged with: windows-services
type: Question
has body: I am using YAJSW to install (and uninstall) my program as Windows service (win 32 and win 64) with the following directory structure. How do I go about it ? apps - user works with this dir log - user works with this dir core - core of my program, user not works with this dir, here may be anything, include wrappers. install.cmd - user launch it to install software as windows service uninstall.cmd - user launch it to uninstall windows service settings.cmd - a very short file with user properties. javapath, ntservicename, dburl, dbuser, dbpass at all - user edit it.
has title: Running Java program with custom directory structure as Windows service
downvote count: 0
answer count: 3
tagged with: wrapper
upvote count: 1

http://stackoverflow.com/q/22557902
tagged with: java
has body: Let's say I have a Mac application bundle and my executable inside isn't Cocoa/Objective-C based but I use a normal shell script for any good reason: myProgram.app/ Contents/ MacOS/ mainExecutable.sh Resources/ The shell script does some foo before starting a java process with the main program (GUI based). I now want to receive drop events to the Apps Dock icon in my java process, but that doesn't seem to work. The shell script neither receives the dropped file(s) as argument list on startup ($0 or $@) nor does it receive any input on stdin. How can I pass the drop events and the list of dropped files to the shell script and any executed program inside?
type: Question
has title: Pass drop event on Mac Dock icon to a shell script and its child processes
downvote count: 0
tagged with: bash
accepted answer: http://stackoverflow.com/a/22557903
answer count: 1
tagged with: shell
tagged with: macos
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/22557903

http://stackoverflow.com/comment/34265274
comment on: http://stackoverflow.com/q/22518907
score: 0
has text: Can a primitive value be considered an object? is the exact question.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34433878
type: AnswerComment
comment on: http://stackoverflow.com/a/22613513
type: Comment
has text: Sorry, but i don't get what u mean by: adjust the exception message. I can't use any message i want ?
score: 0

http://stackoverflow.com/a/22649344
has body: You can instruct ProGuard to keep all annotated methods: -keepclassmembers class * { @android.webkit.JavascriptInterface &lt;methods&gt;; } This should probably be part of the default configuration in the Android SDK.
answers question: http://stackoverflow.com/q/22618588
type: Answer
score: 11
downvote count: 0
upvote count: 11
accepted answer of: http://stackoverflow.com/q/22618588
type: AcceptedAnswer

http://stackoverflow.com/q/22574728
tagged with: java
has answer: http://stackoverflow.com/a/22574767
type: Question
has title: Java load and process big data
has body: I have several big data(1G each) files containing person's information(just name and phone numbers). The format is clear and flexible. The problem is load and process them. Process one of them maybe still feasible but if I want to process them all under certain directory, things get tricky. When I use File file = chooser.getSelectFile(); and get a directory, I think the next step is put the file in the file array: File[] files = file.ListFile(); But will that cause a problem? Since each file is 1G, the VM's memory wont ablt to hold all these files together. In order to search them later, I think I may want to sort them first. How can I sort these individual files? Since the total size is so big, the idea: put them into files like A.txt, B.txt which start with letter A and B is not sufficient.
answer count: 3
tagged with: file-io
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22574774
tagged with: bigdata
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/22574787

http://stackoverflow.com/comment/34336872
comment on: http://stackoverflow.com/q/22559224
has text: @AaronDigulla when editing, it shows correctly. I don't know how to solve it. Maybe a bug?
score: 0
type: Comment
type: QuestionComment

android-sensors
tags question: http://stackoverflow.com/q/22535344
tags question: http://stackoverflow.com/q/22581095
tags question: http://stackoverflow.com/q/22612961
tags question: http://stackoverflow.com/q/22529419
tags question: http://stackoverflow.com/q/22576456
tag name: android-sensors
type: Tag

http://stackoverflow.com/a/22600145
has body: Dave, ftl files being used from location src/main/webapp/... are not in classpath. And i beleive your testing class is on location src/test/... which will not have visibility into the ftl files (which are actually in src/main/webapp//WEB-INF/freemarker/mail/job/*.ftl) and so you get template not found exception. If you want them to be on classpath, put the files in src/test/resources.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34410591
has comment: http://stackoverflow.com/comment/88113598
type: Answer
accepted answer of: http://stackoverflow.com/q/22599980
score: 2
answers question: http://stackoverflow.com/q/22599980
upvote count: 2

http://stackoverflow.com/comment/34477205
has text: The HttpSession is stored at server side and shouldn't be visible to any end user, unless he has access to the server. But there's no real need to keep the password in the session. That's just a bad design. The password has to be in Server memory only the amount of time is necessary for authentication.
score: 3
comment on: http://stackoverflow.com/q/22636055
type: QuestionComment
type: Comment

http://stackoverflow.com/a/33077985
answers question: http://stackoverflow.com/q/22580149
type: Answer
score: 1
has body: i had a similar requirement where i had to count the levels in a bfs algo. I did it by creating a of hashmap of levelMap>.. the integer is the level number... nodes is the list of nodes at the same level... this helped me find out when to go to the next level by incrementing the level counter...while doing bfs.. pseudo code: HashMap&lt;Integer, ArrayList&lt;Node&gt;&gt; levelMap = new HashMap&lt;Integer, ArrayList&lt;Node&gt;&gt;(); .... int currentLevelFromMap = getCurrLevelFromMap(levelMap, currentNode); currentLevel = currentLevelFromMap + 1; if (currentLevelNodeList.size() != 0) { levelMap.put(currentLevel, currentLevelNodeList); } currentLevelNodesList is the list of the nodes from a particular iteration of algorithm
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/34258802
score: 2
comment on: http://stackoverflow.com/q/22515524
has text: No, they don't get inserted at all (this is why a set's `.add()` method returns a boolean). Just like keys in a map aren't replaced, only values associated with that key are.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34357511
comment on: http://stackoverflow.com/a/22570722
type: AnswerComment
has text: I think you're barking up the wrong tree frankly. You're not going to improve on the kernel implementation of select(), and it's been beaten to death for decades so it's vanishingly unlikely to have any bugs.
score: 0
type: Comment

http://stackoverflow.com/q/22544818
has comment: http://stackoverflow.com/comment/34311324
has answer: http://stackoverflow.com/a/22545853
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34312232
has title: Adding a string to an arraylist through another arraylist's object's method
upvote count: 1
has answer: http://stackoverflow.com/a/22545693
possible better answer: http://stackoverflow.com/a/22545853
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22545693
has comment: http://stackoverflow.com/comment/34312526
has body: I am in the process of updating my game to Java, but the only minor bug I have left is this: Every time a dead player's name is "added" to the dead player name list, it adds the Player object's hashcode instead. EDIT: Here is a link to a zip folder with the source code: https://dl.dropboxusercontent.com/u/98444970/KarmaSource.zip The code in question is the two places where the line gets the player object and gets the object's name. When it is used in println, it works fine and prints the player's name. However, in the second part where it does the same thing, but it prints the hashcode of the player object instead of calling its get_name method and returning the String. I'm not sure if it has to do with the third part, where it adds the "name" to dead player list pdead. If you'd like a link to the compiled version, let me know. It's compiled under JDK 7 Update 51 64-bit. EDIT: I got it working, I was originally referencing the players list instead of the pdead list. Thanks to all who contributed to helping. If you still want the game, let me know and I'll put a download link :D
tagged with: arraylist
score: 0
answer count: 2
tagged with: string
has comment: http://stackoverflow.com/comment/34311410
tagged with: println
favorite count: 0

http://stackoverflow.com/q/22534050
type: Question
score: 3
has answer: http://stackoverflow.com/a/22534684
has title: AndroidStudio: support package v7 seems not imported correctly
tagged with: java
has comment: http://stackoverflow.com/comment/34361568
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22627864
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I recently upgraded to android studio 0.5.1. Since that moment, I'm getting the following logcat message on an android 2.3.5 testing device. The messages are followed buy an instant close of the app (without a force close message). The same issue occures on an api level 8 emulator so it seems not to be devices specific. I/dalvikvm﹕ Failed resolving Landroid/support/v7/widget/SearchView$5; interface 949 'Landroid/view/View$OnLayoutChangeListener;' W/dalvikvm﹕ Link of class 'Landroid/support/v7/widget/SearchView$5;' failed E/dalvikvm﹕ Could not find class 'android.support.v7.widget.SearchView$5', referenced from method android.support.v7.widget.SearchView.addOnLay W/dalvikvm﹕ VFY: unable to resolve new-instance 869 (Landroid/support/v7/widget/SearchView$5;) in Landroid/support/v7/widget/SearchView; D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0002 D/dalvikvm﹕ VFY: dead code 0x0004-000a in Landroid/support/v7/widget/SearchView;.addOnLayoutChangeListenerToDropDownAnchorSDK11 ()V On my Nexus 4 (Android Kitkat) the app works. For me, it looks like the app somehow fails to find or load the support package correctly, although it is in my build.gradle.: dependencies { // some other imports here compile 'com.android.support:support-v4:+' compile 'com.android.support:appcompat-v7:+' } Testing with different buildToolVersions (19.0.1 and 19.0.3) and different support version (replaced the + with 19.0.+) didnt help. Any help would be appreciated. // Update: I downgraded to Android Studio 0.4.2 with gradle 1.9 and it is working again. This lets me assume its a problem within AS and/or gradle 1.11. - Gonna report that as a bug
tagged with: android-studio
upvote count: 3
has answer: http://stackoverflow.com/a/22574302

http://stackoverflow.com/q/22579941
has title: How to correctly add a Java Maven project dependency to a Grails Maven project in eclipse
tagged with: eclipse
type: Question
upvote count: 4
has body: I'm using: Eclipse Kepler Service Release 2 M2E - Maven Integration for Eclipse 1.4.0.xxx Grails 2.1.2 Groovy/Grails Tool Suite 3.4.0 My approach was to create a Grails application, then convert it to a Maven project and then I added a Java Maven project as dependency through the "Java Build Path" -> "Projects" option. But every time I want to run the Grails application the Grails application is unable to resolve those classes from my other Java Maven project. Might be a very simple problem but I couldn't find any solution so far. Thank you in advance!
score: 4
tagged with: grails
has answer: http://stackoverflow.com/a/23432382
answer count: 3
tagged with: groovy
downvote count: 0
has answer: http://stackoverflow.com/a/22580031
has answer: http://stackoverflow.com/a/22580163
favorite count: 0
possible better answer: http://stackoverflow.com/a/22580163
tagged with: maven
accepted answer: http://stackoverflow.com/a/23432382
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/34555555
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22656414
has text: Unrelated but you don't need to add the modules in the plugin's configuration unless you want to tune the configuration. Those are detected automatically by the plugin. Your pom looks good otherwise, there's no reason it wouldn't work. Can you add some relevant JBoss logs?

http://stackoverflow.com/q/22498951
score: 0
tagged with: java
has title: Error in adding paranetheis in code
has answer: http://stackoverflow.com/a/22501149
downvote count: 1
type: Question
answer count: 2
tagged with: jsp
tagged with: tomcat
has comment: http://stackoverflow.com/comment/34229940
has body: &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="java.sql.*,java.util.*,java.lang.*;"%&gt; &lt;% String abc=request.getParameter("q"); out.println(abc); %&gt; &lt;% public class postg { public void cat(){ int count=0; // TODO Auto-generated method stub try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException cnfe) { // out.println("Could not find the JDBC driver!"); System.exit(1); } // out.println("PostgreSQL JDBC Driver Registered!"); Connection connection = null; try { connection = DriverManager.getConnection("jdbc:postgresql://localhost/test", "postgres","manafara"); connection.setAutoCommit(false); Statement st1=connection.createStatement(); ResultSet rs1=st1.executeQuery("Select COUNT(*) AS TOTAL from groc1"); int n=0; while(rs1.next()) { n=rs1.getInt("TOTAL"); } // out.println("Count: " +n); rs1.close(); Double db[][]=new Double[n][2]; Statement st=connection.createStatement(); ResultSet rs=st.executeQuery("Select * from groc1 "); for(int a=0; rs.next(); a++) { db[a][0]=(double)rs.getInt(4); db[a][1]=rs.getDouble(6); } // out.println("data fetched: "); // out.print(" \t cost quantity \n"); for(int i=0;i&lt;n;i++) { // out.print(i+"\t"); for(int j=0;j&lt;2;j++) { // out.print(db[i][j]+"\t"); } // out.println(); } // out.println(); Double inf=Double.POSITIVE_INFINITY; Double[][] dist=new Double[n][n];//precomputed distance betn i and j int[] davg=new int[n];//array of index of closest clusters for each i int store[][]=new int[n][n]; for(int i=0;i&lt;n;i++) { for(int j=0;j&lt;n;j++) { if(i==j) { dist[i][j]=inf; } else dist[i][j]= distance(db[i],db[j]); if(dist[i][j]&lt;dist[i][davg[i]]) davg[i]=j;//store closest pairs index } } // out.println("initial dist matrix"); for(int i=0;i&lt;n;i++) { // out.print(i+":\t"); for(int j=0;j&lt;=i;j++) { // out.print((dist[i][j])+""); if(dist[i][j]!=inf) // out.print("\t"); } // out.println(); } // out.print("\t"); for(int i=0;i&lt;n;i++) { // out.p…
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22499084
linked to: http://stackoverflow.com/q/2226218

http://stackoverflow.com/comment/34321712
has text: Okay. So we have a Map which pools up all the messages received by the client. And we constantly check (till a timeout) if this message has been sent. Yes, this was my first attempt actually. But the "keys" are not unique. Hence what I could do is, constantly check if the `size of the Map` has increased and once it increases I get the last message which was added and then compare. Is this a right way of approach ?
comment on: http://stackoverflow.com/a/22542628
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34244643
comment on: http://stackoverflow.com/a/22504558
has text: `^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])` this RegEx will do the job. this accepts dd/MM/yyyy with leap years, Valid years : from 1600 to 9999
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/22604114
score: 1
answers question: http://stackoverflow.com/q/22604019
downvote count: 0
has body: i think it would be easier if you just put the logout login inside servlet instead of an jsp. And don't forget to do a session.invalidate() EDIT (further detail): something like this : package com.my.package; public class LogoutServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("Cache-Control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); request.getSession().invalidate(); response.sendRedirect(request.getContextPath() + "/login.jsp"); } } In your servlet.xml (you could also do it with an annotation) configure it like this: logoutServlet com.my.package.LogoutServlet logoutServlet /logout And then finally your link goes to: Logout
has comment: http://stackoverflow.com/comment/34416320
type: Answer
has comment: http://stackoverflow.com/comment/34503130
has comment: http://stackoverflow.com/comment/34416748
upvote count: 1
has comment: http://stackoverflow.com/comment/34416717
has comment: http://stackoverflow.com/comment/34416523

http://stackoverflow.com/comment/34372769
type: Comment
comment on: http://stackoverflow.com/a/22573350
type: AnswerComment
has text: can execute that on the debugger?
score: 0

http://stackoverflow.com/q/22569516
has comment: http://stackoverflow.com/comment/34354814
favorite count: 0
accepted answer: http://stackoverflow.com/a/22569935
upvote count: 2
tagged with: sockets
has comment: http://stackoverflow.com/comment/34355097
tagged with: python
score: 2
type: AnsweredQuestion
tagged with: java
has body: I'm trying to read the data from Python server using TCP socket. For this, client in python is already written and I'm supposed to write Android code for this. I've tried different approaches in JAVA, but I'm seeing that Socket reading in JAVA code that I've written is very slow. I am overwriting buffer in some cases as I am only concerned with number of bytes that I am receiving not the actual data. Following is the snippet of socket reading in Python client buffer_len = 0 print str(tcp.response_len) + " start " + str((time.time()-timeOrigin)*1000) while True: buffer_len += len(self.sock.recv(4096)) print str(buffer_len) + " of " + str(tcp.response_len) if buffer_len &gt;= tcp.response_len: break Following are the couple of things that I have tried in JAVA : while (totalRead &lt; RS.getResponse_len()) { //dataInputStream is of type DataInputStream int bytesRead = dataInputStream.read(buffer, totalRead, RS.getResponse_len() - totalRead); Log.d("Response", "Total read : " + totalRead + " of " + RS.getResponse_len()); if (bytesRead &lt; 0) { throw new IOException("Data stream ended prematurely"); } totalRead += bytesRead; } With small buffer size : while (totalRead &lt; RS.getResponse_len()) { int bytesRead = dataInputStream.read(buffer, 0, 4096); Log.d("Response", "Total read : " + totalRead + " of " + RS.getResponse_len()); if (bytesRead &lt; 0) { throw new IOException("Data stream ended prematurely"); } totalRead += bytesRead; } I also tried using readFully instead of read too but reading was still slow. Then I tried reading data using ReadableByteChannel as follows : ByteBuffer lenBuf = ByteBuffer.allocate(4096); //SocketChannel.open(); ReadableByteChannel channel = Channels.newChannel(client.socket.getInputStream()); int bytesRead = 0; while (totalRead &lt; RS.getResponse_len()) { bytesRead = channel.read(lenBuf); lenBuf.clear(); Log.d("Response", "Total read : " + totalRead + " of " + RS.getResponse_len()); totalRead += bytesRead; } But I am not seeing any signi…
has comment: http://stackoverflow.com/comment/34355945
type: Question
has title: Reading from JAVA socket slower than Python
has answer: http://stackoverflow.com/a/22569935
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34354635
tagged with: android

http://stackoverflow.com/q/22622085
upvote count: 1
has body: I have a uni project that is intended to log sales and, based on a set of pre established rules, determine which of them are eligible for four kinds of aditionals: two bonuses (specific product and sales by salesman) and two prizes (product campaign and best salesman). It is written using Java (Spring Framework), and uses Hibernate to communicate with a MySql database and JSP for the presentation layer. While testing it I found that something to the sales bonus is not working properly. Even though the calculation is performed successfully and the results stored in the database, when trying to retrieve them I get a null value. For instance, when performing the calculation the result shown in the jsp is From | To | Salesman | Bonus | Prizes | Sales | Product | Best salesman | Campaign --------------------------------------------------------------------------------- 01/01/2013 22/11/2013 Salesman 1 No No No No 01/01/2013 22/11/2013 Salesman 2 Yes Yes No Yes 01/01/2013 22/11/2013 Salesman 3 Yes Yes No No 01/01/2013 22/11/2013 Salesman 4 No No No No but after refreshing it, which involves getting the results from the database, it only shows From | To | Salesman | Bonus | Prizes | Sales | Product | Best salesman | Campaign --------------------------------------------------------------------------------- 01/01/2013 22/11/2013 Salesman 2 Yes Yes No Yes 01/01/2013 22/11/2013 Salesman 3 No Yes No No And if I check the SalesBonus table via PHPMyAdmin I get id dateCreation dateFrom dateTo total units salesman_id --------------------------------------------------------------------- 1 2014-02-05 2013-01-01 2013-11-22 200 1 2 4 2014-02-05 2013-01-01 2013-11-22 200 3 3 Futhermore, if I run using Debug, the variables tree shows AllBonuses ArrayList&lt;E&gt; (id=491) elementData Object[3] (id=502) [0] Aditional (id=503) productCampaignRegistry Prize (id=506) ProductBonus PersistentBag (id=507) salesBonusRegistry SalesBonus (id=508) dateCreation Timestamp (id=509) dateFrom Timestamp (…
tagged with: spring
has answer: http://stackoverflow.com/a/22817182
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22817182
has title: Hibernate retrieves only first record from database, rest is null
has comment: http://stackoverflow.com/comment/34448944
favorite count: 0

http://stackoverflow.com/q/22570592
tagged with: java
has title: Using swing with libgdx and porting to android
type: Question
upvote count: 0
answer count: 1
favorite count: 0
has body: I am looking for ways to avoid remaking my game using android SDK. So I was wondering if it is possible to use libgdx to edit an android app that uses swing. Then port to android?
tagged with: android
score: -1
type: UnansweredQuestion
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/22571436
tagged with: android-layout
tagged with: libgdx

http://stackoverflow.com/q/22559632
type: Question
has answer: http://stackoverflow.com/a/22560405
tagged with: c#
type: AnsweredQuestion
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/22560405
possible better answer: http://stackoverflow.com/a/22560410
score: 0
has body: As I have a web form I need to fill in repeatedly, can I construct a Java or C# program to populate the form automatically? For example below is a sample contact us form, I wish that when I click on the Java or C# program, the form could be filled in automatically. How to achieve this?
has answer: http://stackoverflow.com/a/22560410
has title: How to populate the fields in browser using Java or C#

http://stackoverflow.com/a/25254018
upvote count: 1
has body: You need to add it to your application class, like so: @Application("/") public class MyApplication extends ResourceConfig { public MyApplication() { super(YourResourceOrResources.class, CsrfProtectionFilter.class); } }
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22578595
type: Answer

http://stackoverflow.com/comment/34360325
score: 0
has text: It would be possible to make lambdas work on Java 7 VMs, but the official compiler does not do that.
type: QuestionComment
comment on: http://stackoverflow.com/q/22572230
type: Comment

http://stackoverflow.com/comment/34479906
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22639332
has text: No it is not possible without replacing the progress manager which is not practical.
score: 1

http://stackoverflow.com/comment/34452008
type: AnswerComment
has text: Please, please, do NOT use a `double` to store an amount of money. MadProgrammer, you should know better than this!
type: Comment
comment on: http://stackoverflow.com/a/22623476
score: 0

http://stackoverflow.com/a/22595351
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22595284
type: Answer
answers question: http://stackoverflow.com/q/22595284
has body: It is defined in Thread class - java.lang.Thread.isInterrupted() To use this HotThread ht = new HotThread(); Thread t = new Thread(ht); use t.isInterrupted()

http://stackoverflow.com/comment/34383011
type: Comment
has text: @volley I can assure you, no modification was done to this class. I generate the hashCode() AFTER all modifications are done.
comment on: http://stackoverflow.com/a/22585196
type: AnswerComment
score: 0

http://stackoverflow.com/q/22610157
tagged with: jbutton
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22610226
tagged with: java
has answer: http://stackoverflow.com/a/22610262
has title: How do I get input from buttons I created using a loop?
type: Question
tagged with: actionlistener
possible better answer: http://stackoverflow.com/a/22610262
has body: I'm trying to make a simple calculator in Java using Swing, and I've created my buttons the following way: //Our number keypad public static JPanel numbers(){ //our panel to return JPanel panel = new JPanel(); //Create and add 3x4 grid layout to panel GridLayout gl = new GridLayout(3, 4); panel.setLayout(gl); //For creating and adding buttons to panel for(int i = 0; i &lt; 10; i++){ //Create a new button where the name is the value of i String name = "" + i + ""; JButton button = new JButton(name); //add action listener button.addActionListener(handler); //Add button to panel panel.add(button); } return panel; } My question is how do I reference each specific button in my event handler? I can't think of a way to do this without having to manually create each button rather than using a loop. Thanks.
score: 0
has answer: http://stackoverflow.com/a/22610226
has answer: http://stackoverflow.com/a/22610254
has answer: http://stackoverflow.com/a/22610342
tagged with: swing
answer count: 4

http://stackoverflow.com/q/22628541
type: Question
has answer: http://stackoverflow.com/a/22628593
tagged with: java
possible better answer: http://stackoverflow.com/a/22628849
tagged with: class
has answer: http://stackoverflow.com/a/22628849
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34460432
accepted answer: http://stackoverflow.com/a/22628593
has comment: http://stackoverflow.com/comment/34460175
tagged with: compare
has comment: http://stackoverflow.com/comment/34460474
tagged with: generics
has title: What is Difference Comparing Class Types in Java
has body: public &lt;T, V&gt; void F1(T p1, V p2) { //Method 1 if (p1.getClass() == p2.getClass()) { } //Method 2 if (p1.getClass().equals(p2.getClass())) { } //Method 3 if (p1.getClass().getName().equals(p2.getClass().getName())) { } } I want to compare the parameter's class, Which method is more secure or is there any little bit difference in 3 usage?
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/34460280
has comment: http://stackoverflow.com/comment/34460461
has comment: http://stackoverflow.com/comment/34460413
has comment: http://stackoverflow.com/comment/34460364

http://stackoverflow.com/a/22567010
has comment: http://stackoverflow.com/comment/34349609
has comment: http://stackoverflow.com/comment/34349503
type: Answer
answers question: http://stackoverflow.com/q/22566891
has body: You're trying to get a bean of type SplitterDAO but you haven't defined any of that class. All I see in the splitter is core.SplitterImpl. Try creating a bean that is of type core.SplitterImpl.
score: 0

http://stackoverflow.com/comment/34353154
has text: Recommended link(http://balusc.blogspot.in/2008/07/dao-tutorial-data-layer.html?m=1)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22568529

http://stackoverflow.com/comment/94812067
type: Comment
has text: So, if you would use buffered stream on the file, then I wouldn't see the same issue since the buffered stream would already have buffered it (under the hood) before I start reading, right?
type: AnswerComment
comment on: http://stackoverflow.com/a/22630702
score: 0

http://stackoverflow.com/a/25358674
answers question: http://stackoverflow.com/q/22628255
has body: SIMON is as simple to use as RMI, but with fewer traps in the initial setup. It also has some advantages over RMI. Here is a simple hello-world example: http://dev.root1.de/projects/simon/wiki/Sample_helloworld110
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/22618961
has comment: http://stackoverflow.com/comment/34444608
score: 0
has comment: http://stackoverflow.com/comment/34443504
has body: The Graphics object received in paintComponent should not be stored. Instead, call all the painting code from within paintComponent, and pass the Graphic2D object to the other painting functions, like you did for drawGraph. public void paintComponent(Graphics g) { super.paintComponent(g); //gra2 = (Graphics2D)g; gra2 = (Graphics2D)g.create(); gra2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); drawGraph(gra2, graphPoints); } public void drawGraph(Graphics2D g, List&lt;Point&gt; graphPoints) { g.setColor(lineColor); .... ....
answers question: http://stackoverflow.com/q/22618549
type: Answer
has comment: http://stackoverflow.com/comment/34445053

http://stackoverflow.com/comment/131295862
type: AnswerComment
has text: Krishna M the demo in your link shows only the first occurrence of label is selected
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22507859

http://stackoverflow.com/comment/34378162
type: AnswerComment
type: Comment
has text: I tried both setPreferredSize and setMinimumSize for the JTextArea. I also neglected to mention that I am using the Swing (GUI) Designer to change the properties. I don't know if that's significant. But, after changing the values, I still get one long string of text posted to my database.
comment on: http://stackoverflow.com/a/22581960
score: 0

http://stackoverflow.com/a/22545874
has comment: http://stackoverflow.com/comment/34317128
has comment: http://stackoverflow.com/comment/34314310
answers question: http://stackoverflow.com/q/22545566
has comment: http://stackoverflow.com/comment/34313241
score: 2
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34315032
has body: You call setVisible() before your JFrame is finished being set up, try calling setVisible() when your JFrame is finished being set up completely. setVisible() will call a repaint, and repaint will paint anything that's already been added and is currently visible (which for you at the point you call it nothing but the JFrame itself). Resizing the frame causes another repaint event to be queued, which by then more visible components have been added to and will now be painted.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22545566

http://stackoverflow.com/comment/34284153
type: Comment
has text: Thanks for your reply. But I have added that in my Web.xml and even tried using a servlet interceptor for adding header parameter for all responces with response.setHeader("Access-Control-Allow-Origin","*"). But it is not working.
type: AnswerComment
score: 15
comment on: http://stackoverflow.com/a/22528050

http://stackoverflow.com/q/22523999
tagged with: java
tagged with: loops
type: Question
has body: I've been struggling with this for loop pattern in Java(with spaces on both sides) 0 000 00000 0000000 00000 000 0 Heres what I have been doing: for (int i = 1; i &lt;= 5; i++) { for (int s = 5; s &gt; i; s--) { System.out.print(" "); } for (int j = 1; j &lt; i; j++) { System.out.print("0"); } for (int j = 1; j &lt; i; j++) { System.out.print("0"); } System.out.println(""); } for (int i = 1; i &lt;= 5; i++) { for (int s = 1; s &lt; i; s++) { System.out.print(" "); } for (int j = 5; j &gt; i; j--) { System.out.print("0"); } for (int j = 5; j &gt; i; j--) { System.out.print("0"); } System.out.println(""); } As you can probably tell, I've been able to figure out how to print this pattern using an odd number of 0's in each row, but I can't for the life of me figure out how to do it with odd numbers. Thanks.
has answer: http://stackoverflow.com/a/22524182
has answer: http://stackoverflow.com/a/22524214
has comment: http://stackoverflow.com/comment/34274235
score: 0
has answer: http://stackoverflow.com/a/22524145
tagged with: nested
has answer: http://stackoverflow.com/a/22524285
has title: Nested For Loop Pattern
answer count: 4
has comment: http://stackoverflow.com/comment/34274172
type: UnansweredQuestion

http://stackoverflow.com/comment/34287758
type: Comment
comment on: http://stackoverflow.com/a/22504565
type: AnswerComment
has text: I don't know why that wouldn't work; can you edit your question to show a complete example?
score: 0

http://stackoverflow.com/comment/34262801
type: QuestionComment
has text: What would the JSP page do? Wouldn't it look exactly like the HTML page, since I am not putting in Java code into it?
comment on: http://stackoverflow.com/q/22517659
score: 0
type: Comment

http://stackoverflow.com/a/22582954
answers question: http://stackoverflow.com/q/22554605
score: 0
has body: It looks like you've got a script for the Java Card simulator (as the AID in the first part shows Sun Microsystems - now Oracle - to be used for the card loader). Your actual Java Card probably uses the Global Platform standard for loading applets. You need to send the contents of the .cap files after authentication to the GP Card Manager. There is a Global Platform implementation for Java available from Source Forge, and the standard is freely available (after registration). Before uploading, please check if at least the mayor and minor version numbers of your Card implementation is correct. Be sure to compile against the correct version. Ask your vendor for the Java Card and GP version to use. A set of keys to authenticate to the card manager may be in order as well.
type: Answer
has comment: http://stackoverflow.com/comment/34665764

http://stackoverflow.com/comment/34530374
has text: @GloryOfSuccess Some patience, maybe he's just not here every day ;-) In doubt, if the problem persists, you might consider sending an e-mail after a few days...
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22617919

http://stackoverflow.com/q/22598438
tagged with: filter
accepted answer: http://stackoverflow.com/a/22598794
linked to: http://stackoverflow.com/q/22586233
has comment: http://stackoverflow.com/comment/34410269
has title: Java: Printing Arraylist to Output File?
has body: EDIT: To test these cases, change sort and filter methods to the following: EXAMPLE SORT METHOD: public void sortTitle() { Collections.sort(songs2, SongComparator.byTitle()); // now we have a sorted list } EXAMPLE FILTER METHOD (FOR STRING INPUT): public void filterTitle(String s) { int n = 0; if (n == 0) { n++; for (Song song1 : songs2) { if ((!(((song1.title).contains(s))))) { itemsToRemove.add(song1); } } songs2.removeAll(itemsToRemove); itemsToRemove.clear(); } } EXAMPLE FILTER METHOD (FOR INT INPUT): public void filterRank(Range r) { int n = 0; if (n == 0) { n++; for (Song song1 : songs2) { if (song1.rank &gt; (r.getMax()) || (song1.rank) &lt; (r.getMin())) { itemsToRemove.add(song1); } } songs2.removeAll(itemsToRemove); itemsToRemove.clear(); } } TEST CASES: Input strings should be like the following examples: sort:title This input runs successfully until the line System.setOut(out); in the main class, where it begins to print spaces and does not successfully print the collection. This may be because of a problem with the toString method in the SongCollection class. artist:Paramore or title:Misery Business This input runs successfully through the entire program (the program does not terminate because the while loop does not terminate), except instead of printing the collection, a blank space is printed. ADDITIONAL DETAILS: This question is a followup to a previous question I asked, since I have short time constraints on this project (it is due tomorrow). The primary problem I am experiencing with this is that the program is failing to output correctly, even though the methods and code in the main for printing seems logically sound. Printing arraylist into output file? For some reason, it takes an extraordinary amount of time for the ArrayLists to be printed to the output file, usually 20-30 minutes. However, this only happens with the sort methods or the filterTitle or filterArtist methods (methods that concern String inputs). When I run filterRank or filterYe…
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22598794
tagged with: sorting
has comment: http://stackoverflow.com/comment/34406757
favorite count: 0
tagged with: arraylist

http://stackoverflow.com/a/77010186
score: 0
answers question: http://stackoverflow.com/q/22526676
type: Answer
has body: There is an active question how to reconfigure Eclipse for spaces at How do I change Eclipse to use spaces instead of tabs?. This is very tedious. I also encountered this issue at a project. I did not want to deal with huge IDE setup. Editorconfig is a solution Install editor config Eclipse plugin Create an .editorconfig with following content: root = true [*] indent_style = space indent_size = 4 insert_final_newline = true charset = utf-8 You can do even more as changing the line ending style to LF using end_of_line = lf This way, also users of IntelliJ and VS.Code can have the same configuration when editing the files.

http://stackoverflow.com/q/22497324
tagged with: android
upvote count: 0
has body: I want to create an clickable listview where the data in the listview is retrieved from the database in assets folder. The code below is what I had tried, but each of the item now has the same content. String[] from = new String[] {"shopName"}; int[] to = new int[] { R.id.TextView1}; dbhelper = new DataBaseHelper(this); try { dbhelper.createDataBase(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Cursor cs = dbhelper.getShopData(); @SuppressWarnings("deprecation") SimpleCursorAdapter adapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.list, cs, from, to); ListView list = (ListView) findViewById(R.id.ListView1); list.setAdapter(adapter); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent objIndent = new Intent(getApplicationContext(), Cityinfo.class); objIndent.putExtra("_id", id); startActivity(objIndent); } });
tagged with: java
type: Question
has title: onClick ListView item on database
has comment: http://stackoverflow.com/comment/34417986
tagged with: database
score: -1
has answer: http://stackoverflow.com/a/22497440
has answer: http://stackoverflow.com/a/22497596
answer count: 2
has comment: http://stackoverflow.com/comment/34227491
has comment: http://stackoverflow.com/comment/34417907
tagged with: sqlite
downvote count: 1
has comment: http://stackoverflow.com/comment/34229402
has comment: http://stackoverflow.com/comment/34229268
favorite count: 0
has comment: http://stackoverflow.com/comment/34228174
type: UnansweredQuestion

http://stackoverflow.com/a/22711203
type: AcceptedAnswer
type: Answer
has body: Trouble was in wrong annotation imports. You need to use annotation which are from javax.faces.bean package.
answers question: http://stackoverflow.com/q/22490744
score: 0
accepted answer of: http://stackoverflow.com/q/22490744

http://stackoverflow.com/a/22617974
has comment: http://stackoverflow.com/comment/34441879
has body: You need to extend ListFramgent. setListAdapter is a method of ListFragment. No need to use runOnUiThread. onPostExecute is invoked on the ui thread. Edit: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_schedule, container, false); subjectList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); myListView = (ListView) rootView.findViewById(R.id.textViewMatrix); new LoadAllSubject().execute(); myListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { String matrix_id = ((TextView) view.findViewById(R.id.textViewMatrix)).getText() .toString(); // Starting new intent Intent in = new Intent(getActivity().getApplicationContext(), SingleSubject.class); // sending matrix id to next activity in.putExtra(TAG_MATRIX_ID, matrix_id); // starting new activity and expecting some response back startActivityForResult(in, 100); } }); return rootView; } Then protected void onPostExecute(String file_url) { super.onPostExecute(file_url); pDialog.dismiss(); ListAdapter adapter = new SimpleAdapter( getActivity(), subjectList, R.layout.all_subject, new String[] { TAG_MATRIX_ID, TAG_NAME}, new int[] { R.id.matrix_id, R.id.name }); myListView.setAdapter(adapter); }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22617933
has comment: http://stackoverflow.com/comment/34441579
has comment: http://stackoverflow.com/comment/34443439
accepted answer of: http://stackoverflow.com/q/22617933
has comment: http://stackoverflow.com/comment/34443327
has comment: http://stackoverflow.com/comment/34442829
has comment: http://stackoverflow.com/comment/34443272
has comment: http://stackoverflow.com/comment/34442098
has comment: http://stackoverflow.com/comment/35407906
has comment: http://stackoverflow.com/comment/34443000
has comment: http://stackoverflow.com/comment/34441615
has comment: http://stackoverflow.com/comment/34442647
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34441931
has comment: http://stackoverflow.com/comment/34442285
has comment: http://stackoverflow.com/comment/34442596
type: Answer

http://stackoverflow.com/comment/34448422
comment on: http://stackoverflow.com/q/22600013
score: 0
has text: Thank you for your reply. Same problem with SDN 3.0.1 but different error message: AnnotationConfigUtils.processCommonDefinitionAnnotations(…) is not public! Make sure you're using Spring 3.2.5 or better. The class was loaded from %s.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22629744
tagged with: apache-karaf
tagged with: karaf
downvote count: 0
has body: Is there a way to add a secured Nexus repository as feature repository to Apache Karaf? I tried to run the command: karaf@root()&gt; feature:repo-add http://&lt;user&gt;:&lt;password&gt;@&lt;my-repository&gt; But I get the following error: Adding feature url http://&lt;user&gt;:&lt;password&gt;@&lt;my-repository&gt; Error executing command: Server returned HTTP response code: 401 for URL: http://&lt;user&gt;:&lt;password&gt;@&lt;my-repository&gt; I'm using Apache Karaf 3.0.0. Thanks, Mickael
has answer: http://stackoverflow.com/a/44370862
favorite count: 0
upvote count: 2
tagged with: osgi
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22638403
tagged with: java
has title: Using Nexus as feature repository
type: Question
answer count: 2

http://stackoverflow.com/a/22551550
accepted answer of: http://stackoverflow.com/q/22550728
type: Answer
downvote count: 0
score: 1
has body: As far as functionality is concerned, you won't face any challenge if you are querying db for pull / push operations on data but ideally as suggested by 'BwithLove' above one should avoid doing so. The reason for this is clear separation of business logic. While working with servlets one can easily go for MVC (Model, View and Controller) Design Approach which suggest clear separation of logic. Now, what we actually mean by clear separation of logic? Model: Model's basically confine to the bean or pojo clasess. View: View will confine to your UI. Which will display data set by controller. Controller: this is where we are delegating the requests. It will simply get the request and after assumpted logic from the business layer, it will display the result in View. Business Layer will have the DAO which help you to perform push/pull operations as per your need. Following such patterns, simply make easy coding strategy and supports flexibility in terms of future changes in the code. However, its always the developer's choice to leave it or follow it. Hope it helps :)
answers question: http://stackoverflow.com/q/22550728
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/110241196
score: 0
comment on: http://stackoverflow.com/a/39642831
type: Comment
has text: Thank you. Commenting out `.withCredentials(new InstanceProfileCredentialsProvider(false))` on my Client did the trick.
type: AnswerComment

sockets
tags question: http://stackoverflow.com/q/22488434
tags question: http://stackoverflow.com/q/22621309
tags question: http://stackoverflow.com/q/22581722
tags question: http://stackoverflow.com/q/22586030
tags question: http://stackoverflow.com/q/22585025
tags question: http://stackoverflow.com/q/22527333
tags question: http://stackoverflow.com/q/22619323
tags question: http://stackoverflow.com/q/22614543
tags question: http://stackoverflow.com/q/22510832
tags question: http://stackoverflow.com/q/22515654
tags question: http://stackoverflow.com/q/22518933
tags question: http://stackoverflow.com/q/22533289
tags question: http://stackoverflow.com/q/22536626
tags question: http://stackoverflow.com/q/22545421
tags question: http://stackoverflow.com/q/22646567
tags question: http://stackoverflow.com/q/22518572
type: Tag
tags question: http://stackoverflow.com/q/22517141
tags question: http://stackoverflow.com/q/22647034
tags question: http://stackoverflow.com/q/22645809
tags question: http://stackoverflow.com/q/22513882
tags question: http://stackoverflow.com/q/22569516
tags question: http://stackoverflow.com/q/22614750
tags question: http://stackoverflow.com/q/22535684
tags question: http://stackoverflow.com/q/22516261
tags question: http://stackoverflow.com/q/22504144
tags question: http://stackoverflow.com/q/22510629
tags question: http://stackoverflow.com/q/22496393
tags question: http://stackoverflow.com/q/22627788
tags question: http://stackoverflow.com/q/22512424
tags question: http://stackoverflow.com/q/22530484
tags question: http://stackoverflow.com/q/22608162
tags question: http://stackoverflow.com/q/22623929
tags question: http://stackoverflow.com/q/22547451
tags question: http://stackoverflow.com/q/22495044
tag name: sockets
tags question: http://stackoverflow.com/q/22552148
tags question: http://stackoverflow.com/q/22615671
tags question: http://stackoverflow.com/q/22635638
tags question: http://stackoverflow.com/q/22577666
tags question: http://stackoverflow.com/q/22542638
tags question: http://stackoverflow.com/q/22573349
tags question: http://stackoverflow.com/q/22520764
tags question: http://stackoverflow.com/q/22598611
tags question: http://stackoverflow.com/q/22550534
tags question: http://stackoverflow.com/q/22488402
tags question: http://stackoverflow.com/q/22579496
tags question: http://stackoverflow.com/q/22621981
tags question: http://stackoverflow.com/q/22609855
tags question: http://stackoverflow.com/q/22647890

http://stackoverflow.com/q/22491884
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22492039
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34219312
upvote count: 1
has comment: http://stackoverflow.com/comment/34219504
type: Question
has body: Here's the code: Object obj = getUsers(); List&lt;UserDTO&gt; userDTOList = new ArrayList&lt;UserDTO&gt;(); userDTOList = (ArrayList&lt;UserDTO&gt;)obj; for (UserDTO userDTO : userDTOList) { do some stuff with userDTO } The signature of "getUsers()" is as below List&lt;UserDTO&gt; getUsers(); getUsers returns a list of users and if I print the object(The variable obj here) I can see them. The obj is actually a json response as below [{firstName=A,lastName=B,emailAddress=A.B@email.com},{firstName=C,lastName=D,emailAddress=C.D@email.com},{firstName=E,lastName=F,emailAddress=E.F@email.com}] Now the problem I'm facing is: After the casting when I'm iterating over the casted userDTOList I see all the individual userDTOs carry the same data though actually they are different as I can confirm when I print the object. It's like the first user information is getting copied to others. As with the example above, the 3 userDTOs should carry individual user information, but I'm getting say firstName=A for the three DTOs. Any idea how to fix this or what's going wrong here? getUsers/setUsers from another DTO private List&lt;UserDTO&gt; s$user; public List&lt;UserDTO&gt; getUsers() { return s$user; } public void sets$user(List&lt;UserDTO&gt; s$user) { this.s$user = s$user; } UserDTO private String s$firstName; private String s$lastName; private String s$emailAddress; and their getter/setters All the DTOs are getting set from json parsing.
has comment: http://stackoverflow.com/comment/34218572
has comment: http://stackoverflow.com/comment/34221196
has title: Cast Object to List of Custom DTOs in java
tagged with: casting
has comment: http://stackoverflow.com/comment/34218528
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34218423

http://stackoverflow.com/q/22501765
tagged with: https
linked to: http://stackoverflow.com/q/14362245
type: Question
has title: Jetty on Heroku: how to tell in code if https was used
has body: I have some servlets running in Jetty, deployed on Heroku, handling POST requests. Some, but not all, POST requests MUST come over https. Whether or not a request should be forced to be on https depends on the http body of the POST request. I need to figure out, from inside the servlet, whether the incoming request used https (SSL) or not, so that I can send the appropriate response. However, nothing I have tried seems to work. I tried the obvious HttpServletRequest.getProtocol() but that apparently returns the same constant whether the protocol was http or https. I tried HttpServletRequest.isSecure() however that is returning false even though my test request was sent to a url starting with https:// When I call HttpUtils.getRequestURL( HttpServletRequest ).toString(); I get an apparrently reconstructed url that starts with "http://" even though my test request was sent to a url starting with "https://" According to the post "Enforce HTTPS with Embedded Jetty on Heroku" heroku has some load balancers, and I should get the value of the "x-forwarded-proto" header. That header is blank. FYI I am using the default SSL endpoint provided by the heroku api -- I am not using their SSL Endpoint extension, because this url is not being loaded in a browser (so I don't need a custom domain in the url). Can anyone tell me how to tell if HTTPS was used in the incoming request?
answer count: 1
downvote count: 0
tagged with: ssl
has answer: http://stackoverflow.com/a/31171421
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: jetty
has comment: http://stackoverflow.com/comment/76642061
tagged with: heroku
linked to: http://stackoverflow.com/q/11564638
tagged with: java

http://stackoverflow.com/comment/34457086
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22626695
has text: Read up on class variables and instance variables.
type: QuestionComment

http://stackoverflow.com/q/22620664
has comment: http://stackoverflow.com/comment/34492409
score: 8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34491500
tagged with: java
has comment: http://stackoverflow.com/comment/34491032
type: Question
has body: I'm working on migrating a project from java 7 to 8, and have gotten a compilation error in a Mockito "when" case I'm having a hard time tracking down: when(queryRunner.query(any(String.class), any(ResultSetHandler.class), anyVararg())).thenReturn(mockedWordResultList); gives me a compilation error of: java: reference to query is ambiguous both method &lt;T&gt;query(java.lang.String,java.lang.Object,org.apache.commons.dbutils.ResultSetHandler&lt;T&gt;) in org.apache.commons.dbutils.QueryRunner and method &lt;T&gt;query(java.lang.String,org.apache.commons.dbutils.ResultSetHandler&lt;T&gt;,java.lang.Object...) in org.apache.commons.dbutils.QueryRunner match This error happens in build 1.8.0-b128, but doesn't happen in 1.7.0_45. I'm using mockito 1.9.5. What's the correct way to use anyVarArg() argument matching in java 8?
has comment: http://stackoverflow.com/comment/34446920
accepted answer: http://stackoverflow.com/a/23651505
has comment: http://stackoverflow.com/comment/34490965
has title: mockito: How to match varargs in java 8?
tagged with: mockito
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/34492809
has comment: http://stackoverflow.com/comment/34491974
tagged with: java-8
has answer: http://stackoverflow.com/a/23651505

http://stackoverflow.com/a/22632279
has body: You seem to have misunderstood the concept of an actionListener: The Listener listens to your answer, and does nothing else. You have loops in the listener that wait for an correct amount of digits - thats wrong, you need to only handle one input in the listener (and after another click, the listener will be called again). And so, for sure, because you got your loop with only one answer the user entered, you got a non-ending loop. Just handle one input in the action listener, and you'll be fine. Here is an description how to write it: http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html.
upvote count: 1
answers question: http://stackoverflow.com/q/22631993
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/34579768
answers question: http://stackoverflow.com/q/22603331
has body: You need to choose the attribute in your dataset, wich will be responsible for class labels. For example: training.setClass(data.attribute("NameOfAttribute"));
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/34860782
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22621775
has text: If you are using infinispan to distribute them, then you can create an infinispan event `@Listener` and handle new sessions via `@CacheEntryCreated`: http://docs.jboss.org/infinispan/6.0/apidocs/org/infinispan/notifications/Listener.html
type: Comment

http://stackoverflow.com/q/22591499
has body: In Java there used to be a subtle but important difference between abstract classes and interfaces: default implementations. Abstract classes could have them, interfaces could not. Java 8 though introduces default implementations for interfaces, meaning this is no longer the critical difference between an interface and an abstract class. So what is? As best as I can tell, the only remaining difference (besides perhaps some under the hood efficiency stuff) is that abstract classes follow traditional Java single-inheritance, whereas interfaces can have multiple-inheritance (or multiple-implementation if you will). This leads me to another question - How do the new Java 8 interfaces avoid the diamond Problem?
has comment: http://stackoverflow.com/comment/34718421
tagged with: abstract-class
tagged with: diamond-problem
type: AnsweredQuestion
score: 68
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/40700168
type: Question
accepted answer: http://stackoverflow.com/a/22591531
tagged with: interface
possible better answer: http://stackoverflow.com/a/22721577
linked to: http://stackoverflow.com/q/19998454
has comment: http://stackoverflow.com/comment/34393739
has answer: http://stackoverflow.com/a/22721577
tagged with: java-8
has answer: http://stackoverflow.com/a/22591593
has answer: http://stackoverflow.com/a/22591519
upvote count: 68
tagged with: java
has comment: http://stackoverflow.com/comment/34393721
linked to: http://stackoverflow.com/q/1913098
has answer: http://stackoverflow.com/a/22591531
has title: What are the differences between abstract classes and interfaces in Java 8?
answer count: 5

http://stackoverflow.com/comment/34389865
score: 0
type: Comment
has text: Your great. thanks man I got it now. I appreciate you. I appreciate everyones help.
comment on: http://stackoverflow.com/a/22588887
type: AnswerComment

http://stackoverflow.com/q/22554591
answer count: 4
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/12407479
tagged with: java
has title: Identify File Type in Java
tagged with: file
possible better answer: http://stackoverflow.com/a/22801282
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22665643
has body: I want to check that the user uploads only a particular file format (say text files only). I've written a verification mechanism which checks for format after the file name like this filename.txt But, this created a problem when it was accepting other files also (like excel files) which are saved as .txt like myexcelfile.txt is being assumed as a text file even when it is an excel file So, What would be the unique parameter to check for to make sure that the uploaded file is of the required type? Using apache-commons uploader, servlets. ======================EDIT===================== Based on answers below, I've tried FileInputStream my = new FileInputStream(uploadedFile2); InputStream inputStream = new BufferedInputStream(my); String mimeType = URLConnection.guessContentTypeFromStream(inputStream); But is always returning a null value. probe content type is based on filename extension and also there is a bug with this approach, checked that too. I don't prefer to use third party file verifiers, I believe that this problem will have a logical solution.
has answer: http://stackoverflow.com/a/22665753
upvote count: 3
accepted answer: http://stackoverflow.com/a/22663420
has answer: http://stackoverflow.com/a/22801282
has comment: http://stackoverflow.com/comment/34327487
favorite count: 0
has comment: http://stackoverflow.com/comment/34327430
has answer: http://stackoverflow.com/a/22663420

http://stackoverflow.com/a/22609911
type: Answer
has comment: http://stackoverflow.com/comment/34435971
downvote count: 0
score: 23
has comment: http://stackoverflow.com/comment/34427269
has comment: http://stackoverflow.com/comment/34427072
answers question: http://stackoverflow.com/q/22609779
type: AcceptedAnswer
upvote count: 23
accepted answer of: http://stackoverflow.com/q/22609779
has comment: http://stackoverflow.com/comment/34429032
has body: Your idea is correct: The finally block will close the resources even if an unexpected exception ocurred. You are also right that this is irrelevant if such an exception crashes the complete application, but from looking at this code you can't decide if this is the case. There might be other exception handlers, catching that exception, so it is good and correct practice to put the closing logic in a finally block. Note that there still might be a bug hiding: if data.close() throws an exception, result.close() will never get called. Depending on your environment there are various flavours on how to fix the bug. in java 7 ff you can use try-with-resources if you are using Spring, there might be a proper template similar to the JdbcTemplate if nothing of those applies, yes you'll have to do a try/finally inside the finally. Quit ugly. You absolutely should at least extract this into a method as suggested in the comments. conceptually cleaner but rather wordy in java pre 8 is to implement the loan pattern. If you don't happen to work with scala/clojure/haskell developers it might be more confusing then anything else.

http://stackoverflow.com/q/22640246
has body: "time" "id", "parameter", "value" "2014-02-18 18:58:00", "1$SGP", "A", "415.7806091308594" "2014-02-18 18:58:00", "1$SGP", "B", "240.3373565673828" "2014-02-18 18:58:00", "2$SGP", "A", "393.191162109375" "2014-02-18 18:58:00", "2$SGP", "B", "50.10090637207031" "2014-02-18 18:58:00", "3$SGP", "E", "3484841472" "2014-02-18 18:05:01", "1$SGP", "A", "0" "2014-02-18 17:58:01", "1$SGP", "B", "0" "2014-02-18 17:58:01", "2$SGP", "C", "0" "2014-02-18 17:58:01", "2$SGP", "D", "0" "2014-02-18 17:58:01", "2$SGP", "E", "3061691904" "2014-02-18 17:57:01", "3$SGP", "A", "0" "2014-02-18 17:57:02", "3$SGP", "B", "0" Now from say the table Foo having the above data, I need to add up the value of parameter "A" for all the different IDs such that for a particular ID it picks up the value from the last time stamp that came between 18:00:00 and 19:00:00. How to write a single Query for this requirement that is fast considering both time and id field are indexed.
tagged with: java
tagged with: mysql
has title: Trouble forming a single MySql Query to sum values in a Table
has answer: http://stackoverflow.com/a/22640978
tagged with: mysql-5.5
type: AnsweredQuestion
answer count: 1
type: Question
has comment: http://stackoverflow.com/comment/34480904
accepted answer: http://stackoverflow.com/a/22640978
score: 0
has comment: http://stackoverflow.com/comment/34481276

http://stackoverflow.com/comment/34270893
score: 0
type: AnswerComment
type: Comment
has text: SO_TIMEOUT works only for the OIO transport, and Netty does not close a connection or raise any exceptions or alerts because of it.
comment on: http://stackoverflow.com/a/22518674

http://stackoverflow.com/comment/34375222
comment on: http://stackoverflow.com/a/22580845
type: AnswerComment
score: 0
type: Comment
has text: Ok after reading Java Doc. I see that I could use the isEnables function. however it still gives me the same error? should I make a Boolean variable??

http://stackoverflow.com/comment/34460706
has text: Possible duplicate of http://stackoverflow.com/questions/12035688/is-finally-block-really-necessary-for-the-clean-up-code-like-closing-streams
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22609779
type: Comment

http://stackoverflow.com/a/37507396
has body: It doesn't really work in eclipse for me (nor does in netbeans for what i have read), to test if your code actually works well you should do this: (In windows) Open a command prompt ( execute ... "cmd" + Enter ) then compile your class or classes with javac YourClass.java if no errores it will just let you type a new command with no messages and then java YourClass then you can try the Ctrl + z in windows (ctrl + d in linux) which will print the ^Z character and then hit enter. Hope it helped.
type: Answer
answers question: http://stackoverflow.com/q/22597719
score: 0

http://stackoverflow.com/comment/34462183
type: Comment
comment on: http://stackoverflow.com/q/22629431
type: QuestionComment
score: 2
has text: simpler would be to play with DefaultListModel, espacially in the case that there are changes ...., note you have an issue with Concurency in Swing, output from GUI.addToList(request); to Swing method must be wrapped into invokeLater

http://stackoverflow.com/comment/34225843
comment on: http://stackoverflow.com/q/22496343
type: Comment
type: QuestionComment
has text: Yes, by the VID & PID... so what exactly is your question? Do you need a database of VIDs and PIDs? You can find such with a search engine.
score: 0

http://stackoverflow.com/comment/34393291
type: Comment
has text: How do compiler solve to what overloading try to cast
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22591077

http://stackoverflow.com/comment/34406997
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22598447
score: 0
has text: Edited my post to show you what i want the gui to look like

http://stackoverflow.com/comment/34432287
has text: I'm on my phone so I can't read the source but do you do a Jframe revalidate and repaint every time
comment on: http://stackoverflow.com/q/22611747
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34238302
has text: Why not try it and see?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22504212
score: 0

http://stackoverflow.com/comment/34217571
score: 0
has text: The Equals in Ingrediënt class was based only on the names,so it didnt show id=3 since it has the same name. (What do i have to do now, answer coorect or delete the question since it was user fault?)
comment on: http://stackoverflow.com/a/22491029
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/47634004
type: AnswerComment
type: Comment
has text: @JoopEggen thanks. About animated gifs, will take care next time.
comment on: http://stackoverflow.com/a/22605190
score: 0

http://stackoverflow.com/q/22494472
tagged with: applet
has answer: http://stackoverflow.com/a/22494656
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has title: Applet error: access denied ("java.lang.RuntimePermission")
has body: I'm trying to make an Applet, but it doesn't seem to be working. Whenever I open my HTML file, it asks me security questions, but then I get: Error. Click for details. This is what it says: access denied ("java.lang.RuntimePermission" "exitVM.0") Here is my index.html: &lt;html&gt; &lt;head&gt; &lt;body&gt; &lt;applet code = "Odyssey.class" archive = "Odyssey.jar" width = 600 height = 600&gt; &lt;/body&gt; &lt;/head&gt; &lt;/html&gt; Here is my Odyssey.class: public class Odyssey extends Applet { private static final long serialVersionUID = 1L; public static String windowName = "The Odyssey - Alpha 1.0"; public static JFrame window; public static int WIDTH = 600, HEIGHT = 600; public void init() { window = new JFrame(windowName); window.setSize(new Dimension(WIDTH, HEIGHT)); window.setResizable(false); window.setDefaultCloseOperation(3); window.setLocationRelativeTo(null); window.setVisible(true); } public void paint(Graphics g) { g.drawString("Game is in a pop up window!", 20, 20); } } Any reason why this isn't working? If you really need this, I get this in the details: CacheEntry[file:/C:/Users/MYNAME/Desktop/The%20Odyssey/Odyssey.jar]: updateAvailable=false,lastModified=Tue Mar 18 20:11:16 CDT 2014,length=1712 0
answer count: 1

http://stackoverflow.com/a/22599534
has body: You upload a file to your EC2 instance with scp: scp your.jar root@your.ec2:/tmp You run your file with ssh: ssh your.ec2 "java -jar /tmp/your.jar" All that can be easily automated since no passwords are required to execute scp or ssh, you'll just need to exchange certificates. Or did you mean that you wanted to make Java program part of your image?
answers question: http://stackoverflow.com/q/22599183
has comment: http://stackoverflow.com/comment/34436112
has comment: http://stackoverflow.com/comment/34429006
accepted answer of: http://stackoverflow.com/q/22599183
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/22578373
downvote count: 0
has body: Hi I have made a JTextArea but it is not scrolling, can someone please tell me why? JTextArea textArea = new JTextArea(2, 0); textArea.setText("sdsdsd \n dfdfdf \n dsdsdsdsd \n dsdsdsd \n sdsdsdsd"); textArea.setEditable(false); JScrollPane scrollPane = new JScrollPane(textArea); panel.add(textArea); Also, I would like it to auto scroll down, when new content gets added to, show it only shows the last 2 lines automatically, if possible. Thanks.
type: UnansweredQuestion
has title: How to make a JTextArea scrollable in java?
tagged with: jscrollpane
score: 1
favorite count: 0
type: Question
answer count: 2
upvote count: 1
tagged with: swing
tagged with: java
linked to: http://stackoverflow.com/q/6243086
has answer: http://stackoverflow.com/a/22578402
tagged with: jtextarea
has answer: http://stackoverflow.com/a/22578391

http://stackoverflow.com/comment/34452769
comment on: http://stackoverflow.com/a/22624107
type: AnswerComment
has text: So I simply must add placeholder LinkedLists until they need to be used, correct?
score: 0
type: Comment

http://stackoverflow.com/a/29113825
answers question: http://stackoverflow.com/q/22498245
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Yeah, just like a question in my mind: doesn't Java support multiple inheritance? The fact is YES. Java refuse the multiple inheritance from classes, but it does support multiple inheritance from Interface. More exactly, both class and interface are object. "Everything is an Object".
accepted answer of: http://stackoverflow.com/q/22498245
type: Answer

http://stackoverflow.com/q/22591356
accepted answer: http://stackoverflow.com/a/22591521
has comment: http://stackoverflow.com/comment/34393860
type: Question
linked to: http://stackoverflow.com/q/20923888
has comment: http://stackoverflow.com/comment/34393787
downvote count: 0
has comment: http://stackoverflow.com/comment/34393915
score: 3
answer count: 1
has answer: http://stackoverflow.com/a/22591521
favorite count: 0
has body: please help me explain this code behaviour: public class Main { public static void var(Object... x) { System.out.println("Object"); } public static void var(Integer... x) { System.out.println("Integer..."); } public static void main(String... args) { byte i = 0; Integer i2 = 127; var(i, i2); } } code above returns Object... public class Main { public static void var(Object... x) { System.out.println("Object"); } public static void var(int... x) { System.out.println("int..."); } public static void main(String... args) { byte i = 0; Integer i2 = 127; var(i, i2); } } java: reference to var is ambiguous, both method var(java.lang.Object...) in inheritanceTest.Main and method var(int...) in inheritanceTest.Main match I have these questions. Why each code variant Do returns corresponds value What principical differencies between these code snippets. Really I cannot understand this part of jls a lot of time. My colleagues don't know it too.
has title: different varargs priority for primitive and objects
tagged with: overloading
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34393849
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/34418440
has text: thats fine, it says that any `System.out.println()` will go to file named nohup.out
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22601509

http://stackoverflow.com/a/22604959
type: AcceptedAnswer
score: 0
type: Answer
has body: Over time there have been several changes to the way Android deals with AsyncTasks that run concurrently. In very old Android versions (pre-1.6 afaik) multiple AsyncTasks were executed in sequence. That behavior has been changed to run the AsyncTasks in parallel up until Android 2.3. Beginning with Android 3.0 the the Android team decided that people were not careful enough with synchronizing the tasks that run in parallel and switched the default behavior back to sequential execution. Internally the AsyncTask uses an ExecutionService that can be configured to run in sequence (default) or in parallel as required: ImageLoader imageLoader = new ImageLoader( imageView ); imageLoader.executeOnExecutor( AsyncTask.THREAD_POOL_EXECUTOR, "http://url.com/image.png" );
accepted answer of: http://stackoverflow.com/q/22531961
answers question: http://stackoverflow.com/q/22531961

http://stackoverflow.com/q/22583174
score: 0
has comment: http://stackoverflow.com/comment/34380753
tagged with: javafx-2
has title: setText into TextFiend JavaFX with FXML
has answer: http://stackoverflow.com/a/22613879
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34380691
has comment: http://stackoverflow.com/comment/34380779
has comment: http://stackoverflow.com/comment/34382630
tagged with: java
tagged with: scenebuilder
tagged with: javafx
has body: I have that java class. It's initialized in JavaClassContainer. The problem is that it returns that error: java.lang.NullPointerException. A no set the text to the textfield. import gnu.io.CommPortIdentifier; import gnu.io.SerialPort; import gnu.io.SerialPortEvent; import gnu.io.SerialPortEventListener; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStream; import java.util.Enumeration; import javafx.fxml.FXML; import javafx.scene.control.TextField; public class RXTX implements SerialPortEventListener{ @FXML private static TextField carlos; // MORE CODE @FXML private void GetData(String Data) { if(Data.contains("Temperature")){ carlos.setText("Hola"); } } } If I put a System.Out.Println for instance it works. So, The problem is in the setText to the TextField no in GetData class. Ok, I will put also the main controller: public class FXMLDocumentController implements Initializable { @FXML private Label label; @FXML private void handleButtonAction(ActionEvent event) { System.out.println("You clicked me!"); label.setText("Hello World!"); } @Override public void initialize(URL url, ResourceBundle rb) { RXTX main = new RXTX(); main.initialize(); Thread t=new Thread() { public void run() { //the following line will keep this app alive for 1000 seconds, //waiting for events to occur and responding to them (printing incoming messages to console). try {Thread.sleep(1000000);} catch (InterruptedException ie) {} } }; t.start(); System.out.println("Started"); } }
type: Question
linked to: http://stackoverflow.com/q/10464547
answer count: 1
has comment: http://stackoverflow.com/comment/34383587
has comment: http://stackoverflow.com/comment/34380895

http://stackoverflow.com/comment/34480400
score: 0
comment on: http://stackoverflow.com/q/22639286
type: Comment
type: QuestionComment
has text: rs.next checks the next row and valueFound should return true if the credentials exist in database and if they dont exist valueFound should return false.

http://stackoverflow.com/a/22647971
downvote count: 0
answers question: http://stackoverflow.com/q/22647890
score: 1
upvote count: 1
has body: BufferedReader socketIn = new BufferedReader(new InputStreamReader(s.getInputStream())); String str = socketIn.readLine(); while (buttonClicked == false){ int done = 0; String messageType = socketIn.toString(); while(done == 0) { switch(messageType) { case "username": // Type A username = socketIn.toString(); System.out.println("username: " + username); break; case "password": // Type B password = socketIn.toString(); System.out.println("Password: " + password); break; case "Click": buttonClicked = true; break; } You take the .toString() of the stream (socketIn.toString();), you should use str. BufferedReader socketIn = new BufferedReader(new InputStreamReader(s.getInputStream())); String str = socketIn.readLine(); while (buttonClicked == false){ int done = 0; while(done == 0) { switch(str) { case "username": // Type A username = str; System.out.println("username: " + username); break; case "password": // Type B password = str; System.out.println("Password: " + password); break; case "Click": buttonClicked = true; break; } But, anyway i think it's not what you want... i mean when him pass "password", password will be password. Maybe you want BufferedReader socketIn = new BufferedReader(new InputStreamReader(s.getInputStream())); String str = socketIn.readLine(); while (buttonClicked == false){ int done = 0; while(done == 0) { switch(str) { case "username": // Type A username = socketIn.readLine(); System.out.println("username: " + username); break; case "password": // Type B password = socketIn.readLine(); System.out.println("Password: " + password); break; case "Click": buttonClicked = true; break; } To read a new line from input.
type: Answer

http://stackoverflow.com/a/22557516
answers question: http://stackoverflow.com/q/22557414
type: Answer
has comment: http://stackoverflow.com/comment/34332269
has body: Use setArguments() to provide the dataset for the Adapter to the DialogFragmet. In DialogFragment override onViewCreated(), retrieve the ListView, create the Adapter and set it to the ListView
score: 0
has comment: http://stackoverflow.com/comment/34332776

http://stackoverflow.com/q/22490988
upvote count: 1
type: Question
tagged with: sorting
has answer: http://stackoverflow.com/a/22498471
has comment: http://stackoverflow.com/comment/34218130
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34219063
favorite count: 0
has answer: http://stackoverflow.com/a/22501688
has comment: http://stackoverflow.com/comment/34217887
has body: I know this question has been asked But I feel mine is a special case. I still haven't been able to figure this out. So, I need to sort Employee Objects by their Age if they are in departments Information Systems or Account. However, I cannot get the code to just sort Employee's in departments Information Systems or Accoutning, how would I specify just to sort them by age and just print out the rest?. Here is all relevant code: Employee Class: public class Employee { private String name; private int age; private String department; public String getDept(){ return department; }//end dept public void setDept(String dept){ this.department = dept; }//end public String getName(){ return name; }//end name public void setName(String n){ this.name = n; }//end public int getAge(){ return age; }//end age public void setAge(int a){ this.age = a; }//end public String toString(){ return name + " " + age + " " + department; }//end to string public Employee (String n,int age,String dept){ this.name = n; this.age = age; this.department = dept; }//end employee }//end class Department Class: import java.util.*; public class Department implements Comparator&lt;Employee&gt; { @Override public int compare(Employee o1, Employee o2){ return o1.getAge() - o2.getAge(); }//end method }//end departmen Main Method Class: import java.util.*; public class Company { public static void main(String [] args){ PrimeAgeChecker p = new PrimeAgeChecker(); ArrayList&lt;Employee&gt; test = new ArrayList&lt;Employee&gt;(); test.add(new Employee("Counting Guru",55,"Accounting")); test.add(new Employee("Counting Pro",45,"Accounting")); test.add(new Employee("Counting Savvy",40,"Accounting")); test.add(new Employee("Counting Novice",25,"Accounting")); test.add(new Employee("Sales Guru",50,"Marketing")); test.add(new Employee("Sales Pro",48,"Marketing")); test.add(new Employee("Sales Savvy",38,"Marketing")); test.add(new Employee("Hiring Guru",58,"Human Resrouces")); test.add(new Employee("Hiring Pro",47,"Human…
tagged with: list
type: UnansweredQuestion
score: 1
tagged with: java
has title: How to sort certain items in an ArrayList in Java?

http://stackoverflow.com/q/22578861
tagged with: android-emulator
type: Question
has body: my java class consists of following code package com.example.sati; import com.example.sati.R; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { int count; Button add,sub; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); count=0; add=(Button)findViewById(R.id.but); sub=(Button)findViewById(R.id.butone); display=(Button)findViewById(R.id.tvdis); sub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub count++; display.setText("your total is"+count); } }); sub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub count--; display.setText("your total is"+count); } }); } @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; } } and my xml file code is as follows; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" 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:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello_world" android:layout_gravity="center" android:gravity="center" android:id="@+id/tvdis" /&gt; &lt;Button an…
downvote count: 0
has title: The application sati(process com.example.sati)has stopped unexpectedly.Please try again.[force closed]
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22578885
upvote count: 1
tagged with: eclipse

http://stackoverflow.com/a/22606065
answers question: http://stackoverflow.com/q/22605393
upvote count: 1
has body: Problem is in your getView() accessing array elements. String split() does not return empty strings (the limit is 0) and that's why you can get an array with length 1 and an exception trying to access the second element there. Instead of encoding your data in a single string, consider using e.g. Pair&lt;String, String&gt; instead.
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/22536461
tagged with: war
has answer: http://stackoverflow.com/a/22536534
has body: I'm reading through the Java EE 7 Tutorial, and I came to the section Packaging Web Archives. I'm already familiar with the way Java web applications and WARs should be structured, but something caught my eye: A web module has a specific structure. The top-level directory of a web module is the document root of the application. The document root is where XHTML pages, client-side classes and archives, and static web resources, such as images, are stored. What on earth do they mean by "client-side classes"? If you put a .class file outside of WEB-INF, obviously you can download it using a web browser or other HTTP client. I suppose you could distribute a small application this way. Would these "client-side classes" have any other use?
tagged with: java
type: Question
has title: Java .class files outside of WEB-INF?
score: 0
has comment: http://stackoverflow.com/comment/34296144
has comment: http://stackoverflow.com/comment/34306592
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34306818

http://stackoverflow.com/comment/34271406
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22522328
has text: "\-" why we need "\"?
type: AnswerComment

jsp
tags question: http://stackoverflow.com/q/22498951
tags question: http://stackoverflow.com/q/22528609
tags question: http://stackoverflow.com/q/22507980
tags question: http://stackoverflow.com/q/22571508
tags question: http://stackoverflow.com/q/22489227
tags question: http://stackoverflow.com/q/22491392
tags question: http://stackoverflow.com/q/22525175
tags question: http://stackoverflow.com/q/22639896
tags question: http://stackoverflow.com/q/22581063
tags question: http://stackoverflow.com/q/22494882
tags question: http://stackoverflow.com/q/22493638
tags question: http://stackoverflow.com/q/22547978
tags question: http://stackoverflow.com/q/22524699
tags question: http://stackoverflow.com/q/22494859
tags question: http://stackoverflow.com/q/22495634
tags question: http://stackoverflow.com/q/22636173
tags question: http://stackoverflow.com/q/22527866
tags question: http://stackoverflow.com/q/22493680
tags question: http://stackoverflow.com/q/22634428
tags question: http://stackoverflow.com/q/22527898
tags question: http://stackoverflow.com/q/22496903
tags question: http://stackoverflow.com/q/22511386
tags question: http://stackoverflow.com/q/22582023
tags question: http://stackoverflow.com/q/22579540
tags question: http://stackoverflow.com/q/22570342
tags question: http://stackoverflow.com/q/22542404
tags question: http://stackoverflow.com/q/22526533
tags question: http://stackoverflow.com/q/22510031
tags question: http://stackoverflow.com/q/22554693
tags question: http://stackoverflow.com/q/22528044
tags question: http://stackoverflow.com/q/22608626
tags question: http://stackoverflow.com/q/22512431
tags question: http://stackoverflow.com/q/22600489
tags question: http://stackoverflow.com/q/22562819
tags question: http://stackoverflow.com/q/22527591
tags question: http://stackoverflow.com/q/22565462
tags question: http://stackoverflow.com/q/22617761
tags question: http://stackoverflow.com/q/22605590
tags question: http://stackoverflow.com/q/22646917
tags question: http://stackoverflow.com/q/22518220
tags question: http://stackoverflow.com/q/22523545
tags question: http://stackoverflow.com/q/22627515
tags question: http://stackoverflow.com/q/22619417
tags question: http://stackoverflow.com/q/22582794
tags question: http://stackoverflow.com/q/22582237
tags question: http://stackoverflow.com/q/22643281
type: Tag
tags question: http://stackoverflow.com/q/22498553
tags question: http://stackoverflow.com/q/22548222
tags question: http://stackoverflow.com/q/22610608
tags question: http://stackoverflow.com/q/22489486
tags question: http://stackoverflow.com/q/22618211
tags question: http://stackoverflow.com/q/22560343
tags question: http://stackoverflow.com/q/22631462
tags question: http://stackoverflow.com/q/22526848
tags question: http://stackoverflow.com/q/22600067
tags question: http://stackoverflow.com/q/22626845
tags question: http://stackoverflow.com/q/22519276
tags question: http://stackoverflow.com/q/22599435
tags question: http://stackoverflow.com/q/22613748
tags question: http://stackoverflow.com/q/22552490
tags question: http://stackoverflow.com/q/22551415
tags question: http://stackoverflow.com/q/22610338
tags question: http://stackoverflow.com/q/22525617
tags question: http://stackoverflow.com/q/22562411
tag name: jsp
tags question: http://stackoverflow.com/q/22613976
tags question: http://stackoverflow.com/q/22578516
tags question: http://stackoverflow.com/q/22593280
tags question: http://stackoverflow.com/q/22546786
tags question: http://stackoverflow.com/q/22516636
tags question: http://stackoverflow.com/q/22528998
tags question: http://stackoverflow.com/q/22518070
tags question: http://stackoverflow.com/q/22627759
tags question: http://stackoverflow.com/q/22518154
tags question: http://stackoverflow.com/q/22532680
tags question: http://stackoverflow.com/q/22605708
tags question: http://stackoverflow.com/q/22497130
tags question: http://stackoverflow.com/q/22592530
tags question: http://stackoverflow.com/q/22582917

http://stackoverflow.com/comment/34461857
type: QuestionComment
comment on: http://stackoverflow.com/q/22622332
score: 0
has text: Have a look at use of [Ternary operator](http://stackoverflow.com/a/22628588/1686291)
type: Comment

http://stackoverflow.com/comment/34395897
type: Comment
has text: Thanks a lot Simon ... actually , your description is awesome .. I have understood that XML could be regarded as "data description tool" ?? So I could encode any type of data to be in the XML format ?? Is that true ??
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22592168

http://stackoverflow.com/q/22504212
tagged with: try-catch
accepted answer: http://stackoverflow.com/a/22504342
has body: Which exception can i use to check if the input has the right number of "/" The input should be like DD/MM/YYYY try{ String str = text.getText(); StringTokenizer st = new StringTokenizer(str); String DD = st.nextToken("/"); String MM = st.nextToken("/"); String YYYY = st.nextToken(); } catch( ???){ }
has title: Finding Correct exception to catch
score: 0
possible better answer: http://stackoverflow.com/a/22504558
has comment: http://stackoverflow.com/comment/34238302
has answer: http://stackoverflow.com/a/22504558
has answer: http://stackoverflow.com/a/22504327
tagged with: string
has comment: http://stackoverflow.com/comment/34238341
has comment: http://stackoverflow.com/comment/34238353
tagged with: exception
has comment: http://stackoverflow.com/comment/34238343
tagged with: throw
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22504342
tagged with: java
has comment: http://stackoverflow.com/comment/34238361
has answer: http://stackoverflow.com/a/22504493
type: Question

http://stackoverflow.com/q/22578749
type: Question
answer count: 2
downvote count: 0
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/22578904
accepted answer: http://stackoverflow.com/a/22578904
has body: I have several strings in a file where I am supposed to stop and read the values from those strings. For example: This is the first line #1 stop = 300 This is the third line This is the 4th line #2 stop = 400 This is the 6th line I need to stop at #1 and extract the value 300 from there. Then I have to stop at #2 and extract 400, and so on. I am VERY new to Java and can't figure out what is wrong with my code. (I haven't gotten to extracting the values yet): public static void main(String[] args) throws IOException { //read File fromFile = new File("in.txt"); BufferedReader bufferedReader = new BufferedReader(new FileReader(fromFile)); String line; String firstHandler=""; while ((line = bufferedReader.readLine()) != null) { bufferedReader.readLine(); if (firstHandler.startsWith("#1")){ System.out.println(firstHandler); String[] parts = firstHandler.split("="); System.out.println(Arrays.toString(parts)); } break; } System.out.println(line); bufferedReader.close(); } } At this point it only prints the first line, which is not at all what I need. Can anyone explain to me how this should be done in the right way?
favorite count: 0
has comment: http://stackoverflow.com/comment/34370656
has answer: http://stackoverflow.com/a/22578822
tagged with: parsing
tagged with: text
has title: How to read a specific line in a text file and return a part of it?
score: 1
has comment: http://stackoverflow.com/comment/34370682
upvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34370835
possible better answer: http://stackoverflow.com/a/22578822

http://stackoverflow.com/q/22590710
duplicate of: http://stackoverflow.com/q/18848885
type: UnansweredQuestion
has body: How List&lt;?&gt; and List&lt;Object&gt; is not reifiable what is the exact reason for this. I didn't understand the intent behind that. As the java generics is implemented by type erasure but not by dynamic casts etc.. while compilation, what is the reasoning behind the that, It seems to be confusing to me to grasp the exact concept, what compiler will do exactly inside while generating the byte code.
linked to: http://stackoverflow.com/q/18848885
has comment: http://stackoverflow.com/comment/34392429
answer count: 0
has title: java wild card List<?> is reifiable but not List<Object>
tagged with: java
has comment: http://stackoverflow.com/comment/34392515
type: Question
has comment: http://stackoverflow.com/comment/34392614
has comment: http://stackoverflow.com/comment/34392454
has comment: http://stackoverflow.com/comment/34392639
score: 0
upvote count: 1
downvote count: 1
tagged with: generics
favorite count: 0

http://stackoverflow.com/q/22509621
has title: How to set java.time.LocalDate using (the value of) an java.util.Date?
has body: I use the Java 8 DatePicker (and I like it). This Class uses java.time.LocalDate. Persistence on the other hand uses (exclusively in MAR 2014) java.util.Date. LocalDate2Date is involved but doable (see below) but I can't find a way to do Date2LocalDate. .... entityClassFromDatabase.setDate2b(LocalDate2Date(datepicker.getvalue())); .... } private java.util.Date LocalDate2Date(LocalDate localDate) { [validation code omitted] ChronoLocalDateTime cldt = localDate.atStartofDay(); Instant instant = cldt.toInstant(ZoneOffset.from(Instant.now().atZone(ZoneId.systemDefault()))); return Date.from.(instant); } What I need is something like; datepicker.setvalue(Date2LocalDate(entityClassFromDatabase.getDate2b()); I have seen answers that suggest new LocalDate(date); and variants, but these do not work; Latest effort was 'conversion' via java.time.Instant but although the 'instant' used in LocalDate2Date prints out identical to the instant used below: Instant instant = entityClassFromDatabase.getDate2b.toinstant(); LocalDateTime xx = LocalDateTime.from(instant); throws exception below: java.time.DateTimeException: Unable to obtain LocalDateTime from TemporalAccessor: 2014-03-27T23:00:00Z of type java.time.Instant I'm lost
tagged with: java
tagged with: java-time
has comment: http://stackoverflow.com/comment/34259886
score: 2
has answer: http://stackoverflow.com/a/26554290
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22510045
has comment: http://stackoverflow.com/comment/34249990
type: Question
tagged with: datepicker
favorite count: 0
upvote count: 2
answer count: 2
linked to: http://stackoverflow.com/q/21242110
tagged with: java-8

http://stackoverflow.com/q/22572230
favorite count: 0
has answer: http://stackoverflow.com/a/37919842
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/63290505
linked to: http://stackoverflow.com/q/18320587
answer count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22574101
score: 13
has title: Are compiled Java 8 lambda expressions backwards compatible with earlier versions of the Java runtime?
type: Question
tagged with: backwards-compatibility
has comment: http://stackoverflow.com/comment/63290571
upvote count: 13
has body: In order to reduce the clutter caused by numerous instantiations of anonymous types, I'm exploring the possibility of leveraging Java 8 lambdas. One important consideration before using Java 8 and lambdas in a production environment is whether JDK8-compiled code that uses lambda expressions can be executed on an earlier version of the Java runtime. I'm specifically interested in JRE6 and JRE7 as target platforms. One one hand, I understand that lambdas are simply syntactic sugar around an instantiation of an anonymous class containing one method. On the other hand, I'm not certain that this equivalence implies that the bytecode generated for each is identical and/or compatible across JVM versions other than JRE8. For example, given the single-method interface: public interface Action&lt;T&gt; { public void perform(T argument); } The following two snippets are "functionally" equivalent: With lambda: final Action&lt;String&gt; y = i -&gt; System.out.println(i); With anonymous class instance: final Action&lt;String&gt; y = new Action&lt;String&gt;() { @Override public void perform(final String i) { System.out.println(i); } }; My specific question is whether the semantic equivalence of both constructs extends to equivalence of their compiled representations. Furthermore, if they indeed compile equivalently, does this equivalence indicate that the compiled form of a lambda expression can be hosted on earlier versions of the Java runtime without modification?
has answer: http://stackoverflow.com/a/22572293
possible better answer: http://stackoverflow.com/a/22574101
has comment: http://stackoverflow.com/comment/34360325
has answer: http://stackoverflow.com/a/22572270
accepted answer: http://stackoverflow.com/a/22572270

http://stackoverflow.com/a/22619132
has comment: http://stackoverflow.com/comment/34444228
has comment: http://stackoverflow.com/comment/34443673
has comment: http://stackoverflow.com/comment/34443884
type: Answer
has body: if ( !myString.contains( "ANY" ) ) { Add/Store string } Check the string you're getting from the file contains "Any", if so, store it else do nothing.
score: 0
has comment: http://stackoverflow.com/comment/34443735
has comment: http://stackoverflow.com/comment/34444683
answers question: http://stackoverflow.com/q/22618988

http://stackoverflow.com/comment/34390578
score: 2
has text: Do you need each thread to print its own column? There'll be a ton of ugly synchronization you could avoid with a different design, perhaps having 3 threads feed queues that a dedicated output thread polls for numbers to print.
type: QuestionComment
comment on: http://stackoverflow.com/q/22589499
type: Comment

http://stackoverflow.com/comment/34447863
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22621287
has text: Maybe we need a `heck` tag, @HovercraftFullOfEels.

http://stackoverflow.com/comment/34414081
comment on: http://stackoverflow.com/a/22602566
has text: Good answer, I can only however mark this as accepted answer in 1 minute, can you also point me the way on how to have certain margins between each row? like top margin, left margin etc... to have better formatting. I've heard of inserting a invisible row, but how about left and right?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22501246
upvote count: 0
has body: Call wait() method on the thread whenever button is clicked or event happens (whenever you desire) and again call notify() method to resume the thread
type: Answer
has comment: http://stackoverflow.com/comment/34233596
downvote count: 1
answers question: http://stackoverflow.com/q/22501175
has comment: http://stackoverflow.com/comment/34233697
has comment: http://stackoverflow.com/comment/34233878
score: -1

http://stackoverflow.com/a/22625057
answers question: http://stackoverflow.com/q/22624818
score: 0
accepted answer of: http://stackoverflow.com/q/22624818
type: Answer
has body: It sounds to me that you are trying to set something up so that you can make a copy of an Employee and be able to write the properties to a text file. This won't write to a text file but I think it may clear some things up for you. public class Employee { private String firstName; private String lastName; public Employee(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public Employee(Employee copy) { firstName = copy.firstName; lastName = copy.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; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("Employee"); sb.append("{firstName='").append(firstName).append('\''); sb.append(", lastName='").append(lastName).append('\''); sb.append('}'); return sb.toString(); } } TestClass.java public class TestClass { public static void main(String[] args){ //First we have to have one to copy Employee emp = new Employee("Joe", "Dirt"); //Now we have a copy Employee emp2 = new Employee(emp); //Calls the Employee.toString() method and sends it to System.out System.out.println("Employee 1 : " + emp); System.out.println("Copy of Employee 1 : " + emp2); } }
type: AcceptedAnswer

http://stackoverflow.com/a/22567965
has comment: http://stackoverflow.com/comment/34352102
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22567650
has body: There should be 20 C 4 possible groupings which is 4845. It should be possible to generate these combinations quite easily with four nested for loops. int count = 0; for(int i=0;i&lt;17;++i) { for(int j=i+1;j&lt;18;++j) { for(int k=j+1;k&lt;19;++k) { for(int l=k+1;l&lt;20;++l) { System.out.println(""+i+"\t"+j+"\t"+k+"\t"+l); ++count; } } } } System.out.println("Count "+count); You can quickly loop through all of these and use some objective function to workout which is the most optimal grouping. Your problem definition is a little fuzzy so I'm not sure how tell which is the best combination. Thats just the number of way picking four golfers out of 20, you really need 5 group of 4 which I think is 20C4 * 16C4 * 12C4 * 8C4 which is 305,540,235,000. This is still in the realm of exhaustive computation though you might need to wait a few minutes. Another approach might be a probabilistic approach. Just pick the groups at random, rejecting illegal combinations and those which don't meet your criteria. Keep picking random groups until you have found which is good enough.
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/34362170
has text: Note: Uncompilable code snippet != runnable example. For better help sooner, post a [MCTaRE](http://stackoverflow.com/help/mcve) (Minimal **Complete** Tested and Readable Example). Hard code some data to replace the DB.
comment on: http://stackoverflow.com/q/22573696
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34291270
type: QuestionComment
has text: I am using this json-lib-2.2.2-jdk15
comment on: http://stackoverflow.com/q/22533745
score: 0
type: Comment

http://stackoverflow.com/q/22577197
has comment: http://stackoverflow.com/comment/107164027
has answer: http://stackoverflow.com/a/38728166
has title: Java 8 Streams - collect vs reduce
type: Question
has answer: http://stackoverflow.com/a/65084414
has body: When would you use collect() vs reduce()? Does anyone have good, concrete examples of when it's definitely better to go one way or the other? Javadoc mentions that collect() is a mutable reduction. Given that it's a mutable reduction, I assume it requires synchronization (internally) which, in turn, can be detrimental to performance. Presumably reduce() is more readily parallelizable at the cost of having to create a new data structure for return after every step in the reduce. The above statements are guesswork however and I'd love an expert to chime in here.
answer count: 8
has answer: http://stackoverflow.com/a/49303206
has answer: http://stackoverflow.com/a/22577274
has answer: http://stackoverflow.com/a/40015915
favorite count: 0
has answer: http://stackoverflow.com/a/48915631
score: 180
tagged with: java-stream
upvote count: 181
accepted answer: http://stackoverflow.com/a/22577274
has comment: http://stackoverflow.com/comment/34367880
downvote count: 1
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/37579695
has answer: http://stackoverflow.com/a/38513507
possible better answer: http://stackoverflow.com/a/38728166
tagged with: java

http://stackoverflow.com/comment/34268485
score: 0
type: Comment
has text: No, this is incorrect. Casting a double or a float to int always rounds towards zero. So this will product a number from -99 to 100, with 0 twice as likely as the other numbers.
comment on: http://stackoverflow.com/a/22520395
type: AnswerComment

http://stackoverflow.com/q/22529123
tagged with: eclipse
type: Question
has title: Calendar view in android should display 1 week from current date
downvote count: 0
answer count: 1
has body: I am trying to get the CalendarView widget to display only 1 week from current date. I tried using , Date date = new Date(); cal = (CalendarView) findViewById(R.id.calendarView1); cal.setMaxDate(date.getTime()+604800000); cal.setMinDate(date.getTime()); but it doesn't seem to work. Really appreciate if someone could help me out.
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: calendarview
has answer: http://stackoverflow.com/a/22529328
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/34308133
type: AnswerComment
has text: @CommuSoft No, the type-safety warning is provided by the compiler. It's not an IDE-specific feature, and it's warning about a specific problem (the possibility of heap pollution).
type: Comment
comment on: http://stackoverflow.com/a/22542546
score: 0

http://stackoverflow.com/q/22614284
linked to: http://stackoverflow.com/q/2536692
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/22614652
has answer: http://stackoverflow.com/a/22614772
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34435082
has comment: http://stackoverflow.com/comment/34434752
tagged with: concurrency
has title: What to put inside run() method in concurrent classes?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22614652
downvote count: 0
has comment: http://stackoverflow.com/comment/34435224
has comment: http://stackoverflow.com/comment/34434796
upvote count: 1
accepted answer: http://stackoverflow.com/a/22614772
has comment: http://stackoverflow.com/comment/34434815
favorite count: 0
has body: Suppose we have a thread-safe class called Teacher which implements Runnable. A teacher can either read or write to a student's book. public class Teacher implements Runnable { boolean doneWithBook = false; private Lock lock = new ReentrantLock(); private Condition cond = lock.newCondition(); public void readBook(Book book) { lock.lock(); try { book.read(); doneWithBook = false; cond.signalAll(); System.out.println("Teacher read the book"); } finally { lock.unlock(); } } public void writeToBook(Book book) { lock.lock(); try { book.write(); doneWithBook = true; System.out.println("Teacher wrote to book."); } finally { lock.unlock(); } } Teacher implements Runnable, so the task can be ran on its own separate thread. What I don't understand is what to put inside the Runnable's interface run() method. What if I want to read/write to the book. How does run() come into play? Examples are greatly appreciated. @Override public void run() { // now what??? }
has comment: http://stackoverflow.com/comment/34434875

http://stackoverflow.com/comment/34460094
has text: Your naming conventions are confusing..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22628483

http://stackoverflow.com/comment/34380645
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22583859
has text: Yes. Why don't you try it?
type: AnswerComment

http://stackoverflow.com/q/22634535
has comment: http://stackoverflow.com/comment/34472462
tagged with: mysql
answer count: 1
accepted answer: http://stackoverflow.com/a/22635705
has comment: http://stackoverflow.com/comment/34471588
has comment: http://stackoverflow.com/comment/34470608
has comment: http://stackoverflow.com/comment/34471191
has comment: http://stackoverflow.com/comment/34471659
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/54224565
linked to: http://stackoverflow.com/q/17114046
linked to: http://stackoverflow.com/q/5456480
has title: Connection refused when trying to connect to mysql using hibernate
has comment: http://stackoverflow.com/comment/34472868
has answer: http://stackoverflow.com/a/22635705
type: Question
has comment: http://stackoverflow.com/comment/34470537
has body: I am trying to connect to mysql database using hibernate from the cfg file as <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/test root root 10 true org.hibernate.dialect.MySQLDialect update <mapping resource="Employee.hbm.xml" /> </hibernate-configuration> private static SessionFactory factory; public static void main(String[] args) { try { factory = new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { System.err.println("Failed to create sessionFactory object." + ex); ex.fillInStackTrace(); ex.printStackTrace(); throw new ExceptionInInitializerError(ex); } Though my connection-string,username,password are correct and the same are working fine in other project with basic jdbc connection, But when I try it using hibernate I am getting this error on console Exception in thread "main" java.lang.ExceptionInInitializerError at com.hibernate.ManageEmployee.main(ManageEmployee.java:21) Caused by: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml at com.hibernate.ManageEmployee.main(ManageEmployee.java:19) Caused by: org.dom4j.DocumentException: Connection refused: connect Nested exception: Connection refused: connect at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481) at org.hibernate.cfg.Configuration.configure(Configuration.java:1425) at org.hibernate.cfg.Configuration.configure(Configuration.java:1411) at com.hibernate.ManageEmployee.main(ManageEmployee.java:16) And yes the database server is up and running but the connections from this hibernate application are refused
linked to: http://stackoverflow.com/q/4301294
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34470724

http://stackoverflow.com/a/22602121
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22597227
answers question: http://stackoverflow.com/q/22597227
type: Answer
downvote count: 0
has body: In Camel, there is something called Exchange Pattern. A sychronous request, such as the one you describe, is InOut and a one way request is InOnly. Simply setting the payload will have Camel reply back with that payload. Like this: <from uri="jetty:http://0.0.0.0:8888/camelServlet/abc" /> hi
score: 1
upvote count: 1

http://stackoverflow.com/q/22540025
possible better answer: http://stackoverflow.com/a/22540194
tagged with: loops
has answer: http://stackoverflow.com/a/22540318
has title: Should I use an Iterator or a forloop to iterate?
has comment: http://stackoverflow.com/comment/34302665
has answer: http://stackoverflow.com/a/22540205
type: Question
tagged with: iterator
has answer: http://stackoverflow.com/a/22540191
linked to: http://stackoverflow.com/q/1879255
favorite count: 0
accepted answer: http://stackoverflow.com/a/22540191
answer count: 5
has answer: http://stackoverflow.com/a/22540194
has answer: http://stackoverflow.com/a/22540508
tagged with: dictionary
has comment: http://stackoverflow.com/comment/34303505
linked to: http://stackoverflow.com/q/2113216
upvote count: 3
has comment: http://stackoverflow.com/comment/34303063
has body: I don't like the idea of having to call hasNext() and next(), and seeing how I would need a loop to call those anyways, I don't really see much point in using the iterators given to us in Lists and Maps. Is it only if you need to pull one this from the list? Or, if you're taking one item from the list, and having to do that for an unmeasured amount of time? I couldn't find this on Google or Stack, please help me out. I'm not talking about an enhanced for-loop specifically (for-each loop). I also understand that foreach loops excel in performance, but this is more of a 'why does it exist' question EDIT: Realized I was talking about collections alone and not arrays aswel. Foreach loops don't have limitations in this situation.
has comment: http://stackoverflow.com/comment/34304753
downvote count: 1
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34302431
tagged with: list
has comment: http://stackoverflow.com/comment/34302587
linked to: http://stackoverflow.com/q/180158
tagged with: java

http://stackoverflow.com/comment/34419122
comment on: http://stackoverflow.com/q/22567874
score: 0
has text: My apologies about that. That (and several other) of my sites disappeared because the free host gave up hosting a little time ago. For the moment, you can get it from my Google [share drive](https://drive.google.com/folderview?id=0B5B9wDXIGw9lUnJaUjA2cmlVRE0).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34274421
score: 0
type: AnswerComment
has text: i got through it. Any idea of this error sir JSONException: No value for current_observation
comment on: http://stackoverflow.com/a/22524097
type: Comment

http://stackoverflow.com/q/22569050
type: Question
has body: I am rendering points using Java OpenGL to be overlayed ontop of a video stream. I'm stuck trying to make the background of the Java OpenGL canvas window transparent, so only the rendered points are visible when overlayed ontop of the video stream layer? This is the code I'm using to setup the canvas. public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); System.err.println("INIT GL IS: " + gl.getClass().getName()); // Enable VSync gl.setSwapInterval(1); // Setup the drawing area and shading mode gl.glEnable(GL_BLEND); gl.glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl.glShadeModel(GL.GL_SMOOTH); gl.glClearColor(0.0f, 0.4f, 0.0f, 0.0f); } Cheers for any ideas on how to do this. J
answer count: 1
downvote count: 0
has title: Java OpenGL - transparent background to see panel layer beneath?
favorite count: 0
tagged with: jogl
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22569736
accepted answer: http://stackoverflow.com/a/22569736
tagged with: opengl
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34353793

http://stackoverflow.com/comment/34271501
comment on: http://stackoverflow.com/a/22522350
score: 0
type: AnswerComment
type: Comment
has text: This is what was happening: this code is part of an Android snippet where I was trying to implement a checkbox list. the checkbox listener is who changed the value of array1.

http://stackoverflow.com/q/22588379
downvote count: 2
tagged with: collections
has comment: http://stackoverflow.com/comment/34388500
has body: Was type safety the only reason to introduce generics for the java.util.Collection classes, so the addition of heterogeneous elements in a Collection is prevented? Or have there been other reasons too?
has comment: http://stackoverflow.com/comment/34388511
has answer: http://stackoverflow.com/a/22588524
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34388493
has comment: http://stackoverflow.com/comment/34389072
has comment: http://stackoverflow.com/comment/34389223
has title: Why were generics introduced for the Collection classes?
has answer: http://stackoverflow.com/a/22588507
score: -1
answer count: 2
tagged with: generics
linked to: http://stackoverflow.com/q/7815528
has comment: http://stackoverflow.com/comment/34388536
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22511689
answer count: 2
upvote count: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22511840
has comment: http://stackoverflow.com/comment/34251816
type: AnsweredQuestion
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/34251681
type: Question
tagged with: split
possible better answer: http://stackoverflow.com/a/22511840
has answer: http://stackoverflow.com/a/22511749
accepted answer: http://stackoverflow.com/a/22511749
has body: I am using Java programming language and I have problem. String val = "1 - v2"; val = val.split(val,' ')[0]; System.out.println("Value of val is: " + val); Output: &gt;&gt;&gt; Value of val is: I use similar code a few lines further and works there without any problems. Where I make mistakes? // Thx
has title: Java String.split not work
downvote count: 6
has comment: http://stackoverflow.com/comment/34251725
has comment: http://stackoverflow.com/comment/34251623
has comment: http://stackoverflow.com/comment/34251811

iterator
tags question: http://stackoverflow.com/q/22501402
tag name: iterator
tags question: http://stackoverflow.com/q/22577870
tags question: http://stackoverflow.com/q/22556939
tags question: http://stackoverflow.com/q/22624914
tags question: http://stackoverflow.com/q/22579024
tags question: http://stackoverflow.com/q/22574887
tags question: http://stackoverflow.com/q/22602066
tags question: http://stackoverflow.com/q/22540025
tags question: http://stackoverflow.com/q/22644707
tags question: http://stackoverflow.com/q/22627415
tags question: http://stackoverflow.com/q/22577559
type: Tag

http://stackoverflow.com/a/22615229
has body: Well, actually I had reinstalled eclipse several times because of those and other bugs.. But I think I had installed it correctly with the latest plugins... Now, to be sure that I install it definitely correctly, I have completely formatted my computer (reinstall windows 8.1) So, in order to be sure that I do everything absolute correctly, which of the following possible ways to install the whole eclipse setup is better? Install eclipse kepler WITHOUT ADT. Then install all the ADT-plugins and google-plugins, and then install everything necessary from android SDK manager. Install ADT Bundle (comes with eclipse juno atm and is version 22.3). Then install google-plugins and update ADT-plugins from 22.3 to 22.6.1. Then install everything necessary from android SDK manager. I know this shouldn't make a real difference, but I have done that often enough and I still had errors. This time I want to be sure to do it completely right!
type: Answer
answers question: http://stackoverflow.com/q/22598548
score: 0

http://stackoverflow.com/comment/34246687
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22507692
type: Comment
has text: Yes tell me because i m going now.

http://stackoverflow.com/comment/35431310
has text: And how is it going? Did you solve your problem?
score: 0
comment on: http://stackoverflow.com/q/22646179
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34250414
type: Comment
comment on: http://stackoverflow.com/a/22510568
has text: what about if inside the for loop i had this: `if (n%3 == 2) n = 9;`. If n had remainder 2, the code would end really quickly! Doesn't this create huge variance?
type: AnswerComment
score: 0

http://stackoverflow.com/q/22535406
tagged with: google-cloud-endpoints
tagged with: google-app-engine
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22535430
tagged with: java
type: Question
has body: While reading Google's tutorial on Cloud Endpoints for Android, I came across this code where they have passed a variable of type Void to a function. Is this correct? If yes, how does that work? Also, what is the point of passing variables named "unused" to functions if they are not going to be used by those functions? public void onClickListGreetings(View unused) { AsyncTask&lt;Void, Void, HelloGreetingCollection&gt; getAndDisplayGreeting = new AsyncTask&lt;Void, Void, HelloGreetingCollection&gt; () { @Override protected HelloGreetingCollection doInBackground(Void... unused) { // more code As always, thanks so much for helping out!! :)
has title: Is this Java code from a tutorial by Google correct in creating a variable of type Void?
has comment: http://stackoverflow.com/comment/34294416
score: 0
has answer: http://stackoverflow.com/a/22535430
tagged with: android
answer count: 1

http://stackoverflow.com/a/22531816
type: Answer
has body: public boolean add(E e) { ensureCapacityInternal(size + 1); // Increments modCount!! elementData[size++] = e; return true; } This is the source cod of the ArrayList in 7u40-b43. The method ensureCapacityInternal() is not thread safe,and size++ is not either. The size++ is done by three steps,1)get the size,2) size +1,3) write the new value back.
score: 0
answers question: http://stackoverflow.com/q/22528713

http://stackoverflow.com/comment/34391472
score: 0
type: QuestionComment
type: Comment
has text: It could be helpful if you could be more specific on (a) what you tried and (b) what "doesn't work" actually means. (BTW, I always wonder why even people actually working in the IT industry are not able to give a profound problem description. How can you expect this from your users/customers?)
comment on: http://stackoverflow.com/q/22580930

http://stackoverflow.com/q/22501975
has comment: http://stackoverflow.com/comment/34235466
answer count: 0
tagged with: java
type: Question
has title: Error Receiving broadcast Intent notification
has comment: http://stackoverflow.com/comment/34234806
has comment: http://stackoverflow.com/comment/34235607
score: 0
has body: I'm getting this error in log cat when i receive a notification but not always. Seems that sometimes the String i want pass and display in a toast results null but not always. The error is this as from title: java.lang.RuntimeException: Error receiving broadcast Intent { act=it.dd.notification flg=0x10 (has extras) } -- -- Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f04006b -- at it.dd.notification.Main$2.onReceive(Main.java:417) -- i can't post all logCat because i don't have Eclipse here. I remember this parts that are what i need to understand the problem. I declared these first in MainActivity: //private String dir; protected MyReceiver mReceiver = new MyReceiver(); public static String INTENT_ACTION_NOTIFICATION = "it.dd.notification"; private String titoloNoti; private String contenutoNoti; // Always in MainActivity i have this BroadcastReceiver: public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent != null) { Bundle extras = intent.getExtras(); String notificationTitle = extras.getString(Notification.EXTRA_TITLE); CharSequence notificationText = extras.getCharSequence(Notification.EXTRA_TEXT); contenutoNoti = notificationText.toString(); //Line 417 Toast loc = Toast.makeText(getApplicationContext(), contenutoNoti, Toast.LENGTH_SHORT); loc.show(); } } } So when i intercept a notification it crashes. But, i repeat, not always. Sometimes when it wants and it's so frustrating!! Have you any ideas?
tagged with: android-broadcast
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34235361
tagged with: android-intent

http://stackoverflow.com/a/22491146
has comment: http://stackoverflow.com/comment/34216942
accepted answer of: http://stackoverflow.com/q/22491012
answers question: http://stackoverflow.com/q/22491012
score: -1
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/34236263
has body: I don’t think @ModelAttribute is the correct annotation here. For BindingResult to work, you also need @Valid on the form bean.
type: Answer
upvote count: 0

http://stackoverflow.com/q/22629747
has answer: http://stackoverflow.com/a/22629912
linked to: http://stackoverflow.com/q/11093326
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/22629868
linked to: http://stackoverflow.com/q/17874717
downvote count: 0
linked to: http://stackoverflow.com/q/6111003
tagged with: swing
has title: How do i make a check for in the input is a number or not in swing?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34462853
tagged with: numbers
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22629871
accepted answer: http://stackoverflow.com/a/22629871
type: Question
has body: So i was making an application where the user enters an input, and when he clicks the button it executes a command, however the input has to be an integer, so i added a check but even when i enter an integer is gives me an error saying "you can enter numbers only!" heres my code : String itemId = textField1.getText(); String itemAmount = textField2.getText(); int id = Integer.parseInt(itemId); int amount = Integer.parseInt(itemAmount); if (!Double.isNaN(id) || !Double.isNaN(amount)){ JOptionPane.showMessageDialog( null, "You can only enter numbers!" ); even after i enter numbers to the textFields i still cannot pass this test, why and how can i fix this ? thanks.
linked to: http://stackoverflow.com/q/10021579
has comment: http://stackoverflow.com/comment/34462653
possible better answer: http://stackoverflow.com/a/22629861
upvote count: 1
tagged with: input
has answer: http://stackoverflow.com/a/22629861

http://stackoverflow.com/q/22520496
possible better answer: http://stackoverflow.com/a/77462540
accepted answer: http://stackoverflow.com/a/22520819
has answer: http://stackoverflow.com/a/77462540
favorite count: 0
score: 8
upvote count: 8
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has title: How do I inject a custom version of WebDataBinder into Spring 3 MVC?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22520819
downvote count: 0
has body: I wrote a custom implementation of the WebDataBinder. In the future I'd like to enhance it so that it looks for an annotation on the class itself and figures out if it should be binding data to it or not. How do I get this class injected into the Spring context in place of the WebDataBinder? What I want is that if I run this code, my version of the WebDataBinder gets injected instead of the default Spring one. @Controller public class MyFormController { @InitBinder public void initBinder(WebDataBinder binder) { // ... } // ... } My custom implementation of the WebDataBinder. It lets me exclude data binding by class instead of by method names. package com.companyname.spring; import org.springframework.beans.MutablePropertyValues; import org.springframework.util.StringUtils; import org.springframework.web.bind.WebDataBinder; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class CustomDataBinder extends WebDataBinder { List&lt;Class&gt; disallowedClasses = new ArrayList&lt;&gt;(); public CustomDataBinder(Object target) { super(target); } public CustomDataBinder(Object target, String objectName) { super(target, objectName); } public CustomDataBinder disallowClass(Class... classes) { Collections.addAll(disallowedClasses, classes); return this; } @Override protected void doBind(MutablePropertyValues mpvs) { if(disallowedClasses.contains(getTarget().getClass())) { if (logger.isDebugEnabled()) { logger.debug("DataBinder will not bind class [" + getTarget().getClass().getSimpleName() + "] because it appears in the list of disallowed classes [" + StringUtils.collectionToCommaDelimitedString(disallowedClasses) + "]"); } } else { super.doBind(mpvs); } } } EDIT1 First pass, having trouble with the AsyncSupportConfigurer @Configuration @ComponentScan(basePackageClasses = RootContextConfig.class) @EnableTransactionManagement @EnableWebSecurity @EnableAsync @EnableSpringConfigured @EnableLoadTimeWeaving public class RootContextConfig extends …

http://stackoverflow.com/a/22563349
type: Answer
accepted answer of: http://stackoverflow.com/q/22563272
has comment: http://stackoverflow.com/comment/34343180
score: 5
type: AcceptedAnswer
downvote count: 0
upvote count: 5
answers question: http://stackoverflow.com/q/22563272
has body: You need to make your classes generic: public abstract class Report&lt;T extends Transaction&gt; { protected Map&lt;String, T&gt; m = new HashMap&lt;String, T&gt;(); // more stuff } public class TRRTransaction extends Transaction { public String someMethodOnlyInTRRTransaction() { // do stuff } @Override public void someInheritedMethod() { // do stuff } // more stuff } public class TRRReport extends Report&lt;TRRTransaction&gt; { public void doSomething() { for (B b : m.values()) { query.setString(1, b.someMethodOnlyInTRRTransaction()); } } // more stuff }

http://stackoverflow.com/a/22590663
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34392587
has comment: http://stackoverflow.com/comment/34392886
type: Answer
has comment: http://stackoverflow.com/comment/34393130
accepted answer of: http://stackoverflow.com/q/22590572
has body: The node that you take off the open list must be the node with the smallest F cost. That makes using a linked list a bad choice - you either have to search through it completely to extract a node, or you have to search through it completely to insert nodes. But, bad choice or not, it's not correct like this because you're doing neither. Also, if a neighbour is already in the open list, you must compare the G scores and re-parent it if the new path is better. Using a linked list for the closed set is also a bad choice, you only need "add" and "contains" on it, and contains is terrible for linked lists. This doesn't affect correctness though.
answers question: http://stackoverflow.com/q/22590572
has comment: http://stackoverflow.com/comment/34392754
score: 0
has comment: http://stackoverflow.com/comment/34393176

http://stackoverflow.com/q/22582179
tagged with: stack-overflow
has comment: http://stackoverflow.com/comment/34377208
score: 0
tagged with: subclass
has comment: http://stackoverflow.com/comment/34380801
has body: Is this possible? If I extend the StackOverflowError class, could a subclass instance be thrown on a stack overflow instead of the default instance?
answer count: 0
type: UnansweredQuestion
has title: Make Java throw a StackOverflowError subclass instead?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34377155
has comment: http://stackoverflow.com/comment/34377075

http://stackoverflow.com/a/22587241
downvote count: 0
type: Answer
upvote count: 2
score: 2
has body: You will need to add a constructor with a parameter and then have a method that returns the value in the form that you need. For instance you could have: class Delivery { private int year; public Delivery(String date) { year = Integer.parseInt(date); } public int getYear() { return year; } } then in your other part of the program you can: Delivery delivery = new Delivery(date); int year = delivery.getYear(); Well, something like that anyway...
answers question: http://stackoverflow.com/q/22587177

http://stackoverflow.com/comment/34704587
type: Comment
score: 1
has text: Ok, I added the link.
type: AnswerComment
comment on: http://stackoverflow.com/a/22617122

http://stackoverflow.com/q/22599116
has answer: http://stackoverflow.com/a/22599166
has comment: http://stackoverflow.com/comment/34407810
score: 0
has comment: http://stackoverflow.com/comment/34407778
answer count: 1
has comment: http://stackoverflow.com/comment/34407795
has comment: http://stackoverflow.com/comment/34407886
has title: How to discover what argument format must be used in a method?
has comment: http://stackoverflow.com/comment/34407901
type: UnansweredQuestion
tagged with: arguments
tagged with: superclass
tagged with: java
tagged with: eclipse
type: Question
has body: Currently working on a very simple Java project, however I've encountered a problem. I'm unsure as for what arguments I need to find a command, specified by the original Jar. Since, if it's possible, I would be using this in a number of situations, providing the exact files involved wouldn't be too useful. However, if someone could please explain how to find the format the arguments should be in for a method? Example - robot.ifBesideThing(), and I'm unsure what to put in the (). I want to know how to find the possible arguments. I'm using Eclipse. I've tried searching through guides and google, however keyword wise, I'm almost always led off to an unrelated problem.

http://stackoverflow.com/q/22598738
type: UnansweredQuestion
has title: Need help reading a file in java
type: Question
has answer: http://stackoverflow.com/a/22598775
has comment: http://stackoverflow.com/comment/34407157
tagged with: java
has body: I'm trying to make my code read a file. I can store a file but I'm not sure how to fix the error that I'm receiving to read the file. Here is my main class: public static void main(String[] args) throws IOException { Scanner input = new Scanner(System.in); Room[] myHotel = new Room[6]; for (int x = 0; x &lt; myHotel.length; x++) { myHotel[x] = new Room(); } String roomName = null; String choice; String emptyRoom = "empty"; int roomNum = 0; initialise(myHotel); while ( roomNum &lt; 6 ) { System.out.println("V: To View rooms"); System.out.println("A: To Move customer to room"); System.out.println("D: To Remove customer from room"); System.out.println("S: Store data into text file"); System.out.println("L: Read data from file"); choice = input.next(); if (choice.equals("V")) //views all the rooms { view(myHotel, roomName); } if (choice.equals("A")) { System.out.println("Enter room number (0-5) or 6 to stop:" ); roomNum = input.nextInt(); System.out.println("Enter the name for the room " + roomNum + " : " ) ; roomName = input.next(); myHotel[roomNum].setName(roomName); add(myHotel, roomName); System.out.println(" "); } if (choice.equals("D")) { view(myHotel, roomName); System.out.println("Enter room you want to remove a customer from: "); roomNum = input.nextInt(); myHotel[roomNum].setName(emptyRoom); delete(myHotel, roomName); System.out.println(""); } if (choice.equals("S")) { store(myHotel); } if (choice.equals("L")) { System.out.println(""); load(myHotel); } } } private static void initialise( Room hotelRef[] ) { for (int x = 0; x &lt; 6; x++ ) hotelRef[x].getName(); System.out.println( "initilise "); } public static void view(Room[] myHotel, String roomName){ System.out.println("All the rooms are shown below:"); for (int x = 0; x &lt; 6; x++) { System.out.println("room " + x + " occupied by " + myHotel[x].getName()); } } private static void add(Room[] myHotel, String roomName){ for (int x = 0; x &lt; 6; x++) { System.out.println("room " + x + " is occupied by " + m…
score: 0
answer count: 1

http://stackoverflow.com/q/22514654
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22514726
has title: Convert double[] to long[]
has comment: http://stackoverflow.com/comment/34257136
tagged with: long-integer
tagged with: java
has body: Well like the title says, I have to convert a double[] to a long[] but I don't know how can I do it. I try this: double[] ids = getIds(); // The ids I'm getting return in double format List&lt;Long&gt; myArray = new ArrayList&lt;Long&gt;(); for (double _ids : ids) { myArray.add((long)_ids); } System.out.println(myArray); // Works! the list is now long, I can print also in myArray.toArray() // Now I need pass this on a long[] array for the system wich request the data // Receive "getStringsById(String string, long... Ids)" I really appreciate the help. Thanks for your time.
type: Question
score: 0
answer count: 1
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/34257132
tagged with: double
type: UnansweredQuestion

http://stackoverflow.com/comment/34495970
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22646218
has text: The loop runs, it just gives me the incorrect answer. If I type in "abc" the program returns 0 unique characters instead of 3. I've also tried putting "i < lengthText" in the for loop and that still gives me the wrong answer.
score: 0

http://stackoverflow.com/q/22514695
has answer: http://stackoverflow.com/a/22515173
has comment: http://stackoverflow.com/comment/34257414
has comment: http://stackoverflow.com/comment/34257758
has body: I wrote a parser in java that parses several features from a text file.The idea is to get a block of lines corresponding to the corresponding headline. For instance, if I have this: CC -!- FUNCTION: Adapter protein implicated in the regulation of a large CC spectrum of both general and specialized signaling pathways. Binds ... I'll need to get this: Function : Adapter protein implicated in the regulation of a large spectrum of both general and specialized signaling pathways. Binds .... I can do that without any problem for all the features from that type of text file. The problem comes when I have this: CC -!- FUNCTION: Adapter protein implicated in the regulation of a large CC spectrum of both general and specialized signaling pathway ... CC -!- SUBUNIT: Homodimer. Interacts with SAMSN1 and PRKCE (By CC similarity). Interacts with SSH1 and TORC2/CRTC2. Interacts .. When i finish with the block "function", my parser will always jump one line at the end and escapes therefore the line with "SUBUNIT" that i can't get anymore :( Here is an example of a file I need to parse: CC -!- FUNCTION: Adapter protein implicated in the regulation of a large CC spectrum of both general and specialized signaling pathways. Binds... CC -!- SUBUNIT: Homodimer. Interacts with SAMSN1 and PRKCE (By CC similarity). Interacts with SSH1 and TORC2/CRTC2. Interacts with ... CC -!- SUBUNIT: Homodimer. Interacts with SAMSN1 and PRKCE salut(By CC similarity). Interacts with SSH1 and TORC2/CRTC2. salutInteracts with CC -!- INTERACTION: CC Q76353:- (xeno); NbExp=3; IntAct=EBI-359815, EBI-6248077; CC Q9P0K1-3:ADAM22; NbExp=2; IntAct=EBI-359815, EBI-1567267; ... CC -!- SUBCELLULAR LOCATION: Cytoplasm. Melanosome. Note=Identified by CC mass spectrometry in melanosome fractions from stage I to stage CC IV. .... Here's a part of what I wrote. I'm trying to mark the current position in the file while reading it but the parsing doesn't work well when i do that. What am I missing here? Cheers for any help, …
has title: How to mark a position while reading a file in java?
type: Question
tagged with: reset
answer count: 1
has comment: http://stackoverflow.com/comment/34257597
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34257682
type: UnansweredQuestion

http://stackoverflow.com/comment/34257214
comment on: http://stackoverflow.com/a/22514446
score: 0
type: AnswerComment
type: Comment
has text: Thank you. Can I please know where did you get this information? I was unable to find in on the Java SE7 documentation online. Anything that I am missing? :)

http://stackoverflow.com/comment/34461389
type: Comment
type: AnswerComment
has text: I know, but how can i do this ? Should i create a new array in main and = to this an array returned from method ? I mean how can change the array returned from a.czynnikiPierwsze to sth like tab[i]; ?
comment on: http://stackoverflow.com/a/22629263
score: 0

http://stackoverflow.com/comment/34399765
comment on: http://stackoverflow.com/q/22594773
has text: Your question is unanswerable, and your terminology is wrong. You're not implementing swing. You're using swing. A method can't be a subclass. You can't create a method, only call it. Post a minimal but complete exemple reproducing the problem, tell us what the expected result is a,d what the desired result is.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22524914
score: 0
tagged with: java
tagged with: gxt
type: Question
has comment: http://stackoverflow.com/comment/34279862
has comment: http://stackoverflow.com/comment/34280233
has title: How to Add Listener to cell in GXT Editable Grid
has comment: http://stackoverflow.com/comment/34283321
answer count: 0
has body: I am writing code for Editable Grid using GXT.I created one column with TextField as Editor like below: column=new ColumnConfig(); column.setId("checkinTime"); column.setHeader("Check In Time"); column.setWidth(80); column.setMenuDisabled(true); column.setSortable(false); final TextField&lt;String&gt; text = new TextField&lt;String&gt;(); column.setEditor(new CellEditor(text)); configs.add(column); Now I need to add Listener to the cell of this column to validate the value of the cell and need to reset the value if validations fails.Please suggest how to do this. I am using Gxt 2.2.3. UPDATE Below are the imports import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; import com.extjs.gxt.ui.client.widget.grid.ColumnModel; import com.extjs.gxt.ui.client.widget.grid.EditorGrid; import com.extjs.gxt.ui.client.widget.form.TextField; import com.extjs.gxt.ui.client.widget.grid.CellEditor;
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34277869
tagged with: gwt

http://stackoverflow.com/q/22617045
has body: I am a but puzzled about the lastfm API, more exactly about the PaginatedResult I read all users from a group in a PaginatedResult: PaginatedResult&lt;de.umass.lastfm.User&gt; users = Group.getMembers("Classic Rock", key); Then I tried two methods to display all the users. There should be about 25000, but I only get about 25. Only first page? How could I get all the results? // for (int i = 0; i &lt; users.getTotalPages();i++){ for (User thisuser: users.getPageResults()){ //for each user System.out.print(thisuser.getName() + " - age: " + thisuser.getAge() + " - country: " + thisuser.getCountry() + " - "+ thisuser.getGender() + " - is: " + thisuser.getId() + " - playcount: " + thisuser.getPlaycount() + " - num playlists: " + thisuser.getNumPlaylists() + "\n"); } // } for (User thisuser: users){ //for each user System.out.print(thisuser.getName() + " - age: " + thisuser.getAge() + " - country: " + thisuser.getCountry() + " - "+ thisuser.getGender() + " - is: " + thisuser.getId() + " - playcount: " + thisuser.getPlaycount() + " - num playlists: " + thisuser.getNumPlaylists() + "\n"); }
favorite count: 0
tagged with: last.fm
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22617291
type: Question
accepted answer: http://stackoverflow.com/a/22617291
has title: Last.fm java API - how to get users from PaginatedResult
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/45165339
comment on: http://stackoverflow.com/q/22527908
score: 0
type: Comment
type: QuestionComment
has text: Why Loading the Driver Class 2 times when loading it once is sufficient , Same goes with Connection

http://stackoverflow.com/a/22591730
has comment: http://stackoverflow.com/comment/34395600
accepted answer of: http://stackoverflow.com/q/22591483
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22591483
has comment: http://stackoverflow.com/comment/34395861
has comment: http://stackoverflow.com/comment/34396764
type: Answer
has comment: http://stackoverflow.com/comment/34395611
upvote count: 1
has body: See http://www.w3.org/TR/xpath/#booleans, if you have a comparison expression1 = false() where expression1 evaluates to a string value then any non-empty string is treated as the boolean value true() and that way the comparison is false for the string 'true' as well as for the string 'false' as both are non-emtpy strings.
has comment: http://stackoverflow.com/comment/34396952

http://stackoverflow.com/a/22570084
type: Answer
has body: You could just use a managed bean on the commandButton and then do a redirect in your page? As you definitely want to navigate away with p:commandbutton youw would want to set ajax="false" put action . Alternatively you could just use &lt;p:commandButton type="button" value="logout" onclick="javascriptTolinkToServletEndEsssion" /&gt;
score: 0
answers question: http://stackoverflow.com/q/22567133

http://stackoverflow.com/comment/34458758
has text: dispatcher config might help here
type: QuestionComment
comment on: http://stackoverflow.com/q/22627759
score: 3
type: Comment

http://stackoverflow.com/comment/34377710
has text: That is exactly how I set the port to 9000.The first application runs on the default port while the second application runs on 9000 by setting the above jvm flag
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22582349
type: Comment

random
tags question: http://stackoverflow.com/q/22571478
tags question: http://stackoverflow.com/q/22565684
tags question: http://stackoverflow.com/q/22495599
tags question: http://stackoverflow.com/q/22573385
tags question: http://stackoverflow.com/q/22563558
tags question: http://stackoverflow.com/q/22642918
tags question: http://stackoverflow.com/q/22637468
tags question: http://stackoverflow.com/q/22646328
tags question: http://stackoverflow.com/q/22576718
tags question: http://stackoverflow.com/q/22628408
tags question: http://stackoverflow.com/q/22600647
tags question: http://stackoverflow.com/q/22584244
tags question: http://stackoverflow.com/q/22622281
tags question: http://stackoverflow.com/q/22586997
tags question: http://stackoverflow.com/q/22542581
tag name: random
tags question: http://stackoverflow.com/q/22553843
type: Tag
tags question: http://stackoverflow.com/q/22530702
tags question: http://stackoverflow.com/q/22609012
tags question: http://stackoverflow.com/q/22534073

http://stackoverflow.com/q/22521953
type: Question
has comment: http://stackoverflow.com/comment/34270732
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22522159
type: UnansweredQuestion
tagged with: recursion
downvote count: 0
score: 1
has body: I have this method and I want to be able to predict the output of this recursive method using a recursion tree, anyone have an idea of what this would look like? Code: public static void main(String[ ] args) { f(5, 2); } public static void f(int x, int y) { if (x &gt; 0 &amp;&amp; y &gt; 0) { f(y - 1, x - 2); f(x - 2, y); System.out.print((x + y) + " "); f(x - 3, y - 1); System.out.print((x - y) + " "); } }
tagged with: java
has title: Predicting output using a recursion tree

http://stackoverflow.com/comment/34485744
type: Comment
type: AnswerComment
has text: I replace the setPreferredSize() to setSize and also modified the button like this JButton btnCategory_2=new JButton(" "). It isn't show the height as I want. I want the text field and button has the same height. Also how can I make the button and text field form left to right. I added this code panelCategory.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT ), but all button and text fields in the center. Thanks for your help
comment on: http://stackoverflow.com/a/22572025
score: 0

http://stackoverflow.com/comment/34370147
type: Comment
type: QuestionComment
has text: Do you expect that setting 'stageStandingTeam' param to value 'team.stageStanding.stage1' will have some effect on expression '${team.stageStanding.stage1}'?
score: 0
comment on: http://stackoverflow.com/q/22577955

http://stackoverflow.com/comment/34407228
type: AnswerComment
comment on: http://stackoverflow.com/a/22598524
has text: nice, i got this. but in the upper code, we dont give values, so what will it print?
score: 0
type: Comment

http://stackoverflow.com/comment/49119377
type: AnswerComment
type: Comment
has text: I got this working but the email always returning null, any idea?
comment on: http://stackoverflow.com/a/22686778
score: 0

http://stackoverflow.com/comment/34633533
type: AnswerComment
type: Comment
has text: Thanks but thats not really what im looking for, but i believe ive solved the issue now. thanks
comment on: http://stackoverflow.com/a/22582829
score: 0

http://stackoverflow.com/q/22551270
score: 3
tagged with: java
tagged with: hibernate
has body: Is there a simple way (through Java code) to verify if the HQL is syntactically correct? One way is certainly to execute it and catch the exception. But I want to avoid firing the query. In my case, the HQL is generated on the fly depending on user's selection and sometimes the user may even enter it manually. Hence, I want to verify if the HQL is in the correct form.
tagged with: hql
type: Question
has title: How to verify if HQL is syntactically correct (without executing it)?
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/22551381
answer count: 3
possible better answer: http://stackoverflow.com/a/22551454
has answer: http://stackoverflow.com/a/22552169
accepted answer: http://stackoverflow.com/a/22552169
downvote count: 0
has answer: http://stackoverflow.com/a/22551454
type: AnsweredQuestion

http://stackoverflow.com/q/22572214
has title: How to ignore case in replace method java
score: 0
linked to: http://stackoverflow.com/q/5054995
has answer: http://stackoverflow.com/a/22572305
answer count: 1
favorite count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/5054995
tagged with: java
tagged with: bukkit
upvote count: 1
has body: Alright So I am trying to check and see if a string exists but I don't know what case it's going to be in so How would I use it in my method? here is my code if (!p.hasPermission("core.chat.curse")){ String message = e.getMessage().toString().toLowerCase().replace(" ", ""); List&lt;String&gt; cursewords = manager.getCurseFile().getStringList("cursewords"); for (String badword : cursewords){ badword = badword.toString().toLowerCase(); if (message.contains(badword)){ String crossout = ""; for (int x = 0; x &lt; badword.length(); x++){ crossout += "*"; } e.setMessage(e.getMessage().replace(badword, crossout)); //I need to //replace Ignore Case Here } } } .replace does not take a regex, so I can't use that! How would I go about doing this, because the player can input the word in any case?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34374624

http://stackoverflow.com/comment/34302797
has text: Thank you. I will clean that right up
comment on: http://stackoverflow.com/q/22537833
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34427833
comment on: http://stackoverflow.com/q/22609217
type: QuestionComment
has text: @sunleo I made an Answer.
type: Comment
score: 0

http://stackoverflow.com/a/22565057
score: 0
answers question: http://stackoverflow.com/q/22564962
has comment: http://stackoverflow.com/comment/34346567
has comment: http://stackoverflow.com/comment/34347904
type: Answer
has comment: http://stackoverflow.com/comment/34348138
has comment: http://stackoverflow.com/comment/34346610
has comment: http://stackoverflow.com/comment/34346832
has comment: http://stackoverflow.com/comment/34346106
has body: Your problem is the visited, it is a List of Cities and you do contains in it. A Map is faster for this kind of things, and also will ensure to compare the value of the String as key. In the Graph.BFS method replace the visited from a List by a Map: Map visited = new HashMap(); And then: ... while (!toVisit.isEmpty()&amp;&amp;(!found)) { node = toVisit.remove(); visited.put(node.getId(), true); // &lt;--- this was changed and: for (City n : aux) if (!visited.containsKey(n.getId())&amp;&amp;(!n.equals(to))) { // &lt;-- this was changed
has comment: http://stackoverflow.com/comment/34347571
has comment: http://stackoverflow.com/comment/34347593
has comment: http://stackoverflow.com/comment/34346715
has comment: http://stackoverflow.com/comment/34347987

http://stackoverflow.com/comment/34227779
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22497281
has text: ik... i just hate the fact that screen cant extend JFrame...
score: 0

http://stackoverflow.com/q/22508965
accepted answer: http://stackoverflow.com/a/22541393
tagged with: clojure
type: AnsweredQuestion
tagged with: maven
has body: I'm trying to compile some Clojure code into a jar, using Maven and the clojure-maven-plugin. The generated jar includes the source *.clj files, i would like to exclude these files from the final jar, and include only the AOT compiled files. My pom file is as follows: <?xml version="1.0" encoding="UTF-8"?> clojure-interop com.testing.clojure 1.0.0 4.0.0 jar com.theoryinpractise clojure-maven-plugin 1.3.13 true compile-clojure compile compile test-clojure test test clojars http://clojars.org/repo/ org.clojure clojure 1.5.0 Can someone point me in the right direction?
has title: How to exclude source files using Clojure maven plugin?
type: Question
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22541393

http://stackoverflow.com/comment/34354933
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22569746
has text: If you look down the stack trace, it's saying the error is on line 45. Is this line 45: `tweetBTN.setOnClickListener(tweetBTNOnClickListener);`? I don't trust my counting. If it is, then the previous line returned `null` for `tweetBTN`.

http://stackoverflow.com/comment/34333560
type: QuestionComment
comment on: http://stackoverflow.com/q/22557564
score: 0
has text: @Bilals... Check out the similar thread http://stackoverflow.com/a/22527848/1839336
type: Comment

http://stackoverflow.com/q/22488643
has title: Unity3D vs Java3D
has answer: http://stackoverflow.com/a/22489104
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34212351
downvote count: 5
has answer: http://stackoverflow.com/a/22488746
possible better answer: http://stackoverflow.com/a/22489104
accepted answer: http://stackoverflow.com/a/22488746
answer count: 2
has body: Hello, I am a Java Programmer and i want to learn Java3D but Unity3D looks more Advanced than Java3D like Unity3D is more lively, more Alive than Java3D.I would like to ask if Java3D can do exactly as Unity3D or even more.
favorite count: 0
tagged with: unity-game-engine
upvote count: 2
score: -3

http://stackoverflow.com/a/22629460
has comment: http://stackoverflow.com/comment/34472140
has comment: http://stackoverflow.com/comment/34510200
answers question: http://stackoverflow.com/q/22628897
has body: http://www.slf4j.org/legacy.html#jul-to-slf4j The jul-to-slf4j module includes a java.util.logging (jul) handler, namely SLF4JBridgeHandler, which routes all incoming jul records to the SLF4j API Sounds like what you're looking for?
has comment: http://stackoverflow.com/comment/34480277
score: 0
type: Answer

http://stackoverflow.com/a/22576375
type: Answer
score: 1
upvote count: 1
has body: I think you are missing an argument, use: JOptionPane.showMessageDialog(null, "We're going to calculate the volume of a cylinder", "Dialog Title", JOptionPane.INFORMATION_MESSAGE);
downvote count: 0
answers question: http://stackoverflow.com/q/22576285

http://stackoverflow.com/comment/34291758
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22534025
has text: If you get an Exception, then you should post the stacktrace here.
type: Comment

http://stackoverflow.com/a/22599659
has comment: http://stackoverflow.com/comment/34408855
has comment: http://stackoverflow.com/comment/34408777
downvote count: 0
has comment: http://stackoverflow.com/comment/34408800
has body: I wonder how the code is working for you. The above code should not work. You put the fragment at android.R.id.content. But I don't see that inside the DrawerLayout your Activity XML. Furthermore, the Drawer Layout should only have a FrameLayout (with id 'content' in your case) and a ListView as mentioned here. So you need to have add a FrameLayout as below in your Activity XML for which you are implementing the navigation drawer. &lt;FrameLayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; Also you will have to move the xml into another fragment which you can load when the activity starts or when desired.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22599595
has comment: http://stackoverflow.com/comment/34408920
score: 2

http://stackoverflow.com/a/22497685
answers question: http://stackoverflow.com/q/22490064
upvote count: 17
accepted answer of: http://stackoverflow.com/q/22490064
has body: The problem is because you are trying to run JavaFX scene graph control outside of JavaFX Application thread. Run all JavaFX scene graph nodes inside the JavaFX application thread. You can start a JavaFX thread by extending JavaFX Application class and overriding the start() method. public class Main extends Application { @Override public void start(Stage primaryStage) { Media pick = new Media("put.mp3"); // replace this with your own audio file MediaPlayer player = new MediaPlayer(pick); // Add a mediaView, to display the media. Its necessary ! // This mediaView is added to a Pane MediaView mediaView = new MediaView(player); // Add to scene Group root = new Group(mediaView); Scene scene = new Scene(root, 500, 200); // Show the stage primaryStage.setTitle("Media Player"); primaryStage.setScene(scene); primaryStage.show(); // Play the media once the stage is shown player.play(); } public static void main(String[] args) { launch(args); } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34237898
score: 17
type: Answer
has comment: http://stackoverflow.com/comment/34237627

http://stackoverflow.com/a/22492195
has body: to get the text in the textfield assign a string to name of textfield - .getText();
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22487953

http://stackoverflow.com/comment/34279191
type: AnswerComment
type: Comment
has text: Yes, i understand what you want, but td doesn't accept the name attribute. The warnings message appears :Undefined attribute name (name).
comment on: http://stackoverflow.com/a/22522579
score: 0

http://stackoverflow.com/comment/34272630
type: Comment
has text: Thanks, please read the part about your add routine. It is reversed as you've posted.
type: AnswerComment
comment on: http://stackoverflow.com/a/22523138
score: 0

http://stackoverflow.com/a/22578552
downvote count: 0
has body: What you are trying to do won't work, since Thymeleaf processes the template on the server side and therefore the variables it has access to are the ones defined in it's model. If you had myVariable in the model on which Thymeleaf is operating, it would work. If what you want is to set the value of a Javascript variable in a Thymeleaf template, you can do the following: &lt;script th:inline="javascript"&gt; /*&lt;![CDATA[*/ ... var myVariable= /*[[${myVariable}]]*/ 'value'; ... /*]]&gt;*/ &lt;/script&gt; Inside the script you could have any logic you want including hide/show etc. Check out this part of the documentation for mode details.
score: 35
type: Answer
upvote count: 35
answers question: http://stackoverflow.com/q/22575136

http://stackoverflow.com/a/22493334
upvote count: 6
score: 6
accepted answer of: http://stackoverflow.com/q/22493027
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22493027
type: Answer
has body: When I go ahead and enable GL_CULL_FACE (because apparently it isn't enabled by default, as it should be) What do you mean? GL_CULL_FACE is disabled by default, as dictated by the spec. The decision what is the front face and what is the back face is completely indepentent of the normal you use, GL uses the winding order of the primitive (defined by the order of the vertices you specify). By default, a face is considered the front face if its vertices (in screen space) are oriented in counter-clockwise. You can either reorient your faces by flipping the winding of every primitive, or you can use glFrontFace() to change GL's order rule from GL_CCW to GL_CW (clockwise), or you could even use glCullFace() to tell OpenGL that you want to cull front faces instead of back faces. No matter what option you choose, I would advise you that you make sure that you make sure that the winding order of all objects in your scene is consistent. It is in principle possible to switch the oders for each draw call, but you should avoid that if it is not absolutely necessary.

http://stackoverflow.com/q/22598548
has answer: http://stackoverflow.com/a/22615229
favorite count: 0
tagged with: google-app-engine
tagged with: android
has title: App Engine: Can't get any Tutorial working
has body: I try to develop an App Engine project for Android, but I have bugs again and again. I tried to do 3 tutorials in the last days, but got none of them working... Tutorial 1: Create App Engine Connected Android Project When creating an App Engine Connected Android Project, I get the following error in the MainActivity: RegisterActivity cannot be resolved to a type. When i googled this error, I saw that many people had the same error 1 year ago, but nobody could give a good solution yet. Has google been able to solve this bug yet?.. Tutorial 2: https://developers.google.com/appengine/docs/java/endpoints/getstarted/backend/create_project This Tutorial uses Maven. I tried to generate the project with following command, because I am not able to do that with the interactive mode: "mvn archetype:generate -DgroupId=com.google.appengine.samples.helloendpoints -DartifactId=helloendpoints -DarchetypeArtifactId=appengine-skeleton-archetype -DinteractiveMode=false". It fails and tells me that the archetype doesn't exist.. (appengine-skeleton-archetype) Well, I don't know what to do here... Tutorial 3: https://cloud.google.com/developers/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial At "Modify the Client Application", when I replace the Code from MainActivity01, I get errors like "CloudEndpointUtils cannot be resolved", because in the MobileAssistant src folder the class CloudEndpointUtils was not created! Conclusion: Seems like most of the documentation is not up-to-date and the google plugins are pretty bugged... Maybe somebody knows how to solve those errors? Is there any Tutorial, which is up-to-date and, which shows how to build an easy application for android with appengine and which WORKS? I would like to complete just ANY tutorial and have a stable basic project...
type: UnansweredQuestion
tagged with: java
tagged with: maven
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22601583
score: -1
tagged with: eclipse
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/34417715
has text: he mentions "like the good old C programs" which contains all logic in one method
comment on: http://stackoverflow.com/a/22604889
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22611441
score: 0
has body: You can create a serialized reprezentation of the values you want to send in the url. It has limitations such as the max length of the url. 'http://domain.com/data_handler.php?data=' . urlencode(serialize($array1)); Getting back your array: $array1 = unserialize($_GET['data']); Its even better to create a post request and use this syntax: pid[]=1 pid[]=2 http://www.php.net/manual/en/faq.html.php
type: Answer
answers question: http://stackoverflow.com/q/22611213

http://stackoverflow.com/a/22622132
has body: What you need to do is to set up intent in your main activity, and then get it here so it goes like follows: under Main_Activity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.Main_Activity); Intent i = new Intent(this,activiteResultats.class); // or getApplicationContext() &lt;= for context i.putExtras("TagOfMyMessage","MyMessageblablabla"); startActivity(i); } under ActivteResultats.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_activite_resultats); Intent i = getIntent(); String message = i.getStringExtras(); // or something like it // Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); // Set the text view as the activity layout setContentView(textView); } You just don't need to use fragments if you want a clear and easy tutorial i advice you to check this one : http://www.vogella.com/tutorials/AndroidIntent/article.html
score: 0
answers question: http://stackoverflow.com/q/22621727
type: Answer

singleton
tags question: http://stackoverflow.com/q/22497497
type: Tag
tags question: http://stackoverflow.com/q/22554588
tags question: http://stackoverflow.com/q/22492668
tag name: singleton

http://stackoverflow.com/q/22535762
has title: How to determine which input field was populated on JSP?
tagged with: input
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22536483
has body: have Struts project and web-form based JSP page with several input fields. Users enters data to the ONLY one input field and submit the form. So the related Action class is called. In that action-class I have proper String fields for every input on JSP and later in my code I need to use populated value to find some data. So my question is: how would you determine which field was populated? 'cause I know the only one stupid way (not real code, just as an example): if (isNotBlank(field_1)) { findData(field_1) } else if (isNotBlank(field_2)) { findData(field_2) } else if (isNotBlank(field_3)) { findData(field_3) } else if... and so on... Is there any elegant way for group of strings to determine which one is not blank? any hints are appreciated. thx.
type: Question
tagged with: struts2
score: 0
answer count: 1
tagged with: jsp
tagged with: string
has answer: http://stackoverflow.com/a/22536483

http://stackoverflow.com/comment/34277063
comment on: http://stackoverflow.com/a/22525696
score: 0
has text: I changed and run it as Rengine re = new Rengine (new String [] {"--vanilla"}, false, null); ,Still same no output and program getting terminated
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34334788
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22533632
has text: @pveentjer thanks for the link, totally new area for me, very interesting indeed

http://stackoverflow.com/comment/34402122
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22595874
has text: Check ZouZou comment on @arshajii answer.
score: 0

http://stackoverflow.com/q/22620271
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/34446613
accepted answer: http://stackoverflow.com/a/22621883
upvote count: 5
has comment: http://stackoverflow.com/comment/34447074
downvote count: 0
has comment: http://stackoverflow.com/comment/34446005
tagged with: exception
has comment: http://stackoverflow.com/comment/34446453
favorite count: 0
tagged with: interrupted-exception
has comment: http://stackoverflow.com/comment/34448628
has comment: http://stackoverflow.com/comment/34448492
has answer: http://stackoverflow.com/a/22621883
has comment: http://stackoverflow.com/comment/34448049
has comment: http://stackoverflow.com/comment/34446781
type: AnsweredQuestion
has title: Should I Thread.currentThread.interrupt() before I throw an exception back?
tagged with: java
possible better answer: http://stackoverflow.com/a/22621751
type: Question
has comment: http://stackoverflow.com/comment/34445918
has answer: http://stackoverflow.com/a/22621751
has body: I am implementing an interface which throws IOException. In my implementation, I call another method which can block, and therefore throw InterruptedException. Context: I want to end the treatment if I am interrupted; this is not a thread I created myself. My current idea is to do as such (skeleton code): @Override public void implementedMethod() throws IOException { try { methodThatBlocks(); } catch (InterruptedException ignored) { Thread.currentThread().interrupt(); throw new IOException(); } } is that the correct way? Or should I just throw and not .interrupt()?

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

http://stackoverflow.com/q/22555855
downvote count: 0
has title: org.hibernate.PropertyAccessException: exception setting property value with CGLIB
favorite count: 0
has body: This is my hibernate POJO class. StockModel.java import java.util.Date; public class StockModel implements java.io.Serializable{ private static final long serialVersionUID = 1L; private String s_model_id; private String s_prod_id; private String s_model_name; private String s_model_type; private char c_epos_type; private String s_model_ver; private String s_model_cat; private String s_oem; private char c_voice_facility; private char c_actual_distance; private char c_sim_lock; private char c_emergency; private char c_accdacc; private char c_ignition; private char c_battery; private char c_tampering; private char c_overspeed; private char c_fuelknob; private char c_routedeviation; private char c_swipedetection; private char c_circular_geofence; private char c_polygonal_geofence; private char c_gps_antennae; private char c_gsm_antennae; private char c_adc; private char c_accident_data; private char c_is_active = 'Y'; private String s_created_by; private Date dt_created; private String s_modified_by; private Date dt_modified; private char c_is_deleted = 'N'; /** * @return the s_model_id */ public String getS_model_id() { return s_model_id; } /** * @param s_model_id the s_model_id to set */ public void setS_model_id(String s_model_id) { this.s_model_id = s_model_id; } /** * @return the s_prod_id */ public String getS_prod_id() { return s_prod_id; } /** * @param s_prod_id the s_prod_id to set */ public void setS_prod_id(String s_prod_id) { this.s_prod_id = s_prod_id; } /** * @return the s_model_name */ public String getS_model_name() { return s_model_name; } /** * @param s_model_name the s_model_name to set */ public void setS_model_name(String s_model_name) { this.s_model_name = s_model_name; } /** * @return the s_model_type */ public String getS_model_type() { return s_model_type; } /** * @param s_model_type the s_model_type to set */ public void setS_model_type(String s_model_type) { this.s_model_type = s_model_type; } /** * @return the c_epos_type */ public char getC_…
tagged with: exception
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22573964
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22573964
answer count: 1

http://stackoverflow.com/comment/34360721
has text: Yes. Absolutely true.
type: Comment
comment on: http://stackoverflow.com/a/22551255
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34333406
comment on: http://stackoverflow.com/q/22558000
score: 0
type: Comment
type: QuestionComment
has text: I can't figure what you are trying? Are you trying to display result in new Activity or something else? You are instanced new Intent but you are not using them later ...

http://stackoverflow.com/comment/34216957
has text: @LouisWasserman Indeed correct, there's no change between Java 8 and Java 7 here. It's two different methods so there's no reason why it wouldn't compile.
type: Comment
comment on: http://stackoverflow.com/a/22490969
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34450297
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22621248
type: Comment
has text: I see that I mentioned a JTable above, which has to relevance. Apologies. I meant a JList.

http://stackoverflow.com/comment/34476687
comment on: http://stackoverflow.com/q/22637913
type: QuestionComment
has text: And in what way does it "not work"? Doesn't do anything? Throws an Exception?
score: 0
type: Comment

http://stackoverflow.com/comment/34444514
type: QuestionComment
comment on: http://stackoverflow.com/q/22619270
score: 0
has text: Is it possible that there are two different versions of your classes on the server? Or, two different apps deployed that have different versions of the same class? I've seen the debugger do some nearly incomprehensible things when the source in the IDE and the bytecode running on the server didn't match.
type: Comment

http://stackoverflow.com/comment/34296978
type: Comment
comment on: http://stackoverflow.com/a/22518075
type: AnswerComment
has text: This is a classic ASP applicaiton. So, is CAS configurable with a calssic ASP applicaiton ??
score: 0

http://stackoverflow.com/q/22527187
upvote count: 1
has body: With @Path variables it is possible to stop overflow conversions (from string to number). For example if a parameter is an integer (int) then a path expression like {number : \d{1,5}} is a breaker before doing a number conversion. What about handling query parameters in a similar fashion? The syntax for path variables isn't usable in the @QueryParam annotation (@QueryParam("big : \d{1,5}") big...).
answer count: 1
tagged with: jax-rs
tagged with: query-string
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has title: Overflow protection for numbers jax-rs
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22528891
accepted answer: http://stackoverflow.com/a/22528891
type: Question

http://stackoverflow.com/comment/34490022
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22645006
score: 0
has text: i tried userLocal now it says userName is the issue, changed that to userNameLocal and that did not fix it.

http://stackoverflow.com/a/27248534
upvote count: 3
type: Answer
score: 3
answers question: http://stackoverflow.com/q/22631024
downvote count: 0
has body: Solved it by defining my own BeanPostprocessor: public class GroovyConfigImporter implements BeanDefinitionRegistryPostProcessor { private static final Logger log = LoggerFactory.getLogger(GroovyConfigImporter.class); private final String config; public GroovyConfigImporter(String config) { this.config = config; } @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { log.info("Loading Groovy config '{}'", config); GroovyBeanDefinitionReader reader = new GroovyBeanDefinitionReader(registry); try { reader.importBeans(config); } catch (IOException e) { throw new ApplicationContextException("Can't open Groovy config '" + config + "'"); } } @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { } } Then define in your XML: &lt;bean class="my.package.GroovyConfigImporter"&gt; &lt;constructor-arg value="myConfig.groovy"/&gt; &lt;/bean&gt;

http://stackoverflow.com/q/22556885
has comment: http://stackoverflow.com/comment/34331137
type: Question
has comment: http://stackoverflow.com/comment/34331944
linked to: http://stackoverflow.com/q/13570309
linked to: http://stackoverflow.com/q/27581
has title: Is it safe to return 0 as hashcode
answer count: 2
has answer: http://stackoverflow.com/a/22556973
accepted answer: http://stackoverflow.com/a/22557069
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34331341
has comment: http://stackoverflow.com/comment/34331203
possible better answer: http://stackoverflow.com/a/22556973
upvote count: 2
score: 2
type: AnsweredQuestion
has body: I have a class that has a List of Article (or what you want). Is it safe to implement/override the hashCode() function in that class like this : class Place{ List &lt;Article&gt; list = new List&lt;Article&gt;(); public int hashCode() { if(list.isEmpty()) return 0; //is it safe to return 0 else return list.get(0).hashCode(); } } public class Main{ private HashSet&lt;Place&gt; places = new HashSet&lt;&gt;(); //this function must be donne like this public boolean isArticleIn(Article article){ Place place = new Place(); place.add(article); return places.contains(place); } } Is there a possibility to have a list that is not empty and return 0.
tagged with: hashcode
tagged with: java
has answer: http://stackoverflow.com/a/22557069

http://stackoverflow.com/comment/34438387
comment on: http://stackoverflow.com/a/22588639
type: AnswerComment
has text: I have looked at that thread before. But as I explained, I am now in a new activity and have no control over the old activity. In particular, there is no way for me to call it's cancel method, nor set any flags to it... :(
score: 0
type: Comment

http://stackoverflow.com/comment/34478879
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22636606
has text: How about using [`randomUUID()`](http://developer.android.com/reference/java/util/UUID.html#randomUUID())? The chances of getting two identical UUIDs should be microscopical.

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

http://stackoverflow.com/q/22594745
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
has title: drawing shape objects in java (draggable,resizable and can rotate)
type: Question
has answer: http://stackoverflow.com/a/22595225
tagged with: jpanel
has comment: http://stackoverflow.com/comment/34399651
downvote count: 0
answer count: 1
tagged with: paintcomponent
favorite count: 0
accepted answer: http://stackoverflow.com/a/22595225
has body: I am trying to draw shapes (triangle, rectangle, square and circle) that can be used in creating a picture. A user should be able to place a shape on a canvas and drag it around or even enlarge it to create a desired picture. I tried overriding the paintComponent() of a JPanel to achieve this but realize that the Jpanels shape remains a square so when you have a circle you can still drag it even if u are not necessarily touching it as it is within a square and also having difficulty drawing the triangle What libraries would you suggest?
upvote count: 1

http://stackoverflow.com/comment/34326115
comment on: http://stackoverflow.com/q/22553688
type: Comment
type: QuestionComment
has text: @Nik then follow the solutions in the Answer section.
score: 0

http://stackoverflow.com/a/22619499
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/22619453
downvote count: 0
has comment: http://stackoverflow.com/comment/34486173
type: Answer
has body: You can use the split(String str) method of class String. Example: String resultArray[] = stringToSplit.split(",");
has comment: http://stackoverflow.com/comment/34445011

http://stackoverflow.com/q/22626997
has body: I need to reduce size of audio and video files in an Android app. Can I use FFMPEG library for this, if yes please help with code or some tutorial link. Or if there exists some other way to achieve this, please suggest.
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has title: Compress (reduce size) of audio and video files in Android
accepted answer: http://stackoverflow.com/a/22628118
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22628118
tagged with: android
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/22613748
has answer: http://stackoverflow.com/a/22614301
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
tagged with: liferay
has title: parameter not getting set when sent from jsp to Java Portlet
downvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/22614301
linked to: http://stackoverflow.com/q/21550030
tagged with: portlet
answer count: 1
favorite count: 0
has body: JSP CODE <portlet:actionURL name="sampleActionUrl" var="sampleActionUrl"> </portlet:actionURL> CLICK HERE After clicking the div, the control is transferred to the java portlet code (processAction()) package com.home; import java.io.IOException; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.GenericPortlet; import javax.portlet.PortletContext; import javax.portlet.PortletException; import javax.portlet.PortletRequestDispatcher; import javax.portlet.PortletSession; import javax.portlet.RenderMode; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; public class Game extends GenericPortlet { @Override @RenderMode(name = "VIEW") protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType(request.getResponseContentType()); PortletContext context = getPortletContext(); PortletRequestDispatcher rd = context .getRequestDispatcher("/WEB-INF/jsp/game.jsp"); String env = request.getParameter("envSelected"); System.out.println("Game.doView() >> rendering with env : " + env); rd.include(request, response); } @Override public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { String env = request.getParameter("envSelected"); System.out.println("Game.processAction() >> processAction for envSelected: " + env); } } I tried to print the value of the parameter I had set in the jsp code. It is printed as null. Can someone please guide me what I might be missing here?

http://stackoverflow.com/comment/34454219
type: QuestionComment
has text: @Glenn-- I have posted the log cat
comment on: http://stackoverflow.com/q/22624856
score: 0
type: Comment

http://stackoverflow.com/comment/34398479
has text: That is not valid Java code. *Every* line is missing the closing `;`.
comment on: http://stackoverflow.com/q/22593983
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22525654
favorite count: 0
has body: How do appenders work in the web-app when the log results are to be printed to a single file ? Referring to the working of the servlets , each request is served by a different servlet thread , and in a web application , there are numerous of requests occurring in parallel. How is logging handled when multiple instances of the servlets want to log to the same file ? Is this problem handled like the critical section problem in shared resources ? Since the operation involved is write and resource is single log file , would it not slow down the web app in order to serve the requests ?
has answer: http://stackoverflow.com/a/22530909
type: UnansweredQuestion
tagged with: logging
downvote count: 0
has title: Working of Appenders in Logging utilities (log4j) in the context of a web app
score: 1
tagged with: java
type: Question
tagged with: servlets
upvote count: 1
answer count: 1
tagged with: log4j

http://stackoverflow.com/comment/34273224
comment on: http://stackoverflow.com/q/22523478
score: 0
type: Comment
type: QuestionComment
has text: yes sorry first question I've posted here :D

http://stackoverflow.com/q/22584427
has answer: http://stackoverflow.com/a/22584481
has body: For some time I tried to understand, but I still don't get exactly what "compiler compliance level" for a project in Eclipse means. I looked all over this site and Google and couldn't find an answer I could understand. Let's say I want my program to be able to run on JRE 6. I can do: Project > Preferences > Java Build Path > Libraries, and set the JRE library I use to JRE 6. Why isn't this enough? I never understood why I also need to set the compiler compliance setting to JRE 6. I'd like to understand the difference between using JRE 6 in a project, and setting the project's compiler compliance setting to JRE 6. What exactly does compiler compliance level mean?
has answer: http://stackoverflow.com/a/22584449
has answer: http://stackoverflow.com/a/22584512
score: 63
has title: What is "compiler compliance level" in Eclipse?
possible better answer: http://stackoverflow.com/a/22584449
tagged with: java
has answer: http://stackoverflow.com/a/22584460
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/22584460
upvote count: 63
type: AnsweredQuestion
downvote count: 0
answer count: 5
type: Question
favorite count: 0
has answer: http://stackoverflow.com/a/79260122

http://stackoverflow.com/comment/34417497
comment on: http://stackoverflow.com/q/22604825
score: 0
has text: C has also recursion. Arguably, faculty is not an enlightening example for demonstrating it.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22514524
type: AcceptedAnswer
downvote count: 0
has body: The basic code for adding components to a visible panel is: panel.add(...); panel.add(...); panel.revalidate(); panel.repaint(); Adding a component does nothing because the component still has a zero size so there is nothing to paint. When you invoke the revalidate() method the layout manager gets invoked so components will now have a location/size. The repaint() will then paint the components. The revalidate() will also cause the scrollbars to show when required. This of course assumes you are using layout managers. The components are added to the panel so you invoke the methods on the panel, not the scrollpane.
answers question: http://stackoverflow.com/q/22513032
accepted answer of: http://stackoverflow.com/q/22513032
type: Answer
score: 13
upvote count: 13

http://stackoverflow.com/comment/34506632
type: AnswerComment
comment on: http://stackoverflow.com/a/22634640
type: Comment
score: 0
has text: This hides the content, but I want to hide the div completly so that I can have a different design on the log in screen. Any idea?

http://stackoverflow.com/a/22573985
answers question: http://stackoverflow.com/q/22573938
score: 0
has comment: http://stackoverflow.com/comment/34362595
type: Answer
has body: Google Comparator class BookAuthorComparator implements Comparator&lt;Book&gt;{ public int compare(Book b1, Book b2){ return b1.getAuthor().compareTo(b2.getAuthor()); } } Collections.sort(bookList, new BookAuthorCompartor());
has comment: http://stackoverflow.com/comment/34362574

http://stackoverflow.com/a/22533749
has body: You can try javaocr on sourceforge: http://javaocr.sourceforge.net/ There is also a great example with an applet which uses Encog: http://www.heatonresearch.com/articles/42/page1.html That said, OCR requires a lot of power, so it means that if you are looking for a heavy use, you should look after OCR libraries written in C and integrate that with Java. OCR is hard. So be sure to qualify your needs before adventuring yourself in it. Tesseract and opencv (with javacv for integration for instance) are common choices. There are also commercial solutions such as ABBYY FineReader Engine and ABBYY Cloud OCR SDK.
type: Answer
answers question: http://stackoverflow.com/q/22531656
downvote count: 1
upvote count: 10
score: 9

http://stackoverflow.com/comment/34454704
type: QuestionComment
comment on: http://stackoverflow.com/q/22625102
has text: Are you sure that url is correct? - it doesn't look like it. EOF generally means there's something wrong with the file you're trying to get.
score: 0
type: Comment

http://stackoverflow.com/comment/34383254
type: Comment
comment on: http://stackoverflow.com/q/22585375
score: 0
has text: There seem to be some general implementations in [bukkit](http://jd.bukkit.org/rb/apidocs/org/bukkit/util/noise/NoiseGenerator.html); although you are generally working with 1D noise, not 2D. Also check out some of the related links on the right side of this page.
type: QuestionComment

http://stackoverflow.com/a/70824224
type: Answer
answers question: http://stackoverflow.com/q/22576840
has body: To add onto Luis' answe, sometimes you may want Pan/ Zoom to act as exclusive actions (only one can happen at a time). If that's what you're after, this may be useful val targetVector1 = Vector2(pointer1).sub(initialPointer1) val targetVector2 = Vector2(pointer2).sub(initialPointer2) val isZoom = targetVector1.hasOppositeDirection(targetVector2) val isPan = !isZoom
score: 0

http://stackoverflow.com/a/22539170
score: 0
type: Answer
has body: First, as stated by @rgettman, if the first 'if' check doesn't match, you automatically return false, so it needs to arranged better. However, in this case you probably want to use a boolean flag. It should be set to false until the case matches, in which case you would set the flag to true. Outside the loop you would return the flag.
answers question: http://stackoverflow.com/q/22538858

http://stackoverflow.com/a/42102506
type: Answer
has comment: http://stackoverflow.com/comment/71375280
answers question: http://stackoverflow.com/q/22544377
has comment: http://stackoverflow.com/comment/71377081
score: 0
has body: Maybe it's not ideal, perhaps you can pass a parameter in the intent you use to run the child activity that you can evaluate on onBackPressed(). My reasoning is: A and B are C's parent activities. If you are in A and call C, you can do: Intent intent = new Intent(this, C.class); intent.putExtra("parent", "A") In C you get that parameter: mParentActivity = intent.getStringExtra("parent"); Then in onBackPressed(): public void onBackPressed() { if(mParentActivity.equals("A")) { Intent intent = new Intent(this, A.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else if (mParentActivity.equals("B")) { Intent intent = new Intent(this, B.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else { super.onBackPressed(); } }

http://stackoverflow.com/comment/34380691
score: 0
type: Comment
type: QuestionComment
has text: Can you add full exception stack trace? It gives you line number which helps to understand what is null in NullPointerException.
comment on: http://stackoverflow.com/q/22583174

http://stackoverflow.com/q/22575544
has comment: http://stackoverflow.com/comment/34365220
answer count: 3
has comment: http://stackoverflow.com/comment/34366075
has answer: http://stackoverflow.com/a/33760522
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34365096
upvote count: 1
has comment: http://stackoverflow.com/comment/34366486
has comment: http://stackoverflow.com/comment/34366612
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34366657
has comment: http://stackoverflow.com/comment/34368982
has comment: http://stackoverflow.com/comment/34365166
type: Question
has answer: http://stackoverflow.com/a/22575594
has body: I want to find all the paths between 2 nodes, and save them into a list. This is part of a problem where I need to find the shortest path between 2 cities. I have to use BFS so I was thinking to apply a BFS on my graph and save all the paths between the 2 cities in a list.So far I've implemented this but I'm stuck with those cities and routes. I want my list to be a list of Routes but I don't know how to do that. public class Route { private final City node; private final int cost; public Route(City node, int cost) { this.node = node; this.cost = cost; } public City getCity() { return node; } public int getCost() { return cost; } @Override public String toString() { return "{" + node + ", " + cost + "}"; } } public class Graph { private final List&lt;City&gt; cities; private final List&lt;Route&gt; routes; private final Map&lt;City, List&lt;Route&gt;&gt; myGraph = new HashMap&lt;City,List&lt;Route&gt;&gt;(); private List&lt;City&gt; visited = new LinkedList&lt;City&gt;(); private List&lt;City&gt; beenThere = new LinkedList&lt;City&gt;(); public List&lt;List&lt;City&gt;&gt; BFS(Graph graph, City from, City to) { List&lt;List&lt;City&gt;&gt; rute = new ArrayList&lt;List&lt;City&gt;&gt;(); Queue&lt;City&gt; toVisit = new LinkedList&lt;City&gt;(); toVisit.add(from); beenThere.add(from); while(!toVisit.isEmpty()) { City node = toVisit.remove(); visited.add(node); Queue&lt;City&gt; neighbors = new LinkedList&lt;City&gt;(); neighbors = this.getNeighbors(node); while(!neighbors.isEmpty()) { visited.add(neighbors.element()); checkRoute(neighbors.remove()); } if (beenThere.get(beenThere.size()-1).equals(to)) rute.add(beenThere); beenThere.clear(); beenThere.add(from); } return rute; } I have modified the BFS and added a new function. It doesn't work. Could you please help me figure it out what I'm doing wrong..
has comment: http://stackoverflow.com/comment/34405626
downvote count: 0
has comment: http://stackoverflow.com/comment/34366218
has comment: http://stackoverflow.com/comment/34365297
has answer: http://stackoverflow.com/a/33760703
has title: Find all paths between 2 given nodes
favorite count: 0

http://stackoverflow.com/q/22558214
linked to: http://stackoverflow.com/q/15790369
type: Question
has answer: http://stackoverflow.com/a/22558365
downvote count: 0
score: 4
answer count: 3
linked to: http://stackoverflow.com/q/3721963
tagged with: android
upvote count: 4
linked to: http://stackoverflow.com/q/20113448
favorite count: 0
possible better answer: http://stackoverflow.com/a/22558365
has answer: http://stackoverflow.com/a/22575494
accepted answer: http://stackoverflow.com/a/22575494
tagged with: calendar
has answer: http://stackoverflow.com/a/65685251
has body: I have working in android calender. i have add event in Calender programmatically using android app. I have Also Refer this links :IllegalArgumentException: Unknown URL content://com.android.calendar/events when inserting an event to the calendar on Android Adding events to native calendar is not working but is not working in my code . my Code is: ContentValues contentEvent = new ContentValues(); // Particular Calendar in which we need to add Event contentEvent.put("calendar_id", AlarmId); // Title/Caption of the Event contentEvent.put("title", "Wedding"); // Description of the Event contentEvent.put("description", "Wedding Party"); // Venue/Location of the Event contentEvent.put("eventLocation", "New York"); // Start Date of the Event with Time contentEvent.put("dtstart", l); // End Date of the Event with Time contentEvent.put("dtend", l+60*1000); // All Day Event contentEvent.put("allDay", 1); // Set alarm for this Event contentEvent.put("hasAlarm",1); contentEvent.put("eventTimezone", android.text.format.Time.getCurrentTimezone()); Uri eventsUri = getCalendarURI(false); // event is added successfully getContentResolver().insert(eventsUri, contentEvent); // Uri uri = cr.insert(CalendarContract.Events.CONTENT_URI, values); public Uri getCalendarURI(boolean eventUri) { Uri calendarURI = null; if (android.os.Build.VERSION.SDK_INT &lt;= 7) { calendarURI = (eventUri) ? Uri.parse("content://calendar/events") : Uri.parse("content://calendar/calendars"); } else { calendarURI = (eventUri) ? Uri .parse("content://com.android.calendar/events") : Uri .parse("content://com.android.calendar/calendars"); } return calendarURI; } My issue Is: When i have run my application that time this error have been generated. so how can i solve this error ? error is: java.lang.IllegalArgumentException: Unknown URL content://com.android.calendar/ thank you in Advance
type: AnsweredQuestion
has title: Android : Error in Add event of Calender : Unkown URL
tagged with: java

http://stackoverflow.com/a/22712230
has comment: http://stackoverflow.com/comment/34612332
type: Answer
has comment: http://stackoverflow.com/comment/34612617
has body: The PersistenceAnnotationBeanPostProcessor is the Spring component that handles entity manager injection in Spring components. It targets components where the @PersistenceContext annotation was applied. When the Spring context is destroyed at job stop time, the post processor will clean a static cache that it holds of entity managers that are running in extended mode. One way that RestOperationsWithAuthentication could have ended up in this cache is if an EntityManager is injected in that class, which should not be. One solution and a best practice is not to inject entity managers only in the persistence layer, and not the web layer controllers or the persistence layer. Also if the job is stopping and the JVM is being shutdown, you can safelly ignore this message. The only reason why the destroy method tries to clean the cache is to prevent memory leaks upon redeployment. If during a redeployment the cache was kept populated, objects inside the class would reference via their class object the classloader, preventing the old version of the application from being garbage collected. If the job halting does not mean that the JVM is shutdown, then this error is indeed something to worry about as it indicates a potencially big memory leak, where lots of classes of a previous version of the application are left hanging around.
answers question: http://stackoverflow.com/q/22616260
has comment: http://stackoverflow.com/comment/34615182
score: 0

http://stackoverflow.com/q/22599204
has body: i know this question been asked before but i didn't find the solution yet, i wrote an android app but it didn't work and i don't know what is the problem, i almost try any thing so please help !! this is my code : MainActivity java:- package com.startPoint.gmap; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import android.os.Bundle; import android.support.v4.app.FragmentActivity; public class MainActivity extends FragmentActivity { private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); map=((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); map.setMapType(GoogleMap.MAP_TYPE_NORMAL); } } Manifest:- &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.startPoint.gmap" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="18" android:targetSdkVersion="18" /&gt; &lt;permission android:name="com.startPoint.gmap.MAPS_RECEIVE" android:protectionLevel="signature"&gt;&lt;/permission&gt; &lt;uses-permission android:name="com.startPoint.gmap.permission.MAPS_RECEIVE"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt; &lt;uses-permission android:name="com.startPoint.gmap.providers.gsf.permissions.READ_GSEREVICES"/&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true"/&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppThe…
tagged with: google-maps
has title: android, google map v2 app
has comment: http://stackoverflow.com/comment/34415375
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22631154
type: Question
tagged with: android
linked to: http://stackoverflow.com/q/21863498
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/19843784
tagged with: java
has answer: http://stackoverflow.com/a/22599281

http://stackoverflow.com/a/22630594
has comment: http://stackoverflow.com/comment/34467736
score: 1
upvote count: 1
has body: Maybe, you should use full qualified class name including the package name while specifying class parameter of the bean element. Like in the 'connectionFactory' bean above the 'pooledSQLConnectionFactory'.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22623410
answers question: http://stackoverflow.com/q/22623410
type: Answer
has comment: http://stackoverflow.com/comment/34467826

http://stackoverflow.com/q/22525057
has title: Hit Api and get Response using http post and curl
has answer: http://stackoverflow.com/a/22525644
score: 0
has comment: http://stackoverflow.com/comment/34276241
answer count: 1
accepted answer: http://stackoverflow.com/a/22525644
tagged with: php
tagged with: curl
type: AnsweredQuestion
tagged with: java
has body: Hello every one i am a junior php developer i am working on converting java code to php.. on Java api hit and get response correctly and now i am trying to hit using curl http post in php this is my task in my software house plz help me i am gonna show you my java code which is correctly working and then my php code which is not working and not parsing params to that api so pls kindly guide me This is my Java Code This is working correctly i want to do this same work from php import java.io.*; import java.util.jar.JarException; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.json.*; class MyCode{ public static void main(String[] args) throws JarException, JSONException { testCustomerApiIsExposed(); } public static void testCustomerApiIsExposed() throws JarException, JSONException { try { @SuppressWarnings("deprecation") HttpClient c = new DefaultHttpClient(); HttpPost p = new HttpPost("http://link"); String payload = "{id:\"" + 1 + "\"," + "method:\"" + "customerApi.getApiToken" + "\", params:[\"teabonezenminddemo1partner@gmail.com\", \"demo1234!\", \"\", \"\", \"\", \"\", \"\", false, \"\", \"\"" + "]}"; String mimeType=""; /*There is something here. What constructor are we really calling here? */ // p.setEntity(new StringEntity( payload,ContentType.create("application/json"))); p.setEntity(new StringEntity(payload)); HttpResponse r = c.execute(p); BufferedReader reader = new BufferedReader(new InputStreamReader(r.getEntity().getContent(), "UTF-8")); StringBuilder builder = new StringBuilder(); for (String line = null; (line = reader.readLine()) != null;) { builder.append(line).append("\n"); } JSONTokener tokener = new JSONTokener("[" + builder.toString() + "]"); JSONArray finalResult = new JSONArray(tokener); JSONObject o = finalResult.getJSONObject(0); //Getting names of the JSO…
tagged with: http
type: Question

http://stackoverflow.com/q/22614108
has body: I have a requirement that i have some String values and i have to save the values somewhere say in a list.And the values once i inserted into the list should remain there.So that if i want to use that values later i should not put those values in the list again.i am giving a simple piece of code to illustrate my problem... public class Chkrecords { public static void main(String a[]){ List&lt;String&gt; inti=new ArrayList&lt;&gt;(); String arr[]={"a","b","c","d"}; // for(int i=0;i&lt;arr.length;i++){ // // inti.add(String.valueOf(arr[i])); // } System.out.println(inti); } } this is the piece of code i am trying to implement ... the for loop is going to insert the values for the first time.And from then i don't want to use that loop again,but i want the values be in the list..Can anyone help me....
has title: How to save a value of a String variable and use it later when i wish even every time i run the code?
tagged with: java
has comment: http://stackoverflow.com/comment/34434351
type: Question
answer count: 2
downvote count: 5
has comment: http://stackoverflow.com/comment/34434327
has answer: http://stackoverflow.com/a/22614538
has answer: http://stackoverflow.com/a/22614215
favorite count: 0
has comment: http://stackoverflow.com/comment/34434346
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/34434571
has comment: http://stackoverflow.com/comment/34434474
upvote count: 1

http://stackoverflow.com/comment/34447330
score: 0
type: Comment
has text: Great tip mate, nice complement to the answer, I will make sure to experiment on such ^^ Thank you
type: AnswerComment
comment on: http://stackoverflow.com/a/22620964

http://stackoverflow.com/q/22617023
tagged with: java
has answer: http://stackoverflow.com/a/22636425
type: Question
upvote count: 1
tagged with: android-view
has body: I'm creating an android application and got into issues already in the first stage. I'm trying to display an image with an ImageView inside a Layout. My code is as follows: activity_starter.xml: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" 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=".StarterActivity" &gt; &lt;ImageView android:id="@+id/starterPic" android:layout_width="0dp" android:layout_height="160dp" android:layout_gravity="center" android:layout_weight="0.84" android:adjustViewBounds="true" android:contentDescription="@string/app_name" android:src="@drawable/ic_launcher" android:visibility="visible" /&gt; &lt;/LinearLayout&gt; and StarterActivity.java: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_starter); Log.i(LOG_TAG, "Entered Starter Screen"); ImageView mImageView = (ImageView) findViewById(R.id.starterPic); mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER); mImageView.setImageResource(R.drawable.ic_launcher); mImageView.setVisibility(ImageView.VISIBLE); mImageView.invalidate(); } The issues are: I can't hide the title bar on the top (black bar says "WhereIsIt" (app. name)). The image in the imageview is not shown. I've been digging into this for hours, what am I doing wrong?
downvote count: 0
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/22617495
tagged with: android
has answer: http://stackoverflow.com/a/22636684
has comment: http://stackoverflow.com/comment/34441110
has title: ImageView is NOT SHOWING in a linear layout (android)
type: UnansweredQuestion
tagged with: android-imageview
has comment: http://stackoverflow.com/comment/34440954
tagged with: android-layout
has answer: http://stackoverflow.com/a/22659409
has answer: http://stackoverflow.com/a/22617655
score: 1

http://stackoverflow.com/comment/34477423
type: QuestionComment
comment on: http://stackoverflow.com/q/22638280
has text: You may have to do both, and have some time-delayed decisioning logic before you decide to "do" anything.
score: 0
type: Comment

http://stackoverflow.com/q/22532125
linked to: http://stackoverflow.com/q/5432063
tagged with: sqlite
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/34289082
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22532475
linked to: http://stackoverflow.com/q/20608543
upvote count: 1
has title: Replacing single quotes with double quotes in Android database insertion statement
has answer: http://stackoverflow.com/a/22532181
has body: Suppose I have an execquery statement like this: db1.execSQL("insert into "+TABLE_NAME+" values('"name"')"); where name is a string variable which contains an apostrophe. For example: name = "tom's database"; In this case, I get an SQLITEexception near this statement. I am certain that this is because of that single quote. How to modify this such that the statement does not cause a crash and the name get stored in the db with the single quote intact? I read online that every such single quote has to be prefixed by another single quote. Can someone provide the code for the same?
has comment: http://stackoverflow.com/comment/34288546
tagged with: java
has answer: http://stackoverflow.com/a/22532393
downvote count: 1
has answer: http://stackoverflow.com/a/22532492
type: Question
has comment: http://stackoverflow.com/comment/34288096
has comment: http://stackoverflow.com/comment/34288652
has comment: http://stackoverflow.com/comment/34288192
score: 0

http://stackoverflow.com/q/22554332
linked to: http://stackoverflow.com/q/1069066
has answer: http://stackoverflow.com/a/22554643
has answer: http://stackoverflow.com/a/22554447
has comment: http://stackoverflow.com/comment/34327054
type: AnsweredQuestion
tagged with: instance
possible better answer: http://stackoverflow.com/a/22554447
tagged with: java
linked to: http://stackoverflow.com/q/421280
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/22554643
tagged with: instantiation
has title: Find which class an object was instantiated in
score: 0
tagged with: call-hierarchy
has body: I am trying to learn unnecessarily complicated source code. There is a method public void passObject(SomeObject someObject), and I want to know which class someObject was instantiated in. The problem is, as we traverse up the call hierarchy, the branching factor is very large. For example, three methods can pass someObject through passObject, and three methods before these three methods can pass the same object respectively. Is there some method that I can insert into passObject such as: public void passObject(SomeObject someObject) { whereDidThisComeFrom(someObject); // Should print the class (perhaps) where someObject was instantiated. // //do the other stuff that passObject is supposed to do. } I use Eclipse.
answer count: 2

http://stackoverflow.com/comment/34342771
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22563119
has text: Your question does not match the example code and it is quite difficult to understand what you're really asking, but by experience, odd things when handling times between 2AM and 3AM are often related to DST.
score: 2

http://stackoverflow.com/comment/34433391
has text: As an aside, replace the first two lines with `List<String> classDates = dates.getClassdates();`. There's no point creating an instance, if you re-assign the reference on the next line
comment on: http://stackoverflow.com/q/22613534
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/22628018
score: 0
answer count: 3
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/22628193
possible better answer: http://stackoverflow.com/a/22628142
has comment: http://stackoverflow.com/comment/34459334
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22628142
has comment: http://stackoverflow.com/comment/34462718
has answer: http://stackoverflow.com/a/23192498
accepted answer: http://stackoverflow.com/a/23192498
has body: I am stuck with opening an eclipse project using java program. Program: IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); System.out.println("Root path: "+root.getFullPath().toString()); Result: Root path: / Aim: My project is located at suppose path : C:/User/XYX/workspace/project2 Step 1: I want to open this workspace Step 2: A particular project within the workspace - say project2 Step 3: Refresh the project Can anyone please help me with this?
tagged with: eclipse
has title: How to get a control on eclipse workspace or project through java program

http://stackoverflow.com/a/22531982
type: Answer
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22529161
has body: Is performance more important to you than writing simple correct robust and maintainable code? If not, forget it. Performance depends on the XSLT processor you are using. For example Saxon and XSLTC are both considerably faster than the default JDK processor (interpretive Xalan). And the relative performance of different ways of writing your code also depends on which processor you are using; one way of writing it might be faster with Xalan, a different way with Saxon. Performance also depends on how you run the processor; for example Saxon is ten times faster with its own native tree model than when run against a DOM. Answers to questions such as "which is faster" are unreliable. The reliable way to get the answer to such a question is to make careful measurements. ("Careful" means, for example, taking care to ensure that you are discounting the effect of Java warm-up time, unless Java warm-up time is part of your production workload.)
answers question: http://stackoverflow.com/q/22529161

http://stackoverflow.com/comment/34300067
score: 0
comment on: http://stackoverflow.com/a/22538730
type: Comment
type: AnswerComment
has text: Yes that was it. After changing the status object to global it functioned as expected. Thanks

http://stackoverflow.com/a/22619670
has comment: http://stackoverflow.com/comment/34502681
has body: You can try to parse the string with SimpleDateFormat, something like SimpleDateFormat sd = new SimpleDateFormat("yyyyMMddHHmmssSSz"); Date date = sd.parse("2014030902101100GMT-05:00"); and for the z (timezone) parameter you could add GMT-05:00 (New York offset from GMT/UTC) to the timestamp string that you have at hand. After this you can convert to what ever you would like. simpledateforamt.parse will give you date (java.util.date). Convesion from date to Timestamp is straight forward. long ms = date.getTime(); Timestamp t = new Timestamp(ms);
has comment: http://stackoverflow.com/comment/34479164
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22578168

http://stackoverflow.com/q/22620279
type: Question
answer count: 1
downvote count: 0
tagged with: keyboard
favorite count: 0
type: UnansweredQuestion
has body: I am attempting to use a swipe gesture to finish a fragment, and if the fragment is displaying the keyboard, the keyboard will be hidden. The following is a sample: public void finishFragment() { View focus = getCurrentFocus(); InputMethodManager imm = null; if (focus != null) { imm = (InputMethodManager) focus.getContext(). getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { imm.hideSoftInputFromWindow(focus.getWindowToken(), 0); } } if (getFragmentManager().getBackStackEntryCount() &gt; 1) { getFragmentManager().popBackStack(); } } Unfortunately, since I am calling a service along side the fragment stack, the service is hanging up the UI display, thus giving it a laggy appearance. Does anyone know how I can hide the keyboard without calling a service or should I call an Async process? Even better, does anyone know how onBackPressed() removes the keyboard?
tagged with: android
tagged with: android-fragments
score: 1
tagged with: java
upvote count: 1
has title: Prevent android keyboard form causing lag
has answer: http://stackoverflow.com/a/22622081

http://stackoverflow.com/a/22634301
answers question: http://stackoverflow.com/q/22633709
score: 0
has comment: http://stackoverflow.com/comment/34470102
type: Answer
has body: Try calling createRegistry() first to make sure that you have a running registry. Also, port 0 should be a reserved port so you won't be able to make your server listen on that particular port. Try the default one 1099.
has comment: http://stackoverflow.com/comment/34473049

http://stackoverflow.com/a/22536635
score: 0
answers question: http://stackoverflow.com/q/22535736
has body: If you want to initialize it "outside" the method, why not hand it over like that: create(new BufferedReader(reader, 3)); Or how exactly do you want it to have instantiated? For the instantiation, you need a Reader, which can be handed over. If you want to create a Reader from a file, the answer is also in the following link. How to read special characters with a BufferedReader: Read special characters in java with BufferedReader
type: Answer

http://stackoverflow.com/a/22610424
has comment: http://stackoverflow.com/comment/78478791
has body: In general, no. The backwards compatibility means that you can run Java 7 program on Java 8 runtime, not the other way around. There are several reasons for that: Bytecode is versioned and JVM checks if it supports the version it finds in .class files. Some language constructs cannot be expressed in previous versions of bytecode. There are new classes and methods in newer JRE's which won't work with older ones. If you really, really want (tip: you don't), you can force the compiler to treat the source as one version of Java and emit bytecode for another, using something like this: javac -source 1.8 -target 1.7 MyClass.java (the same for Maven), and compile against JDK7, but in practice it will more often not work than work. I recommend you don't. EDIT: JDK 8 apparently doesn't support this exact combination, so this won't work. Some other combinations of versions do work. There are also programs to convert newer Java programs to work on older JVM's. For converting Java 8 to 5-7, you can try https://github.com/orfjackal/retrolambda To get lower than 5, you can pick one of these: http://en.wikipedia.org/wiki/Java_backporting_tools None of these hacks will give you new Java 8 classes and methods, including functional programming support for collections, streams, time API, unsigned API, and so on. So I'd say it's not worth it. Or, since you want to run your Java 8 JEE applications on an application server, just run your entire server on Java 8, it may work.
downvote count: 1
has comment: http://stackoverflow.com/comment/34427865
has comment: http://stackoverflow.com/comment/34445586
has comment: http://stackoverflow.com/comment/34429106
has comment: http://stackoverflow.com/comment/34446140
has comment: http://stackoverflow.com/comment/34427771
has comment: http://stackoverflow.com/comment/34433340
score: 80
answers question: http://stackoverflow.com/q/22610400
has comment: http://stackoverflow.com/comment/34450964
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34433555
accepted answer of: http://stackoverflow.com/q/22610400
upvote count: 81
has comment: http://stackoverflow.com/comment/104123592
type: Answer
has comment: http://stackoverflow.com/comment/34444704

http://stackoverflow.com/q/22501573
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22501932
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22501879
tagged with: debugging
accepted answer: http://stackoverflow.com/a/22501804
has comment: http://stackoverflow.com/comment/34234324
has comment: http://stackoverflow.com/comment/34234174
score: -1
tagged with: eclipse
has body: I was given an empty class and instructed to fill it with instance variables and methods with bodies, which set or get values from the instance variables. Then I am to open another java file where code creating a new Contact object was provided and instructed to add additional code that uses that object to test all the methods created in the Contact class. I am using the program Eclipse for coding/testing. The only things are correct are my method headers. When testing with what I have written (below) I get a null, null response (that is when I remove what wrote about the setPhoneNumber. When it's included I get a worse looking error Exception in thread "main" java.lang.Error: Unresolved compilation problem: phoneNumber cannot be resolved to a variable.) Any assistance on getting the get/set methods to work will be much appreciated. I am entirely new to any programming and have looked at about dozens of examples and have tried many variations with no success. public class Contact { //Instance Variables private String firstName; private String lastName; private int phoneNumber; public String getFirstName() //method to retrieve first name { return this.firstName; } public void setFirstName(String firstName) //method to set the first name { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getPhoneNumber() { return this.phoneNumber; } public void setPhoneNumber(int phoneNumber) { this.phoneNumber = phoneNumber; } public void call() { System.out.printf(getFirstName(), getLastName(), getPhoneNumber()); } } Here is the other java file used to test the Contact class above: public class ContactTestDriver { public static void main(String[] args) { Contact contact = new Contact(); //all above was given; below are my code additions String myContact; myContact = contact.getFirstName(); contact.setFirstName(); System.out.println(myContact); myContact = contact.getLastNa…
has title: How to debug a java code with getters and setters?
has answer: http://stackoverflow.com/a/22501811
upvote count: 0
tagged with: junit
favorite count: 0
possible better answer: http://stackoverflow.com/a/22501811
answer count: 5
has answer: http://stackoverflow.com/a/22501804
has answer: http://stackoverflow.com/a/22501892
has comment: http://stackoverflow.com/comment/34234246
has comment: http://stackoverflow.com/comment/34236165

http://stackoverflow.com/q/22639865
tagged with: installation
has answer: http://stackoverflow.com/a/25166516
has comment: http://stackoverflow.com/comment/34480639
answer count: 8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34480242
downvote count: 0
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/25572217
has answer: http://stackoverflow.com/a/23585956
type: Question
has comment: http://stackoverflow.com/comment/34480366
has body: I have researched this and none of the solutions that I have seen have fixed my error. What is happening is I tried to install Java EE version got the above error and then found out that I must install Java SE first. So I installed Java SE and set the JAVA_HOME variable to C:\Program Files\Java\jdk1.8.0 which is where I installed my JDK. I also put C:\Program Files\Java\jdk1.8.0\bin in my PATH variable. Still not working. I also tried the JAVA_HOME variable with C:\Program Files\Java\jdk1.8.0\bin and that didn't work. I also tried installing without the PATH variable being updated to where I put my JDK. I'm really getting confused as to why this is happening. I've had Java before and I don't recall having this much trouble installing it. PS I don't install from the command line I just click the download icon in Firefox and then click the download.
has comment: http://stackoverflow.com/comment/34535983
has answer: http://stackoverflow.com/a/31831380
has answer: http://stackoverflow.com/a/25702527
favorite count: 0
has answer: http://stackoverflow.com/a/53645715
upvote count: 7
has title: How to fix error: could not find the required version of the Java(TM) 2 runtime environment in '(null)'
has answer: http://stackoverflow.com/a/22640143
has comment: http://stackoverflow.com/comment/34535963
accepted answer: http://stackoverflow.com/a/22640143
has answer: http://stackoverflow.com/a/33643655
possible better answer: http://stackoverflow.com/a/23585956

http://stackoverflow.com/comment/34251892
type: AnswerComment
type: Comment
has text: short & simple but awesome
comment on: http://stackoverflow.com/a/22511814
score: 0

http://stackoverflow.com/comment/34411151
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22600964
has text: In the code you provided you create an `AlertDialog.Builder` named `builder2` but immediately start using `builder` instead. Could this be the source of your problem?
score: 0

http://stackoverflow.com/comment/34327256
comment on: http://stackoverflow.com/q/22554310
score: 0
type: QuestionComment
has text: possible duplicate of [Does Java have a limit on the class name length?](http://stackoverflow.com/questions/1039029/does-java-have-a-limit-on-the-class-name-length)
type: Comment

http://stackoverflow.com/comment/34426173
has text: `it works well for certain cases` tell us when/where it not works as you expected.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22609487
score: 0

http://stackoverflow.com/a/22580414
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22577509
type: Answer
accepted answer of: http://stackoverflow.com/q/22577509
score: 1
has body: You seem to have the path you want with getServletContext().getRealPath("/") so you could define a global parameter &lt;xsl:param name="dir"/&gt; in your XSLT, use that as in &lt;xsl:result-document href="{$dir}/{@name}.js" format="js"&gt; and then set transformer.setParameter("dir", new File(getServletContext().getRealPath("/")).toURI().toString()); before running the transformation.

http://stackoverflow.com/q/22502869
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22502960
type: Question
has comment: http://stackoverflow.com/comment/34236215
accepted answer: http://stackoverflow.com/a/22502960
answer count: 1
has body: I created an application to parse Json data from server to my app. But now When I run the project I get a JSONArray cannot be converted to JSONObject exception.I get all the server data in my LogCat view but not in the application. I tried with different methods but had no luck. Thank you. // This is my main code public class jsonExample2 extends Activity{ // This is the url that i try to get data private static String url = "http://api.worldbank.org/countries/ir?format=json"; private static final String PAGE = "page"; private static final String VALUE = "value"; private static final String NAME = "name"; private static final String GEO = "region"; JSONArray page = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activitybw); new GetJSONTask().execute(url); } class GetJSONTask extends AsyncTask&lt;String, Void, JSONObject&gt; { protected JSONObject doInBackground(String... urls) { try { JSONParser jParser = new JSONParser(); return jParser.getJSONFromUrl(urls[0]); } catch (Exception e) { return null; } } protected void onPostExecute(JSONObject json) { // do all the parsing here: try { page = json.getJSONArray(PAGE); JSONObject c = page.getJSONObject(0); String value = c.getString(VALUE); String name = c.getString(NAME); String geo = c.getString(GEO); final TextView id1 = (TextView) findViewById(R.id.id); final TextView name1 = (TextView) findViewById(R.id.name); final TextView geo1 = (TextView) findViewById(R.id.geo); id1.setText(value); name1.setText(name); geo1.setText(geo); } catch (JSONException e) { e.printStackTrace(); } } } } // JSONParser class public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; public JSONParser() { } public JSONObject getJSONFromUrl(String url) { // Making HTTP request try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse …
tagged with: android
type: AnsweredQuestion
has title: Error JSONArray cannot be converted to JSONObject
score: 0

http://stackoverflow.com/a/22632689
score: 0
type: Answer
has body: To get 2 decimal places before the digits and one after you can do the following. String s = String.format("%4.1f", d / Math.pow(10, (int) (Math.log10(Math.abs(d)) - 1))); Of course believing that the number after 999 => 99.9 is 1000 => 10.0 is just madness.
answers question: http://stackoverflow.com/q/22631089

http://stackoverflow.com/comment/34385968
type: AnswerComment
comment on: http://stackoverflow.com/a/22586886
type: Comment
has text: Well, it's meant to be used like this: `TapeObject mygate = TapeObject.create("g");` should do the same like `TapeObject mygate = new Gate ("mygate");`
score: 0

http://stackoverflow.com/a/22502489
has body: You can export using pl/sql: http://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_api.htm#sthref460 You can just invoke the pl/sql code from java. (see this http://www.dbforums.com/oracle/1690300-using-data-pump-java.html for example)
score: 0
answers question: http://stackoverflow.com/q/22501612
type: Answer

http://stackoverflow.com/comment/34371082
has text: Thanks also @Klemens Morbe
comment on: http://stackoverflow.com/a/22578477
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34406315
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22598076
has text: Another issue may be that you are clearing `beenThere` The same copy of `beenThere` is held in your `ArrayList`, so when you clear `beenThere` you are also clearing it in `rute`

http://stackoverflow.com/comment/34292579
type: QuestionComment
score: 1
has text: You've mixed up too many things in your question, and it is making it hard to understand. Moreover, you don't tell what error you get wherever you're saying it doesn't work. What issues you faced while making `BirdLifestyle` implement the `AvianLifestyleInterface` interface?
comment on: http://stackoverflow.com/q/22534376
type: Comment

http://stackoverflow.com/comment/34242636
type: Comment
has text: It was only example - now file B is also a xml file.
comment on: http://stackoverflow.com/q/22503769
score: 0
type: QuestionComment

http://stackoverflow.com/q/22603531
upvote count: 3
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22604003
score: 2
answer count: 1
has body: Hi i am relatively new to Scala, i would like to try this Play 2 Framework and stuck with the following code (used as a template) @todoTasks.groupBy(_.project).map { case (project, tasks) => { @project.name @tasks.map { task => @task.title } } } What does this line mean? @todoTasks.groupBy(_.project).map { and how do you use scala *.map in the context of Play 2 Framework. I'd appreciate it if you could explain it in exact detail as i am relatively new to Scala (coming from Java developer)
favorite count: 0
tagged with: scala
has title: What does this block of Scala code mean
tagged with: playframework-2.0

http://stackoverflow.com/q/22528848
tagged with: java
accepted answer: http://stackoverflow.com/a/22530038
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22530038
has title: java.lang.IllegalArgumentException: No SchemaFactory that implements the schema language specified
has body: I am getting the following exception: java.lang.IllegalArgumentException: No SchemaFactory that implements the schema language specified by: http://www.w3.org/2001/XMLSchema-instance could be loaded at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:204) at MAIN.SchemaImport3.validateXMLSchema(SchemaImport3.java:74) at MAIN.SchemaImport3.main(SchemaImport3.java:62) Here is my code: URL source; source = new URL(schemaList.getDocumentBaseURI()); SchemaFactory factory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
tagged with: wsdl
tagged with: http://stackoverflow.com/tag/xml
upvote count: 14
score: 14
type: AnsweredQuestion
tagged with: schema

http://stackoverflow.com/comment/34408289
score: 1
type: AnswerComment
has text: Thanks. Escaping the json helped. I already have the content type set, just failed to include it. thanks!
comment on: http://stackoverflow.com/a/22597714
type: Comment

http://stackoverflow.com/comment/34301033
comment on: http://stackoverflow.com/q/22538677
has text: @CianGallagher - I agree. I'm planning on moving to Amazon once the site is in production. It's cheaper for me to develop here though. =)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22630398
downvote count: 1
has answer: http://stackoverflow.com/a/22630751
has comment: http://stackoverflow.com/comment/34463289
has answer: http://stackoverflow.com/a/22630475
has answer: http://stackoverflow.com/a/22630529
has answer: http://stackoverflow.com/a/22630484
tagged with: java
has answer: http://stackoverflow.com/a/22630876
has answer: http://stackoverflow.com/a/22630472
type: Question
has body: I am trying to do the following program in Java where I'm writing a recursive and an iterative method to compute the sum of all odd numbers from n to m import java.util.Scanner; public class AssignmentQ7 { public static int recursivesum(int n, int m){ if (n &lt; m){ int s = n; s += recursivesum(n+2, m); } else{ if(m &lt; n){ int s = m; s += recursivesum(m+2, n); } } return s; } public static int iterativesum(int n, int m){ if(n &lt; m){ int s = n; for(int i = n; i &lt;= m; i += 2){ s += i; return s; } } else if(m &lt; n){ int s = m; for(int i = m; i &lt;= n; i += 2){ s += i; return s; } } } public static void main(String args[]){ int n,m; Scanner in = new Scanner(System.in); System.out.println("Enter two numbers: "); n = in.nextInt(); m = in.nextInt(); while(n%2 == 0){ System.out.println("Enter the first number again: "); n = in.nextInt(); } while(m%2 == 0){ System.out.println("Enter the second number again: "); m = in.nextInt(); } System.out.println("The answer of the recursive sum is: " + recursivesum(n,m)); System.out.println("The answer of the iterative sum is: " + iterativesum(n,m)); } } I'm getting an error cannot find symbol - variable enter code heres. I don't know what's wrong! Can anyone help please?
has answer: http://stackoverflow.com/a/22630537
has title: Cannot find symbol - variable java
has answer: http://stackoverflow.com/a/22630685
has answer: http://stackoverflow.com/a/22630540
favorite count: 0
has comment: http://stackoverflow.com/comment/34463308
score: 0
has comment: http://stackoverflow.com/comment/34463774
has answer: http://stackoverflow.com/a/22630502
answer count: 10
has comment: http://stackoverflow.com/comment/34463259
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/140094532
has text: Why `new Rectangle(comp.getBounds())` rather than just `comp.getBounds()`?
comment on: http://stackoverflow.com/a/22533633
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34396138
has text: Yes. A common use in Android is to create custom view objects with their own properties and then to add those views to the layout XML. The properties can have any type of data that can be represented as string inside the XML - which, with the right encoding/escaping, can be anything! Because of OOP, you can even extend existing views and add your own properties which are set alongside the other properties in the XML - e.g. `<MyTextView android:text="some text" myNameSpace:myProperty="some value which is whatever I want"/>`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22592168
type: Comment

http://stackoverflow.com/comment/34509264
type: Comment
score: 2
has text: Using StAX you are in a way forced to sequential processing. StAX reads simply the elements of XML one by one. So here no aggregation is possible. That is the thing you have to code. If this XML is from a structural point of view a fixed one, you should look into JAXB or a similar framework for pojo mapping. This frameworks deliver you a complete parsed class structure and all the magic of XML parsing, encoding, tags, attributes and so on is completly hidden from you.
type: AnswerComment
comment on: http://stackoverflow.com/a/22648893

http://stackoverflow.com/a/22634597
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22634450
has body: Don't use them separately, use the delimiters together, like : String dataArr\[\] = data.split("\t\n",1); Then iterate through the String[]: for (int i = 0; i &lt; dataArr.length; i+=2) { String name = dataArr[i]; String food = dataArr[i+1]; // ... do whatever you want with them. } Or, you could also try the similar Pattern-Matcher approach
downvote count: 0
type: Answer

http://stackoverflow.com/q/22581886
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22582002
has answer: http://stackoverflow.com/a/22582007
has comment: http://stackoverflow.com/comment/34376717
has body: I'm using OS X (10.9 Mavericks) and I've got no idea why this code is giving me a blank output - meaning it gives no output at all, not even an exception. Code snippet (created using ItelliJ IDEA): public static void main(String[] args) { String textFile = "hello.txt"; try { FileWriter scribe = new FileWriter(textFile, true); scribe.write("Hello! Is it me you're looking for?"); scribe.close(); } catch (IOException iox) { System.out.println("ERROR with: " +textFile); } } Upon further inspection, it was simply an error with the 'cat' terminal command somehow failing to find the files on the system. Thanks to everyone who pitched in :)
has comment: http://stackoverflow.com/comment/34376602
answer count: 2
has comment: http://stackoverflow.com/comment/34376542
has comment: http://stackoverflow.com/comment/34376707
tagged with: macos
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34377954
has title: Problems with Java's FileWriter (OS X)
has comment: http://stackoverflow.com/comment/34376863
score: 0
tagged with: java
tagged with: filewriter
has comment: http://stackoverflow.com/comment/34376770
upvote count: 1
has comment: http://stackoverflow.com/comment/34376828

http://stackoverflow.com/comment/34281618
type: QuestionComment
comment on: http://stackoverflow.com/q/22525398
has text: hi Aleksandr M i am passing intercepter ref in the action tag,so before sucess it should check session value in intercepter class..there i am checking session status..if its null the i am redirecting it to login page..bt its not working before calling result page its not checking session in intercepter class.
score: 0
type: Comment

http://stackoverflow.com/comment/69934423
comment on: http://stackoverflow.com/a/22626730
has text: This worked great, I'm such a doof, been struggling with a way to share variables across multiple classes without a new instance and didn't even think of this.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34244767
comment on: http://stackoverflow.com/q/22507590
has text: I realize now that I didn't provide all necessary information for troubleshooting this issue. Please see my updated original post for more details.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22487968
has comment: http://stackoverflow.com/comment/34211165
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/9243772
has answer: http://stackoverflow.com/a/27259617
type: Question
tagged with: java
score: 0
answer count: 1
has title: How set an xml element optional ?(using trang xml->xsd converter)
has comment: http://stackoverflow.com/comment/34211386
has body: I am trying to validate an xml which I get from the users. I propose a list of parameters (which may change every now and then) in an xml format with empty values. Users should fill in values and upload it. Then I should validate the uploaded xml and save the values in db(Mongodb). I tried trang to generate xsd from an xml file. It works but I do not know how to specify that user can leave some of these parameters without values. I read something about nillable =true or minoccurs=0 which is used in xsd, however, I don’t want to modify the generated xsd manually. Is there a better solution? If it is not possible with trang, which converter do you suggest?(I am using java)
type: UnansweredQuestion

http://stackoverflow.com/a/22572627
answers question: http://stackoverflow.com/q/22571550
score: 0
type: Answer
has body: If we change the package name to uppercase we have to check whether all references with that package got modified or not. As you are saying that if you try to run package names with lower case is working fine. If you try to modify the package names with IDE that will ask for updating references also. Once check that. NOTE: *As per java coding standards package names should be in lower case.*

http://stackoverflow.com/comment/34366991
type: Comment
comment on: http://stackoverflow.com/a/22576746
has text: Down votter please comment the mistake.
score: 1
type: AnswerComment

http://stackoverflow.com/a/22579134
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22579055
answers question: http://stackoverflow.com/q/22579055
type: Answer
upvote count: 1
has body: Got an example code from the H2DB tutorial site import java.sql.*; public class Test { public static void main(String[] a) throws Exception { Class.forName("org.h2.Driver"); Connection conn = DriverManager. getConnection("jdbc:h2:E:\\folder\\mydb", "sa", ""); // add application code here conn.close(); } }
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/22594163
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22594132
has comment: http://stackoverflow.com/comment/34398707
answers question: http://stackoverflow.com/q/22594132
type: Answer
downvote count: 0
score: 1
has body: You state: JSoup import not recognised in a method Your imports are actually being recognized just fine, but you need to remember that for Java, both spelling and capitalization are important. JSoup != Jsoup So change: this.catalogue = JSoup.parse(coll).text(); to: this.catalogue = Jsoup.parse(coll).text(); and make similar changes throughout your program.
upvote count: 1

http://stackoverflow.com/a/22612730
has body: You've defined your own Comparable interface which Integer does not implement. Remove the custom interface from your build path so that the built-in java.lang.Comparable can be used instead
type: Answer
accepted answer of: http://stackoverflow.com/q/22612662
score: 1
answers question: http://stackoverflow.com/q/22612662
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34418936
score: 0
has text: Java is case-sensitive so your code still would not work but the right answer to your question was posted anyways.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22605581

http://stackoverflow.com/a/22559026
type: AcceptedAnswer
downvote count: 0
has body: You should show to Hibernate how to manage relations between model classes Employee and Department. Annotations @ManyToOne and @OneToMany will help you. Employee @ManyToOne @JoinColumn(name = "department_id") private Department department; Department @OneToMany(mappedBy = "department") private List&lt;Employee&gt; list = new ArrayList&lt;Employee&gt;();
type: Answer
accepted answer of: http://stackoverflow.com/q/22558567
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22558567

http://stackoverflow.com/q/22564308
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34344703
has body: Now I've created an exception class but haven't created a constructor for it as shown public class InvalidChoiceException extends Exception { } but the catch block for that handles what I want to display. try { if(readFile.hasNextInt() == false) throw new InputMismatchException(); else { num = readFile.nextInt(); readFile.nextLine(); } } catch (InputMismatchException e) { System.err.println("Integer expected"); e.printStackTrace(); System.exit(0); } Is this ok to do? edit: Let's just pretend input mismatch was a empty exception class even though it's not..
accepted answer: http://stackoverflow.com/a/22564448
has comment: http://stackoverflow.com/comment/34344728
type: Question
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22564448
has comment: http://stackoverflow.com/comment/34344928
tagged with: exception
has title: Making an exception class and leaving it empty

http://stackoverflow.com/comment/34468577
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22633262
type: AnswerComment
has text: There's an input type `hidden` that means you don't need to use the style. Oh and the OP is asking about, JSP, would be nice to give the example code as JSP too

http://stackoverflow.com/a/79427565
answers question: http://stackoverflow.com/q/22550958
upvote count: 0
type: Answer
downvote count: 1
has body: Let us consider the following piece of code : try(Resource1;Resource2;Resource3){ // Your Code Here } Now, we can take IO related resources, Network related resources or Database related resources. All of these resources should be AutoCloseable resources. Which means that the corresponding classes of these resources should implement AutoCloseable interface. All of these resources already implement the AutoCloseable Interface. AutoCloseable interface was introduced in 1.7 version of Java. This interface only has one method that is- public void close(){}
score: -1

http://stackoverflow.com/q/22517659
tagged with: jsp
has answer: http://stackoverflow.com/a/22517740
has title: Display HTML page after servlet is finished
has comment: http://stackoverflow.com/comment/34262801
has comment: http://stackoverflow.com/comment/34262742
type: UnansweredQuestion
tagged with: java
has body: I have a Servlet which accept username and password and authenticates it. After it is done, I want to display an HTML page. It is a big HTML page so I read that using writer.println() was not a good idea. How do I display the new page? I tried using sendRedirect but that, for some reason, displayed the same page (login page) again. Please help.
type: Question
has comment: http://stackoverflow.com/comment/34262845
has comment: http://stackoverflow.com/comment/34262880
tagged with: servlets
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22522635

http://stackoverflow.com/q/22552481
has title: Run keytool on php
tagged with: keystore
has comment: http://stackoverflow.com/comment/34324342
tagged with: cmd
has body: I need a php script to generate jks with keystore. What command should I use for it? exec() or system()? My code: exec("keytool -genkey -alias 1800 -keyalg RSA -keysize 2048 -validity 365 -keystore 1800.jks -keypass brsacquiro -storepass brsacquiro 2&gt;&amp;1", $return_var); foreach($return_var as $word) echo "$word&lt;br&gt;"; I get result: What is your first and last name? [Unknown]: What is the name of your organizational unit? [Unknown]: What is the name of your organization? [Unknown]: What is the name of your City or Locality? [Unknown]: What is the name of your State or Province? [Unknown]: What is the two-letter country code for this unit? [Unknown]: Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct? I get ten of these texts in a row. I need to answer the questions that are listed there. And at the end of this list I get error: keytool error: java.lang.RuntimeException: Too many retries, program terminated If I write this command in cmd, then all is ok.
has answer: http://stackoverflow.com/a/22557006
upvote count: 3
has comment: http://stackoverflow.com/comment/34324498
has comment: http://stackoverflow.com/comment/34324174
tagged with: php
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22557006
has comment: http://stackoverflow.com/comment/34324588
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34324560

http://stackoverflow.com/comment/34528192
comment on: http://stackoverflow.com/q/22643120
score: 0
has text: Yes - try what you said
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22595822
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34402316
score: 1
has comment: http://stackoverflow.com/comment/34402231
has comment: http://stackoverflow.com/comment/34402056
has body: If what you want is to retrieve from the recorset all its columns you could ask it how many columns does it have (n) and access from 1 to n: ResultSet result = stmt.executeQuery(); ResultSetMetaData md = result.getMetaData(); int nCols = md.getColumnCount(); for(int c = 1; c &lt;= nCols; c++) strResult.append(result.getString(c).append(" ")); Concerning your multiline commands, you could replace the command end of lines by spaces: query.replaceAll("(\\r|\\n)", " ");
has comment: http://stackoverflow.com/comment/34402420
has comment: http://stackoverflow.com/comment/34401850
has comment: http://stackoverflow.com/comment/34402540
has comment: http://stackoverflow.com/comment/34402018
has comment: http://stackoverflow.com/comment/34402393
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22595761
answers question: http://stackoverflow.com/q/22595761

http://stackoverflow.com/comment/34421349
score: 0
comment on: http://stackoverflow.com/q/22606654
type: Comment
type: QuestionComment
has text: All my apps are up-to-date. I've edited my question because I think something else might be wrong.

http://stackoverflow.com/a/22541894
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22541807
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/34305892
downvote count: 0
has comment: http://stackoverflow.com/comment/34305856
has body: You close the file after accepting one contact in the do .. while() loop: b.close(); No surprises that you see one contact. Close it outside of the loop instead.
upvote count: 6
answers question: http://stackoverflow.com/q/22541807

http://stackoverflow.com/comment/34501907
score: 0
type: AnswerComment
has text: Thanks for your suggestions and help.
type: Comment
comment on: http://stackoverflow.com/a/22634119

http://stackoverflow.com/comment/34377954
type: QuestionComment
has text: Fixed the bit about "no output" to make it clearer. I've tried changing the name to a couple of other things such as: "test_hello.txt" and "file_does_not_exist.txt" making sure there weren't any existing file mixups. I think I should add something: using terminal I ran 'cat hello.txt', as I expected nothing turns up. The file hasn't been written to the computer's drive at all.
score: 0
comment on: http://stackoverflow.com/q/22581886
type: Comment

http://stackoverflow.com/comment/34438051
type: QuestionComment
comment on: http://stackoverflow.com/q/22615671
score: 0
has text: And what is your problem? If you want to connect "a" and "c" directly, it is not possible, every message has to be send through the server.
type: Comment

http://stackoverflow.com/comment/35310230
comment on: http://stackoverflow.com/q/22611881
has text: what makes you think `100` in exception corresponds to number of trees? Can you post more of the stack trace please?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22489781
downvote count: 0
upvote count: 3
type: Answer
has body: Wouldn't this work: if (sum &gt; 0.0) { total.setText(String.format("%.2f", sum)); else { total.setText(""); }
score: 3
has comment: http://stackoverflow.com/comment/34214492
answers question: http://stackoverflow.com/q/22489718
accepted answer of: http://stackoverflow.com/q/22489718
type: AcceptedAnswer

http://stackoverflow.com/comment/34464915
type: AnswerComment
comment on: http://stackoverflow.com/a/22623040
type: Comment
has text: @justhalf Wait a sec while I bury my head in the ground, brb
score: 0

http://stackoverflow.com/q/22512772
has title: How to get assign a number from a list - JDBC JAVA SQL
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/34254642
score: 0
tagged with: sql
has body: I am having trouble with my database where I want to select from a range of stock (not a primary key) and assign them to the users in the system. For example, I have a field called stockCodes which consists of codes like CAB001-CAB100. This is not the primary key, and the primary key is in fact stockID. The table looks like this... ID | Stock Codes -------------------- 1 | CAB001-CAB100 2 | CBA100-CBA200 Now, how do I break down the stock codes so that I get a list like this in Java... CAB001 CAB002 CAB003 CAB004 CAB005 ... Please help.
answer count: 1
has answer: http://stackoverflow.com/a/22513275
accepted answer: http://stackoverflow.com/a/22513275
has comment: http://stackoverflow.com/comment/34254021
tagged with: jdbc

http://stackoverflow.com/comment/34285155
comment on: http://stackoverflow.com/q/22530253
has text: I don't think it is possible. You can try with segregate key in some way.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22607711
has body: "Here is the error: non-static variable lines cannot be referenced from a static context." You're getting this error because you're trying to access the lines in a static way, when lines isn't a static variable, it's an instance variable. So what to you want to do is get a reference to that instance variable. One way is to pass the frame reference to the panelWithButton through constructor injection, then you can access the instance field lines. Something like public class frame extends JFrame { private int lines; // private for encapsulation. getter/setter below ... panelWithButton panel = new panelWithButton(frame.this); ... public void setLines(int lines) { this.lines = lines; } } public class panelWithButton extends JPanel { private frame f; public panelWithButton(final frame f) { this.f = f; } public void button() { ... public void actionPerformed(ActionEvent e) { f.setLines(5); } } } By passing the same instance of frame to panelWithButton, it's able to access the instance members, like the method setLines. I used the private field with the setter as to not break the rules of encapsulation. There are better solutions to this common scenario though. This one is just one simple fix (bu with holes). This method exposes the frame class unnecesarily. What I would do in this particular situation is use some sort of MVC architecture. An easier solution would be to use an interface as a middleman and have the frame implement it (example here, but since all you want to do is manipulate data, the MVC design is the best approach. Side Notes Use Java naming convention. Class names begin with capital letters. UPDATE Here's an example of a simple MVC (Model, View, Controller) design, using some of your program ideas. I'll walk you through it. Model LinesModel class. The only property is has is an int lines. It has a setLines method. The special thing about this method is that it fires a property change event so when ever the method is called, the view can be changed public …
has comment: http://stackoverflow.com/comment/34436683
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22606293
answers question: http://stackoverflow.com/q/22606293
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/22547715
score: 0
has title: How to avoid hibernate insert empty string to my feild?
answer count: 1
has comment: http://stackoverflow.com/comment/34316677
has comment: http://stackoverflow.com/comment/34316536
has body: I have a Mysql table with a field name "password", I have set this field is NOT NULL in mysql. but hibernate always insert empty string to my table. so, I wander if there is a way to config hibernate treat empty string as null and let mysql throw an error that the field is not allow to be NULL.
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34316686
accepted answer: http://stackoverflow.com/a/22547742
type: Question
has comment: http://stackoverflow.com/comment/34316662
has comment: http://stackoverflow.com/comment/34316798
has answer: http://stackoverflow.com/a/22547742

http://stackoverflow.com/q/22621513
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22621587
has answer: http://stackoverflow.com/a/22621688
accepted answer: http://stackoverflow.com/a/22621587
possible better answer: http://stackoverflow.com/a/22621688
has body: Consider the following simple block of Java code: public static void main(String[] args) { int a = 7; double exp; for (int i=0; i&lt;71; ++i) { exp = Math.pow(a,i) % 71; if (exp == 59.0) System.out.printf("k=%d: %.0f%n", i, exp); } } I am trying to iterate through all of the exponents k such that a^x=59 mod 71... however there should be only a single one, and I'm getting three: k=3, k=23, k=63. This is clearly wrong, as upon verification, only k=3 is the correct answer. Is there some inherent problem in the way floating point works (and thus Math.pow), or is there some other logic problem in my code? Should I be using some other method to calculate a^x (mod n)?
tagged with: java
has title: Is there a better (more correct) way to calculate modulus of some power than Math.pow?
upvote count: 1
tagged with: floating-point
type: Question
type: AnsweredQuestion
tagged with: math
answer count: 2

http://stackoverflow.com/comment/34407441
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22546743
type: AnswerComment
has text: looking at that is like trying to learn Chinese. Perhaps I'm a little in over my head and really short on time, need to send it off to the UK tomorrow. This is the only class I've had problems with and I really don't understand, is there any way I could just enter a name and have it delete that from the text file? Something a little less complex along those lines? I'm really lost.

http://stackoverflow.com/a/22606288
has comment: http://stackoverflow.com/comment/34420089
has body: I found out that in MSSQL databases it depends on how the value is entered. If you have a table like this (asuming als cols are String): tbl1 ---------------------- | col1 | col2 | col3 | ---------------------- Now you insert data in like this: INSERT INTO tbl1 (col1) VALUES ('Test') You are likely to get: col1: Test col2: Null Col3: Null But if yoy insert data like that (e.g. you don't check if the value is "" in col2) INSERT INTO tbl1 (col1, col2, col3) VALUES ('Test', '', '') you will get: col1: Test col2: "" Col3: "" This happens mostly by not only inserting data filled by the user instead of the whole data.
answers question: http://stackoverflow.com/q/22605711
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34439024
upvote count: 1
has comment: http://stackoverflow.com/comment/34420052
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22605711

http://stackoverflow.com/q/22646247
has comment: http://stackoverflow.com/comment/34492149
answer count: 1
accepted answer: http://stackoverflow.com/a/22646380
has comment: http://stackoverflow.com/comment/34491987
favorite count: 0
has body: I want to run a single fragment from another fragment. I try: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.lecturers_fragment, container, false); ListView list = (ListView) rootView.findViewById(R.id.lecturersList); final List&lt;Lecturer&gt; allLecturersList = LecturerDatabaseHelper .getAllLecturers(getActivity()); if (allLecturersList != null) { LecturerItemAdapter lecturerAdapter = new LecturerItemAdapter( mCurrentActivity, allLecturersList); list.setAdapter(lecturerAdapter); } list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int index, long id) { Lecturer lecturer = allLecturersList.get(index); L.i("Boulder name is playing link it contains" + lecturer.getName()); Intent intent_lecturer = new Intent(mCurrentActivity, LecturerFragment.class); intent_lecturer.putExtra(LecturerFragment.SELECTED_LECTURER, lecturer); mCurrentActivity.startActivity(intent_lecturer); } }); return rootView; } In my logcat i have this: 03-25 22:04:36.092: E/AndroidRuntime(12453): Caused by: java.lang.ClassCastException: com.asi.sesjaapp.view.LecturerFragment cannot be cast to android.app.Activity How can I do it?
tagged with: android
has title: How to run only one fragment on screen?
has answer: http://stackoverflow.com/a/22646380
linked to: http://stackoverflow.com/q/22636722
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34498144
has comment: http://stackoverflow.com/comment/34491924
tagged with: android-fragments
tagged with: java
type: Question
score: 0

http://stackoverflow.com/q/22552208
tagged with: string
has comment: http://stackoverflow.com/comment/34324052
tagged with: android
has comment: http://stackoverflow.com/comment/34324145
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34324169
tagged with: java
has title: Different sizes of file in storing String v/s ByteArray in File android
tagged with: file
accepted answer: http://stackoverflow.com/a/22552516
type: Question
has comment: http://stackoverflow.com/comment/34323986
tagged with: arrays
has answer: http://stackoverflow.com/a/22552516
has body: I am using this approach for storing data in a file from responce of Server. ByteArrayOutputStream outstream = new ByteArrayOutputStream(); response.getEntity().writeTo(outstream); byte[] responseBody = outstream.toByteArray(); String data = new String(responseBody); FileOutputStream out = new FileOutputStream(new File(my_path)); out.write(data.getBytes()); out.flush(); out.close(); It's working fine and my file gets created and size of it is 3786 bytes. Now consider this , ByteArrayOutputStream outstream = new ByteArrayOutputStream(); response.getEntity().writeTo(outstream); byte[] responseBody = outstream.toByteArray(); FileOutputStream out = new FileOutputStream(new File(my_path)); out.write(responseBody); out.flush(); out.close(); it gives filesize of 1993 bytes. Can anybody help me understand this , Does this new String(responseBody) do something to responcebytes like some encoding ? Any help would be appreciated.
score: 0
has comment: http://stackoverflow.com/comment/34323924
answer count: 1
has comment: http://stackoverflow.com/comment/34324125

http://stackoverflow.com/comment/34446037
type: AnswerComment
comment on: http://stackoverflow.com/a/22620137
has text: Thanks for the help I'll be looking up CSV parsing and tokenizing and see what I can come up with.
type: Comment
score: 0

http://stackoverflow.com/q/22551019
tagged with: tomcat
favorite count: 0
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22552118
has body: I have a website i am running using tomcat 7 and MYSQL. It runs on a dedicated server. I am using the simple connection pool and simple DAO's classes outlined below: I have also attached the screen shot of all the localhost connections on the server. I run another application on a different server using similar DAO's and the same connection pool and i only ever see 4 connections on that server. Why would there be so many connections and is there a way to trace it back to my application to see why so many are spawning or is this normal? public class ConnectionPool { private static ConnectionPool pool = null; private static DataSource dataSource = null; public synchronized static ConnectionPool getInstance() { if (pool == null) { pool = new ConnectionPool(); } return pool; } private ConnectionPool() { try { InitialContext ic = new InitialContext(); dataSource = (DataSource) ic.lookup("java:comp/env/jdbc/DBNAME"); } catch(Exception e) { e.printStackTrace(); } } public Connection getConnection() { try { return dataSource.getConnection(); } catch (SQLException sqle) { sqle.printStackTrace(); return null; } } public void freeConnection(Connection c) { try { c.close(); } catch (SQLException sqle) { sqle.printStackTrace(); } catch (NullPointerException npe){ npe.printStackTrace(); } } } DAO public static DefaultMetaInfo loadDefaultMetaData() { ConnectionPool pool = ConnectionPool.getInstance(); Connection connection = pool.getConnection(); PreparedStatement ps = null; ResultSet rs = null; String query = "SELECT META_TAG, TITLE_TAG FROM SITE_SETTINGS"; try { ps = connection.prepareStatement(query); rs = ps.executeQuery(); if (rs.next()){ DefaultMetaInfo settings = new DefaultMetaInfo(); settings.setMetaTag(rs.getString("META_TAG")); settings.setTitleTag(rs.getString("TITLE_TAG")); return settings; } } catch(SQLException e) { e.printStackTrace(); return null; } finally { DaoUtil.closeResultSet(rs); DaoUtil.closePreparedStatement(ps); pool.freeConnection(connection); } return …
has answer: http://stackoverflow.com/a/22552118
has answer: http://stackoverflow.com/a/22551255
has comment: http://stackoverflow.com/comment/34354774
tagged with: java
tagged with: mysql
upvote count: 1
accepted answer: http://stackoverflow.com/a/22551255
has title: Java tomcat app showing many client connections to MySql DB
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/15949
score: 1

http://stackoverflow.com/q/22542182
type: UnansweredQuestion
tagged with: windows
tagged with: permissions
has comment: http://stackoverflow.com/comment/34306452
has comment: http://stackoverflow.com/comment/34317835
answer count: 0
has comment: http://stackoverflow.com/comment/34340645
tagged with: java
type: Question
has body: We have a Java-JNI application that runs fine on Windows XP, and Windows 7. When I try to run it on Windows 8 I basically get a cannot create file error. If I point the file to be created in the Users/documents folder the application works. If I point the file to be created in a C:\Tests folder or the Program Files (X86)/application folder it fails. Similarly If I try to shell an application from the Program Files (X86)/application folder it fails. It seems that using java on Windows 8 or Windows 8.1 has some file/folder creation restrictions. Any suggestions. We do not want to migrate the entire application to a users folder at this time. Thanks, Don
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/34306459
score: 0
has comment: http://stackoverflow.com/comment/34317780
has title: java windows 8 file read write permissions
has comment: http://stackoverflow.com/comment/34306464

http://stackoverflow.com/comment/40094003
type: Comment
comment on: http://stackoverflow.com/a/22588005
has text: @Sanaullah did you solve your problem? were you able to send sms?
score: 0
type: AnswerComment

http://stackoverflow.com/a/22621909
score: 0
has body: Ok, this should help a bit... missing Timer but you can get an idea of how to manage ActionListeners: Main class public class WindowInit{ public static void main(String args[]){ WindowHelp wh = new WindowHelp(); } } WindowHelp (This one does the magic) import java.awt.*; import javax.swing.*; import javax.swing.event.*; import java.awt.event.*; import javax.swing.event.*; public class WindowHelp{ JButton b1; JButton b2; JLabel label; long money; long buckets; JFrame jf; Timer timer; public WindowHelp(){ money = 0; buckets = 0; b1 = new JButton("Add buckets"); b2 = new JButton("Add money"); label = new JLabel(""); jf = new JFrame("My Game"); b1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { buckets += 2; label.setText("Buckets: " + buckets); } }); b1.setBounds(50,50,100,30); b2.setBounds(200,50,100,30); label.setBounds(300,50,200,30); jf.add(b1); jf.add(b2); jf.add(label); jf.setSize(500,600); jf.setVisible(true); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } Yes, one is the main class you compile "WindowInit" and run that one. For timers, gimme some time while I implement it.
answers question: http://stackoverflow.com/q/22620807
type: Answer

http://stackoverflow.com/q/22517074
tagged with: coding-style
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22517498
tagged with: java
has answer: http://stackoverflow.com/a/22517314
has answer: http://stackoverflow.com/a/22517165
has body: New at coding, and I'm running some basic exercises to get used to the language. In this exercise I'm trying to generate a phone number with the following restrictions: 1st 3 digits cannot contain an 8 or 9 2nd set of 3 digits cannot be higher than 742 I've seen suggestions to add an empty string (which I have), but I don't understand why that works. For now, I'll be sticking with the following, even though I don't fully understand why it works. num1 = rand.nextInt(7) + 1; num2 = rand.nextInt(7) + 1; num3 = rand.nextInt(7) + 1; num4 = rand.nextInt(643) + 100; num5 = rand.nextInt(1001) + 1000; String number = "" + num1 + num2 + num3 + "-" + num4 + "-" + num5; System.out.print("Your assigned phone number is: " + number); EDIT: NEW CODE INCLUDES sb.append StringBuilder sb = new StringBuilder(); int num1, num2, num3, num4, num5; num1 = rand.nextInt(7) + 1; num2 = rand.nextInt(7) + 1; num3 = rand.nextInt(7) + 1; num4 = rand.nextInt(643) + 100; num5 = rand.nextInt(1001) + 1000; sb.append(num1); sb.append(num2); sb.append(num3); sb.append("-"); sb.append(num4); sb.append("-"); sb.append(num5); //String number = "" + num1 + num2 + num3 + "-" + num4 + "-" + num5; System.out.print("Your assigned phone number is: " + sb.toString()); @Serge 's answer worked for me. Though it does seem to require more coding with all the sb.append calls I have to include. I've yet to learn about the StringBuilder class, but it definitely seems to be helpful. Thank you, everyone.
type: Question
has comment: http://stackoverflow.com/comment/34262547
duplicate of: http://stackoverflow.com/q/2674707
has answer: http://stackoverflow.com/a/31227929
linked to: http://stackoverflow.com/q/2674707
upvote count: 2
tagged with: concatenation
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/27834252
has title: How so I concatenate int values without adding them? (Java)
possible better answer: http://stackoverflow.com/a/22517314
has answer: http://stackoverflow.com/a/22517259
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/34262417
has answer: http://stackoverflow.com/a/22517186
accepted answer: http://stackoverflow.com/a/22517165
score: 2

http://stackoverflow.com/comment/34464835
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22631072
has text: I get the following error: java.lang.ClassCastException: XdsJsonSubmissionSet cannot be cast to DocumentDossier What I want to skip is having my JSON object wrapped in {"documentDossier": ... }, so my web service will be able to receive JSON objects like the one I posted.

http://stackoverflow.com/q/22542061
has answer: http://stackoverflow.com/a/22542129
tagged with: java-8
type: Question
tagged with: java
has body: Will targeting Java 6 allow my program to run in Apple Java? Are there any differences between Oracle JRE 6 and Apple Java 6?
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22542129
tagged with: macos
type: AnsweredQuestion
tagged with: netbeans
has title: How to target Apple Java from JDK?

http://stackoverflow.com/q/22615594
tagged with: apache-poi
score: 21
upvote count: 21
has title: Replacing variables in a word document template with java
type: Question
tagged with: java
has body: I want to load a template word document to add content to and save as new document. I'm working on .doc file. After a long research I only found solutions for docx : http://www.smartjava.org/content/create-complex-word-docx-documents-programatically-docx4j http://www.sambhashanam.com/mail-merge-in-java-for-microsoft-word-document-part-i/ So I want to replace any variable written in this format: $VAR by its value. Can I do it with velocity or Apache-poi, what is the best solution for it. Any help will be appreciated.
has answer: http://stackoverflow.com/a/22737947
answer count: 3
has answer: http://stackoverflow.com/a/37959904
linked to: http://stackoverflow.com/q/31844308
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/60562052
tagged with: velocity
has answer: http://stackoverflow.com/a/60562052
accepted answer: http://stackoverflow.com/a/22737947
type: AnsweredQuestion

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

http://stackoverflow.com/q/22528789
type: AnsweredQuestion
type: Question
tagged with: android
has body: I have login window, where I want to get user information to the next window and share only the username. I both stored password and username in the database and I want to get array result. Here is my code. 2 EditText where i have to get their values and pass them via json. The link I request is ..../userprofiles?username=. so, when I type the username I have to receive basic info. in JSON will be like this: { "content": [ { "id": 4, "email": "email@domain.com", "password": "this_will_not_be_set", "firstName": "John", "phoneNumber": "11223344", "username": "newuser", "birthDate": 1394204315000, "gender": "Male", "blacklistedDate": null, "userPicture": "Oik=", "blacklisted": false }], "size": 25, "number": 0, "sort": null, "totalPages": 1, "numberOfElements": 1, "totalElements": 1, "lastPage": true, "firstPage": true } and my Android code is: public static String GET(String url) { InputStream inputStream = null; String result = ""; try { HttpClient httpClient = new DefaultHttpClient(); // make GET request to the give URL HttpResponse httpResponse = httpClient.execute(new HttpGet(url)); // receive response as inputStream inputStream = httpResponse.getEntity().getContent(); // convert inputstream to string if (inputStream != null) result = convertInputStreamToString(inputStream); else result = "Did not work!"; } catch (Exception e) { Log.d("InputStream", e.getLocalizedMessage()); } return result; } private class HttpAsyncTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { return GET(urls[0]); } @Override protected void onPostExecute(String result) { Toast.makeText(getBaseContext(), "Received", Toast.LENGTH_LONG) .show(); try { JSONObject json = new JSONObject(result); String str = ""; JSONArray jArr = json.getJSONArray("content"); str += "username: " + jArr.getJSONObject(0).getString("username"); str += "password: " + jArr.getJSONObject(0).getString("password"); usernameEditText.setText(str); passwordEditText…
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/22529973
score: 0
answer count: 2
tagged with: authentication
has comment: http://stackoverflow.com/comment/34282187
possible better answer: http://stackoverflow.com/a/22532898
has answer: http://stackoverflow.com/a/22532898
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34283327
accepted answer: http://stackoverflow.com/a/22529973
has title: Android Login input to be send via HttpGet JSON to server and return list of user profile information

http://stackoverflow.com/comment/34491115
type: AnswerComment
type: Comment
has text: I think you would see benefit from looking at the javadoc for java.util.LinkedList. I used standard methods on that api. The addBefore method adds a value before the reference to the node that you pass to the addBefore() function.
comment on: http://stackoverflow.com/a/22644215
score: 0

http://stackoverflow.com/a/22555583
score: 0
has body: If you're using Hibernate 3.2.6/3.3.1, it is likely the cause of the problem is a bug in Hibernate: HHH-3529: ConnectionWrapper is not visible from class loader Looks like there's a bug in the BorrowedConnectionProxy class regarding the getProxyClassLoader() method. Upgrade Hibernate to 3.5.0 or later. If that's not possible, there's a patch in that JIRA you can apply.
type: Answer
answers question: http://stackoverflow.com/q/22550823

http://stackoverflow.com/comment/34432157
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22607704
has text: The last line is executed, but the two threads are still running.

http://stackoverflow.com/a/22543505
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22543314
downvote count: 0
has body: try this, String str="aF/1234"; if(str.matches("[a-zA-Z]{2}/\\d{4}")) System.out.println("Match");

http://stackoverflow.com/comment/34353787
type: QuestionComment
has text: What is your concrete question?
comment on: http://stackoverflow.com/q/22569118
type: Comment
score: 1

http://stackoverflow.com/comment/34346191
type: QuestionComment
has text: Also: "Declaring volatile Object data would be semantically correct, but would likely impose extra costs on every subsequent access to the field." <-- This is environment-specific. On x86, as far as I understand, all of the cost is on the write; the reads aren't more expensive than non-`volatile` fields. [More info](http://stackoverflow.com/questions/1090311/are-volatile-variable-reads-as-fast-as-normal-reads)
type: Comment
comment on: http://stackoverflow.com/q/22565155
score: 1

http://stackoverflow.com/a/46014542
answers question: http://stackoverflow.com/q/22605050
type: Answer
has body: Node Reverse(Node head) { Node n,rev; rev = new Node(); rev.data = head.data; rev.next = null; while(head.next != null){ n = new Node(); head = head.next; n.data = head.data; n.next = rev; rev = n; n=null; } return rev; } Use above function to reverse single linked list.
score: 0

http://stackoverflow.com/comment/34382331
type: Comment
has text: number 2 sounds like the better fix, but I don't know how to do that. Do you know of any documentation I could look at?
comment on: http://stackoverflow.com/a/22584911
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34283873
has text: I'm removing my answer since overall people think it's irrelevent. For reference, and since some people did upvote it anyway, I'll sum it up here. The OP did not mention explicitly that using string objects was a parameter of their problem. Thus, I believe it is relevent to state that because string comparison shouldn't be made with `==` unless comparing references, I advise as a general rule of thumb to simplify the problem by starting with experimenting with integers or using `equals`. IMHO, boolean operation precedence could have been understood more easily by the OP if they had done so.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22526170
score: 0

http://stackoverflow.com/comment/34262209
score: 0
comment on: http://stackoverflow.com/a/22517314
type: AnswerComment
has text: No @StreamingBits, you're not adding integers, you're concatinting... he said he's new at coding, I added an explanation of how that code works, and why "" before integers will print them 1 by 1 instead of adding them
type: Comment

http://stackoverflow.com/comment/34273352
has text: Cause I'm debugging my own problems while solving yours :P
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22523349
score: 0

http://stackoverflow.com/q/22493027
score: 2
type: AnsweredQuestion
has title: OpenGL Quad Visible on Both Sides?
downvote count: 0
tagged with: opengl
tagged with: java
tagged with: lwjgl
type: Question
has body: I've just started learning OpenGL, and came across an interesting bug (that's probably through my wrongdoing) However, I can't seem to figure out why my faces are being drawn by default on both sides, rather than one. Here are a few screenshots describing the problem When I go ahead and enable GL_CULL_FACE (because apparently it isn't enabled by default, as it should be), my quads get rendered, but all on the wrong side. Is this due to a way I'm calculating normals? Here is my code for calculating a normal public static Point3D calculateNormals(Point3D p1, Point3D p2, Point3D p3) { Point3D v1 = new Point3D(p2.getX() - p1.getX(), p2.getY() - p1.getY(), p2.getZ() - p1.getZ()); Point3D v2 = new Point3D(p3.getX() - p1.getX(), p3.getY() - p1.getY(), p3.getZ() - p1.getZ()); Point3D normal = new Point3D(); normal.addX((v1.getY() * v2.getZ()) - (v1.getZ() - v2.getY())); normal.addY((v2.getZ() * v1.getX()) - (v2.getX() * v1.getZ())); normal.addZ((v1.getX() - v2.getY()) - (v1.getY() - v2.getX())); return normal; } Note: Creating a Point3D with no arguments results in x, y, and z all being set to 0, hence why addX, andY, and addZ can be used. Should I flip my normal calculations?
has answer: http://stackoverflow.com/a/22493334
has answer: http://stackoverflow.com/a/22518888
accepted answer: http://stackoverflow.com/a/22493334
upvote count: 2
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/22518888

http://stackoverflow.com/a/22600132
type: Answer
has comment: http://stackoverflow.com/comment/34411031
has comment: http://stackoverflow.com/comment/34410003
answers question: http://stackoverflow.com/q/22600064
has comment: http://stackoverflow.com/comment/34409772
has body: The easiest thing, I think, would be to use a List&lt;String&gt; to hold the two arrays. You could do something like this: List&lt;String&gt; merged = new ArrayList&lt;&gt;(); if (line.startsWith("#dataOne ")){ String[] oneS = line.split("= "); String[]oneT= oneS[1].split(" "); merged.addAll(Arrays.asList(oneT)); } if (line.startsWith("#dataFour")){ String[] twoS = line.split("= "); String[]twoSets= twoS[1].split(", "); merged.addAll(Arrays.asList(twoSets)); } Then you could do things like turn it into a String[] if you really need an array instead of a List. Or you could first add the elements of merged to a Set to get rid of duplicates. Alternatively, you would make oneT and twoSets external to the if blocks and merge them directly into a String[] using System.arraycopy: String[] oneT; String[] twoSets; if (line.startsWith("#dataOne ")){ String[] oneS = line.split("= "); oneT= oneS[1].split(" "); } else { oneT = new String[0]; } if (line.startsWith("#dataFour")){ String[] twoS = line.split("= "); twoSets= twoS[1].split(", "); } else { twoSets = new String[0]; } String[] merged = new String[oneT.length + twoSets.length]; System.arraycopy(oneT, 0, merged, 0, oneT.length); System.arraycopy(twoSets, 0, merged, oneT.length, twoSets.length);
has comment: http://stackoverflow.com/comment/34409689
score: 0

http://stackoverflow.com/comment/34368551
has text: Isn't it also wrong to return the `ResultSet`? This depends on the caller having to remember to close it. And if that is forgotten, memory leaks happen. Also, to be able to close the `ResultSet`, the `Connection` should be open. I may be wrong in the case of _disconnected_ result sets.
type: Comment
comment on: http://stackoverflow.com/a/22577517
score: 0
type: AnswerComment

http://stackoverflow.com/comment/99333427
type: AnswerComment
comment on: http://stackoverflow.com/a/51441353
has text: In some cases you need parent class to implement CREATOR e.g. passing an abstract class in AIDL
score: 0
type: Comment

http://stackoverflow.com/a/22547392
upvote count: 2
answers question: http://stackoverflow.com/q/22547301
has comment: http://stackoverflow.com/comment/34316238
score: 2
type: AcceptedAnswer
downvote count: 0
has body: Your first example works, if you change if(locatedNum[0][2] == ""+num) { to if(locatedNum[0][2].equals(""+num)) { Here, you are comparing Strings, and Strings should always be compared using .equals. Otherwise, you are comparing the String pointers, which are most of the time not the same. Your second test works, if you change if(locatedNum[0][2].equals(num)) { to if(Integer.parseInt(locatedNum[0][2]) == num) { In this case, you are comparing Integer values, and == is a valid choice. However, you have to convert your String value from locatedNum to an Integer value as well. Your third test works, if you change if(locatedNum[0][2] == s) { to if(locatedNum[0][2].equals(s) { If you are comparing strings, always use .equals instead of ==.
type: Answer
accepted answer of: http://stackoverflow.com/q/22547301

http://stackoverflow.com/a/33650825
has body: Error message does not say much, but it means that building your android apk failed. if you look at maven output above error, you might see message with actual error. in my case it was: Extracting libs Generating R file for Planer:AndroidApk:apk:1.0.0 C:\NetBeansProjects\Planer\AndroidApk\res\values\strings.xml:30: error: Resource entry ui.separator is already defined. C:\NetBeansProjects\Planer\AndroidApk\res\values\strings.xml:29: Originally defined here. Error when generating sources. org.apache.maven.plugin.MojoExecutionException: at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:894) at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:323) ... Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command .... ... as you can see information about problem is typed above maven error. Mine problem, for example, was duplication of string resource- for some reason Android studio have made a duplicate. So, you do not have to run that command on your own. just look at the output.
type: Answer
answers question: http://stackoverflow.com/q/22646930
score: 0

http://stackoverflow.com/comment/34270687
comment on: http://stackoverflow.com/a/22522000
type: AnswerComment
has text: eeks I missed that - will fix
score: 0
type: Comment

http://stackoverflow.com/comment/34282161
has text: Oh ok, I understand now. Maybe you could reindent your code correctly and try to configure Git to ignore spaces and tabs. There are some posts about it on SO.
comment on: http://stackoverflow.com/a/22526801
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22554384
accepted answer: http://stackoverflow.com/a/22844310
tagged with: intellij-idea
downvote count: 0
has comment: http://stackoverflow.com/comment/34327993
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34640401
tagged with: maven
has answer: http://stackoverflow.com/a/22844310
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: vaadin
has title: Vaadin 7 samples with maven
upvote count: 1
has body: I am new to Vaadin, I would like to find easy to start Vaadin 7 examples with maven(I do not want to download jars manually). I have seen this github repositores, but had problem when trying to build project. github.com/nfrankel/More-Vaadin Also are there a official examples from Vaadin.? I use IDEA as a ide. Thanks.
has comment: http://stackoverflow.com/comment/34328487
has comment: http://stackoverflow.com/comment/34640416
type: Question

http://stackoverflow.com/comment/34426495
comment on: http://stackoverflow.com/a/22609876
type: AnswerComment
score: 0
type: Comment
has text: ok...so you are trying to say that i can't execute `Update` query in Datastore ?

http://stackoverflow.com/comment/64175678
score: 0
has text: I'm unable to get this working. Why is a `component` variable in the loop never used? And you forgot to set return type to `Path` and add brackets after `isAbsolute()` and `getSeparator()`.
type: Comment
comment on: http://stackoverflow.com/a/22611925
type: AnswerComment

http://stackoverflow.com/comment/34368059
type: Comment
comment on: http://stackoverflow.com/a/22577209
has text: @Joop Sorry where should I put the try and catch block?
type: AnswerComment
score: 0

http://stackoverflow.com/q/22647463
has comment: http://stackoverflow.com/comment/34493984
has title: java - java.lang.ArrayIndexOutOfBoundsException error while not using an array
has comment: http://stackoverflow.com/comment/34493993
has answer: http://stackoverflow.com/a/22647527
score: 0
has comment: http://stackoverflow.com/comment/34493957
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22647531
has body: I am writing a program to display Dewey Decimal Information. I don't have much yet, but am already getting the following error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at DDC.main(DDC.java:19) I don't understand why the error is array related here's my code: // enter a book's catalog number and the program produces a // list of the information the catalog number provides for the user import java.util.Scanner; public class DDC { public static void main(String[] args) { Scanner input = new Scanner(System.in); // Prompt the user to enter a catalog number System.out.println("Enter the catalog number: "); String catalognumber = input.nextLine(); int strLength = catalognumber.length(); if (strLength == 15) { String[] parts = catalognumber.split(" "); String topicarea = parts[0]; String authorID = parts[1]; String titleID = parts[3]; System.out.println("This is a Dewey Decimal Classification(DDC) for Non-fiction"); System.out.println("Topic Area: "+ topicarea); System.out.println("Author Identifier: "+ authorID); System.out.println("Title Identifier: " + titleID); System.out.println("Thanks for using the Catalog Information Program."); } // end if } // end main } // end DDC
has comment: http://stackoverflow.com/comment/34493919
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/22554643
answers question: http://stackoverflow.com/q/22554332
has comment: http://stackoverflow.com/comment/34327550
upvote count: 4
has body: The easiest / dirtiest way is to just put (new Exception("test")).printStackTrace() in SomeObject's constructor and run the code. You'll get a stack trace printed to the console every time SomeObject is instantiated. Eclipse also supports breakpoints in constructors so you could set a breakpoint and debug.
score: 4
has comment: http://stackoverflow.com/comment/34327829
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22554332
has comment: http://stackoverflow.com/comment/34327490

http://stackoverflow.com/a/22624403
answers question: http://stackoverflow.com/q/22624354
has comment: http://stackoverflow.com/comment/34454037
score: 4
upvote count: 4
has body: mapArea.getGraphics(); is not how custom painting in Swing is done. Start by taking a look at Performing Custom Painting for more details. Adding a component to a container ensures that the child component will always be painted over the container... JLabel label = new JLabel(new ImageIcon(map)); mapArea.add(label); You have that backwards. It might be better to add both the label and mapArea to the same container The next problem you will need to overcome is the fact that you will need to get your painting component to reside over the top of your label. To this end you could... Use a glass pane Use a OverlayLayout Use a GridBagLayout Update with example There are any number of ways to achieve this, you could use multiple components which act as layers onto which you could add other components or perform custom painting. This is not as easy it as it sounds. Most layout managers don't consider two components sharing the same space. You also have to manage the connection between the layers, so if the map is centered within the lowest layer, but the available space is larger or smaller than the map, offsets begin to drift...messy... A simpler solution would be to use a single component and render all the content onto it, for example... import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestMap { public static void main(String[] args) { new TestMap(); } public TestMap() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException |…
downvote count: 0
has comment: http://stackoverflow.com/comment/34453496
type: Answer
has comment: http://stackoverflow.com/comment/34454209
has comment: http://stackoverflow.com/comment/34454232

http://stackoverflow.com/comment/34348009
score: 1
type: Comment
type: QuestionComment
has text: I was referring to the generated query that is actually sent to firebird.
comment on: http://stackoverflow.com/q/22555377

http://stackoverflow.com/comment/34277632
type: QuestionComment
has text: If I understand correctly the Oracle documentation, `ElementType.TYPE` mean that it can be apply to all element where other types can be applied.
score: 0
comment on: http://stackoverflow.com/q/22525939
type: Comment

http://stackoverflow.com/a/22586518
upvote count: 4
downvote count: 0
has body: You may have got it working already, but I came up with an answer, so I'll post it anyways. I haven't implemented the Comparator interface into the Movie class; instead, I just use Arrays.sort and a custom Comparator to sort it by some property of the movie. Here is the Movie class I created, just for reference. Here is the code I used to sort an example: Movie a = new Movie("The Muppets Take Manhattan", "Columbia Tristar", 2001); Movie b = new Movie("Fight Club", "Regency Enterprises", 1999); Movie c = new Movie("Toy Story", "Walt Disney Pictures", 1995); Movie[] movies = {a, b, c}; // compares the TITLES in ASCENDING order Arrays.sort(movies, new Comparator&lt;Movie&gt;() { public int compare(Movie m1, Movie m2) { return m1.getTitle().compareTo(m2.getTitle()); } }); // print out the sorted movie array for (Movie m : movies) { System.out.println(m + "\n---"); } If you wanted to put the order to be descending, you could simply reverse the order you are comparing the values in the Comparator. For example, you would change this: return m1.getTitle().compareTo(m2.getTitle()); to this: return m2.getTitle().compareTo(m1.getTitle()); If you wanted to compare different properties of the Movie, just change getTitle() to something else, like getYear() or getStudio(). Example: return m1.getYear() - m2.getYear(); // ascending by year Because the year is in an int, you cannot use the String compareTo method, you just have to return the difference. To make this order the movies depending on input, look at this code. I didn't want to daunt you right away.
score: 4
answers question: http://stackoverflow.com/q/22585950
type: Answer

http://stackoverflow.com/comment/34257691
has text: Note: The CollabClientFactory is also bound correctly. I just had it omitted from the original code for simplification.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22491326
type: QuestionComment

http://stackoverflow.com/comment/34432224
score: 0
type: AnswerComment
type: Comment
has text: Agree, and your solution is correct. All I am saying is that your explanation of problem is wrong.
comment on: http://stackoverflow.com/a/22612464

http://stackoverflow.com/comment/34220983
type: QuestionComment
comment on: http://stackoverflow.com/q/22493259
score: 0
has text: @jpw If OP doesn't use nextLine() anywhere so there is no problem with consuming line separators. Even if each number would be placed in new line series of `nextInt()` would read them without problem.
type: Comment

http://stackoverflow.com/comment/34292321
score: 0
type: Comment
has text: The error got fixed by changing schemalocation as schemaLocation with capital L in location and you too gave proper sdnext-servlet.xml with this change.Thanks for your reply
comment on: http://stackoverflow.com/a/22517003
type: AnswerComment

http://stackoverflow.com/q/22629431
tagged with: defaultlistmodel
tagged with: jlist
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/11837749
tagged with: concurrenthashmap
has title: Storing Data in DefaultListModel vs ConcurrentHashMap
tagged with: swing
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34464480
linked to: http://stackoverflow.com/q/2064427
tagged with: java
has body: I am writing a GUI in swing to display incomming requests from clients. The server populates a LinkedBlockingQueue, while another thread takes from the queue when there is data available. The requests are stored as an Object. Like so: while(should_take) { //getRequest() is blocking Object request = server.getRequest(); //Add request to user interface GUI.addToList(request); } Now my question comes in, would it be better to: Solution 1: Store the request in a ConcurrentHashMap&lt;Integer, Object&gt; with the key as the hash of the request and the value as the Object. I will then use a DefaultListModel to store the identifier (eg. request type) of the request and the hash value. The DefaultListModel will be used to populate a JList, effectively displaying the request to the user. The value of the selected request (selected by the user) can then be retrieved from the ConcurrentHashMap using the hash saved in the DefaultListModel. Some example code: ConcurrentHashMap&lt;Integer, Object&gt; requests = new ConcurrentHashMap&lt;&gt;(); DefaultListModel listData = new DefaultListModel(); JList theList = new JList(); ... public void addToList(Object request) { //Place in HashMap requests.put(request.hashCode(), request); //Create a DataHolder with the Hashvalue and identifier of the request DataHolder holder = new DataHolder(request.getID(), request.hash); //Add the element to the ListModel listData.addElement(holder); //Assign the list model to the JList theList.setModel(listData); } When a user selects an item in the list: DataHolder holder = (DataHolder)theList.getSelectedValue(); //Get request from HashMap Object request = requests.get(holder.getHash()); //Do something with request Solution 2: I populate a new Object, call it DataHolder, with the request identifier and request value. I can now populate the JList with DefaultListModel that contains DataHolder and no reference is needed to any other data structure to retrieve the actual request value. Because DefaultListMo…
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22635660
accepted answer: http://stackoverflow.com/a/22635660
has comment: http://stackoverflow.com/comment/34462183
has comment: http://stackoverflow.com/comment/34465154

http://stackoverflow.com/q/22544072
has title: Move folders up the file path of .class file in java
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: file
type: Question
answer count: 2
has body: I found the class path of my running class by: MyClass.class.getProtectionDomain().getCodeSource().getLocation().getPath(); For which I got below path as my result: \Users\vanburen\main_dev\vob2\SD\WebContent\WEB-INF\classes I have to read an XML file in location: \Users\vanburen\main_dev\vob2\SD\rulesXML\rules.XML Can someone help me how do I move three folders up? I've tried using getAbsoluteFile().getParentFile() but that seems to be redundant. Is there a better way of doing this?
upvote count: 1
has answer: http://stackoverflow.com/a/22544429
has comment: http://stackoverflow.com/comment/34478823
favorite count: 0
has answer: http://stackoverflow.com/a/22639072
accepted answer: http://stackoverflow.com/a/22639072
possible better answer: http://stackoverflow.com/a/22544429
tagged with: filepath

http://stackoverflow.com/comment/34468433
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22633253
has text: I can't see working with Cipher in C# code. And the cipher should be there, same as in Java
type: Comment

http://stackoverflow.com/a/22550143
answers question: http://stackoverflow.com/q/22550048
has comment: http://stackoverflow.com/comment/34321078
has body: Use ImageView.setTag() to get position of clicked row on ImageVIew click as: vHolder.imageView.setTag(pos); // set current pos vHolder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showCarEditDialog(Integer.parseInt(v.getTag().toString())); } });
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22550048
type: Answer
upvote count: 1

http://stackoverflow.com/q/22606966
downvote count: 2
upvote count: 1
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/22607626
type: Question
has title: How to reduce Audio and Video file size while downloading from server in Android app?
has body: I need to either play or download audio/video files hosted on a server. While downloading, I need the file to be downloaded in compressed size. How to achieve that? Any help would be appreciated.
favorite count: 0
tagged with: android
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/22531601
has comment: http://stackoverflow.com/comment/34287255
has title: Why constructor is not called for the parent class while deserialization?
has answer: http://stackoverflow.com/a/22531713
score: 0
answer count: 1
tagged with: deserialization
tagged with: serialization
type: UnansweredQuestion
has body: I have 2 class X and Y. public class Z extends Y implements Serializable{ private String a; // getter and setter } public class Y{ private int age; public Y() { this.age = 10; } } Now I serialize this Y object. And then deserialize it. age - 10 // constructor is called here. a - myname Now I have taken another case. I have 2 class X and Y and Z. public class X implements Serializable{ private String s; public class Y extends X { private int age; public Y() { this.age = 10; } } public class Z extends Y implements Serializable{ private String a; } Now here when I am deserializing Z object, the constructor is not getting executed. And it is printing the values what I have set during my serialization. Why is that?
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7151711

http://stackoverflow.com/a/22572435
upvote count: 1
answers question: http://stackoverflow.com/q/22572339
has body: Soundcloud relies on tokens that are produced from logging in to fulfill your requests. Your client will be useless without one.
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22572339
type: Answer

runtime-error
tags question: http://stackoverflow.com/q/22542297
tags question: http://stackoverflow.com/q/22645006
tags question: http://stackoverflow.com/q/22571550
tag name: runtime-error
tags question: http://stackoverflow.com/q/22497083
type: Tag
tags question: http://stackoverflow.com/q/22627019

http://stackoverflow.com/q/22552192
tagged with: screenshot
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34323708
tagged with: jsf-2
score: 0
has comment: http://stackoverflow.com/comment/34327045
type: UnansweredQuestion
has body: I am implementing a screenshot capture in my Java web Application Which Is Already Working. I however have an issue with the screenshot because the Image is Taken for the entire Screen: As you can see this is the entire screen, I just want to capture the area with the graphs(the White area). The Code I am using to capture this screen is: public void captureGraphs() { try { Dimension size = Toolkit.getDefaultToolkit().getScreenSize(); Robot robot = new Robot(); BufferedImage img = robot.createScreenCapture(new Rectangle(size)); File f = new File("C:/capture"); if (!f.exists()) { f.mkdir(); } File[] flist = f.listFiles(); for (File flist1 : flist) { flist1.delete(); } ImageIO.write(img, "JPG", new File("C:/capture/screenShot.jpg")); System.out.println("Capture Successfull"); FacesContext.getCurrentInstance().addMessage( null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Successful!", "You have successfully taken a snapshot. Thank You")); } catch (HeadlessException e) { System.out.println(e.getMessage()); } catch (AWTException e) { System.out.println(e.getMessage()); } catch (IOException e) { System.out.println(e.getMessage()); } } Is there any way I can change this code to capture the Mid Part only holding the graphs??
has title: Capture a specified area of screen using java
answer count: 0

http://stackoverflow.com/comment/34398652
has text: I want to create own list of rules and test it
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22593635

http://stackoverflow.com/comment/34271889
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22519686
has text: You may want to remove `ResultSet results` as a parameter, since you already defined into in your class. Normally this isn't a problem, but it's actually the last thing I could image... :/ (Also you're not closing the ResultSet, are you?)
type: Comment

http://stackoverflow.com/a/22557979
score: 6
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/84381452
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22556929
has body: You could try to first get the bootstrap class loader by e.g. calling ClassLoader bootstrapLoader = ClassLoader.getSystemClassLoader().getParent(); and then get the classes of this class loader as explained here: How can I list all classes loaded in a specific class loader. But note, that getting the bootstrap class loader is not reliable, because it may not explicitly exist. So ClassLoader.getSystemClassLoader().getParent() may return null, as explained in the Javadoc of ClassLoader#getParent(): Returns the parent class loader for delegation. Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class loader's parent is the bootstrap class loader.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22556929

http://stackoverflow.com/comment/109566661
score: 2
has text: This only indirectly answers the question... The answer is "remove the flags to remove the warning". As the [insightful comment](https://stackoverflow.com/questions/22634644/java-hotspottm-64-bit-server-vm-warning-ignoring-option-maxpermsize#comment54226301_32365351) by @ohad-schneider reveals, there is no _one_ single replacement for them.
type: AnswerComment
comment on: http://stackoverflow.com/a/22634880
type: Comment

http://stackoverflow.com/q/22647008
has comment: http://stackoverflow.com/comment/34746301
type: Question
tagged with: kerberos
has title: session key between client and TGS in kerberos
score: 0
has comment: http://stackoverflow.com/comment/34510375
has comment: http://stackoverflow.com/comment/34768386
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34782161
has body: I'm trying to develop a kerberos application in java. Could some one tell how AS generate the session key between client and TGS.
tagged with: java
has comment: http://stackoverflow.com/comment/34650111

http://stackoverflow.com/comment/34604400
type: Comment
type: QuestionComment
has text: I think that the best thing you can do is a parallel processing, check the `ExecutorService` class of Java and the `Future` class, they can help you to do some parallel processing and wait until all the tasks are finished
score: 0
comment on: http://stackoverflow.com/q/22642558

http://stackoverflow.com/q/22571681
answer count: 1
has comment: http://stackoverflow.com/comment/34358668
has comment: http://stackoverflow.com/comment/34358563
has body: In Objective-C we have a generic type for objects called "id". id someObject = someValue; if([someObject isKindOfClass:[NSString class]]) { NSString *string = someObject; } I want to know if there's something like that in Java. id someObject = someValue; if(someObject instanceof String) { String string = someObject; }
tagged with: android
has comment: http://stackoverflow.com/comment/34358775
has comment: http://stackoverflow.com/comment/34358929
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/22571730
has comment: http://stackoverflow.com/comment/34359073
type: Question
tagged with: java
has title: Java generic type for objects
accepted answer: http://stackoverflow.com/a/22571730

http://stackoverflow.com/comment/34407174
comment on: http://stackoverflow.com/a/22546743
score: 0
type: Comment
has text: also dude, it all needs to be off of button clicks and the only way i know how to do that is by using if([string name here].equals("button name")) then do this.
type: AnswerComment

http://stackoverflow.com/comment/34495346
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22647938
has text: Yes. It's like adding hard disks to PC, you will get device in /dev per disk. You can have more than one device per disk with multiple partitions on it but not vice versa.
score: 0

http://stackoverflow.com/comment/34303846
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22540751
has text: It's not at all clear what your inputs are here... or what time zone you're interested in. Bear in mind that a `Date` is just an instant in time; it can occur on different days around the world. If you can possibly use Joda Time (or Java 8) that will make your life easier too.
score: 0

http://stackoverflow.com/a/22595978
has comment: http://stackoverflow.com/comment/34403106
has comment: http://stackoverflow.com/comment/34402496
has body: Let ui and vi be the positions of circle i before and after the current timestep, assuming no collisions, respectively, for i = 1, 2. Let ri be the radius of circle i, for i = 1, 2. Let R = r1 + r2. Assume that the circles move at a constant speed over the duration of the timestep. That is, the path of ball i is described by pi(t) = (1 - t)ui + tvi, t in [0,1], assuming no collision. We can detect a collision by solving the equation ||p2(t) - p1(t)|| = r1 + r2 = R for t. Let's simplify this equation. ||p2(t) - p1(t)|| = R ||(1-t)(u2 - u1) + t(v2 - v1)||2 = R2 ||(1 - t)U + tV||2 = R2 where U = u2 - u1 and V = v2 - v1 &lt;(1 - t)U + tV, (1 - t)U + tV&gt; = R2 (1 - t)&lt;U, (1 - t)U + tV&gt; + t&lt;V, (1 - t)U + tV&gt; = R2 (1 - t)2&lt;U, U&gt; + (1 - t)t&lt;U, V&gt; + t(1 - t)&lt;V, U&gt; + t2&lt;V, V&gt; = R2 (1 - t)2&lt;U, U&gt; + 2(1 - t)t&lt;U, V&gt; + t2&lt;V, V&gt; = R2 At this point it should be clear: this is just a quadratic equation in t! Solve for the possible values of t. If there is no real solution in the interval [0,1], then there is no collision. If there are any real solutions in the interval [0,1], the earliest (minimum) solution in the interval [0,1] describes the time of collision. Let T be the described earliest real solution in the interval [0,1]. Then p1(T) and p2(T) are the positions at the time of collision. The vector between these positions is the normal of the collision.
has comment: http://stackoverflow.com/comment/34482585
has comment: http://stackoverflow.com/comment/34402673
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34403022
has comment: http://stackoverflow.com/comment/34402159
accepted answer of: http://stackoverflow.com/q/22595502
answers question: http://stackoverflow.com/q/22595502
has comment: http://stackoverflow.com/comment/34402241
type: Answer
has comment: http://stackoverflow.com/comment/34402885
downvote count: 0
score: 1

validation
tags question: http://stackoverflow.com/q/22590676
tags question: http://stackoverflow.com/q/22562403
tags question: http://stackoverflow.com/q/22523770
tags question: http://stackoverflow.com/q/22590537
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/22601068
tags question: http://stackoverflow.com/q/22589052
tags question: http://stackoverflow.com/q/22522256
tags question: http://stackoverflow.com/q/22507055
tags question: http://stackoverflow.com/q/22570321
tags question: http://stackoverflow.com/q/22508424
tags question: http://stackoverflow.com/q/22510472
tags question: http://stackoverflow.com/q/22567789
tags question: http://stackoverflow.com/q/22625365
tags question: http://stackoverflow.com/q/22595545
tags question: http://stackoverflow.com/q/22542155
tags question: http://stackoverflow.com/q/22547244
tags question: http://stackoverflow.com/q/22622761
tags question: http://stackoverflow.com/q/22638309

http://stackoverflow.com/comment/34291541
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22531310
has text: I have the code but the problem is it's too complicated that it calls objects from another classes and some gui objects. I may try your solution but it'll take lots of time from me... Thanks anyway.
type: AnswerComment

http://stackoverflow.com/a/22524765
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22524687
has body: After entering your number I guess you are pressing &lt;enter&gt; so this needs to be chewed up before entering your string try char ch = input.next().charAt(0); input.nextLine(); System.out.println("Enter the string to search: "); String str = input.nextLine();
upvote count: 2
type: Answer

http://stackoverflow.com/comment/34218785
comment on: http://stackoverflow.com/a/22491917
score: 0
type: Comment
has text: Other than system performance, do the two ways have no difference?
type: AnswerComment

http://stackoverflow.com/q/22509242
has title: How to delete a specific character from a string?
has answer: http://stackoverflow.com/a/22509489
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22509299
tagged with: java
possible better answer: http://stackoverflow.com/a/22509489
linked to: http://stackoverflow.com/q/12734721
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/34249575
tagged with: string
score: 0
has body: I'm reading some integer values from a webpage using Java through Jsoup library. In the website integer represented as xxx,xxx. I need this set of data to be written in a .csv file so later it can be accessed through Excel for further work. How to remove this comma in the middle so it doesn't affect the .csv file?
has answer: http://stackoverflow.com/a/22509336
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/22509299
has comment: http://stackoverflow.com/comment/34247151
answer count: 4
has answer: http://stackoverflow.com/a/22509375

http://stackoverflow.com/q/22540115
linked to: http://stackoverflow.com/q/23493556
tagged with: google-drive-api
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23341572
upvote count: 3
has body: I am using the demo found here as a guide for my app: https://github.com/googledrive/android-demos/tree/master/src/com/google/android/gms/drive/sample/demo I am first using the PickFolderWithOpenerActivity.java to retrieve the Google Drive folder responseID. I want the user to first drill down and select a folder, and then all the files in that folder to be displayed (and to be selectable) The OpenFileActivityBuilder opens ok in my app and I can then browse the folder structure, and then press the "Select" button in order to select that folder. In PickFolderWithOpenerActivity.java, I am overwriting the EXISTING_FOLDER_ID with the responseID (this response ID matches the drive folder URL i.e. the part in bold: https://drive.google.com/?authuser=0#folders/0AwbfSlc3Y1XYUXpZU0Vac1JXY28): So essentially, EXISTING_FOLDER_ID = 0AwbfSlc3Y1XYUXpZU0Vac1JXY28 DriveId driveId = (DriveId) data.getParcelableExtra( OpenFileActivityBuilder.EXTRA_RESPONSE_DRIVE_ID); EXISTING_FOLDER_ID = driveId.getResourceId(); I then call the the "ListFilesInFolderActivity.java": public class ListFilesInFolderActivity extends BaseActivity { private ListView mResultsListView; private ResultsAdapter mResultsAdapter; //private static DriveId sFolderId = DriveId.decodeFromString(EXISTING_FOLDER_ID); // this causes error @Override public void onConnected(Bundle connectionHint) { super.onCreate(connectionHint); setContentView(R.layout.activity_listfiles); mResultsListView = (ListView) findViewById(R.id.listViewResults); mResultsAdapter = new ResultsAdapter(this); mResultsListView.setAdapter(mResultsAdapter); showMessage("EXISTING_FOLDER_ID:" + EXISTING_FOLDER_ID); Drive.DriveApi.fetchDriveId(getGoogleApiClient(), EXISTING_FOLDER_ID) .setResultCallback(idCallback); } final private ResultCallback&lt;DriveIdResult&gt; idCallback = new ResultCallback&lt;DriveIdResult&gt;() { @Override public void onResult(DriveIdResult result) { if (!result.getStatus().isSuccess()) { showMessage("Cannot find DriveId. Are you…
accepted answer: http://stackoverflow.com/a/23341572
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/25886606
has answer: http://stackoverflow.com/a/25886606
tagged with: java
answer count: 2
has title: Google Drive API - populating list of files in ListView
has comment: http://stackoverflow.com/comment/34417564
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34616281
tagged with: android

http://stackoverflow.com/q/22612401
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22612902
favorite count: 0
accepted answer: http://stackoverflow.com/a/22612902
tagged with: android
has comment: http://stackoverflow.com/comment/34431382
has body: Please forgive me, since this is my first time to make an Android program. So I've followed a tutorial on YouTube to make a simple program which will take a user inputted number, multiply it by 5 and then display it on a label. It got no errors. But when I tried to run it on my Android phone, it got the error "Unfortunately, xxx has stopped". I've checked and I could run the Hello World program that Eclipse initiated the program with. Thank you very much for your kind attention. MainActivity.java package com.example.converter; 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.widget.*; // * is wild character, which will import all widgets import android.os.Build; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } Button calc = (Button)findViewById(R.id.btnCalculate); calc.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { EditText num = (EditText)findViewById(R.id.num); TextView display = (TextView)findViewById(R.id.display); double number = Double.parseDouble(num.getText().toString()); number = number * 5; display.setText(number + ""); } }); } @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/U…
has comment: http://stackoverflow.com/comment/34431088
has answer: http://stackoverflow.com/a/22612632
tagged with: android-actionbar
upvote count: 1
possible better answer: http://stackoverflow.com/a/22612632
type: AnsweredQuestion
has title: Eclipse: "Unfortunately, XXX has stopped" error when testing on an Android phone
score: 1
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/q/22627979
tagged with: actionlistener
has answer: http://stackoverflow.com/a/22628649
accepted answer: http://stackoverflow.com/a/22628649
answer count: 1
score: 0
has body: How can I change the Value of a JTextfield inside an ActionLIstener? cmdAnzeigen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { /* Cannot refer to a non-final variable TextOutput inside an inner class defined in a different method*/ TextOutput.setText("Hello"); } });
has comment: http://stackoverflow.com/comment/34459087
tagged with: textfield
has comment: http://stackoverflow.com/comment/34459203
tagged with: swing
type: AnsweredQuestion
has title: change textfield in action listener
duplicate of: http://stackoverflow.com/q/1299837
tagged with: java
linked to: http://stackoverflow.com/q/1299837
type: Question

http://stackoverflow.com/q/22626112
tagged with: wildfly
upvote count: 1
has title: producing EntityManager throws __FIRST_PHASE__ is missing
type: Question
tagged with: java
tagged with: hibernate
tagged with: persistence.xml
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22634364
favorite count: 0
has body: Here's my error ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]} ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "test.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]} and the caused by portion of the stack trace Caused by: java.lang.Exception: "JBAS014807: Management resource '[(\"deployment\" => \"test.war\")]' not found" at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getActionResult(ServerDeploymentPlanResultFuture.java:134) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final] at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getResultFromNode(ServerDeploymentPlanResultFuture.java:123) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final] at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:85) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final] at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:42) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final] and relevant log output 2014-03-25 00:06:26,543 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 3) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {"JBAS…
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/22634364

http://stackoverflow.com/q/22528893
tagged with: java
has comment: http://stackoverflow.com/comment/34282525
answer count: 5
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/22528976
downvote count: 4
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22529034
has body: I have a database with a field called numberRange which is not a primary key. Now in Java, how do I get all the numbers in the range 101000001 - 10100050? I want to display it to display, 10100001, 101000002, 101000003, 101000004, ... 10100050. I would greatly appreciate it if someone could help me out here, I am really struggling at the moment. Edit, database looks like this StockID|StockName|StockPrice|StockLevels 1 | Water| £0.50 | 101000001 - 10100050
type: Question
has answer: http://stackoverflow.com/a/22529041
tagged with: range
has answer: http://stackoverflow.com/a/22528974
has comment: http://stackoverflow.com/comment/34282450
has answer: http://stackoverflow.com/a/22529004
has title: How do I get all the numbers within a range JAVA?
has comment: http://stackoverflow.com/comment/34282356

http://stackoverflow.com/a/22600981
has comment: http://stackoverflow.com/comment/34411131
has comment: http://stackoverflow.com/comment/34411077
score: 0
answers question: http://stackoverflow.com/q/22600775
upvote count: 1
downvote count: 1
has body: I don't know how your packages separated,while when the transport data contains too many parameters,My advice is to create a new Object that calls DTO(data transport object) in javaee.As you said,it's not easy to guarantee. Otherwise,to use CALLBACK is a better way that could be easily guaranteed and extended.Nothing is perfect,you'd choose which aspect is your attention. callback seen as void function(Callback callback){ callback.do(); } This is my advice but not a exactly correct way.Maybe it's helpful for you.
has comment: http://stackoverflow.com/comment/34411313
type: Answer

inheritance
tags question: http://stackoverflow.com/q/22609617
tags question: http://stackoverflow.com/q/22642666
tags question: http://stackoverflow.com/q/22582598
tags question: http://stackoverflow.com/q/22536992
tags question: http://stackoverflow.com/q/22582522
tags question: http://stackoverflow.com/q/22647768
tag name: inheritance
tags question: http://stackoverflow.com/q/22576709
tags question: http://stackoverflow.com/q/22501398
tags question: http://stackoverflow.com/q/22583525
tags question: http://stackoverflow.com/q/22556237
type: Tag
tags question: http://stackoverflow.com/q/22491589
tags question: http://stackoverflow.com/q/22516572
tags question: http://stackoverflow.com/q/22587330
tags question: http://stackoverflow.com/q/22585041
tags question: http://stackoverflow.com/q/22531284
tags question: http://stackoverflow.com/q/22599227
tags question: http://stackoverflow.com/q/22542592
tags question: http://stackoverflow.com/q/22574758
tags question: http://stackoverflow.com/q/22539945
tags question: http://stackoverflow.com/q/22581102
tags question: http://stackoverflow.com/q/22517047
tags question: http://stackoverflow.com/q/22567851
tags question: http://stackoverflow.com/q/22613159

http://stackoverflow.com/q/22497165
score: 11
linked to: http://stackoverflow.com/q/23923443
tagged with: java-8
type: AnsweredQuestion
has title: Does SonarQube support Java 8 yet?
tagged with: java
tagged with: sonarqube
has comment: http://stackoverflow.com/comment/34227769
type: Question
possible better answer: http://stackoverflow.com/a/22789685
has comment: http://stackoverflow.com/comment/34227067
has answer: http://stackoverflow.com/a/22789685
has body: With Java 8, executing gradle sonarRunner shows this error message. (sonarQube version : 4.2.1) java.lang.ArrayIndexOutOfBoundsException: 26721 at org.objectweb.asm.ClassReader.readClass(Unknown Source) [asm-all-3.2.jar:5.0_BETA] at org.objectweb.asm.ClassReader.accept(Unknown Source) [asm-all-3.2.jar:5.0_BETA] at org.objectweb.asm.ClassReader.accept(Unknown Source) [asm-all-3.2.jar:5.0_BETA] at org.sonar.java.bytecode.asm.AsmClassProviderImpl.decoracteAsmClassFromBytecode(AsmClassProviderImpl.java:76) [java-squid-2.0.jar:na] at org.sonar.java.bytecode.asm.AsmClassProviderImpl.getClass(AsmClassProviderImpl.java:55) [java-squid-2.0.jar:na] at org.sonar.java.bytecode.asm.AsmClassVisitor.visit(AsmClassVisitor.java:52) [java-squid-2.0.jar:na] at org.objectweb.asm.ClassReader.accept(Unknown Source) [asm-all-3.2.jar:5.0_BETA] at org.objectweb.asm.ClassReader.accept(Unknown Source) [asm-all-3.2.jar:5.0_BETA] ``` Does SonarQube not support Java 8 yet? I would like to know when support is available. Thank you.
downvote count: 0
has answer: http://stackoverflow.com/a/22499925
answer count: 3
has answer: http://stackoverflow.com/a/23312000
upvote count: 11
favorite count: 0
accepted answer: http://stackoverflow.com/a/23312000

http://stackoverflow.com/comment/57195127
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22493171
has text: Possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it)
type: Comment

rfid
tag name: rfid
type: Tag
tags question: http://stackoverflow.com/q/22490490

http://stackoverflow.com/comment/34353706
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22568898
has text: @fge How to solve the issue then, because I am using the same URL to get the information when I am entering it in the browser.
score: 0

http://stackoverflow.com/comment/34213447
type: QuestionComment
type: Comment
has text: It is certainly easier to write, but the competition is fierce!
score: 0
comment on: http://stackoverflow.com/q/22489120

http://stackoverflow.com/a/52889609
type: Answer
answers question: http://stackoverflow.com/q/22542833
has body: This must work perfectly. I tested it out. int age=0; String name; Scanner sc = new Scanner(System.in); System.out.print("Enter Age: "); age = sc.nextInt(); System.out.print("Enter Name: "); name= sc.nextLine();
has comment: http://stackoverflow.com/comment/92693236
score: 0

http://stackoverflow.com/a/22519973
upvote count: 2
answers question: http://stackoverflow.com/q/22519898
type: AcceptedAnswer
has body: Try this: SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); SimpleDateFormat outputFormat = new SimpleDateFormat("dd/MM/yy HH/mm a"); Date myDate = inputFormat.parse("2014-03-19 23:51:10 +0000"); System.out.println(outputFormat.format(myDate));
has comment: http://stackoverflow.com/comment/34279367
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34266988
has comment: http://stackoverflow.com/comment/34298398
has comment: http://stackoverflow.com/comment/34295914
accepted answer of: http://stackoverflow.com/q/22519898

http://stackoverflow.com/comment/34345880
type: AnswerComment
has text: when i write buf to the outputstream of the socket who reads from it?
type: Comment
comment on: http://stackoverflow.com/a/22564428
score: 1

http://stackoverflow.com/q/22516261
tagged with: delay
has comment: http://stackoverflow.com/comment/34260525
has answer: http://stackoverflow.com/a/22516419
has comment: http://stackoverflow.com/comment/34262070
answer count: 3
has title: Huge delay when socketing in java
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34261469
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/22517375
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34264489
type: Question
has answer: http://stackoverflow.com/a/22517184
has body: (UPDATED CODE) I'm trying to make clients communicate with server (I've made simple client-server apps, like a chatroom). The communication is created, but there is a huge delay (I send coordinates from the client to the server). It's over 10 seconds (sometimes even more). What could be the problem? The client: public class GameComponent extends Canvas implements Runnable { private static final long serialVersionUID = 1L; private static final int WIDTH = 320; private static final int HEIGHT = 240; private static final int SCALE = 2; private boolean running; private JFrame frame; Thread thread; public static final int GRID_W = 16; public static final int GRID_H = 16; private Socket socket; private DataInputStream reader; private DataOutputStream writer; private HashMap&lt;Integer, OtherPlayer&gt; oPlayers; private ArrayList&lt;OtherPlayer&gt; opList; private int maxID = 1; private int ID; Player player; public GameComponent() { //GUI code.. oPlayers = new HashMap&lt;Integer, OtherPlayer&gt;(); //Hash map to be able to get players by their ID's opList = new ArrayList&lt;OtherPlayer&gt;(); //And an array list for easier drawing setUpNetworking(); start(); } public void start() { if (running) return; running = true; thread = new Thread(this); player = new Player(GRID_W * 2, GRID_H * 2); thread.start(); } public void stop() { if (!running) return; running = false; } public void run() { //The main loop, ticks 60 times every second long lastTime = System.nanoTime(); double nsPerTick = 1000000000D / 60D; int frames = 0; int ticks = 0; long lastTimer = System.currentTimeMillis(); double delta = 0; while (running) { long now = System.nanoTime(); delta += (now - lastTime) / nsPerTick; lastTime = now; boolean shouldRender = true; while (delta &gt;= 1) { ticks++; tick(delta); delta -= 1; shouldRender = true; } try { Thread.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } if (shouldRender) { frames++; render(); } if (System.currentTimeMillis() - lastTimer &gt;=…

http://stackoverflow.com/comment/34395035
has text: This seems to be a pretty standard way of mapping between enum values in Java. Why is it clunky? You have a quick hashed lookup.
type: Comment
comment on: http://stackoverflow.com/q/22592219
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34407003
comment on: http://stackoverflow.com/q/22597046
has text: what's the question here?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22596669
linked to: http://stackoverflow.com/q/513832
duplicate of: http://stackoverflow.com/q/513832
possible better answer: http://stackoverflow.com/a/22596803
has answer: http://stackoverflow.com/a/22596972
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34403312
score: -4
type: Question
has body: I have following code: class Ideone { public static void main (String[] args) throws java.lang.Exception { CharSequence cs = "5.00"; double danswer = 5.0000; DecimalFormat df = new DecimalFormat("#.00"); if(cs.toString() == String.valueOf(df.format(danswer))) { System.out.println("person"); } else { System.out.println("False"); } } } Why am i not able to compare in this case? As both are string values? How can i compare the values in this case?
has title: Compare CharSequence with String.valueOf
tagged with: java
downvote count: 4
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/22596759
favorite count: 0
has comment: http://stackoverflow.com/comment/34403268
accepted answer: http://stackoverflow.com/a/22596759
has answer: http://stackoverflow.com/a/22596803

http://stackoverflow.com/comment/34370126
has text: I want a path relative to the root of the app. I can do that with the servlet, but not from the XSLT file.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22577509
score: 0

eclipse-jdt
tags question: http://stackoverflow.com/q/22548545
tags question: http://stackoverflow.com/q/22522870
tag name: eclipse-jdt
type: Tag
tags question: http://stackoverflow.com/q/22531237
tags question: http://stackoverflow.com/q/22602792

http://stackoverflow.com/comment/34643914
has text: Could you check my answer above, because i insert my code it works and i want to you check which one better mine or yours or no different because i think if the code written in simple way will execute better.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22576484

http://stackoverflow.com/comment/34455134
type: AnswerComment
score: 0
type: Comment
has text: So, can I get right azimuth in any Orientation mode, using your answer?
comment on: http://stackoverflow.com/a/22588516

http://stackoverflow.com/comment/34446712
type: QuestionComment
score: 0
has text: So you're able to convert the keyboard event codes to `char` and add them with `StringBuilder`? How do you do this--`getEventCharacter()`? If that works, then what does `getEventCharacter()` return for `Shift`, `CapsLock`, `F1-F12`? I don't know anything about LWJGL, I'm just looking at the javadoc.
type: Comment
comment on: http://stackoverflow.com/q/22620454

http://stackoverflow.com/q/22553292
linked to: http://stackoverflow.com/q/22497518
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22553435
has comment: http://stackoverflow.com/comment/34326898
has title: I have a json object. I want to access in java service. I am trying to parse it
has answer: http://stackoverflow.com/a/22553804
accepted answer: http://stackoverflow.com/a/22554157
has comment: http://stackoverflow.com/comment/34325860
possible better answer: http://stackoverflow.com/a/22553435
has comment: http://stackoverflow.com/comment/34325547
type: AnsweredQuestion
has body: I am using import net.sf.json.JSONObject My object is like this: [{ "courseId": "AUTO_CAD", "strDate": "02-04-2012" }, { "courseId": "CNC_PROG", "strDate": "03-04-2012" }] Please help me how to access this in java service //The code that i have tried. List&lt;JSONObject&gt; jsonList = new ArrayList&lt;JSONObject&gt;(); jsonList = (List&lt;JSONObject&gt;) context.get("courseData"); // courseDate is my json object JSONObject obj = jsonList.get(0); Debug.log("courseStartDate ="+ obj.getJSONObject("courseId")); //Using this gives me the following error. org.ofbiz.webapp.event.EventHandlerException: Service invocation error (java.lang.String cannot be cast to net.sf.json.JSONObject)
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/34329212
has answer: http://stackoverflow.com/a/22554157
tagged with: javascript
has comment: http://stackoverflow.com/comment/34325436
has comment: http://stackoverflow.com/comment/34325434

http://stackoverflow.com/q/22638824
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34479385
has comment: http://stackoverflow.com/comment/34479420
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/34478425
has title: Remote Debugging with Tomcat and Eclipse - What could be the issue?
has comment: http://stackoverflow.com/comment/34478243
tagged with: eclipse
score: 0
tagged with: tomcat
has body: I have Tomcat 7 running in my local machine. I deployed a War file and it works fine. I am trying to debug this application from eclipse. I set the following in startup.bat file: set JPDA_ADDRESS=8000 set JPDA_TRANSPORT=dt_socket When I run the startup.bat file from command line, it opens another window and starts tomcat. In the first line I see that debugger is getting started on the port 8000 (something like dt_xxx port 8000). So I can confirm the debugger is started. I configured Eclipse Remote debugging in the debug configuration and attached source for the war file deployed (selected the project). Gave the port and servername (localhost:8000). Set a breakpoint in the Servlet which is called from the browser. When I open the URL, I don't see anything happening in eclipse (I expected it to hit the breakpoint). What could be wrong?

http://stackoverflow.com/comment/34457559
has text: OK, another thing I noticed is that the value of savedCount is not changing. The line to assign value in savedCount is sitting outside the while loop. Can you try putting - savedcount = compareCount.getLong("myrowcount", count); as the first line in the while loop
score: 0
comment on: http://stackoverflow.com/a/22626710
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34452943
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22623538
has text: +1 you are a pragmatic programmer rather than mad, @user2651804 im scare about the power of `GridBagLayout`
score: 0

http://stackoverflow.com/a/22596326
has comment: http://stackoverflow.com/comment/34403661
answers question: http://stackoverflow.com/q/22596297
accepted answer of: http://stackoverflow.com/q/22596297
type: Answer
has comment: http://stackoverflow.com/comment/34402983
score: 2
downvote count: 0
has body: you can use setBackgroundDrawable. Create a BitmapDrawable from your bitmap : BitmapDrawable bd = new BitmapDrawable(yourBitamp); imageView.setBackgroundDrawable(bd); Edit: public void DisplayImage(String url, ImageView imageView) { imageViews.put(imageView, url); Bitmap bitmap=memoryCache.get(url); if(bitmap!=null) { BitmapDrawable bd = new BitmapDrawable(bitmap); imageView.setBackgroundDrawable(bd); } else { queuePhoto(url, imageView); imageView.setImageResource(stub_id); } }
has comment: http://stackoverflow.com/comment/34404428
has comment: http://stackoverflow.com/comment/34499015
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/34227769
type: QuestionComment
has text: This question appears to be off-topic because it is about sonarcube evolution timeline
score: 2
comment on: http://stackoverflow.com/q/22497165
type: Comment

http://stackoverflow.com/a/22530038
score: 21
answers question: http://stackoverflow.com/q/22528848
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Use XMLConstants.W3C_XML_SCHEMA_NS_URI: SchemaFactory factory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI ); The URI "http://www.w3.org/2001/XMLSchema-instance" (value of the XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI) is not an XML schema language by itself, but a property (or feature, or additional mechanism, if you like) of the XML Schema. The proper name for the W3C XML Schema is "http://www.w3.org/2001/XMLSchema" (value of the XMLConstants.W3C_XML_SCHEMA_NS_URI).
upvote count: 21
has comment: http://stackoverflow.com/comment/79839412
accepted answer of: http://stackoverflow.com/q/22528848

http://stackoverflow.com/a/23109227
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22610705
type: Answer
answers question: http://stackoverflow.com/q/22610705
score: 3
upvote count: 3
has body: Instead thinking of disabling and enabling the cell, I just hide and show the cell using CSS. Below is my code which saves me to reach this requirement. GridCellRenderer&lt;AttendanceCaseCreationModel&gt; checkinRenderer=new GridCellRenderer&lt;AttendanceCaseCreationModel&gt;() { @Override public Object render(AttendanceCaseCreationModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore&lt;AttendanceCaseCreationModel&gt; store, Grid&lt;AttendanceCaseCreationModel&gt; grid) { String color="pink"; if(eventcombo.getValue()!=null){ if(eventcombo.getRawValue().equalsIgnoreCase("Forgot To Checkin") || eventcombo.getRawValue().equalsIgnoreCase("Mark/Modify Attendance")){ color="pink"; } else{ config.style=config.style+ ";visibility: hidden;"; } } config.style=config.style+ ";background-color:" + color + ";"; config.style=config.style+ ";display: block;"; Object value = model.get(property); return value; } };

http://stackoverflow.com/comment/34304175
score: 0
has text: Yea I did some more reading and it sounds like you're correct in regards to the pooling in this case. And I'm not making an argument against following the docs recommendation, I'm more curious why/what the recommendation is for.
type: QuestionComment
comment on: http://stackoverflow.com/q/22539318
type: Comment

http://stackoverflow.com/q/22552678
has body: I am getting the below error while the application polls the messages from different queues (using IBM MQ) and load the same into the some staging tables. ....- Completion Code 1, Reason 2003 com.ibm.mq.MQException: Completion Code 1, Reason 2003 at com.ibm.mq.MQQueueManager.commit(MQQueueManager.java:795) Your help in resolving this would be most appreciated.
tagged with: ibm-mq
has answer: http://stackoverflow.com/a/22614450
type: UnansweredQuestion
tagged with: java
type: Question
has title: IBM MQ Error - Completion Code 1, Reason 2003
score: 0
answer count: 1

http://stackoverflow.com/a/54900244
answers question: http://stackoverflow.com/q/22626980
downvote count: 0
has body: Try writing your code in processRow method as follows: public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException{ Object[] r = getRow(); if (r == null) { setOutputDone(); return false; } Object[] outputRow = createOutputRow(r, data.outputRowMeta.size()); //String row = getString(r)+","; //setValue(outputRow, row) putRow(data.outputRowMeta, outputRow); return true; }
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/34219236
type: AnswerComment
has text: Dont get what you are getting at
comment on: http://stackoverflow.com/a/22492440
score: 0
type: Comment

http://stackoverflow.com/comment/34274144
score: 0
comment on: http://stackoverflow.com/a/22523607
type: AnswerComment
has text: I had side1 = sideA before but lost my file and copied someone elses code who was working with me and didn't realize he had it backwards and for || instead of && it was just experimental to see if the output changes and forgot to change it back. what does Math.abs mean and why use epsilon? Is there a way to attach and post a pdf so you can see what the assignment is?
type: Comment

http://stackoverflow.com/a/22539280
type: Answer
has comment: http://stackoverflow.com/comment/34303930
has body: You could fire up jetty embedded. The jetty instance could then serve in memory html strings as web pages via a Servlet / Handler.
answers question: http://stackoverflow.com/q/22538457
score: 0
upvote count: 1
downvote count: 1

macos
tags question: http://stackoverflow.com/q/22604218
tags question: http://stackoverflow.com/q/22510622
tags question: http://stackoverflow.com/q/22520802
tags question: http://stackoverflow.com/q/22544732
tags question: http://stackoverflow.com/q/22598006
tags question: http://stackoverflow.com/q/22557902
tags question: http://stackoverflow.com/q/22512100
tags question: http://stackoverflow.com/q/22527924
tags question: http://stackoverflow.com/q/22635786
tags question: http://stackoverflow.com/q/22645011
tags question: http://stackoverflow.com/q/22588842
tags question: http://stackoverflow.com/q/22534574
tags question: http://stackoverflow.com/q/22559604
tags question: http://stackoverflow.com/q/22581886
tags question: http://stackoverflow.com/q/22539983
type: Tag
tags question: http://stackoverflow.com/q/22519596
tags question: http://stackoverflow.com/q/22539779
tags question: http://stackoverflow.com/q/22585944
tags question: http://stackoverflow.com/q/22625623
tag name: macos
tags question: http://stackoverflow.com/q/22542061

http://stackoverflow.com/comment/34535181
type: Comment
has text: 1- for-each loops are available in Java 6+. 2- as shown in the example cb.getData(DataFlavor.javaFileListFlavor) returns a java.util.List, you can't make it a String
comment on: http://stackoverflow.com/a/22603155
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34218920
comment on: http://stackoverflow.com/q/22491853
score: 0
type: Comment
has text: @JonSkeet `this question applies for all Java boolean comparisons and not just the link`. I want to know the better practice for all `Boolean` comparisons
type: QuestionComment

http://stackoverflow.com/a/22559316
downvote count: 2
score: -2
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22558993
has body: Using JConsole The JConsole graphical user interface is a monitoring tool that complies to the Java Management Extensions (JMX) specification. JConsole uses the extensive instrumentation of the Java Virtual Machine (Java VM) to provide information about the performance and resource consumption of applications running on the Java platform. In the Java Platform, Standard Edition (Java SE platform) 6, JConsole has been updated to present the look and feel of the Windows and GNOME desktops (other platforms will present the standard Java graphical look and feel). The screen captures presented in this document were taken from an instance of the interface running on Windows XP. Starting JConsole The jconsole executable can be found in JDK_HOME/bin, where JDK_HOME is the directory in which the Java Development Kit (JDK) is installed. If this directory is in your system path, you can start JConsole by simply typing jconsole in a command (shell) prompt. Otherwise, you have to type the full path to the executable file. Command Syntax You can use JConsole to monitor both local applications, namely those running on the same system as JConsole, as well as remote applications, namely those running on other systems. source : http://docs.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html

http://stackoverflow.com/comment/34346549
type: AnswerComment
score: 0
type: Comment
has text: It seems not work. This is my first time to use Robot. Can you provide more details? Thank you.
comment on: http://stackoverflow.com/a/22564873

http://stackoverflow.com/q/22620381
has answer: http://stackoverflow.com/a/22974416
score: 1
tagged with: java
upvote count: 1
has body: When I build my Maven project or generate my eclipse configuration using mvn eclipse:eclipse, I get the following error: [ERROR] Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.28:docs (default) on project appserver-server: Problem assembling the enunciate app. String index out of range: 0 -> [Help 1] I have isolated the issue to a single dependency: com.tinkerpop.blueprints blueprints-neo4j-graph 2.4.0 I need this dependency, so getting rid of it isn't an option but why is this causing an error in enunciate to appear? Is there any way to fix this? Edit: after some further testing, the root of the problem may be from this dependency of a dependency of a dependency of a dependency of the previous dependency: org.scala-lang scala-library 2.10.4 Full error: [ERROR] Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.28:docs (default) on project appserver-server: Problem assembling the enunciate app. String index out of range: 0 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.28:docs (default) on project appserver-server: Problem assembling the enunciate app. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:364) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleB…
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/22974416
type: Question
tagged with: enunciate
has title: Maven enunciate error: "String index out of range: 0"
tagged with: tinkerpop
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35082543
tagged with: maven
type: AnsweredQuestion

http://stackoverflow.com/comment/34481991
score: 0
type: Comment
type: QuestionComment
has text: And the number is actually closer to 256 values
comment on: http://stackoverflow.com/q/22640862

http://stackoverflow.com/a/22598553
has body: You are closing the Scanner element, so you are closing the underlying InputStream, System.in So, no other Scanner can read again and a java.util.NoSuchElementException Will be thrown.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22598449
type: Answer
answers question: http://stackoverflow.com/q/22598449
score: 0

http://stackoverflow.com/q/22498257
has comment: http://stackoverflow.com/comment/34228843
score: 0
answer count: 3
has body: I have created a class in Java named Farm which contains a list of animals(cow,pig and chick). myFarm is an array of object of Farm class containing objects of NamedCow,pig and chick class. my sample code goes here: import java.util.*; class Farm { private ArrayList&lt; Animal &gt; myFarm; Farm() { myFarm=new ArrayList&lt;Animal&gt;(); myFarm.add(new NamedCow("cow","Elsie","moo")); myFarm.add(new Chick("chick","cheep","cluck")); myFarm.add(new Pig("pig","oink")); } public void animalSounds(){ Animal temp; for(int i = 0; i &lt; myFarm.size(); i++){ temp = myFarm.get(i); System.out.println(temp.getType() + " goes " + temp.getSound()); } NamedCow named = (NamedCow)myFarm.get(0); System.out.println(named.getName()); } } I have not understand one line in my code: NamedCow named = (NamedCow)myFarm.get(0); here what is the meaning of the NamedCow enclosed within parentheses in the right side. Cn anyone please tell me??
has comment: http://stackoverflow.com/comment/34228766
has answer: http://stackoverflow.com/a/22498452
has answer: http://stackoverflow.com/a/22498611
accepted answer: http://stackoverflow.com/a/22498452
possible better answer: http://stackoverflow.com/a/22498310
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34228797
has answer: http://stackoverflow.com/a/22498310
tagged with: java
type: Question
has title: Suggestion needed for Java Program

http://stackoverflow.com/comment/34242843
score: 0
comment on: http://stackoverflow.com/q/22505389
has text: I inject it like this: @Autowired private AsyncWorker asyncWorker;
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34298000
comment on: http://stackoverflow.com/q/22537532
score: 0
type: Comment
type: QuestionComment
has text: any other efficient alternative?

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

http://stackoverflow.com/comment/34261724
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22517073
has text: @Cobbles with readShort() of course, but from an DataInputStream()
score: 0

http://stackoverflow.com/a/22588639
has comment: http://stackoverflow.com/comment/34410199
score: 1
has comment: http://stackoverflow.com/comment/34419463
upvote count: 1
answers question: http://stackoverflow.com/q/22588591
has body: EDIT: It seems that your problem is that you're trying to do all this image processing work in asynctasks launched by your activity. Have you considered changing your app architecture to rely all this background processing to a service? You can use the activity to show some UI information while you process the image in your service, or if you don't need this UI just simply communicate with the service (through broadcast, for example) to provide it the image and let the service show some information of the process through notifications. If you don't want to keep your activity alive when you exit it you can use android:noHistory="true" in your activity declaration at the manifest More info here
has comment: http://stackoverflow.com/comment/34396684
has comment: http://stackoverflow.com/comment/34389970
downvote count: 0
has comment: http://stackoverflow.com/comment/34438387
has comment: http://stackoverflow.com/comment/34396173
has comment: http://stackoverflow.com/comment/34389341
type: Answer
has comment: http://stackoverflow.com/comment/34438559

http://stackoverflow.com/a/22627575
accepted answer of: http://stackoverflow.com/q/22627538
score: 5
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/22627538
has body: It seems to me like your deployment descriptor servlet declaration doesn't have an load-on-startup value bigger than 0. If you have omitted that element, the Servlet will only be initialized when the container deems that it should handle a request. Until then, the init method is not called. By providing the load-on-startup value, like so servlet com.example.YourServlet 1 You are telling the container to initialize the Servlet right away, therefore invoking your init method on startup, rather than when the first request for that servlet arrives.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22642308
has comment: http://stackoverflow.com/comment/34484680
type: Answer
accepted answer of: http://stackoverflow.com/q/22642089
answers question: http://stackoverflow.com/q/22642089
has comment: http://stackoverflow.com/comment/34485038
has body: Since that is an Android resource and not one you created, append the android prefix to it like so BTArrayAdapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1);
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/22503480
has comment: http://stackoverflow.com/comment/34395959
type: AcceptedAnswer
downvote count: 0
has body: Simple answer: It doesn't. The MySQL driver - by default - will simply execute a query string created from the parameterized query and the (escaped) parameter values. It will create this query locally by replacing the parameter placeholders with the escaped values and then send it to the server Note that JDBC does not require that a PreparedStatement is actually prepared server side, nor that it 'improves' performance. JDBC only requires that they work; as in: you can specify queries with ? as parameterplaceholders, and the driver will correctly execute the statement with the values set through the setXXX methods. Also note that MySQL does have server side prepared statements, but you need to explicitly enable this using the connection property useServerPrepStmts with value true.
has comment: http://stackoverflow.com/comment/34245561
score: 3
type: Answer
answers question: http://stackoverflow.com/q/22502954
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22502954
has comment: http://stackoverflow.com/comment/34246724

http://stackoverflow.com/q/22588396
type: Question
has answer: http://stackoverflow.com/a/22588407
accepted answer: http://stackoverflow.com/a/22588407
answer count: 2
possible better answer: http://stackoverflow.com/a/22684486
has title: How I can make my constructor synchronized?
tagged with: synchronized
linked to: http://stackoverflow.com/q/12611366
favorite count: 0
has body: I have a class. public CarSold{ static int count; CarSold(){count++;} // Other code } Now this is running in multithreading enviroment. And I read here that constructors are not implicitly syncronized. In that case, there is a chance that I don't have the correct count of cars sold in the count variable. What is the way to make sure that it has a correct count? I can think of 2 ways. Class level locking inside the constructor using synchronized(CarSold.class) I can use AtomicInteger. Can this 2 approach solves the problem ? And is there is any other way? Thanks.
upvote count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/22684486
downvote count: 1
type: AnsweredQuestion
tagged with: default-constructor
score: 1
tagged with: java

http://stackoverflow.com/comment/34377376
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22582315
type: AnswerComment
has text: my document lies in the web folder.

http://stackoverflow.com/q/22525025
has answer: http://stackoverflow.com/a/22525453
has answer: http://stackoverflow.com/a/22525147
has title: best way to search and print the specific block of strings from file?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34275802
score: 0
has comment: http://stackoverflow.com/comment/34275770
answer count: 3
has body: what is the best way to print the specific lines of strings from file? for example: file.txt Id : 123 car : toyota model : 1998 Id : 129 car : merecdes model :2007 at console: Enter ID to search specific car and model: 123 ID : 123 car: Toyota model : 1998 code: /* skipped the "write file" portion of the code */ trying to implement: "Read the id and print car and name" according to the example File mfile = new File("Employee.txt"); Scanner scan = new Scanner(mfile); int firstline=0; // String thisLine = null; LineNumberReader m = new LineNumberReader(new FileReader(mfile)); // LineNumberReader lnr = new LineNumberReader(new FileReader(new File("Employee"))); BufferedReader br = new BufferedReader(m); while(scan.hasNextLine()){ /* myEmployee.getID(); myEmployee.getName(); myEmployee.getAge(); */ String line = scan.nextLine();// check next line String s = null; firstline++; if(firstline==1) { System.out.println(line); String line2 = scan.nextLine(); firstline++; if(s== "Name"){ System.out.println(line2); } } } scan.close();
has answer: http://stackoverflow.com/a/22525196
has comment: http://stackoverflow.com/comment/34275786
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34275734

http://stackoverflow.com/q/22600087
tagged with: java
accepted answer: http://stackoverflow.com/a/22600159
type: Question
has body: I have a file which, when read by Java FileReader, prints (println) a bunch of file directories which is in this format: Z:\123456_tre\12345.mpg;0;2343;3423;43234 I need to find a way so that I can automatically take the file name (12345.mpg) which is in between the second back slash "\" and the first semi colon ";" in that line I believe I have to use regex in order to achieve this, but the light has not come upon me yet. I was thinking to use a counter variable to count all the slashes. When counter == 2, take the following strings until it reaches a semicolon then stop. Then return the string that was read. Any help will be fully appreciated! thank you very much!
has comment: http://stackoverflow.com/comment/34409793
has title: Selecting specific words or phrases in a sentence
has answer: http://stackoverflow.com/a/22600256
tagged with: substring
score: 0
has comment: http://stackoverflow.com/comment/34409502
tagged with: string
has answer: http://stackoverflow.com/a/22600159
linked to: http://stackoverflow.com/q/16825979
answer count: 4
possible better answer: http://stackoverflow.com/a/22600123
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22600188
has answer: http://stackoverflow.com/a/22600123

http://stackoverflow.com/comment/34452131
type: Comment
comment on: http://stackoverflow.com/a/22623538
has text: Here are two screencasts that should illustrate my problem: http://screencast.com/t/dBPyVAwfT and http://screencast.com/t/ZolTEEADS
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34527101
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22641636
has text: I tried to implement something, but nothing good came out. How can I access the file this way ? (I tried to use socket)

http://stackoverflow.com/a/22516423
type: Answer
answers question: http://stackoverflow.com/q/22516331
upvote count: 17
has comment: http://stackoverflow.com/comment/112178675
has body: myString::charAt would take an int and return a char, and might be used for any lambda that works that way. It translates, essentially, to index -&gt; myString.charAt(index). String::length would take a String and return an int. It translates, essentially, to string -&gt; string.length(). String::charAt would translate to (string, index) -&gt; string.charAt(index).
score: 17
has comment: http://stackoverflow.com/comment/34263784
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22516331

http://stackoverflow.com/comment/34377397
comment on: http://stackoverflow.com/q/22581907
type: Comment
type: QuestionComment
has text: i'm not sure what you mean by "often", as-in if the code does math on the number or something?... this piece of code takes these values out of the DB2 (using ohoref as one of the unique identifiers) and does some logic, then eventually puts these values into a mysql database.
score: 0

http://stackoverflow.com/a/22489710
type: Answer
has body: There is no reason why you should use a DataInputStream at all. Use Files: final Path dstFile = Paths.get("path/to/dstfile"); Files.copy(url.openStream(), dstFile);
answers question: http://stackoverflow.com/q/22489553
score: 0

http://stackoverflow.com/q/22528264
has body: Is there any alternative way to prevent XSS attack than OWASP XSS filter software? I need suggestion if it is possible to prevent at apache level. I am not security expert so need detailed information. Thanks for your help
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/22533425
possible better answer: http://stackoverflow.com/a/22547722
tagged with: java
has answer: http://stackoverflow.com/a/22547722
answer count: 2
tagged with: security-testing
has title: XSS attack : Alternative to OWASP?
tagged with: xss
score: 0
has answer: http://stackoverflow.com/a/22533425
tagged with: owasp

http://stackoverflow.com/comment/34405669
has text: sorry about that my concatenation method is only printing out the first word for example 'abc' where as im trying to add another word to the end of it to make it 'abcdefg'. where as the removeword isn't removing the words and my double char is only printing it out 'abc' instead of 'aabc'
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22597708

http://stackoverflow.com/a/22582802
has comment: http://stackoverflow.com/comment/34384499
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22582672
has comment: http://stackoverflow.com/comment/34380806
downvote count: 0
has body: ScriptEngine::eval can throw a ScriptException. The line causing you the error is double display = (double) engine.eval(tarea);. You need to wrap the line in a try-catch and handle the Exception.

http://stackoverflow.com/comment/34679398
has text: @DavidMays the location was returning zero for bearing. I placed the polygonOptions inside of the onLocationchanged(Location location) and it is working fine now. If you want to place that as an answer I'll give you the bounty.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22585189
type: Comment

http://stackoverflow.com/comment/34343702
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22560924
score: 0
has text: if you have some example html you could show it would make it easier to visualize what we're talking about

http://stackoverflow.com/q/22587969
score: 10
accepted answer: http://stackoverflow.com/a/22591497
has comment: http://stackoverflow.com/comment/34387913
has comment: http://stackoverflow.com/comment/34387893
tagged with: java
answer count: 2
has body: Let me explain my scenario. I have some hierarchy that I need to maintain. Find below an image that shows this hierarchy. I will explain after the image. A | +--&gt; A1.1 ---&gt; X | | +--&gt; A1 ---+--&gt; A1.2 ---&gt; Y | | | . +--&gt; A2 . . . From A to A1, A2... it is a one to many relationship From A1 to A1.1, A1.2... it is a one to many relationship From A1.1 to X and A1.2 to Y it is a one to one relationship. Initially I had designed it in such a way that it uses multiple HashMaps to maintain this. But then I quickly realized that updating becomes an extremely hard job. Having multiple HashMaps means that I have to handle the uniqueness across the different relationships myself. For example A1.1 can exist within a root B node as well. so im having to append A to A1.1 so that I can ensure uniqueness. Now if i have to modify the value A then I am in major trouble since I have used that to qualify all keys within A as A_A1.1 Now i'm thinking that I can use Nested HashMaps for this. So the code for this becomes: HashMap&lt;String, HashMap&lt;String, HashMap&lt;String, CustomObject&gt;&gt;&gt; _worldsBiggestHash; Is this practice ok? I do have a lot of bookkeeping to do since I'll be using nested hashes but at least CRUD and uniqueness problems handles itself. If this isn't okay, could anyone suggest another better structure that I can use?
has comment: http://stackoverflow.com/comment/34387927
upvote count: 10
has comment: http://stackoverflow.com/comment/34387812
possible better answer: http://stackoverflow.com/a/22588060
tagged with: hashmap
has title: Is it a bad practice to use nested HashMaps?
has answer: http://stackoverflow.com/a/22588060
tagged with: data-structures
has comment: http://stackoverflow.com/comment/34387845
has comment: http://stackoverflow.com/comment/34387838
has comment: http://stackoverflow.com/comment/34387808
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22591497
type: Question
has comment: http://stackoverflow.com/comment/34387873
has comment: http://stackoverflow.com/comment/34387799

http://stackoverflow.com/q/22542155
linked to: http://stackoverflow.com/q/1972933
accepted answer: http://stackoverflow.com/a/22628985
has comment: http://stackoverflow.com/comment/34460874
upvote count: 3
answer count: 1
tagged with: primefaces
has comment: http://stackoverflow.com/comment/34306930
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34306872
has answer: http://stackoverflow.com/a/22628985
type: AnsweredQuestion
tagged with: validation
downvote count: 0
has comment: http://stackoverflow.com/comment/34307425
has body: I was trying to create a somewhat more complex Cross-Field Bean-Validation in the style of this here. What quite quickly became a problem, as soon as I returned false on validating the instance of my entity, that was passed to my custom validator. I thus created a field level constraint annotation, as described in the Hibernate tutorial, but even simpler. Actually my validation was only: @Overrides public bool isValid(Object value, ConstraintValidatorContext arg1){ System.out.println("##### isValid call for example."); return false; } This worked fantastically. As soon as I annotated a Field with the Annotation, any persistence-attempt was smashed and the field was marked as invalid. Now back to my class-level validator: @Target({TYPE, ANNOTATION_TYPE}) @Retention(RUNTIME) @Constraint(validatedBy = CrossFieldConstraintValidator.class) public @interface CrossFieldConstraint { String message() default "CrossFieldConstraint violation"; Class&lt;?&gt;[] groups() default {}; Class&lt;? extends Payload&gt;[] payload() default {}; } Not much to see here, just your standard Constraint Annotation, which defines a message, where it's validated and where it may be put. now when passing that to my CrossFieldConstraintValidator I recieved some overlong stacktrace. I'll paste a "slightly" shortened version, which keeps all: caused by, but removes some of the trail on it... 19:04:31,806 WARN [com.arjuna.ats.arjuna] (http-localhost-127.0.0.1-8443-3) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple&lt; 0:ffffac10b1bd:32279610:5328864c:15fa, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@1380d1b &gt;: javax.persistence.PersistenceException: error during managed flush at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1486) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final] at org.hibernate.engine.transaction.synchronization.internal…
has comment: http://stackoverflow.com/comment/34306758
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34306509
score: 3
has title: False on Class-Level Constraint Validation makes Arjuna TwoPhaseCoordinator.beforeCompletion fail

http://stackoverflow.com/a/22602025
upvote count: 1
has comment: http://stackoverflow.com/comment/34412887
score: 1
has body: Your final statement is part of the outer loop. System.out.println("."); Since you have a single if-else statement in the inner loop, braces were not needed. Always use braces to define the scope of the loop and for the sake of readability. for (int i = 0; i&lt;10; i++) { for (int c = 0; c &lt; 10; c++) { if(i == c) { System.out.print("*"); } else { System.out.print("-"); } } System.out.println("."); }
has comment: http://stackoverflow.com/comment/34412966
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22601986

http://stackoverflow.com/q/22572339
tagged with: java
has answer: http://stackoverflow.com/a/22572435
tagged with: soundcloud
tagged with: api
type: AnsweredQuestion
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22572435
possible better answer: http://stackoverflow.com/a/22572415
score: 0
answer count: 2
tagged with: authentication
has answer: http://stackoverflow.com/a/22572415
upvote count: 1
has comment: http://stackoverflow.com/comment/34359846
downvote count: 1
has title: Can I access SoundCloud API without authenticating?
has body: I am using java-api-wrapper to use the SoundCloud API in Java, and I want to access resources without authenticating. In the readme examples, the usage is: ApiWrapper wrapper = new ApiWrapper("client_id", "client_secret", null, null); // Do I HAVE to do this? wrapper.login("username", "password"); HttpResponse resp = wrapper.get(Request.to("/me")); HttpResponse resp = wrapper.put(Request.to("/me") .with("user[full_name]", "Che Flute", "user[website]", "http://cheflute.com") .withFile("user[avatar_data]", new File("flute.jpg"))); How can I do this?

http://stackoverflow.com/comment/34384780
type: Comment
has text: @Andrew121007 You can have mutable objects in a `HashMap`, as long as none of the fields that affect the hash code are mutable.
comment on: http://stackoverflow.com/a/22585196
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34394605
type: Comment
has text: Your regex breaks with this input `Hello \\Wo rld\\ our world \\test now` java escaped `\\ ` used.
type: AnswerComment
comment on: http://stackoverflow.com/a/22591818
score: 0

http://stackoverflow.com/comment/34260448
has text: Just wondering, but `listofbooks` isn't synchronized, nor is the loop, and I don't think a loop can acquire an object's lock just by being a loop. Please correct me if I'm wrong, but wouldn't `ConcurrentModEx` be thrown if a thread attempts to affect an object while another Thread has the lock?
type: Comment
comment on: http://stackoverflow.com/a/22516396
score: 0
type: AnswerComment

http://stackoverflow.com/a/22502573
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22502339
type: AcceptedAnswer
downvote count: 0
has body: You can do this with positive lookahead assertions: \( # Match ( (?=[^()]*\b21\b) # Assert that 21 can be matched within this group (?=[^()]*\b33\b) # Assert that 33 can be matched within this group \d+ # Match a number (?: # Start of non-capturing group: \| # Match | \d+ # Match a number )* # any number of times, including 0 \) # Match ) or, in Java: Pattern regex = Pattern.compile( "\\( # Match (\n" + "(?=[^()]*\\b21\\b) # Assert that 21 can be matched within this group\n" + "(?=[^()]*\\b33\\b) # Assert that 33 can be matched within this group\n" + "\\d+ # Match a number \n" + "(?: # Start of non-capturing group:\n" + " \\| # Match |\n" + " \\d+ # Match a number\n" + ")* # any number of times, including 0\n" + "\\) # Match )", Pattern.COMMENTS); See it live on regex101.com.
accepted answer of: http://stackoverflow.com/q/22502339
upvote count: 2

http://stackoverflow.com/q/22490936
type: Question
tagged with: frameworks
tagged with: eclipse
tagged with: rad
has body: I am using Spring in my Jar file to get the properties from a properties file. I am getting output when i try from my RAD(eclipse). but when i deploy my jar file in server, i keep getting this error. ERROR: Exception org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'nimoConfigurationBean' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:509) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1041) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1044) The error occurs when i get bean: **NimoConfigurationBean obj = (NimoConfigurationBean) context.getBean("nimoConfigurationBean");** XML: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/util http://xml.westfieldgrp.com/public/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/beans http://xml.westfieldgrp.com/public/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/jee http://xml.westfieldgrp.com/public/schema/jee/spring-jee-3.0.xsd" &gt; &lt;bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="location" value="classpath:/config/devint/nimo.properties"/&gt; &lt;/bean&gt; &lt;bean id="nimoConfigurationBean" scope="singleton" class="com.we…
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34216621
favorite count: 0
has answer: http://stackoverflow.com/a/22496499
type: UnansweredQuestion
tagged with: spring
has title: Error: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'nimoConfigurationBean' is defined
score: 1
tagged with: java
upvote count: 1

class
tags question: http://stackoverflow.com/q/22586137
tags question: http://stackoverflow.com/q/22515152
tags question: http://stackoverflow.com/q/22613705
tags question: http://stackoverflow.com/q/22588444
tags question: http://stackoverflow.com/q/22599088
tags question: http://stackoverflow.com/q/22536154
tags question: http://stackoverflow.com/q/22585373
tags question: http://stackoverflow.com/q/22513112
tags question: http://stackoverflow.com/q/22617607
tags question: http://stackoverflow.com/q/22613302
tags question: http://stackoverflow.com/q/22626808
tags question: http://stackoverflow.com/q/22581407
tags question: http://stackoverflow.com/q/22547879
tags question: http://stackoverflow.com/q/22622676
tags question: http://stackoverflow.com/q/22492668
tags question: http://stackoverflow.com/q/22646567
tags question: http://stackoverflow.com/q/22519482
tags question: http://stackoverflow.com/q/22640219
tags question: http://stackoverflow.com/q/22629015
tags question: http://stackoverflow.com/q/22506536
tags question: http://stackoverflow.com/q/22592872
tags question: http://stackoverflow.com/q/22561954
tags question: http://stackoverflow.com/q/22529710
tags question: http://stackoverflow.com/q/22521288
tags question: http://stackoverflow.com/q/22511161
tags question: http://stackoverflow.com/q/22495012
tags question: http://stackoverflow.com/q/22624694
tags question: http://stackoverflow.com/q/22646544
type: Tag
tags question: http://stackoverflow.com/q/22626695
tags question: http://stackoverflow.com/q/22516572
tags question: http://stackoverflow.com/q/22541952
tags question: http://stackoverflow.com/q/22534725
tags question: http://stackoverflow.com/q/22510099
tags question: http://stackoverflow.com/q/22597968
tags question: http://stackoverflow.com/q/22512193
tags question: http://stackoverflow.com/q/22596005
tag name: class
tags question: http://stackoverflow.com/q/22624632
tags question: http://stackoverflow.com/q/22587349
tags question: http://stackoverflow.com/q/22494183
tags question: http://stackoverflow.com/q/22618361
tags question: http://stackoverflow.com/q/22539938
tags question: http://stackoverflow.com/q/22549617
tags question: http://stackoverflow.com/q/22537899
tags question: http://stackoverflow.com/q/22540589
tags question: http://stackoverflow.com/q/22604333
tags question: http://stackoverflow.com/q/22573599
tags question: http://stackoverflow.com/q/22639998
tags question: http://stackoverflow.com/q/22555044
tags question: http://stackoverflow.com/q/22571278
tags question: http://stackoverflow.com/q/22628541

http://stackoverflow.com/a/22639678
type: Answer
answers question: http://stackoverflow.com/q/22639458
has body: The problem is that you call isBalanced on the class Arithmetic, not on an instance. The following should fix the problem: Arithmetic a = new Arithmetic(s); a.isBalanced(); As a side note: Boolean is the name of a class that boxes a boolean value.
score: 0

http://stackoverflow.com/comment/34352773
has text: This question seems to be subjective and opinion only, the compiler doesn't care - so priority for what?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22568613

http://stackoverflow.com/comment/34313933
comment on: http://stackoverflow.com/a/22545677
type: Comment
has text: Still don't see how the above is the wrong way to do it. Home crafted solutions are always error prone and annoying to maintain. In the above, we all know what can go wrong (time zones, more than 24 hrs, etc.).
score: 0
type: AnswerComment

http://stackoverflow.com/q/22546823
tagged with: java
has answer: http://stackoverflow.com/a/22547852
has comment: http://stackoverflow.com/comment/34316080
has body: So I have a database that's working a bit slower than I would expect and I'd like to describe what I'm doing so hopefully I can verify I'm not missing some performance tweak. Some details first: I'm using java and the database is H2 embedded (although I'm seeing similar results regardless of database). I've profiled / timed it and the problems are definitely in the database queries, specifically the executeQuery() call. For this example the database table has 60K rows but my query involves a subset of 25K rows yet takes a full 1/2 second to return. Here's how I've set up the database table: CREATE TABLE rows ( id @AUTOTYPE@ PRIMARY KEY, x VARCHAR(255) NOT NULL, y VARCHAR(255) NOT NULL, z @TIMETYPE@ NOT NULL ) CREATE INDEX rows_index ON rows(x, y, z); (Note that the parameterization is for auto increment and timestamp, respectively) And my query looks like this: SELECT * FROM rows WHERE x = ? AND y = ? ORDER BY z DESC Now, I only care about the first row, but it needs to be the newest row, so in java it looks like this: PreparedStatement stmt = conn.prepareStatement(query); stmt.setString(1, "foo"); stmt.setString(2, "bar"); stmt.setMaxRows(1); Notice the last line has the setMaxRows() set to 1. To reiterate, the entire 'rows' table has about 60K rows and the query would return 25K rows if I wasn't setting it to return only 1. So am I doing everything I can? Even though 1/2s (0.5s) is certainly not a long time it doesn't seem like 60K records should take that long, especially when it should be indexed. And I know time is relative, so this is just a modern workstation, not running on some sort of load-balanced server. Thoughts? Thanks for taking a look. EDIT: Updating with the things I've tried: I tried adding "LIMIT 1" to the end of the query, the way to limit the number of results in this database, and it didn't make a difference. In fact, the database itself (H2) says to either use LIMIT or setMaxRows(), and in my results they perform the same. I tried indexing on …
type: Question
tagged with: indexing
tagged with: performance
tagged with: database
has answer: http://stackoverflow.com/a/22547004
has title: Database tuning and possibly unexpected results
has comment: http://stackoverflow.com/comment/34314779
has comment: http://stackoverflow.com/comment/34315093
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22547852
possible better answer: http://stackoverflow.com/a/22547004
has comment: http://stackoverflow.com/comment/34315516
has comment: http://stackoverflow.com/comment/34315526
has comment: http://stackoverflow.com/comment/34315286
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34315282
has comment: http://stackoverflow.com/comment/34315301

spring-mvc
tags question: http://stackoverflow.com/q/22598430
tags question: http://stackoverflow.com/q/22594116
tags question: http://stackoverflow.com/q/22627759
tags question: http://stackoverflow.com/q/22629881
tags question: http://stackoverflow.com/q/22618749
tags question: http://stackoverflow.com/q/22612281
tags question: http://stackoverflow.com/q/22560782
tags question: http://stackoverflow.com/q/22609601
tags question: http://stackoverflow.com/q/22585460
tags question: http://stackoverflow.com/q/22593661
tags question: http://stackoverflow.com/q/22534032
tags question: http://stackoverflow.com/q/22526020
tags question: http://stackoverflow.com/q/22558567
tags question: http://stackoverflow.com/q/22534763
tags question: http://stackoverflow.com/q/22641096
tags question: http://stackoverflow.com/q/22647279
tags question: http://stackoverflow.com/q/22566054
tags question: http://stackoverflow.com/q/22528587
tags question: http://stackoverflow.com/q/22530932
tags question: http://stackoverflow.com/q/22622125
tags question: http://stackoverflow.com/q/22548508
tags question: http://stackoverflow.com/q/22618244
tags question: http://stackoverflow.com/q/22570047
tags question: http://stackoverflow.com/q/22598186
tags question: http://stackoverflow.com/q/22572701
tags question: http://stackoverflow.com/q/22508773
tags question: http://stackoverflow.com/q/22574887
tags question: http://stackoverflow.com/q/22491245
tags question: http://stackoverflow.com/q/22610669
tags question: http://stackoverflow.com/q/22591028
tag name: spring-mvc
tags question: http://stackoverflow.com/q/22525175
tags question: http://stackoverflow.com/q/22545847
tags question: http://stackoverflow.com/q/22593383
tags question: http://stackoverflow.com/q/22560615
tags question: http://stackoverflow.com/q/22525923
tags question: http://stackoverflow.com/q/22536811
tags question: http://stackoverflow.com/q/22529774
tags question: http://stackoverflow.com/q/22605244
tags question: http://stackoverflow.com/q/22525078
tags question: http://stackoverflow.com/q/22514394
type: Tag
tags question: http://stackoverflow.com/q/22643577
tags question: http://stackoverflow.com/q/22510031
tags question: http://stackoverflow.com/q/22639258
tags question: http://stackoverflow.com/q/22608482
tags question: http://stackoverflow.com/q/22620323
tags question: http://stackoverflow.com/q/22590036
tags question: http://stackoverflow.com/q/22570727
tags question: http://stackoverflow.com/q/22646552
tags question: http://stackoverflow.com/q/22491012
tags question: http://stackoverflow.com/q/22555110
tags question: http://stackoverflow.com/q/22626100
tags question: http://stackoverflow.com/q/22600489
tags question: http://stackoverflow.com/q/22562819
tags question: http://stackoverflow.com/q/22646858
tags question: http://stackoverflow.com/q/22527591
tags question: http://stackoverflow.com/q/22604503
tags question: http://stackoverflow.com/q/22550730
tags question: http://stackoverflow.com/q/22490558
tags question: http://stackoverflow.com/q/22563761
tags question: http://stackoverflow.com/q/22638991
tags question: http://stackoverflow.com/q/22633538
tags question: http://stackoverflow.com/q/22520496
tags question: http://stackoverflow.com/q/22630643
tags question: http://stackoverflow.com/q/22518220
tags question: http://stackoverflow.com/q/22516402
tags question: http://stackoverflow.com/q/22551898
tags question: http://stackoverflow.com/q/22562151
tags question: http://stackoverflow.com/q/22624931
tags question: http://stackoverflow.com/q/22643098
tags question: http://stackoverflow.com/q/22600275
tags question: http://stackoverflow.com/q/22512108
tags question: http://stackoverflow.com/q/22607852
tags question: http://stackoverflow.com/q/22575608
tags question: http://stackoverflow.com/q/22512268
tags question: http://stackoverflow.com/q/22525394
tags question: http://stackoverflow.com/q/22618211
tags question: http://stackoverflow.com/q/22505389
tags question: http://stackoverflow.com/q/22606627

http://stackoverflow.com/comment/34433091
comment on: http://stackoverflow.com/a/22613288
type: Comment
has text: Okay, thanks for the fast Answer. I never worked with Java before this Project (started a week ago) And so I thought, it might be the easiest way to setup the Web control by simply adding the Java Program into a Website. Especially, because our program is not really complex (Button1 pressed, Server recieves a notification and informs the 2nd Raspberry which changes his GPIO )
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34373344
type: Comment
comment on: http://stackoverflow.com/a/22579590
score: 0
type: AnswerComment
has text: the problem still prevails brother .it now only displays the data recieved by the client sent from the serverand not the data recieved by the server sent from the client.it should execute the print statements of the both the server while loop as well as the client's while loop which it dosent

http://stackoverflow.com/comment/34391973
type: AnswerComment
has text: Can u check now.I have used a BETWEEN clause and used a month interval using Date Objects.The end Date is through a calendar instance
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22590157

clipboard
tags question: http://stackoverflow.com/q/22512906
tags question: http://stackoverflow.com/q/22602950
tag name: clipboard
type: Tag

http://stackoverflow.com/comment/34382446
type: QuestionComment
has text: `this.a` = 0 by default, and multiplying it with something doesn't matter as it will still be 0?
score: 0
comment on: http://stackoverflow.com/q/22584990
type: Comment

http://stackoverflow.com/comment/34261646
type: AnswerComment
has text: This is not the easisest option. But on PCs much faster than the dataOutputStream solution. Little and big endian was never a point in his question
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22517052

http://stackoverflow.com/q/22494341
score: 0
accepted answer: http://stackoverflow.com/a/22494505
answer count: 1
has comment: http://stackoverflow.com/comment/34222651
tagged with: mergesort
has comment: http://stackoverflow.com/comment/34222738
type: AnsweredQuestion
tagged with: java
has title: Non-Recursive Merge Sort in Java
has answer: http://stackoverflow.com/a/22494505
has body: I am working on a non recursive merge sort for my CS class and it is not exactly working. I know it is being called since when I run the test program it changes the array, just not into the correct order. Can someone please help? Thanks! private static void mergeSort(int[] a, int left, int right) { int midPoint = ((right + left) / 2); int[] buffer = new int[19]; selectionSort(a, left, midPoint); selectionSort(a, midPoint-1, right); merge(a, buffer, 0, 9, 19); } private static void selectionSort(int[] a, int beginning, int end) { int [] temp = new int[end-1]; for(int y = 0; y &lt; end - 1; y++) { temp[y] = a[y]; } for (int i = 0; i &lt; temp.length - 1; i++) { int minIndex = findMinimum(temp, i); if (minIndex != i) swap (temp, i, minIndex); } } private static int findMinimum(int[] a, int first) { int minIndex = first; for (int i = first + 1; i &lt; a.length; i++) { if (a[i] &lt; a[minIndex]) minIndex = i; } return minIndex; } private static void swap(int []a, int x, int y) { int temp = a[x]; a[x] = a[y]; a[y] = temp; } private static void merge(int[] a, int[] temp, int left, int mid, int right) { if (mid &gt;= a.length) return; if (right &gt; a.length) right = a.length; int i = left, j = mid+1; for (int k = left; k &lt; right; k++) { if (i == mid) temp[k] = a[j++]; else if (j == right) temp[k] = a[i++]; else if (a[j] &lt; a[i]) temp[k] = a[j++]; else temp[k] = a[i++]; } for (int k = left; k &lt; right; k++) a[k] = temp[k]; }
type: Question
tagged with: arrays

http://stackoverflow.com/q/22636362
accepted answer: http://stackoverflow.com/a/22636959
has answer: http://stackoverflow.com/a/22636432
tagged with: animation
has title: Delay is not working in java graphics
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22636432
has body: This is a code for drawing points on calculated locations by Bresenham's algorithm: public void drawBresenhamPoints(Graphics2D g2, List&lt;Point&gt; bresenham) throws InterruptedException { Graphics2D g = (Graphics2D) g2; if(bresenham == null) return; g.setColor(Color.DARK_GRAY); for(int i = 0; i &lt; bresenham.size(); i = i+20) { int x = bresenham.get(i).x - pointWidth1/2; int y = bresenham.get(i).y - pointWidth1/2; int ovalW = pointWidth1; int ovalH = pointWidth1; g.fillOval(x, y, ovalW, ovalH); // delay try { Thread.sleep(10); } catch(Throwable e) { System.out.println(e.getMessage()); } } } The list 'bresenham' contains all the points which are pre-calculated with the help of Bresenham's line drawing algorithm. I want to set a delay of 1 second inside the 'for' loop so that each and every point is drawn after an interval of 1 second. The portion listed in the 'delay' section doesn't work. How to make 'delay' work? More specifically, I want to see all the points being drawn one by one on the screen in an interval of 1 second.
score: 0
answer count: 2
tagged with: thread-sleep
has comment: http://stackoverflow.com/comment/34473633
tagged with: paintcomponent
linked to: http://stackoverflow.com/q/8138017
has answer: http://stackoverflow.com/a/22636959

http://stackoverflow.com/a/24619174
answers question: http://stackoverflow.com/q/22595676
type: Answer
has body: In my case I added a folder to the views folder named developer. to this folder I added a tables.scala.html file. In my controller I would say: public static Result main() { return ok(developer.tables.render()); } or public static Result main() { return ok(views.developer.tables.render()) } During the run, the compiler said that the "developer package doesn't exists". I usually run clean, reload, and update when adding new views and classes to my project (using eclipse). After a while, what did the trick was to reference this view like this return ok(views.html.developer.tables.render()) Which if you ask me, does not seem very intiutive. But this works, I hope it works for others as well.
score: 0

http://stackoverflow.com/a/22501472
answers question: http://stackoverflow.com/q/22501443
score: 6
type: Answer
has body: That's not valid SQL. You probably meant CREATE TABLE LOGIN not CREATE_TABELLOGIN and ID INTEGER not IDINTEGER.
downvote count: 0
has comment: http://stackoverflow.com/comment/34234539
upvote count: 6

http://stackoverflow.com/comment/34459911
has text: There are similar questions on StackOverflow that might help you, for example: http://stackoverflow.com/questions/3080203/how-could-randomly-my-session-is-null
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22628376

http://stackoverflow.com/comment/34279281
score: 0
type: AnswerComment
has text: @user3354890 There are far more stronger arguments than this question & answer though, you should look into all Java 8 features and especially the lambdas and `Stream` API are worth it to upgrade, and probably forgetting some other awesome features on the way.
type: Comment
comment on: http://stackoverflow.com/a/22501058

http://stackoverflow.com/comment/34498942
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22625928
has text: When you post an answer please, please, please, separate your text of your code! And provide some comments in your code, the OP cannot understand why he/she had a problem!

http://stackoverflow.com/q/22579054
has answer: http://stackoverflow.com/a/58508035
score: 0
has answer: http://stackoverflow.com/a/61720559
tagged with: java
has answer: http://stackoverflow.com/a/22579350
downvote count: 2
has answer: http://stackoverflow.com/a/62606222
has answer: http://stackoverflow.com/a/24988016
has answer: http://stackoverflow.com/a/54721519
has answer: http://stackoverflow.com/a/36152359
type: Question
has answer: http://stackoverflow.com/a/58519422
has answer: http://stackoverflow.com/a/32032040
has answer: http://stackoverflow.com/a/49903032
has answer: http://stackoverflow.com/a/23877473
has body: In the codility permutation check question: A non-empty zero-indexed array A consisting of N integers is given. A permutation is a sequence containing each element from 1 to N once, and only once. For example, array A such that: A[0] = 4 A[1] = 1 A[2] = 3 A[3] = 2 is a permutation, but array A such that: A[0] = 4 A[1] = 1 A[2] = 3 is not a permutation. The goal is to check whether array A is a permutation. Write a function: class Solution { public int solution(int[] A); } that, given a zero-indexed array A, returns 1 if array A is a permutation and 0 if it is not. For example, given array A such that: A[0] = 4 A[1] = 1 A[2] = 3 A[3] = 2 the function should return 1. Given array A such that: A[0] = 4 A[1] = 1 A[2] = 3 the function should return 0. Assume that: N is an integer within the range [1..100,000]; each element of array A is an integer within the range [1..1,000,000,000]. Complexity: expected worst-case time complexity is O(N); expected worst-case space complexity is O(N), beyond input storage (not counting the storage required for input arguments). Here is my solution to it, but I have an error. I feel, I need to check for one extra condition before the code can work well. When tested with an array like this: A[4,1,3}, it returned 1 instead of 0 . What else do I need to test for to get this code to work perfectly? I am missing it because I don't see why a[]{4,1,3} is NOT a permutation and why A[] {4,1,3,2} is a permutation in the question. If anyone could explain that, I might be able to solve my problem. Now,I did modify it to work now on my eclipse,tested but on codility, I still keep getting error about the line : counter[A[i]] += 1; Any one knows why this is so? Something that the array is out of bound but I didn't get that error on my eclipse IDE. Thanks public class Solution { /** * @param args */ public static int solution(int[] A) { // write your code in Java SE 7 int[] counter = new int[(A[0] * A.length)]; int max = -1; int OccurBefore = -1; // stor…
has answer: http://stackoverflow.com/a/23897636
has answer: http://stackoverflow.com/a/50075264
has title: Counting Element Permutation check
has answer: http://stackoverflow.com/a/50693414
has answer: http://stackoverflow.com/a/28262269
has answer: http://stackoverflow.com/a/59170643
has answer: http://stackoverflow.com/a/59533647
has answer: http://stackoverflow.com/a/56525918
has answer: http://stackoverflow.com/a/30639588
favorite count: 0
has answer: http://stackoverflow.com/a/58032816
has answer: http://stackoverflow.com/a/47761775
has answer: http://stackoverflow.com/a/31589437
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22649991
has answer: http://stackoverflow.com/a/30731976
has answer: http://stackoverflow.com/a/51618057
has answer: http://stackoverflow.com/a/24988104
has answer: http://stackoverflow.com/a/59698215
has answer: http://stackoverflow.com/a/73060513
answer count: 28

http://stackoverflow.com/q/22626980
has comment: http://stackoverflow.com/comment/34461505
has comment: http://stackoverflow.com/comment/34457847
tagged with: java
tagged with: mysql
has title: USER defined java class step in pentaho data integration
has comment: http://stackoverflow.com/comment/34461758
type: Question
has answer: http://stackoverflow.com/a/25187098
tagged with: pentaho
has comment: http://stackoverflow.com/comment/34459209
has answer: http://stackoverflow.com/a/54900244
answer count: 2
tagged with: jdbc
downvote count: 0
linked to: http://stackoverflow.com/q/10669638
score: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34459344
upvote count: 1
has body: Hi, I am using the below code in USER DEFINED JAVA CLASS: //STEP 1. Import required packages import java.sql.*; import org.pentaho.di.core.database.*; public class JDBCExample { // JDBC driver name and database URL static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL ="jdbc:mysql://localhost:1111/mysql"; // Database credentials static final String USER = "USER"; static final String PASS = "PASS"; public static void main(String[] args) { Connection conn = null; Statement stmt = null; try{ //STEP 2: Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); //STEP 3: Open a connection System.out.println("Connecting to a selected database..."); conn = DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("Connected database successfully..."); //STEP 4: Execute a query System.out.println("Creating statement..."); stmt = conn.createStatement(); String sql = "select id,sorname,src_databasetype,src_databasename from table"; ResultSet rs = stmt.executeQuery(sql); //STEP 5: Extract data from result set while(rs.next()){ //Retrieve by column name int id = rs.getInt("id"); String sorname = rs.getString("sorname"); String src_databasetype = rs.getString("src_databasetype"); String src_databasename = rs.getString("src_databasename"); //Display values System.out.print("ID: " + id); System.out.print(", sorname: " + sorname); System.out.print(", src_databasetype: " + src_databasetype); System.out.println(", src_databasename: " + src_databasename); } rs.close(); }catch(SQLException se){ //Handle errors for JDBC se.printStackTrace(); }catch(Exception e){ //Handle errors for Class.forName e.printStackTrace(); }finally{ //finally block used to close resources try{ if(stmt!=null) conn.close(); }catch(SQLException se){ }// do nothing try{ if(conn!=null) conn.close(); }catch(SQLException se){ se.printStackTrace(); }//end finally try }//end try System.out.println("Goodbye!"); }//end main }//end JDBCExample Running the code through command pr…

http://stackoverflow.com/q/22528816
has body: As I am new to the android I have written a code which consist of a button which has to animate and also link to another xml file. But when I compile it button will animate but it won't link to the other file. I need the animated button to go into the another xml page when I click on it. code and image display are given below button.xml &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:background="@drawable/bulbasaur" tools:context=".MainActivity" &gt; &lt;Button android:id="@+id/enter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="58dp" android:onClick="onEnterClicked" android:text="@string/enter_button" /&gt; &lt;/RelativeLayout&gt; /res/anim/anim_alpha.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"&gt; &lt;alpha android:fromAlpha="1.0" android:toAlpha="0.1" android:duration="500" android:repeatCount="1" android:repeatMode="reverse" /&gt; &lt;/set&gt; MainActivity.java package com.coded.sandeep; import com.coded.sandeep.SecondActivity; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Animation animAlpha2 = AnimationUtils.loadAnimation(this, R.anim.anim_alpha); Button btnEnter = (Button)findViewById(R.id.enter); btnEnter.setOnClickListener(new Button.OnClickListener()…
tagged with: android
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/22961290
tagged with: animation
has title: onclick function in android button with animation is not working
accepted answer: http://stackoverflow.com/a/22528952
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22528952
score: 0

http://stackoverflow.com/comment/34313531
score: 0
type: Comment
type: QuestionComment
has text: The cast `(T) this` is not type safe.
comment on: http://stackoverflow.com/q/22525088

http://stackoverflow.com/a/22614044
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22591958
accepted answer of: http://stackoverflow.com/q/22591958
upvote count: 2
has body: The problem was solved when I added the following to the glassfish-web.xml &lt;parameter-encoding default-charset=”UTF-8″/&gt;
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/22636676
has body: You should let your global class extend Application. An extensive answer can be found here: How to declare global variables in Android?
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22636550

setter
tags question: http://stackoverflow.com/q/22636153
type: Tag
tag name: setter

http://stackoverflow.com/q/22596155
has body: I have this simple question. I'm working with a database on an android application and I need a ContentProvider for it and I have this two classes that manage the events and the data stored in the database. These classes are: Appointment: package com.example.calendar; public class Appointment { //variables(that are the attributes of the database table) int _id; String _title; String _time; String _details; String _date; //empty constructor to add for the update method in the DBHandler public Appointment(){ } public Appointment(int id, String date, String title, String time, String details){ this._id = id; this._date = date; this._title = title; this._time = time; this._details = details; } public Appointment(String date, String title, String time, String details){ this._date = date; this._title = title; this._time = time; this._details = details; } //----------GET/SET METHODS BELOW----------- //--------ID--------- public int getID(){ return this._id; } public void setID(int id){ this._id = id; } //-------DATE------- public String getDate(){ return this._date; } public void setDate(String date){ this._date = date; } //-----TITLE--------- public String getTitle(){ return this._title; } public void setTitle(String title){ this._title = title; } //------TIME------- public String getTime(){ return this._time; } public void setTime(String time){ this._time = time; } //------DETAILS-------- public String getDetails(){ return this._details; } public void setDetails(String details){ this._details = details; } @Override public String toString() { return _title; } } And DBHandler: package com.example.calendar; import java.util.ArrayList; import java.util.List; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.net.Uri; public class DBHandler extends SQLiteOpenHelper { //Variables needed private static final int DATABA…
has comment: http://stackoverflow.com/comment/34402467
has comment: http://stackoverflow.com/comment/34402611
tagged with: java
has answer: http://stackoverflow.com/a/22596437
has comment: http://stackoverflow.com/comment/34402628
tagged with: android-contentprovider
type: AnsweredQuestion
has title: Which one of these is my provider on android?
has comment: http://stackoverflow.com/comment/34402404
type: Question
accepted answer: http://stackoverflow.com/a/22596437
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/34402507
score: 0
has comment: http://stackoverflow.com/comment/34402661
answer count: 1

http://stackoverflow.com/comment/34488085
type: Comment
score: 0
type: AnswerComment
has text: This code really helped me! Thank you so much!
comment on: http://stackoverflow.com/a/22620117

http://stackoverflow.com/comment/34307565
comment on: http://stackoverflow.com/a/22542640
type: AnswerComment
has text: @RohitJain: I agree, however the first statement that the `?` at initialization is pointless is false. One needs to be very careful with such statements since they sometimes are applied to general.
score: 0
type: Comment

http://stackoverflow.com/comment/34405369
has text: @androidmaster - maybe better to start with Java or C#, it is more common these days and it is much more user-friendly. Especially Java, which is very "strict" in many ways. And I like that, because it helps you to not be confused and to do less mistakes.
type: Comment
comment on: http://stackoverflow.com/a/22597648
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34440657
comment on: http://stackoverflow.com/q/22601925
score: 0
has text: I' using IntellJ IDEA 13 Ultimate
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38477345
type: Comment
comment on: http://stackoverflow.com/a/24791224
has text: I cant do that, as I dont want the regular updates for unchanged keys to hit the cache loader. Maybe I should think about calling invalidate from within the loader...
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34258953
has text: Depends on the meaning of `y`. It seems he is doing a summation, so outside of the loop would probably be more correct.
type: Comment
comment on: http://stackoverflow.com/a/22515481
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34320810
type: QuestionComment
has text: so are you looking for the occurrence of the numbers in the searchlist to be in your list in the order that it is in in searchlist? and it return the index?
score: 0
comment on: http://stackoverflow.com/q/22550264
type: Comment

http://stackoverflow.com/a/22600683
score: -1
upvote count: 0
type: AcceptedAnswer
has body: The simple answer to your question is measure how long it took using System.currentTimeMillis () before and after to measure the difference. Subtract that difference from your desired wait time. long start = System.сurrentTimeMillis(); // do stuff long duration = System.сurrentTimeMillis()-start; Thread.sleep (1000-duration);
accepted answer of: http://stackoverflow.com/q/22600449
answers question: http://stackoverflow.com/q/22600449
type: Answer
downvote count: 1

http://stackoverflow.com/comment/34450562
comment on: http://stackoverflow.com/a/22622808
type: Comment
has text: Thanks - I'll try again. When I tried to iterate over the object I was getting type mismatch errors which seemed to imply there there was a mismatch. Is there any easy way to dump the object to string?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34405727
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22598031
has text: We don't know, because we don't know which game you are playing and which operations are you invoking (and how they are implemented). We need some more information.
type: Comment

http://stackoverflow.com/comment/34415725
type: QuestionComment
type: Comment
score: 0
has text: Right; there's no ```setTimeout()``` because that's a browser thing, not a JS thing. How does your workaround work? It also doesn't help that you do ```LINECONTROL[a] = function () ...``` 100+ times rather than reusing a single instance of the function. You can declare it up above, then do ```LINECONTROL[a] = function0;```. That should safe a bunch of memory.
comment on: http://stackoverflow.com/q/22602680

http://stackoverflow.com/comment/34433259
has text: Thanks. I was running the previous version on accident. It's fixed now!
comment on: http://stackoverflow.com/a/22598148
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34287139
type: Comment
comment on: http://stackoverflow.com/a/22531520
type: AnswerComment
has text: yup same null exception when you call the method createOuptut(line 57 in main and when you go about implementing it(line 109) @Octopus
score: 0

http://stackoverflow.com/comment/34235634
has text: Yes,that's correct.Before re-installation when the tablet and RN42 were connected I could both send and receive data on the tablet.Have you observed a similar behavior?
comment on: http://stackoverflow.com/a/22502371
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/22651101
score: 0
has body: This is a classic problem in networking. The most common solution is what is employed in VoIP infrastructures for P2P calls. So as you mentioned there is a central server which clients connect to and then the players from then on manage the communication i.e. media or game data transfer on their own. The central server in this case is in charge of signaling and introducing the players. The communication parameters are negotiated over the central server. Common protocols for doing this are SIP and for negotiating ports and IP addresses - the body of the SIP messages will contain SDP messages. http://en.wikipedia.org/wiki/Session_Initiation_Protocol Specifically for NAT traversal the industry standard is ICE http://en.wikipedia.org/wiki/Interactive_Connectivity_Establishment Do note that a comprehensive implementation of the above mentioned protocols and standards is not an easy task at all as there are several network configurations possible. So I'd recommend you use the above to understand the complexity of your scenario. Then depending on what you feel - implement the parts you feel are important. Alternatively, don't discard the possibility of going have a central server handling the data. It keeps things a lot simpler.
type: Answer
answers question: http://stackoverflow.com/q/22621637

http://stackoverflow.com/q/22570044
type: Question
has answer: http://stackoverflow.com/a/22570081
has body: Direct is a class that contains 2 get methods and one of them is getName(). In the following code, I am using an array and it works correctly. But if I want to store it in a LinkedList instead of an array, how do I iterate and reach the getName() method. I am able to iterate fine if is just a list of common primitives such as Strings but in this case where it is a list of class, I am confused on how to reach the getName() method. Thanks for helping. private LinkedList&lt;Direct&gt; directList= new LinkedList(); private ListIterator&lt;Direct&gt; iterator = directList.listIterator(); private Direct[] direct = new Direct[100]; private int find(String name){ for (int x=0; x &lt; direct.length; x++){ if (direct[x] != null) if (direct[x].getName().equals(name)){ return x; } } return -1; }
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22570138
tagged with: collections
type: AnsweredQuestion
tagged with: linked-list
accepted answer: http://stackoverflow.com/a/22570138
tagged with: java
possible better answer: http://stackoverflow.com/a/22570081
has title: Using LinkedList to access a get method

database
tags question: http://stackoverflow.com/q/22644995
tags question: http://stackoverflow.com/q/22580560
tags question: http://stackoverflow.com/q/22501035
tags question: http://stackoverflow.com/q/22497324
tags question: http://stackoverflow.com/q/22608482
tags question: http://stackoverflow.com/q/22534639
tags question: http://stackoverflow.com/q/22521298
tags question: http://stackoverflow.com/q/22596499
tags question: http://stackoverflow.com/q/22574632
tags question: http://stackoverflow.com/q/22493562
tags question: http://stackoverflow.com/q/22647861
tags question: http://stackoverflow.com/q/22586217
tags question: http://stackoverflow.com/q/22581423
tags question: http://stackoverflow.com/q/22633152
type: Tag
tags question: http://stackoverflow.com/q/22579055
tags question: http://stackoverflow.com/q/22605141
tags question: http://stackoverflow.com/q/22629378
tags question: http://stackoverflow.com/q/22608090
tags question: http://stackoverflow.com/q/22629319
tags question: http://stackoverflow.com/q/22544874
tags question: http://stackoverflow.com/q/22511036
tags question: http://stackoverflow.com/q/22496119
tags question: http://stackoverflow.com/q/22537777
tags question: http://stackoverflow.com/q/22501612
tags question: http://stackoverflow.com/q/22621225
tag name: database
tags question: http://stackoverflow.com/q/22583304
tags question: http://stackoverflow.com/q/22633303
tags question: http://stackoverflow.com/q/22503593
tags question: http://stackoverflow.com/q/22536960
tags question: http://stackoverflow.com/q/22557208
tags question: http://stackoverflow.com/q/22625783
tags question: http://stackoverflow.com/q/22600604
tags question: http://stackoverflow.com/q/22586840
tags question: http://stackoverflow.com/q/22586576
tags question: http://stackoverflow.com/q/22495404
tags question: http://stackoverflow.com/q/22635437
tags question: http://stackoverflow.com/q/22596789
tags question: http://stackoverflow.com/q/22607440
tags question: http://stackoverflow.com/q/22546823
tags question: http://stackoverflow.com/q/22562757
tags question: http://stackoverflow.com/q/22617978
tags question: http://stackoverflow.com/q/22502862

http://stackoverflow.com/q/22548704
has comment: http://stackoverflow.com/comment/34318406
favorite count: 0
has title: Converting first letter of each word to uppercase
has answer: http://stackoverflow.com/a/22548744
answer count: 2
upvote count: 7
has body: Does anyone know if there is another method other than WordUtils.capitalize() that converts the first letter of each word to upper case?
tagged with: java
accepted answer: http://stackoverflow.com/a/22548744
has answer: http://stackoverflow.com/a/22548795
downvote count: 0
possible better answer: http://stackoverflow.com/a/22548795
has comment: http://stackoverflow.com/comment/34318373
type: Question
type: AnsweredQuestion
score: 7

http://stackoverflow.com/comment/34454188
has text: `left = left + (right - left - 1)`, simple arithmetic tell me that you can simplify it to `left = right -1 `
comment on: http://stackoverflow.com/q/22624535
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22575286
answer count: 1
tagged with: arrays
has body: How to add str,str1,str2,str22,name,randNo to an String array,the data in loop(while) may changes each time. when connection established,user sends data to the following program, it need to store it in an array. String s[][]=new s[100][100]; ServerSocket ss=new ServerSocket(9999); while(true) { Socket s=ss.accept(); DataInputStream dis=new DataInputStream(s.getInputStream()); int str=dis.readInt(); System.out.println("message= "+str); int str1=dis.readInt(); System.out.println("message= "+str1); int str2=dis.readInt(); System.out.println("message= "+str2); int str22=dis.readInt(); System.out.println("message= "+str22); String name=dis.readUTF(); System.out.println("message= "+name); int randNo=dis.readInt(); System.out.println("Unique no:"+randNo); s[][]={{str,str1,str2,str22,name,randNo}}; }
score: 0
has title: how to add data to an array in while loop java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22575511
tagged with: network-programming
tagged with: java
tagged with: loops
type: Question

http://stackoverflow.com/a/22570305
answers question: http://stackoverflow.com/q/22569721
type: Answer
score: 0
has body: First, when you reference this inside the creation of a new object, this refers to that object. You are saying that the onClickListener is the ResultListener. I am going to guess that the class in which you create the onClickListener is the class that implements the onResultListener interface. So for example if you have public class MyClass { private int test; public void example() { // this refers to MyClass here (the current scope) this.test = 0; OnClickListener listener = new View.OnClickListener() { // Now we are in the intalization of a new Object. // "this" refers to the OnClickListener that you are creating } } } So for example, in this case, if you wanted to refer to MyClass in the creation block of the OnClickListener, you simply need to reference the name of the class. So for example: public class MainActivity extends Activity implements OnReultsListener { private int test; public void example() { this.test = 0; OnClickListener listener = new View.OnClickListener() { asFtp = new asFTP(); asFtp.setOnClickListener(MainActivity.this)' ... whatever else you need ... } } } In your case, you would have something like Button btn_copiar = (Button) findViewById(R.id.btn_copiar); btn_copiar.setOnClickListener(new OnClickListener(){ public void onClick (View v) { try { asFtp = new asFTP(); if (comprobar_preferencias()){ Log.d(TAG, prefServidor + " " + String.valueOf(prefPuerto) + " " + prefUsuario + " " + prefPass); asFtp.setOnResultsListener(MainActivity.this); // here I get the eclipse error asFtp.execute(); EDIT: I know this example is crude, I just wanted to get the point across. Let me know if you have any questions.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22569721

http://stackoverflow.com/comment/34343673
score: 3
type: AnswerComment
has text: Note: with Java 7 the null check can be written `Objects.requireNonNull(collection, "collection cannot be null");`
type: Comment
comment on: http://stackoverflow.com/a/22560840

http://stackoverflow.com/q/22578985
answer count: 1
has answer: http://stackoverflow.com/a/22581875
favorite count: 0
has comment: http://stackoverflow.com/comment/34371286
has body: I'm using JPA and when I insert data into the database my ID is autoincremented with 50. I'm using persistence.GeneratedValue to autoincrement it: This is how my model/entity class looks like (Entity to be inserted): ..imports @Entity public class Example extends Identifiable { .. } Identifiable : ..imports @MappedSuperclass public abstract class Identifiable { @Id @GeneratedValue protected long id; .. } Database: # ID NAME ... 1 701 a 2 751 b 3 801 c Anyone have an Idea what the problem is?
has title: JPA, GeneratedValue autoincrement with 50
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22581875
type: Question
upvote count: 4
tagged with: jpa
score: 4
tagged with: entity
downvote count: 0

http://stackoverflow.com/a/22515184
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/22514778
downvote count: 0
score: 4
has body: windowClosing is always fired. windowClosed will be fired when you use: setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); But the overridden method should be like this, @Override public void windowClosed(WindowEvent e) { System.out.println("I'm in the listener"); System.exit(0); } }); Here you can not use dispose() method since this method will be called after the frame is disposed. If dispose() method is called then this will make windowClosed() method execute infinitely.

http://stackoverflow.com/q/22567831
has comment: http://stackoverflow.com/comment/34351319
score: 10
has comment: http://stackoverflow.com/comment/34351479
has answer: http://stackoverflow.com/a/23040731
possible better answer: http://stackoverflow.com/a/49021912
has comment: http://stackoverflow.com/comment/34352201
has comment: http://stackoverflow.com/comment/34352180
answer count: 3
tagged with: groovy
upvote count: 10
has comment: http://stackoverflow.com/comment/34351497
has comment: http://stackoverflow.com/comment/34351254
tagged with: shell
has answer: http://stackoverflow.com/a/49021912
has comment: http://stackoverflow.com/comment/34351844
favorite count: 0
has answer: http://stackoverflow.com/a/22650348
has title: Gradle: execute Groovy interactive shell with project classpath
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34351446
linked to: http://stackoverflow.com/q/4272956
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34351433
has body: I have a Gradle project composed of several sub projects. I just created a new one to add support for an interactive Groovy shell that I would like to run with: gradle console or gradle console:run So my new console module's build.gradle file is the following: apply plugin: 'groovy' apply plugin:'application' mainClassName = 'org.codehaus.groovy.tools.shell.Main' dependencies { compile 'org.codehaus.groovy:groovy-all:2.2.2' compile 'org.fusesource.jansi:jansi:1.11' compile 'commons-cli:commons-cli:1.2' compile 'jline:jline:2.11' compile project(':my-module') } task(console, dependsOn: 'classes', type: JavaExec) { main = 'org.codehaus.groovy.tools.shell.Main' classpath = sourceSets.main.runtimeClasspath } However, when I run gradle :console:run or gradle console I get something like: :console:run Groovy Shell (2.2.2, JVM: 1.6.0_45) Type 'help' or '\h' for help. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- groovy:000&gt; BUILD SUCCESSFUL Total time: 4.529 secs giovanni@mylaptop:~/Projects/my-project$ So the interactive shell seems to start but it exits right away. Am I doing something wrong? EDIT: Added the following to the build.gradle file: run.standardInput = System.in Now the standard input gets read from the input stream (thanks to the comments). However, Gradle seems to get stuck on this: Groovy Shell (2.2.2, JVM: 1.6.0_45) Type 'help' or '\h' for help. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- groovy:000&gt; &gt; Building 88% &gt; :console:run And no input gets accepted. Even this leads to the same thing: gradle --no-daemon console:run UPDATE 2018: Dylons accepted answer don't seem to work any…
accepted answer: http://stackoverflow.com/a/23040731
tagged with: gradle
has comment: http://stackoverflow.com/comment/34351389
type: Question
has comment: http://stackoverflow.com/comment/34351722

http://stackoverflow.com/q/22628408
downvote count: 0
has comment: http://stackoverflow.com/comment/34459986
favorite count: 0
has answer: http://stackoverflow.com/a/22628469
answer count: 5
has answer: http://stackoverflow.com/a/22628480
has answer: http://stackoverflow.com/a/48166134
has answer: http://stackoverflow.com/a/22629159
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22629796
has comment: http://stackoverflow.com/comment/34461167
upvote count: 7
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/34462844
type: Question
has title: math.random() follows which algorithms
has body: Am using math.random() method to generate random numbers. but i had a doubt about that method. math.random() is which algorithms will fallow to generate random numbers. Is there any another random number generated algorithm? Am trying this code but i think this is not efficient to generate random code: for (int i = 0; i &lt; N; i++) { int sd = i + (int) (Math.random() * (N-i)); String t = one[r]; one[r] = one[i]; one[i] = t; } Is there any better algorithm for random number generation?
tagged with: random

google-app-engine
tags question: http://stackoverflow.com/q/22609522
tag name: google-app-engine
tags question: http://stackoverflow.com/q/22619417
type: Tag
tags question: http://stackoverflow.com/q/22608213
tags question: http://stackoverflow.com/q/22515059
tags question: http://stackoverflow.com/q/22639294
tags question: http://stackoverflow.com/q/22544681
tags question: http://stackoverflow.com/q/22636829
tags question: http://stackoverflow.com/q/22530761
tags question: http://stackoverflow.com/q/22598548
tags question: http://stackoverflow.com/q/22506998
tags question: http://stackoverflow.com/q/22516693
tags question: http://stackoverflow.com/q/22611406
tags question: http://stackoverflow.com/q/22537769
tags question: http://stackoverflow.com/q/22568724
tags question: http://stackoverflow.com/q/22618766
tags question: http://stackoverflow.com/q/22579016
tags question: http://stackoverflow.com/q/22560038
tags question: http://stackoverflow.com/q/22549016
tags question: http://stackoverflow.com/q/22647454
tags question: http://stackoverflow.com/q/22537705
tags question: http://stackoverflow.com/q/22627788
tags question: http://stackoverflow.com/q/22593971
tags question: http://stackoverflow.com/q/22615359
tags question: http://stackoverflow.com/q/22536811
tags question: http://stackoverflow.com/q/22606630
tags question: http://stackoverflow.com/q/22527898
tags question: http://stackoverflow.com/q/22495153
tags question: http://stackoverflow.com/q/22489605
tags question: http://stackoverflow.com/q/22616921
tags question: http://stackoverflow.com/q/22590255
tags question: http://stackoverflow.com/q/22522426
tags question: http://stackoverflow.com/q/22535406
tags question: http://stackoverflow.com/q/22629455

http://stackoverflow.com/comment/34304178
has text: Okay thanks :) I don't like how you'd need a loop anyways to grab multiple elements using an Iterator. If some reason comes along where you need the `hasNext()` `next()` execution to be synchronized, but not the list. It can take up some space it doesn't need to. (not memory, but visually)
comment on: http://stackoverflow.com/a/22540191
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22520805
upvote count: 1
answers question: http://stackoverflow.com/q/22520764
type: Answer
downvote count: 0
score: 1
has body: In Eclipse, I saw Bluetooth Chat Sample Application for Android 4.2.* and you can do time-reflesh within usage of the sample codes and your demand via Bluetooth.

http://stackoverflow.com/comment/88289791
has text: As I mentioned, this does not allow to reuse same variables between several test plans. And yes, it limits to run manually only. And enabling/disabling is not very user-friendly. For me loading variables from external `.properties` files by a script worked quite well.
comment on: http://stackoverflow.com/a/50638754
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/22653614
score: 0
has comment: http://stackoverflow.com/comment/53275929
has body: You're in wrong. Hbase by default has 3 versions in a cell.It means that if you save and update 3 times in a cell hbase stores them with time stamps in 3 versions. You cannot store in a cell with time stamp. If you want another value, you'll have to put it in a different column family or different column.
type: Answer
answers question: http://stackoverflow.com/q/22587037

http://stackoverflow.com/comment/34461155
score: 0
has text: If you are getting NPEs I have to see the stacktrace.
type: Comment
comment on: http://stackoverflow.com/a/22537288
type: AnswerComment

http://stackoverflow.com/q/22620698
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
has title: Azure Mobile Services with Android
has answer: http://stackoverflow.com/a/22622603
tagged with: java
tagged with: table-relationships
upvote count: 1
answer count: 1
tagged with: http://stackoverflow.com/tag/json
tagged with: azure-mobile-services
accepted answer: http://stackoverflow.com/a/22622603
has body: I am very new to both Android development &amp; Azure Mobile Services. I have a decent knowledge of Java so Android development is not proving to be too difficult. Although, I am struggling to gain a good knowledge of working with Azure Mobile Services. I have little knowledge of REST API's but will be able to learn quite quickly if required. My main concerns/questions are as followed: Can I build my Android app by using Mobile Services Data &amp; API's alone. i.e the simple table values and the basic CRUD API's? If not, how should I approach building the application? I want to cater for multiple column queries, table relationships (1 .. n , inheritance) and I also would like to use JSON objects as parameters for a more lightweight communication rather than passing my full Java objects. Also, is the possibility of setting up an SSL available? Any help would be appreciated.

http://stackoverflow.com/q/22615822
upvote count: 0
accepted answer: http://stackoverflow.com/a/22615872
favorite count: 0
has title: Constructor and method error
type: Question
score: -1
has comment: http://stackoverflow.com/comment/34437483
tagged with: java
answer count: 3
tagged with: methods
has answer: http://stackoverflow.com/a/22617244
downvote count: 1
has body: Can someone check where is wrong in this code? The output should be true, but X is still false.. setOn(X , true); System.out.println(X); } public static void setOn(boolean mode, boolean onValue) { mode = onValue; } public static boolean X = false; I can't use X = onvalue, because I have other mode to use.
possible better answer: http://stackoverflow.com/a/22615883
has answer: http://stackoverflow.com/a/22615883
has answer: http://stackoverflow.com/a/22615872
type: AnsweredQuestion

gwt
tags question: http://stackoverflow.com/q/22562373
tags question: http://stackoverflow.com/q/22551922
tags question: http://stackoverflow.com/q/22530667
tags question: http://stackoverflow.com/q/22635702
tags question: http://stackoverflow.com/q/22583342
tags question: http://stackoverflow.com/q/22572689
tag name: gwt
tags question: http://stackoverflow.com/q/22606222
tags question: http://stackoverflow.com/q/22640893
tags question: http://stackoverflow.com/q/22620157
tags question: http://stackoverflow.com/q/22585751
tags question: http://stackoverflow.com/q/22552131
type: Tag
tags question: http://stackoverflow.com/q/22634268
tags question: http://stackoverflow.com/q/22625945
tags question: http://stackoverflow.com/q/22521346
tags question: http://stackoverflow.com/q/22559402
tags question: http://stackoverflow.com/q/22606313
tags question: http://stackoverflow.com/q/22537795
tags question: http://stackoverflow.com/q/22643010
tags question: http://stackoverflow.com/q/22578452
tags question: http://stackoverflow.com/q/22530676
tags question: http://stackoverflow.com/q/22525923
tags question: http://stackoverflow.com/q/22632699
tags question: http://stackoverflow.com/q/22637077
tags question: http://stackoverflow.com/q/22568724
tags question: http://stackoverflow.com/q/22490990
tags question: http://stackoverflow.com/q/22498935
tags question: http://stackoverflow.com/q/22610705
tags question: http://stackoverflow.com/q/22541029
tags question: http://stackoverflow.com/q/22497368
tags question: http://stackoverflow.com/q/22619619
tags question: http://stackoverflow.com/q/22620476
tags question: http://stackoverflow.com/q/22491326
tags question: http://stackoverflow.com/q/22615887
tags question: http://stackoverflow.com/q/22637267
tags question: http://stackoverflow.com/q/22506317
tags question: http://stackoverflow.com/q/22528099
tags question: http://stackoverflow.com/q/22564375
tags question: http://stackoverflow.com/q/22543033
tags question: http://stackoverflow.com/q/22585345
tags question: http://stackoverflow.com/q/22632553
tags question: http://stackoverflow.com/q/22524914
tags question: http://stackoverflow.com/q/22559269
tags question: http://stackoverflow.com/q/22519254

http://stackoverflow.com/q/22609150
has comment: http://stackoverflow.com/comment/34426088
tagged with: servlets
score: 0
has body: I have installed Hadoop 2.2.0 on ubuntu 13.10 in a pseudo-distributed mode in my pc that starts and runs correctly (only one datanode). I'm using Eclipse Kepler v4.3 with Maven Plugin to develop my Hadoop program and Dynamic Web Project (web project is without Maven). I have my Hadoop project called "HadWork" from which i created the HadWork.jar (right click on project, Export, Runnable Jar File, with option "Extract required libraries into generated JAR"). It works correctly when run job from command line with: "Hadoop jar HadWork.jar parameter1 parameter2 parameter3" and I see correctly the work progress on the terminal. Now I want to run job from my dynamic web application deployed on WildFly 8.0 Application Server (Eclipse is already configured to run project on correct server WildFly in standalone mode). I'm writing the Servlet "ServletHadoopTest.java" but I don't understand how run Job from my web application, what libraries (Hadoop libraries jar? My HadWork jar?) I need to load and where load it. I can't simply use the command "Hadoop jar HadWork.jar parameter1 parameter2 parameter3" in my servlet directly. In short, what I want: when I click on button "StartJob" on my page "index.jsp", job HadWork begins to work and shows "Working job.." message in web page, possibly showing the URL to track the job. I would like to call MapReduce Job from Servlet. I can load HadWork.jar on application server (if so, where?). I'm looking for informations on google but I have not found any answers yet..
has title: Run Hadoop MapReduce Job from Dynamic Web Project on WildFly Servlet
answer count: 1
has answer: http://stackoverflow.com/a/22615993
tagged with: wildfly
has comment: http://stackoverflow.com/comment/34425735
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22615993
tagged with: eclipse
type: Question
tagged with: hadoop

jframe
tags question: http://stackoverflow.com/q/22573696
tags question: http://stackoverflow.com/q/22615010
tags question: http://stackoverflow.com/q/22550832
tags question: http://stackoverflow.com/q/22647176
tags question: http://stackoverflow.com/q/22520648
tag name: jframe
tags question: http://stackoverflow.com/q/22540579
tags question: http://stackoverflow.com/q/22513850
tags question: http://stackoverflow.com/q/22506805
tags question: http://stackoverflow.com/q/22540217
tags question: http://stackoverflow.com/q/22621415
tags question: http://stackoverflow.com/q/22497281
tags question: http://stackoverflow.com/q/22514853
tags question: http://stackoverflow.com/q/22625245
tags question: http://stackoverflow.com/q/22594826
tags question: http://stackoverflow.com/q/22507724
tags question: http://stackoverflow.com/q/22625379
tags question: http://stackoverflow.com/q/22609593
tags question: http://stackoverflow.com/q/22577659
tags question: http://stackoverflow.com/q/22549813
tags question: http://stackoverflow.com/q/22545566
tags question: http://stackoverflow.com/q/22598274
tags question: http://stackoverflow.com/q/22500463
tags question: http://stackoverflow.com/q/22606293
tags question: http://stackoverflow.com/q/22631993
tags question: http://stackoverflow.com/q/22554346
tags question: http://stackoverflow.com/q/22635568
tags question: http://stackoverflow.com/q/22622281
tags question: http://stackoverflow.com/q/22577924
tags question: http://stackoverflow.com/q/22637300
tags question: http://stackoverflow.com/q/22584813
tags question: http://stackoverflow.com/q/22588842
tags question: http://stackoverflow.com/q/22519939
tags question: http://stackoverflow.com/q/22534574
tags question: http://stackoverflow.com/q/22565189
type: Tag
tags question: http://stackoverflow.com/q/22504637
tags question: http://stackoverflow.com/q/22587537

http://stackoverflow.com/a/22647019
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22646892
type: Answer
has body: Static Methods make your live easier, because you dont have to worry about Accessability in different scopes (not talking about private/public Methods - static methods are ALWAYS there, no matter in which context you are). Basically every OOP Method can be converted to a static method, using the object as one of the parameters. Also each Static method, having an object as a parameter could be converted to a method on the object instance. People have been developing Apps, before any sort of "OOP" was known, so its not a "musst have". General speaking: Does your method require "Object Properties"? Use an Object/instance method. Does your method NOT require Object Properties? Use a static method. OOP makes your live easier, when you have coupled data (like a person has a certain fore- and surename and an email adress -> create an object with those 3 attributes). Instead of passing 3 Parameters to a method, you could implement a method without parameters on the object, and have access to all 3 values. You would not run into trouble, swapping forenames or email adresses somewhere. Your Object clearly keeps track of data relation.
accepted answer of: http://stackoverflow.com/q/22646892
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/22609012
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34425125
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34424918
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22609185
tagged with: random
downvote count: 1
has title: Struggling to understand how to use fields in a method
favorite count: 0
has answer: http://stackoverflow.com/a/22609173
linked to: http://stackoverflow.com/q/215497
answer count: 3
tagged with: field
has answer: http://stackoverflow.com/a/22609148
has body: I am new to Java and I am struggling with understanding some basic concepts. For example, here, I am trying to write a program which will generate random strings by using the "Random" class in Java: http://docs.oracle.com/javase/6/docs/api/java/util/Random.html I noticed that the class can generate random integers, so basically, my idea is to generate random integers and just convert them to a string, if this is possible. Here is my code so far: package øv2; import java.util.Random; public class RandomStringGenerator { private int randomNumber; private void setRandomNumber(int randomNumber){ randomNumber = this.randomNumber; } private int getRandomNumber(){ return randomNumber; } private String generateRandomString(int randomNumber){ int randomString = randomNumber.nextInt(); } } What I really want to do is to take the field "randomNumber" and just turn it into a random number by using the Java class "Random", more specifically the method "nextInt()", and then turn that into a String. But I am not really understanding how to use the field "randomNumber" anywhere, do I even need getters and setters for it? Can I simply use "randomNumber" as an argument in any method? Sorry if this is confusing, thank you so much for your time!

http://stackoverflow.com/q/22610338
has title: Javascript result to Prepared Statement
has answer: http://stackoverflow.com/a/22610465
type: Question
has comment: http://stackoverflow.com/comment/34436467
tagged with: jsp
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34462923
has comment: http://stackoverflow.com/comment/34436269
type: UnansweredQuestion
has body: I have a JSP page that populates a dropdown list dynamically from a database, then I have the dropdown list set up with an "onchange" event to call a Javascript to obtain the selected value. How can I use the Javascript result to be placed in a WHERE clause of a SQL prepared statment? The prepared statement I have set up in a JavaBean.
tagged with: java

google-maps
tags question: http://stackoverflow.com/q/22556720
tag name: google-maps
tags question: http://stackoverflow.com/q/22583140
tags question: http://stackoverflow.com/q/22522407
tags question: http://stackoverflow.com/q/22557564
tags question: http://stackoverflow.com/q/22599204
tags question: http://stackoverflow.com/q/22506143
tags question: http://stackoverflow.com/q/22642670
tags question: http://stackoverflow.com/q/22552023
tags question: http://stackoverflow.com/q/22550537
tags question: http://stackoverflow.com/q/22550429
tags question: http://stackoverflow.com/q/22634482
tags question: http://stackoverflow.com/q/22634428
type: Tag
tags question: http://stackoverflow.com/q/22585189
tags question: http://stackoverflow.com/q/22489252
tags question: http://stackoverflow.com/q/22633363

http://stackoverflow.com/q/22645563
type: AnsweredQuestion
tagged with: builder
upvote count: 2
tagged with: java
type: Question
tagged with: c#
has title: Combining builder methods with service methods - bad practice?
tagged with: fluent
possible better answer: http://stackoverflow.com/a/22648026
answer count: 2
has answer: http://stackoverflow.com/a/22647014
accepted answer: http://stackoverflow.com/a/22647014
downvote count: 0
favorite count: 0
has body: This is a general patterns/best practices question. I'm using C# but I think it's equally applicable to Java and other environments. It's very common for libraries to expose a builder class that goes somewhat hand in hand with a more service-oriented class. Take a hypothetical ORM that allows you to do this: var sql = SQLBuilder.Select("*").From("Users"); var users = db.ExecQuery&lt;User&gt;(sql); As a library developer it's tempting to combine these into a more fluent, discoverable API with only one object to be concerned with: var users = db.Select("*").From("Users").ExecQuery&lt;User&gt;(); Note that the difference is strictly in the API surface; under the hood we'd still have multiple classes with proper separation of concerns. One potential drawback of the second approach is testability. In the first approach, it's much easier to stub out the service object. But what if the library developer took care of this by exposing some sort of static TestMode property that can be configured on app startup or test setup and signals that the service calls should be recorded/faked? From a purist standpoint, other than testability, is there anything "wrong" with the second approach? I'm actually debating whether to do this in a couple libraries I'm working on, and my main red flag is that the first approach just seems so much more common.
has answer: http://stackoverflow.com/a/22648026
tagged with: design-patterns
score: 2

http://stackoverflow.com/q/22625623
tagged with: java
has answer: http://stackoverflow.com/a/22625658
has body: I'm trying to create a simple program that converts degrees in Fahrenheit to degrees in Celcius on my mac through the Terminal application and using the vi editor. My code is as follows: import java.io.*; public class MyThirdJavaProgram { public static void main (String [] args) { double celcius, fahrenheit; fahrenheit = Console.readDouble("fahrenheit"); celcius = convertFahrenheitToCelcius(fahrenheit); System.out.println("Degrees in celcius are " + celcius); } private static double convertFahrenheitToCelcius (double ins) { double celcius; celcius = ((ins-32.0)*5.0)/9.0; return celcius; } } The error I keep getting is: MyThirdJavaProgram.java:7: cannot find symbol symbol : method readDouble(java.lang.String) location: class java.io.Console fahrenheit = Console.readDouble("fahrenheit"); ^ What am i doing wrong here? I've tried a lot of different ways to code it such as fahrenheit = Console.in.readDouble(fahrenheit) and fahrenheit = System.console.readDouble(fahrenheit) but absolutely nothing works and the error statement is almost the same every time. I'm very new to java but this is just confusing the heck out of me. Any help that solves this dang thing would be awesome, even if you tell me to re-write half of it.
type: Question
answer count: 2
upvote count: 1
downvote count: 0
has title: How do I get console input for a java program in Terminal on Mac?
favorite count: 0
has answer: http://stackoverflow.com/a/22625757
tagged with: system
tagged with: symbols
tagged with: input
tagged with: macos
linked to: http://stackoverflow.com/q/11871520
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/34332360
type: QuestionComment
comment on: http://stackoverflow.com/q/22557002
score: 0
has text: new LinkedHashMap<>(new TreeMap<>(originalMap)) and new TreeMap<>(originalMap) will return values in the same way I guess,in sorted way
type: Comment

http://stackoverflow.com/comment/34211116
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22487972
has text: Have you looked at `NumberFormat`?
score: 2

http://stackoverflow.com/q/22582023
has answer: http://stackoverflow.com/a/22589581
has answer: http://stackoverflow.com/a/22779452
score: 0
tagged with: java
type: Question
has title: How to dynamically create a form based on submitting the first form
tagged with: javascript
has body: For eg: 1) I have one text box and submit button if a person adds the value and select submit button then this text box value will be sent to java program where internal calculations will be made and returned to the JSP page based on the values new form should be dynamically created on same page and this form should have the value of the text box which is created before and if i submit it should send all the values to java program... Please post me a sample code of jsp and java program asap
answer count: 2
tagged with: jsp
tagged with: jquery
type: UnansweredQuestion

http://stackoverflow.com/comment/34264107
score: 0
type: AnswerComment
type: Comment
has text: The documentation says that it waits also for the serialization of a Java instance's header. Furthermore we cannot know if the ObjectOutputStream is open by the server, because we don't have the ServerThread's source code.
comment on: http://stackoverflow.com/a/22517581

http://stackoverflow.com/comment/34508465
has text: @vipin, Bull's eye!! :) yes i am a newbie to java. i would like to understand the concept and then put it into the code. so please tell me have i understood it correctly?? :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22633756

http://stackoverflow.com/comment/34428397
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22610618
type: AnswerComment
has text: OK - I'll update my answer to reflect the changes to the OP's question

http://stackoverflow.com/q/22616781
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34442531
has comment: http://stackoverflow.com/comment/34440291
type: Question
tagged with: java
has body: I need to print the minimum and maximum number from each array and the name of a student from a different array that corresponds to the number. This is what I have so far. import java.util.*; import java.util.Arrays; public class Lab5A2 { public static void main(String[] args) { Scanner console = new Scanner(System.in); meals(console); } public static void meals(Scanner console) { System.out.print("How many grades "); int people = console.nextInt(); int subtotal = 0; int min = 10000; int max = 0; int avg = 0; int[] grades = new int[people]; for (int i = 1; i &lt;= people; i++) { System.out.print("Next grade? "); int personCost = console.nextInt(); subtotal = subtotal + personCost; grades[i-1] = personCost; if(max &lt;personCost) { max = personCost; } if(min&gt;personCost) min = personCost; } String[] names = new String[people]; System.out.println("Now the names."); for (int j = 1; j &lt;= people; j++) { System.out.print("Next name? "); String name = console.next(); names[j-1] = name; } avg = subtotal/people; int Min = min; int Max = max; int Avg = avg; int Sum = subtotal; System.out.println(Min); System.out.println(min); System.out.println(Arrays.toString(grades)); System.out.println(Arrays.toString(names)); int hue = Arrays.binarySearch(grades, Min); int huey = Arrays.binarySearch(grades, Max); System.out.println(hue); System.out.println(huey); System.out.println("/*** Statistics from student data ***/"); System.out.println("Max. Grade = " + grades[huey] + " " + "(" + names[huey] + ")"); System.out.println("Min. Grade = " + grades[hue] + " " + "(" + names[hue] + ")"); System.out.println("Avg. Grade = " + Avg); System.out.println(Arrays.toString(grades)); System.out.println(Arrays.toString(names)); } } I know I need to use indexes but i just dont know how
has comment: http://stackoverflow.com/comment/34439553
score: 0
has comment: http://stackoverflow.com/comment/34442409
tagged with: arrays
has title: How to print the minimum score from 1 array and a name from a different array that corresponds to the other array
answer count: 0

http://stackoverflow.com/q/22523404
has answer: http://stackoverflow.com/a/22523579
has comment: http://stackoverflow.com/comment/34273582
has comment: http://stackoverflow.com/comment/34273524
answer count: 1
favorite count: 0
has body: I am trying to use the following code to get the number of alarms currently set on the phone. Uri uri = Uri.parse("content://com.android.deskclock/AlarmClock"); Cursor c = getApplicationContext().getContentResolver().query(uri, null, null, null,null); But I get a NullPointerException when I try to fetch the number using int num = c.getCount(); System.out.println("No of alarms : "+c.getCount()); Please let me know what I am doing wrong ? The exception occurs in getCount() itself so I am not able to display the number of alarms. EDIT: I also get this message on my LogCat : ActivityThread(13290): Failed to find provider info for com.android.deskclock
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/34273714
has comment: http://stackoverflow.com/comment/34273852
has comment: http://stackoverflow.com/comment/34273334
accepted answer: http://stackoverflow.com/a/22523579
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34273750
has title: How to get the number of alarms in Android phone?
tagged with: java
has comment: http://stackoverflow.com/comment/34273161
tagged with: android-alarms
type: AnsweredQuestion

http://stackoverflow.com/comment/34430815
comment on: http://stackoverflow.com/q/22611739
has text: @Andrew Now that you've mentioned it, this is an XY problem. My "actual" problem instead is: being able to select multiple items in the JTree. And this can be done with a TreeSelectionListener. Thanks for the insight
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34293611
has text: Thanks, one other question.. what if a user clicks a delete button, and the given row is deleted. In that case, how would I push this info to the table, to get it to stop showing that row?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22534940

http://stackoverflow.com/comment/34214816
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22489614
has text: As I was thinking: http://stackoverflow.com/questions/6825907/why-put-jsp-in-web-inf
type: Comment

http://stackoverflow.com/comment/34348506
has text: Why you'd like to avoid it?
comment on: http://stackoverflow.com/q/22566488
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22584398
answers question: http://stackoverflow.com/q/22583781
accepted answer of: http://stackoverflow.com/q/22583781
score: 0
type: AcceptedAnswer
type: Answer
has body: There is no "match as many time as possible and join all the groups together" in Java. You either have to do it yourself using: while(matcher.find()) { // ... } ... or using a regex that already matches everything in a single call to find. For example, you could try the following regex (as Java String) instead, which will match all your attributes at once. (?:\\w+ (?:INT|CHAR(?:\\(\\d{1,3}\\))?|DEC)(?:, )?)+ Here is a working example: final String str = "CREATE TABLE student (id INT, name CHAR(20), gpa DEC);"; final Pattern p = Pattern.compile("(?:\\w+ (?:INT|CHAR(?:\\(\\d{1,3}\\))?|DEC)(?:, )?)+"); final Matcher m = p.matcher(str); if(m.find()) { System.out.println(m.group()); // prints "id INT, name CHAR(20), gpa DEC" }; Output: id INT, name CHAR(20), gpa DEC

http://stackoverflow.com/comment/34439508
score: 0
type: AnswerComment
has text: If you are still unable to come to a solution, in terminal, you can execute ps -au to view all running processes. Then you can locate the pid of the tomcat server, and execute a kill -9 <pid> to terminate the process.
type: Comment
comment on: http://stackoverflow.com/a/22616676

http://stackoverflow.com/comment/34471459
type: Comment
comment on: http://stackoverflow.com/a/22632503
score: 0
type: AnswerComment
has text: @Slim, I have updated the code and tested in my local. Pls try it.

http://stackoverflow.com/comment/34485411
has text: Do you want to log each statement into both databases, or be able to selectively log to one or the other. If the latter, do you want to make that choice when you start up the program, or at runtime?
comment on: http://stackoverflow.com/q/22642666
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/34229514
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22492777
has text: My code above is a method for writing the "name of item", "quantity", "original price" and "srp price" in my text file named "Storage.txt". So my problem is how to delete or search specific item. If I'm going to delete that item, it should be remove in the text file including its information and if i'm going to search it, it should be displayed (including its information) in a message dialog box. I have given a sample input and output above. I hope you can help me.

http://stackoverflow.com/q/22579055
downvote count: 0
has title: Accessing h2 database from specified path
possible better answer: http://stackoverflow.com/a/40506981
favorite count: 0
has answer: http://stackoverflow.com/a/40506981
has answer: http://stackoverflow.com/a/22579134
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: h2
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22579134
has body: How do I access an H2 database from a specified file path say E:\folder\mydb.h2.db in java? What would be the jdbc url for that?
tagged with: database
answer count: 2

http://stackoverflow.com/q/22635700
has comment: http://stackoverflow.com/comment/37012292
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22635800
upvote count: 1
linked to: http://stackoverflow.com/q/6855399
type: Question
has answer: http://stackoverflow.com/a/22635847
linked to: http://stackoverflow.com/q/11947452
has comment: http://stackoverflow.com/comment/35989790
answer count: 3
has answer: http://stackoverflow.com/a/22635800
downvote count: 0
has comment: http://stackoverflow.com/comment/34472596
has body: HI guys I have a question about adding images to my layout. Right now i have download four pictures, but all my images are stacked on top of each other, I want to able to make them sitting next to each other, like 2 pictures on top and 2 on the bottom, what is the best approaches to this? right now i am using relative layout and I use AsyncTask to handle the images. my code: public class MainActivity extends Activity { //String[] imgUrls = {getString(R.string.uncc_main_thumb),getString(R.string.football_main_thumb,getString(R.string.ifest_main_thumb),getString(R.string.commencement_main_thumb))}; String[] imgUrls={"http://farm5.staticflickr.com/4113/4843614620_c541de5a5c_m.jpg", "http://farm8.staticflickr.com/7265/8151547298_85e60e7368_m.jpg", "http://farm9.staticflickr.com/8054/8414075899_e87a74407b_m.jpg", "http://farm9.staticflickr.com/8210/8277674769_7d1245dbf1_m.jpg"}; RelativeLayout root; ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); root = (RelativeLayout) findViewById(R.id.RelativeLayout1); for (String imgUrl : imgUrls) { new DownLoadImages().execute(imgUrl); } } private class DownLoadImages extends AsyncTask&lt;String, Void, Bitmap&gt; { @Override protected Bitmap doInBackground(String... params) { String imgUrl = params[0]; Bitmap image = null; try { URL url = new URL(imgUrl); image = BitmapFactory.decodeStream(url.openStream()); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return image; } @Override protected void onPreExecute() { super.onPreExecute(); // show the loading message while downloading the image progressDialog = ProgressDialog.show(MainActivity.this,null, "loading..."); } @Override protected void onPostExecute(Bitmap result) { if (result == null) { result = ((BitmapDrawable) getResources().getD…
favorite count: 0
has comment: http://stackoverflow.com/comment/34472517
tagged with: android
has answer: http://stackoverflow.com/a/22636252
accepted answer: http://stackoverflow.com/a/22636252
has title: how to add Images next to each other in android
type: AnsweredQuestion

http://stackoverflow.com/comment/34372182
type: QuestionComment
type: Comment
has text: In which case do I have to use <extend-configuration-property name="gin.ginjector.extensions" value="test.client.gin.ClientInjectorAdditional"/>
score: 0
comment on: http://stackoverflow.com/q/22578452

http://stackoverflow.com/comment/34389058
type: Comment
type: QuestionComment
has text: Start by calling `super.paint`, in fact, you should avoid overriding `paint` at all an instead use `paintComponent` instead...
comment on: http://stackoverflow.com/q/22588444
score: 0

http://stackoverflow.com/q/22626754
tagged with: rsync
answer count: 1
has comment: http://stackoverflow.com/comment/34457491
favorite count: 0
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: watchservice
type: Question
has title: While copying files using rsync into directory, Java Watch service gets tempary file notification from OS instead of actual files
has answer: http://stackoverflow.com/a/22638354
accepted answer: http://stackoverflow.com/a/22638354
has body: When copying files using rsync, OS is giving notification for temp file instead of actual files to watch service. For example below are few file notifications which are appended with some character after extension ".ser" and with prefix with ".": .file1.ser.4QNNyx .file2.ser.f08GVA .file3.ser.UFBEi Expected notification for file with below name: file1.ser file2.ser file3.ser Code snapshot as below, public void registerServiceWatch() { final ResourceWatchService watchService = new ResourceWatchService(directoryPath); IResourceObserver observer = new IResourceObserver() { @Override public void resourceModified(final String eventName, final Path filePath) { updateCache(eventName, filePath); } }; Runnable runnable = new Runnable() { @Override public void run() { watchService.processEvents(); } }; watchService.addResourceObserver(observer); new Thread(runnable).start(); } If we copy files without rsync like cp, scp then we getting proper notification, but in case of rsync we not getting proper file modification, So what the issue with rsync, Please feel fre to share thoughts on it. rsync command: rsync -rtvz &lt;source&gt; &lt;destination&gt;
upvote count: 2
has comment: http://stackoverflow.com/comment/34457356

http://stackoverflow.com/a/22601071
has comment: http://stackoverflow.com/comment/34769028
has comment: http://stackoverflow.com/comment/37722073
has comment: http://stackoverflow.com/comment/34723708
has comment: http://stackoverflow.com/comment/34722979
type: Answer
has comment: http://stackoverflow.com/comment/34411415
has comment: http://stackoverflow.com/comment/37729910
upvote count: 19
has comment: http://stackoverflow.com/comment/34411242
has body: Passing a HashMap is a common practice in untyped scripting languages but is a bad practice in Java. It defeats the advantages of strong typing which is part of how you gain productivity in Java. To put it a different way, the Java compiler won't be able to help you spot mistakes during development and you'll be more likely to catch them at runtime instead. If the parameters you're passing are related conceptually, you could as you mention group them into an appropriate object. For example if you're passing parameters such as, say, firstName, lastName, dateOfBirth and so on, you can instead pass a Person object which has those properties. This uses OO to make your design easier to think about and maintain. If I understand what you mean about this: "But this give me another troubles because my parameters would not get any guarantee (not sure will be contain or not)", you can enforce the guarantee you need when your Person or etc. object is instantiated. One approach would be to use an immutable Person (etc.) object: no setters, instead pass all params via the constructor. Throw IllegalArgumentException if they're not all correct. Good luck!
answers question: http://stackoverflow.com/q/22600775
has comment: http://stackoverflow.com/comment/34799865
downvote count: 1
has comment: http://stackoverflow.com/comment/34730693
score: 18
has comment: http://stackoverflow.com/comment/34526106

http://stackoverflow.com/comment/66751491
comment on: http://stackoverflow.com/a/22636750
score: 0
type: AnswerComment
type: Comment
has text: @Lorkenpeist Good point. In practice, I would recommend `Collections.unmodifiableMap(new LinkedHashMap<>(realMap));` to keep the iteration order intact (but there may be cases where this doesn't matter). In any case, I'm regularly doing this, and would prefer it over `ImmutableMap` (particularly if Guava is not already a dependency anyhow). There may be justifications for still using `ImmutableMap` (e.g. using it as a return type, to show in an interface that the returned map is *immutable*, but one cannot make a general recommendation here)

mongodb
tags question: http://stackoverflow.com/q/22491638
tags question: http://stackoverflow.com/q/22535208
tags question: http://stackoverflow.com/q/22536086
tags question: http://stackoverflow.com/q/22549363
tags question: http://stackoverflow.com/q/22554000
tags question: http://stackoverflow.com/q/22555103
tag name: mongodb
tags question: http://stackoverflow.com/q/22580980
tags question: http://stackoverflow.com/q/22646102
type: Tag
tags question: http://stackoverflow.com/q/22596959
tags question: http://stackoverflow.com/q/22633828
tags question: http://stackoverflow.com/q/22636104
tags question: http://stackoverflow.com/q/22516514
tags question: http://stackoverflow.com/q/22648138
tags question: http://stackoverflow.com/q/22582514
tags question: http://stackoverflow.com/q/22591540
tags question: http://stackoverflow.com/q/22511739

double
tags question: http://stackoverflow.com/q/22644079
tags question: http://stackoverflow.com/q/22637468
tags question: http://stackoverflow.com/q/22579421
tags question: http://stackoverflow.com/q/22526897
tag name: double
type: Tag
tags question: http://stackoverflow.com/q/22585743
tags question: http://stackoverflow.com/q/22506791
tags question: http://stackoverflow.com/q/22514654
tags question: http://stackoverflow.com/q/22578953
tags question: http://stackoverflow.com/q/22608536
tags question: http://stackoverflow.com/q/22549617
tags question: http://stackoverflow.com/q/22589362
tags question: http://stackoverflow.com/q/22617678
tags question: http://stackoverflow.com/q/22625924

http://stackoverflow.com/a/22575906
has comment: http://stackoverflow.com/comment/34365663
has body: The first way is not legal, as it is clear to the compiler that you can't use j that you declared there, as you can't have another statement inside that for loop. Basically the new declaration of variable at that place will go out of scope the very next statement, thus is not doing any good. While in the second case, the loop is followed by braces, which creates a new scope, and you can use the variable.
has comment: http://stackoverflow.com/comment/34365817
has comment: http://stackoverflow.com/comment/34391574
has comment: http://stackoverflow.com/comment/34365702
has comment: http://stackoverflow.com/comment/34365617
downvote count: 2
has comment: http://stackoverflow.com/comment/34374210
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/56699455
has comment: http://stackoverflow.com/comment/34367724
has comment: http://stackoverflow.com/comment/34374284
has comment: http://stackoverflow.com/comment/34365720
has comment: http://stackoverflow.com/comment/34365692
has comment: http://stackoverflow.com/comment/34365737
has comment: http://stackoverflow.com/comment/34365628
has comment: http://stackoverflow.com/comment/34365710
type: Answer
score: 13
has comment: http://stackoverflow.com/comment/34365714
upvote count: 15
has comment: http://stackoverflow.com/comment/34365625
has comment: http://stackoverflow.com/comment/34365644
accepted answer of: http://stackoverflow.com/q/22575878
has comment: http://stackoverflow.com/comment/34365659
has comment: http://stackoverflow.com/comment/34391368
has comment: http://stackoverflow.com/comment/34365815
answers question: http://stackoverflow.com/q/22575878

http://stackoverflow.com/a/22614339
has body: Use the Eclipse plugin FatJar. FatJar shows you which libraries are getting imported and allows you to specify which .jars, libraries, etc., that you want built into your JAR. FatJar
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/34480157
has comment: http://stackoverflow.com/comment/34471953
answers question: http://stackoverflow.com/q/22612389
has comment: http://stackoverflow.com/comment/34444887
has comment: http://stackoverflow.com/comment/34481065
has comment: http://stackoverflow.com/comment/34443940

http://stackoverflow.com/comment/42604135
type: QuestionComment
has text: I'm also getting this Exception. It's completely random when it occurs which makes it difficult to diagnose the issue.
type: Comment
comment on: http://stackoverflow.com/q/22498331
score: 0

http://stackoverflow.com/comment/34434567
comment on: http://stackoverflow.com/a/22613717
has text: I copied your code and shows error: The method setSpan (ForegroundColorSpan, int, int, int) is undefined for the type String
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34366645
type: Comment
has text: Thanks a lot. I've just replaced the mouselistener as you suggested and started working fine. I left rest of the codes as it was. –
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22554394

http://stackoverflow.com/q/22533365
type: Question
has answer: http://stackoverflow.com/a/22568751
score: 0
tagged with: java
tagged with: session
tagged with: jsp
has comment: http://stackoverflow.com/comment/34291221
type: UnansweredQuestion
tagged with: tomcat
has body: I am facing a very strange problem in my application which works fine, but sometimes i have to face a problem. I have an application running on apache tomcat, the problem is of session. when i login to my application, i store user name in session, there are 100-200 users login to my application daily. There is a module in my application that prints the cash receipt, here is the actual problem, sometime it prints the user name of another user. Suppose the logged in user name is adam but it prints the name john that is another user. It happens rarely, also I have noticed that when I restart my tomcat server then this problem encountered. Is this the problem of apache tomcat or something about related to my code?
tagged with: servlets
has title: session mismatch in jsp servlet on apache tomcat
has comment: http://stackoverflow.com/comment/34294691
answer count: 1

http://stackoverflow.com/comment/34266198
has text: why don't you use "listOfActors.add(a)" instead of the line you are using there? If you want a new object with the same attributes, you may want to use the "clone" method.
comment on: http://stackoverflow.com/q/22519444
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34427483
type: QuestionComment
score: 11
has text: Backward compatible means Java 7 will run under Java 8. In order to run Java 8 byte code on Java 7 you'd need to use a retrotranslate-type process, I expect.
type: Comment
comment on: http://stackoverflow.com/q/22610400

http://stackoverflow.com/q/22626064
downvote count: 0
has comment: http://stackoverflow.com/comment/34456228
favorite count: 0
tagged with: timer
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/12226198
linked to: http://stackoverflow.com/q/22422031
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22626212
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34456258
has title: How to Shuffle image in sequence?
answer count: 1
has comment: http://stackoverflow.com/comment/34456271
has body: I am trying to make Java desktop application where i want to make auto image shuffle i am able to do this but problem is that it is not shuffling all image which i gave i want to shuffle all image how can i achieve this Here is some code I found here: /** * @see https://stackoverflow.com/a/22423511/230513 * @see https://stackoverflow.com/a/12228640/230513 */ public class ImageShuffle extends JPanel { private List&lt;Icon&gt; list = new ArrayList&lt;Icon&gt;(); private JLabel label = new JLabel(); private Timer timer = new Timer(1000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { update(); } }); public ImageShuffle() { this.setLayout(new GridLayout(1, 0)); list.add(new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\e.jpg")); list.add(new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\d.jpg")); list.add(new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\yellow.png")); list.add(new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\f.jpg")); // list.add(new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\yellow.jpg")); //label.setIcon(UIManager.getIcon("OptionPane.informationIcon")); timer.start(); } private void update() { Random r=new Random(); int i1=(r.nextInt(3) +1); label.setIcon(list.get(i1)); } private void display() { JFrame f = new JFrame("ImageShuffle"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(this); f.add(label); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new ImageShuffle().display(); } }); } } Thanks in advance
has comment: http://stackoverflow.com/comment/34456220
accepted answer: http://stackoverflow.com/a/22626212
tagged with: imageicon
linked to: http://stackoverflow.com/q/1519736

http://stackoverflow.com/comment/34328420
score: 0
type: AnswerComment
has text: I installed the professional version. According to your answer, I am good I guess :)
type: Comment
comment on: http://stackoverflow.com/a/22528556

http://stackoverflow.com/comment/34337389
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22560205
has text: Errors are simple: Cannot resolve symbol B
score: 0

http://stackoverflow.com/q/22623983
has body: I realize that Queue is an interface. My problem is this. I have a Queue initialized as a LinkedList for each day of a month (31) and I need to arrange them. I am having issues understanding issues with generics. My first idea is to either make an Array of Queues (java doesn't seem to like this). Or should I just make an ArrayList of type Queue and make the initial size 32? If I do that, how would I reference a specific Queue to add something to it? Like this?: For this I'll say I'm trying to add someone to the list for the 17th day. ArrayList&lt;Queue&lt;Passenger&gt;&gt; lists = new ArrayList&lt;Queue&lt;Passenger&gt;&gt;(32); Passenger person = new Passenger(first, last); (lists.get(17)).add(person); I feel like this would give me a null pointer exception? Perhaps not. Any input/example code is much appreciated.
has title: How to manage array/arraylist of queues/LinkedLists?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34452655
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/34452685
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34452591
has answer: http://stackoverflow.com/a/22624107
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/34348327
type: QuestionComment
has text: What do you mean, empty?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22562257

http://stackoverflow.com/q/22535767
has comment: http://stackoverflow.com/comment/34296430
tagged with: utf-16le
has comment: http://stackoverflow.com/comment/34295423
type: UnansweredQuestion
has body: So I'm writing a tool for a game for modding, it's working all fine, but I got a problem with writing Strings to a file. The game needs the file encoded in UTF-16LE BOM, so my code looks something like this: public void save() { FileOutputStream fos = null; byte[] buffer = null; try { fos = new FileOutputStream(new File("data//backup.txt")); } catch (FileNotFoundException ex) { } try { fos.write((byte)255); fos.write((byte)254); fos.write("\"lang\"\n".getBytes("UTF-16LE")); String s = ""; for(int i = 1;i&lt;fileContent.size();i++) { s = fileContent.get(i); fos.write(s.getBytes("UTF-16LE")); fos.write(System.getProperty("line.separator").getBytes("UTF-16LE")); } fos.close(); } catch(Exception e){} } fileContent is a ArrayList of Strings, containing NO line separators (I checked this multiple times). So my problem is, that there are written too many line separators to the file. Instead of e.g.: a b I get something like: a b Any ideas, what I'm doing wrong?
has comment: http://stackoverflow.com/comment/34294918
answer count: 0
has comment: http://stackoverflow.com/comment/34295842
tagged with: java
tagged with: fileoutputstream
has comment: http://stackoverflow.com/comment/34298208
type: Question
has comment: http://stackoverflow.com/comment/34296113
tagged with: byte-order-mark
tagged with: lines
has comment: http://stackoverflow.com/comment/34295018
score: 0
has title: Java FileOutputStream too many line separators

http://stackoverflow.com/comment/34251522
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/22511634
has text: What is the exact error you get?
type: Comment

http://stackoverflow.com/comment/34278835
type: AnswerComment
type: Comment
has text: In this article [link](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java)
comment on: http://stackoverflow.com/a/22526847
score: 0

http://stackoverflow.com/comment/34378652
type: AnswerComment
comment on: http://stackoverflow.com/a/22579331
type: Comment
has text: First, it is not guaranteed by any means that the compiler or VM will inline it (because it *doesn't* have to; see -O0 switch in GCC for example) - and in case it doesn't, the variable has to get memory allocated for it (once) and get set (for each loop iteration); secondly, even if it *gets* inlined, it makes the code longer and less readable, making it longer by 50%. Should I post references supporting both claims or is that not particularly necessary?
score: 0

http://stackoverflow.com/q/22508124
tagged with: java
has title: NetBeans doesn't recognize imported class
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/34245415
has comment: http://stackoverflow.com/comment/34245032
favorite count: 0
score: 2
possible better answer: http://stackoverflow.com/a/22508294
tagged with: netbeans
downvote count: 0
has answer: http://stackoverflow.com/a/22508294
has body: I've been working for a couple of weeks and NetBeans hasn't done anything like this before: it doesn't recognize an import. I've tried some workarounds but I can't get past this. To better understand what's going on here are some screenshots: The respective import has a warning as it's unused; With qualified name: I've tried fully qualified with the same effect. I chose the name from the very suggestion list. any method I pick is unrecognized. I can tell this is a NetBeans bug but what can I do to go on with my project? I've tried advices on other answers like deleting the cache, deleting the roaming\7.4 contents even reinstalling. I've worked on NetBeans 7.4; uninstalled and replaced it with NetBeans 8.0, all for nothing. And aren't identical words supposed to be visually cued by the yellowish color?
has answer: http://stackoverflow.com/a/22508391
accepted answer: http://stackoverflow.com/a/22508391
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/34323603
score: 1
type: AnswerComment
has text: Its working now. Added try catch and provide proper formatting.
comment on: http://stackoverflow.com/a/22550435
type: Comment

http://stackoverflow.com/a/22579883
score: 1
has body: This public class BoxImpl&lt;T&gt; implements Box&lt;T&gt; { is a generic class declaration. It declares a type variable T for use in instance class members. This public static&lt;V&gt; Box&lt;V&gt; make() { return new BoxImpl&lt;V&gt;(); } is a generic method. It declares its own generic variables and is static. It cannot use the class type variables. The name of the type variable is not an issue here. The name could be the same, but it will not be referring to the same type.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22579810
type: Answer

http://stackoverflow.com/comment/34412970
type: Comment
has text: you can detach entity and after all changes merge it back again. But I think it is bad way. You can try get entity using query and set FlushMode.COMMIT on query, maybe it's help
comment on: http://stackoverflow.com/q/22595742
score: 0
type: QuestionComment

http://stackoverflow.com/a/22630469
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22630048
has body: First,you must dynamically generate a calendar. you can set an event to the calendar,on clicking the date. With JSONArray and JSONObject from Fragment Manager, you can interact with content provider and also with server.After retrieving necessary details you can fix the alert on mentioned date weekly,monthly and yearly.

http://stackoverflow.com/comment/34247087
type: Comment
has text: what are the errors and where are you getting them??
type: AnswerComment
comment on: http://stackoverflow.com/a/22509129
score: 0

http://stackoverflow.com/q/22559622
has title: Strange @hide behavior
type: Question
has comment: http://stackoverflow.com/comment/34336558
has comment: http://stackoverflow.com/comment/34336134
has comment: http://stackoverflow.com/comment/34338112
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/17035271
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34336193
duplicate of: http://stackoverflow.com/q/17035271
has answer: http://stackoverflow.com/a/22559748
has comment: http://stackoverflow.com/comment/34338564
has body: In BitmapFactory.decodeStream method : public static Bitmap decodeStream(InputStream is, Rect outPadding, Options opts) { // we don't throw in this case, thus allowing the caller to only check // the cache, and not force the image to be decoded. if (is == null) { return null; } Bitmap bm = null; Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "decodeBitmap"); try { if (is instanceof AssetManager.AssetInputStream) { final int asset = ((AssetManager.AssetInputStream) is).getAssetInt(); bm = nativeDecodeAsset(asset, outPadding, opts); } else { bm = decodeStreamInternal(is, outPadding, opts); } if (bm == null &amp;&amp; opts != null &amp;&amp; opts.inBitmap != null) { throw new IllegalArgumentException("Problem decoding into existing bitmap"); } setDensityFromOptions(bm, opts); } finally { Trace.traceEnd(Trace.TRACE_TAG_GRAPHICS); // THAT IS COLLISION LINE } return bm; } we see a usage Trace.TRACE_TAG_GRAPHICS. Ok, let's look at Trace.java : public final class Trace { /* * Writes trace events to the kernel trace buffer. These trace events can be * collected using the "atrace" program for offline analysis. */ private static final String TAG = "Trace"; // These tags must be kept in sync with system/core/include/cutils/trace.h. /** @hide */ public static final long TRACE_TAG_NEVER = 0; /** @hide */ public static final long TRACE_TAG_ALWAYS = 1L &lt;&lt; 0; /** @hide */ public static final long TRACE_TAG_GRAPHICS = 1L &lt;&lt; 1; ... And when i try to use Trace.TRACE_TAG_GRAPHICS flag compiler give me error that this tag not responsible for me. I agree with him. But the question - Why BitmapFactory have access to @hide variables and why me not?
tagged with: java

http://stackoverflow.com/comment/34332529
comment on: http://stackoverflow.com/q/22555819
type: Comment
type: QuestionComment
has text: You basically prove it yourself already; very interesting test and very interesting results. It is not so hard to accept that the JVM is capable of doing this kind of optimization; it might even happen at compile time. If you're interested you might examine the byte code (disassembled) that is generated upon compilation to see if it drastically changes.
score: 0

http://stackoverflow.com/q/22552993
answer count: 2
has answer: http://stackoverflow.com/a/22564717
score: 0
has answer: http://stackoverflow.com/a/22553818
tagged with: android
tagged with: build.gradle
tagged with: android-studio
type: UnansweredQuestion
has title: Build.gradle could not resolve symbol.Emulator won't start because of that
has body: Gradle 'MyApplication' project refresh failed: Build script error, unsupported Gradle DSL method found: 'signingConfigs()'! Possible causes could be: - you are using Gradle version where the method is absent - you didn't apply Gradle plugin which provides the method - or there is a mistake in a build script This is what my event log is writing.Please help me!!What i should to do Here is a code: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.7.+' } } allprojects { repositories { mavenCentral() } } apply plugin: "android" android { compileSdkVersion 19 buildToolsVersion "19.0.0" } signingConfigs { release { storeFile file('android.keystore') storePassword "pwd" keyAlias "alias" keyPassword "pwd" } } buildTypes { release { signingConfig signingConfigs.release } } P.S. After i applied code starting from "apply plugin:'android'".So,when i focus with mouse to this code it states"Could not resolve symbol "signingConfig""
tagged with: java
type: Question

http://stackoverflow.com/comment/34371911
score: 0
type: Comment
has text: Thats all well and good, but that is not what I need. I need a consistent clip section (viewPort) to display whatever would be behind it if the main image were rotated.
comment on: http://stackoverflow.com/a/22549162
type: AnswerComment

http://stackoverflow.com/comment/34291184
score: 0
type: AnswerComment
has text: asynctask is handled by android os itself and they execute in background serially or in parallel as the android os version so running two asycntasks do not guarantee that one will be executed after another if you want to do it in this way you can override the Executor class and its method and specify your preffered sequence
type: Comment
comment on: http://stackoverflow.com/a/22532408

http://stackoverflow.com/q/22553806
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22553862
score: -1
has comment: http://stackoverflow.com/comment/34326170
upvote count: 0
answer count: 1
favorite count: 0
has title: Find words by characters inside string
accepted answer: http://stackoverflow.com/a/22553862
has comment: http://stackoverflow.com/comment/34326238
has body: is it possible using java to get words by characters from string using java API or regular expressions? For example I have string : `A broken friendship may be soldered, but will never be sound.` and want to get all words that include so (soldered and sound) and replace them with soldered and sound Thanks!
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34326176
tagged with: java

http://stackoverflow.com/comment/34220671
score: 1
has text: Why don't you use the [zip filesystem provider](http://docs.oracle.com/javase/8/docs/technotes/guides/io/fsp/zipfilesystemprovider.html) instead?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22493333

http://stackoverflow.com/a/22569418
answers question: http://stackoverflow.com/q/22567419
has comment: http://stackoverflow.com/comment/34358386
downvote count: 0
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34357249
has body: This happens when org.apache.karaf.main.SimpleFileLock is used to implement a simple master-slave failover deployment. More details can be found here. If an already another FUSE ESB instance is running, then the second started instance is waiting until the first process is stopped. If you stop the first instance, the second instance will start and get the lock and the log entries will disappear. Master and slave instance must refer to the same lock file in the file system. If this is not possible as master and slave are on different hosts, then org.apache.karaf.main.DefaultJDBCLock can be used.

http://stackoverflow.com/q/22499068
score: 3
tagged with: java
answer count: 2
has title: how to get values for customfields of a custom record in Netsuite
has answer: http://stackoverflow.com/a/22514799
tagged with: netsuite
has answer: http://stackoverflow.com/a/24059379
downvote count: 1
upvote count: 4
tagged with: suitetalk
has body: I'm new to integration with Netsuite. I've created a custom record and some fields along with values in Netsuite app, now I want to get those values from Webservice request. I'm getting labels, but I'm unable to get values. CustomRecordType record = (CustomRecordType)response.getRecord(); CustomRecordTypeFieldList fields = record.getCustomFieldList(); CustomRecordCustomField[] crcf = fields.getCustomField(); for(CustomRecordCustomField c:crcf) { System.out.println(c.getLabel()); }
favorite count: 0
type: UnansweredQuestion
type: Question

http://stackoverflow.com/q/22593593
upvote count: 2
has comment: http://stackoverflow.com/comment/34397709
type: Question
has comment: http://stackoverflow.com/comment/34397668
tagged with: overloading
has comment: http://stackoverflow.com/comment/34397953
has comment: http://stackoverflow.com/comment/34397735
has comment: http://stackoverflow.com/comment/34397699
has comment: http://stackoverflow.com/comment/34397903
tagged with: java
has title: method rules overloading explanation in java
has answer: http://stackoverflow.com/a/22593635
has comment: http://stackoverflow.com/comment/34397775
has body: I try to understand overloading rules which uses java compiler. it is too hard for me. public class Main { public static void var(Long x) { System.out.println("Long"); } public static void var(int... x) { System.out.println("int... x"); } public static void main(String... args) { var(5); } } output: int... In Internet I found next rules: Primitive Widening > Boxing > Varargs. Widening and Boxing (WB) not allowed. Boxing and Widening (BW) allowed. While overloading, Widening + vararg and Boxing + vararg can only be used in a mutually exclusive manner i.e. not together. Widening between wrapper classes not allowed but I cannot apply this rules to this code behaviour. Can you help me? my wrong version: boxing int -> Integer and widening to Long Additional question public class Main { public static void var(Object x) { System.out.println("Object"); } public static void var(int... x) { System.out.println("int... x"); } public static void main(String... args) { var(5); } } output: object
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22593635
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34397821

http://stackoverflow.com/comment/34428432
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22610591
has text: Yes, that's an actual complication: it prevents me from extending InOne inside something that extends One.

http://stackoverflow.com/a/22596492
has comment: http://stackoverflow.com/comment/34403072
has body: You don't return anything, but you say that you will return an int[]. public int[] convertNumtoDigitArray() //Java saying this line is a problem { String[] userGuessSplit = Player.userGuess.split(","); int[] userGuessArray = new int[userGuessSplit.length]; for (int j=0; j&lt;userGuessSplit.length; j++) { userGuessArray[j] = Integer.parseInt(userGuessSplit[j]); } return userGuessArray; }
has comment: http://stackoverflow.com/comment/34403236
has comment: http://stackoverflow.com/comment/34403025
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34403173
answers question: http://stackoverflow.com/q/22596465
type: Answer
accepted answer of: http://stackoverflow.com/q/22596465

http://stackoverflow.com/a/22572890
accepted answer of: http://stackoverflow.com/q/22572703
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34385962
has comment: http://stackoverflow.com/comment/34360796
has body: The error in your logic shows up when N is a multiple of M, for example the input 6 3 1 produces 4, but it should produce 3. The problem is with this condition: if (M &lt;= N) it should be: if (M &lt; N) By testing for equality too, the bank robber makes one more trip back to the bank, but there's nothing to collect, so the loop ends (with her at the bank, rather than at the car - another logic problem). If I were doing this I would not use a loop - I would use purely numerical methods (an exercise for the reader, but hover over the following to see my solution): int time = (N / M) * 2 * T + (N % M == 0 ? -T : T);
answers question: http://stackoverflow.com/q/22572703
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22511392
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/34251336
tagged with: java
tagged with: printing
upvote count: 1
answer count: 1
favorite count: 0
has body: I have a jPanel with a bunch of jLabel's and other components. When i print the jPanel the text in the jLabel is cutoff. How can i fix this? Here is my printing code //handle the printing private class Prints implements Printable { public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { if (pageIndex &gt; 0) { return Printable.NO_SUCH_PAGE; } // get the bounds of the component Dimension dim = dashHolderPanel.getSize(); double cHeight = dim.getHeight(); double cWidth = dim.getWidth(); // get the bounds of the printable area double pHeight = pageFormat.getImageableHeight(); double pWidth = pageFormat.getImageableWidth(); double pXStart = pageFormat.getImageableX(); double pYStart = pageFormat.getImageableY(); double xRatio = pWidth / cWidth; double yRatio = pHeight / cHeight; Graphics2D g2 = (Graphics2D) graphics; g2.translate(pXStart, pYStart); g2.scale(xRatio, yRatio); // print it dashHolderPanel.print(g2); return Printable.PAGE_EXISTS; } } Here is the code for the print Button private void printDashButtonMouseClicked(java.awt.event.MouseEvent evt) { try { //print the dash if (evt.getClickCount() == 1) { PrinterJob pjob = PrinterJob.getPrinterJob(); pjob.setJobName("Print ROP Dash"); //set the attributes of the page formatter PrintRequestAttributeSet attr_set = new HashPrintRequestAttributeSet(); attr_set.add(Fidelity.FIDELITY_TRUE); attr_set.add(PrintQuality.HIGH); attr_set.add(PrintQuality.HIGH); attr_set.add(OrientationRequested.LANDSCAPE); attr_set.add(MediaSizeName.NA_LETTER); float width = (float) MediaSize.NA.LETTER.getX(MediaSize.INCH); float height = (float) MediaSize.NA.LETTER.getY(MediaSize.INCH); attr_set.add(new MediaPrintableArea(0.25f, 0.25f, width - 0.5f, height - 0.5f, MediaPrintableArea.INCH)); //get the formatter PageFormat pf2 = pjob.pageDialog(attr_set); //If user does not hit cancel then print. if (pf2 != null &amp;&amp; pjob.printDialog() == true) { //Set print component pjob.setPrintable(new Prints(…
has title: jlabel text getting cutoff when printing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34251358
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22511698

http://stackoverflow.com/comment/34240134
has text: @StephenC I added a more complete stacktrace
comment on: http://stackoverflow.com/q/22505192
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23274019
accepted answer of: http://stackoverflow.com/q/22513152
answers question: http://stackoverflow.com/q/22513152
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36090572
downvote count: 0
has comment: http://stackoverflow.com/comment/36057537
has body: Just to provide an answer, this all turned out to be a JVM memory issue. The JVM would run out of memory overnight. I don't know why but this server had some special garbage collector options turned on for tomcat and when I remove those, not only did the problem go away but the memory footprint on that machine is much smaller. The default garbage collector must be more aggressive then the one that was being used. The problem hasn't occurred in several weeks and was never related to c3p0, I don't think. C3P0 was just the one catching and reporting problems.
type: Answer
score: 2
upvote count: 2

eclipse-plugin
tags question: http://stackoverflow.com/q/22521893
tags question: http://stackoverflow.com/q/22542964
type: Tag
tags question: http://stackoverflow.com/q/22597276
tags question: http://stackoverflow.com/q/22494596
tags question: http://stackoverflow.com/q/22494233
tags question: http://stackoverflow.com/q/22494353
tags question: http://stackoverflow.com/q/22621262
tags question: http://stackoverflow.com/q/22530718
tags question: http://stackoverflow.com/q/22506519
tags question: http://stackoverflow.com/q/22570167
tags question: http://stackoverflow.com/q/22491968
tags question: http://stackoverflow.com/q/22504497
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/22628018

http://stackoverflow.com/comment/34455580
type: Comment
has text: Nope, still not working. Are you sure that your "var decrypt" is correct because I think the key should be in UTF-8 format. Anyway I tried it but didnt work.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22610341

http://stackoverflow.com/q/22541340
has title: cannot convert from ArrayList<Integer> to ArrayList<String>
has answer: http://stackoverflow.com/a/22541435
has comment: http://stackoverflow.com/comment/34304786
type: UnansweredQuestion
has body: I have a ArrayList with integer value and I want to read this value from another ArrayList consist string value. How can I do that ? public static ArrayList&lt;Integer&gt; scorerValue = new ArrayList&lt;Integer&gt;(); and I want read here using ArrayList&lt;String&gt; score_Number ;
score: -4
has comment: http://stackoverflow.com/comment/34305432
has comment: http://stackoverflow.com/comment/34304876
tagged with: java
has answer: http://stackoverflow.com/a/22541426
type: Question
downvote count: 4
upvote count: 0
favorite count: 0
tagged with: arraylist
answer count: 3
has answer: http://stackoverflow.com/a/22541489
has comment: http://stackoverflow.com/comment/34304788

http://stackoverflow.com/comment/34458189
type: QuestionComment
comment on: http://stackoverflow.com/q/22627038
score: 0
type: Comment
has text: @Potatoswatter: the first dup isn't language specific, but the accepted answer quotes Stroustrup's explanation of his reasoning.

http://stackoverflow.com/q/22537885
tagged with: user-interface
downvote count: 0
favorite count: 0
has body: Thanks for the help. The objects are all showing now. But I ran into a new problem. Im trying to use a For loop to draw 10 copys of the same box with a little space in between so they don't just stack in the same position. But for some reason they keep getting painted on top of eachother and in the center instead of starting at x = 20... import java.awt.*; import javax.swing.*; public class CarWashPanel extends JPanel { public int i; public int x = 20; @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.black); for (i=0; i &lt; 10; i++){ g.fillRoundRect(x, 10, 50, 100, 55, 25); x = x + 10; } } @Override public Dimension getPreferredSize() { return new Dimension(500, 150); } } // I'm trying to add graphics in my CarWashPanel class to I want to add to my GUI. I've read some tutorials and other questions but I can't figure out what i'm doing wrong. The buttons and label that i've added to the GUI show up just fine but when I add something to my CarWashPanel it doesn't show up in the GUI. I feel like I need to tell my GUI to add all elements from the CarWashPanel but I'm not sure how. public class Main { public static void main(String[] args) { GUI g = new GUI(); } } import javax.swing.*; import java.awt.*; public class GUI extends JFrame { private JTextField t1 = new JTextField(2); private JLabel l1 = new JLabel("enter position"); private JButton b1 = new JButton("new customer"); private JButton b2 = new JButton("wash car"); public GUI() { setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE ); add(l1); add(t1); add(b1); add(b2); setTitle("Carwash"); setSize(500, 200); setVisible(true); setLayout(new FlowLayout()); add(new CarWashPanel()); } } public class Carwash { private boolean[] positions = new boolean[10]; private int washing = 10; public void addCar(int p) { positions[p] = true; } public void removeCar(int p) { positions[p] = false; } public boolean[] getPositions() { return positions; } public int getWashing() { return washin…
has title: Java GUI paintcomponent (newbie)
type: UnansweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22538363
has answer: http://stackoverflow.com/a/22538111
score: 1
tagged with: java
answer count: 2

http://stackoverflow.com/a/22562304
downvote count: 0
has comment: http://stackoverflow.com/comment/34354105
has body: What helps is to have a top-down refinement of your control flow / logic. As this reeks a bit of home work, just an idea: Set&lt;String&gt; pins = readPINs(); boolean authenticated = false; for (int attempt = 0; attempt &lt; 3; ++attempt) { String pin = askForPIN(); if (!isSyntacticalValidPIN(pin)) { giveError(); break; } else if (pins.contains{pin)) { authenticated = true; break; } } if (authenticated) { offerMenu(); }
has comment: http://stackoverflow.com/comment/34341597
type: Answer
answers question: http://stackoverflow.com/q/22562029
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34341105

http://stackoverflow.com/a/22538762
upvote count: 4
downvote count: 0
has body: This is because you create a brand new Status object each time you press the button. Status status = new Status(); Consider declaring status as a field initializing it only ones.
score: 4
answers question: http://stackoverflow.com/q/22538633
type: Answer

http://stackoverflow.com/q/22512089
has comment: http://stackoverflow.com/comment/34252446
has title: Converting one bit to an ascci value
has comment: http://stackoverflow.com/comment/34252464
has body: So I'm reading bytes as a fileinputstream and then taking one bit to hexidecimal. How to I convert the value then to the ascii value if there is one. All I've seen on how to do this is from pure Binary?
tagged with: hex
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/34420089
type: Comment
has text: Feel free to correct me if office support states something else. Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22606288

http://stackoverflow.com/q/22627860
downvote count: 0
has answer: http://stackoverflow.com/a/22628237
has title: Call virtual method in constructor - better design
answer count: 4
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23911246
tagged with: design-patterns
score: 3
tagged with: oop
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34459507
has answer: http://stackoverflow.com/a/22629600
has body: I declared an ISerializable interface in java. I basically have 2 methods: serialize(), and deserialize(byte[] buffer). public interface ISerializable{ byte[] serialize(); deserialize(byte[] buffer); } and here is an example of a class implementing this interface: public class MySerializableClass implements ISerializable{ byte[] serialize(){bla bla} deserialize(byte[] buffer){bla bla}; } Ideally, I would like the call to deserailize to be implicit. i.e. when calling the constructor MySerializableClass(byte[] buffer), it would call the correct deserialize with the buffer passed. like that: public abstract class AbstractSerializable { public abstract byte[] serialize(); public abstract void deserialize(byte[] buffer); public AbstractSerializable (){} public AbstractSerializable (byte[] buffer){ deserialize(); } } public class MySerializableClass extends AbstractSerializable { byte[] serialize(){bla bla} deserialize(byte[] buffer){bla bla}; } AFAIK it is problematic to call virtual methods within the constructor and this might end up with an undefined behavior. so currently, I am doing the following: MySerializableClass myClass = new MySerializableClass(); myClass.deserialize(buffer); or by using a dedicated static method that is defined for each class that extends my interface (and basically just do the above 2 lines of code): MySerializableClass myClass = MySerializableClass.CreateMySerializableClass(buffer); My questions is: is there any elegant way to do that without the need to define a dedicated static method for each class implements ISerializable? Is there any design pattern that solves this issue? Note: My serialization is unique so I need to write it on my own, and also for technical reasons I can only use very basic features of Java. ( no annotations,templaates metadata, etc.) so I need a very basic OOP solution.
has answer: http://stackoverflow.com/a/22628094

http://stackoverflow.com/q/22521288
possible better answer: http://stackoverflow.com/a/22521663
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34270372
has answer: http://stackoverflow.com/a/22521705
accepted answer: http://stackoverflow.com/a/22521705
upvote count: 10
downvote count: 1
score: 9
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34306839
has comment: http://stackoverflow.com/comment/42803677
tagged with: class
has comment: http://stackoverflow.com/comment/34270054
has body: What are Auxiliary classes in Java, how does some one write one, and how does the compiler know that something is an Auxiliary class? The reason I ask this is because the compiler is generating a warning regarding an object in an external library: warning: auxiliary class Pattern in jregex/Pattern.java should not be accessed from outside its own source file and I want to know why
has comment: http://stackoverflow.com/comment/34306588
has answer: http://stackoverflow.com/a/22521663
favorite count: 0
has title: What are auxiliary classes?

http://stackoverflow.com/a/22590401
answers question: http://stackoverflow.com/q/22590381
upvote count: 11
has body: mm represents minutes, so when you use mm, it will print minutes instead of month. While MM represents months. Read more about Time Patterns
type: Answer
downvote count: 0
score: 11

http://stackoverflow.com/comment/34459166
type: AnswerComment
has text: @SotiriosDelimanolis, I also noticed that now. This is no unit testing. My first question was `Is it mandatory to have controllers to unit test the interceptors?` and everybody here answered `NO` and yet, in the example and the forum link, they are calling `ModelAndView modelAndView = handler.handleRequest(request, response);` to test the interceptor. This is as good as writing a unit test for a controller using `MockMvc` which is cleaner and way simpler than this. I am already doing that. All I wanted is a different way to test interceptor in silo. Anyways, I think this thread is closed.
type: Comment
comment on: http://stackoverflow.com/a/22626469
score: 0

http://stackoverflow.com/a/22510044
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34249107
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34248954
accepted answer of: http://stackoverflow.com/q/22509914
answers question: http://stackoverflow.com/q/22509914
has comment: http://stackoverflow.com/comment/34251886
has body: It's more there's no reason to mark it as unmodifiable. If you want to change the contents of the list, feel free, it's just the results from a database. The list in the query object has no reason to make it unmodifiable. It's just an in memory store of what's in the database at that point so modifying this list doesn't make changes to the database unless you actually persist this new list.

http://stackoverflow.com/comment/34363717
score: 0
type: Comment
has text: For this you need to use sharedPrefernce and store the value in it..
type: QuestionComment
comment on: http://stackoverflow.com/q/22574678

http://stackoverflow.com/comment/34288796
has text: Yes put the code -- Element flyBoy2 = renderFlyBoy(flyBoy1, "Mark II4455", "2"); inside a loop and call as many time as you want with the dynamic values.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22532010

http://stackoverflow.com/comment/34476788
type: QuestionComment
comment on: http://stackoverflow.com/q/22633800
type: Comment
has text: Also, your intercept won't currently compile. Show us what you actually have.
score: 0

http://stackoverflow.com/comment/34336043
type: QuestionComment
comment on: http://stackoverflow.com/q/22558646
score: 0
has text: I have a Enum which contain some values and i have to show in this way so tried Java its done thought it will done in EL Expression as well
type: Comment

http://stackoverflow.com/q/22510622
has title: How can I install a plugin on Mac programmatically?
has answer: http://stackoverflow.com/a/22514236
downvote count: 0
has body: I need to install a plugin on a Mac programmatically. I know a plugin can be installed by simply copying the .plugin file to the Internet Plug-ins folder, but since you need to enter a password to write to that folder, I have not been able to do it programmatically. Is there any other way to install a plugin on a Mac? Or is there a way to get around the password for the plugins folder?
answer count: 1
tagged with: macos
favorite count: 0
has comment: http://stackoverflow.com/comment/34250587
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34292400
upvote count: 1
tagged with: plugins
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34255570
type: Question

http://stackoverflow.com/q/22576166
type: Question
has comment: http://stackoverflow.com/comment/34367181
has answer: http://stackoverflow.com/a/22576241
has body: In the past I have argued with some coder friends of mine who think that else if statements in Java are just syntactic sugar, and that anything done with else if can just be done with serial if instead. But today I read something that I think might contradict that conclusively. Take for example the following code where int x = 1. if(x &gt;= 5){ System.out.println("First condition"); } else if(x &lt; 5){ System.out.println("Second condition"); } else if (x &lt; 2){ System.out.println("Third condition"); } If you used seriel if statements (without the else) you get the output; Second Condition Third Condition But with the above else if statements what you actually get is Second Condition Because else if statements don't fall through. Because the first else if ran, no other will run after it even if the conditions would be met. So to my question. Is there a way to accomplish this behaviour with serial standard if statements?
has title: Is - `else if` - just syntactic sugar?
has comment: http://stackoverflow.com/comment/34366158
tagged with: java
downvote count: 3
upvote count: 4
answer count: 4
tagged with: if-statement
has comment: http://stackoverflow.com/comment/34366127
has answer: http://stackoverflow.com/a/22576358
accepted answer: http://stackoverflow.com/a/22576241
has comment: http://stackoverflow.com/comment/34366197
has answer: http://stackoverflow.com/a/22576479
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34366081
score: 1
has comment: http://stackoverflow.com/comment/34366632
has comment: http://stackoverflow.com/comment/34366670
favorite count: 0
possible better answer: http://stackoverflow.com/a/22576479
has answer: http://stackoverflow.com/a/22576231

http://stackoverflow.com/comment/34356999
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22569306
has text: @Venkat - I had researched and as Randall commented I found that anti-xml was no longer being actively developed and that is why I am here :)
score: 0

http://stackoverflow.com/comment/34248474
type: AnswerComment
has text: If it was sorted, then its O(N) to find the longest continuous sequence. Just walk the entire vector starting from 1, if vec[i] == vec[i-1]+1, increment sequence_len, else max_len = max(sequence_len,max_len) and then sequence_len = 0.
comment on: http://stackoverflow.com/a/22507683
type: Comment
score: 0

http://stackoverflow.com/comment/34240038
comment on: http://stackoverflow.com/a/22504906
type: Comment
has text: Thanks, though think (1) is not correct, i.e. many users can have many rules, many rules can have many users = @ManyToMany
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34428748
type: Comment
has text: Are you running from a main() method or in a deployed WAR? Can you share the whole project?
comment on: http://stackoverflow.com/q/22598968
score: 0
type: QuestionComment

http://stackoverflow.com/q/22568744
upvote count: 2
downvote count: 1
answer count: 1
tagged with: applet
tagged with: asp.net
favorite count: 0
type: UnansweredQuestion
has body: I have a asp.Net application that make calls to a java applet. Requests via javascript work as expected without problems. however there is a mechanism that searches the time intervals in the applet. (using setInterval) And when this mechanism is triggered the page "loses" focus. For example, if I'm with the focus on a text field, and the call occurs, the focus leaves the field. I tried to go the other way, the applet calling the page, but the result was the same. I also tried putting this control inside an UpdatePanel, to try to isolate the callback but it still fails. Also tried putting inside an iframe, but it still fails. Here is the code that makes the request function initTimerDevices() { setInterval(getDeviceStatus, 5000); } function getDeviceStatus(name) { document.applet.getDeviceStatus("ASDF"); } $(document).ready(function () { initTimerDevices(); }); And here is the ASP &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;applet name="Myapplet" code=com.xpto.applet.class archive="applet.jar" width="0.5" height="0.5"&gt; &lt;/applet&gt; &lt;ul id="ulDevices"&gt; &lt;/ul&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; Is there any way to make the call to the applet asynchronously? Or other form that causes this loss of focus does not exist.
has title: ASP.NET page calls Java Applet and fields lost focus
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34361192
tagged with: javascript
has answer: http://stackoverflow.com/a/22573205

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/22559701
type: Tag
tags question: http://stackoverflow.com/q/22624179
tags question: http://stackoverflow.com/q/22509185

http://stackoverflow.com/q/22522870
has answer: http://stackoverflow.com/a/22631242
tagged with: java
tagged with: eclipse-jdt
has title: How to determine the class is AnnotationDeclaration or TypeDeclaration using JDT
type: Question
has body: I am using JDT ASTParser to parse all Java file in given folder. I wrote the follow code: private void parse(String fileContent) { // TODO Auto-generated method stub //advise the parser to parse the code following to the Java Language Specification, Third Edition. ASTParser parser = ASTParser.newParser(AST.JLS3); // tell the parser, that it has to expect an ICompilationUnit (a pointer to a Java file) as input. parser.setKind(ASTParser.K_COMPILATION_UNIT); parser.setSource(fileContent.toCharArray()); parser.setResolveBindings(true); final CompilationUnit cu = (CompilationUnit) parser.createAST(null); cu.accept(new ASTVisitor() { public boolean visit(AnnotationTypeDeclaration node) { System.out.println("Annotaion: " + node.getName()); return true; } public boolean visit(TypeDeclaration node) { System.out.println("Type: " + node.getName()); return true; } }); } The thing is that, there are 2 kind of Java classes: Bound2Processor.java is a normal java class: TypeDeclaration package com.richardle; import ...; public class Bound2Processor extends AbstractAnnotationProcessor&lt;Bound, CtMethod&lt;?&gt;&gt; { ... } Bound.java is annotation declaration class: AnnotationTypeDeclaration package com.richardle; public @interface Bound { double min(); } But when running the code, I got the output: File: D:\SOFTWARE\Android\SpoonTest\src\com\richardle\Bound.java // no thing print here File: D:\SOFTWARE\Android\SpoonTest\src\com\richardle\Bound2Processor.java Type: Bound2Processor The problem is that the name of annotation class was not printed. Maybe ASTParser not call the function public boolean visit(AnnotationTypeDeclaration node). Could you please tell me why ASTParser ignore this function? And how can determine a class is a normal class or annotation declaration ?
answer count: 1
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22631242
tagged with: annotations
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/22633635
answers question: http://stackoverflow.com/q/22624014
accepted answer of: http://stackoverflow.com/q/22624014
upvote count: 2
type: AcceptedAnswer
has body: As you are only asking for "best practice", the answer is very straightforward: always call ExceptionCheck or ExceptionOccurred when calling JNI functions which may raise exceptions. always check return values from JNI functions Calling ExceptionOccurred after each JNI call, preferably in a dedicated function, allows you to get some information on the exception, for logging, and also allows you to call ExceptionClear. Make the dedicated function return void, and use the return values from the JNI functions to distinguish between normal and error paths.
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34793272

http://stackoverflow.com/comment/34324837
type: Comment
has text: Can you append array content to the question...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22552874

http://stackoverflow.com/comment/34303049
comment on: http://stackoverflow.com/q/22537886
score: 0
type: Comment
has text: @SteveCox - It's always a positive number, 0-180, and there are no "left-over" bits into which to extend the sign.
type: QuestionComment

http://stackoverflow.com/a/22539868
has comment: http://stackoverflow.com/comment/34304592
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/22539586
answers question: http://stackoverflow.com/q/22539586
downvote count: 0
score: 1
has body: This occurs because the table you are trying to update is not being journalled, and your update is being run in a non-transactional mode. you can try this &lt;property name="hibernate.connection.autocommit" value="true"/&gt;
has comment: http://stackoverflow.com/comment/34304890
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34302386

http://stackoverflow.com/a/22642382
score: 4
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22642326
type: Answer
has body: You could create a String containing all characters that you don't want, then make sure selection isn't found. if ("aAb...".indexOf(selection) == -1) { Of course you'd replace the ... with all characters that you don't want.

http://stackoverflow.com/comment/34371113
type: AnswerComment
type: Comment
has text: Thank you for the explanation, now it's clearer to me.
comment on: http://stackoverflow.com/a/22578904
score: 0

http://stackoverflow.com/q/22505271
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34240212
linked to: http://stackoverflow.com/q/3459928
has comment: http://stackoverflow.com/comment/34424899
upvote count: 2
has answer: http://stackoverflow.com/a/42558872
has comment: http://stackoverflow.com/comment/34241787
has body: I have a maven project composed of several submodules. Let's call the submodules shared and webapp. The project is normally built from the parent POM, which resides in the parent directory. So the directory layout looks like: myproject/pom.xml myproject/shared/pom.xml myproject/webapp/pom.xml I have a specific plugin that I want to be executable from the command line in the top-level directory. I do not want it to run by default in any phase. So usually I want to run mvn clean install, and the plugin should not execute at all in this case. But also I want to be able to say mvn clean install com.mycompany:myplugin:goal and the execution should run in this case, but the execution should only run once for the webapp submodule. The execution should not run either for the parent POM or for the shared submodule when I specify this on the command line. The problem I have is that if I define the execution in the parent POM, it runs repeatedly for every submodule. If I define the execution in the webapp POM, it is not accessible through a command line invocation of Maven. I want to do this in a single Maven comand and that single command must also be able to build &amp; run phases for all submodules -- not just the webapp submodule -- hence the -pl command line option does not work for this case? Related: Running a specific Maven plugin goal from the command line in a sub-module of a multi-module reactor project Is such a thing possible? If it's impossible, I'll accept an answer stating that.
answer count: 1
favorite count: 0
has title: Execute maven plugin after build of one submodule
type: UnansweredQuestion
tagged with: maven
score: 2

qemu
tag name: qemu
type: Tag
tags question: http://stackoverflow.com/q/22506590

http://stackoverflow.com/a/22575082
has body: first set a value to your msg in your child class so its not null by default. Int Msg3 = 5; and display it this way System.out.println("Here is a msg:" + child.Msg4);
answers question: http://stackoverflow.com/q/22575028
score: 0
type: Answer

http://stackoverflow.com/comment/34241958
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22506281
has text: Have a look at SimpleDateFormat: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
type: Comment

http://stackoverflow.com/q/22548325
possible better answer: http://stackoverflow.com/a/22548365
has answer: http://stackoverflow.com/a/22548365
score: 0
has comment: http://stackoverflow.com/comment/34317663
has comment: http://stackoverflow.com/comment/34317833
has answer: http://stackoverflow.com/a/22548632
type: AnsweredQuestion
has body: I wanted to create a compareTo method but it gives me an error. Can anyone help me with this ? package defaultpackage; public class HuffmanEntry implements Entry&lt;Integer, String&gt; { private String c; private Integer freq; public HuffmanEntry(String c, Integer freq){ this.c = c; this.freq = freq; } @Override public int compareTo(Integer arg0) { if(getKey()&lt;arg0){ return -1; }else if(getKey()&gt;arg0){ return 1; }else{ return 0; } } @Override public Integer getKey() { return freq; } Here's my error: Exception in thread "main" java.lang.ClassCastException: defaultpackage.HuffmanEntry cannot be cast to java.lang.Integer at defaultpackage.HuffmanEntry.compareTo(HuffmanEntry.java:1)
tagged with: java
has comment: http://stackoverflow.com/comment/34317630
has title: java.lang.ClassCastException: cannot be cast to java.lang.Integer
type: Question
has comment: http://stackoverflow.com/comment/34317628
answer count: 2
accepted answer: http://stackoverflow.com/a/22548632

http://stackoverflow.com/a/26626487
downvote count: 0
has body: Check this sample code .. this sample code uses a file keystore PFX (PKCS12) .. Signs the Document and verify it. // loading the keystore - pkcs12 is used here, but of course jks &amp; co are also valid // the keystore needs to contain a private key and it's certificate having a // 'digitalSignature' key usage char password[] = "test".toCharArray(); File file = new File("test.pfx"); KeyStore keystore = KeyStore.getInstance("PKCS12"); FileInputStream fis = new FileInputStream(file); keystore.load(fis, password); fis.close(); // extracting private key and certificate String alias = "xyz"; // alias of the keystore entry Key key = keystore.getKey(alias, password); X509Certificate x509 = (X509Certificate)keystore.getCertificate(alias); // filling the SignatureConfig entries (minimum fields, more options are available ...) SignatureConfig signatureConfig = new SignatureConfig(); signatureConfig.setKey(keyPair.getPrivate()); signatureConfig.setSigningCertificateChain(Collections.singletonList(x509)); OPCPackage pkg = OPCPackage.open(..., PackageAccess.READ_WRITE); signatureConfig.setOpcPackage(pkg); // adding the signature document to the package SignatureInfo si = new SignatureInfo(); si.setSignatureConfig(signatureConfig); si.confirmSignature(); // optionally verify the generated signature boolean b = si.verifySignature(); assert (b); // write the changes back to disc pkg.close(); Here's the sample source : https://poi.apache.org/apidocs/org/apache/poi/poifs/crypt/dsig/SignatureInfo.html I hope this could help!
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22522187
score: 2

http://stackoverflow.com/comment/34326984
has text: @user3110424 thanks ya, of course I have do that in my xml part. I am able to run it in emulator, it just fail for real device.
type: QuestionComment
comment on: http://stackoverflow.com/q/22553890
type: Comment
score: 0

http://stackoverflow.com/q/22501919
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34235016
has title: How to populate the SWT table with database content?
answer count: 0
tagged with: java
tagged with: swt
tagged with: mysql
has comment: http://stackoverflow.com/comment/34273399
type: Question
has comment: http://stackoverflow.com/comment/34238574
has comment: http://stackoverflow.com/comment/34237984
has comment: http://stackoverflow.com/comment/34236278
has body: I am using PhpMyAdmin to save my data in database. I have a SWT table to populate with database content. I tried below code. which prints the server data perfectly in console but it doesn't populate in my SWT table. here is my code.. public static void fetchDatafromDB(String StartIndex, String FinalIndex) { try { Class.forName(GlobalVariables.SQL_driver).newInstance(); Connection conn = DriverManager.getConnection(GlobalVariables.DB_url + GlobalVariables.DB_name, GlobalVariables.DB_Username, GlobalVariables.DB_password); Statement st = conn.createStatement(); String query = "SELECT `From`, `To`, `IDno`, `TimeStamp` FROM `callsheet` WHERE TimeStamp BETWEEN '" + StartIndex + "' AND '" + FinalIndex + "'"; ResultSet rs = st.executeQuery(query); java.sql.ResultSetMetaData rsmd = rs.getMetaData(); int columnsNumber = rsmd.getColumnCount(); while (rs.next()) { for (int i = 1; i &lt;= columnsNumber; i++) { // System.out.print(rs.getString(i)); item.setText(i, rs.getString(i)); } // System.out.println(); } } catch (Exception P) { P.printStackTrace(); } } I am getting error in setText() line. Something similar happened when i was trying to print the ID no (RFID) in TextField(SWT). Could you provide some specific solution for above problem please? Following Errors occurred. java.lang.NullPointerException at java2MySql.fetchDatafromDB(java2MySql.java:200) at vehicleUserLog.NewVehicleCallSheet$6.widgetSelected(NewVehicleCallSheet.java:618) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759) at vehicleUserLog.NewVehicleCallSheet.open(NewVehicleCallSheet.java:167) at java2MySql.ReadFromDB(java2MySql.java:72) at java2MySql.SignInParser(java2MySql.java:107) at ReportWindow.verifyfromDB(Repor…
score: 0
has comment: http://stackoverflow.com/comment/34238474
has comment: http://stackoverflow.com/comment/34236886

http://stackoverflow.com/a/22644796
type: Answer
upvote count: 1
has body: s.split(",")[0]; Split gives you an array of Strings that are split up by the regex provided in the argument. You would want to check the length of the output of the split before using it.
answers question: http://stackoverflow.com/q/22644746
downvote count: 0
score: 1

http://stackoverflow.com/a/22534231
type: Answer
has body: The problem appears in the context of parameters and assignments only. I.e. CharSequence cs1=(true? String.class: StringBuilder.class).newInstance(); works. Unlike the other answer claims, using a generic &lt;T&gt; T ternary(boolean cond, T a, T b) method does not work. This still fails when the invocation is passed to a generic method like &lt;T&gt; T foo(Class&lt;T&gt; clazz) so that the actual type of &lt;T&gt; is searched. However it works in the assignment example Class&lt;? extends CharSequence&gt; aClass = true ? String.class : StringBuilder.class; as the resulting type is already specified explicitly. Of course, a type cast to Class&lt;? extends CharSequence&gt; would always fix that for the other use cases too. The problem is that the algorithm is specified as finding the “least upper bound” of the second and third operand first and apply “capture conversion” afterwards. The first step already fails for the two types Class&lt;String&gt; and Class&lt;StringBuilder&gt; so the second step which would consider the context is not even attempted. This is not a satisfying situation, however, in this special case there is an elegant alternative: public static void main(String... arg) { CharSequence cs=foo(true? String::new: StringBuilder::new); } static &lt;T&gt; T foo(Supplier&lt;T&gt; s) { return s.get(); }
has comment: http://stackoverflow.com/comment/36762569
upvote count: 1
has comment: http://stackoverflow.com/comment/34292947
score: 1
has comment: http://stackoverflow.com/comment/34326678
answers question: http://stackoverflow.com/q/22509488
downvote count: 0

http://stackoverflow.com/comment/74586839
type: Comment
has text: Well, that's approximate size only.. What I am referring is accurate size.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22496883

http://stackoverflow.com/comment/34387934
comment on: http://stackoverflow.com/q/22587997
score: 0
has text: It would be very helpful if you shared the piece of code that shows the reference the agent is using to the controller.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34384251
type: Comment
type: AnswerComment
has text: Thanks man... I can vote you up because of my reputation :)
score: 0
comment on: http://stackoverflow.com/a/22585906

http://stackoverflow.com/q/22558633
tagged with: zooming
type: UnansweredQuestion
has body: I have a problem with zoom JPanel. I have a circle in the middle of panel when I click a message say: you clicked in the circle And if I don't click on the circle it will be: you're out of any circle The problem I tried zoom the panel but now when I click the message says you're out of panel (but I'm clicking in the zoomed circle) also the JScrollPane don't work I tried hard with it but it don't working. Please help. This is my code: import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Ellipse2D; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ public class ZoomProject extends javax.swing.JFrame { Ellipse2D DraggedCircle; Ellipse2D CircleDrawInPanel; public ZoomProject() { initComponents(); CircleDrawInPanel=new Ellipse2D.Float(jPanel1.getWidth()/2,jPanel1.getHeight()/2, 50, 50); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jSlider1 = new javax.swing.JSlider(); jScrollPane1 = new javax.swing.JScrollPane(); jPanel1 = new javax.swing.JPanel(){ protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); super.paintComponent(g); int w =getWidth(); // real width of canvas int h =getHeight(); // real height of canvas // Translate used to make sure scale is centered g2.translate(w/6, h/6); g2.scale((double)jSlider1.getValue(),(double)jSlider1.getValue()); g2.translate(-w/6, -h/6); g2.fillOval(w/2,h/2,50,50); } }; setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jSlider1.setOrientation(javax.swing.JSlider.VERTICAL); jSlider1.setValue(1); jSlider1.addChangeListener(new javax.swi…
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
tagged with: jpanel
tagged with: jscrollpane
has title: Use JScrollPane in JPanel and zoom a Graphics2D correctly
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/22681537
accepted answer of: http://stackoverflow.com/q/22507129
has body: List or other type of objects can post with RestTemplate's postForObject method. My solution is like below: controller: @RequestMapping(value="/getLocationInformations", method=RequestMethod.POST) @ResponseBody public LocationInfoObject getLocationInformations(@RequestBody RequestObject requestObject) { // code block } Create a request object for posting to service: public class RequestObject implements Serializable { public List&lt;Point&gt; pointList = null; } public class Point { public Float latitude = null; public Float longitude = null; } Create a response object to get values from service: public class ResponseObject implements Serializable { public Boolean success = false; public Integer statusCode = null; public String status = null; public LocationInfoObject locationInfo = null; } Post point list with request object and get response object from service: String apiUrl = "http://api.website.com/service/getLocationInformations"; RequestObject requestObject = new RequestObject(); // create pointList and add to requestObject requestObject.setPointList(pointList); RestTemplate restTemplate = new RestTemplate(); ResponseObject response = restTemplate.postForObject(apiUrl, requestObject, ResponseObject.class); // response.getSuccess(), response.getStatusCode(), response.getStatus(), response.getLocationInfo() can be used
type: Answer
answers question: http://stackoverflow.com/q/22507129
score: 7
upvote count: 7
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34357352
type: Comment
type: QuestionComment
has text: Uh, DO NOT run as root :/ This is bad practice and you make processes harder to isolate... Now you can only run `pstree -uplan|less` and spot processes which may be your misbehaving servers. But create a user for Tomcat to run!
comment on: http://stackoverflow.com/q/22570846
score: 0

http://stackoverflow.com/q/22564338
has answer: http://stackoverflow.com/a/22574876
type: AnsweredQuestion
type: Question
tagged with: ant
tagged with: java
accepted answer: http://stackoverflow.com/a/22574876
has title: Ant - replace/encode Strings
score: 0
answer count: 1
has body: I want an Ant Task to build my Java-Project and obfuscate that with ProGuard. I need a solution to encode hardcoded Strings like System.out.println("Hello"); String test = "Whats up"; System.out.println("Answer: " + test); ProGuard doesn't support any solution for Strings. My idea is to replace it automatically before obfuscating. Can I use Javassist for that? I have two solution-ideas: 1: After the JAR is created, i override Strings with Javasisst and add an Method like System.out.println(StringEncode.decode(1234)); String test = StringEncode.decode(633524236); System.out.println(StringEncode.decode(88302) + test); 2: Before the JAR is created im copy the source files and replace that over RegExpr. I need a quick start guide for a best practice. The Method StringEncode.decode(88302) is an example. This static method will encode integer values with an algorhytm to the original String. The same algorhytm will be used for encoding. I hope you can give me an idea.

http://stackoverflow.com/comment/34494786
type: Comment
has text: Well yes, but the OP seemed to want to to do it longhand. :)
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22647767

http://stackoverflow.com/a/22606368
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34421187
answers question: http://stackoverflow.com/q/22604874
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/113047124
accepted answer of: http://stackoverflow.com/q/22604874
has comment: http://stackoverflow.com/comment/99435967
has comment: http://stackoverflow.com/comment/34450389
has body: Installing a tooltip to image view is working. Try yourself with new sample JavaFX project and see it. When you doubt about some functionality of the used API (JavaFX in this case) try to isolate the doubted use case into new fresh environment/project and observe it closely. P.S. Why are you removing the targetCardBox from leftSide and adding it again afterwards.
upvote count: 7

http://stackoverflow.com/comment/34343480
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22563331
has text: Have a look at [Download a file using smartclient](http://forums.smartclient.com/showthread.php?t=11372).
score: 0

http://stackoverflow.com/q/22646235
accepted answer: http://stackoverflow.com/a/22646314
has title: Global method in Android App?
has body: I am very new to Android and I need my app to listen out for a specific key being pressed at all times. I have managed to get this working in each activity with the following code: @Override public boolean dispatchKeyEvent(KeyEvent e) { if (e.getKeyCode() == KeyEvent.KEYCODE_F) { Log.d("Test","YOU PRESSED THE F KEY"); startActivity(new Intent(getApplicationContext(), Activity2.class)); return true; } return super.dispatchKeyEvent(e); }; However, I am trying to figure out if I could just have this method once somewhere in the code? (Rather than have this piece of code in each individual activity)
answer count: 3
downvote count: 0
favorite count: 0
upvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/22646314
tagged with: android-studio
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22646301
tagged with: java
possible better answer: http://stackoverflow.com/a/22646298
has answer: http://stackoverflow.com/a/22646298
type: Question

http://stackoverflow.com/q/22515628
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34259351
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34258819
tagged with: loops
type: Question
tagged with: comparator
tagged with: for-loop
tagged with: indexof
has title: Removing for loop somehow? and changing the way my reading of difference is?
has comment: http://stackoverflow.com/comment/34259130
score: 0
has comment: http://stackoverflow.com/comment/34259639
has body: So to begin with I am basically playing the Price is right...With a public getWinner() to calculate if the guess was under the item price I have listed how I get it but my teacher does not like for loops so I am attempting to changed this and also fix my int difference variable so it does not look messy. @Override public Contestant getWinner() { int difference = 999999999; Contestant winner = null; for (Contestant person: allContestants){ int personDifference= anItem.getPrice() - person.getAmount(); if (personDifference &gt;= 0 &amp;&amp; personDifference &lt; difference){ winner= person; difference = personDifference; } } if (difference &lt; 0) { return null; } return winner; } For extra info I have this as my GuessOnItem class which extends my abstract public GuessOnItem (ItemOnDisplay inItem){ anItem= inItem; allContestants = new ArrayList&lt;Contestant&gt;(); } public GuessOnItem (ItemOnDisplay inItem, List&lt;Contestant&gt; contestantList){ anItem= inItem; allContestants= contestantList; } I have a contestant class that has the constructor that compares the byName already. Just cleaning it up is what I am struggling with. Thank for the help.

http://stackoverflow.com/a/22515242
has body: You are creating a single Dimension object outside your loop that you are assigning to all your MipMapData objects. Dimension mipMapDimension= new Dimension(); Remember that in Java objects are passed by reference. So when you pass in mipMapDimension to your MipMapData constructor, it is going to be referenced in all of them.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22514872
answers question: http://stackoverflow.com/q/22514872
score: 0

http://stackoverflow.com/comment/34247465
comment on: http://stackoverflow.com/a/22509027
type: Comment
has text: what does it mean? where can be problem ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34358756
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22571777
type: AnswerComment
has text: In fact it requires Ω(log n) extra space at the very least

http://stackoverflow.com/q/22510851
score: 1
tagged with: java
type: Question
upvote count: 2
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/22511134
accepted answer: http://stackoverflow.com/a/22511027
favorite count: 0
has title: chained exception facility in JAVA
tagged with: exception
has answer: http://stackoverflow.com/a/22511027
has comment: http://stackoverflow.com/comment/34250270
has body: I can acheive chained Exception facility in java as case 1: public static void main(String[] args) { try { method1(); } catch (Exception e) { System.out.println("Exception in the main method :: "+e); } } private static void method1() throws Exception { try{ System.out.println("Inside Try Block"+10/0); } catch(ArithmeticException e){ System.out.println("Exception in method1 :: "+e); throw e; } finally{ System.out.println("In FinallY Block"); } } case 2 : public static void main(String[] args) { try { method1(); } catch (Exception e) { System.out.println("Exception in the main method :: "+e); } } private static void method1() throws Exception { try{ System.out.println("Inside Try Block"+10/0); } catch(ArithmeticException e){ System.out.println("Exception in method1 :: "+e); throw (ArithmeticException)new ArithmeticException().initCause(e); } finally{ System.out.println("In FinallY Block"); } } And I got the output as Exception in method1 :: java.lang.ArithmeticException: / by zero In FinallY Block Exception in the main method :: java.lang.ArithmeticException: / by zero And My Question is : Is there any difference between these two cases ? Which is the better method ? And why 2 cases for the same purpose ?
possible better answer: http://stackoverflow.com/a/22511134
type: AnsweredQuestion

http://stackoverflow.com/comment/34340182
comment on: http://stackoverflow.com/a/22547779
type: AnswerComment
score: 0
type: Comment
has text: So I will have to create a Model Class that is extended by both Action Listeners and within it have: `List<String> routeStopList = new ArrayList<String>();`. Then I would need a method/constructor inside that Model Class through which Strings from the Action Listeners would be appended to the Array List.

http://stackoverflow.com/q/22537171
has answer: http://stackoverflow.com/a/22537501
accepted answer: http://stackoverflow.com/a/22537501
score: 0
has body: I have an existing project which is a single maven project. The SVN path be root/MySingleProject. Now I'd like to create a multi module project (parent), and add the existing as a module. Which steps do I have to perform so that svn history/commits are preserved? Can I just create a new folder in my svn and copypaste the existing project there? (and then of course create a parent and module pom). root/MyMultiModule/MySingleProject Would this still maintain the history when checked in?
answer count: 1
tagged with: maven
has title: Convert maven project to submodule of multi module project?
type: AnsweredQuestion
tagged with: svn
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/a/22588753
answers question: http://stackoverflow.com/q/22588112
score: 0
type: Answer
has body: Interesting task... I did notice that your code contains word.toLowerCase(); I think you want word = word.toLowerCase(); to normalize both text Strings for the comparison. You could use Pattern/Matcher to make your text changes (compiling the Pattern in the class rather than at runtime), or iterate over each substring character - duplicates are where the character at position x equals the one at x+1 - so you can tell where to remove a character.

http://stackoverflow.com/comment/34462772
has text: sory, i edited my question. because if i copy it, each time i update that jar inside the EAR, i must duplicate it to my WAR lib.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22629033

http://stackoverflow.com/comment/34393659
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22581984
type: Comment
has text: So the classpath specifies what JRE library the project will be using during execution? For example choosing JRE 5 in the classpath will enable to use enums, but choosing JRE 4 in the classpath will not, because the program will be using JRE 4 libraries during runtime?

http://stackoverflow.com/q/22558032
type: Question
answer count: 2
tagged with: start-activity
score: 0
has answer: http://stackoverflow.com/a/22558242
type: UnansweredQuestion
tagged with: android
has title: How to run startActivity from outside of the main activity
has body: I have a MainActivity class which has a NotificationsListener (seperate class). When a notification appears, it calls my gethtml class. They both extend Activity but the startActivity in my gethtml class doesn't work... (If I copy and test this code in my MainActivity, it works fine)... Anyone have an idea why it isn't working? This is the main class: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); IntentFilter filter = new IntentFilter(); filter.addAction("com.kpbird.nlsexample.NOTIFICATION_LISTENER_EXAMPLE"); startService(new Intent(MainActivity.this, NLService.class)); Intent intent=new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"); startActivity(intent); } @Override protected void onDestroy() { super.onDestroy(); } } This is the notification listener: public class NLService extends NotificationListenerService { @Override public void onCreate() { super.onCreate(); IntentFilter filter = new IntentFilter(); filter.addAction("com.kpbird.nlsexample.NOTIFICATION_LISTENER_SERVICE_EXAMPLE"); } @Override public void onDestroy() { super.onDestroy(); } @Override public void onNotificationPosted(StatusBarNotification sbn) { new Thread(new Runnable() { public void run(){ Looper.prepare(); int cangethtml = 1; try{ if(cangethtml==1){ cangethtml = 0; //only runs once new html(); } }finally{Looper.loop();} }; }).start(); } @Override public void onNotificationRemoved(StatusBarNotification sbn) {} } This is the final class which doesn't open the website through the startActivity: public class html extends Activity{ public html() { try { Intent i2 = new Intent("android.intent.action.MAIN"); i2.setComponent(ComponentName.unflattenFromString("com.android.chrome/com.android.chrome.Main")); i2.addCategory("android.intent.category.LAUNCHER"); i2.setData(Uri.parse("https://wwww.google.com")); startActivity(i2); } finally{} } }
has comment: http://stackoverflow.com/comment/34355426
tagged with: java
has answer: http://stackoverflow.com/a/22558056
has comment: http://stackoverflow.com/comment/34333470

http://stackoverflow.com/q/22588251
has answer: http://stackoverflow.com/a/22588334
accepted answer: http://stackoverflow.com/a/22588334
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22592901
has title: JPanel Exact drawing size/Limit?
tagged with: paintcomponent
possible better answer: http://stackoverflow.com/a/22588317
has body: When drawing on my extended JPanel I want the size to be variable. I've worked out the code to always outline a 1 pixel margin. My code works but I don't understand why I must adjust the height and width and height of the dimension by -1 when drawing the rectangle. If I draw a rectangle that has 1,1 as a size it draws a single pixel square so shouldn't drawing the width and the height work without the -1 modifier. If any one can explain why there is a discrepancy between the size of my extended JPanel or explain a better way to get the exact dimensions of the drawing area I would appreciate it. public class Engine extends JPanel { Engine(){ } @Override public void paintComponent(Graphics g){ Dimension a = this.getSize(); g.setColor(Color.RED); g.drawRect(0, 0, a.width-1, a.height-1); } }
tagged with: swing
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/22588317

http://stackoverflow.com/a/66762803
upvote count: 3
type: Answer
downvote count: 0
score: 3
has body: Copy from one sheet to another public static void copyFromSourceToDestinationRow(XSSFWorkbook workbook, XSSFSheet sourceWorksheet, int sourceRowNum, XSSFSheet destinationWorksheet, int destinationRowNum) { // Get the source / new row XSSFRow sourceRow = sourceWorksheet.getRow(sourceRowNum); XSSFRow newRow = destinationWorksheet.createRow(destinationRowNum); // Loop through source columns to add to new row for (int i = 0; i < sourceRow.getLastCellNum(); i++) { // Grab a copy of the old/new cell XSSFCell oldCell = sourceRow.getCell(i); XSSFCell newCell = newRow.createCell(i); // If the old cell is null jump to next cell if (oldCell == null) { continue; } // Copy style from old cell and apply to new cell XSSFCellStyle newCellStyle = workbook.createCellStyle(); newCellStyle.cloneStyleFrom(oldCell.getCellStyle()); newCell.setCellStyle(newCellStyle); // If there is a cell comment, copy if (oldCell.getCellComment() != null) { newCell.setCellComment(oldCell.getCellComment()); } // If there is a cell hyperlink, copy if (oldCell.getHyperlink() != null) { newCell.setHyperlink(oldCell.getHyperlink()); } // Set the cell data type newCell.setCellType(oldCell.getCellTypeEnum()); // Set the cell data value switch (oldCell.getCellTypeEnum()) { case BLANK:// Cell.CELL_TYPE_BLANK: newCell.setCellValue(oldCell.getStringCellValue()); break; case BOOLEAN: newCell.setCellValue(oldCell.getBooleanCellValue()); break; case FORMULA: newCell.setCellFormula(oldCell.getCellFormula()); break; case NUMERIC: newCell.setCellValue(oldCell.getNumericCellValue()); break; case STRING: newCell.setCellValue(oldCell.getRichStringCellValue()); break; default: break; } } // If there are are any merged regions in the source row, copy to new row for (int i = 0; i < sourceWorksheet.getNumMergedRegions(); i++) { CellRangeAddress cellRangeAddress = sourceWorksheet.getMergedRegion(i); if (cellRangeAddress.getFirstRow() == sourceRow.getRowNum()) { CellRangeAddress newCellRangeAddress = new CellRangeAddress(newRow.g…
answers question: http://stackoverflow.com/q/22627691

mysql
tags question: http://stackoverflow.com/q/22612347
tags question: http://stackoverflow.com/q/22498645
tags question: http://stackoverflow.com/q/22557202
tags question: http://stackoverflow.com/q/22626980
tags question: http://stackoverflow.com/q/22575297
tags question: http://stackoverflow.com/q/22640246
tags question: http://stackoverflow.com/q/22559638
tags question: http://stackoverflow.com/q/22601269
tags question: http://stackoverflow.com/q/22570580
tags question: http://stackoverflow.com/q/22508089
tag name: mysql
tags question: http://stackoverflow.com/q/22555183
tags question: http://stackoverflow.com/q/22598172
tags question: http://stackoverflow.com/q/22581981
tags question: http://stackoverflow.com/q/22569027
tags question: http://stackoverflow.com/q/22531529
tags question: http://stackoverflow.com/q/22547678
tags question: http://stackoverflow.com/q/22549634
tags question: http://stackoverflow.com/q/22493562
tags question: http://stackoverflow.com/q/22503407
tags question: http://stackoverflow.com/q/22502006
tags question: http://stackoverflow.com/q/22494882
tags question: http://stackoverflow.com/q/22522255
tags question: http://stackoverflow.com/q/22551532
tags question: http://stackoverflow.com/q/22510098
tags question: http://stackoverflow.com/q/22647512
tags question: http://stackoverflow.com/q/22591958
tags question: http://stackoverflow.com/q/22604952
tags question: http://stackoverflow.com/q/22545125
tags question: http://stackoverflow.com/q/22492584
tags question: http://stackoverflow.com/q/22496903
tags question: http://stackoverflow.com/q/22520676
tags question: http://stackoverflow.com/q/22581571
tags question: http://stackoverflow.com/q/22551019
tags question: http://stackoverflow.com/q/22549433
tags question: http://stackoverflow.com/q/22501035
tags question: http://stackoverflow.com/q/22612364
tags question: http://stackoverflow.com/q/22554693
tags question: http://stackoverflow.com/q/22501919
tags question: http://stackoverflow.com/q/22508922
tags question: http://stackoverflow.com/q/22618161
tags question: http://stackoverflow.com/q/22502954
tags question: http://stackoverflow.com/q/22494483
tags question: http://stackoverflow.com/q/22599014
tags question: http://stackoverflow.com/q/22512772
tags question: http://stackoverflow.com/q/22596499
tags question: http://stackoverflow.com/q/22543614
tags question: http://stackoverflow.com/q/22537278
tags question: http://stackoverflow.com/q/22558272
tags question: http://stackoverflow.com/q/22521731
tags question: http://stackoverflow.com/q/22503786
tags question: http://stackoverflow.com/q/22573054
tags question: http://stackoverflow.com/q/22605958
tags question: http://stackoverflow.com/q/22517972
tags question: http://stackoverflow.com/q/22522964
tags question: http://stackoverflow.com/q/22625681
tags question: http://stackoverflow.com/q/22540135
tags question: http://stackoverflow.com/q/22627327
tags question: http://stackoverflow.com/q/22627515
tags question: http://stackoverflow.com/q/22522340
tags question: http://stackoverflow.com/q/22643281
type: Tag
tags question: http://stackoverflow.com/q/22622085
tags question: http://stackoverflow.com/q/22564326
tags question: http://stackoverflow.com/q/22595761
tags question: http://stackoverflow.com/q/22576447
tags question: http://stackoverflow.com/q/22603935
tags question: http://stackoverflow.com/q/22586273
tags question: http://stackoverflow.com/q/22624971
tags question: http://stackoverflow.com/q/22496268
tags question: http://stackoverflow.com/q/22513427
tags question: http://stackoverflow.com/q/22617653
tags question: http://stackoverflow.com/q/22607704
tags question: http://stackoverflow.com/q/22634535
tags question: http://stackoverflow.com/q/22581349
tags question: http://stackoverflow.com/q/22625783
tags question: http://stackoverflow.com/q/22524128
tags question: http://stackoverflow.com/q/22595561
tags question: http://stackoverflow.com/q/22493056
tags question: http://stackoverflow.com/q/22616764

http://stackoverflow.com/q/22619058
downvote count: 1
has answer: http://stackoverflow.com/a/22619214
accepted answer: http://stackoverflow.com/a/22619214
favorite count: 0
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/22619116
answer count: 4
has comment: http://stackoverflow.com/comment/34443685
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22619129
tagged with: addition
has title: Update value in Java ArrayList
has comment: http://stackoverflow.com/comment/34443542
type: Question
has body: I wasn't too sure what to title this question, apologies in advance. I currently have a value of say 50 stored in the BidderArray. I want to be able to increase that 50 by any given number entered into a text field. So say I want to add 10 to the existing 50, it will return 60. Currently when I add the 10 the 50 is replaced by 10 instead of adding the two together. I understand why my code is doing this but haven't been able to find any tutorials or hints on what I should be doing instead. Here is the code: package abc; import java.awt.*; public class Funds extends javax.swing.JFrame { int i = 0; Bidder bidbal = new Bidder(); /** Creates new form Funds */ public Funds() { initComponents(); } private void addActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: int f = 0; boolean validEntries = true; try{ f = Integer.parseInt(amount.getText()); Bidder.BidderArray.get(i).setRegFee(f); } catch (Exception error) { validEntries = false; amount.setBackground(Color.red); } if (validEntries) { Bidder.exportBidder(); Home home = new Home(); home.setVisible(true); this.dispose(); } } }
has comment: http://stackoverflow.com/comment/34443653
has answer: http://stackoverflow.com/a/22619160
tagged with: java
has answer: http://stackoverflow.com/a/22619116
score: 0
upvote count: 1

http://stackoverflow.com/q/22490625
downvote count: 0
has comment: http://stackoverflow.com/comment/34856395
has body: On a particular server (Windows 2012 server R2) I am having trouble creating a temp file. I get the following error everytime I try. java.io.IOException: The system cannot find the path specified at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createTempFile(Unknown Source) etc.. The error happens everytime the following code is ran: InputStream inputStream = portalBean.createPDF( sessionID, foCode ); Things I have tried Changed the java.io.tmpdir variable on the fly. System.setProperty("java.io.tmpdir", "C:\\"); Added -Djava.io.tmpdir=c:\\temp to the webnetwork lax file to an unrestricted location. I tried setting the webNetwork service to run as a specified user with rights to temp files e.g. the Administrator. Made sure I have free disk space and I cleaned out the c:\windows\temp folder. Made sure the tmp environment variables were set to their default values. I also tried running the service from a command prompt which was opened with the Run As Administrator option. And the IOException lingers still. I have another server running the same code without issue (Windows Server 2012). Does anyone else have any Ideas of what else I can try to resolve this issue? And or any tips on how I can debug the issue more thoroughly to get a grasp of what is going on?
has comment: http://stackoverflow.com/comment/34216086
has answer: http://stackoverflow.com/a/22490798
favorite count: 0
has comment: http://stackoverflow.com/comment/34218334
tagged with: file-io
type: UnansweredQuestion
tagged with: io
has title: java.io.IOException: The system cannot find the path specified
has comment: http://stackoverflow.com/comment/34216466
upvote count: 3
tagged with: file
has answer: http://stackoverflow.com/a/22490802
has comment: http://stackoverflow.com/comment/34216489
type: Question
score: 3
has comment: http://stackoverflow.com/comment/34217462
tagged with: java
tagged with: inputstream
has comment: http://stackoverflow.com/comment/34216165
has comment: http://stackoverflow.com/comment/34216141
has comment: http://stackoverflow.com/comment/34216686
answer count: 2

http://stackoverflow.com/comment/34255475
type: AnswerComment
has text: just did that with no affect on the print output.
comment on: http://stackoverflow.com/a/22511698
score: 0
type: Comment

http://stackoverflow.com/comment/34291484
type: Comment
type: QuestionComment
has text: data is null.Check the below answers.
score: 1
comment on: http://stackoverflow.com/q/22533879

http://stackoverflow.com/q/22568780
has title: How to view internet-passwords from Keychain using Java (mac)
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34353352
accepted answer: http://stackoverflow.com/a/23934917
type: Question
tagged with: passwords
has comment: http://stackoverflow.com/comment/34353748
has comment: http://stackoverflow.com/comment/34352953
score: 0
has comment: http://stackoverflow.com/comment/34354048
has body: I would like to create a simple java app (for mac) that takes in a website and outputs my password associated with the website in Keychain. My problem is that my app can't read the password from the output. If I manually write: security find-internet-password -gs www.google.com into the Terminal I get a few lines of info and then -> password: "mypassword". But in my application I only see the lines of info but the last line which should be the password is not there or null. My code: public static void command(){ try{ String command = "security find-internet-password -gs www.google.com"; Process child = Runtime.getRuntime().exec(command); BufferedReader r = new BufferedReader(new InputStreamReader(child.getInputStream())); String s; while ((s = r.readLine()) != null) { System.out.println(s); } System.out.println(r.readLine()); r.close(); } catch (IOException e) { e.printStackTrace(); } } I'm not getting any errors but simply the code above is not showing the password. I'm using Eclipse if that matters. Thanks The application prints: keychain: "/Users/*username*/Library/Keychains/login.keychain" class: "inet" attributes: 0x00000007 &lt;blob&gt;="www.google.com" 0x00000008 &lt;blob&gt;=&lt;NULL&gt; "acct"&lt;blob&gt;="*username*" "atyp"&lt;blob&gt;="http" "cdat"&lt;timedate&gt;=0x323031*numbers*3333325A00 "2011*numbers*132Z\000" "crtr"&lt;uint32&gt;="rimZ" "cusi"&lt;sint32&gt;=&lt;NULL&gt; "desc"&lt;blob&gt;=&lt;NULL&gt; "icmt"&lt;blob&gt;=&lt;NULL&gt; "invi"&lt;sint32&gt;=&lt;NULL&gt; "mdat"&lt;timedate&gt;=0x3230331*numbers*33834375A00 "20115*numbers*3847Z\000" "nega"&lt;sint32&gt;=&lt;NULL&gt; "path"&lt;blob&gt;="/" "port"&lt;uint32&gt;=0x00000000 "prot"&lt;blob&gt;=&lt;NULL&gt; "ptcl"&lt;uint32&gt;="htps" "scrp"&lt;sint32&gt;=&lt;NULL&gt; "sdmn"&lt;blob&gt;="www.google.com" "srvr"&lt;blob&gt;="www.google.com" "type"&lt;uint32&gt;=&lt;NULL&gt; but the last line is missing and should be password: "mypassword" Edited Is it the InputStreamReader that does not read the …
answer count: 1
tagged with: inputstreamreader
has answer: http://stackoverflow.com/a/23934917
tagged with: terminal
tagged with: keychain

http://stackoverflow.com/a/22512656
has body: @Autowired is a Spring annotation that is not standardized. The corresponding standard annotation is @Inject from javax.inject Aside from Spring, Google Guice supports also javax.inject Another extremely lightweight framework for dependency injection (that does not support javax.inject) is PicoContainer
upvote count: 2
answers question: http://stackoverflow.com/q/22510600
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/22518184
has comment: http://stackoverflow.com/comment/34342529
has comment: http://stackoverflow.com/comment/34885861
tagged with: httpclient
has comment: http://stackoverflow.com/comment/34265378
favorite count: 0
type: UnansweredQuestion
has body: I've still yet to solve this. This is a work in progress. I'm actively learning, and im posting my progress as i go. I'm sorry this thing is so obnoxiously long, its mostly errorlogs. Edit:4/4/14: I was tinkering around a bit with chrome and i noticed a cool option "preserve logs" while in "inspect element". This was cool because it allowed me to see a hidden post to the server. The post didnt help me much though, there must be something else going on behind the scenes im not seeing. the post i did looked something like this: HttpPost post = new HttpPost( "https://ssb.sunydutchess.edu/pls/prod/bwskfshd.P_CrseSchdDetl"); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("term_in:","201401")); post.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse postResponse=client.execute(post,context); and im posting AFTER i log into my school. I still get an error, but its a DIFFERENT error, which is usually good. this is my error: javax.net.ssl.SSLException: Server selected improper ciphersuite SSL_RSA_WITH_DES_CBC_SHA at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.ClientHandshaker.serverHello(Unknown Source) at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) at sun.security.ssl.Handshaker.processLoop(Unknown Source) at sun.security.ssl.Handshaker.process_record(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:533) at org.apache.http.conn.ssl.SSLSocketFactory.connectS…
has comment: http://stackoverflow.com/comment/34314185
has comment: http://stackoverflow.com/comment/34342973
has comment: http://stackoverflow.com/comment/34265143
score: 2
downvote count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/34265406
tagged with: https
type: Question
has comment: http://stackoverflow.com/comment/34265440
tagged with: java
tagged with: ssl
has title: SSL peer not authenticated
upvote count: 2
has comment: http://stackoverflow.com/comment/34266722

http://stackoverflow.com/q/22611540
answer count: 0
upvote count: 2
tagged with: java
type: Question
tagged with: weka
has body: I'm using the KernelEstimator class (KernelEstimator.java) from the Weka library. I want to find the max value in my density function, that is, the value with the highest density. I have been looking at the mean-shift algorithm (Mean-shift wiki) but I don't know how to implement it with the methods I have available from the KernelEstimator class. Specifically: How can I implement the mean-shift algorithm in Java (or other algorithms that find the max value), preferable using what I have available from the KernelEstimator class? If there are better libraries that can solve my problem other than the Weka library, please let me know. Thanks.
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Finding The Max Value from Density Function (Kernel Estimator) in Java
score: 2

http://stackoverflow.com/comment/34249903
score: 0
comment on: http://stackoverflow.com/q/22509890
type: Comment
type: QuestionComment
has text: I would do something like: if (String.IsNullOrWhiteSpace(inString)) throw new ArgumentNullException("inString");

http://stackoverflow.com/a/22542808
has comment: http://stackoverflow.com/comment/34308093
has body: Just don't start service manually. When you bind it from activities it starts and shuts down automatically.
answers question: http://stackoverflow.com/q/22542642
has comment: http://stackoverflow.com/comment/34310990
has comment: http://stackoverflow.com/comment/34308280
score: 0
has comment: http://stackoverflow.com/comment/34311130
has comment: http://stackoverflow.com/comment/34307995
type: Answer

http://stackoverflow.com/q/22513660
tagged with: weblogic11g
has answer: http://stackoverflow.com/a/33896654
has comment: http://stackoverflow.com/comment/34258016
favorite count: 0
has answer: http://stackoverflow.com/a/22683851
answer count: 4
downvote count: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/69159081
has answer: http://stackoverflow.com/a/26121237
type: Question
score: 3
has title: JRE 8 compatibility with weblogic 10.3.6 (11g
has body: Could you please help in finding out if JRE 8 would be compatible with weblogic 10.3? We have a swing based application deployed on weblogic 10.3 server. We want to upgrade our JRE so wanted to check if JRE 8 would be able to run apps deployed on weblogic 10.3
upvote count: 3

http://stackoverflow.com/q/22515275
tagged with: java
has body: In the broadleaf demo site, after ordering I have seen.. A confirmation email has been sent to xyz@abc.com But the email doesn't seem to go because it wasn't configured. I tried making these changes to my applicationContext-email.xml file. <?xml version="1.0" encoding="UTF-8"?> smtp.mandrillapp.com 900 smtp xyz@abc.com mypassword true 25000 true <constructor-arg ref="blEmailTemplateEngine"/> <constructor-arg ref="blMailSender"/> <constructor-arg ref="blMailSender"/> support@mycompany.com 2 false I have also seen a class called SendOrderConfirmationEmailActivity class. This class seems to send the email. This is listed in the activities in applicationContext-workflow.xml but I am getting the following exception. [ERROR] 00:07:19 ContextLoader - Context initialization failed [artifact:mvn] org.springframework.beans.FatalBeanException: Unable to merge source and patch locations; nested exception is org.broadleafcommerce.common.extensibility.context.merge.exceptions.MergeException: java.lang.NullPointerException [artifact:mvn] at org.broadleafcommerce.common.extensibility.context.MergeApplicationContextXmlConfigResource.getConfigResources(MergeApplicationContextXmlConfigResource.java:86) [artifact:mvn] at org.broadleafcommerce.common.web.extensibility.MergeXmlWebApplicationContext.loadBeanDefinitions(MergeXmlWebApplicationContext.java:130) [artifact:mvn] at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) Could you tell me the way of how to send order confirmation email? I am using Broadleaf commerce demo 3.1.0-GA version.
score: 0
has answer: http://stackoverflow.com/a/22803418
answer count: 1
has title: Context Initialization Failed - Broadleaf Commerce - Send Order Confirmation Email
tagged with: email
tagged with: spring
type: UnansweredQuestion
tagged with: broadleaf-commerce
type: Question

http://stackoverflow.com/a/22909525
type: Answer
answers question: http://stackoverflow.com/q/22578870
accepted answer of: http://stackoverflow.com/q/22578870
score: 0
has body: Well since nobody helped here., I tried stopping those iterations after a specific time.(say 2000 times) Now, when I checked the program, it got trained for some extent.. And I continued my work with those...
type: AcceptedAnswer

http://stackoverflow.com/a/22630843
score: 1
upvote count: 1
has body: Every variable is passed by value. In the instance of primatives, we have the naive case - the values are passed into the function. In the instance of Objects, we have a slightly more complicated although analogous paradigm - the references to the objects are passed by value. Note the subtle differences: //This is essentially a no-op. The values are only local to the function void swap(int a, int b){ int temp = a; a = b; b = temp; } //This is different. The references to a and b are passed by value so the values of a.x and b.x are actually swapped on return. void swap(Point a, Point b){ int temp = a.x; a.x = b.x; b.x = temp; }
type: Answer
answers question: http://stackoverflow.com/q/22630649
downvote count: 0

http://stackoverflow.com/a/22525382
type: Answer
has body: First you didn't use your class that draw the image (DrawImage) in this line JPanel pane = new JPanel(); so you must change it to DrawImage pane = new DrawImage(); second issue you didn't invoke getFile() method to initialize image object so either use as I mentioned below or invoke this method as your write in class drawImage constructor. public class DrawImage extends JPanel{ BufferedImage image; public Image getFile() { try { image = ImageIO.read(new File("grass.png")); return image; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } protected void paintComponent(Graphics g) { super.paintComponent(g); System.out.println(image); g.drawImage(getFile(), 0, 100, null); } public static void main(String[] args) { DrawImage pane = new DrawImage(); JFrame frame = new JFrame(); frame.add(pane); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setSize(400, 400); frame.setVisible(true); } }
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34276703
answers question: http://stackoverflow.com/q/22525002
downvote count: 0

http://stackoverflow.com/comment/112752553
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22591627
type: AnswerComment
has text: In my opinion, using "Impl" as suffix for the implementation is really a horrible idea as @SeanPatrickFloyd said. Because, when you add "Impl" you do not have a clear purpose why you are using this class. When the purpose is clear, the naming will be available easier.

keystroke
type: Tag
tags question: http://stackoverflow.com/q/22507505
tag name: keystroke

freemarker
tags question: http://stackoverflow.com/q/22599980
type: Tag
tag name: freemarker

http://stackoverflow.com/comment/34439632
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22616932
has text: The question says "any ideas". It doesn't say "I have to use a do-while" loop. I answered the question.
score: 0

http://stackoverflow.com/q/22520801
score: 7
tagged with: java
possible better answer: http://stackoverflow.com/a/22520840
upvote count: 7
accepted answer: http://stackoverflow.com/a/22520811
has comment: http://stackoverflow.com/comment/34268509
has answer: http://stackoverflow.com/a/22520840
type: Question
has title: What is returning class when use "return this"?
has comment: http://stackoverflow.com/comment/34269136
has comment: http://stackoverflow.com/comment/34268596
has comment: http://stackoverflow.com/comment/34268507
has comment: http://stackoverflow.com/comment/34269401
downvote count: 0
favorite count: 0
has body: I started learning Java and I couldn't understand one of examples in "Thinking in Java" book. In this example author represent, as he state "simple use of 'this' keyword": //Leaf.java //simple use of the "this" keyword public class Leaf { int i = 0; Leaf increment() { i++; return this; } void print() { System.out.println("i = " + i); } public static void main(String[] args) { Leaf x = new Leaf(); x.increment().increment().increment().print(); } } And when above code is working as indeed, I cant understand what increment() method is returning. It's not variable i, it's not object x? I just don't get it. I tried to modify program to understand it (like replace return this with return i or print x instead of i), but compiler shows me errors.
has answer: http://stackoverflow.com/a/22520811
has answer: http://stackoverflow.com/a/22520893
has answer: http://stackoverflow.com/a/22520876
answer count: 4
has comment: http://stackoverflow.com/comment/34268477
type: AnsweredQuestion

http://stackoverflow.com/comment/34234802
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22501090
has text: I meant the array that you want to print its values, and yes like: `Arrays.toString(promos);` with out `[]`.
score: 0

http://stackoverflow.com/comment/34223941
type: QuestionComment
comment on: http://stackoverflow.com/q/22495151
score: 0
has text: Can you use a [ProcessBuilder](http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html)? That makes escaping the commandline a lot less tedious (e.g. `"E:\\DA_Laptrinhmang NguyenTo"`)
type: Comment

http://stackoverflow.com/comment/34395750
score: 0
type: AnswerComment
type: Comment
has text: Thanks. Why Spring jars should I put my project's build path?
comment on: http://stackoverflow.com/a/22592571

http://stackoverflow.com/comment/34496469
type: AnswerComment
score: 0
type: Comment
has text: @user1757913 Glad we got there in the end. That will teach me for posting from my iPad, with my left hand, first thing in the morning :P
comment on: http://stackoverflow.com/a/22645343

http://stackoverflow.com/comment/34361514
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22573189
has text: My main method is mostly calls to other methods. Here it is:
score: 0

http://stackoverflow.com/q/22537532
has comment: http://stackoverflow.com/comment/34298030
has body: I have a CipherInputStream created from an InputStream and Cipher passed to its constructor. I want to know the size of that stream, is there any way of doing the same? will available() give me the result what I expect? I know answers like read the stream to determine same and such inefficient ones easily available on internet, but I want an efficient way of doing the same. I already asked one question here for the same issue but there I did not mention exact class of the stream. also I tried searching on the internet but could not find any proper answer.
has comment: http://stackoverflow.com/comment/34297974
type: Question
has answer: http://stackoverflow.com/a/22537627
has title: Will available() on CipherInputStream give full size of stream always?
linked to: http://stackoverflow.com/q/22508428
score: 0
tagged with: encryption
answer count: 1
has comment: http://stackoverflow.com/comment/34298000
tagged with: java
type: UnansweredQuestion
tagged with: inputstream
linked to: http://stackoverflow.com/q/3283787

http://stackoverflow.com/comment/34443483
score: 0
has text: Are you wanting the line number, word number, paragraph number, or anything else specific about the location of the word?
comment on: http://stackoverflow.com/q/22618980
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34449477
score: 1
type: Comment
has text: The variable is clearly "accessible" since you're able to assign to it. Is the problem that you're not reading the variable anywhere, so they compiler is warning you that although you're writing to it you're not subsequently "using" it anywhere?
type: QuestionComment
comment on: http://stackoverflow.com/q/22622238

http://stackoverflow.com/comment/34243023
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22506791
has text: `for(int j=0; i < stringArr.length; j++){` this also needs to be `j <`. If you didn't have this exception, you'd have an infinite loop
type: Comment

http://stackoverflow.com/comment/34286621
type: AnswerComment
comment on: http://stackoverflow.com/a/22530171
score: 0
type: Comment
has text: `Collections.synchroinzedMap(map)` is a shortcut for `synchronized(map){}`. They act the same.

http://stackoverflow.com/a/22611580
has comment: http://stackoverflow.com/comment/34430747
answers question: http://stackoverflow.com/q/22611541
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The AM/PM marker may not match that of your default Locale Try SimpleDateFormat format = new SimpleDateFormat("hh:mm a", Locale.ENGLISH);
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22611541
has comment: http://stackoverflow.com/comment/34429718

http://stackoverflow.com/comment/34445429
has text: Do we have any reason to assume the serial garbage collector is in use? On by default on single processor systems, but how common are those nowadays?
type: AnswerComment
comment on: http://stackoverflow.com/a/22615515
score: 0
type: Comment

http://stackoverflow.com/comment/34538231
has text: I'm sure, that the render and tick methods run 60 times a second. Checked.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22517375
type: Comment

http://stackoverflow.com/comment/79839412
score: 3
type: AnswerComment
has text: I would like to underline that using `http://www.w3.org/2001/XMLSchema` works with http **but not with https**
type: Comment
comment on: http://stackoverflow.com/a/22530038

http://stackoverflow.com/comment/34377936
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22582495
has text: Glad to know you've got it working. I'd just struggled with a similar issue earlier today whence my eagerness to answer. I'll add some detail to my answer for posterity.

http://stackoverflow.com/comment/34457457
type: QuestionComment
score: 0
has text: Hmm.that could make more sense.
comment on: http://stackoverflow.com/q/22626713
type: Comment

http://stackoverflow.com/comment/34428180
has text: @shylu well your response is not a `JSONObject` its a `String`. Check your server side code and make sure its a `JSONObject` that is returned. That will fix the problem
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22607575
score: 0

javabeans
tags question: http://stackoverflow.com/q/22490744
type: Tag
tags question: http://stackoverflow.com/q/22646552
tags question: http://stackoverflow.com/q/22581216
tag name: javabeans
tags question: http://stackoverflow.com/q/22502533

http://stackoverflow.com/q/22524858
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/22525672
favorite count: 0
tagged with: date-format
tagged with: android
tagged with: datetime
has body: I'm having a problem in parsing a date. I'm new on android and try to search for the solution but it seems no luck. I'd already tried to follow this one http://developer.android.com/reference/java/text/SimpleDateFormat.html but still got an error. please help me.. I try to parse this date 2014-03-18T02:07:35.742-0400 and try to format to this 03/18/2014 02:07 I got this error: java.lang.IllegalArgumentException at java.text.DateFormat.format(DateFormat.java:361) at java.text.Format.format(Format.java:93)
score: -1
has answer: http://stackoverflow.com/a/22525036
has title: Parse and format Date in Android
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34275622
possible better answer: http://stackoverflow.com/a/22525024
tagged with: simpledateformat
tagged with: java
has answer: http://stackoverflow.com/a/22525024
accepted answer: http://stackoverflow.com/a/22525036
type: Question

http://stackoverflow.com/comment/34394152
comment on: http://stackoverflow.com/q/22591483
score: 1
has text: See explanation in answer and http://www.w3.org/TR/xpath/#booleans.
type: Comment
type: QuestionComment

android-optionsmenu
tags question: http://stackoverflow.com/q/22545188
tag name: android-optionsmenu
type: Tag

http://stackoverflow.com/comment/34396596
score: 0
type: AnswerComment
has text: Hi, sorry for the late reply, I have edited the post and I believe that is one of the lines giving the null pointer.
type: Comment
comment on: http://stackoverflow.com/a/22592491

http://stackoverflow.com/comment/34278705
comment on: http://stackoverflow.com/a/22526847
score: 0
type: AnswerComment
type: Comment
has text: sn1 and sn2 are not identical, they are equal. :-)

http://stackoverflow.com/q/22547136
has comment: http://stackoverflow.com/comment/36224299
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/36309329
answer count: 1
downvote count: 0
favorite count: 0
has title: KahaDB db.data and ActiveMQ 5.6
score: 4
tagged with: activemq-classic
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23643803
has body: I am looking for answers for the following questions related to KahaDB. I have an app that uses ActiveMQ and the app receives about 500,000 to 1 million messages which are written to an ActiveMQ queue with consumers picking them up. I observed that the db.data file size varies anywhere between a few KB to almost 600 or 700 MB. I noticed that when the db.data file size grows, messages get stuck, forcing me to shutdown my app, restart the app to have new consumers connecting to the broker to drain all messages. Ideally what should be the size of db.data? If an app produces and consumes at the same time, irrespective of the number of messages, I think the size of db.data should be small. Why sometimes the file size grows and what triggers the file size of db.data to grow? I have ActiveMQ 5.6 and I see this issue at least 2 or 3 times a month. In the brokers that are running smooth, I observed that the file size of db.data is in KB and not 500 MB or 700 MB. Here is the sample activemq.xml file: <?xml version="1.0" encoding="UTF-8"?> file:${activemq.conf}/credentials.properties " producerFlowControl="true" memoryLimit="1mb"> <pendingSubscriberPolicy> <vmCursor /> </pendingSubscriberPolicy> " producerFlowControl="true" memoryLimit="1mb" useCache="false" /> <kahaDB directory="/foo/activemq_5.6/data/kahadb" /> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" /> <import resource="jetty.xml" />
tagged with: java

http://stackoverflow.com/a/38270435
has body: You can use @JsonBackReference/@JsonManagedReference and add this method to child @JsonProperty public Long getParentId() { return parent == null ? null : parent.getId(); } Result will be: { "id": 1, "name": "child1", "parentId": 1 } I hope this helps someone.
has comment: http://stackoverflow.com/comment/86643704
score: 3
answers question: http://stackoverflow.com/q/22615317
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/a/22606885
upvote count: 1
answers question: http://stackoverflow.com/q/22606572
has body: try this JSONObject jObject = new JSONObject(responceData); JSONObject categoryObject = jObject.getJSONObject("categories"); JSONObject obj0 = categoryObject.getJSONObject("0"); String termId0 obj0.getString("term_id"); String name0 obj0.getString("name"); JSONObject obj1 = categoryObject.getJSONObject("1"); String termId1 obj1.getString("term_id"); String name1 obj1.getString("name"); but i agree with wqrahd, categories should be an array
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34421118

http://stackoverflow.com/q/22641221
tagged with: sql
tagged with: jpa
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: Problem description Hello, I've been using OpenJPA 2.1.2 (JPA 2.0) to retrieve data from a table called LOGISCHRAPPORTwhich has about 28 columns. In some cases OpenJPA decides to issue seperate select statements for one of the columns for no particular reason, leading to a dramatic decrease in query performance. Everything is fine until... Initially everything goes fine and all my columns are retrieved in a performant, single SELECT statement by JPA. As soon as I add a relationship to another entity called RAPTAALMETADATA @OneToMany(fetch=FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumns({ @JoinColumn(name = "RAPPORTNR", referencedColumnName = "RAPPORTNR"), @JoinColumn(name = "RAPPORTTYPE", referencedColumnName = "RAPPORTTYPE") }) private List&lt;Raptaalmetadata&gt; raptaalmetadata; --- Queried using Criteria API as follows: --- Join&lt;LogischRapport, Raptaalmetadata&gt; metadata = reportRoot.join( "raptaalmetadata"); JPA no longer includes one of my original columns called REPORT_COMMENTS instead it is issuing separate select statements to retrieve the REPORT_COMMENTS column for each instance of LOGISCHRAPPORT. All other columns (including the ones coming from RAPTAALMETADATA are retrieved properly as part of the intial SELECT. REPORT_COMMENTS is of the HUGEBLOB type in Oracle and I've mapped in in my Entity as follows: @Lob @Basic @Column(name = "REPORT_COMMENTS") private byte[] reportComments; I now get tons of these: SELECT t0.REPORT_COMMENTS FROM dwhsd001.LogischRapport t0 WHERE t0.rapportnr = ? AND t0.rapporttype = ? [params=(long) 1473, (String) RAP] Can anyone point out why I might be seeing this behavior and how I can avoid it? Its not a LAZY loading problem as I've specifically tested that case. I don't see any other reason why OpenJPA decides to retrieve this one column using separate statements. Update 1 Interesting addition: as soon as I remove the fetch=FetchType.EAGER attribute from the @OneToMany annotation described above I start seeing the …
tagged with: java
tagged with: openjpa
upvote count: 1
type: UnansweredQuestion
has title: Why is JPA retrieving one column using a seperate select

http://stackoverflow.com/comment/34398051
comment on: http://stackoverflow.com/q/22593776
type: Comment
score: 1
has text: It's the internationally standardized date format (ISO 8601). The T is the separator between date and time. The Z at the end indicates the UTC+0 timezone.
type: QuestionComment

http://stackoverflow.com/comment/34429643
has text: @venki I did not link the page for an upvote, I linked it because you asked for ideas, and I think this is a pretty good guideline to come up with ideas.
type: Comment
comment on: http://stackoverflow.com/a/22611164
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34336775
type: Comment
has text: Could u please post the code or attach the files..
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22560007

http://stackoverflow.com/q/22553413
has answer: http://stackoverflow.com/a/22706564
upvote count: 3
has body: I make TableView in javaFX that contain two TableColumns. The width of TableView Span more than the width Of all TableColumn, but its not the problem. What I did not understand Is when I click in area outside the row that contain data, and outside area of column (red area), I get an error. Can anyone explain to me why this error occur? run: Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at javafx.scene.control.TableView$TableViewArrayListSelectionModel.handleSelectedCellsListChangeEvent(TableView.java:2657) at javafx.scene.control.TableView$TableViewArrayListSelectionModel.clearAndSelect(TableView.java:2180) at javafx.scene.control.TableView$TableViewArrayListSelectionModel.clearAndSelect(TableView.java:2140) at com.sun.javafx.scene.control.behavior.TableRowBehavior.doSelect(TableRowBehavior.java:196) at com.sun.javafx.scene.control.behavior.TableRowBehavior.mousePressed(TableRowBehavior.java:88) at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:95) at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89) at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:…
answer count: 2
has title: Error in javaFX tableview
favorite count: 0
type: UnansweredQuestion
downvote count: 0
tagged with: javafx
has answer: http://stackoverflow.com/a/24993344
has comment: http://stackoverflow.com/comment/38857357
type: Question
has comment: http://stackoverflow.com/comment/34345855
score: 3
has comment: http://stackoverflow.com/comment/34337289
tagged with: java

http://stackoverflow.com/comment/34346797
score: 1
has text: then see my answer with wrappers :)
type: Comment
comment on: http://stackoverflow.com/a/22565551
type: AnswerComment

http://stackoverflow.com/a/73152805
answers question: http://stackoverflow.com/q/22593801
has body: You can not compare a char with a string. So you should modify the if part like this: if(word.charAt(i) == letter.charAt(0))
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/22594480
answers question: http://stackoverflow.com/q/22594447
upvote count: 9
score: 9
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Try: String test = ";;;;"; String[] split = test.split(";", -1); System.out.println(split.length); The String API explains this method overload that also adds a limit field. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length.
accepted answer of: http://stackoverflow.com/q/22594447

http://stackoverflow.com/comment/34492816
has text: Short answer: no. Long answer: noooooo. Copying is the only alternative.
comment on: http://stackoverflow.com/q/22646777
type: Comment
type: QuestionComment
score: 8

http://stackoverflow.com/a/22586667
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22576474
has body: Does the one-page-notification you get show "My App" / "Hello Wear !"? This would be logical, because you are building this notification (var notificationBuilder) and actually have it displayed (notificationManager.notify()). For the two-page notification, you create the first and second page - but when merging the first and the second page into twoPageNotification, you are using notificationBuilder instead of notificationCompatBuilder for your first page. Additionally, that built, two-page notification twoPageNotification is never passed to the notify() function. So adding a notificationManager.notify(notificationId,twoPageNotification) should display those two pages.
answers question: http://stackoverflow.com/q/22576474
has comment: http://stackoverflow.com/comment/34387639
score: 0

http://stackoverflow.com/q/22631517
has title: Value of Unpassed post param in Java restlet?
tagged with: java
type: Question
has body: Am a newbie to Java &amp; Restlet. Am writing a function to get the post params and calls another function internally. My doubt is if my code is something like this: Form form = new Form(entity); String abc = form.getFirstValue("abc"); And if the param abc is not passed, what would be the exception or what would be stored in abc?
tagged with: restlet
tagged with: post
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22632043
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22632043

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/22547475
tags question: http://stackoverflow.com/q/22534356
tags question: http://stackoverflow.com/q/22548839
type: Tag
tags question: http://stackoverflow.com/q/22596328

http://stackoverflow.com/q/22595480
tagged with: wgs84
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22596032
type: Question
score: 0
has title: java: check if WGS84 point is within a polygon if not get the distance
answer count: 2
has body: as mentioned in the title I'm searching for a possibillity to check if a given point in wgs84-format is within an given polygon and if not I want to find the shortest distance from that point to the polgon. Maybe there exists any library. Thank you for the help Greetings
tagged with: java
has answer: http://stackoverflow.com/a/22595976

http://stackoverflow.com/comment/34315034
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22546415
type: AnswerComment
has text: `java.util.List` is an interface that best corresponds to the trait `Buffer`. `ArrayList` is a concrete collection -- I'd say it best corresponds to `ArrayBuffer`s in Scala.

xmlunit
tags question: http://stackoverflow.com/q/22507994
tag name: xmlunit
tags question: http://stackoverflow.com/q/22642587
type: Tag
tags question: http://stackoverflow.com/q/22610374

http://stackoverflow.com/comment/34398928
score: 1
comment on: http://stackoverflow.com/q/22589901
type: Comment
type: QuestionComment
has text: The documentation for FXML is [here](http://docs.oracle.com/javase/8/javafx/api/javafx/fxml/doc-files/introduction_to_fxml.html). It's not possible to make a comprehensive list of tags, because arbitrary classes (including classes you write) can be instantiated with FXML tags.

http://stackoverflow.com/comment/34275516
score: 0
type: QuestionComment
type: Comment
has text: are most threads at QueryFactory.java:78? what does this line contain? If it is a complex statement, try to split it in several lines.
comment on: http://stackoverflow.com/q/22522068

http://stackoverflow.com/q/22542642
has body: I have an Android app that consists of a Service and various activities. When the app starts, the Service is started with startService(Intent service). Various activities (but not all activities) bind to the Service and send/receive messages from it. The service should be alive while the app is in the foreground on any activity or in the background, but should end when the entire app is closed (i.e. user swipes the app from Recent Apps screen). How do I determine from the Service (which currently never stops running until you manually stop it on the device) that the app process has ended so that I can then stop the service?
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34307687
has answer: http://stackoverflow.com/a/22542848
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34311317
has answer: http://stackoverflow.com/a/22542808
has title: How do you detect from a service that the app process has closed?
tagged with: service
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34310963

bufferedreader
tags question: http://stackoverflow.com/q/22600586
tags question: http://stackoverflow.com/q/22512728
tags question: http://stackoverflow.com/q/22492777
tags question: http://stackoverflow.com/q/22548977
tags question: http://stackoverflow.com/q/22538964
tags question: http://stackoverflow.com/q/22596022
tags question: http://stackoverflow.com/q/22535736
tags question: http://stackoverflow.com/q/22567663
tags question: http://stackoverflow.com/q/22543575
tags question: http://stackoverflow.com/q/22611092
tags question: http://stackoverflow.com/q/22564552
tags question: http://stackoverflow.com/q/22545083
tag name: bufferedreader
tags question: http://stackoverflow.com/q/22578749
tags question: http://stackoverflow.com/q/22596895
type: Tag

http://stackoverflow.com/q/22497563
answer count: 1
tagged with: xml-attribute
favorite count: 0
has comment: http://stackoverflow.com/comment/34660740
has body: Using DOM parser, I am storing attribute values in HashMap in Java and then later retrieving it as required. Is there any other way of doing this without using maps? Xml example: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Main&gt; &lt;SubMainLevels&gt; &lt;SubMainLevel LineNo="1" arg2="122" RollNo="11" weight="14" folds="1" /&gt; &lt;SubMainLevel LineNo="2" arg2="123" RollNo="12" weight="12" folds="2" /&gt; &lt;/SubMainLevels&gt; &lt;/Main&gt; What I have done: Map&lt;String, String&gt; x = new HashMap&lt;String, String&gt;(); getXmlAttr(){ Traverse till Main\SubMainLevels\SubMainLevel for each SubMainLevel { getAttribute() for all attributes LineNo,arg2,RollNo,weight,folds concatenate strConcat = arg2+":"+RollNo+":"+weight+":"+folds x.put(LineNo,strConcat); } } retrieveAttrMap(HashMap x){ for each HashMap key{ strVal =x.get(key) split strVal at ":" //do stuff } }
has comment: http://stackoverflow.com/comment/34737461
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34758243
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22740737
upvote count: 1
has comment: http://stackoverflow.com/comment/34756735
has comment: http://stackoverflow.com/comment/34749973
type: Question
tagged with: domparser
tagged with: xml-parsing
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/22740737
downvote count: 0
has title: DOM parser to read Xml , retrieve attribute values and storing them

http://stackoverflow.com/comment/34350574
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22567404
score: 0
has text: I shortened the code to make it as simple as possible.

http://stackoverflow.com/a/22558488
has comment: http://stackoverflow.com/comment/34334316
has body: Correct. What you need is javax.jms.ConnectionFactory and javax.jms.Destination. However, as you say it is ESB, there should some connection properties to the server, e.g. JNDI, or some service-locator to connect to the bus and call appropriate service. Actually not enough info, what you have in hands regarding that ESB
has comment: http://stackoverflow.com/comment/34340935
answers question: http://stackoverflow.com/q/22558318
has comment: http://stackoverflow.com/comment/34340061
has comment: http://stackoverflow.com/comment/34340242
has comment: http://stackoverflow.com/comment/34337558
has comment: http://stackoverflow.com/comment/34337686
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34335003

http://stackoverflow.com/a/47399727
type: Answer
answers question: http://stackoverflow.com/q/22596330
has body: Here is apache commons closeQuietly adapted for AutoCloseable: static void closeQuietly(AutoCloseable closeable) { try { if (closeable != null) { closeable.close(); } } catch (Exception swallowed) { } } since google sent me here for that case :)
score: 0

http://stackoverflow.com/comment/34455853
type: Comment
type: QuestionComment
has text: who down vote my question and why? don't just down vote and go
comment on: http://stackoverflow.com/q/22625821
score: 0

http://stackoverflow.com/comment/34584973
type: AnswerComment
type: Comment
has text: see addition with foreach loop
comment on: http://stackoverflow.com/a/22611350
score: 0

http://stackoverflow.com/comment/34266206
type: QuestionComment
has text: I have captilized the Class name and named the file discount.java. they are both correct. xD
comment on: http://stackoverflow.com/q/22519482
score: 0
type: Comment

http://stackoverflow.com/q/22610825
has answer: http://stackoverflow.com/a/22610890
has comment: http://stackoverflow.com/comment/34428317
type: UnansweredQuestion
has body: I am making an app in which there is a splash class containing an image to display when the app is made to run and another class is made for adding and subtracting a number and it is to be displayed after the image appered first .... manifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" />// here shows a warning saying"Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details." <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.example.sati.MAINACTIVITY" /> <category android:name="android.intent.category.DEFAULT" /> following is the code of xml file named splash <?xml version="1.0" encoding="utf-8"?> Splash.java package com.example.sati; import android.app.Activity; import android.os.Bundle; public class Splash extends Activity { @Override protected void onCreate(Bundle sidra) { // TODO Auto-generated method stub super.onCreate(sidra); setContentView(R.layout.splash);//SPLASH CLASS CODE } } //all above mentioned code is the implementation of ThenewBoston tutorials up to 14 Logcat 03-24 13:26:23.285: W/dalvikvm(328): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 03-24 13:26:23.355: E/AndroidRuntime(328): FATAL EXCEPTION: main 03-24 13:26:23.355: E/AndroidRuntime(328): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.sati/com.example.sati.SplashAct}: java.lang.ClassNotFoundException: com.example.sati.SplashAct in loader dalvik.system.PathClassLoader[/data/app/com.example.sati-1.apk] 03-24 13:26:23.355: E/AndroidRuntime(328): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585) 03-24 13:26:23.355: E/AndroidRuntime(328): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 03-24 13:26:23.355: …
has title: The application sati(process com.example.sati)has stopped unexpectedly.Please try again
tagged with: java
has answer: http://stackoverflow.com/a/22610903
tagged with: eclipse
type: Question
tagged with: syntax-error
has comment: http://stackoverflow.com/comment/34428354
answer count: 2
score: 0
tagged with: android

http://stackoverflow.com/q/22639175
type: AnsweredQuestion
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/1384947
type: Question
answer count: 2
has body: I'm pretty new to CSV and XML files in general, and I want to convert every CSV file in my folder to an XML file. I'd like some tips how to work with CSV files, how to go about processing and converting the files, and how to go about repeating the conversion process for every file in my folder. Thanks in advance. Example CSV id,name,surname,street,number,town 112345,gentoo,king,bourkley,6,novi sad 446636,mark,smith,milson,14,capetown Example XML 112345 gentoo king bourkley 6 novi sad 112345 mark smith milson 14 capetown Of course, I'd like the simplest possible solution. Using libraries as basic as they get.
upvote count: 0
has answer: http://stackoverflow.com/a/22639388
has comment: http://stackoverflow.com/comment/34479018
tagged with: http://stackoverflow.com/tag/csv
possible better answer: http://stackoverflow.com/a/22639276
tagged with: directory
favorite count: 0
has answer: http://stackoverflow.com/a/22639276
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/34478927
accepted answer: http://stackoverflow.com/a/22639388
downvote count: 1
has title: How to convert every CSV in a folder to an XML file in Java?

http://stackoverflow.com/a/22630529
has body: This method is the problem: public static int recursivesum(int n, int m) { if (n &lt; m) { int s = n; // Variable declared here... scoped to the if s += recursivesum(n+2, m); } else { if (m &lt; n) { int s = m; // Variable declared here... scoped to this if s += recursivesum(m+2, n); } } return s; // No such variable in scope! } You could use: public static int recursivesum(int n, int m) { int s = 0; // See note below if (n &lt; m) { s = n + recursivesum(n+2, m); } else { if (m &lt; n) { s = m + recursivesum(m+2, n); } } return s; } We have to give s an explicit initial value, because you currently don't have any code handling the case where n and m are equal. It's not clear what you want to do then. Another alternative is to return from the if statements, just as you do in iterativesum... although you'll again need to think about what to do if m == n: public static int recursivesum(int n, int m) { if (n &lt; m) { // You don't even need an s variable! return n + recursivesum(n+2, m); } else if (m &lt; n) { // Simplified else { if { ... } } to else if { .... } return m + recursivesum(m+2, n); } else { // What do you want to return here? } } Note that you've got the same problem in iterativesum - the compiler should be complaining at you at the moment that not all paths return a value. What do you expect iterativesum(3, 3) to do?
upvote count: 5
answers question: http://stackoverflow.com/q/22630398
score: 5
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34398212
comment on: http://stackoverflow.com/a/22593857
score: 0
type: AnswerComment
type: Comment
has text: The Z is relevant. It indicates that the date has been transformed to a String using the UTC timezone.

http://stackoverflow.com/comment/34416879
type: Comment
has text: Can you try with `within(com.app.components..*` instead of `within(com.app.components.**`
type: QuestionComment
comment on: http://stackoverflow.com/q/22604303
score: 2

http://stackoverflow.com/comment/34378423
has text: The code would be almost identical to what you have now. Instead of `new JFrame()`, you would use `new JDialog(true)`. Just make sure setVisible(true) is called last, because everything after setVisible(true) will be blocked until the user closes the dialog.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22581831

http://stackoverflow.com/q/22574317
accepted answer: http://stackoverflow.com/a/22617122
downvote count: 0
has comment: http://stackoverflow.com/comment/34366293
tagged with: java-8
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/40053177
has answer: http://stackoverflow.com/a/40053177
answer count: 2
linked to: http://stackoverflow.com/q/8122843
has comment: http://stackoverflow.com/comment/34366193
favorite count: 0
upvote count: 3
has title: How to add jdk8 in Eclipse Indigo
has body: I just read How to have Eclipse use JDK8 to compile a project? What i added jdk8 to eclipse as, From the answers of How to have Eclipse use JDK8 to compile a project? I tried to Update the JDT/Core, JDT/UI bundles from http://dist.springsource.com/snapshot/TOOLS/java8/e43 But it shows error as, "Eclipse Java Development Tools Patch for Java 8 Support (BETA)" is not applicable to the current configuration and will not be installed. "Eclipse Plug-in Development Environment Patch for Java 8 Support (BETA)" is not applicable to the current configuration and will not be installed. How Can i fix it ?
has answer: http://stackoverflow.com/a/22617122

http://stackoverflow.com/q/22525006
has title: How to check continously that a IP is reachable?
type: Question
tagged with: network-programming
has answer: http://stackoverflow.com/a/22526835
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/5352565
linked to: http://stackoverflow.com/q/5888502
has answer: http://stackoverflow.com/a/22525209
has answer: http://stackoverflow.com/a/22525019
type: UnansweredQuestion
tagged with: android
has body: I am writing an app for sync purposes. And basically it should transfer data to a nas or a shared folder when it reachable. For example: When I come home my phone notices that 192.168.1.1 is now reachable and starts the sync process. How can this be achieved? I need something what continuously check whether the destination is reachable or not. Any ideas ?
tagged with: java
has comment: http://stackoverflow.com/comment/34275832

http://stackoverflow.com/q/22603492
tagged with: android-graphview
tagged with: android
answer count: 1
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25241576
has body: I need a way to fix the y axis for the graph view package. I am showing real time frequency spectra but it is not possible to visualise the data properly as the y axis adjusts to the current largest value. Please advise. I will offer a bounty to any answer that easily solves my problem. Package: http://android-graphview.org/#documentation
tagged with: java
has title: Fix (freeze) y axis for Android GraphView package
type: Question

http://stackoverflow.com/comment/34371263
score: 0
has text: If you use NetBeans, use the make controller option to create the controller files from fxml. It will do the FXML injection for you.
type: Comment
comment on: http://stackoverflow.com/a/22546154
type: AnswerComment

memoization
type: Tag
tag name: memoization
tags question: http://stackoverflow.com/q/22637877

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/22511566
tags question: http://stackoverflow.com/q/22606186
tags question: http://stackoverflow.com/q/22596681
tags question: http://stackoverflow.com/q/22528034
tags question: http://stackoverflow.com/q/22569306
tags question: http://stackoverflow.com/q/22609601
tags question: http://stackoverflow.com/q/22552201
tags question: http://stackoverflow.com/q/22578017
tags question: http://stackoverflow.com/q/22600528
tags question: http://stackoverflow.com/q/22642684
tags question: http://stackoverflow.com/q/22644208
tags question: http://stackoverflow.com/q/22573167
tags question: http://stackoverflow.com/q/22624192
tags question: http://stackoverflow.com/q/22624553
tags question: http://stackoverflow.com/q/22498033
type: Tag
tags question: http://stackoverflow.com/q/22516571
tags question: http://stackoverflow.com/q/22552290
tags question: http://stackoverflow.com/q/22541156
tags question: http://stackoverflow.com/q/22590988
tags question: http://stackoverflow.com/q/22573480
tags question: http://stackoverflow.com/q/22528816
tags question: http://stackoverflow.com/q/22544585
tags question: http://stackoverflow.com/q/22523920
tags question: http://stackoverflow.com/q/22548992
tags question: http://stackoverflow.com/q/22604234
tags question: http://stackoverflow.com/q/22491177
tags question: http://stackoverflow.com/q/22591577
tags question: http://stackoverflow.com/q/22634559
tags question: http://stackoverflow.com/q/22642634
tags question: http://stackoverflow.com/q/22625582
tags question: http://stackoverflow.com/q/22493545
tags question: http://stackoverflow.com/q/22549703
tags question: http://stackoverflow.com/q/22636214
tags question: http://stackoverflow.com/q/22532345
tags question: http://stackoverflow.com/q/22522558
tags question: http://stackoverflow.com/q/22560386
tags question: http://stackoverflow.com/q/22539158
tags question: http://stackoverflow.com/q/22505068
tags question: http://stackoverflow.com/q/22581378
tags question: http://stackoverflow.com/q/22509629
tags question: http://stackoverflow.com/q/22529161
tags question: http://stackoverflow.com/q/22617633
tags question: http://stackoverflow.com/q/22531436
tags question: http://stackoverflow.com/q/22609754
tags question: http://stackoverflow.com/q/22631885
tags question: http://stackoverflow.com/q/22492200
tags question: http://stackoverflow.com/q/22580867
tags question: http://stackoverflow.com/q/22538071
tags question: http://stackoverflow.com/q/22592168
tags question: http://stackoverflow.com/q/22510893
tags question: http://stackoverflow.com/q/22646841
tags question: http://stackoverflow.com/q/22646931
tags question: http://stackoverflow.com/q/22573299
tags question: http://stackoverflow.com/q/22552736
tags question: http://stackoverflow.com/q/22500131
tags question: http://stackoverflow.com/q/22539790
tags question: http://stackoverflow.com/q/22640257
tags question: http://stackoverflow.com/q/22633053
tag name: xml
tags question: http://stackoverflow.com/q/22550188
tags question: http://stackoverflow.com/q/22528848
tags question: http://stackoverflow.com/q/22532127
tags question: http://stackoverflow.com/q/22634537
tags question: http://stackoverflow.com/q/22579396
tags question: http://stackoverflow.com/q/22565866
tags question: http://stackoverflow.com/q/22504322
tags question: http://stackoverflow.com/q/22625305
tags question: http://stackoverflow.com/q/22553401
tags question: http://stackoverflow.com/q/22537552
tags question: http://stackoverflow.com/q/22516859
tags question: http://stackoverflow.com/q/22514948
tags question: http://stackoverflow.com/q/22610374
tags question: http://stackoverflow.com/q/22601406
tags question: http://stackoverflow.com/q/22523325
tags question: http://stackoverflow.com/q/22641708
tags question: http://stackoverflow.com/q/22556423
tags question: http://stackoverflow.com/q/22589052
tags question: http://stackoverflow.com/q/22533951
tags question: http://stackoverflow.com/q/22584027

http://stackoverflow.com/comment/34368431
has text: giving error ... Exception in thread "main" java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>'
comment on: http://stackoverflow.com/a/22577436
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22586379
has answer: http://stackoverflow.com/a/22586415
score: 5
accepted answer: http://stackoverflow.com/a/22586391
has answer: http://stackoverflow.com/a/22586433
possible better answer: http://stackoverflow.com/a/22586411
tagged with: string
has comment: http://stackoverflow.com/comment/34385258
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/22586391
answer count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22586411
has body: if(input.contains("Angle ")) { input.charAt(?); } So, basically, how would you find the char directly after "Angle "? In absolute simplest terms, how do you find the indexes in which "Angle " was found?
has title: Find char index where contains() found sequence
type: Question
tagged with: java

http://stackoverflow.com/a/22527974
score: 1
accepted answer of: http://stackoverflow.com/q/22498978
answers question: http://stackoverflow.com/q/22498978
has body: if @lang.code returning the en-IN, it means its giving you .defaultLang in place of .code, may be you are using a variable of lang name also in your controller.and you confused the play so it is taking .defaultLang, which is returning en-IN. make sure no variable name should be lang and the problem will be solved.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/q/22622332
has comment: http://stackoverflow.com/comment/34464496
has answer: http://stackoverflow.com/a/22622535
has comment: http://stackoverflow.com/comment/34477579
has comment: http://stackoverflow.com/comment/34476368
has comment: http://stackoverflow.com/comment/34477414
linked to: http://stackoverflow.com/q/46586
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/34477333
has comment: http://stackoverflow.com/comment/34449368
has answer: http://stackoverflow.com/a/22622724
has answer: http://stackoverflow.com/a/22632103
has comment: http://stackoverflow.com/comment/34478825
answer count: 16
has answer: http://stackoverflow.com/a/22625445
has comment: http://stackoverflow.com/comment/34449419
has answer: http://stackoverflow.com/a/23190883
has answer: http://stackoverflow.com/a/22623040
has comment: http://stackoverflow.com/comment/34478571
has comment: http://stackoverflow.com/comment/34478513
has answer: http://stackoverflow.com/a/22633135
downvote count: 3
has title: One 'else' for nested 'if' statements
has comment: http://stackoverflow.com/comment/34461857
has comment: http://stackoverflow.com/comment/104185503
accepted answer: http://stackoverflow.com/a/22622915
has comment: http://stackoverflow.com/comment/34455288
upvote count: 24
has answer: http://stackoverflow.com/a/22622441
has answer: http://stackoverflow.com/a/22623319
has answer: http://stackoverflow.com/a/22627888
favorite count: 0
has comment: http://stackoverflow.com/comment/34477274
has answer: http://stackoverflow.com/a/22634300
has answer: http://stackoverflow.com/a/22632449
possible better answer: http://stackoverflow.com/a/22622441
has body: I've got a problem which can be simplified to this: parameters: a, b if (a &gt; 5) { Print("Very well, a &gt; 5"); if (b &gt; 7) Print("Even better, b &gt; 7"); else { Print("I don't like your variables"); } } else { Print("I don't like your variables"); } I would like to use only one else instead of two since they are the same code. What I thought of was creating an additional method, which will return combined true`false`, but this is a serious overkill. Another option would be a goto, but this would make code less readable and unsafe. What is the way to do it, avoiding checking the same condition many times and making it as readable as possible?
has answer: http://stackoverflow.com/a/22622915
has answer: http://stackoverflow.com/a/22633534
has answer: http://stackoverflow.com/a/22628588
has comment: http://stackoverflow.com/comment/34477134
has comment: http://stackoverflow.com/comment/34460605
tagged with: c++
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22632754
tagged with: if-statement
has comment: http://stackoverflow.com/comment/34478507
score: 21
tagged with: java

http://stackoverflow.com/comment/34386639
has text: It was typo corrected it now, thxs
score: 0
comment on: http://stackoverflow.com/q/22587187
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34282967
comment on: http://stackoverflow.com/q/22529161
has text: In XSLT, performance is seldom the top priority. Still, the most reliable way to find out is to actually test this. Why don't you go ahead and measure the time or resources?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22596015
tagged with: http://stackoverflow.com/tag/mp3
type: Question
tagged with: wav
has answer: http://stackoverflow.com/a/22596331
upvote count: 2
score: 0
downvote count: 2
has title: I can not handle programe exception : play java sound
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I want my Java program to play sounds, but I am having some problems with it. public static void main(String[] args) throws IOException, UnsupportedAudioFileException, LineUnavailableException { AudioInputStream audioIn = AudioSystem.getAudioInputStream(new File("PTUK1.mp3")); Clip clip = AudioSystem.getClip(); clip.open(audioIn); clip.start(); clip.stop(); } I am getting the following exception, with "PTKU1.mp3" : Exception in thread "main" javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1187) With "PTUK2.wav", I am getting this exception: Exception in thread "main" java.lang.IllegalArgumentException: Invalid format at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.createStream(PulseAudioDataLine.java:142) at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:99) at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:283) at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:402) at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:453)
tagged with: audio
tagged with: java

http://stackoverflow.com/q/22521485
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34269769
possible better answer: http://stackoverflow.com/a/22521547
tagged with: java
has answer: http://stackoverflow.com/a/22521547
has body: Basically I am wondering how I could make a method that takes a String that has a series of decimal numbers separated by spaces and then (after splitting the string according to separate numbers) returns a double. Then using the doubles returned, returning the sum of all the decimal numbers rounded to the nearest whole number. Example: Like let's say I input String “42.5 7.2 1.2” and I want to make it return the sum of all the decimal numbers rounded to the nearest whole number, which here would be 51.0. Here is my attempt so far. String s = text1; String[] ls; ls = s.split(" "); for(int i = 0; i&lt;= s.length(); i++){ double a = Double.parseDouble(ls[i]);
type: Question
has answer: http://stackoverflow.com/a/22521596
has comment: http://stackoverflow.com/comment/34269847
score: 0
has answer: http://stackoverflow.com/a/22521624
has comment: http://stackoverflow.com/comment/34269823
answer count: 6
has comment: http://stackoverflow.com/comment/34269797
has comment: http://stackoverflow.com/comment/34269825
has comment: http://stackoverflow.com/comment/34269841
has comment: http://stackoverflow.com/comment/34269799
accepted answer: http://stackoverflow.com/a/22521624
has answer: http://stackoverflow.com/a/22521919
has answer: http://stackoverflow.com/a/22521555
has answer: http://stackoverflow.com/a/22521818
has title: Computing the sum of values that came from a split String in an array in Java

http://stackoverflow.com/comment/34396600
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22592899
has text: That would be a question for the maven developers.
score: 0

http://stackoverflow.com/comment/34409663
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22600217
has text: What are you confused about?
score: 0

http://stackoverflow.com/comment/34460264
type: Comment
has text: I'm just curious, why didn't you declare the class *outside* the method? Can you please post a small example of that? I really want to know when it's better to have a class *inside* a method.
type: AnswerComment
comment on: http://stackoverflow.com/a/22628562
score: 0

http://stackoverflow.com/q/22513053
has body: This is my code: ObjectMapper mapper = new ObjectMapper(); mapper.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false);//suggested by fge Socket s = new Socket("127.0.0.1",port); mapper.writeValue(s.getOutputStream(),anObjectRequest);//this works Aresponse res = mapper.readValue(s.getInputStream(),AresponseClass.class); I get that the socket is closed. But, if look into wireshark, I see the server correctly receives the request and correctly sends the answer too! Where is the problem?
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: "socket closed" error when I try to send/receive a jxrpc over a socket stream
tagged with: jackson
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22513231
accepted answer: http://stackoverflow.com/a/22513231
favorite count: 0

http://stackoverflow.com/comment/34250685
comment on: http://stackoverflow.com/q/22510893
has text: that activity is part of a tabhost does that do anything to create the error?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22534931
accepted answer of: http://stackoverflow.com/q/22534356
type: Answer
upvote count: 58
has comment: http://stackoverflow.com/comment/91920637
has comment: http://stackoverflow.com/comment/105004999
downvote count: 1
answers question: http://stackoverflow.com/q/22534356
has comment: http://stackoverflow.com/comment/63157099
has body: The complete Swing processing is done in a thread called EDT (Event Dispatching Thread). Therefore you would block the GUI if you would compute some long lasting calculations within this thread. The way to go here is to process your calculation within a different thread, so your GUI stays responsive. At the end you want to update your GUI, which have to be done within the EDT. Now EventQueue.invokeLater comes into play. It posts an event (your Runnable) at the end of Swings event list and is processed after all previous GUI events are processed. Also the usage of EventQueue.invokeAndWait is possible here. The difference is, that your calculation thread blocks until your GUI is updated. So it is obvious that this must not be used from the EDT. Be careful not to update your Swing GUI from a different thread. In most cases this produces some strange updating/refreshing issues. Still there is Java code out there that starts a JFrame simple from the main thread. This could cause issues, but is not prevented from Swing. Most modern IDEs now create something like this to start the GUI: public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); }
has comment: http://stackoverflow.com/comment/34293683
has comment: http://stackoverflow.com/comment/34294290
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34294025
score: 57

http://stackoverflow.com/comment/34282276
score: 0
has text: @kocko: Please have a look at the Oracle JDK's source.
type: QuestionComment
comment on: http://stackoverflow.com/q/22528675
type: Comment

http://stackoverflow.com/q/22631024
favorite count: 0
has title: Import Groovy Bean definition in Spring 4?
type: UnansweredQuestion
tagged with: spring
tagged with: spring-4
has answer: http://stackoverflow.com/a/27248534
tagged with: java
has comment: http://stackoverflow.com/comment/40200119
has comment: http://stackoverflow.com/comment/34465039
type: Question
score: 4
upvote count: 4
has body: I have defined some beans with groovy dsl and tried to add them like i did previously using a xml definition for beans in my dispatcher-servlet.xml: &lt;import resource="/WEB-INF/config.groovy"/&gt; but this is not working. Whats wrong? My bean definition looks like this: import org.apache.commons.dbcp.BasicDataSource beans { dataSource(BasicDataSource) { driverClassName = "com.mysql.jdbc.Driver" url = "jdbc:mysql://localhost:3306/test" username = "root" password = "root" } }
tagged with: groovy
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34331580
type: Comment
comment on: http://stackoverflow.com/a/22557117
type: AnswerComment
score: 0
has text: thanks. in the examples that i saw on internet, they never mentioned to shutdown the the threadpool, and the examples were using `Executor` which does not have a `shutdown/halt` behavior. :)

http://stackoverflow.com/q/22596895
tagged with: android
score: 10
has answer: http://stackoverflow.com/a/22657359
answer count: 6
has title: Android App Retrieve Data from Server but in a Secure way
tagged with: java
tagged with: inputstream
upvote count: 10
accepted answer: http://stackoverflow.com/a/22656107
has answer: http://stackoverflow.com/a/22655323
has answer: http://stackoverflow.com/a/22654480
possible better answer: http://stackoverflow.com/a/22654013
has body: Obviously I am no android or java expert. What I want to do in my Android app is, load data from a server. I already got working this part and sourcecode is attached. But I want to do it in a way which is secure. As a first step, instead of http://thisismyurl.com/a.php?action=get I want to do it with username/password like this: http://username:password@thisismyurl.com/a.php?action=get How would I do it? Should I just add the username and password part to the url? Lets say I've accomplished that this will not be of any of use, because someone can just open the apk and decompile the sourcecode and get the url and the username/password. so is there a truly secure way of doing that? I hope I am getting understood here. String url = "http://thisismyurl.com/a.php?action=get"; String result = Web.executeWeb(url); public class Web { public static String executeWeb(final String url) { final StringBuilder sb = new StringBuilder(); Thread thread = new Thread(new Runnable() { public void run() { try { InputStream is = (InputStream) new URL(url).getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String result, line = reader.readLine(); result = line; while((line=reader.readLine())!=null){ result+=line; } sb.append(result); //System.out.println(result); //Log.i("My Response :: ", result); } catch (Exception e) { // TODO: handle exception } } }); thread.start(); try { thread.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return sb.toString(); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22653996
has answer: http://stackoverflow.com/a/22654013
downvote count: 0
tagged with: bufferedreader
favorite count: 0
has answer: http://stackoverflow.com/a/22656107
type: Question

http://stackoverflow.com/comment/34460497
type: QuestionComment
comment on: http://stackoverflow.com/q/22628762
has text: Have you thought of looking at hibernate? It does EXACTLY what you're doing with annotations.
score: 0
type: Comment

http://stackoverflow.com/q/22559402
has answer: http://stackoverflow.com/a/22559743
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34336111
accepted answer: http://stackoverflow.com/a/22559743
tagged with: interface
has comment: http://stackoverflow.com/comment/34336130
has comment: http://stackoverflow.com/comment/34335855
tagged with: gwt
type: AnsweredQuestion
has title: Implementing this Interface Properly
has body: I'm trying to implement this interface properly: public interface OccupancyGrid { public Grid grid(); } Then I have a class which implements it: public class OccupancyCheckView implements OccupancyGrid{ private Grid myGrid = new Grid(17,17); @Override public Grid grid() { return myGrid; } public main_(){ createResultGrid("Test Grid"); //More code below which changes the properties of 'myGrid' } Then I have a class which is trying to call upon the above interface: public class TestOccupanciesPanel { private VerticalPanel mainPanel_; OccupancyGrid myGrid = new OccupancyCheckView(); //This is where I trip up mainPanel_.add(myGrid); I've seen elsewhere in the code I'm editing the user of interfaces very cleanly but without going about it in the way I've done above, it seems much cleaner. The code simply does something like: OccupancyCheckView.class Can you help me out and give me some tips?
tagged with: java

http://stackoverflow.com/q/22587974
score: 2
tagged with: audio
type: AnsweredQuestion
has title: set time interval between repeating audio clip in java when using clip.loop(Clip.LOOP_CONTINUOUSLY);
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34387956
has answer: http://stackoverflow.com/a/22598556
accepted answer: http://stackoverflow.com/a/22598556
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34390344
favorite count: 0
has body: I am trying to loop a small ".wav" audio file. The code I used worked perfectly but I want to set some time interval between looping audio. Code is provided below. try { // from a wave File File soundFile = new File("path"); AudioInputStream audioIn = AudioSystem.getAudioInputStream(soundFile); clip = AudioSystem.getClip(); clip.open(audioIn); clip.loop(Clip.LOOP_CONTINUOUSLY); //IS THERE ANY WAY TO CREATE TIME INTERVAL??? } catch (Exception e) { JOptionPane.showMessageDialog(null, "Hi. This is background music error \n" + e); }

http://stackoverflow.com/a/22621048
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22619760
answers question: http://stackoverflow.com/q/22619760
has body: The problem was related to another table. We have an audit table with field 'description' also. Once i increased the size of the audit table description field the error went away. Unfortunately the error thrown by hibernate did not state on which table the error was thrown and i assumed it was on the regular table.

http://stackoverflow.com/a/22620699
has body: Nope. The char '7' can be retrieved from int 7 in these ways: int digit = 7; char code = Integer.toString(digit).charAt(0); code = Character.forDigit(digit, 10);
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22620440

http://stackoverflow.com/a/22630068
type: Answer
has body: Most Open Source licenses include a warranty disclaimer and liability limitation language. To the extent that your jurisdiction allows you to disclaim warranty and liability, any of them are likely to be usable. For instance, the MIT license includes: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. And from the Apache License: 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of t…
upvote count: 4
downvote count: 1
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22629467
answers question: http://stackoverflow.com/q/22629467

http://stackoverflow.com/comment/34316071
type: Comment
type: QuestionComment
has text: I have edited my question to be more clear. Essentially, I expect my JUnit testMethod() to hit UserController.testMethod(). The result should be a 200 and a successful compilation.
score: 0
comment on: http://stackoverflow.com/q/22547117

http://stackoverflow.com/a/22536093
answers question: http://stackoverflow.com/q/22535957
has body: use interface in the activity you implement the interface and in the other class you just trigger it. and it it's method you use notify for the adapter.
type: Answer
score: 0

http://stackoverflow.com/comment/34299941
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22537502
has text: I give it an array for example ( 3,2,5,6,1) and it compares 3 with 0. Then 3,2 with 0. and for the second part (5,6,1) everything is 0. It compares 0 with 0 then 0 with 0... EDITED! Finally it outputs 0,0,1,5,6 So one part is gone.

http://stackoverflow.com/comment/34373404
type: AnswerComment
type: Comment
has text: That is true when you use shared memory in your application. When you use messaging (like the asker mentioned) you dont have to bother that.
comment on: http://stackoverflow.com/a/22578378
score: 0

http://stackoverflow.com/q/22614613
has answer: http://stackoverflow.com/a/22615172
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: dependencies
type: UnansweredQuestion
tagged with: maven
has body: I need to use external framework in my code. I've added dependency to my pom.xml. But the problem is that we need to use the same jar across all out project on the remote host, thus we use provided And every thing works good if i run my project on the remote host, but when i run it locally i get java.lang.NoClassDefFoundError... ... Caused by: java.lang.ClassNotFoundException: I've checked - my local repository contains dependency, but still i can't use it. Where should i put my *jar file to make it accessible for my application ? UPDATE: We use Jetty, but very often we run java code from ruby scripts.
has title: Local usage of maven dependency with provided scope

http://stackoverflow.com/comment/34329060
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22555342
has text: When R is not compiled (and then it's deleted), it's a matter of xml errors (not only in layout files) AND/OR invalid characters in file names (such as UPPER CASE letters or - or other invalid characters).
type: Comment

http://stackoverflow.com/comment/34410905
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22600067
has text: Check that your installation contains the EL libraries.
score: 0

http://stackoverflow.com/comment/34382270
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22584761
has text: I actually like the implementation of class variables here. If I had the reputation points (because for some reason 15 are required) I would certainly up vote this. Thanks!
score: 1

http://stackoverflow.com/q/22490064
has answer: http://stackoverflow.com/a/22497685
upvote count: 5
accepted answer: http://stackoverflow.com/a/22497685
tagged with: media-player
answer count: 3
downvote count: 0
tagged with: media
favorite count: 0
has answer: http://stackoverflow.com/a/22508472
has body: I'm writing a simple game and trying to play sounds but I can't get it to work when I create the Media object it throws IllegalArgumentException. I'm not much of a Java coder and any help will be appreciated. Here is a sample code: import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; public class Main{ public static void main(String[] args) { Media pick = new Media("put.mp3"); //throws here MediaPlayer player = new MediaPlayer(pick); player.play(); } } Obviously "put.mp3" exists and located in the correct directory, I checked the path using: System.out.println(System.getProperty("user.dir")); what am I doing wrong here?
possible better answer: http://stackoverflow.com/a/22508472
has comment: http://stackoverflow.com/comment/34216367
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has title: How to use JavaFX MediaPlayer correctly?
has answer: http://stackoverflow.com/a/64626759
type: Question
score: 5

http://stackoverflow.com/comment/34364690
type: QuestionComment
comment on: http://stackoverflow.com/q/22575308
score: 0
type: Comment
has text: `ä` has no ascii value, see http://en.wikipedia.org/wiki/ASCII

http://stackoverflow.com/q/22525224
has title: No output is coming not even error java with jri call to R
has comment: http://stackoverflow.com/comment/34276313
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22525696
tagged with: jri
has body: Below is my code package org.quad.test; import org.rosuda.JRI.Rengine; public class JRT { public static void main(String[] args) { System.out.println("Cannot load R"); // new R-engine Rengine re = new Rengine(new String[] {}, false, null); if (!re.waitForR()) { System.out.println("Cannot load R"); return; } else { System.out.println(" load R"); } // print a random number from uniform distribution System.out.println(re.eval("runif(1)").asDouble()); System.out.println("Cannot load R"); // done... re.end(); } } Above program runs fine but no output please help as i am new to java with r integration....
tagged with: http://stackoverflow.com/tag/r
score: 0
linked to: http://stackoverflow.com/q/2180235
has comment: http://stackoverflow.com/comment/34276384
linked to: http://stackoverflow.com/q/19100875
answer count: 1
has comment: http://stackoverflow.com/comment/34276458
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34276161
has comment: http://stackoverflow.com/comment/34276083

http://stackoverflow.com/comment/34347356
type: QuestionComment
comment on: http://stackoverflow.com/q/22546967
score: 0
has text: Interesting how you have 3 deleted answers below... Anyway I probably won't write an answer, but glad to help
type: Comment

http://stackoverflow.com/q/22619099
tagged with: java
has comment: http://stackoverflow.com/comment/34453788
tagged with: live
has comment: http://stackoverflow.com/comment/34443731
has comment: http://stackoverflow.com/comment/34443654
upvote count: 1
has body: I've implemented a code that sends e-mails using Outlook server (worked fine locally). What's the cause of the following exception on my production environment and how do I resolve it? javax.mail.MessagingException: Could not connect to SMTP host: smtp.live.com, port: 587; nested exception is: java.net.ConnectException: Connection timed out
has comment: http://stackoverflow.com/comment/34443626
has title: javax.mail.MessagingException: Could not connect to SMTP host: smtp.live.com, port: 587
tagged with: email
favorite count: 0
type: UnansweredQuestion
downvote count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/34453818
type: Question
tagged with: outlook
score: 1

http://stackoverflow.com/a/22503685
type: AcceptedAnswer
has body: if i typed any letter it shows "Invalid input". Can anyone help me? Catch the exception and print the message, like below - try{ System.out.print("Enter your age : "); age = input.nextInt(); }catch(RuntimeException ex){ System.out.println("Invalid input"); }
answers question: http://stackoverflow.com/q/22503520
type: Answer
has comment: http://stackoverflow.com/comment/34237706
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22503520
upvote count: 1

http://stackoverflow.com/q/22553440
answer count: 1
favorite count: 0
upvote count: 2
has body: I have done a map-reduce wordcount program, now i want use the output(which is a word-count of each word) from which i want to count top 5 keywords. How to use the output of stage 1 into stage 2,should i run another job?
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
has title: How can i use the output of mapreduce wordcount for further processing?
has answer: http://stackoverflow.com/a/22557639
downvote count: 0

http://stackoverflow.com/comment/34224148
score: 0
comment on: http://stackoverflow.com/a/22495257
type: Comment
type: AnswerComment
has text: you've modified the question, it's another question

http://stackoverflow.com/comment/34334535
comment on: http://stackoverflow.com/a/22558599
type: AnswerComment
has text: Is there any other way? In MySQL, for example, I can search with the like expression for Strings even though the column is integer.
score: 0
type: Comment

http://stackoverflow.com/q/22549433
has comment: http://stackoverflow.com/comment/34327324
has answer: http://stackoverflow.com/a/68695166
tagged with: connection
has comment: http://stackoverflow.com/comment/34320179
has answer: http://stackoverflow.com/a/22549508
has comment: http://stackoverflow.com/comment/34319495
answer count: 4
has body: I am new in connection pooling.I have a created a connection pool in mysql that adds five connections.Now i want to know what is the application of connection pooling,i.e after creating that pool how to use that.. i am pasting my code here import java.sql.DriverManager; import java.sql.SQLException; import java.util.Vector; import com.mysql.jdbc.Connection; class ConnectionPoolManager { String databaseUrl = "jdbc:mysql://localhost:3306/homeland"; String userName = "root"; String password = "root"; Vector connectionPool = new Vector(); public ConnectionPoolManager() { initialize(); } public ConnectionPoolManager( // String databaseName, String databaseUrl, String userName, String password) { this.databaseUrl = databaseUrl; this.userName = userName; this.password = password; initialize(); } private void initialize() { // Here we can initialize all the information that we need initializeConnectionPool(); } private void initializeConnectionPool() { while (!checkIfConnectionPoolIsFull()) { System.out .println("Connection Pool is NOT full. Proceeding with adding new connections"); // Adding new connection instance until the pool is full connectionPool.addElement(createNewConnectionForPool()); } System.out.println("Connection Pool is full."); } private synchronized boolean checkIfConnectionPoolIsFull() { final int MAX_POOL_SIZE = 5; // Check if the pool size if (connectionPool.size() &lt; 5) { return false; } return true; } // Creating a connection private Connection createNewConnectionForPool() { Connection connection = null; try { Class.forName("com.mysql.jdbc.Driver"); connection = (Connection) DriverManager.getConnection(databaseUrl, userName, password); System.out.println("Connection: " + connection); } catch (SQLException sqle) { System.err.println("SQLException: " + sqle); return null; } catch (ClassNotFoundException cnfe) { System.err.println("ClassNotFoundException: " + cnfe); return null; } return connection; } public synchronized Connection getConnectionFromPool…
has title: How to use connection pooling
has answer: http://stackoverflow.com/a/57180755
type: UnansweredQuestion
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/34327539
type: Question
has answer: http://stackoverflow.com/a/22549506
score: 0

http://stackoverflow.com/comment/34411508
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22601248
type: Comment
has text: Thanks for answering. That seems like a fine solution but is there no way to simply reference an Object in Java even though it belongs to another object?

http://stackoverflow.com/a/22612436
has comment: http://stackoverflow.com/comment/34458513
type: Answer
has comment: http://stackoverflow.com/comment/34435175
has comment: http://stackoverflow.com/comment/34435091
has comment: http://stackoverflow.com/comment/34434754
score: 0
answers question: http://stackoverflow.com/q/22610768
has body: public class UnreachableCatchBlock { public static void main(String[] args) { UnreachableCatchBlock ucb = new UnreachableCatchBlock(); System.out.println(ucb.getClass().getName() + " started."); // ucb.method1(); ucb.method2(); } private void method1() { try { System.out.println(getClass().getName() + ".method1() started."); } catch (FileNotFoundException e) {//any checked exception } } private void method2() { System.out.println(getClass().getName() + ".method2() started."); } } Above code compiles and runs as explained in @Raedwald answer. I don't suggest this as an answer, just a place to post the code that I attempted to include in comments.

http://stackoverflow.com/q/22595174
downvote count: 0
favorite count: 0
score: 79
answer count: 5
has answer: http://stackoverflow.com/a/22829362
has answer: http://stackoverflow.com/a/22639045
linked to: http://stackoverflow.com/q/34316162
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47170269
has comment: http://stackoverflow.com/comment/139461750
tagged with: youtube-api
possible better answer: http://stackoverflow.com/a/30249913
type: Question
has answer: http://stackoverflow.com/a/30249913
tagged with: google-oauth-java-client
accepted answer: http://stackoverflow.com/a/22829362
tagged with: java
tagged with: youtube-data-api
has body: I am trying to make an upload to YouTube from my Java based web app, I spent a few days to understand what and where is the problem and I cannot get it, for now I am pulling my hair out off my head. I registered my web app in Google Console, so I got a pair of Client ID and Secret and a possibility to download JSON type file with my config. So here is the config: { "web":{ "auth_uri":"https://accounts.google.com/o/oauth2/auth", "client_secret":"***", "token_uri":"https://accounts.google.com/o/oauth2/token", "client_email":"***", "redirect_uris":["http://localhost:8080/WEBAPP/youtube-callback.html","http://www.WEBAPP.md/youtube-callback.html"], "client_x509_cert_url":"***", "client_id":"***", "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs", "javascript_origins":["http://www.WEBAPP.md/"] } } How is possible that I am getting the default URL from Google? The redirect URI in the request: http://localhost:8080/Callback did not match a registered redirect URI It always gives me the default http://localhost:8080/Callback URL instead of mine. And IDE console shows me that: Please open the following address in your browser: https://accounts.google.com/o/oauth2/auth?client_id=***&amp;redirect_uri=http://localhost:8080/Callback&amp;response_type=code&amp;scope=https://www.googleapis.com/auth/youtube.upload Attempting to open that address in the default browser now... I am using the last version of dependencies: google-api-services-youtube v3-rev99-1.17.0-rc and google-api-services-youtubeAnalytics v1-rev35-1.17.0-rc
tagged with: google-oauth
has answer: http://stackoverflow.com/a/58042278
upvote count: 79
has title: Google OAUTH: The redirect URI in the request did not match a registered redirect URI

http://stackoverflow.com/q/22578655
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: paintcomponent
linked to: http://stackoverflow.com/q/2064427
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34370485
has title: Why is my paint method only calling every other time?
has body: I have a set of sprites that I am calling in a Java game, and when I had 3 sprites it worked fine, but when I add a fourth sprite, the repaint method is only called every other time. Here is my minimal example, Main class: public class Maze extends JPanel implements ActionListener{ /** * @param args */ int stage; int dir; int x = 32; int y = 32; Rectangle r = new Rectangle(x,y,10,10); Draw D = new Draw(); public static ArrayList&lt;Rectangle&gt; walls = new ArrayList&lt;Rectangle&gt;(); public ArrayList&lt;Image&gt; spritesl = new ArrayList&lt;Image&gt;(); public ArrayList&lt;Image&gt; spritesd = new ArrayList&lt;Image&gt;(); public ArrayList&lt;Image&gt; spritesr = new ArrayList&lt;Image&gt;(); public ArrayList&lt;Image&gt; spritesu = new ArrayList&lt;Image&gt;(); BufferedImage image; public Maze() throws IOException{ setBackground(Color.black); setSize(672,672); Timer timer = new Timer(2000,this); timer.addActionListener(this); timer.start(); //add sprites for(int i = 1; i&lt;5; i += 1){ spritesl.add(image = ImageIO.read(new File("C:/Users/Dave/Desktop/Sprites/left" + i + ".png"))); } for(int i = 1; i&lt;5; i += 1){ spritesd.add(image = ImageIO.read(new File("C:/Users/Dave/Desktop/Sprites/down" + i + ".png"))); } for(int i = 1; i&lt;5; i += 1){ spritesr.add(image = ImageIO.read(new File("C:/Users/Dave/Desktop/Sprites/right" + i + ".png"))); } for(int i = 1; i&lt;5; i += 1){ spritesu.add(image = ImageIO.read(new File("C:/Users/Dave/Desktop/Sprites/up" + i + ".png"))); } } public static void main(String[] args) throws IOException { JFrame frame = new JFrame(); Maze ate = new Maze(); frame.addKeyListener(new Input()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(ate); frame.setPreferredSize(new Dimension(688, 709));//16, 37 frame.setVisible(true); frame.pack(); } @Override public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; //call wall drawer g.setColor(Color.gray); D.draw(g); g.setColor…
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/34370515
has answer: http://stackoverflow.com/a/22579774
tagged with: image
tagged with: file-io

http://stackoverflow.com/a/22582252
type: Answer
accepted answer of: http://stackoverflow.com/q/22582128
answers question: http://stackoverflow.com/q/22582128
score: 0
type: AcceptedAnswer
has body: If the object that you are using is an instance of FreeThread, then calling object.letUsFinalise() will call the method from FreeThread. It looks like you are calling letUsFinalise() from the super class, so it's not possible to call the subclass' method unless you are using a static object to it (demonstrated below). public class SuperClass { public void method(){ Objects.object.method(); } } class SubClass extends SuperClass{ @Override public void method(){ System.out.println("I'm the sub class!"); } } class Objects{ public static SubClass object = new SubClass(); } I suggest that you create a static object of FreeThread and use that to call the method, as shown above.

http://stackoverflow.com/comment/34378182
score: 2
has text: for better help sooner post an SSCCE/MCVE/MCTRE, short runnable, compilable, with creating image from void, class
comment on: http://stackoverflow.com/q/22580736
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22526571
tagged with: obfuscation
has comment: http://stackoverflow.com/comment/92721570
answer count: 0
upvote count: 3
tagged with: java
has title: Java (WAR file) obfuscation tool
type: Question
score: 3
has comment: http://stackoverflow.com/comment/34278227
linked to: http://stackoverflow.com/q/28690812
has body: We have a large enterprise web project that uses; JDK 1.7 JSF &amp; Primefaces Spring Framework MVC 3.1.1 Several Web Service clients Annotations (for spring rest services) We want to obfuscate the builded WAR file before deploying it on the customer's side. I have read several of tutorials and tried Proguard and JShrink but failed. Proguard gives several warnings such as: "Warning: class [WEB-INF/classes/web/util/XMLGregorianCalendarSerializer.class] unexpectedly contains class [web.util.XMLGregorianCalendarSerializer]" and Warning: there were 282 classes in incorrectly named files. Note that I am using NetBeans IDE 7.2.1 any plug in for it are also welcome. Any good tutorials or anyone can lead me?
downvote count: 0
tagged with: proguard
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22493057
answer count: 1
downvote count: 0
has title: Real logout BaseGameActivity
tagged with: android
favorite count: 0
score: 2
has body: I have an BaseGameActivity in which the user should get the possibility to really logout. Calling signOut(); is not enough since the next time the user starts the activity he automatically gets signed in again. But I want the activity to forget all account information such that when the user starts the activity again the activity asks him for his account information and needs the user's permission like the very first time. How is such a logout possible?
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26856648
tagged with: java
tagged with: google-play-services
type: Question
has comment: http://stackoverflow.com/comment/34393023

http://stackoverflow.com/q/22568027
answer count: 1
type: UnansweredQuestion
has title: Showing values in jTable B when selecting a record in jTable A
has comment: http://stackoverflow.com/comment/34351898
has comment: http://stackoverflow.com/comment/34352485
has comment: http://stackoverflow.com/comment/34351871
has comment: http://stackoverflow.com/comment/34352143
has comment: http://stackoverflow.com/comment/34352027
has comment: http://stackoverflow.com/comment/34352941
has answer: http://stackoverflow.com/a/22568525
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/34352622
has comment: http://stackoverflow.com/comment/34351932
has comment: http://stackoverflow.com/comment/34352796
has comment: http://stackoverflow.com/comment/34352326
type: Question
has body: I am trying to pass in a JTable object which has columns DiscountID and Name. I am basically trying to get a row of the first column which is selected in JTable A (a DiscountID) and upon this set data relating to this selected record in JTable B which is JTable5 in the rs.next() loop. The problem I have now is that since initially int row = table.getSelectedRow(); I'm having to set it to 0 to avoid an IndexOutOfBoundsException but then when I run the program JTable B will show information correlating to the first record in JTable A without any selection of data by me. I don't want any information to be displayed at all in JTable B until I select a record from JTable A whilst also avoiding the IndexOutOfBoundsException. It will be much appreciated if anyone can help me to fix this I've been trying hard to find a solution. Here is the code to my method: public static ArrayList&lt;FlexiBand&gt; getFlexiBands(JTable table, JTable table2) { ArrayList&lt;FlexiBand&gt; flexiband = new ArrayList&lt;FlexiBand&gt;(); try { Connection con = null; PreparedStatement stmt = null; ResultSet rs = null; con = DriverManager .getConnection("jdbc:mysql://localhost:3306/abpp034?user=abpp034&amp;password=120001772"); stmt = con .prepareStatement("SELECT UpperBound, PercentageRate FROM FlexiBand WHERE DiscountID = ?"); int row = table.getSelectedRow(); if (row == -1) { row = 0; for (int x = 0; x &lt; table2.getRowCount(); x++) { table2.setValueAt("", x, 0); table2.setValueAt("", x, 1); } } System.out.println(row); // This is printing me 0 meaning that row is still 0 System.out.println(table.getValueAt(row, 0)); // This means that row will be equal to 0 // when it goes to the next line. stmt.setObject(1, table.getValueAt(row, 0)); try { rs = stmt.executeQuery(); int i = 0; while (rs.next()) { FlexiBand fb = new FlexiBand(); fb.setUpperBound(rs.getInt("UpperBound")); fb.setPercentageRate(rs.getInt("PercentageRate")); flexiband.add(fb); } } finally { if (rs != null) { try { rs.close(); } cat…
has comment: http://stackoverflow.com/comment/34353093
has comment: http://stackoverflow.com/comment/34352711
has comment: http://stackoverflow.com/comment/34352747
score: 0
has comment: http://stackoverflow.com/comment/34352577
tagged with: sql

http://stackoverflow.com/comment/34370332
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22578554
type: QuestionComment
has text: Have you enabled global debugging.

http://stackoverflow.com/q/22520404
favorite count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/2659952
has body: I have a search form with following fields price, status, owner When user fill all the fields, the request will be sent to the back-end to show a list of categories that have products with the specified price, status and owner. User is able to click on each category to see the list of its products. To implement it, I have following method to retrieve the categories, and put the search fields (price,status,owner) into session to be available in next page of the search ( when a category is selected). The value of the parameters might be so long, and I prefer to have them as GET to be easy to bookmark the results. public String retrieveCategories(){ //... here I retrieve categories which their products are matched //with the search fields Map session = ActionContext.getContext().getSession(); session.put("Items", this.items); return "SUCCESS"; } Once all categories are shown user is able to click on each to see their products. The name of category will be send to backend, so I will retrieve the values from session to search for products with the same specifications for the selected category. public String retrieveProductsOfSelectedCategory(){ Map session = ActionContext.getContext().getSession(); this.items = (Items) session.get("Items"); //... here I retrieve products of the selected category based on values retrieved // from session } I am wondering if it is a good practice to implement it if not whats your suggestion?
tagged with: session
tagged with: java
has title: Should I use session for implementing search box?
has answer: http://stackoverflow.com/a/22588921
type: Question
has comment: http://stackoverflow.com/comment/34268301
tagged with: struts2
has answer: http://stackoverflow.com/a/22736061
has comment: http://stackoverflow.com/comment/34275659
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22723454

http://stackoverflow.com/q/22551333
upvote count: 0
has answer: http://stackoverflow.com/a/22551352
has answer: http://stackoverflow.com/a/22551391
favorite count: 0
type: Question
has title: ArrayList does not give the get option to retrieve the data
has body: I create customer and computer arraylist from the existing cutomer and computer classes as belows ArrayList&lt;Customer&gt; customer = new ArrayList&lt;Customer&gt;(); ArrayList&lt;Computer&gt; computer = new ArrayList&lt;Computer&gt;(); But I don't available to get option to retrieve the data. Can anyone solve this problem?
has comment: http://stackoverflow.com/comment/34322272
score: -7
has comment: http://stackoverflow.com/comment/34322935
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/34322414
downvote count: 7
has answer: http://stackoverflow.com/a/22551380
has comment: http://stackoverflow.com/comment/34322318
type: UnansweredQuestion
tagged with: arraylist

http://stackoverflow.com/q/22610531
has answer: http://stackoverflow.com/a/22610618
tagged with: java
has comment: http://stackoverflow.com/comment/34427741
type: Question
has body: This is my code: private ArrayList&lt;Integer&gt; gradeList; public void addGrades(Scanner reader) { int grade = reader.nextInt(); if (grade != -1) { this.gradeList.add(grade); // --&gt; NullPointerException } } I can't figure out why I am getting a NullPointerException, because I have made methods like this often without this problem. I thought changing it to this: public void addGrades(Scanner reader) { int grade = Integer.parseInt(reader.nextLine()); while (true) { if (grade == -1) { break; } else { this.gradeList.add(grade); // --&gt; NullPointerException } } } would help, but it did not fix the problem. In both cases, the problem is on the line this.gradeList.add(grade). I also tried declaring the ArrayList to be null within the method before the loop, but realized that was redundant. So I'm not sure what I'm doing wrong.
has comment: http://stackoverflow.com/comment/34427700
has answer: http://stackoverflow.com/a/22610647
has answer: http://stackoverflow.com/a/22610614
tagged with: arraylist
score: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/22610640
has answer: http://stackoverflow.com/a/22611665
has title: Getting a NullPointerException when creating a method that adds to an ArrayList
answer count: 5
type: UnansweredQuestion

http://stackoverflow.com/a/74875819
answers question: http://stackoverflow.com/q/22527978
has body: Just an alternative way of testing, just filter class methods with PreAuthorize annotation. I made simple test generator @Test public void shouldCheckMethodsPreAuthorizeAnnotationValue() { List<Method> methods = Arrays.stream(YourControllerOrService.class.getDeclaredMethods()) .filter(method -> AnnotationUtils.getAnnotation(method, PreAuthorize.class) != null) .collect(Collectors.toList()); System.out.println(format("assertEquals(methodsMap.size(), %s);", methods.size())); Map<String, String> methodsMap = methods.stream() .map(method -> { PreAuthorize annotation = AnnotationUtils.getAnnotation(method, PreAuthorize.class); System.out.println(format("assertEquals(methodsMap.get(\"%s\"), \"%s\");", method.getName(), annotation.value())); return method; }) .collect(Collectors.toMap( Method::getName, method -> Objects.requireNonNull(AnnotationUtils.getAnnotation(method, PreAuthorize.class)).value() )); assertEquals(methodsMap.size(), 2); assertEquals(methodsMap.get("getMethod1"), "hasRole('ROLE_BLA_1')"); assertEquals(methodsMap.get("getMethod2"), "hasRole('ROLE_BLA_2')"); } The test covers all @PreAuthorize annotations. just remove unnecessary System.out after you have generated assertions.
downvote count: 0
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/134586184

http://stackoverflow.com/q/22609160
favorite count: 0
tagged with: rcaller
has answer: http://stackoverflow.com/a/23041334
has title: RCaller get matrix of unknown size
type: AnsweredQuestion
has body: I'm using RCaller in Java in order to execute an external R program. The problem is, that I don't know the exact size of the matrix but the .getAsDoubleMatrix() method wants to have the size. double[][] matrix = caller.getParser().getAsDoubleMatrix("result", DONT_KNOW, DONT_KNOW); Is there a way to keep the size dynamic?
accepted answer: http://stackoverflow.com/a/23041334
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/34443247
type: Comment
comment on: http://stackoverflow.com/q/22618120
score: 0
type: QuestionComment
has text: Do the location and size of entities have a correlation with their place in the array?

http://stackoverflow.com/comment/34212581
type: QuestionComment
has text: No, indeed...I am just deciding if I need them or I can save some space/dependancy. From the code it just seems that I could substitute everything with java.util. So I am asking in what do they differ and what advantages they bring
score: 0
comment on: http://stackoverflow.com/q/22488734
type: Comment

http://stackoverflow.com/comment/34405704
score: 0
comment on: http://stackoverflow.com/q/22597903
type: Comment
has text: What exactly is the difference? I don't think that I need to use my own implementation, but I think I do have a Node class that we used in a prior assignment.
type: QuestionComment

http://stackoverflow.com/comment/34457412
type: Comment
comment on: http://stackoverflow.com/a/22626862
has text: What? Even for `n=1000000` this should be a *lot* slower due to the unnecessary log-factor
score: 2
type: AnswerComment

http://stackoverflow.com/q/22629697
has comment: http://stackoverflow.com/comment/34463640
has title: Dynamically adding rows to JTable - Why do they appear at once?
type: Question
has answer: http://stackoverflow.com/a/22712149
tagged with: swingworker
has comment: http://stackoverflow.com/comment/34462882
downvote count: 0
has body: In the example, I'm seeking to add a table to my GUI and then dynamically add rows to it (to show the progress). What I don't understand is why all the rows are appearing at once. I mean, the the table's changing, isn't it? Can someone please give me an explanation? import java.awt.Component; public class Main { public static void main(String[] args) { // Show GUI java.awt.EventQueue.invokeLater(new Runnable() { public void run() { GUI gui = new GUI(); gui.setVisible(true); DefaultTableModel model = new DefaultTableModel( new String[] { "Column 1", "Column 2" }, 0); JTable table = new JTable(model); gui.add(table); gui.validate(); for (int i = 0; i &lt; 10; i++) { System.out.println("Row " + i); model .addRow(new String[] { "Row", String.valueOf(i) }); // model.fireTableDataChanged(); try { Thread.sleep(250); } catch (InterruptedException e) { e.printStackTrace(); } } } }); } } class GUI extends JFrame { private static final long serialVersionUID = 1L; public GUI() { setTitle("GUI"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 350, 100); setLocationRelativeTo(null); JPanel cp = new JPanel(); cp.setBorder(new EmptyBorder(10, 10, 10, 10)); setContentPane(cp); } }
tagged with: jtable
answer count: 3
tagged with: thread-sleep
has comment: http://stackoverflow.com/comment/34606126
linked to: http://stackoverflow.com/q/21354725
has answer: http://stackoverflow.com/a/22629717
accepted answer: http://stackoverflow.com/a/22712149
favorite count: 0
has comment: http://stackoverflow.com/comment/34609387
upvote count: 1
tagged with: swing
possible better answer: http://stackoverflow.com/a/22630452
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22630452
score: 1
tagged with: java

http://stackoverflow.com/comment/34526754
type: Comment
has text: I don't think so, for the simple fact that they shouldn't test _your_ code in the first place. Also I don't think they should mock the db, the should mock the repository. But this is a specific when dealing with persistence though, I don't think it applies to the fluent builder pattern as a whole, so it depends on the context :D
type: AnswerComment
comment on: http://stackoverflow.com/a/22648026
score: 0

http://stackoverflow.com/q/22539100
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34300881
type: Question
answer count: 1
has title: scheduleAtFixedRate-timer does not work (Android in Eclipse)
has comment: http://stackoverflow.com/comment/34300951
tagged with: illegalargumentexception
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34301783
tagged with: timer
type: UnansweredQuestion
has body: I am using a scheduleAtFixedRate-timer for my Android app in Eclipse, but it does not work: Timer t = new Timer(); t.scheduleAtFixedRate(task, (long) 0, (long) interval*1000); where interval can for example be 0.5. However, this works: Timer t = new Timer(); t.scheduleAtFixedRate(task, (long) 0, (long) 500); And a schedule-timer also works: Timer t = new Timer(); t.schedule(task, (long) interval*1000); I think this is strange and don't know why the emulator gives an illegalargumentexception. Can someone help me out? Edit: stack trace 03-20 12:29:54.080: E/AndroidRuntime(855): FATAL EXCEPTION: main 03-20 12:29:54.080: E/AndroidRuntime(855): Process: com.example.bulerias, PID: 855 03-20 12:29:54.080: E/AndroidRuntime(855): java.lang.IllegalArgumentException 03-20 12:29:54.080: E/AndroidRuntime(855): at java.util.Timer.scheduleAtFixedRate(Timer.java:526) 03-20 12:29:54.080: E/AndroidRuntime(855): at com.example.bulerias.MainActivity$1.onClick(MainActivity.java:92) 03-20 12:29:54.080: E/AndroidRuntime(855): at android.view.View.performClick(View.java:4424) 03-20 12:29:54.080: E/AndroidRuntime(855): at android.view.View$PerformClick.run(View.java:18383) 03-20 12:29:54.080: E/AndroidRuntime(855): at android.os.Handler.handleCallback(Handler.java:733) 03-20 12:29:54.080: E/AndroidRuntime(855): at android.os.Handler.dispatchMessage(Handler.java:95) 03-20 12:29:54.080: E/AndroidRuntime(855): at android.os.Looper.loop(Looper.java:137) 03-20 12:29:54.080: E/AndroidRuntime(855): at android.app.ActivityThread.main(ActivityThread.java:4998) 03-20 12:29:54.080: E/AndroidRuntime(855): at java.lang.reflect.Method.invokeNative(Native Method) 03-20 12:29:54.080: E/AndroidRuntime(855): at java.lang.reflect.Method.invoke(Method.java:515) 03-20 12:29:54.080: E/AndroidRuntime(855): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777) 03-20 12:29:54.080: E/AndroidRuntime(855): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) 03-20 12:29:54.080: …
has comment: http://stackoverflow.com/comment/34301172
has answer: http://stackoverflow.com/a/22539622
tagged with: java
has comment: http://stackoverflow.com/comment/34301472

http://stackoverflow.com/q/22596272
type: UnansweredQuestion
upvote count: 1
tagged with: libgdx
score: 1
tagged with: java
has body: I have a football player image who will kick a ball when user touches the screen. Not touch and hold just simple touch. So when user touches i need to start a libgdx animation which is in my create() method. I need to draw this animation in render(). So my code will be like this in render() method: elapsedTime += Gdx.graphics.getDeltaTime(); if(Gdx.input.isTouched()) { if(lr.contains(Gdx.input.getX(), Gdx.input.getY())){ batch.begin(); batch.draw(kickAnimation.getKeyFrame(elapsedTime, false), 0, 0); batch.end(); } } But i am not getting desired result. Am i conceptually correct? I am a javascript guy. This is a very simple problem to think about. I need to know the concept of making event based animation in libGDX way. Thanks.
has comment: http://stackoverflow.com/comment/34403811
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34402703
favorite count: 0
has title: I need to understand- on touch starting an animation in libgdx- basic concept
tagged with: android
has comment: http://stackoverflow.com/comment/39549018
has comment: http://stackoverflow.com/comment/34415448
has comment: http://stackoverflow.com/comment/34403055
has comment: http://stackoverflow.com/comment/34403238
answer count: 0
has comment: http://stackoverflow.com/comment/34402641

http://stackoverflow.com/a/22500366
has comment: http://stackoverflow.com/comment/34236112
type: AcceptedAnswer
downvote count: 0
has body: While isAlive( ) is occasionally useful, the method that you will more commonly use to wait for a thread to finish is called join( ) I don't understand. Why, according to you, join() is more commonly used than isAlive()? Do you have a proof for that? They are two different methods defined for the Thread class: isAlive(): Tests if this thread is alive. A thread is alive if it has been started and has not yet died. join(): Waits for this thread to die. One method performs a check, the other one waits for death of thread. You'll use isAlive(), when you want to perfom a check about the life of a thread, without waiting, and it will return a boolean value about the status of thread. You'll use join() if you want to wait for the death of thread. The meaning is that you want to wait for the completion of the task assigned to the thread.
type: Answer
has comment: http://stackoverflow.com/comment/34234417
accepted answer of: http://stackoverflow.com/q/22500127
upvote count: 3
answers question: http://stackoverflow.com/q/22500127
score: 3

http://stackoverflow.com/comment/34407048
score: 0
type: AnswerComment
has text: So when left and right are equal the if block won't be entered. I understand that. But when is the second recursive call ever actually called?
type: Comment
comment on: http://stackoverflow.com/a/22598662

http://stackoverflow.com/q/22603095
has comment: http://stackoverflow.com/comment/34414674
score: 2
answer count: 1
favorite count: 0
has title: Increacing the speed of thread
has answer: http://stackoverflow.com/a/22603303
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: multithreading
tagged with: swing
has body: After every call of thread it's speed is increased (specifically - FirstCircleRepaintThread, SecoundCircleRepaintThread, LineRepaintThread). But the main thread's speed is normal. I've read this question, but my thread's speed is always increasing. GitHub, JAR on Dropbox P.S. Sorry for my bad english
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34414810
accepted answer: http://stackoverflow.com/a/22603303

http://stackoverflow.com/comment/34223038
has text: There is fair amount of synchronisation in the code. I have put the CPU usage stats, if that helps.
score: 0
comment on: http://stackoverflow.com/q/22494484
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34321201
type: QuestionComment
has text: The console log is also empty..I guess there is some logical error I need to process the if loop only after the completion of returnCode = p.waitFor(); but how do I do it?
score: 0
comment on: http://stackoverflow.com/q/22539973
type: Comment

http://stackoverflow.com/comment/34358600
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22571324
type: Comment
has text: This is basically what a SwingWorker does. It creates a separate Thread and allows you to publish results so that the code is executed on the EDT.

http://stackoverflow.com/q/22560615
has answer: http://stackoverflow.com/a/22562195
accepted answer: http://stackoverflow.com/a/22562195
has answer: http://stackoverflow.com/a/22561594
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37558375
tagged with: java
linked to: http://stackoverflow.com/q/6933464
has title: can we do spring generic mapping to views?
type: Question
possible better answer: http://stackoverflow.com/a/22561594
has body: I am new to spring. What i want is i will be having various jsp pages and i will map user request to those JSP pages.My question is "can we map user requests to jsp pages when request url and jsp names are same using spring controller mapping".I searched and not found anything. like without writing controller &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt; &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /&gt; &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt; &lt;property name="suffix" value=".jsp" /&gt; &lt;/bean&gt;
score: 0
answer count: 2

http://stackoverflow.com/a/42442012
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22592366
score: 2
has body: Transparent encryption/decryption If your database supports transparent encryption/decryption, that's probably the best thing to do. Jasypt Another option is to use you can use Jasypt, which offers a wide range of Hibernate Types to encrypt/decrypt data. Using a @ColumnTransformer A very easy way to encrypt/decrypt an entity attribute is to use a @ColumnTransformer like this: @ColumnTransformer( read = """ pgp_sym_decrypt( storage, current_setting('encrypt.key') ) """, write = """ pgp_sym_encrypt( ?, current_setting('encrypt.key') ) """ ) @Column(columnDefinition = "bytea") private String storage; This way, Hibernate will be able to encrypt the entity attribute when you persist or merge it and decrypt it upon fetching the entity.
downvote count: 0

http://stackoverflow.com/q/22637913
score: 0
has title: Delete all tables of Database
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/22639361
type: AnsweredQuestion
tagged with: java
has body: I have a Database named KG. I want to delete all tables in this Database using java and then create them again (purpose is to truncate ALL data. Deleting tables as per advice of someone here at stackoverflow). What i need is a single command that can delete all tables. From this link i took this command Drop Database KG This command is not working with my case. Is there any other way to delete all Tables? Editted Code I am Using is { dbConnect(); try { stmt = c.createStatement(); sql = "Drop Database KG"; stmt.executeUpdate(sql); c.commit(); stmt.close(); c.close(); System.out.println("Database Deleted!"); } catch (SQLException e) { System.err.println("Delete Database Query: " + sql); System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } } and public void dbConnect() { try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:KG.s3db"); c.setAutoCommit(false); System.out.println("Connected"); } catch (ClassNotFoundException | SQLException e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } } Error i am getting is Delete Database: Drop Database KG java.sql.SQLException: near "Database": syntax error Note: I have achieved it but by writing a large number of Lines of Code. Used command Drop Table If Exists tablename did this in loop.
type: Question
has comment: http://stackoverflow.com/comment/34476621
has comment: http://stackoverflow.com/comment/34477633
has comment: http://stackoverflow.com/comment/34476687
answer count: 1
has answer: http://stackoverflow.com/a/22639361

http://stackoverflow.com/comment/61775527
type: Comment
comment on: http://stackoverflow.com/a/23299977
type: AnswerComment
score: 4
has text: how would I do this in windows or linux?

eclipse
tags question: http://stackoverflow.com/q/22612401
tags question: http://stackoverflow.com/q/22624133
tags question: http://stackoverflow.com/q/22646841
tags question: http://stackoverflow.com/q/22506128
tags question: http://stackoverflow.com/q/22490936
tags question: http://stackoverflow.com/q/22619262
tags question: http://stackoverflow.com/q/22600960
tags question: http://stackoverflow.com/q/22560007
tags question: http://stackoverflow.com/q/22489022
tag name: eclipse
tags question: http://stackoverflow.com/q/22616565
tags question: http://stackoverflow.com/q/22523877
tags question: http://stackoverflow.com/q/22500131
tags question: http://stackoverflow.com/q/22500236
tags question: http://stackoverflow.com/q/22554693
tags question: http://stackoverflow.com/q/22523325
tags question: http://stackoverflow.com/q/22640257
tags question: http://stackoverflow.com/q/22539100
tags question: http://stackoverflow.com/q/22621262
tags question: http://stackoverflow.com/q/22638847
tags question: http://stackoverflow.com/q/22512698
tags question: http://stackoverflow.com/q/22630323
tags question: http://stackoverflow.com/q/22639127
tags question: http://stackoverflow.com/q/22558993
tags question: http://stackoverflow.com/q/22490207
tags question: http://stackoverflow.com/q/22527842
tags question: http://stackoverflow.com/q/22570727
tags question: http://stackoverflow.com/q/22497751
tags question: http://stackoverflow.com/q/22507104
tags question: http://stackoverflow.com/q/22522426
tags question: http://stackoverflow.com/q/22507482
tags question: http://stackoverflow.com/q/22524881
tags question: http://stackoverflow.com/q/22619456
tags question: http://stackoverflow.com/q/22636762
tags question: http://stackoverflow.com/q/22553004
tags question: http://stackoverflow.com/q/22496964
tags question: http://stackoverflow.com/q/22506519
tags question: http://stackoverflow.com/q/22572815
tags question: http://stackoverflow.com/q/22584427
tags question: http://stackoverflow.com/q/22548545
tags question: http://stackoverflow.com/q/22526831
tags question: http://stackoverflow.com/q/22529123
tags question: http://stackoverflow.com/q/22629455
tags question: http://stackoverflow.com/q/22584263
tags question: http://stackoverflow.com/q/22525162
tags question: http://stackoverflow.com/q/22589382
tags question: http://stackoverflow.com/q/22598229
tags question: http://stackoverflow.com/q/22620201
tags question: http://stackoverflow.com/q/22615359
tags question: http://stackoverflow.com/q/22594215
tags question: http://stackoverflow.com/q/22633752
tags question: http://stackoverflow.com/q/22600783
tags question: http://stackoverflow.com/q/22570167
tags question: http://stackoverflow.com/q/22597101
tags question: http://stackoverflow.com/q/22610825
tags question: http://stackoverflow.com/q/22537552
tags question: http://stackoverflow.com/q/22590256
tags question: http://stackoverflow.com/q/22635907
tags question: http://stackoverflow.com/q/22510425
tags question: http://stackoverflow.com/q/22584605
tags question: http://stackoverflow.com/q/22611503
tags question: http://stackoverflow.com/q/22639067
tags question: http://stackoverflow.com/q/22562960
tags question: http://stackoverflow.com/q/22504497
tags question: http://stackoverflow.com/q/22614515
tags question: http://stackoverflow.com/q/22561800
tags question: http://stackoverflow.com/q/22639490
tags question: http://stackoverflow.com/q/22583326
tags question: http://stackoverflow.com/q/22501573
tags question: http://stackoverflow.com/q/22605824
tags question: http://stackoverflow.com/q/22549125
tags question: http://stackoverflow.com/q/22515360
tags question: http://stackoverflow.com/q/22500558
tags question: http://stackoverflow.com/q/22531237
tags question: http://stackoverflow.com/q/22558284
tags question: http://stackoverflow.com/q/22513359
tags question: http://stackoverflow.com/q/22597719
tags question: http://stackoverflow.com/q/22589302
tags question: http://stackoverflow.com/q/22489486
tags question: http://stackoverflow.com/q/22582607

http://stackoverflow.com/comment/34463004
type: Comment
type: QuestionComment
score: 1
has text: @ghoshak The second of those duplicates is a perfect match, good spot. The first is not a duplicate at all.
comment on: http://stackoverflow.com/q/22630098

http://stackoverflow.com/a/22542424
score: 0
answers question: http://stackoverflow.com/q/22541519
type: Answer
has body: Try, I just implement your logic by using string operations. String string = "a\\,b\\\\,c,d\\\\\\,e,f\\\\g"; String finalString = ""; for(String i : string.split(",")){ int count = 0; for(int j=0;j&lt;i.length();j++) if(i.charAt(j) == '\\') count++; finalString+=(count%2==0)?","+i+"$":","+i; } for(String finalAns: finalString.split("\\$")){ System.out.println(finalAns.replaceFirst(",", "")); } Output: a\,b\\ c d\\\,e f\\g

http://stackoverflow.com/a/22531520
has comment: http://stackoverflow.com/comment/34287139
score: 0
has comment: http://stackoverflow.com/comment/34287311
has comment: http://stackoverflow.com/comment/34289361
has comment: http://stackoverflow.com/comment/34289682
accepted answer of: http://stackoverflow.com/q/22531383
has comment: http://stackoverflow.com/comment/34287558
has comment: http://stackoverflow.com/comment/34286934
has body: obj[i] is null. Initialize it to Chef instance. You have just created an array which will contain objects of type Chef. But, you haven't actually created any instance of Chef. So, create a new Instance of Chef in the loop and assign the fields of it later for(int i=0;i&lt;2;i++) { obj[i] = new Chef(); System.out.println("for the object "+i+" enter the name "); obj[i].name=input.next(); System.out.println("for the object "+i+" enter the city "); obj[i].city=input.next(); System.out.println("for the object "+i+" enter the value "); obj[i].value=input.nextInt(); } also change the filepointer to write onto to a .txt instead of .docx file
has comment: http://stackoverflow.com/comment/34290310
answers question: http://stackoverflow.com/q/22531383
has comment: http://stackoverflow.com/comment/34289955
has comment: http://stackoverflow.com/comment/34290626
has comment: http://stackoverflow.com/comment/34289564
has comment: http://stackoverflow.com/comment/34303836
has comment: http://stackoverflow.com/comment/34287014
has comment: http://stackoverflow.com/comment/34287803
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34320290
has comment: http://stackoverflow.com/comment/34303686
type: Answer
has comment: http://stackoverflow.com/comment/34288292
has comment: http://stackoverflow.com/comment/34287705
has comment: http://stackoverflow.com/comment/34287915

http://stackoverflow.com/comment/34365285
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22575464
has text: Why use else if? This block only gets executed, when the byte read is not an ASCII character. From what I understand, you want to append a newline after every 64 chars. Also, do you mean "after 64 chars read" or "after 64 ASCII chars"?
score: 1

http://stackoverflow.com/q/22522945
tagged with: javascript
answer count: 1
downvote count: 0
tagged with: cas
favorite count: 0
has answer: http://stackoverflow.com/a/22542158
tagged with: node.js
type: AnsweredQuestion
score: 1
has title: Using Java in Sails.js applications
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22542158
tagged with: sails.js
has body: I'm currently trying to integrate the CAS (Central Authentication Service) client into a web application that I built off of Sails.js. It seems that the CAS client that I need to integrate into my web app is Java-based or PHP-based. Are there any options to integrate CAS into my web app? I tried searching for solutions but only found a node-java module for Node.js, which I'm not sure is completely compatible with Sails.js (are all Node.js modules compatible with Sails.js since Sails is just a framework for Node.js?).

http://stackoverflow.com/comment/34447345
type: Comment
comment on: http://stackoverflow.com/q/22614795
score: 0
has text: As far as I can tell, all of the code is in Swing and there is no JavaFX code at all, so the [javafx] tag and the JavaFX reference in the title should be removed?
type: QuestionComment

http://stackoverflow.com/q/22634482
accepted answer: http://stackoverflow.com/a/23025333
upvote count: 15
favorite count: 0
has title: start virtual tour with gmaps v2 for android
tagged with: android
tagged with: virtual-tour
has answer: http://stackoverflow.com/a/23025333
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
tagged with: google-maps
score: 15
has body: is there a way to open a virtual tour with google maps api v2 for Android? (something similar to this: https://www.google.com/maps/@37.772031,-122.432005,3a,75y,12.85h,79.63t/data=!3m5!1e1!3m3!1srR8mp3c5XZoAAAAGOphoBg!2e0!3e2 ) I would like to click on a place in a gmap and offer the possibility (among other informations) to open a virtual tour (even in a webview, but how can I create the above link?)
answer count: 1

http://stackoverflow.com/a/22552196
score: 6
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/22552131
has body: I would just do: rootPanel.add(new Label("© 2014 MyCorp")); or using HTML: rootPanel.add(new HTML("&amp;copy; 2014 MyCorp"));
downvote count: 0

http://stackoverflow.com/a/22502930
answers question: http://stackoverflow.com/q/22499119
has comment: http://stackoverflow.com/comment/34237856
upvote count: 1
has comment: http://stackoverflow.com/comment/34245453
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34237805
has body: This is one of way how to do some background processing in android. There are also some like Handlers, AsyncTasks Service and maybye some that I don't know already Proper approach to do async stuff in android depedns on the kind of work to do. If you do some stuff constantly you simple create service as you did. If you want to run sth smaller one shot taks you can create Handler or AsyncTask. Like I said it depends on the sort of work that you would like to do in background.
score: 1
accepted answer of: http://stackoverflow.com/q/22499119

http://stackoverflow.com/a/22643472
accepted answer of: http://stackoverflow.com/q/22633668
answers question: http://stackoverflow.com/q/22633668
type: AcceptedAnswer
downvote count: 0
has body: This is a bug in the Spring Security Java Configuration that impacts the global authentication option. See SEC-2533 for details. There is not a real easy work around for this issue, but the bug is already fixed and a release will be out within the next few days.
type: Answer
upvote count: 4
score: 4

http://stackoverflow.com/comment/35827934
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22581379
has text: I think gson-parser can not do deep-marshalling of hashmaps. It works smoothly with primitive types only, not more. Your no-constructor exception means, that you need to define a default no-arg constructor in each of your classes
score: 0

http://stackoverflow.com/q/22567471
has answer: http://stackoverflow.com/a/22568086
accepted answer: http://stackoverflow.com/a/22568086
has comment: http://stackoverflow.com/comment/34351781
score: 1
tagged with: java
has title: Stuck on Java Recursion Puzzle
has comment: http://stackoverflow.com/comment/34357512
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34359433
upvote count: 2
possible better answer: http://stackoverflow.com/a/22568391
has body: I am new to java and I have recently decided to learn recursion. There is this puzzle that I must solve using a recursive method. The puzzle is a list on integers where you start at the first element and the goal is to reach the last element, that is always zero. Now you have to move right or left in the list and number of times you can do so is determined by the element you are currently on. You cannot move outside the list either, and cannot use subList. My method is suppose to see if the given puzzle is solvable. Current code has StackoverFlow and I have no idea how to fix it
has comment: http://stackoverflow.com/comment/34351020
downvote count: 1
has comment: http://stackoverflow.com/comment/34350507
favorite count: 0
has comment: http://stackoverflow.com/comment/34350497
has comment: http://stackoverflow.com/comment/34353351
has comment: http://stackoverflow.com/comment/34350736
has comment: http://stackoverflow.com/comment/34351071
has comment: http://stackoverflow.com/comment/34350518
has comment: http://stackoverflow.com/comment/34358992
tagged with: recursion
has answer: http://stackoverflow.com/a/22568391
type: AnsweredQuestion

http://stackoverflow.com/comment/34273251
has text: what do you mean by "file itself"?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22523493

http://stackoverflow.com/a/22532168
has body: In Android, I am facing many time convert Bitmap to String and String to Bitmap. When send or receive Bitmap to server and storing Image in database. Bitmap to String: public String BitMapToString(Bitmap bitmap){ ByteArrayOutputStream baos=new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG,100, baos); byte [] arr=baos.toByteArray(); String result=Base64.encodeToString(arr, Base64.DEFAULT); return result; } String to Bitmap: public Bitmap StringToBitMap(String image){ try{ byte [] encodeByte=Base64.decode(image,Base64.DEFAULT); Bitmap bitmap=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length); return bitmap; }catch(Exception e){ e.getMessage(); return null; } }
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/92330202
score: 1
answers question: http://stackoverflow.com/q/22532136

http://stackoverflow.com/q/22556815
score: 1
tagged with: java
upvote count: 1
tagged with: scrollbar
has comment: http://stackoverflow.com/comment/34333327
type: Question
has body: Hello I am trying to make use of a scroll bar depending on the number of tabs that are comprised in a JTabbedPane. I have set the following code: JTabbedPane jtp = new JTabbedPane(); jtp.setTabPlacement(JTabbedPane.LEFT); JScrollPane sp = new JScrollPane(jtp); My program works, however the tabs extensions doesn't match my expectations. I have: Tab1 Tab2 Tab3 After adding enough tabs so that their summed size get larger than my panel, they grow into a new line and the horizontal scrollbar appears: Tab31 Tab1 Tab32 Tab2 Tab33 Tab3 ... Tab30 &lt;--------horizontal ScrollBar??---------&gt; What I want is that tabs keep growing from top to bottom and the Vertical scroll bar appears: Tab1 Tab2 Tab3 ... Tab30 Tab31 How can I do that? HEre you will find an adapted piece of my program: package eventListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class TabbedPane extends JFrame { private JTabbedPane jtp; public static void main(String [] args) { System.out.println("-----\nTest TabbedPane\n------\n"); TabbedPane tp = new TabbedPane(); tp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tp.setSize(300, 600); tp.setVisible(true); } public TabbedPane() { //constructor for the tabbed frame you will be creating //This will create the title you see in the upper left of the window setTitle("Tabbed Pane"); //Here we are creating the object jtp = new JTabbedPane(); jtp.setTabPlacement(JTabbedPane.LEFT); JScrollPane sp = new JScrollPane(jtp); //sp.add(jtp); //This creates the template on the windowed application that we will be using getContentPane().add(sp); JPanel jp1 = new JPanel();//This will create the first tab JPanel jp2 = new JPanel();//This…
has comment: http://stackoverflow.com/comment/34331443
linked to: http://stackoverflow.com/q/7481991
downvote count: 0
has comment: http://stackoverflow.com/comment/34332679
favorite count: 0
tagged with: jtabbedpane
type: UnansweredQuestion
tagged with: swing
answer count: 0
has title: Associate JTabbedPane and JScrollPane

http://stackoverflow.com/a/22621359
downvote count: 0
answers question: http://stackoverflow.com/q/22621309
type: Answer
has body: If this is the only thing your client will do, you don't need a separate thread. Otherwise, yes, you need one background thread to handle these tasks which would free the main thread to do other things. To create a thread, the most basic way is to extend Thread or implement Runnable. See also: http://docs.oracle.com/javase/tutorial/essential/concurrency/
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34448034
has comment: http://stackoverflow.com/comment/34448001

http://stackoverflow.com/q/22555301
has comment: http://stackoverflow.com/comment/34337853
downvote count: 0
favorite count: 0
has title: In IDEA 13.1 test classes are not updated
has body: I've updated to IntelliJ IDEA 13.1 yesterday and I have a problem running unit test in a maven project. The tests work fine if compiling whole project but when I modify a code and run a single test(or single test class), the changes in the code are not reflected. I see the message "make" in the progress bar on bottom of the screen, but it looks like nothing is actually compiled. So I've tried to create a simple test case to verify the problem like this: package my.company.project; import org.junit.Test; public class Bug { @Test public void testBug() throws Exception{ String bug = "ABC"; System.out.println(bug); } } But when I wanted to run the test, I got a message that the class my.company.project.Bug was not found. When I compile the whole project, the test is ok. Problem appears on version 135.475 (13.1) Previous version(OK) 133.696 (13.02) Both are Ultimate
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34328631
tagged with: maven
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/34338266
tagged with: java
has comment: http://stackoverflow.com/comment/34352131
type: Question
score: 2
tagged with: intellij-idea

http://stackoverflow.com/q/22622296
tagged with: java
has answer: http://stackoverflow.com/a/22630818
tagged with: swing
has comment: http://stackoverflow.com/comment/34473177
has comment: http://stackoverflow.com/comment/34449400
type: Question
tagged with: jtable
tagged with: encoding
linked to: http://stackoverflow.com/q/499010
has comment: http://stackoverflow.com/comment/34463914
upvote count: 1
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34462719
favorite count: 0
has body: I am loading a file, getting a line from it and putting it in a jTable the jTable shows some of my charcters as square boxes. answers I found online: 1. it's how the file is opened, so I changed BufferedReader bf = new BufferedReader(new FileReader(filename)); into BufferedReader bf = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF8")); I also tried Charset instead of the string 2. it's the font, so I tried jTable1.setFont(new Font("Times New Roman", Font.BOLD, 12)); I tried other fonts, like Arial, David, ... Can you think of any other reason?? By nachokk's request, here's my code: int linecount = 0; String line = null; BufferedReader bf = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF8")); DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); while ((line = bf.readLine()) != null) { linecount++; model.addRow(new Object[]{filename, linecount, line}); }
type: UnansweredQuestion
has title: jTable Encoding in Java
tagged with: utf-8
score: 1

http://stackoverflow.com/q/22626977
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
tagged with: java
has body: I having List data inside HashMap. i need to show the List on ListView. i added AddTextChangeListener to my editText on top of ListView. I need to filter the List according to my Search string. How i can add filter to my HashMap List?
type: Question
has comment: http://stackoverflow.com/comment/34508739
upvote count: 2
has comment: http://stackoverflow.com/comment/34457875
downvote count: 1
favorite count: 0
has title: How to sort an HashMap using filterable.I need to get a list associate with my key search strings

http://stackoverflow.com/a/79115177
answers question: http://stackoverflow.com/q/22520327
type: Answer
has body: In my case was that I used default root layout id for inflater val contentView = findViewById&lt;ViewGroup&gt;(android.R.id.content) inflater.inflate(R.layout.custom_toast, contentView) I fixed it by passing null ( otherwise you have to pass actual root view id of your layout) inflater.inflate(R.layout.custom_toast, null) It avoids unnecessary complexity, and it's the correct approach since the custom Toast view won't be part of a parent ViewGroup.
score: 0

http://stackoverflow.com/q/22525074
tagged with: java
has answer: http://stackoverflow.com/a/22525284
downvote count: 1
type: Question
has title: Activity crashes when onStart (onRestart) goes after onCreate
accepted answer: http://stackoverflow.com/a/22525284
has body: I am developing my first Android app (having an experience of developing in other systems e.g. Visual Basic). A strange error occurs: when I use onStart method after onCreate in java activity class, the activity immediately crashes on its start. Whereas everything works fine without the onStart (with onCreate only). The same thing is when I put onRestart instead of onStart. It occurs at me in two different activities, Main and Help, which are not similar. Matters why I need to use onStart (onRestart): in MainActivity I wish to fadein layout each time it appears, on the first load and after return from other activities, HelpActivity inflates additional child views with help pages in the same frame (ScrollView), but on device rotation it throws back to Help TOC, initially set to the frame in onCreate. It's not what user would like, you see. Codes and Logcat are applied. I use old e-reader Pocketbook iq 701 with Android 2.0.1 (plugged via USB) and third-party emulator YouVawe, and error appears on both. If anyone had faced to the same problem, please tell is this an Android bug or am I doing something wrong. Maybe I could overwork it, but the conventional way according to docs blablabla, will be preferable and more convenient. Thanx in advance! MainActivity: public class MainActivity extends Activity { public Animation fadeIn; public View mainView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mainView=(View)findViewById(R.id.linearLayoutMain); mainView.setVisibility(View.INVISIBLE); //to fadein later //fade-in animation to use on activity (re)start fadeIn = AnimationUtils.loadAnimation(this, R.anim.fadein); } @Override protected void onStart() { super.onStart(); mainView.setVisibility(View.INVISIBLE); mainView.startAnimation(fadeIn); mainView.setVisibility(View.VISIBLE); } HelpActivity: public class HelpActivity extends Activity { public LinearLayout layoutHelpFrame; public Vi…
has comment: http://stackoverflow.com/comment/34277723
has comment: http://stackoverflow.com/comment/34275812
has comment: http://stackoverflow.com/comment/34275827
answer count: 1
favorite count: 0
tagged with: onstart
tagged with: android
tagged with: android-activity
type: AnsweredQuestion
upvote count: 2
score: 1

gradle
tags question: http://stackoverflow.com/q/22566642
tags question: http://stackoverflow.com/q/22509638
tags question: http://stackoverflow.com/q/22535280
tags question: http://stackoverflow.com/q/22617269
tags question: http://stackoverflow.com/q/22502720
tags question: http://stackoverflow.com/q/22498726
type: Tag
tags question: http://stackoverflow.com/q/22567831
tags question: http://stackoverflow.com/q/22516291
tags question: http://stackoverflow.com/q/22617743
tags question: http://stackoverflow.com/q/22646486
tags question: http://stackoverflow.com/q/22622952
tag name: gradle
tags question: http://stackoverflow.com/q/22619293
tags question: http://stackoverflow.com/q/22528114
tags question: http://stackoverflow.com/q/22544249
tags question: http://stackoverflow.com/q/22605947
tags question: http://stackoverflow.com/q/22556070
tags question: http://stackoverflow.com/q/22550761
tags question: http://stackoverflow.com/q/22558160
tags question: http://stackoverflow.com/q/22538210
tags question: http://stackoverflow.com/q/22584869

http://stackoverflow.com/a/22623538
has comment: http://stackoverflow.com/comment/34452165
has comment: http://stackoverflow.com/comment/34490305
has comment: http://stackoverflow.com/comment/34451855
accepted answer of: http://stackoverflow.com/q/22623515
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34453466
has comment: http://stackoverflow.com/comment/34453373
has comment: http://stackoverflow.com/comment/34452260
has comment: http://stackoverflow.com/comment/34452339
type: Answer
has comment: http://stackoverflow.com/comment/34452131
answers question: http://stackoverflow.com/q/22623515
score: 2
has comment: http://stackoverflow.com/comment/34452943
has body: Basically, you could add the JTextText onto a JPanel with another JPanel which acts a filler, causing the JTextArea to occupy the smallest space it actually needs. I did this by using GridBagLayout to force the fill to occupy the most of space it could... import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestTextArea { public static void main(String[] args) { new TestTextArea(); } public TestTextArea() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new JScrollPane(new TestPane())); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private JTextArea ta; public TestPane() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 1; gbc.weighty = 1; gbc.fill = GridBagConstraints.BOTH; JPanel filler = new JPanel(); filler.setBackground(Color.WHITE); add(filler, gbc); gbc.gridy = 1; gbc.weighty = 0; ta = new JTextArea(1, 20); add(ta, gbc); } } }
upvote count: 2
has comment: http://stackoverflow.com/comment/34451831

http://stackoverflow.com/q/22549363
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22598199
type: Question
tagged with: mongoexport
answer count: 2
upvote count: 1
has body: I was trying to export the data from Mongo to Oracle. I used to below approach. Step 1 : Export the data to CS file usign mongoExport command. Step 2 : Read the data through a java code, do the necessary data transformation. Step 3 : Insert the data to Oracle Issue is that, when any of the comment section has a new line character ('\n'), the data is moving to next line and java read fails to process the document. There is a open bug with 10gen for this, JIRA. Has any one faced issue. Is there is a workaround for this ?
possible better answer: http://stackoverflow.com/a/22559628
tagged with: java
has answer: http://stackoverflow.com/a/22559628
tagged with: mongodb
has title: Mongoexport - Issue with "\n"
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22598199

http://stackoverflow.com/comment/34263044
type: QuestionComment
has text: HashSet is not sorted.
score: 0
comment on: http://stackoverflow.com/q/22517765
type: Comment

http://stackoverflow.com/q/22560817
has body: i have next classes: public class A { private int i; public void setI(int i){...} } public class B extends A { private int c; public void setC(int c){...} } and when i try to use setProperty: B b = new B(); PropertyUtils.setProperty(b, "i", 1); i get next error: java.lang.NoSuchMethodException: Property 'i' has no setter method in class 'class org.test.B' but if i try to assign value to field in class B : B b = new B(); PropertyUtils.setProperty(b, "c", 1); all is ok. So i get error only when i try to assign values to field declared in parent class. Anyone could help? Is it possible to do what i try to do with BeanUtils?
has comment: http://stackoverflow.com/comment/34340883
has comment: http://stackoverflow.com/comment/34342148
tagged with: parent
has comment: http://stackoverflow.com/comment/34343460
favorite count: 0
has comment: http://stackoverflow.com/comment/34339329
tagged with: apache-commons-beanutils
has comment: http://stackoverflow.com/comment/34341168
answer count: 0
type: UnansweredQuestion
has title: BeanUtils: how to set value to field in parent class?
score: 2
has comment: http://stackoverflow.com/comment/34339508
downvote count: 0
tagged with: java
type: Question
upvote count: 2

http://stackoverflow.com/comment/34414647
score: 5
type: Comment
type: QuestionComment
has text: You should really provide a *complete* example which others can try to reproduce the problem.
comment on: http://stackoverflow.com/q/22603062

http://stackoverflow.com/comment/34338981
has text: i need a listener in all page that call a function when the session time out.
comment on: http://stackoverflow.com/a/22557403
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/22622222
upvote count: 2
tagged with: implements
has comment: http://stackoverflow.com/comment/34449410
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22622313
tagged with: java
has answer: http://stackoverflow.com/a/22622313
has comment: http://stackoverflow.com/comment/34449329
has comment: http://stackoverflow.com/comment/34449218
has comment: http://stackoverflow.com/comment/34449332
type: Question
has body: I've been having a bit of trouble with this problem. The question: Write a complete Java program that does the following: declares interfaces I1 and I2, both with empty bodies declare interface I3 with an empty body, which extends both of the above interfaces declare interface I4 with an empty body class X implements I3 with an empty body class W with an empty body implements I4 and extends X create a class InstanceofTest that does the following in the main(): Create an object w of class W. Use the instanceof operator to test if the object w implements each of the interfaces and is of type X, and display the appropriate message. So this is what I've come up with so far: public interface I1 { } public interface I2 { } public interface I3 extends I1, I2 { } public interface I4 { } public class W extends X implements I4 { } I'm having a bit of confusion with the InstanceofTest method. I know that the instanceof operator would tell you if a certain object is an instance of a certain type, like when you do it like this: public class InstanceofTest { public static void main(String[] args) { W w = new W(); if (w instanceof X) { System.out.println("w is an instance of X."); } } } The problem I'm having is using instanceof to see if w implements each of the interfaces. I have no idea how I would go about doing that. Any help would be greatly appreciated! Edit: So, should I do it like this? public class InstanceofTest { public static void main(String[] args) { W w = new W(); if (w instanceof X) { System.out.println("w is an instance of X."); } if (w instanceof I1) { System.out.println("w implements I1."); } if (w instanceof I2) { System.out.println("w implements I2."); } if (w instanceof I3) { System.out.println("w implements I3."); } if (w instanceof I4) { System.out.println("w implements I4."); } } }
answer count: 2
has answer: http://stackoverflow.com/a/22622373
downvote count: 0
favorite count: 0
tagged with: interface
has comment: http://stackoverflow.com/comment/91836591
has comment: http://stackoverflow.com/comment/34449242
has title: Using instanceof to test interfaces
tagged with: instanceof
accepted answer: http://stackoverflow.com/a/22622373

http://stackoverflow.com/comment/44140808
score: 2
type: AnswerComment
has text: Note that since then I have developed something that may interest you; see [here](https://github.com/fge/java7-fs-more)
type: Comment
comment on: http://stackoverflow.com/a/22605905

http://stackoverflow.com/comment/34277048
comment on: http://stackoverflow.com/q/22525770
type: Comment
type: QuestionComment
has text: @AndrewThompson Cool, never been able to get them to work...
score: 0

http://stackoverflow.com/q/22606579
linked to: http://stackoverflow.com/q/21076179
type: UnansweredQuestion
tagged with: x509certificate
has body: now I looking for solution regarding task how to rewrite deprecated solution for client side x509 certificate authentication via HttpComponentsMessageSender (not relevant). For example, deprecated solution is: SSLSocketFactory lSchemeSocketFactory = new SSLSocketFactory(this.keyStore, this.keyStorePassword); Scheme sch = new Scheme("https", 443, lSchemeSocketFactory); DefaultHttpClient httpClient = (DefaultHttpClient)getHttpClient(); httpClient.getConnectionManager().getSchemeRegistry().register(sch); As new solution with CloseableHttpClient I am using: SSLContextBuilder sslContextBuilder = SSLContexts.custom() // this key store must contain the key/cert of the client .loadKeyMaterial(keyStore, keyStorePassword.toCharArray()); if (trustStore != null) { // this key store must contain the certs needed and trusted to verify the servers cert sslContextBuilder.loadTrustMaterial(trustStore); } SSLContext sslContext = sslContextBuilder.build(); LayeredConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext); // Create a registry of custom connection socket factories for supported // protocol schemes / https Registry&lt;ConnectionSocketFactory&gt; socketFactoryRegistry = RegistryBuilder.&lt;ConnectionSocketFactory&gt;create() .register("https", sslsf) .register("http", new PlainConnectionSocketFactory()) .build(); PoolingHttpClientConnectionManager connPoolControl = new PoolingHttpClientConnectionManager(socketFactoryRegistry); setConnPoolControl(connPoolControl); getClientBuilder().setSSLSocketFactory(sslsf); I still get 403 forbidden from server. But when I use "deprecated" version of the solution, it works great. SSL certificate is signed Thawte. Any idea? Thanks
tagged with: spring-ws
tagged with: java
has answer: http://stackoverflow.com/a/26159543
type: Question
has title: Apache HttpClient 4.3 and x509 client certificate to authenticate
has answer: http://stackoverflow.com/a/43857839
score: 5
linked to: http://stackoverflow.com/q/7885785
upvote count: 5
tagged with: httpclient
tagged with: ssl
has answer: http://stackoverflow.com/a/38313344
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/34227135
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22497222
has text: I can't believe we agree on that one ;)
score: 1

http://stackoverflow.com/comment/34375594
comment on: http://stackoverflow.com/a/22565520
type: AnswerComment
has text: If relationships do not imply transitivity, can there be dangers if references stored in `final` fields are stored to non-final fields [see edit to question for an example]?
score: 0
type: Comment

http://stackoverflow.com/comment/34293523
type: Comment
comment on: http://stackoverflow.com/a/22534943
score: 1
has text: Note that it would technically still work without the cast since `Integer.valueOf('1')` is `49`, which is even. Not a very good idea though.
type: AnswerComment

http://stackoverflow.com/comment/34242532
type: Comment
score: 2
has text: The two are not the same. The second one uses `min("c"."ts")` which is an aggregate function. And because there are other columns in the select list, a `group by` is required. The first statement only uses `c.ts` (without an aggregate). So the question is: why does JOOQ think it needs a `min()`?
comment on: http://stackoverflow.com/q/22505745
type: QuestionComment

http://stackoverflow.com/q/22577923
has title: Java: display time at user entered GMT offset
downvote count: 0
upvote count: 1
tagged with: timezone-offset
favorite count: 0
has answer: http://stackoverflow.com/a/79378106
tagged with: time
has body: I've got a problem to solve here and I don't know how? I have to do this : ShowCurrentTime.java, gives a program that displays the current time in GMT. Revise the program so that it prompts the user to enter the time zone offset to GMT and displays the time in the specified time zone. Here is a sample run: I've done so far the default GMT time, but I have no Idea whatsoever how to do it.. package ex; import java.util.*; import java.text.*; public class GMT { public static void main(String[] args) { final Date currentTime = new Date(); final SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM d, yyyy hh:mm:ss a z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); System.out.println("GMT time: " + sdf.format(currentTime)); } }
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: java-time
has comment: http://stackoverflow.com/comment/34382566
tagged with: date
type: Question
possible better answer: http://stackoverflow.com/a/79378106
answer count: 2
has answer: http://stackoverflow.com/a/22577993
accepted answer: http://stackoverflow.com/a/22577993

http://stackoverflow.com/a/22611047
accepted answer of: http://stackoverflow.com/q/22610768
answers question: http://stackoverflow.com/q/22610768
type: Answer
score: 11
upvote count: 11
has body: The compiler allows this because the throws clause of the method is part of the signature of the method, rather than part of its implementation. It is possible that the implementation might change at some point, while keeping the signature the same. An old implementation might have thrown a checked exception, but the new one might not. Or the designer of the signature might have wanted to give the implementer the flexibility to throw a checked exception when that is not always necessary.
has comment: http://stackoverflow.com/comment/34428940
has comment: http://stackoverflow.com/comment/34429252
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22564479
type: AcceptedAnswer
upvote count: 2
answers question: http://stackoverflow.com/q/22564240
type: Answer
score: 2
has body: You can override the method equal(Object obj) . public boolean equals(Object o) { if(o instanceof ZombieSprite) return ((ZombieSprite)o).x == this.x; return super.equals(o); } Then if you want to check if a zoombiesprite exists in theGameView.zombieSpriteList or not ( by x value) theGameView.zombieSpriteList.contains(...)
has comment: http://stackoverflow.com/comment/34345074
accepted answer of: http://stackoverflow.com/q/22564240
downvote count: 0

http://stackoverflow.com/comment/34257076
type: Comment
has text: It should ... but if you say the odd numbers up to 5 do you want 5 as an aditional odd number or only 1 and 3? If you want to add 5 you need counter < maxNum in your for loop
type: AnswerComment
comment on: http://stackoverflow.com/a/22514377
score: 0

http://stackoverflow.com/q/22605561
has comment: http://stackoverflow.com/comment/34419007
has body: I found a nice code on the web for drawing a binary tree. I created the binary search tree algorithm for it, now if I pass the root node for the function, it draws out my tree. I want to make it draw step by step, by running it in a thread, and making it sleep after inserting an element. Now the problem is, I guess, the JPanel itself won't be returned until the drawing is complete, so even if it runs on a different thread, it won't be added to my split pane ( I have many sorting algorithms implemented, and already being painted, and all can be accessed from the same tabbed pane. Every tabbed pane contains a split pane and every split pane contains the controlling buttons, and a jpanel, where I draw the algorithms, but the others do not extend from JPanel! ). Could you please help me find a way to run this in a totally different thread then the main program, and be able to see how it draws the tree? Please do not judge me on this code, I just put it together fast, trying to make it work, this is not the way I code. public class BinaryTree extends JPanel implements Runnable { private int radius = 20; private int vGap = 45, hGap = 150; private int x = 350, y = 25; private GraphNode root; private BinarySearchTreeSort binaryTreeSort; private int latency = 270; private boolean isManual = false; //Stores the sorting algorithm's instance public BinaryTree(BinarySearchTreeSort binaryTreeSort) { this.binaryTreeSort = binaryTreeSort; } @Override public void run() { //Maybe i should put here the paintComponent somehow??? root = binaryTreeSort.binaryTreeSort(); } @Override public void paintComponent(final Graphics g) { displayTree(g, root, x, y, hGap); } private void displayTree(Graphics g, GraphNode root, int x, int y, int hGap) { // Display the root while (!isStarted) { try { Thread.sleep(100); } catch (InterruptedException ex) { Logger.getLogger(BinaryTreeFrame.class.getName()).log(Level.SEVERE, null, ex); } } g.drawOval(x - radius, y - radius, 2 * radius, 2 * radius); if (ro…
has comment: http://stackoverflow.com/comment/34418913
type: UnansweredQuestion
tagged with: multithreading
tagged with: swing
answer count: 0
has comment: http://stackoverflow.com/comment/34459917
score: 0
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/34432362
type: Question
has comment: http://stackoverflow.com/comment/34425994
has title: JPanel paintComponent in a Thread

http://stackoverflow.com/comment/34472140
type: Comment
comment on: http://stackoverflow.com/a/22629460
has text: not at all. I've mentioned above I need a non logback based solution without the performance hit mentioned by the link you gave.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22637380
type: Question
tagged with: java
downvote count: 0
tagged with: runtime
favorite count: 0
tagged with: processbuilder
has title: Get Maven's module classpath at runtime
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
has body: I wan to run java app in different process, and use classpath of another maven module. How can I do that? I try that stuff: String separator = System.getProperty("file.separator"); String path = System.getProperty("java.home") + separator + "bin" + separator + "java"; ProcessBuilder processBuilder = new ProcessBuilder( path, "-cp", //System.getProperty("java.class.path"), ".." + separator + nodeProperties.getClasspath(), nodeProperties.getMainClass()); processBuilder.directory(new File(".." + separator + nodeProperties.getWorkingDir())); Map&lt;String, String&gt; env = processBuilder.environment(); env.put("jmx-port", "8000"); env.put("mode", "SUPER_PEER"); processBuilder.inheritIO(); try { Process process = processBuilder.start(); process.waitFor(); } catch (Exception e) { e.printStackTrace(); } System.out.println("SuperPeer stopped");
tagged with: maven
tagged with: classpath

http://stackoverflow.com/a/22590964
has body: Below program has implemented producer consumer scenario using BlockingQueue , you can use such approach while writing your own implementation. import java.util.concurrent.*; public class ThreadingExample { public static void main(String args[]){ BlockingQueue&lt;Message&gt; blockingQueue = new ArrayBlockingQueue&lt;Message&gt;(100); ExecutorService exec = Executors.newCachedThreadPool(); exec.execute(new Producer(blockingQueue)); exec.execute(new Consumer(blockingQueue)); } } class Message{ private static int count=0; int messageId; Message(){ this.messageId=count++; System.out.print("message Id"+messageId+" Created "); } } class Producer implements Runnable{ private BlockingQueue&lt;Message&gt; blockingQueue; Producer(BlockingQueue&lt;Message&gt; blockingQueue){ this.blockingQueue=blockingQueue; } @Override public void run(){ while(!Thread.interrupted()){ System.out.print("Producer Started"); try { blockingQueue.put(new Message()); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Producer Done"); } } } class Consumer implements Runnable{ private BlockingQueue&lt;Message&gt; blockingQueue; Consumer(BlockingQueue&lt;Message&gt; blockingQueue){ this.blockingQueue=blockingQueue; } @Override public void run(){ while(!Thread.interrupted()){ System.out.print("Concumer Started"); try{ Message message = blockingQueue.take(); System.out.print("message Id"+message.messageId+" Consumed "); } catch(InterruptedException e){ e.printStackTrace(); } System.out.println("Concumer Done"); } } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22492000

string
tags question: http://stackoverflow.com/q/22492225
tags question: http://stackoverflow.com/q/22599088
tags question: http://stackoverflow.com/q/22598051
tags question: http://stackoverflow.com/q/22518816
tags question: http://stackoverflow.com/q/22585683
tags question: http://stackoverflow.com/q/22640862
tags question: http://stackoverflow.com/q/22601720
tags question: http://stackoverflow.com/q/22605581
tags question: http://stackoverflow.com/q/22521144
tags question: http://stackoverflow.com/q/22534985
tags question: http://stackoverflow.com/q/22510764
tags question: http://stackoverflow.com/q/22582038
tags question: http://stackoverflow.com/q/22598294
tags question: http://stackoverflow.com/q/22571864
tags question: http://stackoverflow.com/q/22509523
tags question: http://stackoverflow.com/q/22547514
tags question: http://stackoverflow.com/q/22586379
tags question: http://stackoverflow.com/q/22546392
tags question: http://stackoverflow.com/q/22506823
tags question: http://stackoverflow.com/q/22597006
tags question: http://stackoverflow.com/q/22517074
tags question: http://stackoverflow.com/q/22505414
tags question: http://stackoverflow.com/q/22522558
tags question: http://stackoverflow.com/q/22539158
tags question: http://stackoverflow.com/q/22572090
tags question: http://stackoverflow.com/q/22623355
tags question: http://stackoverflow.com/q/22525742
tags question: http://stackoverflow.com/q/22573602
tags question: http://stackoverflow.com/q/22544818
tags question: http://stackoverflow.com/q/22535762
tags question: http://stackoverflow.com/q/22546537
tags question: http://stackoverflow.com/q/22640219
tags question: http://stackoverflow.com/q/22500072
tags question: http://stackoverflow.com/q/22640106
tags question: http://stackoverflow.com/q/22494948
tags question: http://stackoverflow.com/q/22518594
tags question: http://stackoverflow.com/q/22598754
tags question: http://stackoverflow.com/q/22600087
tags question: http://stackoverflow.com/q/22592872
tags question: http://stackoverflow.com/q/22612364
tags question: http://stackoverflow.com/q/22500236
tags question: http://stackoverflow.com/q/22493246
tags question: http://stackoverflow.com/q/22524687
tags question: http://stackoverflow.com/q/22645659
tags question: http://stackoverflow.com/q/22646555
tags question: http://stackoverflow.com/q/22625061
tags question: http://stackoverflow.com/q/22509242
tags question: http://stackoverflow.com/q/22496119
tags question: http://stackoverflow.com/q/22552208
tag name: string
tags question: http://stackoverflow.com/q/22572197
tags question: http://stackoverflow.com/q/22583939
tags question: http://stackoverflow.com/q/22630047
tags question: http://stackoverflow.com/q/22602113
tags question: http://stackoverflow.com/q/22507774
tags question: http://stackoverflow.com/q/22605225
tags question: http://stackoverflow.com/q/22561632
tags question: http://stackoverflow.com/q/22626982
tags question: http://stackoverflow.com/q/22540678
tags question: http://stackoverflow.com/q/22592612
tags question: http://stackoverflow.com/q/22561767
tags question: http://stackoverflow.com/q/22603438
tags question: http://stackoverflow.com/q/22601106
tags question: http://stackoverflow.com/q/22508715
tags question: http://stackoverflow.com/q/22549339
tags question: http://stackoverflow.com/q/22565517
tags question: http://stackoverflow.com/q/22636630
tags question: http://stackoverflow.com/q/22524065
tags question: http://stackoverflow.com/q/22505114
tags question: http://stackoverflow.com/q/22624948
tags question: http://stackoverflow.com/q/22572557
type: Tag
tags question: http://stackoverflow.com/q/22591637
tags question: http://stackoverflow.com/q/22512116
tags question: http://stackoverflow.com/q/22511689
tags question: http://stackoverflow.com/q/22613145
tags question: http://stackoverflow.com/q/22622697
tags question: http://stackoverflow.com/q/22504260
tags question: http://stackoverflow.com/q/22645809
tags question: http://stackoverflow.com/q/22597719

http://stackoverflow.com/comment/34489601
comment on: http://stackoverflow.com/q/22644441
score: 0
type: Comment
type: QuestionComment
has text: @RohitJain Thanks that looks good and hopefully answers many of my questions.

http://stackoverflow.com/a/54695596
score: 10
downvote count: 0
answers question: http://stackoverflow.com/q/22539779
type: Answer
has body: @maciej-cygan described the process well, however in order to find your java path: $ which java it gives you the path of java binary file which is a linked file in /usr/bin directory. next: $ cd /usr/bin/ &amp;&amp; ls -la | grep java find the pointed location which is something as follows (for me): then cd to the pointed directory to find the real home directory for Java. next: $ ls -la | grep java which is as follows in this case: so as it's obvious in the screenshot, my Java home directory is /usr/lib/jvm/java-11-openjdk-amd64. So accordingly I need to add JAVA_HOME to my bash profile (.bashrc, .bash_profile, etc. depending on your OS) like below: JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" Here you go!
upvote count: 10

http://stackoverflow.com/q/22600067
tagged with: tagfile
type: Question
has comment: http://stackoverflow.com/comment/34410700
has comment: http://stackoverflow.com/comment/34409979
downvote count: 0
answer count: 1
tagged with: jsp
has title: Pass variable in tag file JSP
has comment: http://stackoverflow.com/comment/34410905
has comment: http://stackoverflow.com/comment/34410894
has answer: http://stackoverflow.com/a/44451886
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34414491
has body: I want to pass a variable in tag file. My code here: layout.tag <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@tag description="My layout" pageEncoding="UTF-8"%> <%@attribute name="title" type="java.lang.String" required="true" %> My site | <c:out value="${title}" /> index.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="mySite" tagdir="/WEB-INF/tags" %> <mySite:layout title="home"> </mySite:layout>` But <c:out value="${title} />" always return ${title}. I tried with ${title} and got the same result. I dont know why...
has comment: http://stackoverflow.com/comment/34413669
has comment: http://stackoverflow.com/comment/34410690
has comment: http://stackoverflow.com/comment/34414963
score: 2
tagged with: java

http://stackoverflow.com/comment/34378681
score: 0
type: AnswerComment
has text: But I doubt if your database will consider the line separator as a newline in the view which you are seeing. If it considers line separators appropriately, then a method which adds appropriate line separators will have its use, or else it won't solve the issue as well.
type: Comment
comment on: http://stackoverflow.com/a/22581960

http://stackoverflow.com/a/22605936
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/22605760
has body: In both cases Reference 'e' in changedetails() and 'emp' in main() both point to same object. In code (1) In changedetails() when you make e=null; ONLY e STOPS POINTING TO OBJECT. BUT emp CONTINUES TO POINT TO OBJECT. So in main() when you do emp.id value prints and no NullPointerException In code (2) In changedetails() when you make e.id=9 remember Both References are pointing to same object i.e. 'e' in changedetails() and 'emp' in main() point to same object .... So e.id=9 means change made on same object hence when you do emp.id in main() value is 9
upvote count: 5
type: Answer

http://stackoverflow.com/q/22642326
upvote count: 0
score: -1
duplicate of: http://stackoverflow.com/q/20952325
favorite count: 0
has answer: http://stackoverflow.com/a/22642671
has comment: http://stackoverflow.com/comment/34491746
answer count: 5
has title: How to combine more than 2 exception? (if statement)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34484587
has answer: http://stackoverflow.com/a/22642382
has answer: http://stackoverflow.com/a/22642441
tagged with: if-statement
has answer: http://stackoverflow.com/a/22642466
tagged with: java
has answer: http://stackoverflow.com/a/22642434
has comment: http://stackoverflow.com/comment/34484655
downvote count: 1
type: Question
has body: How would you combine these into one? if (selection != 'a' &amp;&amp; selection != 'A' &amp;&amp; selection != 'b' .....){ I tried if (selection != ('a', 'A','b'....) ) { but it does not work..
linked to: http://stackoverflow.com/q/20952325

http://stackoverflow.com/q/22558567
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/22559026
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
has body: I have a addEmployee form where i am required to enter details of employee including his department. For department I am using a dropdown. I am trying to populate departments of an employee but facing an issue. heres my code Employee class @Entity @Table(name = "EMS") public class Employee { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int empId; private String firstName; private String lastName; private String dob; private String address; private String qualification; private Department dept; public int getEmpId() { return empId; } public void setEmpId(int empId) { this.empId = empId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getDob() { return dob; } public void setDob(String dob) { this.dob = dob; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public Department getDept() { return dept; } public void setDept(Department dept) { this.dept = dept; } public String getQualification() { return qualification; } public void setQualification(String qualification) { this.qualification = qualification; } } Department @Entity public class Department { @Id private int id; private String deptName; @OneToMany private List<Employee> list = new ArrayList<Employee>(); public List<Employee> getList() { return list; } public void setList(List<Employee> list) { this.list = list; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getDeptName() { return deptName; } public void setDeptName(String deptName) { this.deptName = deptName; } } addEmployee Form <form:form id = "addForm" modelAttribute="employee" action="addEmployee.do"> <form:label path="firstName">First Name</form:label> <form:input path="firstName" /> <form:errors></form:errors> <form:l…
score: 0
has answer: http://stackoverflow.com/a/22559026
answer count: 1
has title: SpringMVC : populating values of a dropdown of a department object injected inside Employee object
tagged with: spring

http://stackoverflow.com/comment/34486231
type: Comment
score: 0
has text: How much over head does a Data Base hit create? From JAVA to Oracle.
type: AnswerComment
comment on: http://stackoverflow.com/a/22643128

http://stackoverflow.com/comment/34426783
type: Comment
comment on: http://stackoverflow.com/a/22569607
type: AnswerComment
score: 0
has text: thanks a lot bro.. it working now... you were right.. server had to get started.. and from the string jdbc:oracle:thin:@//localhost:1522/DevDb "//" had to be removed so its working fine now... :)

http://stackoverflow.com/a/22533152
has comment: http://stackoverflow.com/comment/34290619
type: Answer
has body: In that case the code inside the finally is run but the other return is skipped when there are no exceptions. You may also see this for yourself by logging something :) Also see this concerning System.exit: How does Java&#39;s System.exit() work with try/catch/finally blocks? And see returning from a finally: Returning from a finally block in Java
has comment: http://stackoverflow.com/comment/34289984
has comment: http://stackoverflow.com/comment/34290078
has comment: http://stackoverflow.com/comment/34290756
score: 3
has comment: http://stackoverflow.com/comment/34290267
upvote count: 3
has comment: http://stackoverflow.com/comment/34290654
has comment: http://stackoverflow.com/comment/34290174
downvote count: 0
has comment: http://stackoverflow.com/comment/34290016
answers question: http://stackoverflow.com/q/22533128

http://stackoverflow.com/comment/34428492
type: Comment
type: QuestionComment
has text: Oh! So you mean to say that I am loosing my session on page reload?
comment on: http://stackoverflow.com/q/22610608
score: 0

http://stackoverflow.com/q/22487953
has comment: http://stackoverflow.com/comment/34211125
score: -3
type: AnsweredQuestion
tagged with: java
has body: I would like someone to check this program I'm having trouble on getting the result, it wont display. I tried so many ways. please help I just started studying java. please help here's my code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class Counter extends JFrame implements ActionListener { JPanel row1 = new JPanel(); JLabel title = new JLabel("Monthly Total Sales"); JPanel row2 = new JPanel(); JLabel week1 = new JLabel("1st Week"); JTextField text1 = new JTextField(10); JLabel week2 = new JLabel("2nd Week"); JTextField text2 = new JTextField(10); JPanel row3 = new JPanel(); JLabel week3 = new JLabel("3rd Week"); JTextField text3 = new JTextField(10); JLabel week4 = new JLabel("4th Week"); JTextField text4 = new JTextField(10); JPanel row4 = new JPanel(); JLabel month = new JLabel("Monthly Total:"); JPanel row5 = new JPanel(); JButton count = new JButton("TOTAL"); public Counter() { super("Monthly Earnings"); setSize(500,500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); Container pane = getContentPane(); GridLayout layout = new GridLayout(5,1,2,2); pane.setLayout(layout); FlowLayout layout1 = new FlowLayout(FlowLayout.CENTER,2,2); row1.setLayout(layout1); row1.add(title); pane.add(row1); GridLayout layout2 = new GridLayout(1,2,2,2); row2.setLayout(layout2); row2.add(week1); row2.add(text1); row2.add(week2); row2.add(text2); pane.add(row2); GridLayout layout3 = new GridLayout(1,2,2,2); row3.setLayout(layout3); row3.add(week3); row3.add(text3); row3.add(week4); row3.add(text4); pane.add(row3); FlowLayout layout4 = new FlowLayout(FlowLayout.CENTER,2,2); row4.setLayout(layout4); row4.add(month); pane.add(row4); FlowLayout layout5 = new FlowLayout(FlowLayout.CENTER,2,2); row5.setLayout(layout5); row5.add(count); pane.add(row5); setContentPane(pane); setVisible(true); } public void actionPerformed(ActionEvent tot) { if(tot.getSource()==count) { float we1=0; we1 = Float.parseFloat(text1.getText()); float we2=0; we2 = Float.par…
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34211227
has comment: http://stackoverflow.com/comment/34211184
accepted answer: http://stackoverflow.com/a/22488047
possible better answer: http://stackoverflow.com/a/22488046
downvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/22492195
has comment: http://stackoverflow.com/comment/34211102
has answer: http://stackoverflow.com/a/22488047
has answer: http://stackoverflow.com/a/22488046
has title: JAVA how to get the value on JTextfield
favorite count: 0
has comment: http://stackoverflow.com/comment/34211145

http://stackoverflow.com/comment/34493142
has text: other error says you don't have `servlet-api` present in classpat, add the dependency for `javax.servlet:servlet-api` in your `pom.xml`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22646890

http://stackoverflow.com/comment/42257562
type: Comment
has text: Hi @Willian! I uploaded the JAR's on my own Nexus repository as 3rd party artifacts. Thanks!
comment on: http://stackoverflow.com/a/23844497
type: AnswerComment
score: 0

http://stackoverflow.com/a/22594601
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34399554
has body: An Iterable&lt;Option&lt;Boolean&gt;&gt; cannot be converted to an Iterable&lt;Option&lt;?&gt;&gt;, even though Option&lt;Boolean&gt; is convertible to Option&lt;?&gt;. You want Iterable&lt;? extends Option&lt;?&gt;&gt;.
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22594578
answers question: http://stackoverflow.com/q/22594578

http://stackoverflow.com/comment/34346336
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22556701
has text: The fact that it says `java version "1.5.0"` in that output is pretty suspicious; that's not Java 7.

http://stackoverflow.com/q/22619270
has comment: http://stackoverflow.com/comment/34444122
has comment: http://stackoverflow.com/comment/34444923
type: Question
has comment: http://stackoverflow.com/comment/34444560
tagged with: java
has comment: http://stackoverflow.com/comment/34444022
has comment: http://stackoverflow.com/comment/34444121
has comment: http://stackoverflow.com/comment/34444564
answer count: 1
has comment: http://stackoverflow.com/comment/34443915
has title: Variables not getting read
score: 0
has body: I'm working with an existing HttpServletRequest for an application that simply retrieves records from various databases. I'm using Eclipse IDE. The app currently works fine and I want to extend its functionality. However when I try to add my own variables &amp; methods to the servlet, I'm noticing the debugger skips right over them and acts as if they are commented out. boolean checkName = false, checkAddress = false, checkAge = false; //All existing variables get read just fine boolean checkCompany = false; //My own variable that doesn't get read at all I've saved, refreshed, committed to the SVN repository, but all my code is getting skipped over. EDIT: I've noticed that even if I strip away existing code, that code still gets read. It seems my .java file isn't syncing for some reason. Any ideas of what could cause this?
has comment: http://stackoverflow.com/comment/34443937
has comment: http://stackoverflow.com/comment/34444514
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22639220

http://stackoverflow.com/comment/34395230
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22592087
score: 0
has text: edited post with the error i am getting.

http://stackoverflow.com/a/22586800
type: Answer
score: 2
has body: Your in.close(); can not be reached as you're returning right before it. And yes, you should also add a return after the try catch block
answers question: http://stackoverflow.com/q/22586762
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/22534976
has answer: http://stackoverflow.com/a/22535238
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/84963286
has body: I am trying to hit the url using URLConnection using below code, getting the error as , java.io.IOException: HTTPS hostname wrong: should be &lt;XXXX.XXXX.XXX&gt; at sun.net.www.protocol.https.HttpsClient.checkURLSpoofing(Unknown Source) at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at protocol.URL_Certificate.main(URL_Certificate.java:55) public class URL_Certificate { public static void main(String[] args) { String urlPlugin = "https://XXXX.XXXX.XXX/signin"; try { // Create a trust manager that does not validate certificate chains final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { @Override public void checkClientTrusted(final X509Certificate[] chain, final String authType) { } @Override public void checkServerTrusted(final X509Certificate[] chain, final String authType) { } @Override public X509Certificate[] getAcceptedIssuers() { return null; } } }; // Install the all-trusting trust manager final SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); // Create an ssl socket factory with our all-trusting manager final SSLSocketFactory sslSocketFactory = sslContext .getSocketFactory(); InputStream input; BufferedReader br; String line = ""; // All set up, we can get a resource through https now: final URLConnection urlCon1 = new URL(urlPlugin).openConnection(); // Tell the url connection object to use our socket factory which // bypasses security checks ((HttpsURLConnection) urlCon1) .setSSLSocketFactory(sslSocketFactory); input = urlCon1.getInputStream(); br = new BufferedReader(new InputStreamReader(input)); line = ""; while ((line = br.readLine()) != null) { // TODO: Need to Remove System…
has title: java.io.IOException: HTTPS hostname wrong: should be <domain name>
tagged with: java
duplicate of: http://stackoverflow.com/q/1802051
type: Question
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/1802051
has answer: http://stackoverflow.com/a/26102586
upvote count: 1
downvote count: 1
tagged with: connection
favorite count: 0

http://stackoverflow.com/q/22620454
tagged with: java
has title: How to distinguish the commonly printed keyboard keys from the rest
has answer: http://stackoverflow.com/a/22620964
accepted answer: http://stackoverflow.com/a/22620964
type: Question
has body: I want to collect keyboard input and append it together in a java StringBuilder, but using LWJGL's Keyboard event, i end up fetching more than I wish, like Shift, CapsLock, Escape, F1 to F12, Enter, even punctuation etc.. These keys also have key ID's, but by appending them, they are printed as a square (unrecognized character i believe). My goal is to ignore these non-printable keys without having to create a giant array with all these unwanted keys. Is there any way to do so? P.S. Mind that i wish the common symbols like \,.-&lt; etc. to still be considered into the string, like any text editor would.
answer count: 2
has comment: http://stackoverflow.com/comment/34446712
possible better answer: http://stackoverflow.com/a/22620741
tagged with: keyboard
score: 0
tagged with: input
has comment: http://stackoverflow.com/comment/34446501
tagged with: lwjgl
has answer: http://stackoverflow.com/a/22620741
type: AnsweredQuestion

http://stackoverflow.com/comment/34477314
comment on: http://stackoverflow.com/q/22638208
type: Comment
score: 0
type: QuestionComment
has text: What is the error? Don't be shy to add the stack trace (you should always).

http://stackoverflow.com/q/22551919
type: UnansweredQuestion
upvote count: 1
tagged with: zxing
tagged with: datamatrix
score: 1
tagged with: java
type: Question
has title: reading datamatrix with xzing lib in java
answer count: 1
downvote count: 0
has body: My test case is very simple: I'm generating a data matrix code and then I want to read it again. Both with xzing vs3.0.0. I'm doing this the same way with qr-code and pdf417 - and it works perfectly. This is my code: @Test public void testDataMatrix() throws Exception { writeDataMatrix(); String result = readDataMatrix("out/data_matrix.png", "UTF-8", new EnumMap&lt;DecodeHintType, Object&gt;(DecodeHintType.class)); assertEquals("my message", result); } public static void writeDataMatrix() throws IOException { DataMatrixWriter writer = new DataMatrixWriter(); BitMatrix matrix = writer.encode("my message", BarcodeFormat.DATA_MATRIX, 100, 100); MatrixToImageWriter.writeToPath(matrix, "PNG", Paths.get("out/data_matrix.png")); } public static String readDataMatrix(String filePath, String charset, Map hintMap) throws FileNotFoundException, IOException, NotFoundException { BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer( new BufferedImageLuminanceSource( ImageIO.read(new FileInputStream(filePath))))); Result qrCodeResult = new MultiFormatReader().decode(binaryBitmap, hintMap); return qrCodeResult.getText(); } If I run the test above, a data matrix image will be generated in out. This file is readable by the xzing online reader. But it works not in my own code: com.google.zxing.NotFoundException Any ideas? Thanks in advance.
has answer: http://stackoverflow.com/a/32087270
favorite count: 0

http://stackoverflow.com/q/22543057
tagged with: jsf-2
score: 0
answer count: 2
type: UnansweredQuestion
has title: keep a checkbox true after a display error message?
tagged with: jsf
tagged with: java
has answer: http://stackoverflow.com/a/22543988
has answer: http://stackoverflow.com/a/22543315
type: Question
has body: How can I keep a checkbox true when i display error message? Every time I display a errorMessage my checkBox turn false. How can I solve this problem? I am using jsf2.0 and primefaces. This is the button that calls a method: &lt;p:commandButton styleClass="btIcon" value="Consolidar" image="addIcon" process="@this :formCadastro" actionListener="#{bean.addConsolidacao}" onclick="carregando.show();" oncomplete="carregando.hide();" rendered="true" update="@this :formCadastro :formPanel" /&gt;

http://stackoverflow.com/a/22560399
answers question: http://stackoverflow.com/q/22560235
type: Answer
has comment: http://stackoverflow.com/comment/34337848
has comment: http://stackoverflow.com/comment/34338530
has body: Any action triggered from Swing will run on the EDT. So the code in your actionPerformed method will already be executed on the EDT, without any special handling by you. To start a long-running task, like sending data to a server, use a SwingWorker or a Callable and an ExecutorService. I prefer using a SwingWorker when implementing a Swing UI, as has it a useful API for publishing updates and makes the callbacks when the task is done automatically happen on the EDT.
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22560235
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34338041
downvote count: 0

http://stackoverflow.com/comment/34379539
score: 1
comment on: http://stackoverflow.com/q/22583308
has text: Use [VisualVM](http://visualvm.java.net/) and take a heap dump. [Analyse the object graph](https://visualvm.java.net/heapdump.html) and work out what's going on.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22497497
has answer: http://stackoverflow.com/a/22497718
has answer: http://stackoverflow.com/a/72892026
type: Question
has comment: http://stackoverflow.com/comment/34227742
score: 7
tagged with: java
answer count: 6
has answer: http://stackoverflow.com/a/22497574
has answer: http://stackoverflow.com/a/52528010
tagged with: lazy-initialization
upvote count: 7
has body: Below are two ways to implement a singleton. What are the advantages and disadvantages of each? Static initialization: class Singleton { private Singleton instance; static { instance = new Singleton(); } public Singleton getInstance() { return instance; } } Lazy initialization is: class Singleton { private Singleton instance; public Singleton getInstance(){ if (instance == null) instance = new Singleton(); return instance; } }
favorite count: 0
has title: Singleton object- In static block or in getInstance(); which should be used
tagged with: static
accepted answer: http://stackoverflow.com/a/22497718
tagged with: singleton
possible better answer: http://stackoverflow.com/a/22497800
has answer: http://stackoverflow.com/a/22497800
has answer: http://stackoverflow.com/a/22497737
tagged with: static-block
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/34303894
has text: Sorry, I forgot to mention it's a question... it says find the number in this array in the most efficient way... sorting will be at least (nlogn) and I prefer to stay at the (logn) range
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22540756

http://stackoverflow.com/comment/34460848
comment on: http://stackoverflow.com/q/22628709
type: Comment
type: QuestionComment
score: 1
has text: i want to create a message box with ok button and no button. Ok button will just simply output "i like cake " statement. and so for No button, "I dont like cake". Current code after i click ok or no button it will exit. Thank you for asking.

http://stackoverflow.com/comment/34320816
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22549840
has text: This is how you mock the static method right? But the logic I want to test is in method1. What I do want to mock is the new A() not method1.

http://stackoverflow.com/q/22579903
has comment: http://stackoverflow.com/comment/34373308
accepted answer: http://stackoverflow.com/a/22579980
answer count: 3
linked to: http://stackoverflow.com/q/129181
has comment: http://stackoverflow.com/comment/34373620
downvote count: 7
linked to: http://stackoverflow.com/q/4772425
has comment: http://stackoverflow.com/comment/34372892
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/34373548
possible better answer: http://stackoverflow.com/a/22580014
has comment: http://stackoverflow.com/comment/34373696
tagged with: timestamp
type: Question
has comment: http://stackoverflow.com/comment/34374236
linked to: http://stackoverflow.com/q/11839246
has answer: http://stackoverflow.com/a/22579961
has comment: http://stackoverflow.com/comment/34373898
has comment: http://stackoverflow.com/comment/34373820
tagged with: java
has title: How to convert Object as timestamp to formatted date
has body: How to convert Object as timestamp to formatted date? I have printed out timestamp( 1395500668 ) that is in Object. I want to format this and print it out like yyyy-MM-dd H:m:s
has answer: http://stackoverflow.com/a/22580014
score: -7
favorite count: 0
has comment: http://stackoverflow.com/comment/34373770
has answer: http://stackoverflow.com/a/22579980

http://stackoverflow.com/a/22643258
accepted answer of: http://stackoverflow.com/q/22643142
has comment: http://stackoverflow.com/comment/34507408
answers question: http://stackoverflow.com/q/22643142
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: You could do something like this, everytime you type something in, it gets bigger: field.addKeyListener(this); And in your KeyListener implementation this: @Override public void keyReleased(KeyEvent arg0) { field.setSize(field.getWidth() + 10, field.getHeight()); repaint(); }

http://stackoverflow.com/a/22617979
has body: LINQ can do a lot of things and there is no single alternative for it. Java has no LINQ library, it's a .NET thing. You can do a lot of common LINQ operations in Java 8 though with streams and functional programming, such as your example: Class1[] arr = ... List&lt;Class1&gt; filteredList = stream(arr).filter(e -&gt; e.member1 == val).collect(toList()); This generates a list of elements where member1 equals val. For more examples, I'll refer to this package: http://download.java.net/jdk8/docs/api/java/util/stream/package-summary.html If Java 8 is not available, then you have to resort to using simple for loops (or downloading a library to do this for you).
has comment: http://stackoverflow.com/comment/34442205
type: Answer
has comment: http://stackoverflow.com/comment/34442092
answers question: http://stackoverflow.com/q/22617801
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22617801
has comment: http://stackoverflow.com/comment/34527210
has comment: http://stackoverflow.com/comment/34442073
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/22504497
tagged with: java
tagged with: eclipse
has title: Call a class one minute after Eclipse is initialized
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34328095
downvote count: 0
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/22504654
has comment: http://stackoverflow.com/comment/34238747
favorite count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/22504665
has answer: http://stackoverflow.com/a/22504665
accepted answer: http://stackoverflow.com/a/22504654
type: AnsweredQuestion
has body: I'm developing an Eclipse plugin and I would like to call a Java class some time after Eclipse is initialized i.e. 1 min. Where should I create the job that waits 1 min and calls the functions? Thanks in advance!
score: 1

http://stackoverflow.com/comment/34435657
type: AnswerComment
has text: Yes, it is very confusing, but I still believe that there is a bug. Here our scenario. We have UserStory US1, that has associated test case, let's call it TC1. After executing TC1 I want to file a defect through RestApi and specify that this defect belongs to TC1 that actually belongs to US1. Case 1: I do it through UI, then after selecting TC1, US1 automatically gets populated. If I try to delete US1 (un-associate it from this defect), TC1 association is also gone.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22582916

http://stackoverflow.com/a/22538826
has comment: http://stackoverflow.com/comment/34307095
has comment: http://stackoverflow.com/comment/34353455
has comment: http://stackoverflow.com/comment/34306871
downvote count: 0
has comment: http://stackoverflow.com/comment/34306544
has comment: http://stackoverflow.com/comment/34352533
has comment: http://stackoverflow.com/comment/34301642
type: Answer
has comment: http://stackoverflow.com/comment/34301182
upvote count: 3
answers question: http://stackoverflow.com/q/22521680
has body: The original error message is a good indication of what's going on: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "enrollmentStatus" (Class entities.LearningActivity), not marked as ignorable which is caused by the case difference. Jackson is the JSON serializer/deserializer use by GF and it tries to perform a case sensitive match between what it finds in the JSON file and the entity class - and fails. I see three possible solutions: The easiest one, change the entity field's name to match the JSON case Alternatively, just add a @JsonProperty annotation to tell Jackson that entity field enrollmentstatus should map to JSON field enrollmentStatus @Basic(optional = false) @NotNull @Size(min = 1, max = 1) @Column(name = "ENROLLMENTSTATUS") @JsonProperty("enrollmentStatus") private String enrollmentstatus; Last but I think it's a bit messy, provide a getter and setter for the field using the JSON-side casing public String getEnrollmentStatus() { return enrollmentstatus; } public void setEnrollmentStatus(String value) { this.enrollmentstatus = value; } Regarding that stacktrace, I see no obvious connection between the case issue and that problem (but one never knows). If the error doesn't go away one you have fixed the case issue it might be worthwhile to try disabling WADL generation unless you really need that feature. The procedure is explained in the Jersey documentation, the essence is WADL generation is enabled in Jersey by default. This means that OPTIONS methods are added by default to each resource and an auto-generated /application.wadl resource is deployed too. To override this default behavior and disable WADL generation in Jersey, setup the configuration property in your application: jersey.config.server.wadl.disableWadl=true This property can be setup in a web.xml if the Jersey application is deployed in the servlet with web.xml or the property can be returned from the Application. getProperties(). See Deployment chapter for …
score: 3

http://stackoverflow.com/a/22539424
type: Answer
answers question: http://stackoverflow.com/q/22539158
accepted answer of: http://stackoverflow.com/q/22539158
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
has body: Here is Document converter which works fine for me public String getStringFromDoc(Document doc) throws TransformerException { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.transform(domSource, result); writer.flush(); return writer.toString(); }

http://stackoverflow.com/comment/34316339
has text: sir thank you for the help, the above code is not failing this time but my other program is now showing the same problem. Do i post its code too?
comment on: http://stackoverflow.com/a/22547520
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22524687
accepted answer: http://stackoverflow.com/a/22524803
tagged with: for-loop
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34275401
tagged with: string
has comment: http://stackoverflow.com/comment/34275575
favorite count: 0
tagged with: character
has answer: http://stackoverflow.com/a/22524803
has answer: http://stackoverflow.com/a/22524765
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/5032356
has comment: http://stackoverflow.com/comment/34275581
has title: Counting the Occurrences of a User Specified Character in a String
possible better answer: http://stackoverflow.com/a/22524765
has body: My program is supposed to count the number of occurrences a user inputted character appears in a string. For some reason, my program does not execute the for loop. Right after it prints out "Enter the string to search: ", it doesn't let me input a string and prints out: "There are 0 occurrences of '(inputted character)' in '(inputted string)'." on a new line. I need it to be able to find the occurrences of the character over any given amount of words inputted as the string. What can I do to make it function properly? Thanks. import java.util.Scanner; public class CountCharacters { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter a character for which to search: "); char ch = input.next().charAt(0); System.out.println("Enter the string to search: "); String str = input.nextLine(); int counter = 0; for (int i = 0; i &lt; str.length(); i++) { if (ch == str.charAt(i)) { counter++; } } System.out.printf("There are %d occurrences of '%s' in '%s'.", counter, ch, str); System.out.println(); } }
duplicate of: http://stackoverflow.com/q/5032356
tagged with: java
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/34269328
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22514624
type: AnswerComment
has text: Aaa .. solved i. :D I used [link](http://blog.danieldee.com/2009/07/showing-jtable-header-without-using.html) method

http://stackoverflow.com/comment/34324125
has text: thank you @JasonC for explaining. Actually I am creating (certificate).p12 files. and the second solution works fine and I can read that certificate in android also. Is there any way to find byteArray encoding ?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22552208

http://stackoverflow.com/comment/34305762
type: AnswerComment
score: 0
type: Comment
has text: I'd be happy for any alternative suggestions, therefore I updated my answer with my job configuration stuff.
comment on: http://stackoverflow.com/a/22527853

http://stackoverflow.com/q/22575387
favorite count: 0
has body: I want to know if the following method will be thread safe. use cases : I pass two collection from different locations... public static Collection&lt;String&gt; checkIfValidUUIDCollectionAndRefine(Collection&lt;String&gt; uuids){ for(String uuid : uuids){ if(!checkIfValidUUID(uuid)){ uuids.remove(uuid); } } return uuids; }
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22575667
downvote count: 0
tagged with: multithreading
type: Question
score: 3
has comment: http://stackoverflow.com/comment/34365209
has title: is the following method thread safe
tagged with: java
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/34364862
has answer: http://stackoverflow.com/a/22575667
upvote count: 3
has answer: http://stackoverflow.com/a/22575408
answer count: 2
accepted answer: http://stackoverflow.com/a/22575408

http://stackoverflow.com/a/22578479
has body: stmt.executeUpdate("insert into utable values ('a','a');") // ';' is wrong use , stmt.executeUpdate("insert into utable values ('a','a')")
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22578460
downvote count: 0
answers question: http://stackoverflow.com/q/22578460
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34370186

http://stackoverflow.com/q/22622894
has title: Are the threads generated by 2 separate executor services in different threads guaranteed to be different?
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22623014
accepted answer: http://stackoverflow.com/a/22623014
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34450571
has comment: http://stackoverflow.com/comment/34450546
favorite count: 0
has body: Lets say I have 2 different threads running concurrently. Each thread spins up a cached thread pool executor service that spins a bunch more threads. Will each pool have their own distinct set of threads? Or is there a possibility for threads to be shared between them?
tagged with: executorservice
type: AnsweredQuestion
downvote count: 0
tagged with: multithreading

http://stackoverflow.com/q/22635591
score: 3
tagged with: java
has title: deactivate mnemonic for JButton
type: Question
answer count: 1
downvote count: 0
tagged with: mnemonics
has answer: http://stackoverflow.com/a/22638845
favorite count: 0
has body: I need help to deactivate the Mnemonic for JButton. Actually I am using 3rd party API, which they set mnemonic as "Alt C". So I want to remove this mnemonic and wants to set nothing (i.e wants to remove the mnemonic) for this compButton. // Alt + 'C' selects the comp. compButton.setMnemonic(KeyEvent.VK_C);
upvote count: 3
type: UnansweredQuestion
tagged with: swing
tagged with: jbutton

http://stackoverflow.com/q/22580955
score: -2
tagged with: twitter4j
has answer: http://stackoverflow.com/a/22580965
tagged with: nullpointerexception
answer count: 3
upvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: please help me. I'm getting a null pointer exception error in my code. Here it is: File strfile = new File("15.json"); Scanner scan = new Scanner (strfile); while(scan.hasNextLine()) { String line = scan.nextLine(); Status statjson = DataObjectFactory.createStatus(json); String text = statjson.getText(); if (text == null) { System.out.print("null"); } else { System.out.print(text); } } it runs for the first few lines that have a "text" field but the moment it comes across a line without "text" it throws a null pointer exception instead of printing "null" on the console. Help please!
has title: Exception in thread "main" java.lang.NullPointerException error
has comment: http://stackoverflow.com/comment/34374821
has answer: http://stackoverflow.com/a/22580969
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/22581002
type: Question

http://stackoverflow.com/comment/34377104
score: 1
comment on: http://stackoverflow.com/q/22582106
type: Comment
type: QuestionComment
has text: Please check out: mp = MediaPlayer.create(getApplicationContext(), R.raw.startup);

http://stackoverflow.com/comment/34264885
type: QuestionComment
has text: Perhaps the AI has discovered that the only winning move is not to play?
comment on: http://stackoverflow.com/q/22518369
score: 0
type: Comment

http://stackoverflow.com/comment/34490719
type: Comment
comment on: http://stackoverflow.com/q/22645648
has text: `int SIZE = 3; int[] intArray = new int[SIZE];`
score: 1
type: QuestionComment

http://stackoverflow.com/comment/34391555
has text: You mean to statically store in Piece the different possible alleigances?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22590058

http://stackoverflow.com/comment/34395173
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22592087
has text: possible duplicate of [What is a Null Pointer Exception?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception)
score: 0

http://stackoverflow.com/a/22565903
type: AcceptedAnswer
has body: It depends on what you need for your application. byte[] b = new byte[] { -1, 2 } Another way of looking at this is as the hexadecimal number 0xFF02. Does that represent a signed 64-bit value (65282)? Or a signed 16-bit value (-254)? Or an unsigned 16-bit value (65282 again)? Or an unsigned 64-bit value (still 65282)? Your code treats it as a signed 64-bit value. BigInteger treats it as a signed 16-bit value. BigInteger has another constructor to treat the byte array as the magnitude, using a another parameter for the sign: new BigInteger(+1, b) would result in 65282.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34347623
answers question: http://stackoverflow.com/q/22565560
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22565560
score: 1
has comment: http://stackoverflow.com/comment/34388271

http://stackoverflow.com/comment/34497695
type: Comment
comment on: http://stackoverflow.com/a/22646840
type: AnswerComment
score: 0
has text: Fixed it just before you commented, was running a few tests to ensure it was okay. Does it look alright now?

http://stackoverflow.com/q/22522491
tagged with: collections
downvote count: 1
has title: Have trouble in fetching the required data from DB
type: Question
has answer: http://stackoverflow.com/a/22523787
has body: I have a table like this. AreaId LineId ShapePointno x y 1 0 0 2 3 1 0 1 2 5 1 0 2 3 8 1 1 0 2 6 1 1 1 3 2 Before, getting into the problem, I would explain on the fields. A line Id 0 belonging to AreaId1 1 has 3 shape points numbered as 0,1 and 2. Its x and y corresponds to its co-ordinate positions. With this background, let me put the problem in hand. I need to fetch these records and bring it to java. While bringing in, I need to have it as a block of shape points for a line. (i.e) 1st 3 rows as one block and next 2 in a different block. The reason behind this is I need to modify x &amp; y values and the modification function expects the following parameters. i)AreaID, LineId, A 2D array of its shape points). Here is what I have tried out. Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost/task4DB?" + "user=root&amp;password=123"); PreparedStatement st = con.prepareStatement("select Distinct AreaId from TableName") ResultSet r1=st.executeQuery(); while (r1.next()) { int id = r1.getInt("AreaId"); PreparedStatement st1 = con.prepareStatement("select Distinct LineId where AreaId = id") ResultSet r2=st1.executeQuery(); while (r2.next()) { int lineid = r2.getInt("LineId"); PreparedStatement st2 = con.prepareStatement("select x,y where AreaId = id and LineId = lineid") ResultSet r3=st2.executeQuery(); int size = 0; int [][]xy = new int[r3.getCount()][r3.getCount()] while (r3.next()) { xy[size][0] = r3.getInt("x"); xy[size][1] = r3.getInt("y"); size++; } callShapePointConv(id,lineId,xy); } } I don't get the expected results rather it shows junk values/ Please help me out. Also, is there any other better alternate available rather than three while loops? Kindly Help me out. Thanks in advance!
has answer: http://stackoverflow.com/a/22524991
accepted answer: http://stackoverflow.com/a/22524991
upvote count: 2
has comment: http://stackoverflow.com/comment/34271683
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22524158
has comment: http://stackoverflow.com/comment/34273300
possible better answer: http://stackoverflow.com/a/22523787
tagged with: jdbc
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/22551906
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22552252
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22551950
upvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/4391448
has body: I want to do some calculations on my app the result will mostly have from 5 to 15 digits after the . for example 24.61835496354822 I want to display the result in a TextView and only show 2 digits after . for example 24.61 please help me
possible better answer: http://stackoverflow.com/a/22551935
has answer: http://stackoverflow.com/a/22551935
accepted answer: http://stackoverflow.com/a/22551950
downvote count: 0
has comment: http://stackoverflow.com/comment/34323150
favorite count: 0
has title: Result with 2 digits after . eg:23.65
linked to: http://stackoverflow.com/q/9820149
has answer: http://stackoverflow.com/a/22552158
tagged with: android
linked to: http://stackoverflow.com/q/4391448
answer count: 4

http://stackoverflow.com/q/22632950
accepted answer: http://stackoverflow.com/a/22634163
has body: I´m working on small project in Java where I load an image (BMP format, with method ImageIO.read()), use jpeg compression algorithm and finally i want to save it (write image). Method ImageIO.write does its own compression when i want to save image. Are there any possibilities how to write compressed image with my own compression? Note: i want to save it as jpg file Note 2: In the same way i want to implement jpg decoder and i will need to save bmp file (I hope that it is same case as jpg saving)
has comment: http://stackoverflow.com/comment/34468674
tagged with: image
has comment: http://stackoverflow.com/comment/34467714
has comment: http://stackoverflow.com/comment/34468334
has title: Java: How to write an image after my own compression
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34467605
has comment: http://stackoverflow.com/comment/34468081
favorite count: 0
has comment: http://stackoverflow.com/comment/34467628
has comment: http://stackoverflow.com/comment/34469776
has comment: http://stackoverflow.com/comment/34468856
has comment: http://stackoverflow.com/comment/34468553
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22634163
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34468126
upvote count: 1
type: Question

http://stackoverflow.com/comment/34479069
has text: Edit your question. It is hard to read code in comments.
type: QuestionComment
comment on: http://stackoverflow.com/q/22638991
score: 0
type: Comment

http://stackoverflow.com/comment/34446613
score: 0
type: Comment
type: QuestionComment
has text: Well, this is not code which runs in a thread which I create myself; I believe this piece of context matters, so I'll edit the question and add that
comment on: http://stackoverflow.com/q/22620271

pcap
tags question: http://stackoverflow.com/q/22500525
type: Tag
tag name: pcap

http://stackoverflow.com/comment/34487411
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22643588
has text: Which code seems more concise to you?

http://stackoverflow.com/a/22642936
has comment: http://stackoverflow.com/comment/34486631
has comment: http://stackoverflow.com/comment/34487141
has body: Your main method looks fine. Probably your .class file does not correspond to your .java file. I would try to clean up my project (if I was using an IDE and getting this). That is: delete the .class file, regenerate it from the .java file. It seems you're not running ImageFile but some other class, even though you think you're running ImageFile. Check what your IDE is running behind the scenes.
has comment: http://stackoverflow.com/comment/34487391
score: 0
has comment: http://stackoverflow.com/comment/34486587
answers question: http://stackoverflow.com/q/22642875
type: Answer
has comment: http://stackoverflow.com/comment/34487278
has comment: http://stackoverflow.com/comment/34487266

http://stackoverflow.com/q/22491527
type: Question
upvote count: 11
has body: I have a j2ee application and monitoring it by visualVM. Lets say that I have a method like this: public void doStuff(int param) { String s = getStringVariable(param); StringBuilder sb = new StringBuilder(); //Do stuff with sb object } From the thread tap, I can see that some of my threads stuck in the above method. So I have generated a heap dump file to figure out what is s and sb contains. But how can I do that? I am using Eclipse Memory Analyzer.
tagged with: java
has answer: http://stackoverflow.com/a/22491546
answer count: 1
has title: How can I find the local variables in Heap file
tagged with: heap-dump
score: 11
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22491546
downvote count: 0
favorite count: 0
tagged with: eclipse-memory-analyzer
tagged with: visualvm

http://stackoverflow.com/comment/34384935
type: AnswerComment
score: 0
type: Comment
has text: oh thats some seconds to late, i changed the return type to int and added if(zrs.next()){ return zrs.getInt(1); } which works now also, but thanks! :D
comment on: http://stackoverflow.com/a/22586301

http://stackoverflow.com/q/22630999
tagged with: io
upvote count: 6
accepted answer: http://stackoverflow.com/a/23205067
favorite count: 0
has title: Cannot create Path object from a string
tagged with: path
score: 5
downvote count: 1
type: AnsweredQuestion
has body: I'm following along the Basic I/O Tutorial on Oracle.com, but I'm having difficulty making a Path object: Path p1 = Paths.get("/tmp/foo"); Which gives the error: error: The method get(URI) in the type Paths is not applicable for the arguments (String). I'm on Linux and I'm working in Eclipse Kepler. I'm trying to access a text file in the current directory. Using Scanner and File I can work with the file, but I'd also like to fiddle around with a path to the file so I can continue with the tutorial. edit: The entirety of the program is below. The second half is me being a rookie and confirming the file exists/works. When I comment out the Path definitions, I get the output of "Test" which is in the 'save.txt' file.: package projectSARA; import java.util.*; import java.io.*; import java.net.URI; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { String saveFile = "save.txt"; Path p1 = Paths.get(saveFile); Path p2 = Paths.get("save.txt"); File file = new File(saveFile); try{ Scanner in = new Scanner(file); String test = in.next(); System.out.println(test); } catch(FileNotFoundException e){ System.out.println("File not found"); } }// end main }
tagged with: java
has answer: http://stackoverflow.com/a/23947503
has comment: http://stackoverflow.com/comment/34464605
type: Question
has answer: http://stackoverflow.com/a/23205067
answer count: 2
possible better answer: http://stackoverflow.com/a/23947503
tagged with: nio

http://stackoverflow.com/comment/42409162
type: Comment
comment on: http://stackoverflow.com/a/22606381
has text: Wrong answer. He don't want to show the action in ActionBar. He want to show the overflow menu even the phone have a menu button. (which isn't the default behavior)
type: AnswerComment
score: 0

http://stackoverflow.com/a/22508600
has body: Just use an ArrayList type to store all the values that you want to give in the list. Then use an ArrayAdapter to put all these list items into the list. That way, all the items will be clickable. for example--> public class CreateList extends ListActivity { ArrayList&lt;String&gt; myList=new ArrayList&lt;String&gt;; ArrayAdapter&lt;String&gt; myAdapter; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.createlist); myAdapter=new ArrayAdapter&lt;String&gt; (CreateList.this,android.R.layout.simple_list_item_1,myList); setListAdapter(myAdapter); myList.add("genesis"); myAdapter.notifyDataSetChanged(); } } you can make your xml file as--> createlist.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="wrap_content"/&gt; &lt;/LinearLayout&gt; Hope this helps. :)
score: 0
answers question: http://stackoverflow.com/q/22508310
type: Answer

http://stackoverflow.com/a/22503088
has comment: http://stackoverflow.com/comment/34248896
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34806551
accepted answer of: http://stackoverflow.com/q/22499930
type: Answer
has body: Try this pseudo code Set allCS;//create an empty set String[] subStrings = getSubSequences(String_2) //find the subsequence of String_2 for (String str : subStrings) allCS.put(LCS(String_1,str)) //add LCS of (String_1,str) to allCS Note : getSubSequences(String s) returns all the subsequence of the given string parameter LCS(String s1, String s2) returns the LCS of s1 and s
has comment: http://stackoverflow.com/comment/34248760
answers question: http://stackoverflow.com/q/22499930
has comment: http://stackoverflow.com/comment/34820086

http://stackoverflow.com/a/22694578
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22607440
has body: To answer your question, try replacing listBackupContacts.clear() with listBackupContacts = new ArrayList&lt;BackupContact&gt;() + some other mods (see below) I can't see how else you'd get around the issue of the single listBackupContents object being assigned to the final set of values (where idBackup==4). ArrayList&lt;BackupContact&gt; listBackupContacts = null; // don't create yet if(cursor.moveToFirst()) { Integer aux = 0; do{ final Integer idBackup = cursor.getInt(0); final Long timestamp = cursor.getLong(1); final Integer contactsCount = cursor.getInt(2); final String description = cursor.getString(3); final Integer restoreCount = cursor.getInt(4); final Integer idBackupContact = cursor.getInt(5); final String vcard = new String(cursor.getBlob(7), "UTF-8"); final String displayName = cursor.getString(8); if(aux != idBackup) { Backup backup = new Backup(); BackupInfo backupInfo = new BackupInfo(idBackup, description, contactsCount, restoreCount, timestamp); listBackupContacts = new ArrayList&lt;BackupContact&gt;(); backup.setBackupContacts(listBackupContacts); listBackupsToReturn.add(backup); backup.setBackupInfo(backupInfo); aux = idBackup; } BackupContact backupContact = new BackupContact(idBackupContact, idBackup, vcard, displayName); listBackupContacts.add(backupContact); } while(cursor.moveToNext()); } return listBackupsToReturn; }
type: Answer
score: 1

http://stackoverflow.com/a/22522037
has comment: http://stackoverflow.com/comment/34304240
has comment: http://stackoverflow.com/comment/34311327
has comment: http://stackoverflow.com/comment/34271918
type: Answer
has comment: http://stackoverflow.com/comment/34271065
has comment: http://stackoverflow.com/comment/34307603
has body: ArrayList&lt;E&gt;.get(i) performs virtually the exact same function as [] in static arrays. The only difference between the two is that ArrayList&lt;E&gt;.get(i) is simply adapted into the object context. In other words, you can dereference it. First, you'll need to change the privacy of Customer's fields to public to give the ArrayList&lt;Customers&gt; object access to it. Then you'll be able to retrieve your class' fields with simply: customers.get(index).FirstName //or whatever other field
has comment: http://stackoverflow.com/comment/34274383
has comment: http://stackoverflow.com/comment/34270811
has comment: http://stackoverflow.com/comment/34271992
has comment: http://stackoverflow.com/comment/34273565
has comment: http://stackoverflow.com/comment/34302413
has comment: http://stackoverflow.com/comment/34273044
score: 0
has comment: http://stackoverflow.com/comment/34275776
answers question: http://stackoverflow.com/q/22521784
has comment: http://stackoverflow.com/comment/34318616
has comment: http://stackoverflow.com/comment/34271946

http://stackoverflow.com/comment/34457315
type: Comment
type: QuestionComment
has text: @TapasKumarSenapati Well, obviously you are wrong, as your own benchmark shows...
score: 0
comment on: http://stackoverflow.com/q/22626713

http://stackoverflow.com/a/22639511
answers question: http://stackoverflow.com/q/22639379
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34479583
type: Answer
downvote count: 0
has body: In your if, create a new char[] and then place the characters into it. char[] substr = new char[charList.length-i]; for (int j = 0; j &lt; charList.length-i; j++) { substr[j] = charList[i+j]; } break; // out of the loop over i I wrote break but you will probably be returning it, or you would declare substr outside of this scope. The code I wrote is just to give you the idea. I made a simple ideone for this so you can see it working.

http://stackoverflow.com/comment/34754024
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22488366
has text: Yep. I am using OkHttp 1.5.2 together with newest RetroFit. So I guess I do read the full request. As proposed [here](https://github.com/square/okhttp/blob/master/okhttp/src/main/java/com/squareup/okhttp/HttpResponseCache.java) I do add the max-stale header to my request but still the requests wont get cached.
score: 0

http://stackoverflow.com/comment/34412561
has text: Can you be more specific? What should I provide exactly for the merge function (the 3rd parameter)?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22601682

http://stackoverflow.com/a/22515633
answers question: http://stackoverflow.com/q/22514490
accepted answer of: http://stackoverflow.com/q/22514490
type: AcceptedAnswer
has body: if your webservice accepts one string parameter and returns one string as result then you can exchange any data you wish by string encoding convention. a odbc/jdbc/oledb databaseconnection string works like this. i use these strings to transfer xml between mobile device and server String xmlResult = myWebservice.getItems(xmlRquestParameter);
score: 0
type: Answer

http://stackoverflow.com/comment/34314966
has text: DroidSansFallback has chinese characters. You can get it from https://github.com/android/platform_frameworks_base/tree/master/data/fonts (or you should have a copy in your android sdk folder). If you use this font there would be a good chance the symbols look very close to the rest of the Android apps on the phone (if that is a goal).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22520423
type: Comment

http://stackoverflow.com/q/22534294
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34294389
accepted answer: http://stackoverflow.com/a/22535069
tagged with: java
has body: I been reading articles about how object pooling reduces the garbage collection for games, especially for event listeners where the key event is constantly being created and destroyed. They mention how object pooling would decrease the memory problem but nowhere in code does it say how to actually do it. How do you object pool for events in JavaScript or Java?
type: Question
has comment: http://stackoverflow.com/comment/34292422
answer count: 1
tagged with: javascript
score: 0
has comment: http://stackoverflow.com/comment/34292580
tagged with: object-pooling
tagged with: garbage-collection
has title: How to Object pool for event Listeners in Java or JavaScript
has comment: http://stackoverflow.com/comment/34292279
has comment: http://stackoverflow.com/comment/34292241
has answer: http://stackoverflow.com/a/22535069

http://stackoverflow.com/a/22547488
score: 1
answers question: http://stackoverflow.com/q/22544785
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34354290
has body: I'd use an editor and correct the code. What you have sounds like it's simply wrong. Maybe a regex in IntelliJ could do it easily: replace (\\d+)(^)(\\d+) with Math.pow($1, $2) The ^ character has a special meaning in regular expressions. You might have to escape it to make it a character.
downvote count: 0

sparse-array
tags question: http://stackoverflow.com/q/22644745
tag name: sparse-array
type: Tag

http://stackoverflow.com/a/22545853
has comment: http://stackoverflow.com/comment/34590496
has comment: http://stackoverflow.com/comment/34954172
has body: I wanted to check to see if there was some subtle syntax error, so I cut/paste your code into an editor and tried to massage it to get it running. After my massaging, I ran it and it ran fine. Here is the code I ran and the results I got: Code: import java.util.ArrayList; public class Game { private static ArrayList&lt;Player&gt; players = new ArrayList&lt;Player&gt;(); private static ArrayList&lt;String&gt; pdead = new ArrayList&lt;String&gt;(); public static void main(String[] args) { // Some Test Data Player p1 = new Player("George"); p1.setHp(10); players.add(p1); Player p2 = new Player("Bob"); p2.setHp(10); players.add(p2); // Print Current State of data System.out.println("Current Players"); for(Player p: players) { System.out.println(p.getName() + ": " + p.getHp()); } System.out.println("Dead Players"); if (pdead.isEmpty()) { System.out.println("None"); } else { for (int index=0; index &lt; pdead.size(); index++) { System.out.println(pdead.get(index)); } } // Kill Bob p2.setHp(0); // Do work to add names to dead players data structure for (int index2=0; index2 &lt; players.size(); index2++) { if ((players.get(index2).getHp() &lt;= 0) &amp;&amp; !(pdead.contains(players.get(index2).getName()))) { pdead.add(players.get(index2).getName()); } } // Print Current State of data System.out.println("Current Players"); for(Player p: players) { System.out.println(p.getName() + ": " + p.getHp()); } System.out.println("Dead Players"); if (pdead.isEmpty()) { System.out.println("None"); } else { for (int index=0; index &lt; pdead.size(); index++) { System.out.println(pdead.get(index)); } } } } class Player { private String name = ""; private int hp = 0; public Player(String n) { name = n; } public String getName() { return name; } public int getHp() { return hp; } public void setHp(int h) { hp = h; } } Here are the results that code gives me: javac Game.java java Game Current Players George: 10 Bob: 10 Dead Players None Current Players George: 10 Bob: 0 Dead Players Bob
has comment: http://stackoverflow.com/comment/34491097
has comment: http://stackoverflow.com/comment/34355652
answers question: http://stackoverflow.com/q/22544818
score: 0
type: Answer

http://stackoverflow.com/comment/34406561
has text: This isn't a good question for the StackOverflow format. We usually prefer questions where someone has tried something and can't get it to work and doesn't know why. I'll make this suggestion: you have duplicated code that calls `Character.getNumericValue`. Move that up and assign it to a variable, so that it appears only once. That should also make it easier to eliminate the unwanted coefficients and terms.
score: 0
comment on: http://stackoverflow.com/q/22598358
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22632212
answer count: 4
has answer: http://stackoverflow.com/a/22634637
tagged with: servlets
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22632835
has body: I have this json string, comming from a java script: [{"clientNumber":"33"},{"clientName":"3"},{"clientEik":"3"}] when I get it inside of my servlet, here is what I'm doing: JSONArray jsonArr = new JSONArray(URLDecoder.decode(mainData, "UTF-8")); dataObj.put("data", jsonArr); Now it looks like: {"data":[{"clientNumber":"33"},{"clientName":"3"},{"clientEik":"3"}]} What I'm trying to do is to get the clientNumber by: dataObj.getString("clientNumber") BUT it is bombing me with an exception: org.json.JSONException: JSONObject["clientNumber"] not found. Why I can't access it? I know that I'm missing a really small part, but I can't make my mind and find it.
possible better answer: http://stackoverflow.com/a/22632332
has answer: http://stackoverflow.com/a/22632332
type: Question
has answer: http://stackoverflow.com/a/22632503
has title: Why I can't access the object in my json?
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22632503
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/34353003
type: Comment
comment on: http://stackoverflow.com/q/22568641
has text: os=socket.getOutputStream();
score: 0
type: QuestionComment

http://stackoverflow.com/q/22626281
tagged with: java
has title: Apache Derby Driver Not Loaded Automatically
type: Question
tagged with: derby
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22636345
has body: I'm confused about loading database driver for Apache Derby. In it's documentation it is said that: "If your application runs on JDK 6 or higher, you do not need to explicitly load the EmbeddedDriver. In that environment, the driver loads automatically." https://db.apache.org/derby/docs/10.7/devguide/cdevdvlp40653.html My connection URL is: jdbc:derby:testdb;create=true When I try to connect to Java Derby without loading driver, I always get the following error: Error: java.sql.SQLException: No suitable driver found for jdbc:derby:testdb If I load the driver explicitly by adding the following line, the error goes away. Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); Now my question is why should I need to load this driver explicitly? I'm running my database application on Eclipse with a reference to JRE7. Why it isn't loaded automatically?
possible better answer: http://stackoverflow.com/a/22634616
tagged with: jdbc
has answer: http://stackoverflow.com/a/22634616
tagged with: driver
accepted answer: http://stackoverflow.com/a/22636345
type: AnsweredQuestion

http://stackoverflow.com/comment/54344268
score: 0
type: AnswerComment
has text: @NathanTuggy Pardon me if im wrong but I believe that there is reasoning behind getting the prefix String, calling substring twice for indexOf and lastIndexOf is wasteful and there is no point, why call substring(0, n) once for indexOf and again for lastIndexOf.
type: Comment
comment on: http://stackoverflow.com/a/29482955

http://stackoverflow.com/a/22582171
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/34377120
has comment: http://stackoverflow.com/comment/34763952
type: Answer
has body: To make the Java version completely equivalent to your Scala code you need to change it like this. private int t = 20; private int t() { return this.t; } private void run() { int i = 10; while (!isEvenlyDivisible(2, i, t())) i += 2; System.out.println(i); } It is slower because the JVM can not optimize the method calls.
score: 1
answers question: http://stackoverflow.com/q/22581163

http://stackoverflow.com/a/22587497
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34388525
answers question: http://stackoverflow.com/q/22587422
score: 1
has comment: http://stackoverflow.com/comment/34386950
upvote count: 1
has comment: http://stackoverflow.com/comment/34387936
has comment: http://stackoverflow.com/comment/34390821
has body: There is no such data structure in the Java class libraries. But you could create one that is a wrapper for a private HashMap and a private TreeMap with the same set of key/value pairs. This gives a data structure that has get complexity of O(1) like a regular HashMap (but not put or other update operations), and a key Set and entry Set which can be iterated in key order ... as requested in the original version of this Question. Here is a start for you: public class HybridMap&lt;K,V&gt; implements Map&lt;K,V&gt; { private HashMap&lt;K,V&gt; hashmap = ... private TreeMap&lt;K,V&gt; treemap = ... @Override V get(K key) { return hashmap.get(key); } @Override void (K key, V value) { hashmap.put(key, value); treemap.put(key, value); } // etcetera } Obviously, I've only implemented some of the (easy) methods. If you want to be able to iterate the entries in value order (rather than key order), once again there is no such data structure in the Java class libraries. In this case, wrapping a HashMap and TreeMap is going to be very complicated if you need the resulting Map to conform fully to the API contract. So I suggest that you just use a HashMap and TreeSet of the key/value pairs ... and manually keep them in step.

http://stackoverflow.com/q/22611099
has comment: http://stackoverflow.com/comment/34469030
has comment: http://stackoverflow.com/comment/34462434
has comment: http://stackoverflow.com/comment/34431391
tagged with: smartclient
has answer: http://stackoverflow.com/a/22906384
accepted answer: http://stackoverflow.com/a/22906384
has comment: http://stackoverflow.com/comment/34461606
type: Question
has comment: http://stackoverflow.com/comment/34464014
has comment: http://stackoverflow.com/comment/34464297
has comment: http://stackoverflow.com/comment/34465267
has comment: http://stackoverflow.com/comment/34462838
has comment: http://stackoverflow.com/comment/34461839
score: 0
has body: I created a button that allows to create a zip file., the function that zips the file works correctly, but when I call her via the button (in the JS file) it crashes and it gives a blank page (I think I do not manage the output stream) would please an idea (this is a new modified version (for those who see that it is the same question) here is the code : Button isc.ToolStripButton.create({ ID: "BooksApp_GetXmlImage_Button" ,autoDraw:false ,icon: getUIIcon("icon_xml_16") ,prompt: getUIMsg("book_report_get_xml",4) ,showHover:true ,hoverStyle:"book_hover_style" ,click : function () { BooksApp_Action_loadFile("objx"); // isc.say("test"); } }); function to call the zipfile() method: function BooksApp_Action_loadFile(p_UsedFormat) { var tmpBookID = BooksApp_Application.FP_BookID; var tmpIDs = BooksApp_Application.FP_fct_getSelectedPOVIDs(); var tmpUsr_ID = FPIUser.FP_fct_getID(); var tmpFormat = p_UsedFormat; var showInWindow=false; books_objects.exportData( { r_book_idnum : tmpBookID ,sBook_ID : tmpBookID ,sPOV_IDs : tmpIDs ,sUser_ID : tmpUsr_ID ,sFormat : tmpFormat } ,{ operationId: "customExport" ,exportDisplay: (showInWindow ? "window" : "download") } ,function (dsResponse, data, dsRequest) { //Never called BooksApp_Action_Log("BooksApp_Action_loadFile:"+data); } ); } customExport() function public static String customExport(RPCManager rpc, HttpServletResponse response) throws Exception { String sReturn = _Return_OK; try { // setting doCustomResponse() notifies the RPCManager that we'll // bypass RPCManager.send // and instead write directly to the servletResponse output stream rpc.doCustomResponse(); RequestContext.setNoCacheHeaders(response); writeServerDebug("customExport : start"); DSRequest req = rpc.getDSRequest(); List&lt;?&gt; results = req.execute().getDataList(); String sReqData = (String) req.getParameter("exportDisplay"); String sReqData_sBook_ID = "" + req.getCriteriaValue("sBook_ID"); String sReqData_sPOV_IDs = "" + req.getCriteriaValue("sPOV_IDs"); Stri…
answer count: 1
has comment: http://stackoverflow.com/comment/34464855
has comment: http://stackoverflow.com/comment/34464423
type: AnsweredQuestion
has title: create a zip file. and download it
tagged with: java

http://stackoverflow.com/a/22628901
answers question: http://stackoverflow.com/q/22628448
score: 3
type: Answer
upvote count: 3
has body: every job is identified by a individual name and group name to which is belongs to. You have used 'detail.setName()' There must be another function called detail.setGroupName() or something similar –
accepted answer of: http://stackoverflow.com/q/22628448
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34483759
type: AnswerComment
comment on: http://stackoverflow.com/a/22641037
type: Comment
score: 2
has text: This is the most likely solution. When eclipse memory goes crazy, it's usually the add-ons. You have two solutions, increase available memory which is valid if you are running many add-ons and none of them are too abusive on the memory. The other solution as Scott mentioned is to start uninstalling and reinstalling to isolate the issue. If you have increased memory dramatically (512, 1024) and it still runs out but takes longer, it's really sounding like a leaky add-on.

http://stackoverflow.com/q/22499200
has comment: http://stackoverflow.com/comment/34233147
has body: Suppose I am creating a immutable class Employee which has has mutable class reference Address. how can we create the immutable class with scenario. I just refer to this link click here. I did not understand this point: Don't share references to the mutable objects. Never store references to external, mutable objects passed to the constructor; if necessary, create copies, and store references to the copies. Similarly, create copies of your internal mutable objects when necessary to avoid returning the originals in your methods.
upvote count: 4
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/34230261
has comment: http://stackoverflow.com/comment/34230543
has comment: http://stackoverflow.com/comment/34230262
has title: Immutable class with reference of mutable class
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22499474
has answer: http://stackoverflow.com/a/22499328
score: 1
tagged with: java
downvote count: 3
tagged with: mutable
has answer: http://stackoverflow.com/a/22499476
type: Question
has comment: http://stackoverflow.com/comment/34230960

http://stackoverflow.com/comment/34240422
comment on: http://stackoverflow.com/q/22505148
type: Comment
type: QuestionComment
has text: *printing through different PDF versions* - you really mean different PDF versions? Or do you mean different Adobe Reader versions?
score: 0

http://stackoverflow.com/q/22576168
has title: What authentication does applications that tweet on our behalf use?
tagged with: oauth
has body: I created a Twitter App from my twitter account. It gave me four things Consumer Key Consumer Key Secret Access Token Access Token Secret For a while I am using these 4 things to tweet,retweet from the application that I am writing. It is cool that I can access the Twitter API using these 4 keys, which is also called OAuth. But these keys are secret to me . What authentication does applications, that tweet,schedules and may be other stuff use ? I beleive they cannot use OAuth for the reason it will need the 4 keys.
type: AnsweredQuestion
tagged with: java
tagged with: twitter
type: Question
has answer: http://stackoverflow.com/a/22579511
answer count: 1
accepted answer: http://stackoverflow.com/a/22579511
score: 0

http://stackoverflow.com/a/22686435
downvote count: 0
upvote count: 11
has comment: http://stackoverflow.com/comment/34633202
type: Answer
has body: Use this class for JacksonFactory instead of the previous one. com.google.api.client.json.jackson2.JacksonFactory
score: 11
answers question: http://stackoverflow.com/q/22513899

http://stackoverflow.com/a/22550437
downvote count: 0
has body: List has subList and equals. That's all you need. import java.util.*; import java.lang.*; import java.io.*; class TEST { public static void main (String[] args) throws java.lang.Exception { List&lt;Integer&gt; list1 = Arrays.asList(1,2,3,4,5); List&lt;Integer&gt; list2 = Arrays.asList(2,3); for (int i=0; i&lt;list1.size()-list2.size(); ++i) { if (list1.subList(i, i+list2.size()).equals(list2)) { System.out.println("found: "+i); return; } } System.out.println("not found"); } }
answers question: http://stackoverflow.com/q/22550264
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22550264
type: AcceptedAnswer

http://stackoverflow.com/comment/34388367
comment on: http://stackoverflow.com/a/22588305
type: Comment
has text: Still says, Not initialized.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22610985
has body: I have connected Oracle db with Application. For each and every run, no.of inactive sessions are increased and that means the old sessions are not reused and new three connection s are created for every insert/update operation. Only after shut downing Application server everything reset and comes to normal. If it continues, whether it raise any problem?. Any idea for why this happened and Anyway to rectify the issue? This is basic config for JDBC connection for Oracle Class.forName(driverClass); BoneCPConfig config = new BoneCPConfig(); config.setJdbcUrl("jdbc:oracle:thin:@localhost:1521:orcl"); config.setUsername(username); config.setPassword(password); config.setPartitionCount(1); config.setMinConnectionsPerPartition(2); config.setMaxConnectionsPerPartition(4); config.setAcquireIncrement(3); config.setLazyInit(true); config.setDefaultAutoCommit(true); config.setLogStatementsEnabled(true); poolManager = new BoneCP(config); Query select * from v$session where username='ORACLE_DB'; "SADDR" "SID" "SERIAL#" "AUDSID" "PADDR" "USER#" "USERNAME" "COMMAND" "OWNERID" "TADDR" "LOCKWAIT" "STATUS" "SERVER" "SCHEMA#" "SCHEMANAME" "OSUSER" "PROCESS" "MACHINE" "PORT" "TERMINAL" "PROGRAM" "TYPE" "SQL_ADDRESS" "SQL_HASH_VALUE" "SQL_ID" "SQL_CHILD_NUMBER" "SQL_EXEC_START" "SQL_EXEC_ID" "PREV_SQL_ADDR" "PREV_HASH_VALUE" "PREV_SQL_ID" "PREV_CHILD_NUMBER" "PREV_EXEC_START" "PREV_EXEC_ID" "PLSQL_ENTRY_OBJECT_ID" "PLSQL_ENTRY_SUBPROGRAM_ID" "PLSQL_OBJECT_ID" "PLSQL_SUBPROGRAM_ID" "MODULE" "MODULE_HASH" "ACTION" "ACTION_HASH" "CLIENT_INFO" "FIXED_TABLE_SEQUENCE" "ROW_WAIT_OBJ#" "ROW_WAIT_FILE#" "ROW_WAIT_BLOCK#" "ROW_WAIT_ROW#" "TOP_LEVEL_CALL#" "LOGON_TIME" "LAST_CALL_ET" "PDML_ENABLED" "FAILOVER_TYPE" "FAILOVER_METHOD" "FAILED_OVER" "RESOURCE_CONSUMER_GROUP" "PDML_STATUS" "PDDL_STATUS" "PQ_STATUS" "CURRENT_QUEUE_DURATION" "CLIENT_IDENTIFIER" "BLOCKING_SESSION_STATUS" "BLOCKING_INSTANCE" "BLOCKING_SESSION" "FINAL_BLOCKING_SESSION_STATUS" "FINAL_BLOCKING_INSTANCE" "FINAL_BLOCKING_SESSION"…
answer count: 0
tagged with: java
type: Question
tagged with: jdbc-odbc
tagged with: bonecp
downvote count: 0
has title: No.of Inactive session increased while connection made using BoneCP - for every run
favorite count: 0
tagged with: database-connection
upvote count: 2
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/34366687
comment on: http://stackoverflow.com/q/22576529
type: Comment
score: 2
type: QuestionComment
has text: "If i use the same for the pdf file then it's not the right encoding." PDFs aren't text files - they're binary files. Your `createAppDataToWriteToPdf` should return a byte array, not a String.

http://stackoverflow.com/q/22635075
answer count: 2
has answer: http://stackoverflow.com/a/22635912
has answer: http://stackoverflow.com/a/22635743
downvote count: 0
has comment: http://stackoverflow.com/comment/34471295
has comment: http://stackoverflow.com/comment/34471416
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34472985
has comment: http://stackoverflow.com/comment/34472995
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34472823
tagged with: maven
has body: I have a multi module project like below Parent Child1 Child2 Child3 Integration The Integration project (pax-exam test) has references to Child1 and Child2, thus recator order will be: Child1 Child2 Integration Child3 but is required to have Child3 at runtime (osgi-bundle) and fails because Child3 isn't installed yet. If I specify the Integration project last in my 's section in the parent pom everything works, but as soon as a new project is added it will be appended last in the section and there will be fails all over again. Is there anyway to force one project to be built/installed last, ie. overriding reactor order determined here http://maven.apache.org/guides/mini/guide-multiple-modules.html ? I've tried failsafe plugin but the seems to only run integration tests after unit tests INSIDE current project and not the whole stack. Thanks UPDATE: I don't want to add dependencies to Integration project each time a new child project is added just for the sake of getting the Integration project to install last. Then it's just easier to remember to move the Integration module last in list in parent pom modules section. The dependencies is already taken care of with the features.xml file that is loaded from pax-exam.
type: Question
has comment: http://stackoverflow.com/comment/34471252
tagged with: java
has title: Maven force build order of project
has comment: http://stackoverflow.com/comment/34472459

http://stackoverflow.com/q/22627286
has title: Java ActionListener (multiple statements)
has answer: http://stackoverflow.com/a/22627446
answer count: 1
has body: The following is the edited and (extremely basic version) of my codes so you could understand clearly what it is that i am trying to do. I would like to use: public void actionPerformed(ActionEvent e){ } The problem is that i can't edit/ manupulate moves for my chess pieces in the loops under ActionListener but it never functions all statement, it always only functions on one if statement and ignores the others. if(e.getSource()==cSquare[a][b]){ //current source if(switcher=="1" &amp;&amp; cSquare[a][b].getChessPiece()=="Pawn" ) {} Simple example of ActionListener: for(int i=0;i&lt;8;i++){ for(int j=0;j&lt;8;j++){ .... elements[i][x] = new OriginalElements(i, x, "None"); elemenents[i][j].setIcon(None); ....... if(elements[i][x].Xpos()==2 &amp;&amp; elements[i][x].Ypos()==2){ elements[i][x].setIcon(Image); cSquare[i][x].setChessPiece("Image"); } elements[i][j].addActionListener(cListener); //Click do this panel.add(elements[i][jx); My question would be; how could i implement multiple (if, else etc) statements into the ActionListener and make it work on all? rather than only one. I've tried every possibility i know but only seems to work on a single element (e.g. move image from square to another square and replace current square image with 'EmptyImage'. Thank you for your time. P.S : ignore the "professonality" of the codes. I changed it to give you a clear understanding;; thanks :)
has comment: http://stackoverflow.com/comment/34458289
score: 0
linked to: http://stackoverflow.com/q/513832
type: UnansweredQuestion
tagged with: swing
type: Question
tagged with: actionlistener
tagged with: java

http://stackoverflow.com/comment/126434709
comment on: http://stackoverflow.com/a/22829362
has text: Well explained jlmcdonald. Kudos.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34330516
comment on: http://stackoverflow.com/q/22555440
score: 0
type: Comment
type: QuestionComment
has text: @CFlex Nope, I even made a file search in the project folder to be 100% sure, it's the only one...

http://stackoverflow.com/comment/34272606
score: 0
type: Comment
type: QuestionComment
has text: I would start with running the standalone.bat first to make sure it works okay without any netbeans interaction, which it should. Then you can try running it inside netbeans.
comment on: http://stackoverflow.com/q/22522379

http://stackoverflow.com/comment/34212304
type: QuestionComment
has text: Welcome to Stack Overflow! What have you tried? What errors did you have? Show some effort or you will not get the answers you are expecting.
score: 0
comment on: http://stackoverflow.com/q/22488309
type: Comment

http://stackoverflow.com/a/22614831
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22614729
score: 1
upvote count: 1
has body: Have a look at System.arraycopy() :) http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#arraycopy(java.lang.Object, int, java.lang.Object, int, int) Should just be something like System.arraycopy(oldArray, 0, newArray, 0, oldArray.size);

http://stackoverflow.com/comment/116968909
comment on: http://stackoverflow.com/a/22648902
type: AnswerComment
type: Comment
score: 0
has text: I had to deal with the legacy ADF application implemented in JDeveloper 11g 11.1.1.7.0 and this answer led me to a resolution of the issue. One minor input from me in that regard though. 1. I have used the "set JDEV_USER_DIR= " environment variable to explicitly set the location of the CONFIG folder - the one, where the Integrated Server domain configuration is going to be located. 2. Yes, I had to delete the folder system11.1.1.7.40.64.93 located there along with the tmp folder -- and that solved the issue! The AppData\Roaming folder didn't have a JDeveloper folder at all in my case.

http://stackoverflow.com/q/22534763
tagged with: spring-3
has comment: http://stackoverflow.com/comment/34293120
upvote count: 2
tagged with: java
answer count: 3
has body: I am using Spring 3 MVC. I have both mvc-dispatcher-servlet.xml and applicationContext.xml. But applicationContext.xml is not loading only mvc-dispatcher-servlet.xml is loading. Any problem with my configuration? web.xml Archetype Created Web Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:spring/mvc-dispatcher-servlet.xml 1 mvc-dispatcher *.do contextConfigLocation classpath:spring/extendedContext.xml org.springframework.web.context.ContextLoaderListener
type: UnansweredQuestion
has title: Loading both mvc-dispatcher-servlet.xml and applicationContext.xml?
has comment: http://stackoverflow.com/comment/34292885
has comment: http://stackoverflow.com/comment/34292838
has answer: http://stackoverflow.com/a/22545534
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34293423
has answer: http://stackoverflow.com/a/79321263
has answer: http://stackoverflow.com/a/22535107
favorite count: 0
linked to: http://stackoverflow.com/q/1841857
has comment: http://stackoverflow.com/comment/34293071
type: Question
linked to: http://stackoverflow.com/q/9016122
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/34379948
comment on: http://stackoverflow.com/q/22583540
has text: Post code as text, not as picture.
score: 1
type: QuestionComment
type: Comment

gmail
type: Tag
tags question: http://stackoverflow.com/q/22609548
tag name: gmail

http://stackoverflow.com/comment/34252444
type: QuestionComment
comment on: http://stackoverflow.com/q/22509488
has text: With this example I see the point you were trying to make much more clearly - I agree, it looks to me like the ternary operator isn't inferring types in the way it should do.
score: 0
type: Comment

http://stackoverflow.com/q/22540954
has comment: http://stackoverflow.com/comment/34312439
tagged with: logging
has answer: http://stackoverflow.com/a/22542005
tagged with: java
type: Question
has title: Java logging and throwing exception
has body: I know this is an Anti-Pattern, but in my RESTful application I want to log and throw. I have this Code log.warn("Cannot determine provider from name: " + name); throw X.bad("Cannot determine provider from name: " + name); This is a situation that shouldn't happen - it is just the last else in a series of if/else if. However in case it does happen it might indicate a front-end bug/error. My restful stack can deal with exceptions and map them to HTTP responses. I also want a log entry with a good stacktrace. I would like the log entry to pertain to the place it was thrown from (I.e. logger category (class name) and stacktrace. I did think of putting a log.warn(...) inside X.bad() but then the logging class is X and the stacktrace is bigger than it was when the exception was needed to be thrown. Does anyone have a more integrated solution? (I think to stop the repetition of the text component more then anything) Thanks Rob
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34304834
tagged with: exception
type: UnansweredQuestion

http://stackoverflow.com/a/22575309
has comment: http://stackoverflow.com/comment/34381289
has comment: http://stackoverflow.com/comment/34374389
has body: It connects to the server and gets the certificates. There's no way it could have all the certificates already stored in a file, because then Java would have to update every time a certificate was added, removed or replaced anywhere on the Internet. And that obviously doesn't happen.
score: 0
answers question: http://stackoverflow.com/q/22575096
type: Answer

regex
tags question: http://stackoverflow.com/q/22583781
tags question: http://stackoverflow.com/q/22552013
tags question: http://stackoverflow.com/q/22633091
tags question: http://stackoverflow.com/q/22566503
tags question: http://stackoverflow.com/q/22534480
tags question: http://stackoverflow.com/q/22583332
tags question: http://stackoverflow.com/q/22499778
tags question: http://stackoverflow.com/q/22507774
tags question: http://stackoverflow.com/q/22522256
tags question: http://stackoverflow.com/q/22490149
tag name: regex
tags question: http://stackoverflow.com/q/22542092
tags question: http://stackoverflow.com/q/22564820
tags question: http://stackoverflow.com/q/22626913
tags question: http://stackoverflow.com/q/22532005
tags question: http://stackoverflow.com/q/22644993
tags question: http://stackoverflow.com/q/22591637
tags question: http://stackoverflow.com/q/22596944
tags question: http://stackoverflow.com/q/22541519
tags question: http://stackoverflow.com/q/22634450
tags question: http://stackoverflow.com/q/22502339
tags question: http://stackoverflow.com/q/22568518
tags question: http://stackoverflow.com/q/22633951
tags question: http://stackoverflow.com/q/22539231
tags question: http://stackoverflow.com/q/22597307
tags question: http://stackoverflow.com/q/22640115
tags question: http://stackoverflow.com/q/22625026
tags question: http://stackoverflow.com/q/22622051
tags question: http://stackoverflow.com/q/22595068
tags question: http://stackoverflow.com/q/22572956
tags question: http://stackoverflow.com/q/22515540
tags question: http://stackoverflow.com/q/22551448
tags question: http://stackoverflow.com/q/22643806
tags question: http://stackoverflow.com/q/22611864
tags question: http://stackoverflow.com/q/22557708
tags question: http://stackoverflow.com/q/22510793
tags question: http://stackoverflow.com/q/22604709
tags question: http://stackoverflow.com/q/22577473
tags question: http://stackoverflow.com/q/22590530
tags question: http://stackoverflow.com/q/22573953
tags question: http://stackoverflow.com/q/22571186
tags question: http://stackoverflow.com/q/22586639
tags question: http://stackoverflow.com/q/22523641
tags question: http://stackoverflow.com/q/22517695
tags question: http://stackoverflow.com/q/22509476
tags question: http://stackoverflow.com/q/22500719
tags question: http://stackoverflow.com/q/22547514
tags question: http://stackoverflow.com/q/22583804
tags question: http://stackoverflow.com/q/22546392
tags question: http://stackoverflow.com/q/22558666
tags question: http://stackoverflow.com/q/22498779
tags question: http://stackoverflow.com/q/22574915
tags question: http://stackoverflow.com/q/22620407
tags question: http://stackoverflow.com/q/22598177
tags question: http://stackoverflow.com/q/22507972
tags question: http://stackoverflow.com/q/22648108
tags question: http://stackoverflow.com/q/22573008
tags question: http://stackoverflow.com/q/22544217
tags question: http://stackoverflow.com/q/22557567
tags question: http://stackoverflow.com/q/22553911
tags question: http://stackoverflow.com/q/22572197
tags question: http://stackoverflow.com/q/22544241
tags question: http://stackoverflow.com/q/22522145
tags question: http://stackoverflow.com/q/22617761
tags question: http://stackoverflow.com/q/22540518
tags question: http://stackoverflow.com/q/22553806
tags question: http://stackoverflow.com/q/22565517
tags question: http://stackoverflow.com/q/22565139
tags question: http://stackoverflow.com/q/22507096
tags question: http://stackoverflow.com/q/22624948
tags question: http://stackoverflow.com/q/22513525
tags question: http://stackoverflow.com/q/22587187
type: Tag
tags question: http://stackoverflow.com/q/22574441

http://stackoverflow.com/q/22548148
linked to: http://stackoverflow.com/q/11430095
has answer: http://stackoverflow.com/a/62393872
upvote count: 10
tagged with: c++
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/62393872
downvote count: 0
has answer: http://stackoverflow.com/a/22548269
has comment: http://stackoverflow.com/comment/34334862
has answer: http://stackoverflow.com/a/22548258
accepted answer: http://stackoverflow.com/a/22548258
type: Question
has comment: http://stackoverflow.com/comment/34317307
has comment: http://stackoverflow.com/comment/34336278
has comment: http://stackoverflow.com/comment/34348131
tagged with: java
has comment: http://stackoverflow.com/comment/34321244
score: 10
tagged with: http://stackoverflow.com/tag/c
tagged with: optimization
has title: Hoisting/Reordering in C, C++ and Java: Must variable declarations always be on top in a context?
answer count: 3
has body: I read a little about hoisting and reordering, so it seems that Java VM may choose to hoist some expressions. I also read about hoisting of function declarations in Javascript. First Question: Can someone confirm if hoisting usually exist in C, C++ and Java? or are they all compiler/optimization dependent? I read a lot of example C codes that always put variable declarations on top, before any assert or boundary condition. I thought it would be a little faster to do all the asserts and boundary cases before variable declarations given that the function could just terminate. Main Question: Must variable declarations always be on top in a context? (is there hoisting at work here?) Or does the compiler automatically optimize the code by checking these independent asserts and boundary cases first (before irrelevant variable declaration)? Here's a related example: void MergeSort(struct node** headRef) { struct node* a; struct node* b; if ((*headRef == NULL) || ((*headRef)-&gt;next == NULL)) { return; } FrontBackSplit(*headRef, &amp;a, &amp;b); MergeSort(&amp;a); MergeSort(&amp;b); *headRef = SortedMerge(a, b); } As shown above, the boundary case does not depend on variables "a" and "b". Thus, putting the boundary case above variable declarations would make it slightly faster? Updates: The above example isn't as good as I hoped because variables "a" and "b" were only declared, not initialized there. Compiler would ignore declaration until we actually need to use them. I checked GNU GCC assemblies for variable declarations with initializations, the assemblies have different execution sequence. Compiler did not change my ordering of independent asserts and boundary cases. So, reordering these asserts and boundary cases do change the assemblies, thus changing how machine runs them. I suppose the difference is minuscule that most people never cared about this.
tagged with: javascript
favorite count: 0
has comment: http://stackoverflow.com/comment/34317351
has comment: http://stackoverflow.com/comment/34317736

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/22610392
tags question: http://stackoverflow.com/q/22512178
tags question: http://stackoverflow.com/q/22530440
tags question: http://stackoverflow.com/q/22615311
tags question: http://stackoverflow.com/q/22619924
tags question: http://stackoverflow.com/q/22514267
tags question: http://stackoverflow.com/q/22608001
tags question: http://stackoverflow.com/q/22605354
tags question: http://stackoverflow.com/q/22615723
tags question: http://stackoverflow.com/q/22509363
tags question: http://stackoverflow.com/q/22633538
tags question: http://stackoverflow.com/q/22630643
tags question: http://stackoverflow.com/q/22610602
tags question: http://stackoverflow.com/q/22533745
tags question: http://stackoverflow.com/q/22562151
tags question: http://stackoverflow.com/q/22522340
tags question: http://stackoverflow.com/q/22502869
tags question: http://stackoverflow.com/q/22631072
tags question: http://stackoverflow.com/q/22623549
tags question: http://stackoverflow.com/q/22585970
tags question: http://stackoverflow.com/q/22546026
tags question: http://stackoverflow.com/q/22489120
tags question: http://stackoverflow.com/q/22510472
tags question: http://stackoverflow.com/q/22584641
tags question: http://stackoverflow.com/q/22556020
tags question: http://stackoverflow.com/q/22553292
tags question: http://stackoverflow.com/q/22521680
tags question: http://stackoverflow.com/q/22559518
tags question: http://stackoverflow.com/q/22528789
tags question: http://stackoverflow.com/q/22551999
tags question: http://stackoverflow.com/q/22541955
tags question: http://stackoverflow.com/q/22544681
tags question: http://stackoverflow.com/q/22643367
tags question: http://stackoverflow.com/q/22593754
tags question: http://stackoverflow.com/q/22506230
tags question: http://stackoverflow.com/q/22518441
tags question: http://stackoverflow.com/q/22565869
tags question: http://stackoverflow.com/q/22583467
tags question: http://stackoverflow.com/q/22500177
tags question: http://stackoverflow.com/q/22628315
tags question: http://stackoverflow.com/q/22578967
tags question: http://stackoverflow.com/q/22611213
type: Tag
tags question: http://stackoverflow.com/q/22615700
tags question: http://stackoverflow.com/q/22499511
tags question: http://stackoverflow.com/q/22578516
tags question: http://stackoverflow.com/q/22507742
tags question: http://stackoverflow.com/q/22573480
tags question: http://stackoverflow.com/q/22491884
tags question: http://stackoverflow.com/q/22609944
tags question: http://stackoverflow.com/q/22594963
tags question: http://stackoverflow.com/q/22524066
tags question: http://stackoverflow.com/q/22499066
tags question: http://stackoverflow.com/q/22534985
tags question: http://stackoverflow.com/q/22575288
tags question: http://stackoverflow.com/q/22622274
tags question: http://stackoverflow.com/q/22568695
tags question: http://stackoverflow.com/q/22529255
tags question: http://stackoverflow.com/q/22613742
tags question: http://stackoverflow.com/q/22629554
tags question: http://stackoverflow.com/q/22634229
tags question: http://stackoverflow.com/q/22569965
tags question: http://stackoverflow.com/q/22579176
tags question: http://stackoverflow.com/q/22502933
tag name: json
tags question: http://stackoverflow.com/q/22638581
tags question: http://stackoverflow.com/q/22568635
tags question: http://stackoverflow.com/q/22615317
tags question: http://stackoverflow.com/q/22500753
tags question: http://stackoverflow.com/q/22561527
tags question: http://stackoverflow.com/q/22604391
tags question: http://stackoverflow.com/q/22512306
tags question: http://stackoverflow.com/q/22614269
tags question: http://stackoverflow.com/q/22611686
tags question: http://stackoverflow.com/q/22630047
tags question: http://stackoverflow.com/q/22633558
tags question: http://stackoverflow.com/q/22545756
tags question: http://stackoverflow.com/q/22626918
tags question: http://stackoverflow.com/q/22503899
tags question: http://stackoverflow.com/q/22521649

http://stackoverflow.com/comment/34274709
type: QuestionComment
score: 0
type: Comment
has text: When you install a game all required runtime dependencies are installed with it by the installer.
comment on: http://stackoverflow.com/q/22524337

http://stackoverflow.com/comment/34321151
comment on: http://stackoverflow.com/q/22539973
type: Comment
type: QuestionComment
has text: Are exceptions preventing the forward?
score: 0

http://stackoverflow.com/q/22529286
type: Question
has comment: http://stackoverflow.com/comment/34283692
tagged with: crash
has comment: http://stackoverflow.com/comment/34286168
has comment: http://stackoverflow.com/comment/34283636
tagged with: rotation
has comment: http://stackoverflow.com/comment/34283665
has title: RuntimeException/device crash after rotate the device by using requestWindowFeature(Window.FEATURE_NO_TITLE)
has comment: http://stackoverflow.com/comment/34284071
has comment: http://stackoverflow.com/comment/34284895
upvote count: 1
has comment: http://stackoverflow.com/comment/34283265
favorite count: 0
has comment: http://stackoverflow.com/comment/34283452
has comment: http://stackoverflow.com/comment/34285125
has comment: http://stackoverflow.com/comment/34286367
has comment: http://stackoverflow.com/comment/34286866
has comment: http://stackoverflow.com/comment/34283556
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34283324
has body: The following code works for 3 of 4 devices: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } setContentView(R.layout.activity_main); Means: when the user is rotating the device into landscape mode, the titlebar is getting removed and the app goes fullscreen. So far, works on almost every device, except one in my tests. The one it doesn't work is a Galaxy S2 with 4.1 Firmware. It just crashes by rotating the device from portrait to landscape. Starting the app while having it in landscape mode works, also i can rotate to portrait. But it crashes as soon as rotating back to landscape... This is the line causing the crash: requestWindowFeature(Window.FEATURE_NO_TITLE); Logcat: 03-20 09:56:08.193: D/AndroidRuntime(8847): Shutting down VM 03-20 09:56:08.193: W/dalvikvm(8847): threadid=1: thread exiting with uncaught exception (group=0x4192d2a0) 03-20 09:56:08.193: E/AndroidRuntime(8847): FATAL EXCEPTION: main 03-20 09:56:08.193: E/AndroidRuntime(8847): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.example/de.example.MainActivity}: java.lang.NullPointerException 03-20 09:56:08.193: E/AndroidRuntime(8847): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110) 03-20 09:56:08.193: E/AndroidRuntime(8847): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 03-20 09:56:08.193: E/AndroidRuntime(8847): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3576) 03-20 09:56:08.193: E/AndroidRuntime(8847): at android.app.ActivityThread.access$800(ActivityThread.java:140) 03-20 09:56:08.193: E/AndroidRuntime(8847): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243) 03-20 09:5…
answer count: 0
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12127354

http://stackoverflow.com/a/22631001
has comment: http://stackoverflow.com/comment/34464547
type: Answer
has comment: http://stackoverflow.com/comment/34464319
answers question: http://stackoverflow.com/q/22630810
score: 1
upvote count: 1
has body: The first child of each of your user elements is an empty text node, so your println statements are probably just printing out nothing. Give this a try: for (int i = 0; i &lt; nodeList.getLength(); i++) { System.out.println(nodeList.item(i).getChildNodes()[1].getTextContent()); Users_List.add(nodeList.item(i).getChildNodes()[1].getTextContent()); } though this is probably better: for (int i = 0; i &lt; nodeList.getLength(); i++) { String name = ""; NodeList nameList = (NodeList)xPath.evaluate("Name", nodeList.items(i), XPathConstants.NODE); if(nameList.getLength() &gt; 0) { name = nameList.items(0).getTextContent(); } System.out.println(name); Users_List.add(name); }
downvote count: 0

http://stackoverflow.com/q/22583535
has comment: http://stackoverflow.com/comment/34380104
tagged with: linked-list
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34451908
type: Question
downvote count: 0
tagged with: data-structures
has comment: http://stackoverflow.com/comment/34452177
favorite count: 0
has answer: http://stackoverflow.com/a/22584422
has body: I have implemented a java code that reverses every k Node in the linked list and here is the code: public class ReverseALinkedList { public static void main(String[] args) { int k = 2; Node a = new Node(1); Node b = new Node(2); Node c = new Node(3); Node d = new Node(4); Node e = new Node(5); Node f = new Node(6); Node g = new Node(7); Node h = new Node(8); a.next = b; b.next = c; c.next = d; d.next = e; e.next = f; f.next = g; g.next = h; a.printLinkedList(); Node head = reverseKLinkedList(a, k); head.printLinkedList(); } private static Node reverseKLinkedList(Node first, int k) { Node current; Node temp; int count = 0; current = null; while (first != null &amp;&amp; count &lt; k) { temp = first.next; first.next = current; current = first; first = temp; ++count; } if (first != null) { first.next = reverseKLinkedList(first, k); } return current; } static class Node { public Node next; public int value; public Node(int value) { this.value = value; } public void printLinkedList() { Node head = this; while (head.next != null) { System.out.print(head.value + "-&gt;"); head = head.next; } System.out.print(head.value + "-&gt;null"); System.out.println(); } } } When I execute the code with the following linked list: 1->2->3->4->5->6->null and k set to 2, I get an output as follows: 2->1->null The rest of the nodes gets reversed (i.e., 4->3, 6->5), but they are not returned during the recursive call. Could anybody please let me know how to fix this?
has answer: http://stackoverflow.com/a/49476982
has title: Reversing K nodes in a Linked List
answer count: 4
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/34454984
has comment: http://stackoverflow.com/comment/34454758
has comment: http://stackoverflow.com/comment/34380010
has answer: http://stackoverflow.com/a/35533574
has answer: http://stackoverflow.com/a/22583736

http://stackoverflow.com/q/22587537
type: AnsweredQuestion
has title: g.drawImage not successful, completely stumped
type: Question
tagged with: jframe
has comment: http://stackoverflow.com/comment/34387222
has comment: http://stackoverflow.com/comment/34387344
has comment: http://stackoverflow.com/comment/34387160
has answer: http://stackoverflow.com/a/22587945
tagged with: drawimage
score: 0
has comment: http://stackoverflow.com/comment/34387339
tagged with: java
has body: Trying to draw an image and I have no idea why it's not appearing on the screen. Image is loaded fine. System.out.printf("%nPlayer_1.img_player1 is: "+Player_1.img_player1); says that the image is loaded correctly (correct image w/h etc). Have tried all manner of image observers, drawing the image from different classes (namely Player_1.drawSquare and MyPanel.painComponent) There are regular repaint() requests coming in from the Control class, but I do not believe this is preventing the drawing. No error's are thrown. player_1.gif is located within the game_2 package, I have tried running the code with it in the src and root folder. package test; import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; import java.net.URL; public class Main{ public static void main(String[] args) { GUI.main(args); } } class GUI { static JFrame f = new JFrame("Swing Paint Demo"); public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { System.out.printf("%nCreated GUI on EDT? "+ SwingUtilities.isEventDispatchThread()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new MyPanel()); f.setSize(640,640); f.setVisible(true); } } class MyPanel extends JPanel { public MyPanel() { //setBorder(BorderFactory.createLineBorder(Color.black)); } public Dimension getPreferredSize() { return new Dimension(640,640); } public void paintComponent(Graphics g) { super.paintComponent(g); System.out.printf("%nPaincomponent on GUI"); Player_1.paintSquare(g); System.out.printf("%nPlayer_1.img_player1 is: "+Player_1.img_player1); } } class Player_1{ public static Image img_player1; public int int_x = 0; public int int_y = 1; public int int_w = 1; public int int_h = 1; public static void paintSquare(Graphics g){ if (img_player1 == null) img_player1 = IOControl.getImage("player_1.gif"); g.drawImage(img_player1, 32, 32, 32, 32, GUI.f); } } class IOControl { public sta…
tagged with: swing
answer count: 1
tagged with: graphics
accepted answer: http://stackoverflow.com/a/22587945

http://stackoverflow.com/a/22548920
accepted answer of: http://stackoverflow.com/q/22512903
answers question: http://stackoverflow.com/q/22512903
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34523553
type: Answer
has body: What kind of method did you use for create VirtModel object? NOTE: If you used: public static VirtModel openDefaultModel(DataSource ds); public static VirtModel openDefaultModel(String url, String user, String password); so the Model will contains only data from "virt:DEFAULT" graph. And VirtuosoQueryExecutionFactory will add next pragma to query text: define input:default-graph-uri &lt;virt:DEFAULT&gt; If you used something like: public static VirtModel openDatabaseModel(String graphName, DataSource ds); public static VirtModel openDatabaseModel(String graphName, String url, String user, String password) so the Model will contains only data from graphName graph. And VirtuosoQueryExecutionFactory will add next pragma to query text: define input:default-graph-uri &lt;graphName&gt; If you want to use data from all graphs, you must call: VirtModel vmodel = ....create model method... vmodel.setReadFromAllGraphs(true); If you set above to TRUE, the pragma for default-graph-uri will not added. The worked example of using Construct with Virtuoso Jena provider: url = "jdbc:virtuoso://localhost:1111"; VirtGraph set = new VirtGraph ("test1", url, "dba", "dba"); set.clear(); String qry = "INSERT INTO GRAPH &lt;test1&gt; { &lt;aa&gt; &lt;bb&gt; 'cc' . &lt;aa1&gt; &lt;bb&gt; 'zz' }"; VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(qry, set); vur.exec(); Model inputModel = new VirtModel(set); System.out.println("InputModel :"+inputModel); System.out.println("InputModel size :"+inputModel.size()); System.out.println(); qry = "CONSTRUCT { ?x &lt;a&gt; ?y } WHERE { ?x &lt;bb&gt; ?y }"; QueryExecution vqe = VirtuosoQueryExecutionFactory.create (qry, inputModel); Model model = vqe.execConstruct(); System.out.println("Model :"+model); System.out.println("Model size :"+model.size());
has comment: http://stackoverflow.com/comment/34364628
has comment: http://stackoverflow.com/comment/34550775
has comment: http://stackoverflow.com/comment/34562261
score: 1
upvote count: 1

http://stackoverflow.com/comment/34260329
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22516409
has text: This should not be one of your priorities. Learn how you would find the answer yourself instead, it will be more useful to you.

http://stackoverflow.com/q/22573787
upvote count: 2
has answer: http://stackoverflow.com/a/37136625
tagged with: java
has comment: http://stackoverflow.com/comment/34678556
has answer: http://stackoverflow.com/a/22778580
linked to: http://stackoverflow.com/q/16400810
tagged with: tomcat7
type: Question
answer count: 6
tagged with: meta-inf
downvote count: 0
tagged with: netbeans-7
has comment: http://stackoverflow.com/comment/34678585
has answer: http://stackoverflow.com/a/22777586
favorite count: 0
has answer: http://stackoverflow.com/a/29097869
has body: While deploying a project in Netbeans7.4 It is not deploying project in Apache Tomcat 7.0.14 am it is showing following E:\Project\atom\nbproject\build-impl.xml:1111: The module has not been deployed. See the server log for details. BUILD FAILED (total time: 1 minute 22 seconds) line no:1111 at built-impl.xml is <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/> To resolve above problem I have followed this link My context.xml file contains <?xml version="1.0" encoding="UTF-8"?> <Context antiJARLocking="true" path="/atom"/> And all permission is set for general users How to resolve this problem, what can be other cause for this error Edit: Now installed Netbeans 8.0 and Apache Tomcat 8 then also showing same problem I am using struts2.3.15 and hibernet3.6 My web.xml content is <?xml version="1.0" encoding="UTF-8"?> struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* business.schedular.QuartzSchedulerListener 120 pages/login.jsp
has answer: http://stackoverflow.com/a/22782930
possible better answer: http://stackoverflow.com/a/22661211
accepted answer: http://stackoverflow.com/a/22777586
has answer: http://stackoverflow.com/a/22661211
type: AnsweredQuestion
score: 2
tagged with: netbeans
has title: Apache Tomcat 7.0.14:build-impl.xml:1111: The module has not been deployed

http://stackoverflow.com/q/22576161
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22576561
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22576252
has title: Create a text and animate it downwards until it goes out of screen
has body: I am making an application and i need to create a line of text every second and then animate it downwards until it goes out of screen. This will go on like this forever. What kind of algorithm can i use? I'm using canvas.drawtext to create the text.
type: UnansweredQuestion
tagged with: android
tagged with: animation

http://stackoverflow.com/q/22531714
tagged with: jsr356
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22531809
tagged with: websocket
has body: I want to add some additional attributes to container-instantiated WebSocket client endpoint for grouping/statistics. I created a client WebSocket endpoint with JSR-356: Session session = container.connectToServer( MyClientEndpoint.class , uri ); I want to pass some object to Session or MyClientEndpoint instance: @ClientEndpoint public class MyClientEndpoint { @OnOpen public void onWebSocketConnect( Session sess ) { ...i need my param here... } ... @OnMessage, @OnClose, @OnError handlers... } Because MyClientEndpoint instance is instantiated by container (in my example - Jetty), I cannot just pass argument in constructor. Also I cannot set my param in Session user properties: Session session = container.connectToServer( ClientSocket.class , uri ); session.getUserProperties().put( "group", this); because I don't have my property in @OnOpen handler and also I have no guarantee that my "group" property will be set before any @OnMessage call. How to connect to JSR-356 WebSocket in a way that will allow me to use additional objects in @ClientEndpoint object instantiated by container?
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22531809
has title: How to pass parameter/attribute to JSR-356 WebSocket client (@ClientEndpoint)?
answer count: 1

http://stackoverflow.com/comment/34380387
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22583508
has text: The table model that is 'set' should be returned when a 'get' method is called. table.getModel().addTableModelListener
type: AnswerComment

http://stackoverflow.com/q/22582237
has answer: http://stackoverflow.com/a/22582315
linked to: http://stackoverflow.com/q/3976160
score: 2
answer count: 1
downvote count: 0
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34377271
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22582315
tagged with: java
type: Question
has body: i am new to the servelests and building a web application. When i create the new html file in myproejct under the web pages folder in netbeans and compilling that file it shows 404 error with following URL http://localhost:8080/myproject/ but when i change this url to http://localhost:8080/myproject/index.html it shows the page.. and also when creating index.jsp instead of index.html and compile in netbeans it is shown in the browser why this happen ????? any hint ??
tagged with: jsp
has title: Tomcat not picking the showing 404 on index.html
tagged with: tomcat

http://stackoverflow.com/q/22489229
has answer: http://stackoverflow.com/a/22495817
has answer: http://stackoverflow.com/a/22493061
type: UnansweredQuestion
has body: I am automating a web application using selenium webdriver and java. It has few mouse over elements which I am not able to automate. Mouse over works well and newly visible elements locate properly when I record and play in Selenium IDE but same is not working when I run in eclipse. I have automated similar mouse over elements earlier but facing difficulty in automating this. I have attached screenshot of a web application and the code for mouse over elements and here I am not able to mouse over on "Configuration" menu and select "Configure Hierarchy Metadata". It would be really great if anybody could help me out in this!! Let me know if any more details needed. Thanks in advance.
tagged with: selenium-webdriver
tagged with: selenium
type: Question
tagged with: java
tagged with: javascript
has title: Unable to select mouse over elements in Selenium Webdriver Java
score: 0
answer count: 2
tagged with: mouseover

http://stackoverflow.com/q/22631089
has comment: http://stackoverflow.com/comment/34464590
has comment: http://stackoverflow.com/comment/34466696
has comment: http://stackoverflow.com/comment/34468899
has answer: http://stackoverflow.com/a/22658773
upvote count: 1
has title: Java/Android - set DecimalFormat to show only mantissa
tagged with: decimalformat
linked to: http://stackoverflow.com/q/673841
accepted answer: http://stackoverflow.com/a/22658773
has comment: http://stackoverflow.com/comment/34467444
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34468247
has answer: http://stackoverflow.com/a/22632689
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22631599
tagged with: mantissa
has comment: http://stackoverflow.com/comment/34471673
has comment: http://stackoverflow.com/comment/34472514
type: Question
has comment: http://stackoverflow.com/comment/34470536
answer count: 3
possible better answer: http://stackoverflow.com/a/22631599
has comment: http://stackoverflow.com/comment/34468327
downvote count: 0
has comment: http://stackoverflow.com/comment/34469562
has comment: http://stackoverflow.com/comment/34464645
tagged with: number-formatting
favorite count: 0
has comment: http://stackoverflow.com/comment/34466282
has comment: http://stackoverflow.com/comment/34467502
has comment: http://stackoverflow.com/comment/34472085
has comment: http://stackoverflow.com/comment/34468022
tagged with: android
has comment: http://stackoverflow.com/comment/34467282
has body: I want to display only the mantissa of a number independently of what the exponent is. 12.4e-6 after formatting =&gt; 12.4 12.4e-12 after formatting =&gt; 12.4 To do the calculation manually is trivial. But the problem is that I need to use the class DeciamalFormat because I have to give it as argument to another class. I tried this: DecimalFormat mFormat = (DecimalFormat) NumberFormat.getInstance(); mFormat.applyPattern("#.#E0"); if I remove the E symbol, the mantissa will not be calculated. is there any way using this DecimalFormat to show only mantissa?
has comment: http://stackoverflow.com/comment/34464663
has comment: http://stackoverflow.com/comment/34467371

http://stackoverflow.com/comment/34385915
type: Comment
type: QuestionComment
has text: Can you check the request headers on the server side? Is there any difference?
comment on: http://stackoverflow.com/q/22586614
score: 0

http://stackoverflow.com/comment/34350876
comment on: http://stackoverflow.com/a/22557227
has text: There's [`Collections.newSetFromMap`](http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#newSetFromMap(java.util.Map)) if you need an IdentityHashSet.
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/34503887
type: AnswerComment
type: Comment
has text: @CorayThan If you are really keen on reducing the loading time and this Activity is not the main Activity, you can load raw file data into memory as byte[] so you don't have to load them when that particular Activity is started. Obviously before going down this path you should check the file-reading portion to make sure the benefit is there.
comment on: http://stackoverflow.com/a/22598875
score: 0

http://stackoverflow.com/comment/34304440
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22540978
has text: @user3427895: The return statement is in the `main` method - which should be clear to you if you pay attention to the line number in the error message.

http://stackoverflow.com/comment/34347055
comment on: http://stackoverflow.com/q/22565681
score: 0
has text: are you sure that archiveSchedule is different than zero?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34222938
score: 0
type: AnswerComment
has text: O.O Now "error noSuchMethodException" at row of the "[...] myClass.getConstructor( [..]" :O
type: Comment
comment on: http://stackoverflow.com/a/22494236

http://stackoverflow.com/a/22575411
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/22575370
type: Answer
accepted answer of: http://stackoverflow.com/q/22575370
has body: The performance cost of either of those methods is so positively tiny compared to the cost of doing graphical rendering that you really shouldn't care. Instead of worrying about performance there, you should focus on writing clear, robust, extensible code. With that in mind, I'd recommend: 1) Use a Tile class. It will allow you to add much more than tile_types to them later on. 2) Use new Tile[mapWidth][mapHeight], and address tiles as tiles[x][y]. This approach costs more memory, and you will have to create all of the sub-arrays yourself, but it guards you against a lot of easy-to-make off-by-one errors, and other mathematical mistakes.
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/113244517
has text: Hey @Max, I have followed your steps in the google developer console. It worked. Thank you so much mate.
comment on: http://stackoverflow.com/a/30249913
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22600102
answers question: http://stackoverflow.com/q/22599020
score: 0
type: AcceptedAnswer
type: Answer
has body: By calling setInterface() to the local host you are preventing the joinGroup() message from leaving the current host. That doesn't matter in the sender, because a sender doesn't have to join the group anyway, but in the receiver it will prevent other hosts, routers, etc. from knowing that the receiving host is in the group. Just remove it.
accepted answer of: http://stackoverflow.com/q/22599020

hsqldb
tags question: http://stackoverflow.com/q/22534650
tag name: hsqldb
tags question: http://stackoverflow.com/q/22633195
type: Tag

http://stackoverflow.com/comment/34487603
type: QuestionComment
comment on: http://stackoverflow.com/q/22643506
has text: Not much code behind it, just setting the parent activity via Manifest to Activity A, so the up navigation is always returning to Activity A from the ContactActivity. Obviously setting a parent was not a good way of doing it since I want the up navigation to return to Activity A or Activity B, depending which initially opens Contact Activity.
score: 0
type: Comment

http://stackoverflow.com/q/22573054
has comment: http://stackoverflow.com/comment/34361243
has body: Hi have a method that creates a LinkedList of compMac object. CompMac object contain elements from a mysql table row. Each row contain a nickname and a location so I use a loop to create a 'compMac' for each row and add them in the linkedlist. I don't know why, but the first 'compMac' is created and is being added to the linkedlist, but after that I get java.sql.SQLException: Column 'nickname' not found. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920) at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1163) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5729) at server.DbConnect.getArray(DbConnect.java:224) at server.doComms.sendArray(doComms.java:127) at server.doComms.whileChatting(doComms.java:107) at server.doComms.run(doComms.java:32) at java.lang.Thread.run(Thread.java:695) Here is my method: public LinkedList&lt;compMac&gt; getArray() { LinkedList&lt;compMac&gt; locArray = new LinkedList&lt;compMac&gt;(); try{ String query = "SELECT * FROM online"; rs = st.executeQuery(query); while(rs.next()){ String nn = rs.getString("nickname"); String loc = rs.getString("location");//mac addresses String cX=getCoorX(loc); String cY=getCoorY(loc); String building=getBuilding(loc); String floor=getFloor(loc); locArray.add(new compMac(nn,loc,cX,cY,building,floor)); } } catch(Exception e){e.printStackTrace();} return locArray; } But I do have a nickname column, I like I said, the first compMac is created, when I pop the linkedlist I get the first row's informations. Thanks to anyone having an idea whats wrong with my code. EDIT: Here the class code: package server; import java.sql.*; import java.util.LinkedList; import com.example.client.Mac; import com.example.client.compMac; public class DbConnect { private Connection con; private Statement…
answer count: 1
accepted answer: http://stackoverflow.com/a/22573224
has title: mysql Column not found loop
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34361171
tagged with: java
has comment: http://stackoverflow.com/comment/34362098
tagged with: mysql
has answer: http://stackoverflow.com/a/22573224
has comment: http://stackoverflow.com/comment/34361038
type: Question
has comment: http://stackoverflow.com/comment/34361138
has comment: http://stackoverflow.com/comment/34361099
score: 0
has comment: http://stackoverflow.com/comment/34361153

http://stackoverflow.com/comment/34390385
type: QuestionComment
has text: Is there client certificate authentication? Because 403 means that access is denied. It is not SSL connection error. Btw is apache server certificate self signed or signed by public authority like Verisign?
comment on: http://stackoverflow.com/q/22589410
score: 0
type: Comment

http://stackoverflow.com/a/26797340
answers question: http://stackoverflow.com/q/22603291
score: 0
has body: Spring 4.0 is the answer with the @Qualifier annotation usage. Hope this helps
type: Answer
upvote count: 2
downvote count: 2

generics
tags question: http://stackoverflow.com/q/22620909
tags question: http://stackoverflow.com/q/22545933
tags question: http://stackoverflow.com/q/22605082
tags question: http://stackoverflow.com/q/22588518
tags question: http://stackoverflow.com/q/22612430
tags question: http://stackoverflow.com/q/22620693
tags question: http://stackoverflow.com/q/22567562
tags question: http://stackoverflow.com/q/22638793
tags question: http://stackoverflow.com/q/22597968
tags question: http://stackoverflow.com/q/22583546
tags question: http://stackoverflow.com/q/22647444
tags question: http://stackoverflow.com/q/22531284
tags question: http://stackoverflow.com/q/22631979
tags question: http://stackoverflow.com/q/22591201
tags question: http://stackoverflow.com/q/22578404
tags question: http://stackoverflow.com/q/22511161
tags question: http://stackoverflow.com/q/22513952
tags question: http://stackoverflow.com/q/22595665
type: Tag
tags question: http://stackoverflow.com/q/22578065
tags question: http://stackoverflow.com/q/22490835
tags question: http://stackoverflow.com/q/22525088
tags question: http://stackoverflow.com/q/22555608
tags question: http://stackoverflow.com/q/22604551
tags question: http://stackoverflow.com/q/22565290
tags question: http://stackoverflow.com/q/22563939
tags question: http://stackoverflow.com/q/22636104
tags question: http://stackoverflow.com/q/22561869
tags question: http://stackoverflow.com/q/22588187
tags question: http://stackoverflow.com/q/22590357
tags question: http://stackoverflow.com/q/22494295
tags question: http://stackoverflow.com/q/22515108
tags question: http://stackoverflow.com/q/22534376
tags question: http://stackoverflow.com/q/22542487
tags question: http://stackoverflow.com/q/22640472
tags question: http://stackoverflow.com/q/22592870
tags question: http://stackoverflow.com/q/22563272
tags question: http://stackoverflow.com/q/22617607
tags question: http://stackoverflow.com/q/22644024
tags question: http://stackoverflow.com/q/22606422
tags question: http://stackoverflow.com/q/22609974
tags question: http://stackoverflow.com/q/22626430
tags question: http://stackoverflow.com/q/22590710
tags question: http://stackoverflow.com/q/22541541
tags question: http://stackoverflow.com/q/22500125
tags question: http://stackoverflow.com/q/22588379
tags question: http://stackoverflow.com/q/22509488
tags question: http://stackoverflow.com/q/22625575
tags question: http://stackoverflow.com/q/22595234
tags question: http://stackoverflow.com/q/22614866
tags question: http://stackoverflow.com/q/22503713
tags question: http://stackoverflow.com/q/22628541
tags question: http://stackoverflow.com/q/22579810
tags question: http://stackoverflow.com/q/22507895
tags question: http://stackoverflow.com/q/22493247
tags question: http://stackoverflow.com/q/22562147
tags question: http://stackoverflow.com/q/22501398
tag name: generics
tags question: http://stackoverflow.com/q/22493327
tags question: http://stackoverflow.com/q/22530676
tags question: http://stackoverflow.com/q/22599161
tags question: http://stackoverflow.com/q/22594578
tags question: http://stackoverflow.com/q/22536992
tags question: http://stackoverflow.com/q/22603291

http://stackoverflow.com/comment/34317190
type: QuestionComment
comment on: http://stackoverflow.com/q/22543575
has text: I can read the file but i can't convert the hex to decimal from FileReader. i tried int a = Integer.parseInt(b, 16); and for binairy (0b) and 2. but i can't . It is assignment and has a deadline.
score: 0
type: Comment

http://stackoverflow.com/q/22524331
answer count: 2
tagged with: websphere
has comment: http://stackoverflow.com/comment/34455800
has answer: http://stackoverflow.com/a/36031286
score: 0
has body: I am getting the list of datasources configured in context.xml of Tomcat Server using the method below : public static List&lt;String&gt; getDataSourcesList() { List&lt;String&gt; dataSourceList = new ArrayList&lt;String&gt;(); try { if( initialContext == null ) { initialContext = new InitialContext(); } NamingEnumeration&lt;NameClassPair&gt; list = ( ( Context )initialContext.lookup( DATASOURCE_CONTEXT ) ).list( "" ); while( list.hasMore() ) { dataSourceList.add( list.next().getName() ); } } catch( NamingException ex ) { Logger.getLogger( JDBCUtil.class.getName() ).log( Level.SEVERE, null, ex ); } return dataSourceList; } But this method does not work for Weblogic and Websphere Servers. How can I get the list of datasource names configured on the Weblogic/WebSphere Servers ? Is there any method to get the list of datasource names ?
has title: How to get list of JNDI Names from Weblogic Server?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34302136
type: Question
has answer: http://stackoverflow.com/a/36024177
tagged with: weblogic
tagged with: java

http://stackoverflow.com/comment/82249512
has text: Answer is poor. Need to compare string length first to make sure in bounds. check out answer here: https://stackoverflow.com/questions/8033655/find-longest-common-prefix
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22493370

http://stackoverflow.com/comment/34275712
score: 0
has text: Thank You @user2310289.. Will try it and post the comments...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22524570

http://stackoverflow.com/comment/34479702
type: AnswerComment
comment on: http://stackoverflow.com/a/22639617
type: Comment
has text: Thank you!!! See this is what I needed, I had no idea I was throwing away the object.
score: 0

http://stackoverflow.com/a/22595539
downvote count: 0
answers question: http://stackoverflow.com/q/22595327
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34401468
score: 1
has body: You can have a class Person with the class variables you require (name,age,salary) class Person { private int age; private dobule salary; private String firstname; private String lastname; } Define the getter and setter methods for each of the class variables. For e.g public void setAge(int age){ this.age = age; } public int getAge(){ return this.age; } In your main class read the input from STDIN as you are doing it. Instantiate the Person object for each of the 5 person. Person employee = new Person(); employee.setAge(x); employee.setFirstName(x); employee.setLastName(y); employee.setSalary(y); Now, you can add each Person to your list and remove them too. For removing any Person you would have to search for the Person through the ArrayList by name. That would be iterating over the length of ArrayList and comparing the name of each. The final class would look like, public class Solution{ private ArrayList&lt;Person&gt; details = new ArrayList()&lt;Person&gt;; public static void main(){ // Here you loop for reading from STDIN as you are already doing. // addPerson() would be used to add to ArrayList and removePerson() for the other } public addPerson(String firstName, String lastName, int age, int salary){ //Create the Person object details.add(&lt;person object&gt;); } public removePerson(name){ details.remove(index); // to get index it would require iterating over the ArrayList. // It would be better if you use a Map instead (as other suggest) // with name as the key } } Hope this helps.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34401821
accepted answer of: http://stackoverflow.com/q/22595327

http://stackoverflow.com/comment/34368973
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22577509
type: Comment
has text: and how can I change that?

http://stackoverflow.com/comment/34452252
type: AnswerComment
comment on: http://stackoverflow.com/a/22599194
type: Comment
has text: @dashhund, Did you read my suggestion? I never said you needed to use "insets". However I do remember mentioning "glue".
score: 0

http://stackoverflow.com/q/22644644
score: -1
favorite count: 0
has title: java - how to pass multiple parameters over serial port to Arduino mega
has body: Through my java program. i want to pass a byte value to the Arduino mega to blink an Led and also at the same time i want to pass a string value to the Arduino to be displayed in the lcd. How can I separately get above 2 inputs from the java program to Arduino and use them in different processes inside Arduino.. Below is the arduino code LiquidCrystal lcd (12, 11, 10, 9, 8, 7); int operation; void setup() { lcd.begin(16, 2); Serial.begin(9600); Serial1.begin(9600); Serial2.begin(9600); pinMode(3, OUTPUT); pinMode(2, OUTPUT); } int count = 0; void loop() { //LCD start if (Serial.available()) { // wait a bit for the entire message to arrive delay(50); // clear the screen lcd.clear(); delay(10); // read all the available characters while (Serial.available() &gt; 0) { // display each character to the LCD lcd.write(Serial.read()); } } //LCD end //LED Blink start if (Serial.available() &gt; 0) delay(10); { operation = Serial.read(); } if(operation == '2') { digitalWrite(2, LOW); digitalWrite(3, HIGH); delay(50); digitalWrite(3, LOW); delay(50); } if(operation == '1') { digitalWrite(3, LOW); digitalWrite(2, HIGH); delay(50); digitalWrite(2, LOW); delay(50); } //LED Blink end // Recieve rfid tag numbers if(Serial1.available()) { int x = Serial1.read(); Serial1.print(x); } if(Serial2.available()) { int x = Serial2.read(); Serial1.print(x); } } Below is the Java code to send data Code to send number 1 to Arduino String buf = "1"; char buf2[] = buf.toCharArray(); output.write((byte)buf2[0]); Code to send string to display in lcd output.write("Hellow world. this is a String from java".getBytes()); When I run these codes separately it works well without any interference.. but when I do them both together... sometimes value 1 or 2 is displayed in the lcd.. and led doesnot blink properly . how to get two inputs from java to arduino and process them separately inside the Arduino?
type: UnansweredQuestion
tagged with: serial-port
tagged with: java
has answer: http://stackoverflow.com/a/22645278
tagged with: arduino
has answer: http://stackoverflow.com/a/22660084
downvote count: 1
type: Question
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/34278814
comment on: http://stackoverflow.com/q/22526819
score: 0
type: Comment
type: QuestionComment
has text: In this article [link](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java)

http://stackoverflow.com/a/22521249
has body: As of 1.7.2, there are two getHealth() and getMaxHealth() methods. This is becaue of the way Bukkit handled Minecraft changing the way entity health is stored in 1.6. You can read more about this here. If you aren't using any NMS code, you should use the bukkit.jar in your build path as opposed to craftbukkit.jar. This should resolve your issue easily enough. If you do need NMS code, you need to have both bukkit.jar AND craftbukkit.jar in your build path. Furthermore, you have to have bukkit.jar above craftbukkit.jar in the build path for it to work.
answers question: http://stackoverflow.com/q/22512345
type: Answer
score: 0

http://stackoverflow.com/q/22494353
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/22495001
accepted answer: http://stackoverflow.com/a/22495001
tagged with: eclipse-plugin
has title: Eclipse PDE: Mimicking IResourceChangeEvents for IJavaProject creation between PDE and developer's workspace?
has body: (NOTE - FINAL SOLUTION IS BELOW) In my plug-in, I am trying to create an IJavaProject (using Eclipse JDT, code at the end) that creates a Java Project almost EXACTLY as if the IJavaProject were created by the developer (or whoever is using the plug-in). I am able to create the IJavaProject from my PDE, and it works fine, but I need to mimic the IResourceChangeEvents that arise from the project creation in my PDE to match the IResourceChangeEvents that arise from Java project creation in the developer's workspace. I am measuring the 'IResourceChangeEvents' using my IResourceChangeListener (it uses a visitor, and should be correct - view the code here). When a Java Project is created in the developer's workspace, I am measuring the following IResourceChangeEvents: CHANGE-ROOT (1 child) ADD-PROJECT (5 children) ADD-FILE ".classpath" ADD-FILE ".project" ADD-FOLDER ".settings" ADD-FILE ".prefs" ADD-FOLDER ".bin" ADD-FOLDER ".src" And when I create an IJavaProject using Eclipse JDT in my PDE (code at the end), I measure these IResourceChangeEvents: C-R C-P ADD-FILE ".project" C-R C-P "JavaProject" C-R C-P CHANGE-FILE ".project" C-R C-P ADD-FOLDER "bin" C-R C-P C-F ADD-FILE ".project" C-R C-P ADD-FILE ".classpath" C-R C-P ADD-FOLDER "src" C-R C-P CHANGED-FILE ".classpath" Where C-R is CHANGED-ROOT, C-P is CHANGED-PROJECT and C-F is CHANGED-FILE. Any suggestions on another way to create an IJavaProject? Here is my IJavaProject creation code: public static IJavaProject getJavaProject(IProject project) throws CoreException { return getJavaProject(project, "src", "bin"); } public static IJavaProject getJavaProject(IProject project, String sourceFolderPath, String binFolderPath) throws CoreException { if (!project.exists()) // This creates ADDED (.project) ResourceUtility.createProject(project); System.out.println("setting description nature id's."); IProjectDescription description = project.getDescription(); description.setNatureIds(new String[] {JavaCore.NATURE_ID}); System.o…
favorite count: 0
downvote count: 0
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/22597270
score: 2
answers question: http://stackoverflow.com/q/22597108
downvote count: 0
upvote count: 2
type: Answer
has body: You could remove it if desired: import java.awt.Component; import java.awt.Container; import javax.swing.AbstractButton; import javax.swing.JComboBox; import javax.swing.JOptionPane; public class PlayWithComboArrow { public static void main(String[] args) { String[] items = {"Fe", "Fi", "Fo", "Fum"}; JComboBox&lt;String&gt; combo = new JComboBox&lt;String&gt;(items); combo.setEditable(true); removeButton(combo); JOptionPane.showMessageDialog(null, combo); } private static void removeButton(Container container) { Component[] components = container.getComponents(); for (Component component : components) { if (component instanceof AbstractButton) { container.remove(component); } } } }
has comment: http://stackoverflow.com/comment/34404796
has comment: http://stackoverflow.com/comment/34404620

http://stackoverflow.com/comment/34357148
comment on: http://stackoverflow.com/a/22570398
score: 0
type: AnswerComment
has text: @Alan Stokes, take a look at the awnser (I added an example), it solves the problem you created, although it creates a new one, which would render this cicle infinite.
type: Comment

http://stackoverflow.com/comment/34274208
comment on: http://stackoverflow.com/a/22524097
score: 2
type: AnswerComment
type: Comment
has text: there is no need for `GetWeahter` to be a Activity class

hamcrest
tags question: http://stackoverflow.com/q/22510975
tags question: http://stackoverflow.com/q/22605369
tags question: http://stackoverflow.com/q/22643364
type: Tag
tag name: hamcrest

http://stackoverflow.com/q/22544874
has body: One of the application I work on generates reports using large volume of data returned from DB. The application receives the request as a AJAX async request, executes a query based on the input parameters, stores the data in JSON format, generates an excel with the same contents and then returns the JSON result back to the browser to display the records. At times due to high volume of data the server crashes due to high memory usage and at times the server threads are hung. The exception captured in the logs is mentioned below : [3/20/14 21:55:07:051 IST] 0000001a ThreadMonitor W WSVR0605W: Thread "WebContainer : 6" (00000038) has been active for 761754 milliseconds and may be hung. There is/are 1 thread(s) in total in the server that may be hung. at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:141) at com.ibm.db2.jcc.a.ab.b(ab.java:168) at com.ibm.db2.jcc.a.ab.c(ab.java:222) at com.ibm.db2.jcc.a.ab.c(ab.java:337) at com.ibm.db2.jcc.a.ab.v(ab.java:1447) at com.ibm.db2.jcc.a.db.a(db.java:42) at com.ibm.db2.jcc.a.r.a(r.java:30) at com.ibm.db2.jcc.a.sb.g(sb.java:152) at com.ibm.db2.jcc.b.zc.n(zc.java:1186) at com.ibm.db2.jcc.b.ad.db(ad.java:1761) at com.ibm.db2.jcc.b.ad.d(ad.java:2203) at com.ibm.db2.jcc.b.ad.U(ad.java:489) at com.ibm.db2.jcc.b.ad.executeQuery(ad.java:472) at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteQuery(WSJdbcPreparedStatement.java:1102) at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java:723) at com.abc(ABCDao.java:1250) at com.abc(ABCFacade.java:159) at com.abcservlet.doPost(ABCServlet.java:56) at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) Environment details are as follows : 1. Application Server - WebSphere Application Server 7.0.0.29 2. DB Server - DB2 3. JVM Memory - 512MB - 2048 MB Wanted to know what should be the best approach to hand…
score: 0
tagged with: resultset
has title: Best approach to handle large volume of data returned from DB
has comment: http://stackoverflow.com/comment/34311747
has comment: http://stackoverflow.com/comment/34312714
linked to: http://stackoverflow.com/q/444380
has comment: http://stackoverflow.com/comment/34312999
has comment: http://stackoverflow.com/comment/34349588
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34311849
has comment: http://stackoverflow.com/comment/34338179
has comment: http://stackoverflow.com/comment/34350217
tagged with: java
tagged with: database
type: Question
tagged with: db2

http://stackoverflow.com/comment/34315375
has text: Generally, whoever installed the web server software or application server software will have created a user for anonymous web requests to run as. You could have a special directory that the anonymous web user can write to, or you could create actual logins for each student and force them to log in, in which case anything each of them runs will run as that user. But you should discuss this with your hosting provider - there are almost certainly limits on what they will let you do.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22546786

http://stackoverflow.com/q/22575526
has answer: http://stackoverflow.com/a/22575618
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/22575567
has body: To get the grips on to Java8, I am trying to implement a simple Repo for storing Lists of different Objects. My startingpoint is this: public class MyRepo { Map&lt;Class, List&lt;?&gt;&gt; repo =new HashMap&lt;&gt;(); public List&lt;?&gt; get(Class c){ List&lt;?&gt; result= repo.get(c); return (result==null)?new ArrayList&lt;&gt;():(List&lt;?&gt;) result; } public void put(Class c,List&lt;?&gt; l){ repo.put(c, l); } } So I am able to insert Lists and retrieve lists. My next step would be to implement a generic filter-method: public List&lt;?&gt; find(Class c, Predicate&lt;?&gt; predicate){ List&lt;?&gt; result= repo.get(c); return (result==null)?new ArrayList&lt;&gt;():(List&lt;?&gt;)result.stream().filter(predicate); } which results in java: incompatible types: java.util.function.Predicate&lt;capture#1 of ?&gt; cannot be converted to java.util.function.Predicate&lt;? super capture#2 of ?&gt; How to implement a generic find-method? I have to admit, that I am not sure, that the design with Map&lt;Class, List&lt;?&gt;&gt; repo =new HashMap&lt;&gt;(); is a good choice. Maybe there is a better solution.
favorite count: 0
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/22575567
tagged with: java-8
accepted answer: http://stackoverflow.com/a/22575618
type: AnsweredQuestion
tagged with: java
has title: Implementing a filter with Predicate<T> in Java8
type: Question

http://stackoverflow.com/comment/34233147
has text: @ashishchaurasia: What part don't you understand? If the class is immutable, it can't be made up of mutable parts. The quote you've added to the question says exactly what I said in my answer: Make immutable copies of things if the source information is mutable.
type: QuestionComment
comment on: http://stackoverflow.com/q/22499200
type: Comment
score: 0

http://stackoverflow.com/comment/34701272
has text: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22762331
type: Comment

jwi
tags question: http://stackoverflow.com/q/22589700
tag name: jwi
type: Tag

http://stackoverflow.com/comment/34455421
comment on: http://stackoverflow.com/q/22609779
score: 0
type: Comment
type: QuestionComment
has text: it might be that an exception in the try block won't necessarily cause it to crash, because the exception might have been caught in its own catch clause, or elsewhere (the method caller may have wrapped it in a try-catch too). the point is you can't rely on the program crashing and cleaning up the resources for you.

http://stackoverflow.com/a/26025374
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22521636
type: Answer
downvote count: 0
has body: I got the same thing: ClassLoader error followed by SIGABRT, but only when running the debugger. For me, switching from ART to Dalvik fixed it.

http://stackoverflow.com/comment/34224451
comment on: http://stackoverflow.com/q/22495525
type: Comment
score: 1
has text: you must take a look at SimpleDateFormat - http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
type: QuestionComment

http://stackoverflow.com/comment/34366612
has text: Not read the code 100% so may have missed something, but in the BFS method it looks like your first while loop only continues until (!found) - and you set found=true soon as you find the target city - so you would only ever get one route? (e.g. abort the while loop as soon as you find a route)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22575544

glassfish-4
tags question: http://stackoverflow.com/q/22571178
type: Tag
tags question: http://stackoverflow.com/q/22564963
tag name: glassfish-4
tags question: http://stackoverflow.com/q/22562851

http://stackoverflow.com/q/22638736
has body: I am trying to do a simple android aplication to send two commands (start and stop xbmc) to my raspberry pi running RaspBMC. I am using jsch library for SSH connection. Here is my code: public void onToggleClicked(View view) { boolean on = ((ToggleButton) view).isChecked(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); dir_ip = prefs.getString("IP_DIR", ""); String[] params = new String[2]; params[0] = dir_ip; if (!validarIP(dir_ip)){ alert.showAlertDialog(MainActivity.this, "Error", "La direccion IP no ha sido seleccionada o es erronea. Vaya a Settings y elija una IP", false); ((ToggleButton) view).setChecked(!on); } else{ if (on) { Log.d("AITOR", "START"); params[1] = "sudo initctl stop xbmc"; new sendCommand().execute(params); } else { params[1] = "sudo initctl start xbmc"; new sendCommand().execute(params); } } dir_ip = ""; } class sendCommand extends AsyncTask&lt;String, Void, Void&gt; { @Override protected Void doInBackground(String... params) { JSch jsch = new JSch(); Session session; try { session = jsch.getSession("pi", params[0], 22); session.setPassword("raspberry"); // Avoid asking for key confirmation Properties prop = new Properties(); prop.put("StrictHostKeyChecking", "no"); session.setConfig(prop); session.connect(); // SSH Channel ChannelExec channelssh = (ChannelExec) session.openChannel("exec"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); channelssh.setOutputStream(baos); // Execute command channelssh.setCommand(params[1]); channelssh.connect(); channelssh.disconnect(); } catch (JSchException e) { Log.d("AITOR", e.getMessage()); } return null; } } I am not getting any exception or error simply the command is not sent to my rPi. Thanks for the answers!
type: UnansweredQuestion
tagged with: android
tagged with: java
has title: Cant send command to Rpi with jsch
type: Question
has answer: http://stackoverflow.com/a/22639014
score: 0
tagged with: raspberry-pi
answer count: 1
tagged with: jsch

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/22574199
type: Tag
tags question: http://stackoverflow.com/q/22513293
tags question: http://stackoverflow.com/q/22516089
tags question: http://stackoverflow.com/q/22616079
tags question: http://stackoverflow.com/q/22556315
tags question: http://stackoverflow.com/q/22542182

http://stackoverflow.com/a/22512419
score: 0
has comment: http://stackoverflow.com/comment/34253832
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22512306
has body: You can use a lib in java : gson-2.2.3.jar

http://stackoverflow.com/comment/34315130
type: QuestionComment
has text: Using http://stackoverflow.com/questions/3880997/classcastexception-in-java-foreach-loop as a reference, it looks like you have somehow put a `Par` in `pacotes`. What does `GestorPacotes.criaPacotes()` do?
type: Comment
comment on: http://stackoverflow.com/q/22546724
score: 0

http://stackoverflow.com/q/22638229
favorite count: 0
has comment: http://stackoverflow.com/comment/34479148
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34481190
tagged with: conditional-statements
answer count: 0
downvote count: 0
tagged with: if-statement
score: 1
has comment: http://stackoverflow.com/comment/34483831
tagged with: java
has comment: http://stackoverflow.com/comment/34479888
type: Question
has body: I want to set conditions for my apps music selection. I have two different playlists, and to call them i use the function playLTsongs(0) and playHTsongs(0), [0 = index of song in the songlist i.e play first song]. Basic but this is what im looking for: if(HRate &lt; 100){ mp.play(playLTSongs(0)); mp.pause(playHTsong(0)); } else if (HRate &gt; 100){ mp.pause(playLTSong(0)); mp.play(playHTsong(0)); } I know this is rough, and it may not be possible having conditions in the mp.pause/play(), another way may be using case statements? if anyone can help please?
has title: Setting conditions for music selection
tagged with: playback
has comment: http://stackoverflow.com/comment/34479922
upvote count: 1
tagged with: android

http://stackoverflow.com/comment/34297741
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22536960
score: 0
has text: That is a good point, thanks. At the moment I just want to get the authentication working so am just using stored user details in the table. Once this is working I will work on improving the details such as sending and storing the password securely.

http://stackoverflow.com/comment/34336278
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22548148
has text: I checked that myself and it seems that the compiler has no interest in moving the initializations anywhere around. Though it is allowed to do so. In this example the compiler can't predict how often the condition in if statement will be true so it just sticks to the order of instructions defined by the programmer. This might be different with Just-in-time compilation as in Java hotspot or c++ LLVM.
score: 0

http://stackoverflow.com/a/22585280
has body: It depends on what your input is and how you get it.. while(true) { String myWord; //whatever way you are trying to get the input assume its in String myWord if(isNotInt(myWord)) break; } Here is a helper method for a general String. you convert it to int, if the string is not a int, you will get a java.lang.NumberFormatException exception and you can find out. public static boolean isNotInt(String input) { boolean retVal = false try { Integer.parseInt(input); } catch(NumberFormatException e) { retVal = true; } return retVal; }
type: Answer
answers question: http://stackoverflow.com/q/22585135
score: 0

http://stackoverflow.com/comment/34498561
score: 0
type: Comment
type: QuestionComment
has text: *"Making a Chess Board out of JButtons"* See [Making a robust, resizable Chess GUI](http://stackoverflow.com/q/21142686/418556) for a head start..
comment on: http://stackoverflow.com/q/22626640

http://stackoverflow.com/comment/34297045
type: Comment
comment on: http://stackoverflow.com/q/22520167
type: QuestionComment
score: 0
has text: If you want to look at it, that's fine. You can get it [here](http://gls.agilix.com/js/docs/Samples/DlapSampleJava.zip). It's the file labeled Dlap.java - line 169 - 171 is what I'm having issues with.

http://stackoverflow.com/comment/34251671
has text: System.setProperty("user.dir", ...) I guess. I think SSL connectivity shouldn't depend on user.dir property set anyway. At least it worked in Java 7.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22498918
type: Comment

http://stackoverflow.com/q/22543603
score: -2
tagged with: jar
tagged with: exe
favorite count: 0
has body: It would like to know how to create - I mean C++ example - .exe file from .jar file? Do not want to use Launch4j or similar. Just want to do it from scratch.
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/44983637
tagged with: c++
has title: C++: creating .exe file from a .jar file or creating .jar launcher - .exe file
tagged with: java
has answer: http://stackoverflow.com/a/22543880
linked to: http://stackoverflow.com/q/147181
has comment: http://stackoverflow.com/comment/34309092
has comment: http://stackoverflow.com/comment/34309211
type: Question
answer count: 2
upvote count: 0

jar
tags question: http://stackoverflow.com/q/22537689
tags question: http://stackoverflow.com/q/22525392
tags question: http://stackoverflow.com/q/22523877
tags question: http://stackoverflow.com/q/22571198
tags question: http://stackoverflow.com/q/22543603
tags question: http://stackoverflow.com/q/22519378
tags question: http://stackoverflow.com/q/22626146
tags question: http://stackoverflow.com/q/22583586
tags question: http://stackoverflow.com/q/22520433
type: Tag
tags question: http://stackoverflow.com/q/22553371
tags question: http://stackoverflow.com/q/22530657
tags question: http://stackoverflow.com/q/22493196
tags question: http://stackoverflow.com/q/22626602
tags question: http://stackoverflow.com/q/22553004
tags question: http://stackoverflow.com/q/22496964
tags question: http://stackoverflow.com/q/22542423
tags question: http://stackoverflow.com/q/22503804
tags question: http://stackoverflow.com/q/22573064
tags question: http://stackoverflow.com/q/22630973
tag name: jar
tags question: http://stackoverflow.com/q/22635907
tags question: http://stackoverflow.com/q/22619858
tags question: http://stackoverflow.com/q/22637621
tags question: http://stackoverflow.com/q/22525492
tags question: http://stackoverflow.com/q/22494419
tags question: http://stackoverflow.com/q/22497510
tags question: http://stackoverflow.com/q/22493333
tags question: http://stackoverflow.com/q/22582607
tags question: http://stackoverflow.com/q/22582962
tags question: http://stackoverflow.com/q/22488194
tags question: http://stackoverflow.com/q/22545050
tags question: http://stackoverflow.com/q/22636122
tags question: http://stackoverflow.com/q/22558373
tags question: http://stackoverflow.com/q/22629616
tags question: http://stackoverflow.com/q/22547294
tags question: http://stackoverflow.com/q/22591903
tags question: http://stackoverflow.com/q/22547879
tags question: http://stackoverflow.com/q/22612389
tags question: http://stackoverflow.com/q/22549813
tags question: http://stackoverflow.com/q/22643120
tags question: http://stackoverflow.com/q/22548715

http://stackoverflow.com/comment/34335842
type: AnswerComment
has text: I tried to convert it this way "String[] thePins = pins.toArray(new String[pins.size()]);". Do I need to loop on each pins' Integer ?
type: Comment
comment on: http://stackoverflow.com/a/22559498
score: 0

http://stackoverflow.com/comment/34459105
comment on: http://stackoverflow.com/a/22627866
score: 0
type: AnswerComment
has text: @Jackcob: I don't know even the filename. Whatever files it contains, I needed to download it. And needed to give authentication too
type: Comment

http://stackoverflow.com/q/22496259
favorite count: 0
linked to: http://stackoverflow.com/q/5554734
upvote count: 1
has comment: http://stackoverflow.com/comment/34225759
accepted answer: http://stackoverflow.com/a/22496285
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/5554734
tagged with: java
has title: ArrayOutOfBounds Exception
downvote count: 3
has comment: http://stackoverflow.com/comment/34225702
has comment: http://stackoverflow.com/comment/34225737
type: Question
answer count: 2
score: -2
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22975469
has answer: http://stackoverflow.com/a/22975469
has answer: http://stackoverflow.com/a/22496285
tagged with: exception
has body: public void delete(int index) { if (index &lt; 0 || index &gt; _____) { throw new ArrayIndexOutOfBoundsException(); } { Node&lt;X&gt; current = head; for (int i = 0; i &lt; index; i++) { current = current.getLink(); } Node&lt;X&gt; newNode = new Node&lt;X&gt;(); newNode.setLink(current.getLink()); current.setLink(newNode); } } So I can't seem to figure out the logic in writing an outofbounds exception for index when using node objects. It's not like i can do head.length, so would i use a .getLink loop first to find the Null? It's not like I can do index != null either.

http://stackoverflow.com/a/24113466
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22522426
has body: The correct solution is to make sure that you have only one version of appengine-testing.jar on your classpath that corresponds to your App Engine SDK, and you don't have appengine-tools-api.jar on your classpath or in /WEB-INF/lib folder. If you meet these conditions and still have this error, remove appengine-testing.jar from your classpath and from /WEB-INF/lib if you have it there, and then add it back to your classpath.
downvote count: 0

http://stackoverflow.com/q/22530884
has comment: http://stackoverflow.com/comment/34324354
has body: I've recently started using EJB's for an application I'm developing, however, I'm encountering problems with the exception handling. In short, my businesslayer is throwing customized exceptions, but they are never caught in the web-layer. To start with, this is the software I'm using: IDE: Eclipse Kepler Java version: 1.7 Application server: Glassfish 3.1.2 JSF 2.1 My code: Remote interface: @Remote public interface IUserService { public UserRequest createAccount(&lt;some string parameters&gt;) throws ApplicationException; } Stateless session bean: @Stateless public class UserServiceImpl implements IUserService { @Override @Interceptors({ LoggingInterceptor.class, CheckParametersInterceptor.class }) public UserRequest createAccount(&lt;some string parameters&gt;) throws ApplicationException { throw new ApplicationException("Exception thrown"); return null; } } JSF managed bean: public class CreateAccountBean { @EJB IUserService userService; public CreateAccountBean() { } public String confirmCreate() { try { userService.createAccount(&lt;some string values&gt;); } catch (ApplicationException e) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), e.getMsgDetail())); } return "create_succeeded"; } } When I do a call to the managedbean "CreateAccountBean" an exception is thrown by the businesslayer (in UserServiceImpl), however, when I debug through my code, I never arrive in the catch clause of the the calling method. I've not been able to find a solution, until I tried removing the @EJB annotations and replaced them with a call to the constructor. At that point, the exception is in fact caught in the web layer by the managed bean, but that doesn't solve my problem, because I'm not using EJB's anymore at that point, but because this happens I'm assuming that it's the EJB container that is swallowing the exceptions. By the way, the exceptions also appear in my server logs (which is proof that they are in fa…
tagged with: ejb-3.0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34432839
tagged with: glassfish-3
tagged with: jsf
tagged with: java
has comment: http://stackoverflow.com/comment/34287510
tagged with: eclipse
type: Question
score: 0
has title: EJB container swallows exception
has comment: http://stackoverflow.com/comment/34504814

http://stackoverflow.com/comment/34373617
type: QuestionComment
has text: @ThoAppelsin: Consider r = { 8, 1, 1 }. z=n is not the case here (r1 > 0.5*(8+1+1)).
comment on: http://stackoverflow.com/q/22580118
score: 0
type: Comment

http://stackoverflow.com/q/22646338
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/34493131
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/22647520
has comment: http://stackoverflow.com/comment/34492094
answer count: 2
possible better answer: http://stackoverflow.com/a/22647589
has answer: http://stackoverflow.com/a/22647589
favorite count: 0
has comment: http://stackoverflow.com/comment/34492950
has body: I am facing some problem in android suppport v7 app compat. is giving error that some jar missing. I want to make a simple hello world app with android support v4 or something, but how to remove android support v7?
tagged with: android
upvote count: 6
has answer: http://stackoverflow.com/a/22647520
type: AnsweredQuestion
has title: How to remove android v7 -app compat support
tagged with: android-appcompat

http://stackoverflow.com/comment/34382492
has text: The code for `remove()` and `containsKey()` is almost identical with respect to finding the item in the `HashMap`. It almost sounds like your `equals()` or `hashCode()` don't return the same value every time, or some other thread is altering values behind the scenes.
comment on: http://stackoverflow.com/q/22584807
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34443700
comment on: http://stackoverflow.com/q/22618680
score: 0
type: Comment
type: QuestionComment
has text: @laalto it worked. i had done it though. weird stuff.

http://stackoverflow.com/comment/34494243
score: 0
comment on: http://stackoverflow.com/q/22647619
type: Comment
type: QuestionComment
has text: use high-low to get the size of your new array. Allocate it. Use a loop iterated from low to high to copy values into the new array.

http://stackoverflow.com/q/22605369
has answer: http://stackoverflow.com/a/22605481
score: 1
upvote count: 1
tagged with: unit-testing
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34418493
tagged with: hamcrest
tagged with: junit
answer count: 1
downvote count: 0
favorite count: 0
has title: Hamcrest hasItem not matching in ArrayList
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34420517
linked to: http://stackoverflow.com/q/7869711
has body: I am currently testing hasItem() Matcher but to no avail. Please see sample code below: List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("1"); list.add("2"); list.add("3"); org.junit.Assert.assertThat(list, hasItem("3")); It produces java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V at org.hamcrest.core.IsCollectionContaining.matchesSafely(IsCollectionContaining.java:31) at org.hamcrest.core.IsCollectionContaining.matchesSafely(IsCollectionContaining.java:14) at org.hamcrest.TypeSafeDiagnosingMatcher.matches(TypeSafeDiagnosingMatcher.java:55) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:12) at org.junit.Assert.assertThat(Assert.java:865) at org.junit.Assert.assertThat(Assert.java:832) ...

http://stackoverflow.com/comment/34391100
type: QuestionComment
has text: can you describe your directory structure ? Where is your .properties file ?
score: 1
comment on: http://stackoverflow.com/q/22588733
type: Comment

http://stackoverflow.com/q/22561658
has comment: http://stackoverflow.com/comment/34383409
score: 1
tagged with: java
has title: A function that grabs the name of the java class from the byte code
has answer: http://stackoverflow.com/a/22561837
upvote count: 1
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34340385
linked to: http://stackoverflow.com/q/7408921
has body: I'm looking for a library/function that takes a java .class file and returns the class and package name. Are there any small libraries that do this?
has comment: http://stackoverflow.com/comment/34383300
answer count: 1
tagged with: clojure
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34400463

http://stackoverflow.com/a/34199900
has body: Just want to add this. I had this problem today. Adjusted the settings in my project, rebuilt, and same problem. I had (incorrectly) assumed that changing the settings in my project (Eclipse) would cause the projects on which my project depends to be recompiled also. Adjusting the settings to all of the projects up the dependency tree solved the problem.
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22489398

http://stackoverflow.com/comment/34303502
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22540518
has text: So if a search string containing spaces is enclosed in double quotes, you do not want it to be split up ?
score: 0

http://stackoverflow.com/comment/34371095
score: 0
comment on: http://stackoverflow.com/q/22578953
type: Comment
type: QuestionComment
has text: [Math.round()](http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#round(double)) returns a `long`

http://stackoverflow.com/comment/34464530
type: Comment
type: QuestionComment
has text: Can you post the code where R is declared and all the relevant code?
score: 0
comment on: http://stackoverflow.com/q/22629884

http://stackoverflow.com/comment/84521432
type: Comment
has text: Yes, Adding JDK 8 related profile & setting none resolves the issue. It generates javadoc jar same as it was generating in JDK 7. Thanks.
comment on: http://stackoverflow.com/a/34808603
type: AnswerComment
score: 0

http://stackoverflow.com/q/22609375
upvote count: 0
possible better answer: http://stackoverflow.com/a/22671337
has answer: http://stackoverflow.com/a/22611720
accepted answer: http://stackoverflow.com/a/22611720
tagged with: swing
tagged with: tablecellrenderer
type: Question
score: -2
tagged with: java
has body: I am using the following TableCellRenderer in my JTable. When I click on JComboBox, I see a list of values as a single String (like this: [Text1, Text2]), but not as separate items. Where is the error? TableColumn columnComboBox = table.getColumnModel().getColumn(5); columnComboBox.setCellRenderer(getRendererComboBox()); private TableCellRenderer getRendererComboBox() { return new TableCellRenderer() { private JComboBox&lt;String&gt; box = new JComboBox&lt;String&gt;(); @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { box.removeAllItems(); for (String q : employees[row].getQualification()) box.addItem(q); box.setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); box.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); return box; } }; }
tagged with: jtable
answer count: 2
has answer: http://stackoverflow.com/a/22671337
downvote count: 2
has comment: http://stackoverflow.com/comment/34427946
has title: The content of JComboBox is displayed as a single string, not as separate items
favorite count: 0
linked to: http://stackoverflow.com/q/868651
has comment: http://stackoverflow.com/comment/34431316
tagged with: jcombobox
type: AnsweredQuestion

http://stackoverflow.com/comment/34415527
score: 0
type: AnswerComment
type: Comment
has text: @Jason C, +1 for English meaning. I am afraid however that linguistics does not help to OP too much.
comment on: http://stackoverflow.com/a/22603293

http://stackoverflow.com/q/22505857
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/22506068
has title: How to find ISD code from ISO 3166 code?
has answer: http://stackoverflow.com/a/22506068
has body: I want to show ISO 3166 country code and its ISD code in list Like: ind +91 irq +964 ita +39 With the help of java.util.Locale I have got all ISO 3166 country codes but now I want ISD codes of every country.
favorite count: 0
tagged with: iso
tagged with: iso-3166
upvote count: 2
has comment: http://stackoverflow.com/comment/34282907
tagged with: android
has answer: http://stackoverflow.com/a/22505991
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22505991

http://stackoverflow.com/comment/34353174
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22568529
has text: @AbhinavKumar: Hibernate doesn't keep objects in memory. It reloads them from the database in each transaction.
type: Comment

http://stackoverflow.com/comment/34492992
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22646892
has text: If you posted some code examples of your code, maybe we could see how your code could benefit from using objects.
score: 0

http://stackoverflow.com/q/22501133
tagged with: spring-data-jpa
has title: How can I reload changed JPA Repository classes
tagged with: jpa
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
score: 2
answer count: 0
tagged with: java
has body: I am using spring-loaded for dynamic reloading of my webapp without build across changes. The webapp itself is Spring MVC based, uses JPA with postgres underneath and is hosted on Tomcat. spring-loaded does most of the stuff for me to avoid build, except that it does not know how to reload changed JPA "Repository" classes. I am exploring possibility of extending spring-loaded. What is the best way to recreate Repository beans in application context? How does spring-data do it originally codewise?
type: Question

http://stackoverflow.com/comment/34386887
comment on: http://stackoverflow.com/q/22587089
has text: It is because the hasNextDouble() returns false as there is no double value (there is a name) and the program never enters any loop.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34404744
comment on: http://stackoverflow.com/q/22597421
type: Comment
type: QuestionComment
has text: @MarcoAcierno , all good : ) Even it the question was tagged `machinecode` nobody could help without seeing any code.
score: 1

http://stackoverflow.com/comment/34238304
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22503059
type: AnswerComment
has text: Thanks..but what difference does it make if i supply an abstract or non-abstract method? any pros/cons?

http://stackoverflow.com/comment/34455476
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22625621
has text: Initialize `String names[] = {};` like this `String[] names = new String[lists.length > 0 ? lists.length : 1];`

http://stackoverflow.com/comment/34324062
score: 0
type: Comment
type: QuestionComment
has text: I realize this is the current instance but I didn't know if I was using the right syntax. I am compiling using Eclipse -- what I meant by "it," sorry. I also have changed the variable name but I'm still getting the same warning.
comment on: http://stackoverflow.com/q/22552053

http://stackoverflow.com/q/22596877
has answer: http://stackoverflow.com/a/22596907
has title: What's the worst-case time complexity of TreeSet?
type: Question
has body: It is stated here that TreeSet has a log(n) time complexity guarantuee for add()/remove()/contains(). But TreeSet uses a binary search tree and in the worst case, binary search trees can have O(n) height. How is the log(n) complexity "guaranteed"?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34403647
linked to: http://stackoverflow.com/q/3607593
has comment: http://stackoverflow.com/comment/34403649
answer count: 1
tagged with: hashmap
type: UnansweredQuestion
tagged with: time-complexity

http://stackoverflow.com/comment/34482003
type: Comment
type: QuestionComment
has text: Your expectations are all wrong. Java is pass by value. Arrays are static types, you cannot resize them.
comment on: http://stackoverflow.com/q/22640945
score: 3

http://stackoverflow.com/comment/34445470
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22620012
has text: i still dont see how we get 12

http://stackoverflow.com/q/22632167
score: -3
has comment: http://stackoverflow.com/comment/34471961
tagged with: deprecated
has comment: http://stackoverflow.com/comment/34480729
tagged with: java
has answer: http://stackoverflow.com/a/22883225
has title: trait PlainResult in package mvc is deprecated: In Play 2.3, SimpleResult will be the only type of result
type: Question
answer count: 2
tagged with: playframework
has answer: http://stackoverflow.com/a/22781520
upvote count: 1
downvote count: 4
favorite count: 0
has body: i am using scala with play framework 2.2, i am using below piece of code for getting that user is in session or not. session.get("userId").map { user =&gt; //----------------- }.getOrElse { //---------------- } but from some days it getting warning when i am compilling my project. trait PlainResult in package mvc is deprecated: In Play 2.3, SimpleResult will be the only type of result [warn] session.get("userId").map { user =&gt; [warn] ^ so as it is now deprecated , so what i use now for getting that user is in the session or not without any warning?
tagged with: playframework-2.2
has comment: http://stackoverflow.com/comment/35004335
type: UnansweredQuestion
tagged with: scala

http://stackoverflow.com/a/22608194
type: Answer
score: 1
upvote count: 1
has body: please give me the solution of my problem as soon as possible fast (as soon as possible fast and first) create JTable and DefaultTableModel as local variable add, remove, modify data in model only, don't to recreate whole structure, in emergency case to switch betweens model for one JTable (already visible in Swing GUI) whatever Task[] task is it must to notify EDT, then code model.add/remove/insertRow must notify EDT by wrap into invokeLater
answers question: http://stackoverflow.com/q/22608065
downvote count: 0

http://stackoverflow.com/a/22493796
answers question: http://stackoverflow.com/q/22493765
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22493765
has body: Just use a semi-colon ;, it has the same effect.
type: Answer
upvote count: 109
score: 109

http://stackoverflow.com/a/22569061
downvote count: 0
has body: Renderers are just "rubber stamps" painted onto the component. They are not live, interactive components. See this answer: JButton in JList for one possible solution. Effectively, you add a MouseListener to your JList, determine which particular button is being rendered at that click-point, then programmatically click that button. Or, you could make a JPanel of buttons, and place the panel in a JScrollPane. Or, you could make a single-column JTable, where you could implement a custom TableCellEditor, as seen here: Table Button Column
type: Answer
accepted answer of: http://stackoverflow.com/q/22568849
upvote count: 7
answers question: http://stackoverflow.com/q/22568849
has comment: http://stackoverflow.com/comment/34354034
score: 7
type: AcceptedAnswer

http://stackoverflow.com/q/22571586
has body: There is an array related problem, the requirement is that time complexity is O(n) and space complexity is O(1). If I use Arrays.sort(arr), and use a for loop to one pass loop, for example: public static int hello(int[]A){ Arrays.sort(A); for(int i=0;i&lt;A.length;i++){ .................... } return ....; } So the loop will cost O(n) time. My question is: will Arrays.sort() cost more time? If I use Arrays.sort(), will this time complexity still be O(n)? And will Arrays.sort() cost more space?
has comment: http://stackoverflow.com/comment/34358687
has comment: http://stackoverflow.com/comment/34358851
has answer: http://stackoverflow.com/a/22571777
has answer: http://stackoverflow.com/a/74287811
upvote count: 37
accepted answer: http://stackoverflow.com/a/22571601
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/34358372
has comment: http://stackoverflow.com/comment/34358410
answer count: 8
type: AnsweredQuestion
tagged with: time-complexity
has comment: http://stackoverflow.com/comment/113722581
has comment: http://stackoverflow.com/comment/34358675
has comment: http://stackoverflow.com/comment/34358412
favorite count: 0
has answer: http://stackoverflow.com/a/74190323
has comment: http://stackoverflow.com/comment/34358446
type: Question
downvote count: 2
has answer: http://stackoverflow.com/a/22571611
has answer: http://stackoverflow.com/a/22571601
possible better answer: http://stackoverflow.com/a/49360365
has answer: http://stackoverflow.com/a/79161614
tagged with: space-complexity
has answer: http://stackoverflow.com/a/49360365
has title: Will Arrays.sort() increase time complexity and space time complexity?
has comment: http://stackoverflow.com/comment/34358441
has answer: http://stackoverflow.com/a/67782161
score: 35
tagged with: java

http://stackoverflow.com/comment/34471379
type: AnswerComment
comment on: http://stackoverflow.com/a/22634079
type: Comment
has text: Yes, I have. In fact, i had no problems with other beans which I have also configured via annotations, so this is mainly why I don't understand why it is not recognising the interceptor
score: 0

http://stackoverflow.com/comment/59994639
type: AnswerComment
comment on: http://stackoverflow.com/a/35917239
type: Comment
has text: I got when using Build Tools 24.0.0-rcX with API 23. Should be using 23.0.2
score: 0

http://stackoverflow.com/comment/34476370
comment on: http://stackoverflow.com/a/22635166
score: 0
type: AnswerComment
type: Comment
has text: OK, glad to help. Sorry if it sounds like there are a whole load of restrictions but the `Activity` class and a few more android-specific classes need to be treated differently to usual Java classes. Once you've grasped those concepts it gets a lot easier and your code will be more robust and reliable.

http://stackoverflow.com/q/22527333
has title: FTP: When to send the code 226 after initiating a file transfer?
has answer: http://stackoverflow.com/a/22530327
answer count: 1
downvote count: 0
favorite count: 0
tagged with: ftp
has body: From a FTP server perspective, if a client requests a file through RETR command, the server creates a data connection (socket) to the client through the specified port and starts the transfer by writing in the outputstream. The server is coded (JAVA) in such a way that after the write is complete in the socket, the outputstream is flushed and then the socket is closed. After this the code "226" is sent to the client in control channel. Since the connection is over a very slow network, the 226 message reaches before the actual data transfer is complete. This is a tricky situation where the client code cannot be changed and the server has to make sure that the 226 is sent after client received the data. I tried searching in the internet and got few inputs, but not sure which one is the standard. 1. to use setSoLinger() method to turn on SO_LINGER and to set timeout. 2. to introduce a delay after writing each byte in to socket (performance will be impacted for fast connections). Is there any other options other than the above to solve the situation. Any idea about the standard followed for sending 226 in Linux/ Solaris/Windows FTP Servers. I could see a similar thread in stackoverflow "When should 226 be sent from the FTP server?" , but could not find much info from that related to my question. Help here is really appreciated...Thanks
type: UnansweredQuestion
tagged with: sockets
upvote count: 1
has comment: http://stackoverflow.com/comment/34287784
has comment: http://stackoverflow.com/comment/34287566
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34280067

http://stackoverflow.com/a/22566430
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22560921
upvote count: 1
has body: Instead of the ItemizedIconOverlay, use: either osmdroid ItemizedOverlayWithFocus or OSMBonusPack Marker
downvote count: 0

http://stackoverflow.com/comment/34335726
has text: I'm also not an expert. My colleagues have lot more experience with it, so I try to get my hands on as much information as possible.
comment on: http://stackoverflow.com/a/22533632
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22492089
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22508634
has body: I am using the RESTFul HttpGet service from import org.apache.http.client.methods.HttpGet; I created a function to query a service on a different computer. The call works fine, however I run into a "too many open files" on the service. My side simply returns a 500 error, which I catch. I spoke with the vendor, and they were quite adamant that the RESTful call should be made in a persistent way and that I am simply not freeing something and continued on that the problem is on my side. I wrote a stress function, see below, to help isolate the problem. Too my knowledge, I am releasing everything. I am still new to Java so many I am just not seeing something that was not clear. import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; public void doStressTest() { String strUri = "http://&lt;ip address&gt;:&lt;port&gt;/task?vara=dataa&amp;varb=datab"; HttpGet oRestyGet = new HttpGet(); oRestyGet.addHeader("Accept", "application/xml"); for (int iLoop = 0; iLoop &lt; 1000; iLoop++) { CloseableHttpClient httpclient = HttpClients.createDefault(); try { oRestyGet.setURI(new URI(strUri)); try { CloseableHttpResponse response2 = httpclient.execute(oRestyGet); try { String strResponseHeader = response2.getStatusLine().toString(); if (false == "HTTP/1.1 200 OK".equalsIgnoreCase(strResponseHeader)) return; continue; } finally { response2.close(); } } catch (ClientProtocolException e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); } finally { try { httpclient.close(); } catch (Exception e) { e.printStackTrace(); } } } try { oRestyGet.releaseConnection(); } catch (Exception e) { e.printStackTrace(); } } UPDATE: I thought that I add the text of what the vendor had to say, just in case it might help. I should add that in the stress test below I am opening a…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22508634
linked to: http://stackoverflow.com/q/13988780
score: 1
tagged with: java
has title: Java HttpGet, Too many open files in service error
type: Question
accepted answer: http://stackoverflow.com/a/22621807
has comment: http://stackoverflow.com/comment/34247657
upvote count: 1
has answer: http://stackoverflow.com/a/22514839
tagged with: httpclient
favorite count: 0
has comment: http://stackoverflow.com/comment/34246587
has answer: http://stackoverflow.com/a/22621807
tagged with: rest

http://stackoverflow.com/a/22495584
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22495525
downvote count: 0
has comment: http://stackoverflow.com/comment/34224799
type: Answer
has body: Split the string with space as delimiter, convert into integer array and then sort?

http://stackoverflow.com/comment/34469390
score: 0
type: Comment
has text: I dont know the need of those entities so many to one or one to many i am assuming it is needed by you. but in the second entity use mappedBy ="disease".
comment on: http://stackoverflow.com/a/22617949
type: AnswerComment

http://stackoverflow.com/a/22613102
has comment: http://stackoverflow.com/comment/34433608
has comment: http://stackoverflow.com/comment/34433818
has comment: http://stackoverflow.com/comment/34434171
answers question: http://stackoverflow.com/q/22612693
score: 0
has body: If you enable RMI-classloader AND set the appropriate system properties (google for: "java.rmi.server.codebase") then RMI will dynamically load the missing class from server to client - and your problem will go away. No need to store and statically link server libraries on client side. As far as I know the RMI-classloader tutorial describes this all in detail. EDIT: I have given the hint to the great RMI-feature of dynamic classloading. But I would say in your special case it is probably not a good idea to try to propagate server classes to clients. Imagine there is another client like a JMX-browser in parallel which might get problems with unknown classes. Better: Catch the itext-Exception on server side just before sending the result of RMI-invocation and wrap it in another well-known exception like for example IllegalStateException by only using the error message but not the stack trace (you should log it anyway on the server-side). My idea for exception handling on server-side is (pseudo-code): try { // your server code } catch (Throwable ex) { // a) log error completely including cause (stacktrace) with tools like Log4J etc. // b) throw new RemoteException(error.getMessage()); // without cause! }
has comment: http://stackoverflow.com/comment/34435522
has comment: http://stackoverflow.com/comment/34433708
type: Answer

maven
tags question: http://stackoverflow.com/q/22549216
tags question: http://stackoverflow.com/q/22536553
tags question: http://stackoverflow.com/q/22511561
tags question: http://stackoverflow.com/q/22620701
tags question: http://stackoverflow.com/q/22551898
tags question: http://stackoverflow.com/q/22566191
type: Tag
tags question: http://stackoverflow.com/q/22608289
tags question: http://stackoverflow.com/q/22537185
tags question: http://stackoverflow.com/q/22634730
tags question: http://stackoverflow.com/q/22595011
tags question: http://stackoverflow.com/q/22620300
tags question: http://stackoverflow.com/q/22506317
tags question: http://stackoverflow.com/q/22528099
tags question: http://stackoverflow.com/q/22505389
tags question: http://stackoverflow.com/q/22636652
tags question: http://stackoverflow.com/q/22529455
tags question: http://stackoverflow.com/q/22559218
tags question: http://stackoverflow.com/q/22583451
tags question: http://stackoverflow.com/q/22608762
tags question: http://stackoverflow.com/q/22632553
tags question: http://stackoverflow.com/q/22524881
tags question: http://stackoverflow.com/q/22529932
tags question: http://stackoverflow.com/q/22641348
tags question: http://stackoverflow.com/q/22640406
tags question: http://stackoverflow.com/q/22616526
tags question: http://stackoverflow.com/q/22537171
tags question: http://stackoverflow.com/q/22599435
tags question: http://stackoverflow.com/q/22641472
tags question: http://stackoverflow.com/q/22554430
tags question: http://stackoverflow.com/q/22549517
tags question: http://stackoverflow.com/q/22589437
tags question: http://stackoverflow.com/q/22630973
tags question: http://stackoverflow.com/q/22504923
tags question: http://stackoverflow.com/q/22515634
tags question: http://stackoverflow.com/q/22634644
tags question: http://stackoverflow.com/q/22608591
tags question: http://stackoverflow.com/q/22556070
tags question: http://stackoverflow.com/q/22516402
tags question: http://stackoverflow.com/q/22523545
tags question: http://stackoverflow.com/q/22598430
tags question: http://stackoverflow.com/q/22555301
tags question: http://stackoverflow.com/q/22508337
tags question: http://stackoverflow.com/q/22528856
tags question: http://stackoverflow.com/q/22583342
tags question: http://stackoverflow.com/q/22562558
tags question: http://stackoverflow.com/q/22569710
tags question: http://stackoverflow.com/q/22503465
tags question: http://stackoverflow.com/q/22637380
tags question: http://stackoverflow.com/q/22592050
tags question: http://stackoverflow.com/q/22625365
tags question: http://stackoverflow.com/q/22523644
tags question: http://stackoverflow.com/q/22508965
tags question: http://stackoverflow.com/q/22505271
tags question: http://stackoverflow.com/q/22502824
tags question: http://stackoverflow.com/q/22625945
tags question: http://stackoverflow.com/q/22546013
tags question: http://stackoverflow.com/q/22530932
tags question: http://stackoverflow.com/q/22569198
tags question: http://stackoverflow.com/q/22579941
tags question: http://stackoverflow.com/q/22510596
tags question: http://stackoverflow.com/q/22576416
tags question: http://stackoverflow.com/q/22576225
tags question: http://stackoverflow.com/q/22547962
tags question: http://stackoverflow.com/q/22571037
tags question: http://stackoverflow.com/q/22598548
tags question: http://stackoverflow.com/q/22615264
tags question: http://stackoverflow.com/q/22530885
tags question: http://stackoverflow.com/q/22601834
tags question: http://stackoverflow.com/q/22542321
tags question: http://stackoverflow.com/q/22646850
tags question: http://stackoverflow.com/q/22571198
tags question: http://stackoverflow.com/q/22547294
tags question: http://stackoverflow.com/q/22601193
tags question: http://stackoverflow.com/q/22546657
tags question: http://stackoverflow.com/q/22530618
tags question: http://stackoverflow.com/q/22608350
tags question: http://stackoverflow.com/q/22614613
tags question: http://stackoverflow.com/q/22610770
tags question: http://stackoverflow.com/q/22633328

http://stackoverflow.com/a/22611999
has comment: http://stackoverflow.com/comment/34434969
has body: Check out my code from here, to get a hint as to how to paint stuff in a game loop properly. Basically what you need to take care of is double buffering to prevent any flickering and also repainting the background so that you don't leave out any trail of rectangles. You can also check out the Killer Game Programming in Java online book, which can help you learn the game programming concepts and their implementation. The concept of double buffering is simple. Since painting on the screen takes more time than updating the states of the objects in the gameplay, we use two canvas to prevent any flickering issues which arise when objects are painted directly on the screen. When the object states are updated in the game loop, it is rendered in a background canvas. The background canvas is then copied to the screen which takes less time compared to painting directly on the screen. And while this copying is happening, the object states are updated again and they are rendered on the background canvas again, which is then copied to the screen. Repeat this over and over, and you get the double buffering. Basically you keep a buffer of screen which is to be painted and your game renders objects in the buffer which is then copied to the screen. Here's a code which I think might help you understand the concept: import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; public class GamePanel extends JPanel implements Runnable { private static final long serialVersionUID = 6892533030374996243L; public static final int WIDTH = 800; public static final int HEIGHT = 600; private Thread animator; private volatile boolean running = false; private volatile boolean isGameOver = false; private volatile boolean isUserPaused = false; private volatile boolean isWindowPaused = false; private Graphics dbg; private Image dbImage = null; private…
has comment: http://stackoverflow.com/comment/34437866
has comment: http://stackoverflow.com/comment/34437461
type: Answer
has comment: http://stackoverflow.com/comment/34430356
has comment: http://stackoverflow.com/comment/34432045
has comment: http://stackoverflow.com/comment/34434038
answers question: http://stackoverflow.com/q/22611747
has comment: http://stackoverflow.com/comment/34436292
has comment: http://stackoverflow.com/comment/34431153
has comment: http://stackoverflow.com/comment/34430904
has comment: http://stackoverflow.com/comment/34430502
has comment: http://stackoverflow.com/comment/34430830
has comment: http://stackoverflow.com/comment/34437932
has comment: http://stackoverflow.com/comment/34431378
score: 0
has comment: http://stackoverflow.com/comment/34435115
has comment: http://stackoverflow.com/comment/34430417

http://stackoverflow.com/q/22621415
tagged with: java
accepted answer: http://stackoverflow.com/a/22621494
type: Question
has body: I have made JPanel class with one JComboBox and two JTextField controls. JFrame f = new JFrame(); JPanel p = new JPanel(); ComparisonPanel cp = new ComparisonPanel(); //jPanel with a few elements ComparisonPanel cp2 = new ComparisonPanel(); p.setLayout(new FlowLayout()/*new GridLayout(2, 2)*/); f.getContentPane().add(cp); f.getContentPane().add(cp2/*cp*/); f.setVisible(true); It shows the ComparisonPanel only once. I am actually trying to generate a GUI on runtime, the panel will be repeated with a few modifications (different labels etc) and then get the values from this dynamically generated GUI.
tagged with: layout
has title: How to add a custom jPanel to jFrame multiple times?
downvote count: 0
tagged with: jpanel
answer count: 1
has answer: http://stackoverflow.com/a/22621494
favorite count: 0
upvote count: 2
tagged with: jframe
tagged with: swing
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/22545931
upvote count: 2
has comment: http://stackoverflow.com/comment/34313668
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22545603
has comment: http://stackoverflow.com/comment/34314641
downvote count: 0
has body: The Console class is the correct way to read passwords from the command line. However, it doesn't print asterisks, as that would leak information in general (not in the case where a PIN is known to be 4 digits). For something like that, you'd might need a curses library.

http://stackoverflow.com/a/22631477
type: AcceptedAnswer
has body: Primarily there are 3 types of access tokens- User access token Page access token App access token The documentation by facebook: Access Tokens, explains a lot about them. You can have a look. You should initialize the facebookClient with the user access token. The user access token is obtained when a user login/authorizes the app. This token is used to query about the user(for what he has given permissions to the application). The App access token has very limited powers like: posting on behalf of the user once he has given app the authorization, or send the requests etc.
type: Answer
has comment: http://stackoverflow.com/comment/34465307
score: 0
accepted answer of: http://stackoverflow.com/q/22630994
answers question: http://stackoverflow.com/q/22630994
has comment: http://stackoverflow.com/comment/34465254

http://stackoverflow.com/q/22511820
has comment: http://stackoverflow.com/comment/34252317
answer count: 0
type: UnansweredQuestion
tagged with: location-client
has body: I use LocationClient to get current location and if it fails then use LocationManager. Some times I don't get current location of device. If it is getting location of device then it keeps getting every time I try and, if it is not able to get location and no matter how many times I try, it never gives the location. Also at the same time if I run code on multiple devices it gives location of some devices but not able to get for rest of the devices. @Override public void onConnected(Bundle connectionHint) { Location loc = locationClient.getLastLocation(); Log.e(TAG, "location using client = " + loc.getLatitude() + "," + loc.getLongitude()); // If location is not null if (loc != null &amp;&amp; loc.getLatitude() != 0.0 &amp;&amp; loc.getLongitude() != 0.0) { // code } else { // Use location manager to get location getCurrentLocationUsingLocationManager(); } } private void getCurrentLocationUsingLocationManager() { // Get last known location Location location = locationManager .getLastKnownLocation(LocationManager.GPS_PROVIDER); // If last known location is recent then use it, otherwise request for // location update. if (location != null &amp;&amp; location.getTime() &gt; Calendar.getInstance() .getTimeInMillis() - THRESHOLD_ON_LAST_KNOWN_LOCATION_TIME * 1000) { // code } else { LocationListener locationListener = getLocationListener(); // If Network provider is enabled, then start listening for location // updates if (locationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); } // If GPS provider is enabled, then start listening for location // updates if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, locationListener); } // If none of the location providers is enabled if (!locationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER) &amp;&amp; !locationM…
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34253878
favorite count: 0
linked to: http://stackoverflow.com/q/6994904
type: Question
has title: Android current location is returned null
tagged with: android
upvote count: 1
tagged with: java
tagged with: geolocation
tagged with: locationmanager

http://stackoverflow.com/q/22631261
accepted answer: http://stackoverflow.com/a/22632027
upvote count: 8
type: Question
tagged with: jgit
possible better answer: http://stackoverflow.com/a/22631875
has answer: http://stackoverflow.com/a/22632027
answer count: 2
has title: List branches of a git remote repo without cloning it
downvote count: 0
has body: I was wondering hows it would be possible to list all the branches of a remote Git repo with jgit but without cloning it. While going through the jgit's javadoc, I found the ListBranchCommand but that only seem to work with an already opened Repository object. But I was not able to find how to create a Repository object over HTTP without cloning it in local. Is it possible ? Thanks
favorite count: 0
score: 8
has answer: http://stackoverflow.com/a/22631875
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22641501
type: Answer
has comment: http://stackoverflow.com/comment/34483009
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22641340
downvote count: 0
has body: When running an external procss that prints anything to stdout/stderr, you should read what it writes - otherwise it will block once it's buffer fills up. you basically needs a thread to read from stdout and a thread to read from stderr of each process.

aes
tags question: http://stackoverflow.com/q/22530242
type: Tag
tag name: aes
tags question: http://stackoverflow.com/q/22607772
tags question: http://stackoverflow.com/q/22589737
tags question: http://stackoverflow.com/q/22488402
tags question: http://stackoverflow.com/q/22607791

http://stackoverflow.com/comment/130404901
comment on: http://stackoverflow.com/q/22611807
type: QuestionComment
type: Comment
has text: @AmanAgnihotri You are kidding right?
score: 0

http://stackoverflow.com/comment/34481965
has text: Perhaps Apache Commons VFS may be of help? It seems to be able to read directories via HTTP: http://commons.apache.org/proper/commons-vfs/filesystems.html#HTTP_and_HTTPS
score: 0
comment on: http://stackoverflow.com/q/22640385
type: Comment
type: QuestionComment

displaytag
tags question: http://stackoverflow.com/q/22615179
tags question: http://stackoverflow.com/q/22625347
tag name: displaytag
type: Tag

http://stackoverflow.com/a/22612589
has comment: http://stackoverflow.com/comment/34432242
has comment: http://stackoverflow.com/comment/34431772
has body: I suggest you have to write your own XML parser so that it can see get the tags which you want to ignore. In this task you simply remove the ignored tags from expected and actual XML and match others tags for validation or comparison. I think you have two options here either use one of them between two parsers: DOM parser SAX PArser I know it's not best solution, so other thoughts are also welcome... EDIT I believe you need to write the wrapper on XMLUint. Which will take XML input after removing of ignored tags(Wrapper Task) and rest of functionality is same.
answers question: http://stackoverflow.com/q/22610374
accepted answer of: http://stackoverflow.com/q/22610374
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/93226729
score: 0
type: Comment
has text: May I ask how you did that?
comment on: http://stackoverflow.com/a/22584977
type: AnswerComment

http://stackoverflow.com/comment/34471500
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22630470
score: 1
has text: Well, one thing you could do is buffer the last 15 seconds on the server side, then "rewind" the timestamp of incoming connections by that amount, effectively blasting 15 seconds of stream immediately after connection (then dropping down to 128k). Depending on how the renderer decides how much to buffer, that might even fool it into playing immediately even with much less than 8-15 seconds. Of course, this means the output won't be as live (but I'm not sure you could get that anyway).

http://stackoverflow.com/q/22615305
has body: I have an android application that consumes a webservice that is located on a GlassFish server on my laptop. When both my laptop and my device is connected to the WiFi, it works as intended. But when I try to access the webservice when my device is connected to the mobile 3g net it throws a timeout error: W/System.err(3835): java.net.ConnectException: failed to connect to >/[RouterIPAddress] (port 8080): connect failed: ETIMEDOUT (Connection timed out) I have configurated my router to forward HTTP to my laptops IP and port 8080. This is my code for calling the WebService: public class WebService { //Namespace of the Webservice - can be found in WSDL private static String NAMESPACE = "http://service.marcusjacobsson.com/"; //Webservice URL - WSDL File location private static String URL = "http://[myRoutersIPAddress]:8080/WebServiceProject/HelloWebService?wsdl"; //SOAP Action URI again Namespace + Web method name private static String SOAP_ACTION = "http://service.marcusjacobsson.com/"; public static String[] invokeHelloWorldWS(String webMethName) { String[] resultArray = null; // Create request SoapObject request = new SoapObject(NAMESPACE, webMethName); // Create envelope SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); // Set output SOAP object envelope.setOutputSoapObject(request); // Create HTTP call object HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { // Invoke web service androidHttpTransport.call(SOAP_ACTION+webMethName, envelope); // Get the response SoapObject response = (SoapObject) envelope.bodyIn; if(response!=null){ int count = response.getPropertyCount(); resultArray = new String[count]; for(int i=0;i&lt;count;i++){ resultArray[i]=response.getProperty(i).toString(); } } return resultArray; } catch (Exception e) { //Print error e.printStackTrace(); } //Return resTxt to calling object return resultArray; } } What is causing the application to not being able to connect to my laptop over the mo…
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34437989
tagged with: android
has comment: http://stackoverflow.com/comment/34436651
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: web-services
type: Question
has title: Android Application consuming a WebService on a GlassFish server using ksoap2
tagged with: glassfish

http://stackoverflow.com/comment/36653867
type: Comment
has text: Peter, just want to make sure, did `Chronicle` support this: having enough size to contain all the messages so that it won't slow down the `Disruptor` while let the database consumer to consume the message from `Chronicle`, just like a blocking queue?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22629384

http://stackoverflow.com/comment/34782895
has text: But if you take the alternative approach and call a LoginContext configured with the Krb5LoginModule to populate the Subject before using it in a doAs call which obtains a database connection the login module does not add a GSSCredential to the private credentials so if the driver expected it then it would be missing for that scenario.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22682489

http://stackoverflow.com/comment/38920768
score: 0
has text: I'm trying to do the same thing too. what I found so far is you configure it first. via "gsutil configure" I'll post an answer here later when I found the solution
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22584319

http://stackoverflow.com/a/22511691
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22511630
score: 3
answers question: http://stackoverflow.com/q/22511630
type: Answer
has body: Your shuffle and swap methods aren't using compareTo, so there is no reason to make the type Comparable. In this case, an Object[] seems to be the best option, as a replacement for Comparable[]. Any objects can be shuffled. That's as general as it gets.
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/a/22621317
answers question: http://stackoverflow.com/q/22621194
has body: Actually dateCreated is an Object from the Class Date which is in package java.util and is inside the Object you are defining which is SimpleGeoMetricObject In other words Java guys wrote this: package java.util; public Class Date{ //with its own attributes public Date(){ ... //and its own constructor } ...//and it's own methods } And provided it to developpers so we can use it in our own Class/Objects and by the way if you import the package like this import java.util.Date; in the beginning of your file you would only need to construct Date like follows : Date objectDate = new Date();
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22621194
type: AcceptedAnswer

http://stackoverflow.com/q/22566112
answer count: 1
has comment: http://stackoverflow.com/comment/34347867
has answer: http://stackoverflow.com/a/22566244
favorite count: 0
has body: So I am making a student grades calculator and I want to use the List&lt;> but I don't want to use it the normal way where it will contain stuff in the normal order : [x,y,1,3] I want to make it so that I have the List and inside that I will have many small lists that will contain the name of the student and after that all the grades that student has. How can I make such a list and then access it?
accepted answer: http://stackoverflow.com/a/22566244
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/34347865
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has title: How to make 2d List and how to use it
score: 0

http://stackoverflow.com/comment/34310276
comment on: http://stackoverflow.com/q/22544154
type: Comment
has text: For each file, read each line as one `List<Integer>` per line, store those lists in a `HashSet`. Then if `set1.containsAll(set2) && set2.containsAll(set1)`, you're good to go. Or just store each line as a `String` if you aren't worried about whitespace difference leading to false negatives.
score: 1
type: QuestionComment

http://stackoverflow.com/a/22629722
downvote count: 0
score: 1
has body: Using Apache commons-lang library you got a handy method to achieve this: StringUtils.replaceChars(mystr, "01", "10"); Basically it replaces characters with corresponding characters (correspondence by index). This is the litte test program import org.apache.commons.lang.StringUtils; public class InvertString { public static void main(String[] args) { System.out.println(invert("0001011")); System.out.println(invert("000")); System.out.println(invert("1101")); } private static String invert(String string) { return StringUtils.replaceChars(string, "01", "10"); } } and the output of it is 1110100 111 0010
upvote count: 1
answers question: http://stackoverflow.com/q/22628724
type: Answer

http://stackoverflow.com/q/22508874
has answer: http://stackoverflow.com/a/37436552
has answer: http://stackoverflow.com/a/22509001
downvote count: 0
accepted answer: http://stackoverflow.com/a/22509001
favorite count: 0
possible better answer: http://stackoverflow.com/a/22513401
answer count: 9
has answer: http://stackoverflow.com/a/22513401
has title: get prime numbers and total prime numbers in range
has answer: http://stackoverflow.com/a/42676421
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/22508958
has answer: http://stackoverflow.com/a/45669627
has answer: http://stackoverflow.com/a/46198304
upvote count: 7
type: Question
has body: I am a beginner in Java. I am writing this program to show all prime numbers in between the number supplied from the user. Current output is: 2, 3, 5, 7, Count: 4 But, i want the output to be like: "The number of prime is: "+count+", and they are: " followed by all the numbers separated by comma package com.example.test; import java.util.Scanner; public class PrimeTest { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out .println("Enter the number till which the prime numbers are to be calculated: "); int input = scanner.nextInt(); int count = 0; // loop through the numbers one by one for (int i = 2; i &lt; input; i++) { boolean isPrimeNumber = true; // check to see if the number is prime for (int j = 2; j &lt; i; j++) { if (i % j == 0) { isPrimeNumber = false; break; // exit the inner for loop } } // print the number if prime if (isPrimeNumber) { count++; System.out.print(i + ", "); } } System.out.println("Count: " + count); } }
has answer: http://stackoverflow.com/a/22508935
has answer: http://stackoverflow.com/a/22508942

http://stackoverflow.com/comment/34427418
has text: Json Jackson would the option
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22610392

http://stackoverflow.com/a/22511333
has comment: http://stackoverflow.com/comment/34251600
upvote count: 1
has comment: http://stackoverflow.com/comment/34251243
type: Answer
has comment: http://stackoverflow.com/comment/34251103
downvote count: 0
score: 1
has body: Just concatenate the strings and use only one token: System.out.printf("%s", "Title: " + book.getTitle()); I added 6 to your formatted string length, since I assume you want to accommodate for "Title:".
has comment: http://stackoverflow.com/comment/34251466
answers question: http://stackoverflow.com/q/22511275

http://stackoverflow.com/comment/34238012
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22503118
has text: Instead of this: String t = jb.getString(s) you should use: if(jb.has(s)) { String t = jb.getString(s); }
score: 0

http://stackoverflow.com/comment/34345607
has text: Well, looks like you can't do anything with that. Is it an issue for you to write the custom `InMemoryUserDetailsManager` ?
comment on: http://stackoverflow.com/q/22564532
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/22503846
downvote count: 1
answers question: http://stackoverflow.com/q/22503714
type: Answer
score: 2
has body: Try this : if(positionE != -1 &amp;&amp; (position == -1 || positionE &lt; position)){ position = positionE; }
upvote count: 3

http://stackoverflow.com/comment/34426026
has text: @Waxolunist Ah okay, have not read this sentence. Well, I think that is the BEST way so you escape all these weird time zone problems. It will not be good for you to introduce an intermedium JavaScript-object which uses time zones. No tricky workaround based on such a type can really heal the problem that this approach falsifies what the real input was (a plain date).
comment on: http://stackoverflow.com/a/22608454
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/22557300
score: 2
has comment: http://stackoverflow.com/comment/34332355
downvote count: 0
has comment: http://stackoverflow.com/comment/34331954
has body: Assuming your convertion from int to byte array is correct, negative bytes are normal because that's their decimal representation, it's not an error. If the byte value is over 127, the MSB will be 1, which for Java means a negative number. In Java there's no unsigned values, so if you show as decimal representation it will always show negative. If you want to see the byte value unsigned you can convert to hex representation (Integer.toHexString), or use a bigger holder like short or int to see the unsigned decimal value. The point here is that the byte value is always the same, but you can show it in different ways (signed, unsigned, hexadecimal, etc..). The value representation can confuse you. The value and its representation are two different things. Also you might want to look into bit shifting for this instead of using powers, which is way slower.
upvote count: 2
has comment: http://stackoverflow.com/comment/34332019
accepted answer of: http://stackoverflow.com/q/22557174
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22557174
has comment: http://stackoverflow.com/comment/34332449
type: Answer
has comment: http://stackoverflow.com/comment/34331962
has comment: http://stackoverflow.com/comment/34331830

http://stackoverflow.com/q/22549118
has title: Declare an array of WeakReferences?
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: weak-references
linked to: http://stackoverflow.com/q/1817524
has body: I know how to declare an individual WeakReference, but what about an array of them? WeakReference&lt;String&gt; testWR; testWR = new WeakReference&lt;String&gt;("Hello"); String[] exStrArr; exStrArr = new String[5]; WeakReference&lt;String&gt;[] testWR2; //not working testWR2 = new WeakReference&lt;String&gt;[5]; testWR2 = new WeakReference&lt;String&gt;(new String())[5]; testWR2 = new WeakReference&lt;String&gt;()[5]; Could someone please tell me the proper syntax here? I'd sure appreciate it =)
upvote count: 6
has answer: http://stackoverflow.com/a/22549192
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34319108
score: 6
tagged with: java

http://stackoverflow.com/comment/34319785
type: QuestionComment
comment on: http://stackoverflow.com/q/22549558
has text: http://en.m.wikipedia.org/wiki/Java_version_history
score: 0
type: Comment

http://stackoverflow.com/a/22499559
has comment: http://stackoverflow.com/comment/34276286
has comment: http://stackoverflow.com/comment/34266904
has comment: http://stackoverflow.com/comment/34267056
has comment: http://stackoverflow.com/comment/34266975
has body: May be MyCustomType doesn't implement java.lang.Comparable It works fine for ArrayList&lt;MyCustomType&gt; but not for TreeSet&lt;MyCustomType&gt; --EDIT-- HashSet&lt;MyCustomType&gt; or LinkedHashSet&lt;MyCustomType&gt; are working fine. After getting data at client side just use new TreeSet&lt;MyCustomType&gt;(&lt;retured HashSet&lt;MyCustomType&gt;) There is no need of iterating it because it is ordered by &lt;Comparable&lt;MyCustomType&gt;.
has comment: http://stackoverflow.com/comment/34276132
has comment: http://stackoverflow.com/comment/34268630
score: 0
has comment: http://stackoverflow.com/comment/34267871
has comment: http://stackoverflow.com/comment/34267292
type: Answer
answers question: http://stackoverflow.com/q/22498935
has comment: http://stackoverflow.com/comment/34455656

http://stackoverflow.com/a/22541435
answers question: http://stackoverflow.com/q/22541340
has body: Try, ArrayList&lt;Integer&gt; integerList = new ArrayList&lt;Integer&gt;(); // add Integer Elements ArrayList&lt;String&gt; stringList = new ArrayList&lt;String&gt;(); for(Integer i : integerList){ stringList.add(i+""); }
has comment: http://stackoverflow.com/comment/34304941
score: 0
type: Answer

http://stackoverflow.com/a/22602114
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22601986
has body: This confusion is because of the absence of Curly Braces. Your code has nothing wrong in it. The last System.out.println("."); which is confusing you is part of the outer loop. So your code is equivalent to this: for (int i = 0; i&lt;10; i++) { for (int c = 0; c &lt; 10; c++) { if(i == c){ System.out.print("*"); } else{ System.out.print("-"); } System.out.println("."); } }

http://stackoverflow.com/a/30897713
has body: I had Java 1.7 &amp; 1.8 installed (with SBT 2.4 that requires Java 1.8). Even though my project was linked to Java 1.8, I had to change the JAVA_HOME environment variable to point 1.8. Finally, problem solved.
answers question: http://stackoverflow.com/q/22489398
downvote count: 0
type: Answer
score: 9
upvote count: 9

http://stackoverflow.com/a/22628237
has comment: http://stackoverflow.com/comment/34460615
answers question: http://stackoverflow.com/q/22627860
downvote count: 0
has comment: http://stackoverflow.com/comment/34461139
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/34466849
has body: I find your solution elegant enough, what you're doing is a Factory, which is an elegant way to solve your problem. You can keep your constructor private, and always retrieve the objects through the factories public class MySerializableClass extends AbstractSerializable { private MySerializableClass(){ } public static MySerializableClass CreateMySerializableClass(final byte[] buffer){ MySerializableClass result = new MySerializableClass(); result.deserialize(buffer) return result; } byte[] serialize(){bla bla} deserialize(byte[] buffer){bla bla}; }
score: 2
has comment: http://stackoverflow.com/comment/34461686

http://stackoverflow.com/a/22565520
has comment: http://stackoverflow.com/comment/34375594
has comment: http://stackoverflow.com/comment/34405340
score: 8
has comment: http://stackoverflow.com/comment/34375356
type: Answer
has comment: http://stackoverflow.com/comment/34357526
has comment: http://stackoverflow.com/comment/34397931
downvote count: 0
has comment: http://stackoverflow.com/comment/34398165
has comment: http://stackoverflow.com/comment/34358609
has comment: http://stackoverflow.com/comment/34383949
answers question: http://stackoverflow.com/q/22565155
has comment: http://stackoverflow.com/comment/34357481
upvote count: 8
has comment: http://stackoverflow.com/comment/34347312
has comment: http://stackoverflow.com/comment/34347517
has body: Short answer No. Longer answer JLS 17.4.5 lists all* of the ways of establishing a happens-before relationship, other than the special case of final field semantics: An unlock on a monitor happens-before every subsequent lock on that monitor. A write to a volatile field (§8.3.1.4) happens-before every subsequent read of that field. A call to start() on a thread happens-before any actions in the started thread. All actions in a thread happen-before any other thread successfully returns from a join() on that thread. The default initialization of any object happens-before any other actions (other than default-writes) of a program. (The original lists them as bullet points; I'm changing them to numbers for convenience here.) Now, you've ruled out locks (#1) and volatile fields (#2). Rules #3 and #4 relate to the life-cycle of the thread, which you don't mention in your question, and doesn't sound like it would apply. Rule #5 doesn't give you any non-null values, so it doesn't apply either. So of the five possible methods for establishing happens-before, other than final field semantics, three don't apply and two you've explicitly ruled out. * The rules listed in 17.4.5 are actually consequences of the synchronization order rules defined in 17.4.4, but those relate pretty directly to the ones mentioned in 17.4.5. I mention that because 17.4.5's list can be interpreted as being illustrative and thus non-exhaustive, but 17.4.4's list is non-illustrative and exhaustive, and you can make the same analysis from that directly, if you don't want to rely on the intermediate analysis that 17.4.5 provides.
has comment: http://stackoverflow.com/comment/34399001
has comment: http://stackoverflow.com/comment/65044272

http://stackoverflow.com/comment/34304999
comment on: http://stackoverflow.com/a/22539452
has text: Well, ok, this returns my good key value. But I would like to get back the object to call it's methods. How can I achieve this?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22630047
tagged with: android
possible better answer: http://stackoverflow.com/a/22630094
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34462735
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/22630148
type: Question
has title: Android long string concatenament,
has body: I have this methods : private String convertPolygonToJSON(Polygon p) { List&lt;LatLng&gt; points=p.getPoints(); String s="[1,["+points.get(0); for (int i = 1; i &lt; points.size(); i++) { s=s+","+points.get(i); } s=s+"],{\"strokeColor\":\"#FF0000\",\"fillColor\":\"#00FFFF\"}]"; return s; } private String getJsonPolygones(List&lt;Polygon&gt; polys) { String s=""; for (int i = 0; i &lt; polys.size(); i++) { s=s+convertPolygonToJSON(polys.get(i))+","; } return s; } that convert polygone to json String, the problem is that the polgon has a lot of point and this function is called into a loop to convert List of polygons to final json. I guess, it takes a lot of memory, I see alot of GC loggin and even after 15 minuts the loop does not end. (I have a List of polygones ( 7xxx points, 4xxx points, 2xx points .....) I'd like to know if there is an alternative to get this JSON. Any help is welcome, thank you in advance.
score: 0
has answer: http://stackoverflow.com/a/22630167
answer count: 3
has comment: http://stackoverflow.com/comment/34462907
tagged with: string
has answer: http://stackoverflow.com/a/22630094
has answer: http://stackoverflow.com/a/22630148

http://stackoverflow.com/q/22540518
tagged with: regex
has comment: http://stackoverflow.com/comment/34304378
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22540634
tagged with: java
tagged with: solr
has answer: http://stackoverflow.com/a/22692838
has comment: http://stackoverflow.com/comment/34303502
accepted answer: http://stackoverflow.com/a/22692838
has body: I have a webapp that could execute a search through an url query on SolR. The results are received as a Document object. my query is look like : q=Book:Harlan AND Book:Coben AND .., it works fine. String[] word = searchedWord.trim().split(" "); for (int i = 0; i &lt; word.length; i++) { if (!StringUtils.isEmpty(word[i])) { if (i &gt; 0) { query.append("%20AND%20"); } String utf_encoded = URLEncoder.encode(StringEscapeUtils.escapeJava(word[i]), "UTF-8"); } } But i need to enforce the kind of searched terms, because when the searched term is like an exact term : "Harlan Coben", this code split it in two word "Harlan and Coben" Per example, my webapp should be able to search: Exact terms: "Harlan Coben" Multiple terms: shakespeare harlan coben Multiple mixed terms: shakespeare "harlan coben" coben or shakespear "harlan coben" or "harlan coben" coben The URL to call SolR is encoded in UTF-8 to replace special characters.. How should i proceed ? by regular expressions ? or is there another way ? ------ EDIT -------- To be more specific, All of these characters could be "@(!ùéàç" or chinese/russian or anything else characters (unicode?) from a specific language. I need to match them and separate them to prepare the SolR query. Example: If the search term is : coben "Harlan Coben" s(554603)hakesdpeare Straße Привет My regex should match and give me this result: coben "Harlan Coben" s(554603)hakesdpeare Straße Привет Then i need to concatenate each of them with AND Book: or juste Book: to have a query as below: q=Book:coben AND Book:"Harlan Coben" AND Book:s(554603)hakesdpeare AND Book:Straße AND Book:Привет I tried ("[a-z]+(?:\s+[a-z]+)+"|[a-z]+)(?:\s+|$) from @fge (thanks for that), but it match only with [a-z], i tried this with \\p{all} but didn't work.. Any idea ? ------ END EDIT -------- Thanks for help !
type: Question
tagged with: lucene
score: 0
answer count: 2
has title: Build query with different kind of terms for SolR
has answer: http://stackoverflow.com/a/22540634

http://stackoverflow.com/comment/56578752
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/22508939
has text: That first paragraph opened my eyes and made things a lot clearer. Thanks.

http://stackoverflow.com/comment/67597462
type: Comment
has text: To future people who also found this useful, please don't comment a thank you - just upvote the question and answer. http://meta.stackexchange.com/questions/126180/is-it-acceptable-to-write-a-thank-you-in-a-comment it's not a big deal, but we don't want this answer getting cluttered.
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/22544894

http://stackoverflow.com/comment/34358678
score: 0
comment on: http://stackoverflow.com/a/22571601
type: Comment
has text: Niklas, giving you the benefit of the doubt that I was wrong, I reviewed Omega notation again and I'd like to share what I found. If we say that f(n)=Ω(g(n)) uwe mean that for some constant c>0 and all large enough n, f(n)≥c g(n). In our discussion, f(n) is the complexity of timsort, and g(n) is nlgn. Your statement, "Ω(n log n)" would be implying that timsort always takes more than nlogn which is clearly incorrect from the documentation.
type: AnswerComment

http://stackoverflow.com/comment/34432738
type: QuestionComment
comment on: http://stackoverflow.com/q/22613302
has text: Are they still static? If so, just use ClassB.methodName(). If not, then create an instance of ClassB and use that.
score: 0
type: Comment

http://stackoverflow.com/q/22642287
type: UnansweredQuestion
tagged with: android
tagged with: lockscreen
tagged with: widget
has body: Hi I'm programming a lock screen widget that is different buttons and a text that displays information, the widget works fine when it's add or when you "maximize" or "minimize"(full screen or half screen with pattern to unlock) and when the phone is just turned on, the problem is when the phone is ide for a while then the buttons doesn't do nothing, I read a lot of post about it but I haven't found my problem. I have CyanogenMod 11 [4.4.2] &lt;receiver android:name="com.example.widget" android:label="magicButtons" &gt; &lt;intent-filter&gt; &lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_provider" /&gt; &lt;/receiver&gt; &lt;receiver android:name="com.example.widgetReciber"&gt; &lt;intent-filter&gt; &lt;action android:name="updateW"/&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; Widget.java (it's not exactly this): @Override public void onEnabled(Context context) { super.onEnabled(context); //Upgrade buttons } @Override public void onUpdate(Context context,AppWidgetManager appWidgetManager, int[] appWidgetIds){ super.onUpdate(context,appWidgetManager,appWidgetIds); //Upgrade buttons } @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); }
tagged with: java
type: Question
score: 0
has title: Lockscreen widget doesn't work after a while
answer count: 1
has answer: http://stackoverflow.com/a/23548933

http://stackoverflow.com/comment/34294762
score: 0
type: Comment
has text: So how do I go about creating a toString method for my linkedlist class?
comment on: http://stackoverflow.com/a/22535471
type: AnswerComment

http://stackoverflow.com/comment/34455621
score: 0
has text: Why dont you use Asyntask rather than runnable
type: Comment
comment on: http://stackoverflow.com/q/22625419
type: QuestionComment

http://stackoverflow.com/q/22604503
tagged with: tomcat
has comment: http://stackoverflow.com/comment/34417068
score: 0
answer count: 1
has body: I have distributed system with 8 app servers running tomcat on it. It is a spring application. I want to use a property file which will located on some others server an all tomcat will read it from there only. I am using ReloadableResourceBundleMessageSource to use auto refreshing feature. My bean definition is file:///192.168.1.10//var/rateLimit and I am calling property like this System.out.println(messageSource.getMessage("testProp", null, null)); I could not load file using this ip address. Could you please help me on this.
has answer: http://stackoverflow.com/a/22606125
has comment: http://stackoverflow.com/comment/34416870
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34417249
type: AnsweredQuestion
has title: How to use remote location property file in spring re loadable message resource in java
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22606125

http://stackoverflow.com/a/22558599
downvote count: 0
type: Answer
has body: First of all, for your number column, it is very normal to expect an integer as parameter because this is an integer-typed column. You can't compare or match numerical values with strings. Second, LIKE clauses can only be applied to strings. See here.
has comment: http://stackoverflow.com/comment/34334535
score: 1
answers question: http://stackoverflow.com/q/22558476
upvote count: 1

http://stackoverflow.com/comment/34419369
type: Comment
type: QuestionComment
has text: In generall I would write each column in my SELECT and in MSSQL Servers you get an "" (empty string) from column 1 and `Null` from column 2 if the db entry was written with e.g. `Insert Into 'table' (1) Values ( "")`
comment on: http://stackoverflow.com/q/22605711
score: 0

deserialization
type: Tag
tags question: http://stackoverflow.com/q/22531601
tags question: http://stackoverflow.com/q/22643367
tags question: http://stackoverflow.com/q/22593754
tag name: deserialization
tags question: http://stackoverflow.com/q/22524570
tags question: http://stackoverflow.com/q/22578619

http://stackoverflow.com/a/22540154
upvote count: 1
downvote count: 0
type: Answer
has body: Short answer: No, it's not equivalent. When you use synchronized around that return ao;, the ArrayList is only synchronized during the return instruction. This means that 2 threads cannot get the object at the exact same time, but once they have got it, they can modify it at the same time. If 2 threads execute this code, the add() is not thread safe: ArrayList&lt;?&gt; list = getAo(); // cannot be executed concurrently list.add(something); // CAN be executed concurrently Side note: don't use Vectors, take a look at this post to know why.
answers question: http://stackoverflow.com/q/22540075
score: 1

http://stackoverflow.com/comment/34470634
type: QuestionComment
score: 2
type: Comment
has text: The JVM looks at the if statement like this: if(true OR ) then it ignores the rest because its always true.
comment on: http://stackoverflow.com/q/22634636

http://stackoverflow.com/a/22636656
type: AcceptedAnswer
downvote count: 0
has body: The JSON format does not contain any type information, except for its own primitive types. It is a text-based format, with arrays and objects mapped respectively to whatever concept of ordered list and ordered key-value pair list exists in each programming language. Therefore a LinkedHashMap is a natural representation of a JSON object in Java. As such, it is what most JSON deserializers output by default. To retrieve custom objects in all JSON implementations that I have used you need to either supply a custom deserializer class, or to post-process the output of the standard deserializer. Occasionally it may even be necessary for a custom serializer to assist by inserting some type information in the JSON stream to resolve ambiguous cases.
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34484464
has comment: http://stackoverflow.com/comment/34486758
accepted answer of: http://stackoverflow.com/q/22623549
answers question: http://stackoverflow.com/q/22623549
has comment: http://stackoverflow.com/comment/34484613

http://stackoverflow.com/a/28224367
type: Answer
score: 0
has body: Use WS withAuth: WS.url(apiUrl).withAuth("api", apiKey, WSAuthScheme.BASIC).post(postMessage) apiUrl is the URL you want to POST to apiKey is the key from mailgun postMessage is a Map of String to Seq of String. In Scala that is Map[String, Seq[String]] and looks like the following: val postMessage = Map("from" -&gt; Seq(message.from), "to" -&gt; Seq(message.to), "subject" -&gt; Seq(message.subject), "text" -&gt; Seq(message.text), "html" -&gt; Seq(message.html.toString()))
answers question: http://stackoverflow.com/q/22586663

http://stackoverflow.com/q/22508766
tagged with: arrays
has title: C# Iterating char array very slow
upvote count: 1
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34247093
has body: I am calculating a hash of a text string in Java and C#, requirement being that if the text strings are identical the hash is the same. I settled on Java's .hashValue() as it is quite simple and straight forward(and I am fault tolerant to a potential collision), - or so I thought. My C# implementation turns out to be unbearably slow. Here is the implementation in c# (java is almost identical) : char[] val = string.ToCharArray(); int hash = 0; for (int i = 0; i &lt; string.Count(); i++) { hash = 31 * hash + val[i]; } Now I pass in two text strings, both read from text files on disc (C#, System.IO.File.ReadAllText), the fist is 10kb the second is 100kb java zips right by both of them and generates the result. C# takes about 600ms for the 10kb file and then a whooping 50 seconds for the latter. In essense, the C# version does not scale linearly, and at a certain size it becomes a not-feasible approach. Given the exponential scaling, and that i cant fanthom ADD and MUL begins to take more time, it leads me to believe it has to be some memory management that goes haywire with C# indexing the char array. Is this expected behavior ... or what am I missing? :-) Best regards.
has answer: http://stackoverflow.com/a/22508925
accepted answer: http://stackoverflow.com/a/22508925
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34246325
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/34246763

http://stackoverflow.com/comment/34485874
score: 0
type: Comment
type: QuestionComment
has text: try to use getCurrentSession instead openSession()
comment on: http://stackoverflow.com/q/22641639

http://stackoverflow.com/a/22599422
has comment: http://stackoverflow.com/comment/34408343
has comment: http://stackoverflow.com/comment/34408495
has comment: http://stackoverflow.com/comment/34408340
downvote count: 0
has body: You have a comma in your println statement. It should be: System.out.println("lathos timi");
score: 5
has comment: http://stackoverflow.com/comment/34408537
type: Answer
answers question: http://stackoverflow.com/q/22599410
upvote count: 5

http://stackoverflow.com/q/22505920
tagged with: observable
score: 0
has comment: http://stackoverflow.com/comment/34242028
has comment: http://stackoverflow.com/comment/34241441
has body: For school I am trying to create a 2d based grid game where you can play agains a AI or another player. But we are having a issue with the AI. If you click on a empty tile in our grid a method will trigger called onEmptyTileClicked with a X and Y coordinate of the tile. We use this method to place stones on the field (each player has its own stone so lets say you are blue and the AI is yellow). You can see a basic example here: public void onEmptyTileClicked(int x, int y) { GameBoard board = getGameBoard(); int counter = 0; //check if the blue player needs to set or the yellow if (player1) { //sets the amount of diamonds that will be taken over in the var counter, if this is bigger than 0 we can place it counter = board.countTakeovers(x,y, true); if (counter &gt; 0) { //add the diamond to the board board.addGameObject(new Blue(), x, y); //add a message in logcat and in the statistic log Log.d("CoolGameBoard", "Adding blue diamond"); activity.updateStatisticLog(activity.getString(R.string.blue_placed)+" "+(x+1)+", "+(y+1)+ " + " + counter + " " + activity.getString(R.string.conquered)); //change all the diamonds that are taken over with this set board.takeover(x,y,true); //turn is over give the other player a turn and update the gameboard setDone(); } else { //player clicked a wrong point, give them a error message Log.d("CoolGameBoard", "Can't place the blue diamond at this location."); activity.updateStatisticLog(activity.getString(R.string.cant_blue) + " "+(x+1)+", "+(y+1)); } } else { counter = board.countTakeovers(x,y,false); if (counter &gt; 0) { board.addGameObject(new Yellow(), x, y); Log.d("CoolGameBoard", "Adding yellow diamond"); activity.updateStatisticLog(activity.getString(R.string.yellow_placed)+" "+(x+1)+", "+(y+1)+ " + " + counter + " " + activity.getString(R.string.conquered)); board.takeover(x,y,false); setDone(); } else { Log.d("CoolGameBoard", "Can't place the yellow diamond at this location."); activity.updateStatisticLog(activity.getString(R.st…
type: UnansweredQuestion
tagged with: android
tagged with: view
has title: Updating a view in android
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34241764
type: Question

http://stackoverflow.com/comment/78523024
type: AnswerComment
type: Comment
has text: I have problem like @thelawnmowerman and seems filter does not work
comment on: http://stackoverflow.com/a/38244028
score: 0

http://stackoverflow.com/comment/34353379
type: AnswerComment
comment on: http://stackoverflow.com/a/22568844
type: Comment
has text: @njzk2 why not? I find it to be a good practice, nonetheless. Calling the `super.onCreate()` first and the `super.onDestroy()` last.
score: 0

http://stackoverflow.com/comment/34282108
score: 0
comment on: http://stackoverflow.com/a/22528452
type: Comment
has text: Oh no! it's not compiling! :-(
type: AnswerComment

http://stackoverflow.com/comment/34455273
comment on: http://stackoverflow.com/q/22625417
score: 0
type: Comment
type: QuestionComment
has text: basically i need this in my android code.

http://stackoverflow.com/a/22519711
answers question: http://stackoverflow.com/q/22518471
type: Answer
has body: I'm going to leave the actual component encoding as a user-supplied function because it is an existing well-discussed problem without a trivial JCL solution .. In any case, the following is how I would approach this particular problem without the use of third-party libraries. While regular expressions sometimes result in two problems, I am hesitant to suggest a more strict approach such as URI because I don't know how it will - or even if it will - work with such funky invalid URLs. As such, here is a solution using a regular expression with a dynamic replacement value. // The following pattern is pretty liberal on what it matches; // It ought to work as long as there is no unencoded ?, =, or &amp; in the URL // but, being liberal, it will also match absolute garbage input. Pattern p = Pattern.compile("\\b(\\w[^=?]*)=([^&amp;]*)"); Matcher m = p.matcher("http://www.hello.com/bar/foo?a=,b &amp;c =d"); StringBuffer sb = new StringBuffer(); while (m.find()) { String key = m.group(1); String value = m.group(2); m.appendReplacement(sb, encodeURIComponent(key) + "=" encodeURIComponent(value)); } m.appendTail(sb); See the ideone example example with a fill-in encodeURIComponent.
score: 0

http://stackoverflow.com/comment/34394450
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22591768
has text: You need to look at MainActivity.java class line 27.
score: 0

http://stackoverflow.com/comment/34408777
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22599659
type: Comment
has text: This is true. I made that fix, and the nav drawer still goes under the rest of the content.

http://stackoverflow.com/comment/34444832
type: QuestionComment
has text: Agreed with pasty. The center portion will expand to fill all available space. Maybe show a picture of what you were expecting vs. what you got.
score: 0
comment on: http://stackoverflow.com/q/22619560
type: Comment

http://stackoverflow.com/q/22505192
has comment: http://stackoverflow.com/comment/34239969
score: 0
has body: My code is the following: startServer(); Integer port = 4545; String browserString= "*firefox"; selenium = new DefaultSelenium("localhost",port,browserString, url) { public void open(String url) { commandProcessor.doCommand("open", new String[] {url,"true"});}; }; logger.info("Start Selenium "); selenium.start(); // &lt;------ SeleniumException here logger.info("Selenium started"); The stacktrace that I get is: java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Error while launching browser at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:109) at com.example.test.infrastruttura.util.SeleniumHolder.initAll(SeleniumHolder.java:55) at com.example.test.infrastruttura.util.SeleniumHolder.&lt;init&gt;(SeleniumHolder.java:23) at com.example.test.infrastruttura.util.SeleniumHolder.createInstance(SeleniumHolder.java:43) at com.example.test.infrastruttura.util.SeleniumHolder.getInstance(SeleniumHolder.java:28) at com.example.test.infrastruttura.util.SgateSeleneseTestCase.setUp(SgateSeleneseTestCase.java:38) at com.example.sgate.test.selenium.GenericLogin.executeNavigation(GenericLogin.java:18) at com.example.test.infrastruttura.checks.CheckObject.executeSelenium(CheckObject.java:424) at com.example.test.infrastruttura.MainTestCase.executeNode(MainTestCase.java:312) at com.example.test.infrastruttura.MainTestCase.execute(MainTestCase.java:244) at com.example.test.infrastruttura.MainTestCase.execute(MainTestCase.java:157) at com.example.sgate.test.functional.verificaEsitiAnagrafici.VerificaEsitiAnagrafici019AltroUtenteStessoComune.testComune(VerificaEsitiAnagrafici019AltroUtenteStessoComune.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at junit.framework.TestCase.r…
has title: Exception on starting Selenium with Firefox web driver
has answer: http://stackoverflow.com/a/22513542
type: UnansweredQuestion
tagged with: selenium
has answer: http://stackoverflow.com/a/22506079
has comment: http://stackoverflow.com/comment/34240134
tagged with: java
type: Question
answer count: 2
tagged with: firefox

http://stackoverflow.com/q/22599362
favorite count: 0
has comment: http://stackoverflow.com/comment/34488294
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: annotations
type: Question
has body: I am implementing annotation driver aspects at class level and method level using AspectJ to be used in Spring applications using Spring proxy based AOP. When AnnotationTimeoutAspect is exposed to Spring Application and using For Grails applications, set in Config.groovy grails.spring.bean.packages = ['com.xyz.aspect'] or For spring applications &lt;context:component-scan base-package="com.xyz.aspect"/&gt; &lt;aop:aspectj-autoproxy/&gt; Following error is thrown. Required parameter names not available when parsing point cut When the aspect and pointcuts are implemented in single class (no Abstract and Concrete classes) it works as expected. Abstract and Concrete class separation also works fine when testing locally with JUnit test classes and Load-Time-Weaving. The same doesn't work when using with Spring Proxy based AOP scenario. My goal is to keep the implementation in Abstract aspect and pointcuts in Concrete aspect so that I can implement multiple Concrete aspects based in my pointcuts needs. Please let me know if you have any workaround. Concrete Aspect @Component @Order(116) @Aspect public class AnnotationTimeoutAspect extends AbstractTimeoutAspect { @Pointcut("execution(@com.xyz.annotation.Timeout * *(..)) &amp;&amp; @annotation(timeoutConfig)") public void executionOfTimeoutMethod(Timeout timeoutConfig) {} @Pointcut("execution(public * ((@com.xyz.annotation.Timeout *)+).*(..)) " + "&amp;&amp; within(@com.xyz.annotation.Timeout *) &amp;&amp; @target(timeoutConfig) " + "&amp;&amp; !com.xyz.aspect.SystemArchitecture.groovyMOPMethods()") public void executionOfAnyPublicMethodInAtTimeoutType(Timeout timeoutConfig) {} @Pointcut("(executionOfTimeoutMethod(timeoutConfig) || executionOfAnyPublicMethodInAtTimeoutType(timeoutConfig))") public void timeoutMethodExecution(Timeout timeoutConfig) { } @DeclareError("execution(@com.xyz.annotation.Timeout * *(..) throws !java.util.concurrent.TimeoutException)") static final String anError = "Only methods that are declared wit…
has title: Aspects implemented as abstract and concrete classes using @AspectJ syntax not working with Spring AOP
has answer: http://stackoverflow.com/a/24424828
tagged with: spring-aop
tagged with: aspectj
has comment: http://stackoverflow.com/comment/34409272
tagged with: abstract
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/34252619
type: AnswerComment
comment on: http://stackoverflow.com/a/22511930
type: Comment
has text: @D.R. - Java generics are ugly from the git-go. Mostly just C++ feature lust.
score: 1

http://stackoverflow.com/comment/34293350
score: 0
type: Comment
has text: I assume by off heap, you mean in the heap of another JVM, such as a node in your cluster? I'm a big fan of doing the processing in the cluster on data that's already there, which undoubtedly gives you a great performance boost. With the young gen, collection is virtually free with a copying collector because the particular part of the heap can be wiped once the live objects have been copied. I suppose at the end of the day, you need to measure what an application is doing and adjust accordingly
comment on: http://stackoverflow.com/a/22533632
type: AnswerComment

http://stackoverflow.com/a/22560422
answers question: http://stackoverflow.com/q/22536931
type: Answer
has body: this is a bug on the CloudConnect side that will be fixed this Saturday 22nd March 2014. Just update the CloudConnect after this weekend and it should work. Anyway, if you try to Deploy this Data Loading process to the server, everything should be OK. The problem occurs just for the local run of CloudConnect. JT
score: 0

http://stackoverflow.com/comment/34365096
comment on: http://stackoverflow.com/q/22575544
has text: Have you tried "something" ?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22550165
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34320640
tagged with: java
has answer: http://stackoverflow.com/a/22550347
has comment: http://stackoverflow.com/comment/34320635
type: Question
answer count: 2
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/22550347
has comment: http://stackoverflow.com/comment/34320699
downvote count: 0
tagged with: slowdown
has answer: http://stackoverflow.com/a/22550185
has body: I'm creating a video game and I've got a for loop that recovers your health public void recoverHealth() { if (curHealth &lt; finalHealth) { for (double i = 0; i &lt; finalHealth; i = i + 0.1) { curHealth = curHealth + 0.1; System.out.println("health: " + curHealth); } } } But the problem is that java goes through this so fast it goes from 0-20 before the game even starts. How can I possibly slow down the recoverHealth() method without slowing down the entire game such as Thread.sleep doesn't work.. try { Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } Any ideas?
favorite count: 0
has comment: http://stackoverflow.com/comment/34320805
accepted answer: http://stackoverflow.com/a/22550185
has title: Java slow down for loop without slowing down rest of program
type: AnsweredQuestion

http://stackoverflow.com/comment/34378632
has text: You would need A[0]= 4, A[1] = 1, A[2] = 3, A[3]=2 to make it a permutation. If you think of a permutation as a way of arranging the numbers 1,2,3,4 so each number must appear exactly once.
comment on: http://stackoverflow.com/a/22579350
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/22571478
score: 1
tagged with: java
upvote count: 1
has body: The title explains the problem I think, trying to create a random Id for an Object, I'm getting the following exception: java.lang.StackOverflowError at sun.security.provider.ByteArrayAccess.b2iBig64(ByteArrayAccess.java:274) at sun.security.provider.SHA.implCompress(SHA.java:122) at sun.security.provider.SHA.implDigest(SHA.java:103) at sun.security.provider.DigestBase.engineDigest(DigestBase.java:186) at sun.security.provider.DigestBase.engineDigest(DigestBase.java:165) at java.security.MessageDigest$Delegate.engineDigest(MessageDigest.java:576) at java.security.MessageDigest.digest(MessageDigest.java:353) at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:226) at java.security.SecureRandom.nextBytes(SecureRandom.java:455) at java.util.UUID.randomUUID(UUID.java:145) I don't think that anyone can tell me what is going on since I provide little information -> I know that. The thing is: I have not any other information, I just create a randomUUID and it crashes. So I'm just asking for ideas, since I don't find any googling this exception. Thanks in advance. EDIT: Answer provided by m0skit0 and scotth Without noticing that the method which lead to an object creating a UUID was called nonstop I - well - did not notice that a huge amount of UUIDs was generated, which lead to the stackoverflow. Thank you!
type: Question
has comment: http://stackoverflow.com/comment/34358227
has comment: http://stackoverflow.com/comment/34358180
has comment: http://stackoverflow.com/comment/34358331
has comment: http://stackoverflow.com/comment/34358285
tagged with: random
has comment: http://stackoverflow.com/comment/34358125
downvote count: 0
tagged with: stack-overflow
favorite count: 0
has title: UUID.randomUUID -> java.lang.StackOverflowError?
has comment: http://stackoverflow.com/comment/34360400
has comment: http://stackoverflow.com/comment/34358172
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34358433
has comment: http://stackoverflow.com/comment/34358300
has comment: http://stackoverflow.com/comment/34358216
answer count: 0
tagged with: uuid

http://stackoverflow.com/a/22521026
answers question: http://stackoverflow.com/q/22518385
has body: I haven't done this myself, so take the following as a suggestion more than an answer. (I'm more into music synthesis and audio effects for real time playback such as game sound.) As you probably have already read in the tutorial, Java provides a class called AudioSystem which provides access to lines and ports that are available on a given computer. If the computer with which you wish to operate with has two mike lines, then there is every reason to believe that those two lines will both be made visible to Java. The input limitation depends more on the hardware (sound card being used and number of mike lines it offers) and drivers and OS than it does on Java. You may have to purchase a special sound card that allows simultaneous multiple inputs. Also, I know there can exist limits at the OS level (some flavors of Linux in particular) that only allow one output line to operate at a time. This would limit what Java can see. But I haven't really explored this with my Windows OS yet. For reading data from a line, a TargetDataLine class is normally used. Data is usually read from this line in buffer blocks (e.g., 1024 bytes at a time) via a while loop. I have had multiple TargetDataLines operating simultaneously in the past: where the data source were various Java software synth sources. Assuming each TDL is assigned to a different input line, each can be read from within this loop, and the respective data then passed on to the different analyzers. TargetDataLines are blocking lines--if a line doesn't have data ready (usually processing goes much faster than audio data can be presented)--then the program blocks until the data is present. Java is capable of much real-time DSP. I don't know the specific form of analysis you wish to do, but there are probably libraries available by independent sources.
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34279528
accepted answer of: http://stackoverflow.com/q/22518385
has comment: http://stackoverflow.com/comment/34272008

http://stackoverflow.com/a/22776185
type: Answer
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/52805402
accepted answer of: http://stackoverflow.com/q/22625575
has body: I consulted the Apache Commons Collections mailing list, where it was explained to me that the interface for MultiValueMap is known to be lacking, but will be revamped in version 4.1 (see here for the JIRA issue and associated discussion). So in the future we may have a better solution, but in the meantime, as Rohit Jain mentioned in his answer, we're just going to have to suppress some warnings. However, since the key aspect of type safety is for the MultiValueMap (not the custom collection type), the simplest way to achieve this is: @SuppressWarnings({ "rawtypes", "unchecked" }) MultiValueMap&lt;String, String&gt; orderedMap = MapUtils.multiValueMap(new LinkedHashMap(), LinkedHashSet.class); Note the use of the MapUtils factory method, rather than the more direct MultiValueMap which I had used in my original question.
answers question: http://stackoverflow.com/q/22625575
score: 5

http://stackoverflow.com/comment/34220092
score: 1
type: AnswerComment
type: Comment
has text: @ylun Both methods have different performance overheads. The first has to unbox the `Boolean` to a `boolean`, while the second has to box the `false` to a `Boolean`, then cast it from `Object` back to `Boolean` in the `.equals()` method. My guess would be that the `.equals()` method is slower, but I'd have to make an actual benchmark and test it. You can do so yourself by performing each operation a few million times and measuring the time elapsed.
comment on: http://stackoverflow.com/a/22492711

http://stackoverflow.com/comment/34233163
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22499914
has text: @Salah there is no safety difference either way. 1.5 was introduced a long time ago. Yes if he was going to List<Integer> then you wouldn't want to box both ways. If he was going to int[] though then it wouldn't. More importantly if `a` was being used in calculations then you would potentially end up with a lot of autoboxing if you kept it as an `Integer`. It all depends what the questioner is going to be doing with the value.

http://stackoverflow.com/q/22531529
answer count: 1
type: UnansweredQuestion
tagged with: jdbc
tagged with: java
tagged with: mysql
type: Question
has title: How to export MySQL workbench database for Java application runs in other computers?
score: 0
has body: I developed a Java application connecting to MySQL database through a localhost connection. Class.forName("com.mysql.jdbc.Driver"); Connection conexao = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/bd_sensores", "root", "rootadmin"); I want to run the application on other computers. To do that I need to export the database, and the information already recorded. I think I need to create an installer and install it on other computers, but I need to change local and type of database.
has answer: http://stackoverflow.com/a/22532130

http://stackoverflow.com/comment/34326400
score: 0
type: AnswerComment
has text: I thought he is able to let the code do the marshalling of the object with something like public class YourObjectList extends ArrayList<YourObject> { } And directly get the YourObjectList from the requestbody instead of getting the jsonobject
type: Comment
comment on: http://stackoverflow.com/a/22553804

http://stackoverflow.com/comment/34493114
score: 0
type: AnswerComment
type: Comment
has text: If you find the label + `break` unpalatable, an alternative is to do `while (!winner)` and add `&& !winner` to the inner for loop conditions.
comment on: http://stackoverflow.com/a/22646672

http://stackoverflow.com/q/22535786
score: 0
answer count: 1
has title: creating a tcp server and client
has answer: http://stackoverflow.com/a/22535975
tagged with: java
type: UnansweredQuestion
tagged with: client-server
tagged with: tcpserver
has body: ive been trying to make a simple tcp server and and client. i'd like it to be a simple instant messenger. but i dont know which modules i will need to import in java to get them to run.
type: Question

http://stackoverflow.com/comment/34361309
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22573187
has text: is it really:):) i spend my 7-8 hours to find error and haven't checked xml file name:) Thank you very much. now it is working.
score: 0

http://stackoverflow.com/q/22597276
type: Question
answer count: 2
downvote count: 0
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/22597850
favorite count: 0
accepted answer: http://stackoverflow.com/a/22597850
score: 2
upvote count: 2
has body: I am trying to get the executed project name out of an ILaunchConfiguration object, but I am struggling to find an easy way. Thanks
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22597419
has title: get project name out of ILaunchConfiguration object
tagged with: java
possible better answer: http://stackoverflow.com/a/22597419

http://stackoverflow.com/a/22531239
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22521121
type: Answer
accepted answer of: http://stackoverflow.com/q/22521121
has body: Your analysis is correct, you cannot have such a guarantee. Your program is executed by the Java virtual machine. Whatever property you want to require of the JVM, you have to ask it “does this property hold?”. So you'd be asking the JVM “do you protect my application against the people who are running you?”, and the people who are running that JVM can configure it to lie — just say “yes” even though the answer is no. At most you would require a minor patch to the JVM, and probably not even that as whoever wants to see your application run can just fire up a debugger. The Security Manager controls separation between applications. It protects your application from other Java applications. It doesn't protect you against the JVM itself: by running an application on it, you are trusting it. I am sometimes shocked by the blasphemies of those who think themselves pious-for instance, the nuns who never take a bath without wearing a bathrobe all the time. When asked why, since no man can see them, they reply: 'Oh, but you forget the good God.' Apparently they conceive of the Deity as a Peeping Tom, whose omnipotence enables Him to see through bathroom walls, but who is foiled by bathrobes. This view strikes me as curious. (Bertrand Russell)
upvote count: 3
score: 3

http://stackoverflow.com/comment/34439840
comment on: http://stackoverflow.com/q/22518240
score: 0
type: Comment
type: QuestionComment
has text: I added a few more attributes to our manifests. I added 'Application-Library-Allowable-Codebase: *', 'Caller-Allowable-Codebase: *', 'Codebase: *'. Looking at the jws log (using -verbose) this removes all security warnings about missing attributes, but unfortunately we still get this security warning. I also tried with 7u60 b11to see if Oracle fixed this but we still get this error. I'm giving up for now.

http://stackoverflow.com/a/22634779
type: Answer
score: 1
has body: In your example everything after if( true || will be ignored, because in Java a boolean expression will terminate as soon as the result is known. And because true || anything is always true, the rest of the expression is not evaluated.
downvote count: 1
has comment: http://stackoverflow.com/comment/34470765
answers question: http://stackoverflow.com/q/22634636
has comment: http://stackoverflow.com/comment/34470847
upvote count: 2

http://stackoverflow.com/comment/34379957
comment on: http://stackoverflow.com/q/22583479
score: 0
type: Comment
type: QuestionComment
has text: Error is : "Type missmatch: cannot convert from double to integer"

http://stackoverflow.com/q/22643563
has answer: http://stackoverflow.com/a/22643641
has comment: http://stackoverflow.com/comment/34487595
has comment: http://stackoverflow.com/comment/34487024
tagged with: android
has comment: http://stackoverflow.com/comment/34486977
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22643700
has title: Android app not working, crashing
has body: As soon as this java file is opened, application crashes. Please help me , I was just cleaning the app, I made new class baconAndEggs to which I shifted various instances and I implemented actionlistener and made separate switch cases for both buttons,before that everything was working fine. package com.example.testing; import java.util.Random; import android.annotation.TargetApi; import android.app.Activity; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.text.InputType; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.ToggleButton; public class TextPlay extends Activity implements View.OnClickListener{ Button chkCmd; ToggleButton passTog; EditText input; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.text); baconAndEggs(); passTog.setOnClickListener(this); chkCmd.setOnClickListener(this); } private void baconAndEggs() { // TODO Auto-generated method stub chkCmd = (Button) findViewById (R.id.bResults); ToggleButton passTog = (ToggleButton) findViewById (R.id.tbPassword); EditText input =(EditText) findViewById (R.id.etCommands); TextView display = (TextView) findViewById (R.id.tvResults); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onClick(View view) { // TODO Auto-generated method stub switch(view.getId()){ case R.id.bResults: String check = input.getText().toString(); display.setText(check); if (check.contentEquals("left")){ display.setGravity(Gravity.LEFT); } else if(check.contentEquals("right")){ display.setGravity(Gravity.RIGHT); } else if(check.contentEquals("center")){ display.setGravity(Gravity.CENTER); } else if(check.contentEquals("blue")){ display.setTextColor(Color.BLUE); } else if(check.contains("WTF")){ Random crazy = new Random (); di…
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22643641
accepted answer: http://stackoverflow.com/a/22643700

http://stackoverflow.com/a/22528646
has body: Only two errors are their: 1).You are not inflating any view here: @Override public View getView(int position, View convertView, ViewGroup parent) { View view = super.getView(position, convertView, parent); LayoutInflater inflater = ((Activity) mContext).getLayoutInflater(); View view = inflater.inflate(R.layout.custom_inflator_layout,parent,false); TextView azhwaarView = (TextView) view.getTag(R.id.textViewAzhwaar); String azhVal = azhwaarView.getText().toString(); return view; } 2).You are not seting any text to textview ,thats y when you trying to get the text it gives null pointer.
score: 0
answers question: http://stackoverflow.com/q/22528380
type: Answer

http://stackoverflow.com/comment/34942960
type: Comment
score: 0
type: AnswerComment
has text: I was deliberately instantiating the class for my current use case. I have this working with jetty 7, but can't get it to run in jetty 8 and above.
comment on: http://stackoverflow.com/a/22628444

http://stackoverflow.com/q/22620003
type: UnansweredQuestion
has body: I am having troubles with my "for" loop in my program. The main error I am getting is "type mismatch: cannot convert from int to Boolean." All I want to do is to have the corresponding "time" element printed out. I know that conditions need to be of type bool for "classNames[0].length", but I can't figure out how to do that. Thanks! import javax.swing.JOptionPane; import java.util.Scanner; public class arraytest { public static void main(String[] args) { int i = 0; String classInput; String[][] classNames = { {"CIS 280", "ACC 212", "HIS 300"}, {"Tue 7:30", "Thu 2:30", "Fri 1:00" } }; classInput = JOptionPane.showInputDialog("Please input a class name: "); for (i = 0; classNames[0].length; ++i) // problem line if(classNames[0][i].equals(classInput)) { System.out.println("class time:" + classNames[1][i]); } } }
has comment: http://stackoverflow.com/comment/34445451
has answer: http://stackoverflow.com/a/22620044
has answer: http://stackoverflow.com/a/22620069
downvote count: 2
has comment: http://stackoverflow.com/comment/34445465
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/34447891
answer count: 3
has title: Two Dimensional Array
upvote count: 0
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/22620041
tagged with: multidimensional-array

http://stackoverflow.com/comment/34361923
type: Comment
comment on: http://stackoverflow.com/q/22569420
score: 0
type: QuestionComment
has text: @ fge thanks for your comments. I using priority in @Test to overcome this condition but I want to know can I use only TestNG.xml settings to overcome this condition or I need also configure @ Test(Priority="some Integer value") because in TestNG.xml file have already preserve-order="true" attribute.

http://stackoverflow.com/comment/34248760
type: AnswerComment
has text: I am expecting subsequences not substrings.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22503088

http://stackoverflow.com/comment/54484619
has text: @MarkoTopolnik, yes, for `BufferedReader.lines` the problem is still there as well as for other things which have `Spliterators.spliteratorUnknownSize(..)` under the hood. I [proposed](http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-July/034528.html) some improvement which would make the result better in general (though not reaching top possible speed), but it was rejected by Paul Sandoz.
type: AnswerComment
score: 2
type: Comment
comment on: http://stackoverflow.com/a/33344378

jgroups
tags question: http://stackoverflow.com/q/22621775
tag name: jgroups
type: Tag

http://stackoverflow.com/q/22562518
has body: I have a Hibernate entity class representing a "device" table, which is linked to N deviceNetworks: @Entity @Configurable @Table(name = "device") public class Device implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column(name = "device_name", nullable = false) private String deviceName; @OneToMany( cascade = {CascadeType.ALL}, fetch = FetchType.LAZY, mappedBy = "device_network", targetEntity = DeviceNetwork.class, orphanRemoval = true) private final Set&lt;DeviceNetwork&gt; deviceNetworks = Sets.newHashSet(); ...... public Set&lt;DeviceNetwork&gt; getDeviceNetworks() { return deviceNetworks; } public void addDeviceNetwork(final DeviceNetwork deviceNetwork) { deviceNetworks.add(deviceNetwork); } public void removeDeviceNetwork(final DeviceNetwork deviceNetwork) { deviceNetworks.remove(deviceNetwork); } } and the class representing "deviceNetwork": @Entity @Configurable @Table(name = "device_network") public class DeviceNetwork implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @ManyToOne(targetEntity = Device.class) @JoinColumn(name="device_id", nullable=false) private Device device; @Column(name = "network_name", unique = true, nullable = false) private String networkName; ...... } I have a transaction that inserted a new device and a new linked deviceNetwork into DB, then I started with a new tranaction: retrieve the newly inserted device by its id; add a new network; update the device; I use EntityManager to accomplish this: @Transactional public void addNetworkToDevice(long deviceId, DeviceNetwork deviceNetwork) { Device device = entityManager.get(deviceId); device.addDeviceNetwork(deviceNetwork); entityManager.merge(device); } This causes the following exceptions: org.springframework.orm.jpa.JpaObjectRetrievalFailureException: Unable to find com.xxx.domain.DeviceNetwork with …
type: UnansweredQuestion
has title: hibernate merge throws EntityNotFoundException
has comment: http://stackoverflow.com/comment/34349350
has answer: http://stackoverflow.com/a/22567981
type: Question
tagged with: java
tagged with: hibernate
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34344877
has comment: http://stackoverflow.com/comment/34345762
has comment: http://stackoverflow.com/comment/34349573

http://stackoverflow.com/a/22647701
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22646857
has body: AppWidgetProvider extends BroadcastReceiver, which does not, in turn, inherit from Context. getApplicationContext() is a method on Context. As you determined, the reason why you are passed a Context into onReceive() of a BroadcastReceiver (and onUpdate() and other callbacks on AppWidgetProvider) is so you can do things that need a Context. All that being said, the code you have here has issues: Do not use methods inherited from Context from an initializer, as you have with your Activity snippet. There is no guarantee that such methods are ready for use at that point in time. Delay using Context methods until the initial entry point of the component, such as onCreate() of an Activity. Never do database I/O on the main application thread, as it will freeze your application's UI if one of your activities happens to be in the foreground at the time. All callbacks to your AppWidgetProvider, like onUpdate(), are called on the main application thread. Please use an IntentService or something else that can safely run a background thread. Note that the IntentService is perfectly capable of updating the app widget UI via AppWidgetManager. onUpdate() is a trigger for you to do certain work, but that work can -- and often times should -- be done elsewhere. Be very careful in creating all sorts of SQLiteOpenHelper instances, and I am assuming that SqlHelper is a subclass of SQLiteOpenHelper. Please have exactly one instance of your SQLiteOpenHelper for your entire application, so that you can take advantage of the thread safety built into SQLiteOpenHelper. That usually winds up being a singleton SQLiteOpenHelper. Having multiple instances is likely to get you in thread-related trouble.
answers question: http://stackoverflow.com/q/22646857
score: 5
type: Answer
upvote count: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/34442082
score: 0
type: Comment
type: QuestionComment
has text: Please provide full source of the class. As it is, it's unclear what context the top of your code is in: is it a static block? a method? something else?
comment on: http://stackoverflow.com/q/22618229

http://stackoverflow.com/q/22495309
score: 1
tagged with: java
tagged with: rsa
upvote count: 1
type: Question
tagged with: sign
downvote count: 0
has answer: http://stackoverflow.com/a/23106617
tagged with: openssl
answer count: 1
favorite count: 0
tagged with: bouncycastle
type: UnansweredQuestion
has body: Please, what am I doing bad that the result of the following java and bash does not match? Here is the similar topic. I was able to easily write the java (which is actually discussed there), but nobody was concerned about the results. To me, simply, both results are different. Here is a part of java I use (pem file is without password): Security.addProvider(new BouncyCastleProvider()); PEMParser pemParser = new PEMParser(new BufferedReader(new FileReader(pemPath))); Object object = pemParser.readObject(); JcaPEMKeyConverter converter = new JcaPEMKeyConverter(); KeyPair kp = converter.getKeyPair((PEMKeyPair) object); PrivateKey privateKey = kp.getPrivate(); Signature sig = Signature.getInstance("RSA"); sig.initSign(privateKey); sig.update(stringToSign.getBytes()); byte[] bytes = sig.sign(); return new String(Base64.encode(bytes)); //+ close pemParser Bash code is: printf $(printf "${string_to_sign}" | openssl rsautl -sign -inkey "${pem_path}" | openssl enc -base64 | awk '{printf "%s", $0}' )
has comment: http://stackoverflow.com/comment/34231331
has title: Signing by java and openssl does not match
has comment: http://stackoverflow.com/comment/34230324
has comment: http://stackoverflow.com/comment/34246814
has comment: http://stackoverflow.com/comment/34230999
linked to: http://stackoverflow.com/q/8647165

http://stackoverflow.com/q/22617269
has body: We have an ANT build where, in the main sourceset javac compiles certain classes and produces a JAR. This JAR is used in the Classpath while compiling the test sourceset of the same project. How can I replicate this in GRadle. We dont want to use ant.javac command. We are trying to re-write the entire ant script to Gradle. How to compile the test classes with a dependency on the output JAR of the main class. (in the same build.gradle)
answer count: 0
has comment: http://stackoverflow.com/comment/34473361
has comment: http://stackoverflow.com/comment/34443463
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34443129
has comment: http://stackoverflow.com/comment/34445241
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/34440250
has comment: http://stackoverflow.com/comment/34455760
tagged with: gradle
has comment: http://stackoverflow.com/comment/34498659
type: Question
score: 0
has title: Gradle : Include output JAR of main/java sourceset as a dependency to compile test/java sourceset

http://stackoverflow.com/comment/34407604
type: Comment
type: QuestionComment
score: 0
has text: Did none of these questions help? http://stackoverflow.com/search?q=%5Bjava%5D+sort+array+reverse+order
comment on: http://stackoverflow.com/q/22598989

http://stackoverflow.com/comment/34313216
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22545322
has text: @user3443834 If you are going to be doing these sorts of operations frequently, [LinkedList](http://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html)s are better because they provide methods such as `.removeFirst()` and `.addLast()`.
type: Comment

http://stackoverflow.com/comment/34463467
has text: I don't want to say that it's not possible, but i would guess there are lots of local optima, so finding the global optimum reliably might not be possible. Algorithms like genetic algorithms or simulated annealing help escape local optima though (i don't really have much experience with those algorithms)
type: AnswerComment
comment on: http://stackoverflow.com/a/22561874
score: 0
type: Comment

http://stackoverflow.com/q/22598274
tagged with: jlabel
tagged with: jframe
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34407663
has title: Java - Changing Icon of JLabel does not Work
tagged with: java
tagged with: embedded-resource
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/22598355
linked to: http://stackoverflow.com/q/7896723
score: 0
has comment: http://stackoverflow.com/comment/34407469
answer count: 1
has body: I am trying to change the icon (background) of a JLabel, but I am having an issue with the icon not updating. Whenever I tried lblStatusImg.setIcon(new ImageIcon(Brix_Updater_Module.class.getResource("/resources/fail.png"))); to change the JLabel in the main method, the compiler was first complaining that the variable lblStatusImg did not exist, so I moved it from the JFrame initialization method to a class level variable. After this, Eclipse complained that I was trying to reference a nonstatic method from static context, so I made lblStatusImg static. This made it possible for the program to compile, but the icon did not change whenever it was supposed to. Since it's kind of hard to understand my problem here is a download link for an Eclipse workspace that demonstrates my problem. When you first open it, you will notice that there are some problems with it. They were left there on purpose to make it easier for you to see where I am having a hard time. If Eclipse asks you to make the items in question static, just do it and then run the program. You'll notice that it does not change the label icons as it should. Since not all of you have Eclipse, here's the entire code from the workspace. import java.awt.Component; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import java.awt.Font; import javax.swing.SwingConstants; import java.awt.Window.Type; import java.io.BufferedOutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.Timer; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.ImageIcon; import javax.swing.JButton; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class StackOverflow_Image_Resource_Demo { private JFrame frmUpdate; JLabel lblStatusImg = new JLabel(""); JButton btnUpdateComplete = new JButton("OK"); /** * Launch the application. */ public static void main(S…
accepted answer: http://stackoverflow.com/a/22598355

http://stackoverflow.com/comment/34461751
has text: ORA-00904 is invalid identifier. It's saying it doesn't recognize `NAMEIKE` that I don't see in your query
comment on: http://stackoverflow.com/q/22629438
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34477414
type: QuestionComment
type: Comment
has text: @ajb Or Haskell's `EitherT`.. I think you just haven't looked hard enough
score: 0
comment on: http://stackoverflow.com/q/22622332

http://stackoverflow.com/a/23847596
score: 0
has body: If you want to use per-parameters objects for more than one run, it means that you have to keep the reference to them in static field, as each test method is run on a different object. You can also keep in static field the previous value of one of the parameters, and assuming its unique value among parameter sets, you can use it as a detector of parameters change. This is almost what you wanted, with the small glitch that tearDownParams() is run after the constructor for first test for new parameters. @RunWith(Parameterized.class) public class SomeTest { @Parameters public static Collection&lt;Object[]&gt; data() { return Arrays.asList(new Object[][] { { 1, 4, 3 }, { 2, 5, 6 }, { 3, 8, 12 } }); } static int lastP1Value = -1; private int p1; public SomeTest(int p1, int p2, int p3) { System.out.println("constructor"); this.p1 = p1; } @Test public void test1() { System.out.println(" test1"); } @Test public void test2() { System.out.println(" test2"); } @Before public void setUp() { if (lastP1Value != p1) { if (lastP1Value != -1) { // this is a bit too late (after constructor for new params...) tearDownParams(); } setUpParams(); } lastP1Value = p1; } public static void setUpParams() { System.out.println(" setUpParams"); } @AfterClass public static void tearDownParams() { System.out.println(" tearDownParams"); } }
type: Answer
answers question: http://stackoverflow.com/q/22503395

http://stackoverflow.com/comment/34233329
type: Comment
type: AnswerComment
has text: For this use case the ETag is invented, Spring also support this.
score: 0
comment on: http://stackoverflow.com/a/22500185

http://stackoverflow.com/q/22546684
has answer: http://stackoverflow.com/a/22547520
has comment: http://stackoverflow.com/comment/34314558
has comment: http://stackoverflow.com/comment/34315918
has comment: http://stackoverflow.com/comment/34314572
has comment: http://stackoverflow.com/comment/34314483
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34315307
has comment: http://stackoverflow.com/comment/34315052
has answer: http://stackoverflow.com/a/22546864
has comment: http://stackoverflow.com/comment/34314748
answer count: 2
has comment: http://stackoverflow.com/comment/34314754
has comment: http://stackoverflow.com/comment/34314765
has body: I'm trying to build an application where a client sends its screen to the server, the client only sends its screen if there is a difference between last send screen and the latest captured screen(so that the program is easy on the network). And the server uses a JFrame and JLabel to display the image. But the thing is after a minute or two the server is giving a java.lang.OutOfMemoryError: Java heap space. Please consider my code public void go() throws Exception { s=new Socket("127.0.0.1",5000); remoteIP = s.getInetAddress(); remoteIPOnly = remoteIP.toString().split("\\/"); frame=new JFrame(remoteIPOnly[1]); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); InputStream iss=s.getInputStream(); ObjectInputStream is=new ObjectInputStream(iss); JLabel a=new JLabel(); while(!s.isClosed()) { if((ImageIcon)is.readObject()!=null) { System.out.println("I got here"); imageIcon=(ImageIcon) is.readObject(); image=imageIcon.getImage(); rendered = null; if (image instanceof RenderedImage) { rendered = (RenderedImage)image; } else { buffered = new BufferedImage( imageIcon.getIconWidth(), imageIcon.getIconHeight(), BufferedImage.TYPE_INT_RGB ); g = buffered.createGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); rendered = buffered; } frame.setSize(rendered.getWidth(),rendered.getHeight()); a.setIcon(imageIcon); frame.add(a); frame.setVisible(true); } } } And here is my other piece of code, it is also showing the same problem, pls help me optimize it. while(true) { s=serversocket.accept(); os=s.getOutputStream(); oss=new ObjectOutputStream(os); image1=r.createScreenCapture(newRectangle(Toolkit.getDefaultToolkit().getScreenSize())); imageicon=new ImageIcon(image1); oss.writeObject(imageicon); while(!s.isClosed()){ image2=r.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit ().getScreenSize())); b=checkIfImagesAreEqual(image1,image2); System.out.println(b); if(b==false){ image1=image2; imageicon1=new ImageIcon(image2); oss.writeObject(imageicon1); oss.flush(); } …
type: Question
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/34314553
has title: How can I resolve java.lang.OutOfMemoryError: Java heap space in the case when increasing the heap size will mean delayed OutOfMemoryError
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34314946
has comment: http://stackoverflow.com/comment/34315095
has comment: http://stackoverflow.com/comment/34316027

http://stackoverflow.com/a/22511840
answers question: http://stackoverflow.com/q/22511689
score: 0
type: Answer
has body: Read the method definitions: String[] java.lang.String.split(String regex) String[] java.lang.String.split(String regex, int limit) It expects a regex expression, and optionally a integer representing the limit. You are passing the following to the method: split(val, ' ') the second argument is a character, not an integer. If you want to split by a space: val.split(" ") or if you want to split by any whitespace: val.split("\\s")

http://stackoverflow.com/comment/34401238
has text: @NiklasB. the statement listofprimitives[x].primitive1 has TWO dereferences, one for the array containing the objects, and a second dereference of the field inside the object (see example code in question).
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22594894

http://stackoverflow.com/comment/34484981
comment on: http://stackoverflow.com/q/22621154
type: Comment
type: QuestionComment
has text: Try to run it not in the debug mode or check that you have no exception breakpoint enabled. As you can see from openjdk sources InetAddressCachePolicy throws NumberFormatException internally, but catches it silently and proceed execution. For some reason your debugger decided to stop at that point
score: 1

http://stackoverflow.com/q/22571110
has comment: http://stackoverflow.com/comment/34357551
has comment: http://stackoverflow.com/comment/34357539
type: AnsweredQuestion
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/22571246
type: Question
has title: Java - Hide All JButtons
has comment: http://stackoverflow.com/comment/34357604
has comment: http://stackoverflow.com/comment/34357554
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22571246
has comment: http://stackoverflow.com/comment/34357745
has body: I there any way to hide all of the JButtons within a class without having to individually set myButton.setVisible(false); ? I'm looking for something where I can with 1 line of code hide them all without having to constantly update a list of JButtons. If anyone knows of a way to make this possible would be much appreciated.

http://stackoverflow.com/q/22510477
has answer: http://stackoverflow.com/a/22510543
has title: Is this code O(n) or O(logn)?
type: Question
has comment: http://stackoverflow.com/comment/34249434
has comment: http://stackoverflow.com/comment/34249390
has comment: http://stackoverflow.com/comment/34250135
has body: It's only checking the for loop 1/3n times, so it's still technically linear I guess? However I don't really understand why it wouldn't be O(logn), because many times a code with O(logn) running time ends up checking around 1/3n. Does O(logn) always divide the options by 2 every time? int a = 0; for (int i = 0; i &lt; n; i = i+3) a = a+i;
has answer: http://stackoverflow.com/a/22510663
favorite count: 0
tagged with: big-o
has answer: http://stackoverflow.com/a/22510552
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34249908
answer count: 4
has answer: http://stackoverflow.com/a/22510568
upvote count: 2
has comment: http://stackoverflow.com/comment/34249407
score: 0
tagged with: java
downvote count: 2

http://stackoverflow.com/a/22599667
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22598550
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22598550
has body: I am inclined to go with your current solution, which is a separate table for each type. Somehow, I'm most comfortable with storing data in well-defined tables with well-defined types. An EAV (entity-attribute-value) solution is also viable. With 100k rows of data, the EAV solution should perform pretty well, unless you have lots of tables. One downside is the types of the columns. Without a lot of extra work, you are pretty much limited to strings for all the values. Oracle does offer another possibility, which is an XML solution. This can give you the flexibility of dynamic column names along with the "simplicity" of not having to define a separate table for each one. You can read more about it in the documentation here.

http://stackoverflow.com/comment/34305785
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22523607
has text: @user3440443, `Math.abs` is the absolute value function. Instead of direct comparison, we take the absolute value of a difference and check whether it is smaller than some very small number because computers are not precise when computing and comparing decimals (ie floating point numbers).
score: 0

http://stackoverflow.com/a/22571033
type: Answer
has comment: http://stackoverflow.com/comment/34357593
has comment: http://stackoverflow.com/comment/34357365
has comment: http://stackoverflow.com/comment/34357390
downvote count: 0
has comment: http://stackoverflow.com/comment/34357374
has comment: http://stackoverflow.com/comment/34357417
answers question: http://stackoverflow.com/q/22571027
score: 5
accepted answer of: http://stackoverflow.com/q/22571027
type: AcceptedAnswer
has body: To compute the inverse of x mod m, use BigInteger.valueOf(x).modInverse(BigInteger.valueOf(m)).intValue();
has comment: http://stackoverflow.com/comment/34357388
upvote count: 5

http://stackoverflow.com/comment/34414200
type: Comment
has text: How should I know when the only provided info is the stack trace? Post your configurations as well.
type: QuestionComment
comment on: http://stackoverflow.com/q/22602651
score: 0

http://stackoverflow.com/comment/34483493
has text: Essentially, there's no difference between a VM running on your computer and a separate computer across the room connected over a network. The same options are available for both situations, with essentially the same setup required.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22641097

http://stackoverflow.com/comment/34335598
type: AnswerComment
comment on: http://stackoverflow.com/a/22542256
score: 0
type: Comment
has text: Thanks for your reply, but wthat about the performance ? It says "Nested weights are bad for performance"

http://stackoverflow.com/comment/34279367
has text: Not excatly what I wanted, look at the question. I dont know why I did got two downvotes, I didnt even got answer, simpledateformat from njzk did really impress me.
comment on: http://stackoverflow.com/a/22519973
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22575372
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: Some bytes are negative because bytes are signed in Java, just like ints, shorts and longs. The easiest way to undo it is to use &amp; 255 - example code: int fixed_byte = original_byte &amp; 255;. There is no normal ASCII value for ä because ä is not part of ASCII. getBytes does not use ASCII. On your system, getBytes seems to be using UTF-8. getBytes does not use the same encoding on all systems. If you specifically want UTF-8, use getBytes(StandardCharsets.UTF_8). If you look closely, you'll notice that ä is actually encoded as two bytes in UTF-8: -61 and -92. After fixing them to not be negative, these are 195 and 164. Why use bytes at all? A char can hold any character from the Basic Multilingual Plane, including the character ä. (If not for historical mistakes, a char would be able to hold any character. It's too late to fix it now.)
answers question: http://stackoverflow.com/q/22575308

http://stackoverflow.com/comment/34216424
comment on: http://stackoverflow.com/q/22490854
type: QuestionComment
has text: You're not sure why you get a StringIndexOutOfBoundsException?? Could it be because your string index is out of bounds? Could it be that if you look at the exception traceback you will be directed to the exact line where the failure occurred?? Could it be that if you insert System.out.println calls you can figure out what the string index and string length are at the point of failure?? ?? Nah!
type: Comment
score: 3

http://stackoverflow.com/comment/34371564
type: QuestionComment
type: Comment
has text: Your problem is that your Pharagraph class (should that be renamed Paragraph?) JPanel uses a FlowLayout which will not increase the size of the JPanel if its content is larger than its size. You may wish to use other layouts or even create your own custom layout to fix this. Question: must your tokens be JLabels? If you instead simply added your text to a JTextArea, your problem would be solved for you.
comment on: http://stackoverflow.com/q/22579250
score: 0

lucene
tags question: http://stackoverflow.com/q/22630856
tags question: http://stackoverflow.com/q/22595561
tags question: http://stackoverflow.com/q/22637914
tags question: http://stackoverflow.com/q/22539253
tags question: http://stackoverflow.com/q/22615627
tags question: http://stackoverflow.com/q/22585587
tags question: http://stackoverflow.com/q/22562277
tags question: http://stackoverflow.com/q/22622202
tags question: http://stackoverflow.com/q/22559472
tags question: http://stackoverflow.com/q/22569180
tags question: http://stackoverflow.com/q/22516991
type: Tag
tags question: http://stackoverflow.com/q/22518743
tag name: lucene
tags question: http://stackoverflow.com/q/22540518
tags question: http://stackoverflow.com/q/22564763
tags question: http://stackoverflow.com/q/22613765

http://stackoverflow.com/q/22595234
downvote count: 1
upvote count: 17
has answer: http://stackoverflow.com/a/22595392
has title: Interfaces and generics in Java
has answer: http://stackoverflow.com/a/22595485
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34404337
score: 16
tagged with: generics
has answer: http://stackoverflow.com/a/22713461
has body: I have the code: Set&lt;? extends Notifiable&gt; notifiables; Notifiable is an interface. I don't understand the difference between the above code and: Set&lt;Notifiable&gt; notifiables; If Notifiable was a class then I'd understand the difference, the first code would allow Notifiable and any subclass of Notifiable whereas the second code would only allow Notifiable (and not any subclasses) As you can't have an instance of an interface, what can I add/etc to the set? It seems to me there are only two options, either anything that implements Notifiable (in which case how is that different to the first code), or only "instances of Notifiable" which can't exist and so therefore nothing (which is pointless and should throw a compile time error).
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34400836
tagged with: interface
has comment: http://stackoverflow.com/comment/34403613
tagged with: java
answer count: 3

http://stackoverflow.com/comment/34316586
has text: In your last sentence, you say your "list contains only 1 int". Do you mean "only 1 *long*"? If so, please be more careful with your language. Small errors in your question lead to much confusion and unnecessary commenting/wondering. Be precise.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22547476
type: QuestionComment

object
tags question: http://stackoverflow.com/q/22590357
tag name: object
tags question: http://stackoverflow.com/q/22575673
tags question: http://stackoverflow.com/q/22494183
tags question: http://stackoverflow.com/q/22488982
tags question: http://stackoverflow.com/q/22585950
tags question: http://stackoverflow.com/q/22623170
tags question: http://stackoverflow.com/q/22595306
tags question: http://stackoverflow.com/q/22518907
tags question: http://stackoverflow.com/q/22520825
tags question: http://stackoverflow.com/q/22581716
tags question: http://stackoverflow.com/q/22579024
tags question: http://stackoverflow.com/q/22521080
tags question: http://stackoverflow.com/q/22508420
tags question: http://stackoverflow.com/q/22549024
tags question: http://stackoverflow.com/q/22616579
tags question: http://stackoverflow.com/q/22587549
tags question: http://stackoverflow.com/q/22586898
tags question: http://stackoverflow.com/q/22494043
tags question: http://stackoverflow.com/q/22598602
tags question: http://stackoverflow.com/q/22646892
tags question: http://stackoverflow.com/q/22625305
tags question: http://stackoverflow.com/q/22621994
tags question: http://stackoverflow.com/q/22597645
tags question: http://stackoverflow.com/q/22575370
type: Tag
tags question: http://stackoverflow.com/q/22595318
tags question: http://stackoverflow.com/q/22606791
tags question: http://stackoverflow.com/q/22509052
tags question: http://stackoverflow.com/q/22583308
tags question: http://stackoverflow.com/q/22553549
tags question: http://stackoverflow.com/q/22624818
tags question: http://stackoverflow.com/q/22644944

http://stackoverflow.com/comment/34526631
score: 0
type: Comment
type: QuestionComment
has text: The progress bar doesn't update by itself. You have to call `setValue` on it. I don't see you doing that except setting to 0. Also, your code is not thread-safe. In particular it's possible HotSpot is able to compile the `if(changed)` to `if(false)` because `changed` is not volatile. [HotSpot does similar optimizations.](http://stackoverflow.com/a/22241859/2891664)
comment on: http://stackoverflow.com/q/22615360

http://stackoverflow.com/a/22533970
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34291592
has comment: http://stackoverflow.com/comment/34291576
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22533879
accepted answer of: http://stackoverflow.com/q/22533879
has body: From your logcat below like it clearly indicates that your Intent data is null. java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=null} Check for the null value of the Intent data. Try out as below: if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { if (resultCode == RESULT_OK &amp;&amp; null != data) { // Image captured and saved to fileUri specified in the Intent Toast.makeText(this, "Image saved to:\n" + data.getData(), Toast.LENGTH_LONG).show(); }

http://stackoverflow.com/comment/34353120
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22568844
has text: Pay attention to my last edit. Try also moving the `super.onDestroy()` call to the end of the method.

http://stackoverflow.com/comment/34424351
type: QuestionComment
comment on: http://stackoverflow.com/q/22608601
score: 0
type: Comment
has text: You could use *array of tuples* for the same. Then when deleting, you can refer the object by the dog_name

http://stackoverflow.com/comment/34228085
score: 0
type: AnswerComment
type: Comment
has text: No, I mean like the way you've updated in you question...
comment on: http://stackoverflow.com/a/22497656

http://stackoverflow.com/comment/34245136
comment on: http://stackoverflow.com/a/22507824
score: 0
type: AnswerComment
type: Comment
has text: You can parse the JSON content present in a string

http://stackoverflow.com/a/22540318
answers question: http://stackoverflow.com/q/22540025
type: Answer
has body: Part of this has to do with the history of how java has developed over time. Iterators were a language feature as a way to deal with collections of objects since Java 1.2. Java 1.5 added the iterable interface and for-each loops. Unless you need to do something specific with the iterator during your loop I would always use a for-each block ( which uses iterators in the implementation)
score: 0

sql-server
tags question: http://stackoverflow.com/q/22559638
tags question: http://stackoverflow.com/q/22526588
type: Tag
tag name: sql-server
tags question: http://stackoverflow.com/q/22605546

http://stackoverflow.com/comment/34252518
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22511279
has text: Nice. This is almost what I need. Now I will be able to get data sorted by some field. But it doesn't completely answer my question, what if I want to sort it by multiple fields ?

http://stackoverflow.com/comment/34371067
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22572689
has text: @ThomasBroyer Could you please post an example for you suggestion?

http://stackoverflow.com/a/22556154
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22556057
downvote count: 0
has body: You can not touch the Views in a non UI Thread. and you are appending text to TextView in a background Thread which is not allowed. and I hope there is no problem with the initialization of MainActivity inside RegisterTimer as you are not creating the instance of Activity manually. You are in correct way with the initialization rt.ma = this. and why do you need AsyncTask just for changing the text of a TextView?
type: Answer

http://stackoverflow.com/comment/34461578
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22629304
has text: Thank you every much! Does that mean malloc first and giving the address to *readbuff have the same effect as readbuff[11]?

http://stackoverflow.com/comment/34437413
type: Comment
has text: alos i need controlString for other activity & ur code seem didn't take controlString out
comment on: http://stackoverflow.com/a/22615224
score: 0
type: AnswerComment

mapreduce
tags question: http://stackoverflow.com/q/22606630
tags question: http://stackoverflow.com/q/22579943
type: Tag
tags question: http://stackoverflow.com/q/22553440
tags question: http://stackoverflow.com/q/22637621
tags question: http://stackoverflow.com/q/22610865
tag name: mapreduce
tags question: http://stackoverflow.com/q/22600927
tags question: http://stackoverflow.com/q/22537282
tags question: http://stackoverflow.com/q/22602789
tags question: http://stackoverflow.com/q/22554000
tags question: http://stackoverflow.com/q/22631057
tags question: http://stackoverflow.com/q/22630323
tags question: http://stackoverflow.com/q/22563204
tags question: http://stackoverflow.com/q/22512627

http://stackoverflow.com/q/22576840
type: Question
linked to: http://stackoverflow.com/q/5454546
tagged with: libgdx
upvote count: 5
has answer: http://stackoverflow.com/a/70824224
tagged with: pan
has answer: http://stackoverflow.com/a/22584085
has title: Libgdx two-finger pan instead of single finger?
answer count: 4
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/47013977
tagged with: android
downvote count: 2
score: 3
tagged with: java
tagged with: gesture
has answer: http://stackoverflow.com/a/42342680
has body: I've overridden the LibGdx Pan gesture method for a different functionality (a selector). However, I want the pan functionality to use two fingers(pointers) instead. Is this possible? It's the same question as this post, however his is specific to iPhone and not LibGdx: How to implement the traditional imageView-inside-a-scrollView pan gesture with two fingers instead of one? the pan() method will only fire with one finger, not two. I was thinking of keeping track of number of fingers used, by setting a variable in touchDown() using the int pointer variable, however the pan() method will not fire when there are 2 fingers in use. Any suggestions? Cheers

http://stackoverflow.com/comment/34396347
score: 0
has text: Can you include links to the examples?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22592710

http://stackoverflow.com/q/22500126
has body: I have an error when parsing image url to image and displaying it in my listview.. i have caught the error but im not able to rectify it .... (caught = know where the error is -_-) First of all im using SAX. Second , im doing a variety of parsing's so i smashed up everything in one activity. third, i will send the log without the exception caught. the error is the last piece of code... where there is try and catch. public class MainActivity extends Activity { URL url; ListView list; ArrayList&lt;String&gt; titles = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; artists = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; countries = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; companies = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; prices = new ArrayList&lt;String&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); list = (ListView) findViewById(R.id.listView1); MyAsync ma = new MyAsync(); ma.execute(); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // getting values from selected ListItem if(position == 0){ Intent a = new Intent(MainActivity.this , custom.class); tartActivity(a); } } }); } class MyAsync extends AsyncTask&lt;Void, Void, Void&gt; { ProgressDialog pd; @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); pd = ProgressDialog.show(MainActivity.this, "", "loading pc parts"); } @Override protected Void doInBackground(Void... params) { // TODO Auto-generated method stub try { url = new URL("https://dl.dropboxusercontent.com/u/74662678/graphicscards.xml"); // Create an instance for SAXParserFactory SAXParserFactory mySAXParserFactory = SAXParserFactory .newInstance(); // Create an instance for SAXParser SAXParser mySAXParser = mySAXParserFactory.newSAXParser(); // Create an instance…
has answer: http://stackoverflow.com/a/22500487
tagged with: java
has title: Parsing Images to listview with sax parser and imageloader class
type: Question
tagged with: listview
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22500691
possible better answer: http://stackoverflow.com/a/22500487
accepted answer: http://stackoverflow.com/a/22500691
tagged with: android
tagged with: sax
has answer: http://stackoverflow.com/a/22500442
type: AnsweredQuestion

http://stackoverflow.com/a/22512886
has body: while(true) loop will of course always iterate. You've to manually break out of it using break, or System.exit(), or may be return. while(condition == true) will be true while condition is true. You can make that false by setting condition = false. I would never ever use while(condition == true) at least. Instead just use while (condition). That would suffice.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22512830
downvote count: 0

http://stackoverflow.com/comment/34382375
score: 1
has text: Why on earth are you using a `Vector`?? This type has been deprecated for a number of decades. And what do you mean by "parse into a `String`"? You can parse a `String` into a structure or you can format a structure into a `String`. Please elaborate...
type: Comment
comment on: http://stackoverflow.com/q/22584938
type: QuestionComment

http://stackoverflow.com/comment/34268692
has text: @FlenMK just use this again here. with System.out.println("i = " + this.i);
comment on: http://stackoverflow.com/a/22520811
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/134314787
type: Comment
comment on: http://stackoverflow.com/a/24814308
has text: This will work only for some time if the accessKeyId and secretAccessKey rotate.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34375663
type: Comment
type: QuestionComment
score: 0
has text: Currently how did you manage to display this watermark? As a background-image of the masterPage, or as background-image of a grid? Or something different?
comment on: http://stackoverflow.com/q/22573549

http://stackoverflow.com/q/22569551
accepted answer: http://stackoverflow.com/a/22569671
answer count: 2
has answer: http://stackoverflow.com/a/22569630
has body: I'm trying to make each thread read its own text file. private void burden() { File mainFolder = new File("C:\\FilesToRead"); File[] files = mainFolder.listFiles(); String freeFile; for (File file : files) { FileChannel channel; FileLock lock = null; try { channel = new RandomAccessFile(file, "r").getChannel();; lock = channel.lock(); // Ok. We get the lock readFile(file.getName()); } catch (OverlappingFileLockException e) { continue; // File is open by someone else } catch (FileNotFoundException f) { } catch (IOException ex) { } catch (NonWritableChannelException n) { System.out.println("NonWritableChannelException"); } finally { try { lock.release(); } catch (IOException ex) { System.out.println("IOException!"); } } } } // burden(); I get this picture in the debugger: The next step will bring me to the NonWritableChannelException. I can't understand why as I tried to lock file for reading.
score: 0
has title: Disappointment when trying to lock file for reading
has answer: http://stackoverflow.com/a/22569671
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34354513
has comment: http://stackoverflow.com/comment/34354743
possible better answer: http://stackoverflow.com/a/22569630
type: Question

http://stackoverflow.com/a/22587428
has body: Your logic is entirely backwards. You can only say a number is prime if you've tested ALL possible divisors. You're currently adding ANY number which has a non-zero remainder, which is BACKWARDS. A non-zero remainder means it was NOT evenly divisible, meaning it's NOT a multiple of the factor you're testing, e.g. 8 % 3 -&gt; 2 2 != 0 -&gt; true therefore 8 is prime You can only do your .add() call AFTER you've finished the loop and no tests came back true: is_prime = true; // assume prime for(i = 2; i &lt;= n; i++) { if (n % 2 == 0) { // no remainder, even divisible, therefore NOT primt is_prime = false; break; // abort the loop, no point in testing more } } And yes, you can boost efficiency somewhat by starting your tests at 3 and jumping by 2. Since 2 is the only even prime, it is literally impossible for any OTHER even number to be prime, because 2 is a divisor of all even numbers. So test 3,5,7,9,etc... e.g. test if `n` is even and `!= 2` - if so, then it's NOT prime run 3,5,7,... loop to test everything else
type: Answer
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22587381

http://stackoverflow.com/q/22631345
has answer: http://stackoverflow.com/a/22631691
downvote count: 0
has answer: http://stackoverflow.com/a/22631831
has answer: http://stackoverflow.com/a/22631814
favorite count: 0
has body: I'm not sure if this has been asked before, because I couldn't come up with how to explain the question shortly, so if it had been, please point me in the right direction. So I want to know how to create a function in Java to create a list of lists. In these lists, I want all possibilities of the numbers 0-5, but only 4 numbers in each list. I've done this in a simple way, where I can hardcode the 4 in, but I don't want to hardcode that number in. Here is what I have, written in Dart. void generateLists() { // possibles holds all the possible options. (1296 options in this case) List&lt;List&lt;int&gt;&gt; possibles = new List(); int size = 4; // This should be the size of each list. This is what I'm asking about. int maxNum = 6; // The numbers should go from 0 - maxNum. // A terrible amount of for loops within each other to generate these lists. for(int i=0; i&lt;maxNum; i++) { for(int j=0; j&lt;maxNum; j++) { for(int k=0; k&lt;maxNum; k++) { for(int l=0; l&lt;maxNum; l++) { // Create each list and add it to the possibles. List&lt;int&gt; list = new List(); list.add(i); list.add(j); list.add(k); list.add(l); possibles.add(list); } } } } // Print all the numbers to show it works. for(List&lt;int&gt; l in possibles) { print(l); } } Thanks.
tagged with: dart
has comment: http://stackoverflow.com/comment/34464937
type: AnsweredQuestion
tagged with: list
upvote count: 3
has answer: http://stackoverflow.com/a/22636003
possible better answer: http://stackoverflow.com/a/22631911
type: Question
has comment: http://stackoverflow.com/comment/34465507
score: 3
has answer: http://stackoverflow.com/a/22631911
has answer: http://stackoverflow.com/a/22640509
tagged with: java
answer count: 6
accepted answer: http://stackoverflow.com/a/22636003
tagged with: for-loop
has title: How to make a list of lists of n numbers including x-z numbers

http://stackoverflow.com/q/22517695
tagged with: regex
downvote count: 0
type: UnansweredQuestion
tagged with: multithreading
type: Question
score: 1
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/34263538
has title: Threaded application writing duplicate lines to log file
upvote count: 1
has body: I have written a multithreaded application that analyzes rows in a database with regex and updates them appropriately. I am writing each row to a log file for logging purposes. I have noticed that the same row is being written to the log file several times...sometimes upwards of 15 times. Here are snippets of the code. Setting up ThreadPoolExecuter: private static BlockingQueue&lt;Runnable&gt; worksQueue = new ArrayBlockingQueue&lt;Runnable&gt;(blockingQueueSize); private static ThreadPoolExecutor exec = new ThreadPoolExecutor(threadPoolSize, threadPoolSize, 10, TimeUnit.SECONDS, worksQueue); In this part, I run a query, then go through the results: rs = ps.executeQuery(); while (rs.next()) { exec.execute(new UpdateMember(rs, conn, fileWriter)); if (worksQueue.size() == blockingQueueSize) { //reach the maximum, stop refill for (;;) { Thread.yield(); //wait until the size of queue reached the minimum if (worksQueue.size() == 0) { //start refill break; } } } } UpdateMember (with only run and writeToLog methods showing): public class UpdateMember implements Runnable { ResultSet rs; Connection conn; FileWriter fw; public UpdateMember(ResultSet rs, Connection conn, FileWriter fw) { this.rs = rs; this.conn = conn; this.fw = fw; } @Override public void run() { try { String regex = "((?&lt;city&gt;[a-zA-Z\\s\\.]+)\\s)?(?&lt;provState&gt;AB|ALB|Alta|alberta|BC|B\\.C\\.|British Columbia|LB|Labrador|MB|Man|Manitoba|N[BLTSU]|Nfld|NF|Newfoundland|NWT|Northwest Territories|Nova Scotia|New Brunswick|Nunavut|ON|ONT|Ontario|PE|PEI|Prince Edward Island|QC|PC|QUE|QU|Quebec|SK|Sask|Saskatchewan|YT|Yukon|Yukon Territories)(\\s(?&lt;country&gt;CA|CAN|CANADA))?$"; Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); BigDecimal memrecno = rs.getBigDecimal(2); String addressLineTwo = rs.getString(4); String addressLineThree = rs.getString(5); String addressLineFour = rs.getString(6); BigDecimal attrrecno = rs.getBigDecimal(9); String addressBeingParsed = ""; String city = nul…
answer count: 1
has answer: http://stackoverflow.com/a/22517888
has comment: http://stackoverflow.com/comment/34263462

javafx
tags question: http://stackoverflow.com/q/22551223
tags question: http://stackoverflow.com/q/22553413
tags question: http://stackoverflow.com/q/22505338
tags question: http://stackoverflow.com/q/22550668
type: Tag
tags question: http://stackoverflow.com/q/22633271
tags question: http://stackoverflow.com/q/22644995
tags question: http://stackoverflow.com/q/22605701
tags question: http://stackoverflow.com/q/22580285
tags question: http://stackoverflow.com/q/22546028
tags question: http://stackoverflow.com/q/22490786
tags question: http://stackoverflow.com/q/22584263
tags question: http://stackoverflow.com/q/22645067
tags question: http://stackoverflow.com/q/22522995
tags question: http://stackoverflow.com/q/22490064
tags question: http://stackoverflow.com/q/22535847
tags question: http://stackoverflow.com/q/22531847
tag name: javafx
tags question: http://stackoverflow.com/q/22622636
tags question: http://stackoverflow.com/q/22620919
tags question: http://stackoverflow.com/q/22576261
tags question: http://stackoverflow.com/q/22631970
tags question: http://stackoverflow.com/q/22574794
tags question: http://stackoverflow.com/q/22592158
tags question: http://stackoverflow.com/q/22574239
tags question: http://stackoverflow.com/q/22535333
tags question: http://stackoverflow.com/q/22589901
tags question: http://stackoverflow.com/q/22573496
tags question: http://stackoverflow.com/q/22490855
tags question: http://stackoverflow.com/q/22638872
tags question: http://stackoverflow.com/q/22582706
tags question: http://stackoverflow.com/q/22643654
tags question: http://stackoverflow.com/q/22612985
tags question: http://stackoverflow.com/q/22573263
tags question: http://stackoverflow.com/q/22532267
tags question: http://stackoverflow.com/q/22604874
tags question: http://stackoverflow.com/q/22583174
tags question: http://stackoverflow.com/q/22531549
tags question: http://stackoverflow.com/q/22639430
tags question: http://stackoverflow.com/q/22646644
tags question: http://stackoverflow.com/q/22596394
tags question: http://stackoverflow.com/q/22523927
tags question: http://stackoverflow.com/q/22571588
tags question: http://stackoverflow.com/q/22514310

http://stackoverflow.com/comment/34371404
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22579142
has text: @Xbit that is sort of what [`Scanner.nextDouble`](http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextDouble()) does... Would be a pretty useless method otherwise.

http://stackoverflow.com/comment/38477688
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24791224
type: Comment
has text: @eckes wouldn't you be hitting the cache loader anyways when refreshing all entries? how different are your load() and reload() implementations?

http://stackoverflow.com/a/22513331
type: Answer
has comment: http://stackoverflow.com/comment/34309235
answers question: http://stackoverflow.com/q/22493702
has body: You need to tell SWIG that the classes in both files are the same. See File Imports section of the SWIG docs, which also refers to section 15 for more details. Here, do_something_with_data uses return_data so add the %import "return_data.i" in do_something_with_data.i. Also, you then don't need to redefine the vector template. So your do_something_with_data.i should be: /* turn this module into java using SWIG */ %module do_something_with_data %{ #include &lt;vector&gt; #include &lt;complex&gt; #include "do_something_with_data.hh" %} %import "return_data.i" /* boilerplate code */ %pragma(java) jniclasscode=%{ static { try { java.lang.System.loadLibrary("do_something_with_data"); } catch (UnsatisfiedLinkError e) { java.lang.System.err.println("Native code library failed to import"); java.lang.System.exit(1); } } %} %include "do_something_with_data.hh"
has comment: http://stackoverflow.com/comment/34307155
score: 0

http://stackoverflow.com/q/22496343
tagged with: tablet
favorite count: 0
type: Question
tagged with: android
has body: I am developing USB to serial app, where mobile will attached with USB hub, and this hub is connected with with other devices through CP2102 cable. I am able to identify all devices and can read and write also. But the problem is all have same Vendor and product ID and other information also. And USB port number is also changing if we disconnect and connect. So is there any way to identify the attached devices. Let me know if any other information required here. I am using this example for development. http://code.google.com/p/usb-serial-for-android/
has comment: http://stackoverflow.com/comment/34226228
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34225843
has title: How to identify the attached devices through USB
has comment: http://stackoverflow.com/comment/34225927
tagged with: java
tagged with: usb
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22723918

http://stackoverflow.com/a/22622313
has comment: http://stackoverflow.com/comment/34449944
answers question: http://stackoverflow.com/q/22622222
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/34449305
has body: Store those interfaces in Collection like Set&lt;Class&gt; classes, then iterate over them and compare with your object.
has comment: http://stackoverflow.com/comment/34449649
type: Answer
downvote count: 2

http://stackoverflow.com/q/22523532
tagged with: geometry
has answer: http://stackoverflow.com/a/22523607
type: AnsweredQuestion
score: 0
tagged with: java
has title: Triangle always says equilateral in java
type: Question
accepted answer: http://stackoverflow.com/a/22523607
tagged with: if-statement
has comment: http://stackoverflow.com/comment/34273351
tagged with: boolean
answer count: 1
has body: I don't know what's wrong but my output determines that the triangle has sides 1.0, 1.0, 1.0 and is always equilateral. public class Triangle { // fields private double side1; private double side2; private double side3; // constructor public Triangle (double sideA, double sideB, double sideC) { sideA = side1; sideB = side2; sideC = side3; if(isTriangle(sideA, sideB, sideC) == false) { side1 = 1; side2 = 1; side3 = 1; } } // methods public double getSide1() { return side1; } public double getSide2() { return side2; } public double getSide3() { return side3; } public boolean isTriangle(double sideA, double sideB, double sideC) { if (side1 + side2 &gt; side3 || side2 + side3 &gt; side1 || side3 + side1 &gt; side2) { return true; } else { return false; } } public boolean isEquilateral() { if(side1 == side2 &amp;&amp; side2 == side3) { return true; } else { return false; } } public boolean isRight() { if (Math.pow (side1, 2) + Math.pow (side2, 2) == Math.pow (side3, 2) || Math.pow (side2, 2) + Math.pow (side3, 2) == Math.pow (side1, 2) || Math.pow (side3, 2) + Math.pow (side1, 2) == Math.pow (side2, 2)) { return true; } else { return false; } } } // A06 Triangle import java.util.Scanner; public class triangleTest { public static void main(String[] args) { Scanner input = new Scanner(System.in); double side1 = 0; double side2 = 0; double side3 = 0; System.out.print("Side1: "); side1 = input.nextDouble(); System.out.print("Side2: "); side2 = input.nextDouble(); System.out.print("Side3: "); side3 = input.nextDouble(); System.out.println(); Triangle myTriangle = new Triangle(side1, side2, side3); System.out.printf("Triangle( %.1f %.1f %.1f) %s\n", myTriangle.getSide1(), myTriangle.getSide2(), myTriangle.getSide3(), myTriangle.isEquilateral() == true ? "is equilateral" : myTriangle.isRight() == true ? "is right" : ""); } }
has comment: http://stackoverflow.com/comment/34273268

http://stackoverflow.com/q/22643304
has comment: http://stackoverflow.com/comment/34486517
tagged with: sms
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34488282
has answer: http://stackoverflow.com/a/22645025
tagged with: android-intent
type: Question
has comment: http://stackoverflow.com/comment/34486918
has body: I am working on an application that needs to read an incoming message. Now, i found out that i need to use the onReceive method from the BroadcastReceiver class. Now i got to know that java does not allow extending two classes, so how do i get it working, i have been stuck on this from a long time, please help! Also if there is some other way to do this, please do quote. public class SMS extends Activity { Button btnSendSMS; EditText txtPhoneNo; EditText txtMessage; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sms); btnSendSMS = (Button) findViewById(R.id.btnSendSMS); txtPhoneNo = (EditText) findViewById(R.id.txtPhoneNo); btnSendSMS.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String phoneNo = txtPhoneNo.getText().toString(); if (phoneNo.length()&gt;0) sendSMS(phoneNo, phoneNo); else Toast.makeText(getBaseContext(), "Please enter a valid Phone Number.", Toast.LENGTH_SHORT).show(); } }); } private void sendSMS(String phoneNumber, String message) { PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, SMS.class), 0); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, pi, null); } Context context = getApplicationContext(); Intent intent = new Intent(); object.onReceive(context, intent); } class SMSBroadcastReceiver extends BroadcastReceiver { private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED"; private static final String TAG = "SMSBroadcastReceiver"; @Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "Intent recieved: " + intent.getAction()); Toast.makeText(context, "HI", Toast.LENGTH_SHORT).show(); if (intent.getAction().equals(SMS_RECEIVED)) { Bundle bundle = intent.getExtras(); if (bundle != null) { Object[] pdus = (Object[])bundle.get("pdus"); final SmsMessage[] messages = new SmsMessage[pdus.len…
score: 0
answer count: 1
tagged with: android
has title: How do i set a listener in an activity from another class?

http://stackoverflow.com/a/22596963
upvote count: 2
type: Answer
score: 2
has body: If your goal is to eliminate if statements, then a 4 entry lookup table of pointers to functions would be your most elegant answer; combine your two bits (booleans) into a single 2-bit value, and use that to determine which lookup table entry to use, i.e. in pseuodocode: static FunctionArrayInYourLanguage fnAr[4] {ThingA(), ThingB(), ThingC(), ThingD()} UnsignedIntegerType manyBooleans = (boolean1 LeftShift 1) BitwiseOR boolean2 Remark: Or any other way of combining your booleans, like casting a struct of 8 bits as a uint8_t in C or vice versa Execute fnAr[manyBooleans](); Note that this technique is extensible to many more than just 2 booleans if you can afford the lookup table space, and if you've really got a function for each possible combination, you can definitely afford the space.
downvote count: 0
answers question: http://stackoverflow.com/q/22596857

http://stackoverflow.com/q/22564505
has answer: http://stackoverflow.com/a/22564560
has body: So I have this line of code output.println("Nimi: %s | Keskmine hinne %f | Aine: %s", i.askName(), i.askMedian(), i.askSubject()); So the the first and last one are strings but the middle one is a double. Now to print a double I know that you have to use %f right? But for some reason Eclipse is giving me this error: The method println(String) in the type PrintWriter is not applicable for the arguments (String, String, double, String) What is the problem here? Why is the error even showing like I am trying to use 4 variables here when I am only using 3?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22564546
type: Question
has comment: http://stackoverflow.com/comment/34344997
has comment: http://stackoverflow.com/comment/34344980
score: 0
answer count: 2
has title: Having problems with printing out a double
accepted answer: http://stackoverflow.com/a/22564546
possible better answer: http://stackoverflow.com/a/22564560

http://stackoverflow.com/a/22590939
downvote count: 0
has body: The POI jar cannot be found. Add it to your lib directory.
type: Answer
accepted answer of: http://stackoverflow.com/q/22589954
upvote count: 1
answers question: http://stackoverflow.com/q/22589954
score: 1
type: AcceptedAnswer

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/22623414
tag name: google-oauth
tags question: http://stackoverflow.com/q/22595174

http://stackoverflow.com/comment/34553656
has text: Changeing visibility of components: http://wicketguide.comsysto.com/guide/chapter5.html#chapter5_1
type: QuestionComment
comment on: http://stackoverflow.com/q/22638454
type: Comment
score: 1

http://stackoverflow.com/comment/34257969
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22514947
has text: Reflection or writing them in sequence are your options. Why do you feel the need to call these methods in this manner? What are you getting at with this?
type: Comment

http://stackoverflow.com/comment/34428047
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22610608
has text: @StefanBeike Yes, yet the same result.

http://stackoverflow.com/q/22595306
has answer: http://stackoverflow.com/a/22595517
type: UnansweredQuestion
tagged with: animation
answer count: 4
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/22595555
tagged with: swing
has comment: http://stackoverflow.com/comment/34407866
type: Question
tagged with: object
has body: I'm quite new to java. I need to animate two images on a java game. It's meant to be a spaceship game allowing two users to control the objects, using a keyboard. I've partially implemented this, however I cannot understand how to allow for two keyboard controls, and also the one object that is moving via keyboard input is flickering a lot. public class MainFrame extends JFrame implements KeyListener { MainPanel mPanel; MainPanel secondss; MainPanel thirdss; int speed = 5; //ss facing north int direction = 0; MainFrame() { setTitle("spaceship Game"); mPanel = new MainPanel("C:/img"); secondss = new MainPanel("C:/img"); setSize(1024, 768); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(mPanel); // add MainPanel JPanel to JFrame setVisible(true); // show class add(secondSs); add(thirdSs); seconds.currentSs.setX(400); secondSS.currentSs.setY(100); } public void actionPerformed( ActionEvent e ) { if( e.getSource() == mPanel) { } } @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == e.VK_LEFT) { int x = mPanel.currentSs.getX() - speed; mPanel.currentSs.setX(x); } if (e.getKeyCode() == e.VK_RIGHT) { int x = mPanel.currentSs.getX() + speed; mPanel.currentSs.setX(x); } if (e.getKeyCode() == e.VK_DOWN) { int y = mPanel.currentSs.getY() + speed; mPanel.currentSs.setY(y); } if (e.getKeyCode() == e.VK_UP) { int y = mPanel.currentSs.getY() - speed; mPanel.currentSs.setY(y); } //change image direction mPanel.frame = direction; } public static void main(String[] args) { MainFrame mainFrame = new MainFrame(); mainFrame.addKeyListener(mainFrame); } If someone could provide help or if not point me in the right direction I would be grateful.
has answer: http://stackoverflow.com/a/22596172
has comment: http://stackoverflow.com/comment/34400886
tagged with: keylistener
has title: Animating two images in java
has answer: http://stackoverflow.com/a/22595668

http://stackoverflow.com/q/22579845
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7985231
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22593580
type: Question
tagged with: jersey
has body: Can't figure out how to make an object created at jersey-server start accessible in jersey resources. Basically, what i want to do is to inject a Database context into jersey resources. JerseyServer: public boolean startServer(String keyStoreServer, String trustStoreServer) { //Check if GraphDb is setup if (gdbLogic == null) { //FIXME - maybe throw an exception here? return false; } // create a resource config that scans for JAX-RS resources and providers // in org.developer_recommender.server package final org.glassfish.jersey.server.ResourceConfig rc = new org.glassfish.jersey.server.ResourceConfig().packages("org.developer_recommender.server").register(createMoxyJsonResolver()); WebappContext context = new WebappContext("context"); ServletRegistration registration = context.addServlet("ServletContainer", ServletContainer.class); //TODO: value setzen registration.setInitParameter("jersey.config.server.provider.packages", "org.developer_recommender.server.service;org.developer_recommender.server.auth"); registration.setInitParameter(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, SecurityFilter.class.getName()); SSLContextConfigurator sslContext = new SSLContextConfigurator(); sslContext.setKeyStoreFile(keyStoreServer); sslContext.setTrustStoreFile(trustStoreServer); //TODO - sslContext.setKeyStorePass("123456"); sslContext.setTrustStorePass("123456"); // create and start a new instance of grizzly http server // exposing the Jersey application at BASE_URI HttpServer server = null; try{ SSLEngineConfigurator sslec = new SSLEngineConfigurator(sslContext).setClientMode(false).setNeedClientAuth(true); server = GrizzlyHttpServerFactory.createHttpServer(getBaseURI()/*URI.create(BASE_URI)*/, rc, true , sslec); System.out.println("Jersey app started. Try out " + BASE_URI); context.deploy(server); return true; } catch(Exception e ){ System.out.println(e.getMessage()); } return false; Service: public class Service { @Inject protected GDBLogic gbdLogic; } So i want the ins…
has title: Injecting objects into jersey ressources
has comment: http://stackoverflow.com/comment/34372837
tagged with: code-injection
answer count: 1
downvote count: 0
tagged with: dependencies
favorite count: 0
tagged with: rest

http://stackoverflow.com/a/22578822
type: Answer
has comment: http://stackoverflow.com/comment/34370977
has comment: http://stackoverflow.com/comment/34370896
has comment: http://stackoverflow.com/comment/34370874
downvote count: 0
has comment: http://stackoverflow.com/comment/34370872
score: 3
has comment: http://stackoverflow.com/comment/34370964
answers question: http://stackoverflow.com/q/22578749
has comment: http://stackoverflow.com/comment/34371092
has comment: http://stackoverflow.com/comment/34371180
has body: The errors are in these 4 lines: String firstHandler=""; while ((line = bufferedReader.readLine()) != null) { bufferedReader.readLine(); if (firstHandler.startsWith("#1")){ You read one line from inside the while statement. And for each line read, you enter the block. But inside this block, you read yet another line. And then, what you compare with "#1" is not the line that you have just read, but firstHandler, which is initialized as an empty string once, and never modified. The code should be: while ((line = bufferedReader.readLine()) != null) { if (line.startsWith("#1")) { The reader should also be closed in a finally block, but that's another matter.
upvote count: 3
has comment: http://stackoverflow.com/comment/34370948

http://stackoverflow.com/a/22604629
downvote count: 0
answers question: http://stackoverflow.com/q/22565866
upvote count: 2
type: Answer
has body: Try this code, i used it for show video thumb with overlapped play image ` <ImageView android:id="@+id/videoImage" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="center" android:src="@drawable/videoThumb" /> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:scaleType="centerCrop" android:layout_margin="10dp" android:src="@drawable/play_button"/> ` Change height width as per your requirement.
score: 2

http://stackoverflow.com/comment/34496529
type: Comment
comment on: http://stackoverflow.com/a/22647130
type: AnswerComment
score: 0
has text: I have 1 more problem. So the `MainWindow` class has the menubar, when you select the server option from the menubar-a popup window appears. This popup window is handled by another class called `ServerWindow`. It has some fields where you can enter things in like port number then click OK. Once you click okay, `ServerWindow` sends all the typed information to the `Server` class. There's a `MainWindow` function called `draw()` that has something like: `Graphics g = this.getGraphics();`.

http://stackoverflow.com/comment/34410673
has text: So, you mean like this? `System.out.println(Arrays.toString(personID));` It tells me that it cannot convert the ArrayList to whatever array.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22600561
type: Comment

http://stackoverflow.com/comment/34510878
has text: Thanks. In the ticket you're referring to the related (but fixed) issue https://java.net/jira/browse/JERSEY-1960. I can confirm that switching my code to a servlet-container works. I'll wait for the fix and switch back then.
score: 0
comment on: http://stackoverflow.com/a/22649205
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22618679
score: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/34755495
answers question: http://stackoverflow.com/q/22593452
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/129364541
has body: Regarding your first attempt, it does not work, because Bean Validation constraints must follow the Liskov Substitution Principle. See also the relevant Bean Validation specification section - http://beanvalidation.org/1.1/spec/#constraintdeclarationvalidationprocess-methodlevelconstraints-inheritance From the specification: Very informally speaking, the Liskov substitution principle says that where a given type T is used, it should be possible to replace T with a sub-type S of T ("Behavioral subtyping"). If S overrides/implements a method from T and S would strengthen the method's preconditions (e.g. by adding parameter constraints) this principle would be violated as client code working correctly against T might fail when working against S. Also if S overrides/implements a method from T and S weakens the method's postconditions this principle would be violated. However S may strengthen the method's postconditions (by adding return value constraints), as client code working against T still will work against S. I think your second example should actually work, however, I am not familiar with the NetBeans AbstractFacade. My guess is that the call to checkedCreate(entity); is not going via a proxies instance and hence is not intercepted. Maybe you could post the full code for the involved classes? What type of class contains these methods? A session bean?

http://stackoverflow.com/a/22504817
type: Answer
upvote count: 1
score: 1
has body: You are doing this the wrong way - if you want to transfer large objects, use direct HTTP links. This way, you will be able to write them directly to the SD card while they are getting received, and not use up multiples of their size in main memory. Again, do not send them as attachments from the web service, send them as direct http responses - I believe there's even a WS-* compatible way to specify that.
answers question: http://stackoverflow.com/q/22499511
downvote count: 0

printers
tag name: printers
type: Tag
tags question: http://stackoverflow.com/q/22512635

http://stackoverflow.com/a/22611940
score: 0
has body: Your logic is incorrect when you use int instead of boolean. To make it less confusing use int flag = 0 for false and flag = 1 for true. In multi-threading it is a good practice to write conditions for wait() and notify() in a while loop instead of a if block just to make sure the value of the variable/flag is still the same after the thread wakes up. e.g. - class Chat { boolean flag = false; public synchronized void getTalk1(String msg) throws InterruptedException { while (flag) { wait(); } System.out.println(msg); flag = true; notify(); } public synchronized void getTalk2(String msg) throws InterruptedException { while (!flag) { wait(); } System.out.println(msg); flag = false; notify(); } }
answers question: http://stackoverflow.com/q/22609634
type: Answer

http://stackoverflow.com/comment/34460556
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22627677
has text: Why do you skip over debug variants?
type: AnswerComment

http://stackoverflow.com/q/22634730
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23449092
has body: I have one WebService installed on JBOSS EAP 6.2. Problem appears when i want to fetch SOAP headers. Code, where exception is raised: ArrayList<SoapHeader> hl = (ArrayList<SoapHeader>) wsctx.getMessageContext().get("org.apache.cxf.headers.Header.list"); String username = ""; String password = ""; for (int i = 0; i < hl.size(); i++) { //for(SoapHeader header : hl) gives this same exception SoapHeader header = hl.get(i); //here is fetching data from this header. Not important to this case. } I know it isn't really pretty, but i really interested in fetching header and exception raised percisely in this method: hl.get(i) And message of exception is: org.apache.cxf.binding.soap.SoapHeader cannot be cast to org.apache.cxf.binding.soap.SoapHeader At first i thought about wrong version in my Maven's POM file so: org.apache.cxf cxf-rt-bindings-soap 2.4.2 But it work good i think. So my question: how to avoid it? Can anyone help me? Thanks
has title: org.apache.cxf.binding.soap.SoapHeader cannot be cast to org.apache.cxf.binding.soap.SoapHeader
tagged with: jboss
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/22634954
favorite count: 0
has answer: http://stackoverflow.com/a/22634954
tagged with: soapheader
has answer: http://stackoverflow.com/a/23449092
tagged with: maven
type: AnsweredQuestion

http://stackoverflow.com/comment/34226743
has text: @brian roach 's answer has a better explanation than mine on this.
type: Comment
comment on: http://stackoverflow.com/a/22496827
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34465000
type: Comment
comment on: http://stackoverflow.com/a/22627505
has text: I taught that only [extends fragment] can cause that. But its still happen on [extends activity].
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34247301
score: 0
type: AnswerComment
type: Comment
has text: When i try to change to this.wiersz[] ... a get error when compile zad1.java:35 illegal start of expression and its pointing on [] symbol
comment on: http://stackoverflow.com/a/22509129

http://stackoverflow.com/comment/34359749
has text: Classloaders have hierarchies. Common dependencies are put at the bottom of the tree. See these excellent slides for details http://www.slideshare.net/martinlippert/classloading-and-type-visibility-in-osgi-presentation
comment on: http://stackoverflow.com/a/22572188
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22500339
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36072239
linked to: http://stackoverflow.com/q/7615645
type: Question
tagged with: ss
tagged with: ssl-certificate
tagged with: groovy
upvote count: 1
has title: javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name while connecting to the https url via groovy
favorite count: 0
tagged with: client-certificates
has body: I am trying to acces the https xml url of my application deployed on jdk 1.7.0_25 through my groovy code. But the groovy throws an exception for this line in groovy code - URL url = new URL("https://my.company.com//path/to/xml") URLConnection urlConnection = url.openConnection() def xml = new XmlSlurper().parse(url.toString()) //Parse the XML here....and perform operations exception javax.net.ssl.SSLProtocolException: handshake alert:unrecognized_name As a workaround I tried importing the certificate - my.company.com from the certificate hierarchy my.company.cer through the browser to my local keystore where I've my development environment setup. Below is the command - 1. keytool -importcert -alias "mycompany-ca" -file my.company.cer 2. keytool -import -file my_company.cer -keystore "C:\Program Files\Java\jdk1.6.0_30\jre\lib\security\cacerts" -trustcacerts -storepass "changeit" And the certificate was successfully added to the local trust store - "jdk1.6.0_30\jre\lib\security\cacerts". I was able to access the xml via https url via groovy code then. So I tried further importing the same certificate in the server environment's local keystore. But the problem is this workaround works randomly. Sometimes I am able to access this xml successfully via https url from the server and sometimes I hit the same error randomly without any change in the script. Do I need to import the root certificate into the local trust store of my server environment? How do I handle this SSL exception in my groovy itself? I am sorry I am complete new to this. Any pointers and help would be much appreciated.
type: UnansweredQuestion

http://stackoverflow.com/comment/34346175
score: 1
has text: Also, don't trust the serialization in IE Dev Tools; get the ID value and `alert()` it or `console.log()` it or whatever.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22564855

http://stackoverflow.com/comment/34319082
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22548288
has text: have you registered `/testServlet` in `web.xml` url pattern OR using Annotaion `@WebServlet("/testServlet")`? and also take a look on [this](http://stackoverflow.com/questions/5374981/how-to-pass-a-value-of-a-variable-from-a-java-class-to-the-jsp-page?rq=1) and [this](http://stackoverflow.com/questions/5414600/pass-data-from-java-servlet-to-jsp?rq=1)

http://stackoverflow.com/comment/34391368
has text: Declaring but not using variables is not illegal, as can be seen in the second case where the declaration is merely included in a block. The compiler will detect the un-used variable in the block too, and will output a warning about that if configured to do so. Thus, I think your argument does not hold and the explanation is not correct.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22575906

android-webview
tags question: http://stackoverflow.com/q/22630533
type: Tag
tags question: http://stackoverflow.com/q/22618588
tag name: android-webview

http://stackoverflow.com/comment/34307324
type: Comment
type: AnswerComment
has text: or if you are trying to read a list create a list of the class type like List<someclass> and add these objects to that list
score: 0
comment on: http://stackoverflow.com/a/22542620

http://stackoverflow.com/comment/34355908
type: Comment
type: QuestionComment
has text: What is "the PMD option"?
score: 0
comment on: http://stackoverflow.com/q/22570167

http://stackoverflow.com/q/22611739
has comment: http://stackoverflow.com/comment/34430815
tagged with: swing
type: Question
tagged with: jtree
has comment: http://stackoverflow.com/comment/34430569
tagged with: java
has comment: http://stackoverflow.com/comment/135956103
score: 0
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/34430467
has answer: http://stackoverflow.com/a/22612257
type: UnansweredQuestion
has title: Detect when expand/collapse (plus/minus) icon is clicked in JTree
has body: I'm writing a MouseListener to replace the default clicking behaviour in the JTree. How can I tell when this icon is clicked so I can expand the row myself? (I know this is default behaviour, but I'm replacing the default MouseListener with my own MouseListener). Here's my code: // Custom mouse listener for the tree MouseListener treeMouseListener = new MouseAdapter() { public void mousePressed (MouseEvent e) { TreePath path = cameraTree.getPathForLocation(e.getX(), e.getY()); // Do some methods based on what was clicked ... } }; The TreePath returned by cameraTree.getPathForLocation(e.getX(), e.getY()) is null when clicking on the +/- icon. How can I tell when that +/- icon is clicked?

http://stackoverflow.com/comment/34241787
score: 0
has text: @khmarbaise is right, that's absolutely what you want. Just create a separate profile in webapp, asign your goal to whatever phase you want, and then run mvn command from parent with defined profile. The -P options propagate even to submodules.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22505271

http://stackoverflow.com/a/39151533
has body: This is mine (considering that indexOf() is not introduced yet): public boolean prefixAgain(String str, int n) { for (int i=1; i &lt;= str.length()-n; i++) if (str.substring(i, i+n).equals(str.substring(0, n))) return true; return false; } But I found this solution the most elegant so far: public boolean prefixAgain(String str, int n) { return (str.indexOf(str.substring(0, n), 1) != -1); }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22592612

http://stackoverflow.com/q/22491012
tagged with: java
tagged with: hibernate
score: 0
answer count: 1
has title: Request syntactically incorrect
has comment: http://stackoverflow.com/comment/34216789
has answer: http://stackoverflow.com/a/22491146
has body: I am trying to post some variables to my controller which are then entered into a DB. But i keep getting an error stating that the request is syntactically incorrect. Here is the form. <form:form action="addLink" method="POST" commandName="link" > Gender: Garment: Product Class: Sport: Link: </form:form> The Entity Link package com.wlgore.webapp.fab.pfsa.db; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.NotNull; @Entity @Table(name = "LINK") public class Link implements Serializable { private static final long serialVersionUID = 1L; @Id @Column private String hash; @Column @NotNull private String link; @Column @NotNull private Integer garment; @Column @NotNull private Integer productclass; @Column @NotNull private Integer gender; @Column private String sport; /** * @return the link */ public String getLink() { return link; } /** * @param link the link to set */ public void setLink(String link) { this.link = link; } /** * @return the garment */ public Integer getGarment() { return garment; } /** * @param garment the garment to set */ public void setGarment(Integer garment) { this.garment = garment; } /** * @return the productclass */ public Integer getProductclass() { return productclass; } /** * @param productclass the productclass to set */ public void setProductclass(Integer productclass) { this.productclass = productclass; } /** * @return the gender */ public Integer getGender() { return gender; } /** * @param gender the gender to set */ public void setGender(Integer gender) { this.gender = gender; } /** * @return the sport */ public String getSport() { return sport; } /** * @param sport the sport to set */ public void setSport(String sport) { this.sport = sport; } /** * @return the hash */ public String getHash() { return hash; } /** * @param hash the hash to set */ public void setHash(String hash) { this.hash = hash; …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34216781
accepted answer: http://stackoverflow.com/a/22491146
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34216984

http://stackoverflow.com/comment/34286917
has text: Updated my answer to consider question of duplication. By the way the first design was intentionally because you checked not for duplications (list.contains) in your examples.
type: AnswerComment
comment on: http://stackoverflow.com/a/22499468
type: Comment
score: 1

jakarta-mail
tags question: http://stackoverflow.com/q/22609548
tags question: http://stackoverflow.com/q/22556420
tags question: http://stackoverflow.com/q/22638208
tag name: jakarta-mail
tags question: http://stackoverflow.com/q/22591836
tags question: http://stackoverflow.com/q/22569872
type: Tag
tags question: http://stackoverflow.com/q/22595909
tags question: http://stackoverflow.com/q/22559439
tags question: http://stackoverflow.com/q/22503893
tags question: http://stackoverflow.com/q/22515245
tags question: http://stackoverflow.com/q/22551439
tags question: http://stackoverflow.com/q/22488515
tags question: http://stackoverflow.com/q/22517466

http://stackoverflow.com/q/22502076
tagged with: spring
has answer: http://stackoverflow.com/a/22502399
tagged with: java
has title: Same timestamp in an request
has answer: http://stackoverflow.com/a/22502531
type: Question
has comment: http://stackoverflow.com/comment/34234962
score: 0
answer count: 2
has body: I have this usecase, 1) Get an request to an spring controller 2) do some mapping 3) do some things 4) do some other mapping 5) call an backend service So in the mapping step i set an date, I need the date to be same in all mappings for that request. How do I do that in best way in Java/Spring.
type: UnansweredQuestion

http://stackoverflow.com/q/22645621
tagged with: static
has body: I have a question concerning the java synchronization with static methods. More precisely, I have a class with static methods that can be used concurrently by several threads. The principal static method of my class has one argument and calls the other auxiliary static methods one after the other passing them this argument. My question is the following: since the class can be used by multiple threads at a time, isn't there a risk that another thread replaces the argument by another one? I had thought of using a synchronization block on the argument variable of my principal function encompassing the whole code of the method (and thus the calls to auxiliary functions too), but I'm not sure it is a good solution. Could anyone help me?
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/22645763
has comment: http://stackoverflow.com/comment/34491638
has comment: http://stackoverflow.com/comment/34490617
has title: Synchronization on arguments of static methods
has comment: http://stackoverflow.com/comment/34490850
has comment: http://stackoverflow.com/comment/34490699
has comment: http://stackoverflow.com/comment/34491347
tagged with: java
has comment: http://stackoverflow.com/comment/34491901
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34491064
has comment: http://stackoverflow.com/comment/34490846
downvote count: 0
has answer: http://stackoverflow.com/a/22645677
tagged with: block
tagged with: synchronization

http://stackoverflow.com/comment/34413458
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22568830
type: AnswerComment
has text: Try it and no change.

http://stackoverflow.com/comment/34338483
score: 0
has text: LTV has been added very recently and is only available in the AGPL version. Starting with iText 5, the iTextSharp changelog is identical to the iText changelog. You also need to understand the difference between free and gratis. AGPL software is free, but not gratis. Software that is available under the AGPL can be used without paying a fee as long as you make your software also completely free under the AGPL. If you want to use this functionality in a commercial context, you shouldn't ask for a gratis version.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22537516

http://stackoverflow.com/q/22624985
has title: HQL Hibernate registerFunction FUNCTION does not exist
score: 3
downvote count: 0
favorite count: 0
type: Question
upvote count: 3
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27062402
answer count: 1
tagged with: hql
has body: I'm trying to register a custom dialect in Hibernate. I found a ton of examples, and I thought I had it - and now it tells me that the function does not exist in my database. Specifically, I'm trying to create the date_add() dialect for MySQL 5.6. I'm using hibernate 3.6.7. In hibernate.cfg.xml: <hibernate-configuration> com.myPackage.CustomMySQLDialect </hibernate-configuration> In com.myPackage.CustomMySQLDialect: public class CustomMySQLDialect extends MySQL5InnoDBDialect { public CustomMySQLDialect() { super(); registerFunction( "date_add_interval", new SQLFunctionTemplate( Hibernate.DATE, "date_add(?1, interval ?2 ?3)" ) ); } } And when I go to call it in the DAOImpl class: List<User> userList = null; Query confirmationUser = session.getCurrentSession().createQuery("from InitUser where enabled = 0 and date_add_interval(created_date, 1, day) < now() and end_date is null"); userList = confirmationUser.list(); // <-- this is where it dies Here's the exception: Hibernate: select inituser0_.init_user_id as init1_58_, inituser0_.confirmation_date as confirma2_58_, inituser0_.confirmation_sent_date as confirma3_58_, inituser0_.confirmation_token as confirma4_58_, inituser0_.created_date as created5_58_, inituser0_.current_sign_in_date as current6_58_, inituser0_.current_sign_in_ip as current7_58_, inituser0_.email as email58_, inituser0_.enabled as enabled58_, inituser0_.end_date as end10_58_, inituser0_.failed_sign_in_count as failed11_58_, inituser0_.last_sign_in_date as last12_58_, inituser0_.last_sign_in_ip as last13_58_, inituser0_.password as password58_, inituser0_.remember_created_date as remember15_58_, inituser0_.reset_password_confirmation_date as reset16_58_, inituser0_.reset_password_sent_date as reset17_58_, inituser0_.reset_password_token as reset18_58_, inituser0_.sign_in_count as sign19_58_, inituser0_.updated_by as updated20_58_, inituser0_.updated_date as updated21_58_, inituser0_.username as username58_ from InitUser inituser0_ where inituser0_.end…
tagged with: dialect
type: UnansweredQuestion

http://stackoverflow.com/a/22623386
has body: char a = 'a'; char b = 'b'; String str = "" + a+b; or you could try StringBuilder's append.
answers question: http://stackoverflow.com/q/22623355
score: 0
type: Answer

http://stackoverflow.com/a/22572841
answers question: http://stackoverflow.com/q/22572617
downvote count: 1
has body: public static void main(String[] args) { int rows = 5; System.out.println("------ PATTERN 1 ------"); for (int i = 1 ; i &lt;= rows ; i++){ for (int j = rows; j &gt;= i ; j--){ System.out.print(j); } System.out.println(); } System.out.println("\n------ PATTERN 2 ------"); for (int i = 1 ; i &lt;= rows ; i++){ int k; for (k = rows ; k &gt; i; k--){ System.out.print(" "); } for (int j = 1; j &lt;= k ; j++){ System.out.print(j); } System.out.println(); } System.out.println("\n------ PATTERN 3 ------"); for (int i = rows ; i &gt;= 1 ; i--){ int k; for (k = rows ; k &gt; i; k--){ System.out.print(" "); } for (int j = 1; j &lt;= k ; j++){ System.out.print(j); } System.out.println(); } System.out.println("\n------ PATTERN 4 ------"); int whitespaces = rows/2; for (int i = 1 ; i &lt;= rows; i++){ // absolute value of whitespaces int abs_whitespaces = (whitespaces &lt; 0 ? -whitespaces : whitespaces); for (int j = 0 ; j &lt; abs_whitespaces ; j++){ System.out.print(" "); } for (int j = 1 ; j &lt;= rows - 2 * abs_whitespaces ; j++){ System.out.print(j); } whitespaces-=1; System.out.println(); } }
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/q/22522798
has answer: http://stackoverflow.com/a/33233383
score: 3
has answer: http://stackoverflow.com/a/25677105
upvote count: 3
tagged with: java
tagged with: named-entity-recognition
type: Question
answer count: 2
downvote count: 0
has body: I am using Stanford named entity recognition system to identify named entities in my queries. I discover that one of the classifier (english.all.3class.distsim.crf.ser.gz) identify Person named entity more than the other (english.muc.7class.distsim.crf.ser.gz). While the second classifier identify Organization named entity more than the first classifier. The question is how do i modify my code to combine both the performance of 3class and 7class classifiers. I mean how to combine line 2 and 3. Below is my program public void main () { //String serializedClassifier = "classifiers/english.all.3class.distsim.crf.ser.gz"; String serializedClassifier = "classifiers/english.muc.7class.distsim.crf.ser.gz"; AbstractSequenceClassifier&lt;CoreLabel&gt; classifier = CRFClassifier.getClassifierNoExceptions (serializedClassifier); //String s5 = "Access Team Microsoft"; String s5 = " Victor Vianu"; String ans4 = classifier.classifyToString(s5); System.out.println(ans4); }
tagged with: nlp
favorite count: 0
has title: Using multiple classifiers in a Java program
type: UnansweredQuestion

http://stackoverflow.com/comment/34401186
has text: The key difference is that a `Set<Foo>` is *not* a `Set<Notifiable>`, since it doesn't support methods like `add(Notifiable)` that can be used to add a `Bar`. But it *is* a `Set<? extends Notifiable>`, since that doesn't require it to support adding other kinds of notifiables.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22595392
type: AnswerComment

actionlistener
tags question: http://stackoverflow.com/q/22580743
tags question: http://stackoverflow.com/q/22594826
tags question: http://stackoverflow.com/q/22583304
tags question: http://stackoverflow.com/q/22548169
tags question: http://stackoverflow.com/q/22610157
tags question: http://stackoverflow.com/q/22508993
tags question: http://stackoverflow.com/q/22549261
tags question: http://stackoverflow.com/q/22519055
tags question: http://stackoverflow.com/q/22624914
tags question: http://stackoverflow.com/q/22585373
tags question: http://stackoverflow.com/q/22647251
tags question: http://stackoverflow.com/q/22574563
tags question: http://stackoverflow.com/q/22627979
tags question: http://stackoverflow.com/q/22644909
tags question: http://stackoverflow.com/q/22566948
type: Tag
tags question: http://stackoverflow.com/q/22627286
tag name: actionlistener
tags question: http://stackoverflow.com/q/22642173

http://stackoverflow.com/comment/34419487
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22605896
score: 0
has text: @JonSkeet I tried it but it has only this format to send the date and time :(

http://stackoverflow.com/q/22600960
tagged with: android
has answer: http://stackoverflow.com/a/22601108
has answer: http://stackoverflow.com/a/27811033
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/34411442
downvote count: 0
tagged with: java
type: Question
has title: A lot of error when create new project in eclipse for Android App
tagged with: eclipse
has body: I installed eclipse and SDK correctly but when I create new project, I get a lot of error. my R.java file is lost, while there are not file in res that have upper case character I deleted folders that have error in res folder but created new error Please help me. this picture is my SDK manage if there are a component trhat must be install please say Note : Android SDK Tools 22.6 is installed
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/22601001
accepted answer: http://stackoverflow.com/a/22601001
linked to: http://stackoverflow.com/q/22573346
possible better answer: http://stackoverflow.com/a/22601108
has comment: http://stackoverflow.com/comment/34411030
favorite count: 0
has comment: http://stackoverflow.com/comment/34411045

http://stackoverflow.com/comment/34316368
has text: You have a problem at `(?=\\\\{`. The string value looks like `(?=\\{` at that point. The \\ means to match a literal backslash. However, `{` is expected to be the start of a repetition count (such as `"a{2,3}"`), and the pattern compiler complains because this isn't valid. If you want to match literal `{`, you need to add _another_ \\ before the `{`. However, it's probably still wrong. Do you really want your `{` to be _followed_ by a literal backslash, or were you trying to quote the `$`? If the latter, you have too many backslashes before the `$`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22547514
score: 1

http://stackoverflow.com/comment/34439466
score: 0
has text: Here is working example, you can try it : http://en.wikipedia.org/wiki/Java_remote_method_invocation
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22615671

http://stackoverflow.com/q/22573477
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22573551
type: Question
has body: My question is more about general design and code flow, rather than a specific issue like syntax. How can I take an existing game (a fighting game, kind of like Pokemon) and add a GUI to it? I've done very simple GUIs before, so I understand the concepts of adding a frame, selecting a layout, and adding panels, buttons, images, etc. I'm not stuck on the details. Rather, I don't know where to implement the GUI. Is it best to create a class or classes for the GUI, and then create instances of those classes within my existing code? Or do I go the other way around, and have the code within the GUI drive the game forward? I also haven't used event driven programming before. How does this fit into the structure?
accepted answer: http://stackoverflow.com/a/22573551
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0
has title: How do I bring a GUI into an existing object-oriented project?

http://stackoverflow.com/q/22531302
has comment: http://stackoverflow.com/comment/34287136
has comment: http://stackoverflow.com/comment/34286671
has body: &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /&gt; That is my imageView. When I try to change the image of it like this: Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.com_facebook_top_button); imageView1.setImageBitmap(bitmap); the imageview seems to be invisible. The ic_launcher image disappears and the new image is not being shown.
answer count: 0
type: UnansweredQuestion
has title: Change imageview's image from Bitmap object
linked to: http://stackoverflow.com/q/2415619
has comment: http://stackoverflow.com/comment/34287059
type: Question
has comment: http://stackoverflow.com/comment/34286625
tagged with: java
linked to: http://stackoverflow.com/q/11737607
has comment: http://stackoverflow.com/comment/34286512
has comment: http://stackoverflow.com/comment/34287217
score: 0
has comment: http://stackoverflow.com/comment/34286740
has comment: http://stackoverflow.com/comment/34286968
has comment: http://stackoverflow.com/comment/34286922
tagged with: android
has comment: http://stackoverflow.com/comment/34286748

http://stackoverflow.com/a/22642177
upvote count: 1
downvote count: 0
type: Answer
has body: If the text you want to eliminate is on the second and subsequent lines, as in your demo-input &lt;!DOCTYPE Publisher PUBLIC "-//Springer-Verlag//DTD A++ V2.4//EN" "http://devel.springer.de/A++/V2.4/DTD/A++V2.4.dtd"&gt; and no lines between the first and last in the tag contain a closing &gt;, then you can do the following: while(more lines to process) if "&lt;!DOCTYPE Publisher" is not found read line and output it else //This is the first line in a &lt;!DOCTYPE tag read the line and output it, appending '&gt;' to the end while the next line does NOT end with a '&gt;' discard it (don't output it)
score: 1
answers question: http://stackoverflow.com/q/22641724

http://stackoverflow.com/comment/34502266
type: AnswerComment
type: Comment
has text: @AndrewThompson Yeah now i got how to roll it back to any version.But i'm not rolling back this one anymore though. And Thanks for your suggestions AndrewThompson..
score: 1
comment on: http://stackoverflow.com/a/22628963

http://stackoverflow.com/q/22565980
has title: C++: how to get most recent Java path in Windows 32 and 64 bit?
tagged with: c++
has body: How can I get jre - for example jre7 (it could be also jre6 and so on) - folder path using C++ in Windows 32 and 64bit? Simple question - but hard to find working solution/code..
has comment: http://stackoverflow.com/comment/34353716
score: 2
has answer: http://stackoverflow.com/a/22569637
upvote count: 2
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/34065
has comment: http://stackoverflow.com/comment/34350613
type: Question
has comment: http://stackoverflow.com/comment/34353286
linked to: http://stackoverflow.com/q/3167828
linked to: http://stackoverflow.com/q/3930383
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34353936
linked to: http://stackoverflow.com/q/6808541

http://stackoverflow.com/comment/34416763
score: 0
has text: It goes to http://localhost:8080/test-app/j_spring_security_logout and with a HTTP status 404. I want it to go to http://localhost:8080/test-app/logout
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22604064

http://stackoverflow.com/comment/34379549
score: 0
type: Comment
type: QuestionComment
has text: Given is a sequence of distinct positive numbers. We want to find a subsequence with the maximum possible sum, with the restriction that we are not allowed to take three consecutive elements from the original sequence. For example, for input 1, 6, 5, 2, 7, 9, 3, 4, the subsequence with the maximum possible sum is 6, 5, 7, 9, 4 (we have two pairs of consecutive elements 6, 5 and 7, 9 but not three consecutive elements).
comment on: http://stackoverflow.com/q/22583314

http://stackoverflow.com/q/22591324
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34397836
accepted answer: http://stackoverflow.com/a/22662132
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34393686
has comment: http://stackoverflow.com/comment/34397991
tagged with: libgdx
has comment: http://stackoverflow.com/comment/34393483
answer count: 1
has body: I wanted to create a kicking animation when user touch the screen. I call a function from render(){} like this if(Gdx.input.isTouched()) { if(lr.contains(Gdx.input.getX(), Gdx.input.getY())){ //start animation 1-2-3-3-2-1 complete kick myAnimation(); //this is my function. code below, batch.begin(); sprite.draw(batch); batch.end(); } } myAnimation() is where i create a new task. to understand every movement i kept interval 5sec. myAnimation() private void myAnimation(){ Timer.schedule(new Task() { @Override public void run() { // TODO Auto-generated method stub if(positiveCycle){ currentFrame++; if(currentFrame&gt;3) { positiveCycle = false; currentFrame = 3; } }else{ currentFrame--; if(currentFrame==0){ //get out of this loop currentFrame = 1; positiveCycle = true; this.cancel(); } } currentAtlasKey = String.format("%04d", currentFrame); sprite.setRegion(textureAtlas.findRegion(currentAtlasKey)); } } } But when I touch the screen i do not see each spite after 5 sec interval, Its kind of very quick to show the sprite. like less then 20 milliseconds. The complete code package com.geek.tanvir.KickingGame; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL10; //import com.badlogic.gdx.graphics.GLTexture; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Sprite; //import com.badlogic.gdx.graphics.Texture.TextureFilter; //import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; //import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.utils.Timer; import com.badlogic.gdx.utils.Timer.Task; public class KickingGame implements ApplicationListener { private OrthographicCamera camera; private SpriteBatch batch; private Texture te…
has answer: http://stackoverflow.com/a/22662132
has title: how can i start an animation on touch which will stop after reaching the end of spritesheet?

http://stackoverflow.com/a/66665947
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22573064
score: 2
downvote count: 0
has body: You can get by without a bat file by running from the command line (with admin privileges) assoc .xox=Xoxfile ftype Xoxfile=C:\Program Files\Java\jre1.5.0\bin\javaw -jar c:\dev\work\y.jar %1 (correcting for the path to your current jre and path to your jar). Since .txt is already a defined filetype in windows, I think you could skip the assoc command and replace Xoxfile above with ftype "Text Document"=C:\Program Files\Java\jre1.5.0\bin\java -jar c:\dev\work\y.jar but I've only done this with a new custom file type. https://www.rgagnon.com/javadetails/java-0592.html

http://stackoverflow.com/comment/75641711
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22567843
has text: With all respect, you're flooding in a glass of water: you're putting too much code for a simple question. Besides: the error message is pretty clear, I think
score: 0

thread-safety
tags question: http://stackoverflow.com/q/22589315
tags question: http://stackoverflow.com/q/22575387
tags question: http://stackoverflow.com/q/22542721
tags question: http://stackoverflow.com/q/22528306
tag name: thread-safety
tags question: http://stackoverflow.com/q/22560235
tags question: http://stackoverflow.com/q/22565155
tags question: http://stackoverflow.com/q/22514877
tags question: http://stackoverflow.com/q/22566131
type: Tag
tags question: http://stackoverflow.com/q/22632552
tags question: http://stackoverflow.com/q/22528713

concurrenthashmap
tags question: http://stackoverflow.com/q/22607983
tag name: concurrenthashmap
tags question: http://stackoverflow.com/q/22541210
tags question: http://stackoverflow.com/q/22629431
type: Tag

http://stackoverflow.com/a/22574471
has body: According to the book "Essential JNI Java Native Interface", it is the implementation of the JVM that decides whether a copy is done or not. So no, you have no control over the copying.
upvote count: 3
has comment: http://stackoverflow.com/comment/34364484
accepted answer of: http://stackoverflow.com/q/22573602
answers question: http://stackoverflow.com/q/22573602
has comment: http://stackoverflow.com/comment/34368592
has comment: http://stackoverflow.com/comment/34374032
has comment: http://stackoverflow.com/comment/34385667
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34369192
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/comment/34366123
comment on: http://stackoverflow.com/a/22576042
has text: @mok The JLS definition is actually that a `{}` block itself is a kind of statement.
type: Comment
score: 0
type: AnswerComment

spring
tags question: http://stackoverflow.com/q/22555436
tags question: http://stackoverflow.com/q/22598430
tags question: http://stackoverflow.com/q/22518094
tags question: http://stackoverflow.com/q/22558318
tags question: http://stackoverflow.com/q/22551159
tags question: http://stackoverflow.com/q/22627759
tags question: http://stackoverflow.com/q/22539196
tags question: http://stackoverflow.com/q/22629881
tags question: http://stackoverflow.com/q/22533399
tags question: http://stackoverflow.com/q/22547238
tags question: http://stackoverflow.com/q/22550823
tags question: http://stackoverflow.com/q/22622085
tags question: http://stackoverflow.com/q/22557396
tags question: http://stackoverflow.com/q/22531996
tags question: http://stackoverflow.com/q/22597665
tags question: http://stackoverflow.com/q/22618749
tags question: http://stackoverflow.com/q/22628572
tags question: http://stackoverflow.com/q/22569866
tags question: http://stackoverflow.com/q/22560782
tags question: http://stackoverflow.com/q/22491638
tags question: http://stackoverflow.com/q/22609601
tags question: http://stackoverflow.com/q/22501133
tags question: http://stackoverflow.com/q/22585460
tags question: http://stackoverflow.com/q/22497615
tags question: http://stackoverflow.com/q/22593661
tags question: http://stackoverflow.com/q/22534032
tags question: http://stackoverflow.com/q/22557138
tags question: http://stackoverflow.com/q/22547715
tags question: http://stackoverflow.com/q/22526020
tags question: http://stackoverflow.com/q/22507129
tags question: http://stackoverflow.com/q/22558567
tags question: http://stackoverflow.com/q/22642851
tags question: http://stackoverflow.com/q/22534763
tags question: http://stackoverflow.com/q/22629400
tags question: http://stackoverflow.com/q/22551420
tags question: http://stackoverflow.com/q/22612689
tags question: http://stackoverflow.com/q/22499851
tags question: http://stackoverflow.com/q/22641096
tags question: http://stackoverflow.com/q/22604064
tags question: http://stackoverflow.com/q/22645319
tags question: http://stackoverflow.com/q/22644510
tags question: http://stackoverflow.com/q/22647279
tags question: http://stackoverflow.com/q/22498758
tags question: http://stackoverflow.com/q/22528587
tags question: http://stackoverflow.com/q/22537769
tags question: http://stackoverflow.com/q/22600013
tags question: http://stackoverflow.com/q/22569942
tags question: http://stackoverflow.com/q/22555058
type: Tag
tags question: http://stackoverflow.com/q/22563591
tags question: http://stackoverflow.com/q/22612320
tags question: http://stackoverflow.com/q/22637722
tags question: http://stackoverflow.com/q/22630523
tags question: http://stackoverflow.com/q/22644292
tags question: http://stackoverflow.com/q/22558269
tags question: http://stackoverflow.com/q/22501291
tags question: http://stackoverflow.com/q/22554000
tags question: http://stackoverflow.com/q/22544490
tags question: http://stackoverflow.com/q/22633668
tags question: http://stackoverflow.com/q/22573302
tags question: http://stackoverflow.com/q/22575136
tags question: http://stackoverflow.com/q/22631024
tags question: http://stackoverflow.com/q/22622125
tags question: http://stackoverflow.com/q/22569902
tags question: http://stackoverflow.com/q/22490660
tags question: http://stackoverflow.com/q/22579613
tags question: http://stackoverflow.com/q/22614854
tags question: http://stackoverflow.com/q/22597123
tags question: http://stackoverflow.com/q/22602239
tags question: http://stackoverflow.com/q/22598186
tags question: http://stackoverflow.com/q/22506184
tags question: http://stackoverflow.com/q/22601834
tags question: http://stackoverflow.com/q/22531728
tags question: http://stackoverflow.com/q/22572701
tags question: http://stackoverflow.com/q/22517429
tags question: http://stackoverflow.com/q/22508773
tags question: http://stackoverflow.com/q/22570163
tags question: http://stackoverflow.com/q/22561468
tags question: http://stackoverflow.com/q/22606636
tags question: http://stackoverflow.com/q/22539126

http://stackoverflow.com/q/22641639
has comment: http://stackoverflow.com/comment/34487154
has comment: http://stackoverflow.com/comment/34483948
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34484996
has answer: http://stackoverflow.com/a/22642081
has answer: http://stackoverflow.com/a/22666236
has title: Servlet and Hibernate - won't open the session
has comment: http://stackoverflow.com/comment/34485379
has comment: http://stackoverflow.com/comment/34485255
has body: I have this DAO class, which connects with the database via Hibernate: public class ChartDAO { public static ChartData getChartData(){ Session session = null; List data; try { try { session = HibUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); data = session.createQuery("FROM ChartData").list(); tx.commit(); } catch (Exception e) { e.printStackTrace(); data = new ArrayList(); data.add(new ChartData()); } } finally { session.disconnect(); session.close(); try { HibUtil.close(); } catch (Exception e){ e.printStackTrace(); } } ChartData chartData = (ChartData) data.get(0); return chartData; } public static void main(String[] args) throws Exception{ ChartData cd = getChartData(); } } When I run the main method, in which i invoke getChartData(), everything works fine (checked in debugger - the session gets opened and the data is being retrieved). However, when I tried to call the same method from the servlet, the data is not being retrieved. I checked with the debugger - it "freezes" for a while when attempting to open the hibernate session and then immediately jumps to the 'finally' block. What am I doing wrong? Thanks. EDIT: Below is my HibUtil: public class HibUtil { private static ServiceRegistry serviceRegistry; private static final SessionFactory sessionFactory; static { try { Configuration configuration = new Configuration(); configuration.configure(); serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); } catch (Throwable ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } public static void close() throws Exception{ if(serviceRegistry!= null) { StandardServiceRegistryBuilder.destroy(serviceRegistry); } } } UPDATE: This is the Apache Tomcat Log when I Try to call…
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34485874
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/34483325
has comment: http://stackoverflow.com/comment/34485036
answer count: 2
has comment: http://stackoverflow.com/comment/34485407
has comment: http://stackoverflow.com/comment/34527899
has comment: http://stackoverflow.com/comment/34483822
score: 0
has comment: http://stackoverflow.com/comment/34483389
has comment: http://stackoverflow.com/comment/34485186
has comment: http://stackoverflow.com/comment/34485458

http://stackoverflow.com/comment/34257092
comment on: http://stackoverflow.com/q/22514267
type: Comment
type: QuestionComment
has text: Have you tried "yyyyMMddHHmmss" with big letter H?
score: 1

http://stackoverflow.com/comment/34329076
comment on: http://stackoverflow.com/q/22533362
has text: @Shriam addMenuListener works only for JMenu and not for JMenuItem
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22646930
upvote count: 7
type: Question
accepted answer: http://stackoverflow.com/a/24232973
has comment: http://stackoverflow.com/comment/34577526
answer count: 3
has answer: http://stackoverflow.com/a/33650825
downvote count: 0
tagged with: maven-plugin
favorite count: 0
has body: I'm using Android Studio with Maven 3.1.1 and in the package goal it crashes with a MojoExecutionException. I have readed lot of posts but I can't get the solution. [ERROR] Error when generating sources. org.apache.maven.plugin.MojoExecutionException: at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:593) at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:216) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:22…
tagged with: exception
tagged with: android
tagged with: maven
has answer: http://stackoverflow.com/a/31183966
has answer: http://stackoverflow.com/a/24232973
type: AnsweredQuestion
score: 7
possible better answer: http://stackoverflow.com/a/31183966
tagged with: java
has title: MojoExecutionException: Maven with Android

http://stackoverflow.com/q/22621994
upvote count: 0
has title: Using an object and accessor methods
possible better answer: http://stackoverflow.com/a/22622047
score: -1
has answer: http://stackoverflow.com/a/22622047
accepted answer: http://stackoverflow.com/a/22622020
favorite count: 0
downvote count: 1
tagged with: object
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22622020
type: Question
answer count: 2
has body: Alright, so I created a seperate class that has accessor and mutator methods, constructors, etc etc. It compiles all fine no problem. Now I have this demo class that is supposed to use the information from the other class to produce a result. Simple enough, however I'm getting some errors. I think the problem may be simple but I just cant figure it out. Heres the errors: EmployeeDemoWilson.java:19: error: ')' expected System.out.println("Employee ID Number " + emp1.getIdNumber() + " is " emp1.getName() + ". Susan is the " emp1.getPosition() ^ EmployeeDemoWilson.java:19: error: illegal start of expression System.out.println("Employee ID Number " + emp1.getIdNumber() + " is " emp1.getName() + ". Susan is the " emp1.getPosition() ^ EmployeeDemoWilson.java:19: error: ';' expected System.out.println("Employee ID Number " + emp1.getIdNumber() + " is " emp1.getName() + ". Susan is the " emp1.getPosition() ^ EmployeeDemoWilson.java:20: error: not a statement + " of the " + emp1.getDepartment() + " department."); ^ EmployeeDemoWilson.java:20: error: ';' expected + " of the " + emp1.getDepartment() + " department."); ^ 5 errors Heres the code in which the error is coming from: public class EmployeeDemo { public static void main (String [] args) { // Creating the employee objects. Employee emp1 = new Employee("Susan Meyers", 47899, "Accounting", "Vice President"); Employee emp2 = new Employee("Mark Jones", 39119, "IT", "Programmer"); Employee emp3 = new Employee("Joy Rogers", 81774, "Manufacturing", "Engineer"); //Displayng the employee information. System.out.println("Employee ID Number " + emp1.getIdNumber() + " is " emp1.getName() + ". Susan is the " emp1.getPosition() + " of the " + emp1.getDepartment() + " department."); } } Heres the original class that has the constructors, methods and so what and so forth. It compiles fine. public class Employee { // A reference to a string object that holds the employee's name private String name; // An int variable that holds the emp…

http://stackoverflow.com/comment/34403613
type: QuestionComment
comment on: http://stackoverflow.com/q/22595234
has text: It seems like you are misunderstanding what the wildcard indicates. The wildcard doesn't have to do with what kind of `Notifiable` can be added to the set, but rather what kind of `Set` can be put in the reference variable. Actually you can't add anything to a `Set<? extends Notifiable>`.
score: 2
type: Comment

http://stackoverflow.com/comment/34445513
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22618211
has text: Is it calling the binding at all? Or throwing an error?

http://stackoverflow.com/comment/34286921
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22510925
has text: The OSGi framework does not care about the versions when updating a bundle. It will replace the bundle with whatever you provide in the update call. So you can upgrade and downgrade a bundle via update.
type: AnswerComment

http://stackoverflow.com/a/22611430
type: Answer
answers question: http://stackoverflow.com/q/22611213
score: 0
has body: This $result = mysql_query("SELECT *FROM Apps WHERE pid[0] = $pid" AND pid[1] = $pid" AND ...); Is very wrong and unsafe. (Columns wrong syntax, SQL injection, wrong quotation, wrong SQL syntax,...) Must be something like $result = mysql_query(" SELECT * FROM Apps WHERE pid IN(" . implode(',', mysql_real_escape_string($pid)) . ") ");

http://stackoverflow.com/a/22640224
score: 2
upvote count: 2
has body: As AllenKll already pointed out, the high value should probably take the role that you intended for your index. You have been counting the number of occurances in the high variable, but this counting can be "hidden" in the recursion. The purpose of these "helper" methods for recursion in general is exactly that: They usually have (at least) one additional parameter that somehow describes how far the recursion has already proceeded or how far it still has to proceed. As an example for the latter: You could also have used the high variable as a "countdown", by writing public static int count(char[] chars, char ch) { return count(chars, ch, chars.length - 1); } public static int count(char[] chars, char ch, int high) { if (high == -1) { return 0; } if (chars[high] == ch) { return 1 + count(chars, ch, high - 1); } return count(chars, ch, high - 1); } Of course, one could only offer the helper method. Instead of calling count(chars, ch); you could ask the user to call count(chars, ch, 0); But the problem here is that this method may be misused: When then user passes a wrong value as the last parameter, then the method will not work. Note: This whole "helper method" thing only makes sense when the helper method is private. When it is public, the user may still call the wrong method. I see that the public modifier was requested in the task description, but... maybe you'll receive some bonus points when you make your instructor aware of this flaw ;-)
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22639797
type: Answer
accepted answer of: http://stackoverflow.com/q/22639797

printstream
tags question: http://stackoverflow.com/q/22569178
type: Tag
tag name: printstream

http://stackoverflow.com/comment/34269031
comment on: http://stackoverflow.com/a/22520399
type: AnswerComment
score: 0
type: Comment
has text: @Sharpedge Dude! almost there okay so basically the first item is [Travel Standard, Fixed Standard] as one option but I want them broken down into individual options. :D This is exciting! When I run the GUI I can see the first option in the combo box means almost there :D

http://stackoverflow.com/q/22562908
has answer: http://stackoverflow.com/a/22563117
type: Question
has comment: http://stackoverflow.com/comment/34342804
has answer: http://stackoverflow.com/a/22564177
has body: I am supposed to write a program using command line arguments to put in 3 different files, a human DNA sequence, a mouse DNA sequence, and an unknown sequence. Without using arrays, I have to compare each character and give the percent match as well aas which one it closely matches up to. Here is what I have so far import java.io.File; import java.io.FileInputStream; import java.io.DataInputStream; import java.io.*; public class Lucas_Tilak_Hw8_DNA { public static void main (String args[]) throws IOException { //First let's take in each file File MouseFile = new File(args[0]); File HumanFile = new File(args[1]); File UnknownFile = new File(args[2]); //This allows us to view individual characters FileInputStream m = new FileInputStream(MouseFile); FileInputStream h = new FileInputStream(HumanFile); FileInputStream u = new FileInputStream(UnknownFile); //This allows us to read each character one by one. DataInputStream mouse = new DataInputStream(m); DataInputStream human = new DataInputStream(h); DataInputStream unk = new DataInputStream(u); //We initialize our future numerators int humRight = 0; int mouRight = 0; //Now we set the counting variable int countChar = 0; for( countChar = 0; countChar &lt; UnknownFile.length(); countChar++); { //initialize char unkChar = unk.readChar(); char mouChar = mouse.readChar(); char humChar = human.readChar(); //add to numerator if they match if (unkChar == humChar) { humRight++; } if (unkChar == mouChar) { mouRight++; } //add to denominator countChar++; } //convert to fraction long mouPercent = (mouRight/countChar); long humPercent = (humRight/countChar); //print fractions System.out.println("Mouse Compare: " + mouPercent); System.out.println("Human Compare: " + humPercent); if (mouPercent &gt; humPercent) { System.out.println("mouse"); } else if (mouPercent &lt; humPercent) { System.out.println("human"); } else { System.out.println("identity cannot be determined"); } } } If I put in random code {G, T, C, A} for each file I use, …
possible better answer: http://stackoverflow.com/a/22563117
answer count: 2
tagged with: char
tagged with: file-io
upvote count: 1
has comment: http://stackoverflow.com/comment/34342201
has comment: http://stackoverflow.com/comment/34342349
has comment: http://stackoverflow.com/comment/34342397
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22564177
downvote count: 0
score: 1
tagged with: java
has title: Character Matching DNA Program

http://stackoverflow.com/comment/34401615
type: QuestionComment
has text: @TylerDurden I also noticed that you are cheating in your benchmark, because usually you would have indirection even for the "parallel arrays" case, if I understood your question correctly. So it's double busted, because even having *more* indirection doesn't cause the slowness you claim (in fact the cache efficiency is much more important than the indirection)
comment on: http://stackoverflow.com/q/22594894
score: 0
type: Comment

http://stackoverflow.com/comment/34232751
comment on: http://stackoverflow.com/q/22500558
score: 0
type: Comment
has text: anyone plz?? resolve this trouble
type: QuestionComment

http://stackoverflow.com/a/22632755
type: Answer
has comment: http://stackoverflow.com/comment/34468599
has comment: http://stackoverflow.com/comment/34469754
score: 3
has comment: http://stackoverflow.com/comment/34468686
accepted answer of: http://stackoverflow.com/q/22632363
has comment: http://stackoverflow.com/comment/34470042
upvote count: 3
answers question: http://stackoverflow.com/q/22632363
has comment: http://stackoverflow.com/comment/34469870
has comment: http://stackoverflow.com/comment/34469187
has comment: http://stackoverflow.com/comment/34469694
type: AcceptedAnswer
downvote count: 0
has body: Use this to get the current Child position: flipper.getDisplayedChild(); And this to set child number to view: flipper.setDisplayedChild(4); Add an animation listener to the animation object you set as the viewflipper's 'IN' animation. Overide the listeners onAnimationEnd method, and inside that method check if(flipper.getDisplayedChild() == 4) visible your GO Button else hide your button
has comment: http://stackoverflow.com/comment/34469269

http://stackoverflow.com/comment/34345855
has text: I already posted it...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22553413
score: 0

http://stackoverflow.com/q/22492200
has comment: http://stackoverflow.com/comment/34221275
has answer: http://stackoverflow.com/a/22493742
tagged with: http://stackoverflow.com/tag/xml
has title: Java parse XML with many levels
tagged with: java
downvote count: 1
type: Question
has body: I have a complex xml string that i have to parse i retrieve some data, here is the content : something something <C> <D> DataE DataF <G>something</G> <H>something</H> <J> DataK DataL </J> </D> <D> DataE DataF <G>something</G> <H>something</H> <J> DataK DataL </J> </D> </C> I would like to print the content of GetE, GetF, GetK and GetL : for example : GetE = DataE,GetF = DataF,GetK = DataK,GetL = DataL GetE = DataE,GetF = DataF,GetK = DataK,GetL = DataL ... To convert my String data to an XML, I use this function In Java, how do I parse XML as a String instead of a file? Any idea please ?
score: -1
linked to: http://stackoverflow.com/q/2811001
linked to: http://stackoverflow.com/q/22493545
has comment: http://stackoverflow.com/comment/34221225
has comment: http://stackoverflow.com/comment/34219432
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/34218967
has comment: http://stackoverflow.com/comment/34219225
has answer: http://stackoverflow.com/a/22493925
favorite count: 0
tagged with: parsing
linked to: http://stackoverflow.com/q/562160
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34219014

http://stackoverflow.com/comment/34319849
type: QuestionComment
has text: If I have a hypothetical 800x800 array of colour values that I want to export as a png file of the above resolution, how exactly would I do that?
score: 0
comment on: http://stackoverflow.com/q/22549302
type: Comment

http://stackoverflow.com/a/23040731
has comment: http://stackoverflow.com/comment/84569605
has comment: http://stackoverflow.com/comment/35491293
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35492270
answers question: http://stackoverflow.com/q/22567831
has comment: http://stackoverflow.com/comment/103835212
score: 7
accepted answer of: http://stackoverflow.com/q/22567831
has comment: http://stackoverflow.com/comment/35492468
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35521786
has body: This works for JDK 7+ (for JDK 6, look at the next figure): configurations { console } dependencies { // ... compile dependencies, runtime dependencies, etc. console 'commons-cli:commons-cli:1.2' console('jline:jline:2.11') { exclude(group: 'junit', module: 'junit') } console 'org.codehaus.groovy:groovy-groovysh:2.2.+' } task(console, dependsOn: 'classes') &lt;&lt; { def classpath = sourceSets.main.runtimeClasspath + configurations.console def command = [ 'java', '-cp', classpath.collect().join(System.getProperty('path.separator')), 'org.codehaus.groovy.tools.shell.Main', '--color' ] def proc = new ProcessBuilder(command) .redirectOutput(ProcessBuilder.Redirect.INHERIT) .redirectInput(ProcessBuilder.Redirect.INHERIT) .redirectError(ProcessBuilder.Redirect.INHERIT) .start() proc.waitFor() if (0 != proc.exitValue()) { throw new RuntimeException("console exited with status: ${proc.exitValue()}") } } To make this work for JDK 6, I modified the solution from https://stackoverflow.com/a/4274535/206543. My solution is tailored to a standard Linux terminal, so if you are running a shell that uses a char sequence other than '\n' for newlines or that encodes backspaces as a value other other 127, you may need to modify it some. I didn't determine how to make colors print correctly, so its output is rather monotone, but it will get the job done: configurations { console } dependencies { // ... compile dependencies, runtime dependencies, etc. console 'commons-cli:commons-cli:1.2' console('jline:jline:2.11') { exclude(group: 'junit', module: 'junit') } console 'org.codehaus.groovy:groovy-groovysh:2.2.+' } class StreamCopier implements Runnable { def istream def ostream StreamCopier(istream, ostream) { this.istream = istream this.ostream = ostream } void run() { int n def buffer = new byte[4096] while ((n = istream.read(buffer)) != -1) { ostream.write(buffer, 0, n) ostream.flush() } } } class InputCopier implements Runnable { def istream def ostream def stdout InputCopier(istream…

http://stackoverflow.com/q/22587568
has answer: http://stackoverflow.com/a/22588005
answer count: 1
has comment: http://stackoverflow.com/comment/34387364
favorite count: 0
has comment: http://stackoverflow.com/comment/34387066
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has body: i m new to sms lib api i never used api's before please would you give me some help how to use it from strart to end for sending and receiving sms using Gsm modem in eclipse. please it is an emergency my final year project is based upon it. please it will be a great favour..thanks in advance
tagged with: smslib
has comment: http://stackoverflow.com/comment/34389209
type: Question
has comment: http://stackoverflow.com/comment/34387401
has title: How to send and receive sms using sms lib api
tagged with: java
has comment: http://stackoverflow.com/comment/34388067
has comment: http://stackoverflow.com/comment/34387369
score: 0

http://stackoverflow.com/comment/34358668
has text: You can do this, but there's generally a better way. Generics are preferable to casting these days. Could you give us some more context?
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22571681

arrays
tags question: http://stackoverflow.com/q/22553843
tags question: http://stackoverflow.com/q/22494182
tags question: http://stackoverflow.com/q/22583059
tags question: http://stackoverflow.com/q/22588879
tags question: http://stackoverflow.com/q/22518039
tags question: http://stackoverflow.com/q/22506791
tags question: http://stackoverflow.com/q/22643450
tags question: http://stackoverflow.com/q/22493668
tags question: http://stackoverflow.com/q/22494341
tags question: http://stackoverflow.com/q/22626713
tags question: http://stackoverflow.com/q/22598989
tags question: http://stackoverflow.com/q/22552874
type: Tag
tags question: http://stackoverflow.com/q/22636060
tags question: http://stackoverflow.com/q/22621702
tags question: http://stackoverflow.com/q/22587089
tags question: http://stackoverflow.com/q/22594212
tags question: http://stackoverflow.com/q/22596357
tags question: http://stackoverflow.com/q/22490092
tags question: http://stackoverflow.com/q/22506927
tags question: http://stackoverflow.com/q/22639421
tags question: http://stackoverflow.com/q/22589528
tags question: http://stackoverflow.com/q/22586065
tags question: http://stackoverflow.com/q/22580124
tags question: http://stackoverflow.com/q/22500236
tags question: http://stackoverflow.com/q/22504624
tags question: http://stackoverflow.com/q/22553549
tags question: http://stackoverflow.com/q/22493102
tags question: http://stackoverflow.com/q/22512242
tags question: http://stackoverflow.com/q/22487945
tags question: http://stackoverflow.com/q/22602495
tags question: http://stackoverflow.com/q/22534725
tags question: http://stackoverflow.com/q/22621535
tags question: http://stackoverflow.com/q/22629232
tags question: http://stackoverflow.com/q/22609726
tags question: http://stackoverflow.com/q/22616781
tags question: http://stackoverflow.com/q/22561692
tags question: http://stackoverflow.com/q/22645321
tags question: http://stackoverflow.com/q/22573483
tags question: http://stackoverflow.com/q/22552621
tags question: http://stackoverflow.com/q/22503005
tags question: http://stackoverflow.com/q/22512865
tags question: http://stackoverflow.com/q/22590357
tags question: http://stackoverflow.com/q/22512193
tags question: http://stackoverflow.com/q/22596052
tags question: http://stackoverflow.com/q/22522858
tags question: http://stackoverflow.com/q/22529102
tags question: http://stackoverflow.com/q/22493609
tags question: http://stackoverflow.com/q/22528225
tags question: http://stackoverflow.com/q/22494775
tags question: http://stackoverflow.com/q/22601081
tags question: http://stackoverflow.com/q/22620003
tags question: http://stackoverflow.com/q/22547407
tags question: http://stackoverflow.com/q/22625673
tags question: http://stackoverflow.com/q/22594894
tags question: http://stackoverflow.com/q/22493120
tags question: http://stackoverflow.com/q/22592963
tags question: http://stackoverflow.com/q/22517765
tags question: http://stackoverflow.com/q/22558116
tags question: http://stackoverflow.com/q/22514654
tags question: http://stackoverflow.com/q/22565684
tags question: http://stackoverflow.com/q/22533556
tags question: http://stackoverflow.com/q/22555865
tags question: http://stackoverflow.com/q/22542746
tags question: http://stackoverflow.com/q/22634450
tags question: http://stackoverflow.com/q/22521917
tags question: http://stackoverflow.com/q/22587381
tags question: http://stackoverflow.com/q/22534635
tags question: http://stackoverflow.com/q/22576162
tags question: http://stackoverflow.com/q/22576430
tags question: http://stackoverflow.com/q/22567547
tags question: http://stackoverflow.com/q/22548441
tags question: http://stackoverflow.com/q/22585950
tags question: http://stackoverflow.com/q/22494917
tags question: http://stackoverflow.com/q/22581556
tags question: http://stackoverflow.com/q/22600546
tags question: http://stackoverflow.com/q/22586833
tags question: http://stackoverflow.com/q/22546834
tags question: http://stackoverflow.com/q/22597312
tags question: http://stackoverflow.com/q/22511598

http://stackoverflow.com/a/22599796
accepted answer of: http://stackoverflow.com/q/22592758
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34474371
type: Answer
has body: The general approach is not to automate client side. So you generate a PDF or word or perhaps even a rich text file server side then THEN provide a URL/link for the user to click on. The user can then click on that URL (file) and the local client side software (either browser or word) can then open + render that file. So a browser is quite happy to allows one to open a PDF or word (rtf) file FROM server side in the client side. And this includes opening such files with Word. Attempting to launch CLIENT side software from a browser is not only a “high” risk adventure but if you setup such computers to allow the browser to create + launch + run + use such files client side then you open a security hole the size of a barn door. What is to say with such security holes being opened the next site will not open or scan or look for files like “banking” or personal finance? So you really do not want nor can you attempt to automate client side software from a web browser. However creating a PDF or even using some kind of web based report writer, they often have a “web export” option that creates a PDF or even Word format file that can be opened local. For example SQL server reporting services has a great PDF and Word export feature. In fact if you using Access web services (that is Access web publishing for 2010), then the Access web reports render these reports near “perfect” in word and in fact Web Access Reports render better in Word then do client based Access applications! So for example, looking at an Access Web based Report, you see this option: If you click on actions then you get this option in the web browser: Now, when you click on that, you can choose PDF or Word and your LOCAL client opens + renders the report. Really nice is all graphics and formatting is preserved in the web report (unlike client reports that loose their graphics). The above of course is using Access Web publishing which just so happens to use SQL server reporting services. The “key” suggesting…
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22592758

http://stackoverflow.com/a/22589274
has body: The XSD seems to define deLabel, enLabel, key (in this order) as sub-elements of intElement (actually as sub-elements of its parent elementWindow), and you're trying to use them in the XML file as attributes of intElement.
score: 0
accepted answer of: http://stackoverflow.com/q/22589052
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22589052
type: Answer

http://stackoverflow.com/q/22561016
tagged with: jscrollpane
answer count: 1
type: UnansweredQuestion
tagged with: swing
has body: I want to add a grid to the current GridLayout with a filled JTextArea component. It works fine, but as mentioned in the title the JTextArea won't resizes itself after changing the size of frame. I have already localized the error: text.setLineWrap(true); //&lt;--- here is the problem!!enter code here in the method createGui. Here is my Code: import java.awt.*; import java.awt.event.*; import javax.swing.*; class GridLayoutExample { private JFrame frame = new JFrame(); private JPanel panel = new JPanel(); private JScrollPane pane; final JTextArea text = new JTextArea("Click me!\nClick me!\nClick me!\nClick me!\nClick me!"); GridLayoutExample() { createGui(); } //constrcutor private JPanel createGui () { panel.setLayout(new GridLayout(0, 2,0,0)); panel.add( new JLabel("Hello")); //set style of first row, second column text.setLineWrap(true); //&lt;--- here is the problem!! text.setEditable(true); //enable mouse listening and allow mouse action doMouseActions(); panel.add(text); return panel; } void addNewRow() { panel.add(new JLabel("Test1")); panel.add(new JTextField("Test")); }//addNewRow void showFrame() { pane = new JScrollPane(panel); frame.add(pane); frame.pack(); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }//showframe void doMouseActions() { text.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent arg0) { addNewRow(); } @Override public void mouseEntered(MouseEvent arg0) { text.setBackground(Color.YELLOW); } @Override public void mouseExited(MouseEvent arg0) { text.setBackground(Color.WHITE); } @Override public void mousePressed(MouseEvent arg0) {} @Override public void mouseReleased(MouseEvent arg0) {} }); } // end of mouse action public static void main(String[] args) { GridLayoutExample test = new GridLayoutExample(); test.showFrame(); }// end of main }// class GridLayoutExampleenter code here On the one hand It works fine when I disable line wrapping, on the other hand I need it to get the…
tagged with: java
has answer: http://stackoverflow.com/a/22561347
type: Question
tagged with: jtextarea
has title: adding a ScrollPane in a GridLayout doesn't resizes the JTextarea in a JPane when changing size of JFrame
score: 0

http://stackoverflow.com/comment/34437857
has text: Are you doing resource hungry things like ``Domain.all.size()`` or ``Domain.all.find{}`` etc instead of solving this problems using proper queries?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22606478

multi-tenant
tags question: http://stackoverflow.com/q/22562770
tags question: http://stackoverflow.com/q/22493607
tag name: multi-tenant
type: Tag
tags question: http://stackoverflow.com/q/22639513

http://stackoverflow.com/comment/34379871
type: Comment
type: AnswerComment
has text: ok sorry I have just understood what is going on ! thank you very much
comment on: http://stackoverflow.com/a/22582025
score: 0

http://stackoverflow.com/comment/34384311
type: Comment
type: QuestionComment
score: 0
has text: @fge, I don't follow. I am using the joda-time library for what it's worth.
comment on: http://stackoverflow.com/q/22585807

http://stackoverflow.com/comment/34225205
type: QuestionComment
has text: maybe you could transform this format into XML, then you'd have lots of tools ready to use
comment on: http://stackoverflow.com/q/22495935
score: 0
type: Comment

http://stackoverflow.com/comment/34393339
has text: I think it would helpfull for huge count of beginner developers
comment on: http://stackoverflow.com/a/22591077
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22620512
score: 0
has body: looks like you did not initialize your subtractButton before setting the OnClickListener here: subtractButton.setOnClickListener(subtractClicked); the same for the addButton. ==> calling methods on not initialized Objects will lead to a NullPointerException (NPE) BTW: you may want to actually use the layout xml. I wonder why you never make use of findViewById method to look up elements inside the R.layout.activity_main ?
has comment: http://stackoverflow.com/comment/34447680
has comment: http://stackoverflow.com/comment/34486744
has comment: http://stackoverflow.com/comment/34486430
type: Answer
has comment: http://stackoverflow.com/comment/34446921
answers question: http://stackoverflow.com/q/22620391

http://stackoverflow.com/comment/34388439
comment on: http://stackoverflow.com/a/22576740
type: AnswerComment
has text: @ Robert Scholte but if I use only servlet container Tomcat
score: 0
type: Comment

http://stackoverflow.com/q/22562450
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34341740
score: 1
tagged with: java
has body: I was trying to design the following view in my photo album app, and I finally did something after I ask that to the StackOverflow. As I read about layout_weight attribute, when it is used in a nested structure, it may couse some performance problems. I'm planning to use the following layout for repeated rows by loading while the user slides the screen down. Here is the layout : Here is the code : Please note that I put the "button" just for test, they will be ImageView. I only used LinearLayout. Does it the right way to have this view (according to performance) ? I wrote just 2 rows for now, it is gonna have more rows that are created dynamically on run time later. Does it get slow when the row count reaches, maybe 20 ? Should I change the apporach to have this view ? Thanks
upvote count: 1
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/22562568
answer count: 1
downvote count: 0
has title: LinearLayout performance with layout_weight attribute
favorite count: 0

http://stackoverflow.com/comment/34370948
has text: @JB Nizet `if (line.startsWith("#1"))` makes sense, thank you. However, it still reads the first line only. How can I make it read the other lines as well, so that it can reach #1?
comment on: http://stackoverflow.com/a/22578822
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22642433
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Although I believe the method will work (if beingCountedNode is set properly before the call. See @peter.petrov answer), it is weird to use instance variables as parameters for a function. I think the recursive function should have the signature int Count( Node node ) which returns the number of nodes after (including) the given Node. // returns the number of nodes in the list public int Count(){ return CountHelper( head ); } // helper recursive function // returns the number of nodes in the list after and including "node". // call with head of the list to get the count of all nodes. private int CountHelper( Node node ) { if( node == null ) return 0; else return 1 + CountHelper( node.getNext() ); } Also note in your current example, you never reset count, so if I call RecNodeCount() twice in a row, your method will tell me the count is twice what it actually is. Edit, actually I guess it wouldn't since beingCountedNode would be null, but it is still weird to do it this way.
answers question: http://stackoverflow.com/q/22642231
accepted answer of: http://stackoverflow.com/q/22642231
has comment: http://stackoverflow.com/comment/34485426
type: AcceptedAnswer

http://stackoverflow.com/q/22622034
tagged with: java
has answer: http://stackoverflow.com/a/22630754
type: Question
has title: Frosted Glass Effect in JavaFX?
tagged with: user-interface
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/22663681
tagged with: blur
score: 16
favorite count: 0
accepted answer: http://stackoverflow.com/a/22630754
tagged with: javafx-2
linked to: http://stackoverflow.com/q/25534204
has body: I'm making an iOS7-themed JavaFX2/FXML project and I was wondering how I could make a Rectangle object have a iOS7-like frosted glass effect. I'd also like it to have a small shadow. This is tricky, since you might be able to see the shadow behind the semi-transparent object. I'd just like it to be present around the edges. Is this possible? Here's a picture showing the desired effect (not including the small drop-shadow): UPDATE: Here's a continuation of the issue. This is going to look amazing :D.
upvote count: 16
type: AnsweredQuestion
tagged with: ios7

http://stackoverflow.com/comment/34395626
comment on: http://stackoverflow.com/a/22584929
has text: My problem is that when you drag the corner of the frame to make it bigger, the checkerboard just remains the one size. @tethernova
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34251094
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22508261
has text: @fashuser: Edited. That's probably a little more than what you asked but regex are fun.
score: 0

http://stackoverflow.com/q/22625379
upvote count: 1
tagged with: swing
tagged with: jbutton
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34455110
has answer: http://stackoverflow.com/a/22625449
has body: Example below will display a button with jframe window. I want only button visible, how can it be implement? public final void initUI() { JPanel panel = new JPanel(); getContentPane().add(panel); panel.setLayout(null); JButton quitButton = new JButton("Quit"); quitButton.setBounds(50, 60, 80, 30); quitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); panel.add(quitButton); setTitle("Quit button"); setSize(300, 200); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); }
has title: how to display only button with out jframe or jpanel visible?
answer count: 1
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22625449
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34455150
tagged with: jframe

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/22583308
tags question: http://stackoverflow.com/q/22579387
tags question: http://stackoverflow.com/q/22561870
type: Tag
tags question: http://stackoverflow.com/q/22499511
tags question: http://stackoverflow.com/q/22562391

http://stackoverflow.com/q/22634644
tagged with: maven
has comment: http://stackoverflow.com/comment/37748492
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/43248609
tagged with: java
score: 149
has answer: http://stackoverflow.com/a/32365351
linked to: http://stackoverflow.com/q/31455644
type: Question
answer count: 8
possible better answer: http://stackoverflow.com/a/22634880
has answer: http://stackoverflow.com/a/22634880
upvote count: 149
accepted answer: http://stackoverflow.com/a/22634689
has answer: http://stackoverflow.com/a/32150635
linked to: http://stackoverflow.com/q/18276723
has answer: http://stackoverflow.com/a/61651582
has answer: http://stackoverflow.com/a/40254093
has answer: http://stackoverflow.com/a/22634689
has answer: http://stackoverflow.com/a/34247173
has comment: http://stackoverflow.com/comment/49974653
has title: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize
favorite count: 0
has body: When building a Java 8 project with Maven: mvn clean package I get this message: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0 How to remove this message?
linked to: http://stackoverflow.com/q/25009717

osx-mavericks
type: Tag
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/22493736

http://stackoverflow.com/comment/34402071
has text: This problem is better solved using a `HashMap<String, String>`
comment on: http://stackoverflow.com/q/22596022
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/a/22610306
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22610263
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34428428
has body: Provided you don't care about duplicates in the list, the quickest way is to do this: final Set&lt;String&gt; set = new LinkedHashSet&lt;&gt;(arr); set.retainAll(dct); for (final String str: set) System.out.println(str);
has comment: http://stackoverflow.com/comment/34427848
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22610263

http://stackoverflow.com/comment/34369890
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22578248
has text: Awesome man! That totally fixed all the bugs. I have been looking over this code for about a week now and would have never guessed that. Thanks for the all the help! Brilliant deduction!

http://stackoverflow.com/q/22619314
tagged with: java
tagged with: loops
downvote count: 1
has body: trying to create a high-low game with loop function to count the amount of tries and allow the user to keep re-entering until the random number generated matches the entered value by the user, get the output messages for if it's too low or too high but doesn't loop the function or clear the field to allow another guess here's what i have so far; /** * A very simple guessing game program. * * The program thinks of a random number between 1 and 100 * and then asks the user to guess the number. An * appropriate message is displayed depending upon a right * or wrong answer. * */ import javax.swing.*; // JPanel, JLabel, etc import java.awt.event.*; // ActionListener, ActionEvent import java.awt.*; // Color import java.util.*; // Random Class class HiLo8 implements ActionListener { // Define object references JFrame myFrame; JPanel myPanel; JButton startButton, makeGuessButton, submitButton, playAgainButton, exitButton; JLabel message1Label, message2Label, message3Label; JTextField inputNumberTxtField; Random randomGenerator; int randomNumber; // Constructor method HiLo8() { // Set up frame myFrame = new JFrame("Guess a number game"); // Set up panel object. Use absolute positioning. myPanel = new JPanel(); myPanel.setLayout (null); // Create a random generator object randomGenerator = new Random(); // This push button is used to start the game off. startButton = new JButton ("Press to start game..."); startButton.setBounds (10, 30, 400, 30); myPanel.add (startButton); // This label object (initially with no string) // will be used to let the user know that the // program is thinking of a number message1Label = new JLabel (); message1Label.setBounds (10,80,500,20); myPanel.add (message1Label); makeGuessButton = new JButton ("Click to make your guess.. "); makeGuessButton.setBounds (10, 140, 400, 30); myPanel.add (makeGuessButton); // This label object will be used to prompt the // user to enter a number message2Label = new JLabel ("What is the number? "); message2Label.se…
type: Question
upvote count: 0
score: -1
tagged with: while-loop
answer count: 1
has title: loop function to clear field
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34444283
has answer: http://stackoverflow.com/a/24033466
tagged with: if-statement

http://stackoverflow.com/q/22552357
has body: As the title suggests, which is faster on insertion? Is it core api or cypher language? This article says it's the api (though it's demonstrated query instead of insertion): http://java.dzone.com/articles/get-full-neo4j-power-using And the article is referring to cypher 1.9 where as we already have 2.0 now. Thanks!
score: 0
answer count: 1
has title: neo4j - cypher vs java api - for insertion which is faster
has comment: http://stackoverflow.com/comment/34506989
tagged with: neo4j
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22554048
type: Question

http://stackoverflow.com/comment/34259886
type: Comment
comment on: http://stackoverflow.com/q/22509621
type: QuestionComment
score: 2
has text: Please learn Java naming conventions (methods should always start with a lower-case letter).

http://stackoverflow.com/comment/34322721
has text: Then you are in a much biger trouble. The reason of your problem is that the dynamic linker your program (maybe `java`) use does not match the `libc.so` it tries to load.
type: QuestionComment
comment on: http://stackoverflow.com/q/22550611
score: 0
type: Comment

http://stackoverflow.com/a/22547852
accepted answer of: http://stackoverflow.com/q/22546823
upvote count: 1
answers question: http://stackoverflow.com/q/22546823
has body: Your basic problem is that your index isn't very selective: the predicate on X and Y select roughly half the rows in the table. This means that your execution plan might look like the following: Scan the index to find rows that satisfy the predicate on X and Y, returning a set of matching rowids. For each rowid from step #1, retrieve the corresponding table row. Sort those rows in descending order. Return all rows to the client. The database driver will discard all rows but the first, due to the setMaxRows(1). That's a fairly dumb plan, but it's the baseline. H2 might choose to sort the rowids returned by step 1, using the timestamps found in the index, but I wouldn't expect this. You can find the actual plan using the EXPLAIN PLAN command provided by H2 (you should become intimately familiar with it). We should, however, be able to do a bit better than that plan. If you know that you'll always want the most recent records, then it might suffice to change your index: CREATE INDEX rows_index ON rows(x, y, z DESC); This will return the set of rowids in step #1 in already-sorted order. The DB might still return all of those rows, but you won't be paying for the sort every time. This might also open up the use of top 1 in the select clause: the index scan (step #1) can stop as soon as the first match is made on X and Y. If that doesn't work, then a correlated subquery might. I'm just typing this in, haven't run it, so it might contain typos or syntax errors, but it would look something like this (you should also be able to alias the two tables and directly relate the inner query to the outer, rather than duplicating the parameters): select * from ROWS where X = ? and Y = ? and Z = ( select max(Z) from ROWS where X = ? and Y = ? ) As I said, explain plan is your friend. Try out a couple of queries and see what the database is doing, then try to nudge it into doing something different. When I read the H2 performance optimization guide, it seemed like it might be smart abo…
score: 1
has comment: http://stackoverflow.com/comment/34316919
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/22596345
upvote count: 2
tagged with: java
has body: What is the efficient way to encode and decode an audio file in android I have tried the Base64 as below but after decoding the file size get increased. Encode ByteArrayOutputStream objByteArrayOS = new ByteArrayOutputStream(); File file = new File(path); FileInputStream objFileIS; try { objFileIS = new FileInputStream(file); byte[] byteBufferString = new byte[1024]; for (int readNum; (readNum = objFileIS.read(byteBufferString)) != -1;) { objByteArrayOS.write(byteBufferString, 0, readNum); System.out.println("read " + readNum + " bytes,"); byte[] bytes = FileUtils.readFileToByteArray(file); strAttachmentCoded = Base64.encodeToString(bytes, Base64.DEFAULT); Decode byte[] decoded = Base64.decode(strAttachmentCoded, Base64.DEFAULT); // byte[] decoded1 = Base64.decode(byteBinaryData1, 0); File file1 = new File(pathAudio); FileOutputStream os = new FileOutputStream(file1, true); os.write(decoded); os.close(); i want audio in String format to send to server and retrieve the same as per the user requirement.
type: Question
has comment: http://stackoverflow.com/comment/34413279
tagged with: encoding
has comment: http://stackoverflow.com/comment/34413310
has answer: http://stackoverflow.com/a/22597055
has comment: http://stackoverflow.com/comment/34403206
tagged with: base64
has title: Audio File Encoding and Decoding
has comment: http://stackoverflow.com/comment/34413581
has comment: http://stackoverflow.com/comment/34413524
has comment: http://stackoverflow.com/comment/34413257
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34402858
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34420217
tagged with: audio
score: 2

http://stackoverflow.com/comment/34468921
comment on: http://stackoverflow.com/a/22633570
type: Comment
has text: Not sure Im understing here - Ill add my activity main into the top post
type: AnswerComment
score: 0

apache-poi
tags question: http://stackoverflow.com/q/22564664
tags question: http://stackoverflow.com/q/22563444
tags question: http://stackoverflow.com/q/22615594
type: Tag
tags question: http://stackoverflow.com/q/22563609
tags question: http://stackoverflow.com/q/22634988
tags question: http://stackoverflow.com/q/22618770
tags question: http://stackoverflow.com/q/22542470
tag name: apache-poi
tags question: http://stackoverflow.com/q/22607024
tags question: http://stackoverflow.com/q/22511413
tags question: http://stackoverflow.com/q/22504389
tags question: http://stackoverflow.com/q/22603724
tags question: http://stackoverflow.com/q/22627691

http://stackoverflow.com/q/22623391
score: 0
answer count: 1
tagged with: calculator
has comment: http://stackoverflow.com/comment/34451481
has answer: http://stackoverflow.com/a/22623476
has title: Trouble with my Restaurant Billing program codes and calculating
type: UnansweredQuestion
tagged with: checkbox
has body: I need help regarding with the computation of what the user order it seems that the options doesn't have a value to be computed please help me how to put values in every options and one more thing is i need help with the codes for the checkbox for additional order I'm not really good in programming and this is all the effort i can do. I really need to pass this project right now so i need a quick answer and by the way what is the problem with my display to user? Help with: Checkbox codes,Computation,JOptionPane Display package project2; import java.util.ArrayList; import java.util.List; import javax.swing.JOptionPane; public class Project2 { public static void main(String[] args) { List&lt;String&gt; optionList = new ArrayList&lt;String&gt;(); optionList.add("1"); optionList.add("2"); optionList.add("3"); optionList.add("4"); double charge; double tax = 0.0675; double tipRate = 0.15; double totalWithTax; double taxAmount; double tipAmount; double grandTotal; //selection of food Object[] options = optionList.toArray(); int value = JOptionPane.showOptionDialog( null, "Please select your Burger:(1 or 2)\n 1. Burger $3.00 \n 2. Cheese Burger $4.50 " + "\n 2. Bacon Burger $5.50 \n 2. Supreme Burger $7.00", "Pick", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, optionList.get(0)); //calculate the charge and the tip taxAmount = charge * tax; totalWithTax = charge + taxAmount; tipAmount = totalWithTax * tipRate; grandTotal = totalWithTax + tipAmount; //Display it back to the user String opt = optionList.get(value); JOptionPane.showMessageDialog(null,"You picked " + opt" \n meal: $" + charge" \n tax: $" + taxAmount" \n meal + tax: $" + totalWithTax" \n total cost(tip included): $" + grandTotal); } }
type: Question
linked to: http://stackoverflow.com/q/15940485
tagged with: java

http://stackoverflow.com/comment/34487500
comment on: http://stackoverflow.com/q/22643714
type: Comment
type: QuestionComment
score: 0
has text: what is the value of oldMeasure?

http://stackoverflow.com/a/22722945
downvote count: 0
has body: I have solved the problem. The reason was I used a wrong dependency in my maven configuration, consequently the import for the @WebContext was wrong. For Jboss 7.1.Final Web Services you should use org.jboss.ws jbossws-api 1.0.2.Final instead of javax javaee-web-api 6.0 provided And the import have to be changed from import org.jboss.wsf.spi.annotation.WebContext to import org.jboss.ws.api.annotation.WebContext . With kind regards.
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/22490386
upvote count: 1
answers question: http://stackoverflow.com/q/22490386
type: AcceptedAnswer

http://stackoverflow.com/comment/34252023
type: Comment
type: QuestionComment
score: 0
has text: the is not in a form
comment on: http://stackoverflow.com/q/22511386

http://stackoverflow.com/comment/34216942
has text: Where would they use `@RequestParam`?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22491146
type: Comment

http://stackoverflow.com/a/22587376
score: 0
has comment: http://stackoverflow.com/comment/34405252
type: Answer
has body: This is very strange. Please raise a ticket for this in the Log4j2 issue tracker so the Log4j team can take a look. The problem may go away if you put the jar files you mentioned inside WEB-INF/lib instead of in Tomcat's lib folder.
has comment: http://stackoverflow.com/comment/35217336
answers question: http://stackoverflow.com/q/22584530

http://stackoverflow.com/comment/34285685
score: 1
has text: Except the mentioned warning, what is your problem ? What is the purpose of using constant `Obj` here `Obj = Java::sikuliAutomation.new`, instead of simple local var sa `obj`. ?
comment on: http://stackoverflow.com/q/22530682
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22585950
upvote count: 1
possible better answer: http://stackoverflow.com/a/22586518
downvote count: 1
has answer: http://stackoverflow.com/a/22586518
has body: I'm trying to sort an array by title, studio, year. movies[0] = new Movie2("The Muppets Take Manhattan","Columbia Tristar", 2001); I'm having trouble on how to create the constructor for the sorting method. I don't have a idea on how to separate all three elements to sort them all individually.
favorite count: 0
has comment: http://stackoverflow.com/comment/34384225
has comment: http://stackoverflow.com/comment/34384228
tagged with: object
type: AnsweredQuestion
has title: Insertion sorting
tagged with: oop
tagged with: java
has comment: http://stackoverflow.com/comment/34384245
has answer: http://stackoverflow.com/a/22586062
accepted answer: http://stackoverflow.com/a/22586062
type: Question
tagged with: arrays
tagged with: sorting
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34384509
has comment: http://stackoverflow.com/comment/34385274

jsr356
tag name: jsr356
type: Tag
tags question: http://stackoverflow.com/q/22531714

http://stackoverflow.com/comment/34234148
type: QuestionComment
has text: @BoristheSpider I had this before, but it really looks ugly and is quite annoying to make in my opinion.
comment on: http://stackoverflow.com/q/22501398
score: 0
type: Comment

http://stackoverflow.com/a/22574809
answers question: http://stackoverflow.com/q/22574768
score: 3
downvote count: 0
has body: You need to convert the text value (character) to the ascii value, then increase it, not just the text. value = edt.getText().toString(); int ascii = (int)value; edt.setText(Character.toString ((char) ascii+1));
has comment: http://stackoverflow.com/comment/34364041
upvote count: 3
has comment: http://stackoverflow.com/comment/34369166
type: Answer

http://stackoverflow.com/comment/68397553
comment on: http://stackoverflow.com/q/22555795
has text: @Absurd-Mind I found it to be very confusing, gives me loads of errors, very bad jar organisation, just terrible examples and they give java projects as it was android app..
score: 0
type: Comment
type: QuestionComment

elliptic-curve
tags question: http://stackoverflow.com/q/22646792
tag name: elliptic-curve
type: Tag

http://stackoverflow.com/comment/34309987
comment on: http://stackoverflow.com/a/22543833
type: AnswerComment
score: 0
type: Comment
has text: You have to apply it for all buttons.

http://stackoverflow.com/comment/34216626
comment on: http://stackoverflow.com/q/22490518
type: QuestionComment
type: Comment
has text: will anyone please write the getSound() function returning the desired value?
score: 0

http://stackoverflow.com/comment/34392184
comment on: http://stackoverflow.com/q/22590530
has text: Try and `.replaceAll("(?<!;)\r?\n", "");`?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34485609
type: QuestionComment
has text: Check out [this question](http://stackoverflow.com/questions/4240080/generating-all-permutations-of-a-given-string).
comment on: http://stackoverflow.com/q/22642813
score: 0
type: Comment

http://stackoverflow.com/a/22607470
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22605169
answers question: http://stackoverflow.com/q/22605169
has body: Guice is not magic. You can't force it to do something outside of an Injector, so no, you can't do that, and in fact you shouldn't. The best way, as you have already noticed, is to make constructor of MySingleton package-private. That way no one outside of the package will be able to construct it but Guice. Since this package is controlled by you, it is safe assumption that no one will create MySingleton in other way than via Guice (using your module, of course). This is not a "bomb". Package-private modifier is intended exactly for this purpose. It is assumed that you control your packages, so it is fine to make constructors and other things package-private and assume that no one but you will call them.
score: 5
type: AcceptedAnswer

http://stackoverflow.com/a/22622603
type: Answer
has comment: http://stackoverflow.com/comment/34476572
answers question: http://stackoverflow.com/q/22620698
has comment: http://stackoverflow.com/comment/34449927
has body: thanks for trying out Azure Mobile Services. Here is a good tutorial on how to get started with Android. To answer your questions specifically: Generally a CRUD API for data storage and a custom API for arbitrary REST calls should be all you need for a straightforward app, and those are all offered in the box with Mobile Services. The one thing we don't offer today (but are considering) is support for duplex messaging (WebSocket), which you might need if you are building a realtime app or game. Mobile Services does not support object trees on the client, but you can still have them in your server database. You just have to write some custom code to "flatten" the hierarchy before you send it to the client. Every mobile service supports HTTPS by default. We do not currently allow you to do a custom SSL cert.
has comment: http://stackoverflow.com/comment/34450112
upvote count: 5
has comment: http://stackoverflow.com/comment/34450160
accepted answer of: http://stackoverflow.com/q/22620698
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34303661
comment on: http://stackoverflow.com/q/22540437
score: 0
type: Comment
type: QuestionComment
has text: You mean every left and right in the whole program? That was one of the first things I tried, along with switching every "deleteMax" with "deleteMin" or whatever. Surprisingly, the program functioned exactly the same. (That is to say, left-leaning.)

http://stackoverflow.com/comment/34373472
has text: @Sarah0050 You are calling `updateView()` before the system has a chance to call `onCreate()`. I suggest that you read about the Activity and Fragment lifecycles to understand how `onCreate()` is called.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22549234

http://stackoverflow.com/q/22553895
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34326860
has answer: http://stackoverflow.com/a/22561165
has body: I have tried by giving path as" hdfs://localhost:9000/path to file" but still its not working is there any other way to read file? I want to give the file path in program,but not as an argument on terminal...
has comment: http://stackoverflow.com/comment/34332504
tagged with: java
has comment: http://stackoverflow.com/comment/34326304
type: Question
tagged with: hadoop
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34326439
has title: I want to read a file which is on hdfs
linked to: http://stackoverflow.com/q/10657687
has answer: http://stackoverflow.com/a/22561331
linked to: http://stackoverflow.com/q/22020286

http://stackoverflow.com/comment/34470382
type: AnswerComment
has text: Cheers mate! Its done, thanks a tonne. By the way, onclick list items, the navigation pane is not hiding and what should I do if I want to open corresponding activities or fragments when the user clicks on a list item and the state of the list is saved with the clicked option highlighted even after going to the next activity?
type: Comment
comment on: http://stackoverflow.com/a/22634119
score: 0

http://stackoverflow.com/a/22522883
has body: I usually name the return variable result, for all methods: List&lt;EmployeeDetails&gt; result; The reason is that it's obvious which list I'm adding to, and that it's gong to be returned, especially if there are multiple lists within the method. This also conforms to good practice by naming things for what they represent, rather than what are they are. Your idea is a bit like naming an int variable as intVariable. Naming it simply result means you can change they type of the result, eg to Set&lt;EmployeeDetails&gt; without any refactoring of the name.
type: Answer
answers question: http://stackoverflow.com/q/22522609
upvote count: 2
score: 1
downvote count: 1

http://stackoverflow.com/a/22540172
answers question: http://stackoverflow.com/q/22539818
type: Answer
has body: Like Sunil said, the constructor has the same name as the class and you should make the difference between them checking his params. To get the params you could try the next code: public static void main(String[] args) throws ClassNotFoundException { Class&lt;?&gt; c = Class.forName(Class1.class.getCanonicalName()); Constructor&lt;?&gt;[] constructors = c.getDeclaredConstructors(); ArrayList&lt;String&gt; memberList = new ArrayList&lt;String&gt;(); for(Constructor&lt;?&gt; constructor:constructors){ memberList.add(constructor.getName()); System.out.println("--------------------------------------"); System.out.println(String.format("constructor: %s",new Object[]{constructor})); for(Class&lt;?&gt; paramType: constructor.getParameterTypes()){ System.out.println(String.format("constructor param type: %s",paramType)); } } }
score: 0

http://stackoverflow.com/a/22721577
type: Answer
has body: There have been some very detailed answers, but they seem to be missing one point that I at least consider as one of the very few justifications to have abstract classes at all: Abstract classes can have protected members (and members with default visibility). Methods in interfaces are implicitly public.
has comment: http://stackoverflow.com/comment/34626984
score: 19
upvote count: 19
has comment: http://stackoverflow.com/comment/34626899
downvote count: 0
answers question: http://stackoverflow.com/q/22591499

http://stackoverflow.com/q/22494203
has body: I need my app to execute a method each x minutes. But x can be different each time: It can change between 15 and 60 depending on other factors. The method has to be executed even if the user has closed the app or even if the user has restarted the phone. I am trying with the AlarmManager but I don't know if is the best way for my case. Is it? Or is AlarmManager a resource consuming way?
type: Question
has answer: http://stackoverflow.com/a/22494463
accepted answer: http://stackoverflow.com/a/22494463
has title: Repeat task each time different number of minutes
tagged with: alarmmanager
score: 0
answer count: 1
tagged with: service
tagged with: android
has comment: http://stackoverflow.com/comment/34222304
tagged with: repeat
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34222290
tagged with: java

http://stackoverflow.com/comment/34316245
has text: Note that you only need to deal with even numbers of quotes or backslashes to do that.
score: 0
comment on: http://stackoverflow.com/q/22546392
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22625538
has body: I have the current set of of routes implemented (for example): GET /api/:version/:entity my.controllers.~~~~~ GET /api/:version/:entity/:id my.controllers.~~~~~ POST /api/:version/:entity my.controllers.~~~~~ POST /api/:version/:entity/:id my.controllers.~~~~~ DELETE /api/:version/:entity my.controllers.~~~~~ POST /api/:version/search/:entity my.controllers.~~~~~ And they work beautifully. Now let's say I want to implement a "batch endpoint" for the same API. It should look something like this: POST /api/:version/batch my.controllers.~~~~~ and the body should look like this: [ { "method": "POST", "call": "/api/1/customer", "body": { "name": "antonio", "email": "tonysmallhands@gmail.com" } }, { "method": "POST", "call": "/api/1/customer/2", "body": { "name": "mario" } }, { "method": "GET", "call": "/api/1/company" }, { "method": "DELETE", "call": "/api/1/company/22" } ] To do that I would like to know how I can call the play framework router to pass those requests? I was planning to use something similar as what is advised for unit tests: @Test public void badRoute() { Result result = play.test.Helpers.routeAndCall(fakeRequest(GET, "/xx/Kiki")); assertThat(result).isNull(); } by going into the source code of routeAndCall(), you find something like this: /** * Use the Router to determine the Action to call for this request and executes it. * @deprecated * @see #route instead */ @SuppressWarnings(value = "unchecked") public static Result routeAndCall(FakeRequest fakeRequest) { try { return routeAndCall((Class&lt;? extends play.core.Router.Routes&gt;)FakeRequest.class.getClassLoader().loadClass("Routes"), fakeRequest); } catch(RuntimeException e) { throw e; } catch(Throwable t) { throw new RuntimeException(t); } } /** * Use the Router to determine the Action to call for this request and executes it. * @deprecated * @see #route instead */ public static Result routeAndCall(Class&lt;? extends play.core.Router.Routes&gt; router, FakeRequest fakeRequest) { try { play.core.Ro…
upvote count: 1
possible better answer: http://stackoverflow.com/a/22629943
type: Question
accepted answer: http://stackoverflow.com/a/29334062
answer count: 2
tagged with: playframework
downvote count: 0
favorite count: 0
tagged with: playframework-2.2
tagged with: scala
has title: Batch HTTP requests in Play!Framework
has answer: http://stackoverflow.com/a/29334062
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22629943
score: 1
tagged with: java

http://stackoverflow.com/comment/34303855
type: Comment
has text: And a sensible default to UTF-8 (I think) will only come with JDK 1.9!
comment on: http://stackoverflow.com/a/22540780
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34318092
comment on: http://stackoverflow.com/a/22548572
type: Comment
type: AnswerComment
has text: @las `Throwable` and `Error` are much more serious than could be handled by responding to your client. Don't handle them. Just configure and deploy so that they don't happen (as much as possible).
score: 0

http://stackoverflow.com/q/22563591
has body: I have a Spring app running in WebLogic. In my DAO, it inherits a base class with a method that returns a "javax.sql.DataSource". I inject that datasource indirectly using the "jee:jndi-lookup" in my Spring application context to get the datasource from JNDI. When I look at this in the debugger, it appears to be a "weblogic.jdbc.common.internal.RmiDataSource". I'd like to figure out how I can introspect into that datasource in my code to determine information about the database I'm connected to, particularly the host, port, SID, and username. Is there any way I could do that? For some background, I have extensive diagnostics in my app for troubleshooting db connection and query issues. It would be very helpful if at runtime, I could introspect information about the WebLogic datasource from the database connection in use. As I described, I already determined in the debugger what the actual type was, and I've examined all the obvious properties in that object for casting or reflection opportunities, and I don't see any obvious indications of information like "host", "port", or "SID".
type: Question
answer count: 2
tagged with: weblogic
has answer: http://stackoverflow.com/a/22563635
score: 0
type: UnansweredQuestion
tagged with: spring
tagged with: java
tagged with: datasource
has answer: http://stackoverflow.com/a/22564958
has title: How to determine info about WebLogic datasource from datasource connection?

http://stackoverflow.com/a/22567167
accepted answer of: http://stackoverflow.com/q/22522424
upvote count: 5
type: Answer
downvote count: 0
score: 5
type: AcceptedAnswer
has body: I figured it out! The problem was that the pipe didn't know the target alphabet. The solution is to use the CRF's Pipe, like so: Pipe pipe = crf.getInputPipe(); instead of doing that crazyness to make my own Pipe. Now if anyone knows a nicer way to make a new Instance using a query, that would be good too, I just copied what the trainer does.
answers question: http://stackoverflow.com/q/22522424

http://stackoverflow.com/comment/34272429
has text: @DavidWallace I'm casting to String. I'm only referencing it for sample code. I'll post the original code.
comment on: http://stackoverflow.com/q/22522964
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22551691
favorite count: 0
upvote count: 6
type: UnansweredQuestion
tagged with: multithreading
tagged with: fork-join
score: 6
has title: Iterative Fork-Join for base case of divide-and-conquer
has comment: http://stackoverflow.com/comment/34324421
tagged with: java
tagged with: forkjoinpool
has body: I have a recursive divide and conquer algorithm that requires two computationally intensive base case tasks before starting the dividing. The initial base cases are independent tasks, so I want to do them in parallel. After the base cases, the dividing runs the same tasks with different inputs between 0 and 1, and based on the output decides whether or not to split again. I got the base cases to work by creating a task wrapper object that fakes the recursion, but this feels like a kludge, as follows: public static void doSomething () { ForkJoinPool pool = new ForkJoinPool(); private ArrayList&lt;Object&gt; al = new ArrayList&lt;Object&gt;(); TaskWrapper tw = new TaskWrapper(true,-1); al.addAll(pool.invoke(tw)); } @SuppressWarnings("serial") public static class TaskWrapper extends RecursiveTask&lt;ArrayList&lt;Object&gt;&gt; { private ArrayList&lt;Object&gt; al = new ArrayList&lt;Object&gt;(); private boolean arg; private double input; private Object out; TaskWrapper(boolean ar, double in){ arg = ar; input = in; } @Override public ArrayList&lt;Object&gt; compute() { if (arg == false) { out = new Object(runIntensiveTask(input)); al.add(out); } else { // Right Base Case TaskWrapper right = new TaskWrapper(false, 1); right.fork(); // Left Base Case TaskWrapper left = new TaskWrapper(false, 0); al.addAll(left.compute()); // Join with Right result al.addAll(right.join()); } return al; } } Is there a simpler way to accomplish the same thing? This is my first StackOverflow post, so please forgive any formatting or protocol errors. Thank you for the help.
tagged with: java.util.concurrent
type: Question
has answer: http://stackoverflow.com/a/22560683
downvote count: 0
answer count: 1

http://stackoverflow.com/a/22599812
score: 1
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34409668
answers question: http://stackoverflow.com/q/22599435
has body: You have dependency problem: class TagLibraryDirectiveProvider exists in struts2-core jar, but in newer version (2.3.16) than you declared (2.3.8): http://struts.apache.org/release/2.3.x/struts2-core/apidocs/org/apache/struts2/views/TagLibraryDirectiveProvider.html So simple upgrade the dependency.
has comment: http://stackoverflow.com/comment/34409434
downvote count: 0

http://stackoverflow.com/comment/34246041
score: 0
has text: He's asking for the java object that he can deserialize that data into. Please stop telling him it's JSON!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22508595

http://stackoverflow.com/comment/34444090
type: Comment
comment on: http://stackoverflow.com/a/22619214
score: 0
has text: Thank you @clcto the first method you suggested has worked exactly as I intended. Sorry for being vague to those of you that picked me up on that. I'm new to Java and I'm not entirely sure how much code to post
type: AnswerComment

http://stackoverflow.com/comment/34232561
comment on: http://stackoverflow.com/a/22496927
has text: i have done as guided. kindly show your code for one single variable. i think one or two lines of code will be enough to make me understand what you want me to do.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34382475
score: 0
has text: @EJP you don't need to defend your honor... I was just saying you won't know exactly how long it took for the entire message to be sent across the wire since the processing time for the receiver is in there as well.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22570685

http://stackoverflow.com/comment/34312250
comment on: http://stackoverflow.com/q/22545153
score: 0
type: Comment
type: QuestionComment
has text: Post the line and we will see

http://stackoverflow.com/a/22529101
type: Answer
answers question: http://stackoverflow.com/q/22528831
has body: String checkQuery = "SELECT iid FROM item WHERE iid = KEY_IID"; SQLiteDatabase db = this.getWritableDatabase(); if (checkQuery == null) { ContentValues values = new ContentValues(); Yes,it is a dead code, you are assigning somehting in checkQuery and then asking to check if is null, how can it be null when you have already assigned value to it in the line just two lines above it.
score: 0

http://stackoverflow.com/comment/34411804
has text: i prefer you to study the deference between the java file and a activity in the android and please tell what effort you did for connect this all
comment on: http://stackoverflow.com/q/22601406
type: Comment
type: QuestionComment
score: 0

demo
type: Tag
tags question: http://stackoverflow.com/q/22584615
tag name: demo

http://stackoverflow.com/comment/34439965
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22615671
score: 0
has text: You do not need to know socket programming for jsp. To be good developer, you need practice, practice and practice :D. It does not matter what you do, if you do it. Usually creating game is fun enough and you learn a lot, especially, when your game grows "bigger" and you find problems which you didnt see in smaller projects.

http://stackoverflow.com/comment/34397967
comment on: http://stackoverflow.com/q/22593776
score: 1
has text: I don't know what T and Z are supposed to mean here, but ust convert it to a format you know then parse.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25452730
score: 0
answers question: http://stackoverflow.com/q/22639828
has body: I would recommend running your java client with the command line option -Djavax.net.debug=ssl as this will give you more (but cryptic) insight into the SSL handshake. That should illuminate the underlying connection troubles, but it might take a while to understand the details that this debug log will output. http://www.smartjava.org/content/how-analyze-java-ssl-errors provides a very nice, detailed discussion of the SSL handshake. It seems plausible that your HTTPClient does not have a well defined SSLContext. You could explore using some of these options to create it. SSLContext sslContext = SSLContexts.createDefault(); SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslSocketFactory).build(); Note that you can also create custom SSLContext(s) from SSLContexts.custom() which allows you to add keystore, truststore, and to specify using TLS.
type: Answer

http://stackoverflow.com/q/22539381
tagged with: arrays
has answer: http://stackoverflow.com/a/22540097
has comment: http://stackoverflow.com/comment/34302022
has answer: http://stackoverflow.com/a/22539863
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22539693
has answer: http://stackoverflow.com/a/22539641
has body: I am quite new to java but have a project i need to complete and am stuck on a certain part. I want to allow the user to enter a route including, start destination, an end destination, and a number of stops. I have been able to do this, but then i want the user to have the ability of being able to add the same things again, to the same array. without deleting the existing route here is the code i have so far import java.util.Scanner; import java.util.Arrays; public class main { public static void main(String[] args){ menu(); } public static void menu(){ Scanner scanner = new Scanner(System.in); System.out.println("enter 1 to input a new route"); int option = scanner.nextInt(); if(option==1){ inputRoute(); } } public static void inputRoute(){ Scanner scanner = new Scanner(System.in); System.out.println("Please Enter Starting Destination"); String startDest = scanner.next(); System.out.println("Please Enter End Destination"); String endDest = scanner.next(); System.out.println("Please Enter Number of stops"); int numberOfStops = scanner.nextInt(); String[] stops = new String[numberOfStops]; for(int i = 1; i&lt;=numberOfStops; i++){ System.out.println("Enter Stop" + i); stops[i-1] = scanner.next(); } System.out.println(Arrays.toString(stops)); menu(); } } however when this runs, if i go back and enter in another route, it will just delete the existing route. Is there any way of appending the next route to the end of that array or any way of doing this? thank you
has answer: http://stackoverflow.com/a/22540081
answer count: 6
has comment: http://stackoverflow.com/comment/34301274
has answer: http://stackoverflow.com/a/22539699
has title: Entering multiple things in to one array in java

http://stackoverflow.com/comment/34347134
score: 0
type: QuestionComment
type: Comment
has text: It looks very promising, i'll give it a go later tonight, and will report back. Thanks!
comment on: http://stackoverflow.com/q/22564552

http://stackoverflow.com/q/22524516
type: Question
has comment: http://stackoverflow.com/comment/34371428
has body: I have this MVC Controller: @RequestMapping(produces = "text/html") public String list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "sortFieldName", required = false) String sortFieldName, @RequestParam(value = "sortOrder", required = false) String sortOrder, Model uiModel) { if (page != null || size != null) { int sizeNo = size == null ? 10 : size.intValue(); final int firstResult = page == null ? 0 : (page.intValue() - 1) * sizeNo; uiModel.addAttribute("smaker", Smak.findSmakEntries(firstResult, sizeNo, sortFieldName, sortOrder)); float nrOfPages = (float) Smak.countSmaker() / sizeNo; uiModel.addAttribute("maxPages", (int) ((nrOfPages &gt; (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages)); } else { uiModel.addAttribute("smaker", Smak.findAllSmaker(sortFieldName, sortOrder)); } return "smaker/list"; } } I use Tiles 2.2.2 and I have this view renders when the web app runs in Jetty, but I wanted to evaluate spring-test so I started with this simple test: @RunWith(SpringJUnit4ClassRunner.class) public class ViewsControllerTests extends AbstractContextControllerTests { private MockMvc mockMvc; @Before public void setup() throws Exception { this.mockMvc = webAppContextSetup(this.wac).alwaysExpect(status().isOk()).build(); }//wac is in the superclass which loads it from file @Test public void getSmakerView() throws Exception { this.mockMvc.perform(get("/smaker")) .andExpect(view().name(containsString("smaker/list"))); } } Indeed I have Rendering view [org.springframework.web.servlet.view.tiles2.TilesView name 'smaker/list'; in the logs when I run this project in Jetty. Yet when I run tests the test above it fails with java.lang.AssertionError: Expected: a string containing "smaker/list but: was "uncaughtException" which is my default ErrorView for my SimpleMappingExceptionResolver. So something would seem to be wrong with either my test or my assumptions …
has comment: http://stackoverflow.com/comment/34294800
score: 0
has comment: http://stackoverflow.com/comment/34307128
answer count: 1
has comment: http://stackoverflow.com/comment/34315783
tagged with: spring
has title: Spring MVC view/controller test of known good tiles setup fails with assertion error
tagged with: tiles2
tagged with: spring-test
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22657326
tagged with: java
has comment: http://stackoverflow.com/comment/34329058
accepted answer: http://stackoverflow.com/a/22657326

http://stackoverflow.com/comment/34486430
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22620512
has text: It helps, but I cannot initialize them because it wouldn't make sense to convert a Button to a View.OnClickListener. There for, I am stuck. (But keep in mind I am just a beginner with making UI's.)

http://stackoverflow.com/q/22605787
tagged with: java
linked to: http://stackoverflow.com/q/6746665
tagged with: spannablestring
type: Question
score: 0
has answer: http://stackoverflow.com/a/22605925
answer count: 1
has title: Roboto light and Roboto bold in a TextView
tagged with: textview
tagged with: android
accepted answer: http://stackoverflow.com/a/22605925
has comment: http://stackoverflow.com/comment/34419409
has body: Can I apply Roboto light and Roboto bold in same TextView on Android 2.3 like that? **user** has been publish a beez Where **user** is Roboto bold and has been publish a beez is Roboto light
type: AnsweredQuestion

http://stackoverflow.com/a/22510011
has body: The static method locks on the class, while the member method locks on the object. Java uses a pass-by-value, which in the case of a primitive is the value and in the case of an object is the reference to the object. In your methods: there is no lock on the user, which could be modified by another thread via a different reference to it while the synchronized method being invoked. the value of the primitive count cannot be modified such that the method would see the modification after any method is invoked.
has comment: http://stackoverflow.com/comment/34264130
has comment: http://stackoverflow.com/comment/34279331
answers question: http://stackoverflow.com/q/22509521
score: 0
type: Answer

http://stackoverflow.com/a/22584002
has comment: http://stackoverflow.com/comment/34381330
has comment: http://stackoverflow.com/comment/34385250
has comment: http://stackoverflow.com/comment/34385639
type: Answer
has body: int row = source.rowAtPoint(e.getPoint()); int column = source.columnAtPoint(e.getPoint()); Object valueInCell = table.getValueAt(row, column); Simple!
has comment: http://stackoverflow.com/comment/34385957
has comment: http://stackoverflow.com/comment/34381045
has comment: http://stackoverflow.com/comment/34385547
answers question: http://stackoverflow.com/q/22583589
score: 0

http://stackoverflow.com/comment/34456055
type: Comment
has text: You can make use of preExecute and postExecute methods of AsynTask for your requirement.
score: 0
comment on: http://stackoverflow.com/q/22625419
type: QuestionComment

http://stackoverflow.com/a/39913192
answers question: http://stackoverflow.com/q/22586658
score: 1
downvote count: 0
type: Answer
upvote count: 1
has body: If it helps, I got the C# code from Arachnode working very easily - a tweak or two to get the right paths for models and so on, but it then works great. What was missing was something about the right format for the input files. It's in the Javadoc, but for reference, for BuildBinarizedDataset it's something like: 2 line of text here 0 another line of text 1 yet another line of text etc Building that is pretty trivial, depending on what you're starting with (a database, Excel file, whatever)

http://stackoverflow.com/comment/34342522
score: 0
type: AnswerComment
has text: I tried Thread.sleep, but OS still hangs, I will try to find a way to wait for OS I/O operations, but I'm not sure if it's possible (I can probably make it for Windows by hardocidng some stuff, but it should also behave in the same way under Linux).
type: Comment
comment on: http://stackoverflow.com/a/22560915

http://stackoverflow.com/comment/34227483
comment on: http://stackoverflow.com/q/22497443
score: 1
has text: You might want to ask this at http://codereview.stackexchange.com instead.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34283800
comment on: http://stackoverflow.com/a/22528974
has text: @Simulant What happens if I don't know the numberRange? Assume, I don't have access to the database, how do I get all the numbers from say XXXXXXXX - XXXXXXXX?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34489536
comment on: http://stackoverflow.com/a/22644982
type: AnswerComment
has text: my god, i seem to be going crazy. thank you very much.
score: 0
type: Comment

http://stackoverflow.com/a/22583644
score: 0
has body: For small config files, put those in $project_dir/src/main/resources, and they will get built into your final .jar file. Logging configuration files, for example, are ideal for this. If you have large data, like images, I'd probably keep them separate from the .jar and just distribute in a "data" folder next to the jar. Ant/Maven are the major Java build tools. Gradle is arguably better and easier than those if you have the choice. You can make a one line Gradle script apply plugin: 'java' and put your .java source in src/main/java and your resources in src/main/resources and run gradle jar and that should work.
answers question: http://stackoverflow.com/q/22583586
has comment: http://stackoverflow.com/comment/34380461
type: Answer
has comment: http://stackoverflow.com/comment/34385204
has comment: http://stackoverflow.com/comment/34380255
has comment: http://stackoverflow.com/comment/34380204
has comment: http://stackoverflow.com/comment/34380440

http://stackoverflow.com/comment/34424151
type: Comment
type: QuestionComment
has text: Even the very first `1/d` can loose precision: http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
score: 0
comment on: http://stackoverflow.com/q/22608536

http://stackoverflow.com/a/22577262
downvote count: 0
answers question: http://stackoverflow.com/q/22577261
type: Answer
upvote count: 16
has comment: http://stackoverflow.com/comment/38303522
score: 16
accepted answer of: http://stackoverflow.com/q/22577261
has body: This achieves what I wanted to do: /* * Pass two arguments. The created function accepts a String and * returns a StringBuilder */ Function<String, StringBuilder> addEllipsis = appendToMe -> appendChar( '.', 3, appendToMe); /* * Pass one argument. This creates a function that takes another two * arguments and returns a StringBuilder */ BiFunction<String, Integer, StringBuilder> addBangs = (appendToMe, times) -> appendChar('!', times, appendToMe); // Create a function by passing one argument to another function Function<String, StringBuilder> addOneBang = appendToMe -> addBangs .apply(appendToMe, 1); StringBuilder res1 = addBangs.apply("Java has gone functional", 2); StringBuilder res2 = addOneBang.apply("Lambdas are sweet"); StringBuilder res3 = addEllipsis.apply("To be continued"); For a list of all of Java's predefined varieties of the function object have a look here. Edit: If you have a method with a lot of arguments, you can write your own kind of function: /** * Represents a function that accepts three arguments and produces a result. * This is the three-arity specialization of {@link Function}. * * @param <T> * the type of the first argument to the function * @param * the type of the second argument to the function * @param <V> * the type of the third argument to the function * @param <R> * the type of the result of the function * * @see Function */ @FunctionalInterface public interface TriFunction<T, U, V, R> { R apply(T t, U u, V v); } Method accepting many arguments; you want to provide some of them: private static boolean manyArgs(String str, int i, double d, float f) { return true; } Here is how you use your custom function object: /* * Pass one of the arguments. This creates a function accepting three * arguments. */ TriFunction<Integer, Double, Float, Boolean> partiallyApplied = (i, d, f) -> manyArgs("", i, d, f); /* * Provide the rest of the arguments. */ boolean res4 = partiallyApplied.apply(2, 3.0, 4.0F); System.out.println("No time for ceremonies: …
has comment: http://stackoverflow.com/comment/51944293
type: AcceptedAnswer

http://stackoverflow.com/a/22587254
score: 0
type: Answer
has body: The main problem you are running into is a common issue in multithreaded programming. In java, two of the concerns you need to address are the safety of accessing the graph object from one thread while modifying it from another. The other concern is related in that both threads may have a different view of the graph object and measures must be taken to let the runtime/compiler know that after certain code boundaries, the view of the graph object must be synchronized. It would likely help to research synchronized keyword and memory synchronizations. Of course other solutions/optimizations may exist, the best approach is to understand the multithreading concerns mentioned and first take the most straightforward solution .... Deal with performance / optimization later if possible.
accepted answer of: http://stackoverflow.com/q/22582964
answers question: http://stackoverflow.com/q/22582964
has comment: http://stackoverflow.com/comment/34398664
type: AcceptedAnswer

http://stackoverflow.com/comment/34273871
has text: Submit a patch to the AOSP and maybe it gets approved.
type: AnswerComment
comment on: http://stackoverflow.com/a/22523579
score: 0
type: Comment

http://stackoverflow.com/a/77353300
answers question: http://stackoverflow.com/q/22642012
score: 1
has body: You can create an HttpEntity using MultipartEntityBuilder, something like this: HttpEntity httpEntity = MultipartEntityBuilder.create() .addTextBody("text-form-field", "Just a line of text.") .addTextBody("object-form-field", objectMapper.writeValueAsString(workerMetrics), ContentType.APPLICATION_JSON) .addBinaryBody("binary-format", "This would not really be text".getBytes()) .build(); The post-process Spring's MockMultipartHttpServletRequestBuilder, adding the entity as the content. Copying over the entity's content type will set the boundaries for you. mvc.perform(multipart("/upload") .with(request -> { try { request.setContent(httpEntity.getContent().readAllBytes()); request.setContentType(httpEntity.getContentType().getValue()); return request; } catch (IOException e) { throw new UncheckedIOException(e); } }) ).andExpect(status().isAccepted());
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34470537
type: Comment
type: QuestionComment
score: 0
has text: Are you created the password for test db. If not create password for test database
comment on: http://stackoverflow.com/q/22634535

http://stackoverflow.com/comment/34429991
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22607186
has text: I would like to use it because i read a stream of bytes. his length is 'PAGE_SIZE * x' . the buffer can truncate provided data so i need to read forward. Using a ringbuffer will be helpfull
score: 0

http://stackoverflow.com/a/22541487
score: 0
accepted answer of: http://stackoverflow.com/q/22541011
answers question: http://stackoverflow.com/q/22541011
type: Answer
has body: Here you can found same samples: Elements links = doc.select("a.tel"); for (Element el: links) { String tel = el.attr("href"); //.If you want the href attr // String tel = el.text() if you want the inner text }
type: AcceptedAnswer

http://stackoverflow.com/comment/34310120
has text: how do you store your sets in memory? I mean what kind of data structure are you using?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22544154

http://stackoverflow.com/comment/34449191
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22619776
type: Comment
has text: This is basically what I ended up with public void setProjectedGraduationDate(GregorianCalendar projectedGraduationDate){ projectedGraduationDate.add(Calendar.YEAR, 4); this.projectedGraduationDate = projectedGraduationDate; }

http://stackoverflow.com/a/22547545
upvote count: 2
has comment: http://stackoverflow.com/comment/34337948
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22493607
has comment: http://stackoverflow.com/comment/34405387
downvote count: 0
has comment: http://stackoverflow.com/comment/125268619
has body: I found an alternative approach that I will try out: Instead of using the @Multitenant annotation to filter out those entities that belong to my tenant I will use @AdditionalCriteria. My example from the question above becomes @Entity @AdditionalCriteria(":ADMINACCESS = 1 or this.tenant=:TENANT") public class TenantEntity { private String tenant; ... Here I need to take care of the tenant column myself. I can create two entity managers. One for tenant access: private static EntityManager newEntityManager(String tenant) { Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); map.put("TENANT", tenant); map.put("ADMINACCESS", 0); return emf.createEntityManager(map); } And another one for admin access: private static EntityManager newEntityManager() { Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); map.put("TENANT", ""); map.put("ADMINACCESS", 1); return emf.createEntityManager(map); } See details for @AdditionalCriteria here. Any comments?

file
tags question: http://stackoverflow.com/q/22574607
type: Tag
tags question: http://stackoverflow.com/q/22570158
tags question: http://stackoverflow.com/q/22641724
tags question: http://stackoverflow.com/q/22607588
tags question: http://stackoverflow.com/q/22529645
tags question: http://stackoverflow.com/q/22578290
tags question: http://stackoverflow.com/q/22519918
tags question: http://stackoverflow.com/q/22580724
tags question: http://stackoverflow.com/q/22554591
tags question: http://stackoverflow.com/q/22490625
tags question: http://stackoverflow.com/q/22554866
tags question: http://stackoverflow.com/q/22644146
tags question: http://stackoverflow.com/q/22495525
tags question: http://stackoverflow.com/q/22571096
tag name: file
tags question: http://stackoverflow.com/q/22528998
tags question: http://stackoverflow.com/q/22506013
tags question: http://stackoverflow.com/q/22498134
tags question: http://stackoverflow.com/q/22609896
tags question: http://stackoverflow.com/q/22576430
tags question: http://stackoverflow.com/q/22516273
tags question: http://stackoverflow.com/q/22617947
tags question: http://stackoverflow.com/q/22546742
tags question: http://stackoverflow.com/q/22520825
tags question: http://stackoverflow.com/q/22591539
tags question: http://stackoverflow.com/q/22515705
tags question: http://stackoverflow.com/q/22591134
tags question: http://stackoverflow.com/q/22571166
tags question: http://stackoverflow.com/q/22605581
tags question: http://stackoverflow.com/q/22580181
tags question: http://stackoverflow.com/q/22489553
tags question: http://stackoverflow.com/q/22633333
tags question: http://stackoverflow.com/q/22575464
tags question: http://stackoverflow.com/q/22529774
tags question: http://stackoverflow.com/q/22522890
tags question: http://stackoverflow.com/q/22569178
tags question: http://stackoverflow.com/q/22600773
tags question: http://stackoverflow.com/q/22596357
tags question: http://stackoverflow.com/q/22544072
tags question: http://stackoverflow.com/q/22605342
tags question: http://stackoverflow.com/q/22552208
tags question: http://stackoverflow.com/q/22493259
tags question: http://stackoverflow.com/q/22607163
tags question: http://stackoverflow.com/q/22626982
tags question: http://stackoverflow.com/q/22573746
tags question: http://stackoverflow.com/q/22492306
tags question: http://stackoverflow.com/q/22607033

http://stackoverflow.com/q/22596052
upvote count: 1
downvote count: 1
favorite count: 0
has body: I'm trying to find a way to add more to an already filled array, the user of the program must select one of the array for example seat[0][1] and then add their name should be added to next to the seat they've chosen. Is there any way of doing this or is there a way of changing the contents of the part they've chosen to their name? I'm using a 2D String array.Here's the code I've written so far if you could please offer any advice I'd be grateful thanks. {String [][] seat = new String[2][6]; seat[0][0] = "A.1"; seat[0][1] = "B.1"; seat[0][2] = "C.1"; seat[0][3] = "D.1"; seat[0][4] = "E.1"; seat[0][5] = "F.1"; seat[1][0] = "A.2"; seat[1][1] = "B.2"; seat[1][2] = "C.2"; seat[1][3] = "D.2"; seat[1][4] = "E.2"; seat[1][5] = "F.2"; //Print out array here using for-loops System.out.println("Please choose your seat: "); chosenseat=Keyboard.readString(); System.out.println("Please enter the name for the booking: "); name=Keyboard.readString();}
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/22596131
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22596175
tagged with: arrays
has title: How to add more to the contents of a String array in java
score: 0
has answer: http://stackoverflow.com/a/22618728
answer count: 3

http://stackoverflow.com/comment/34460627
comment on: http://stackoverflow.com/a/22628770
type: AnswerComment
type: Comment
has text: Yes this worked. If you don't mind Can explain me how does it work?
score: 0

http://stackoverflow.com/comment/39078109
type: AnswerComment
has text: Any other way to do it dynamically ?
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22615043

http://stackoverflow.com/q/22582509
accepted answer: http://stackoverflow.com/a/22583414
has comment: http://stackoverflow.com/comment/34378544
has title: putExtra(), getStringExtra() - why it does not work?
favorite count: 0
has comment: http://stackoverflow.com/comment/34379448
answer count: 3
has comment: http://stackoverflow.com/comment/34378279
tagged with: android
has comment: http://stackoverflow.com/comment/34378135
linked to: http://stackoverflow.com/q/22575036
upvote count: 3
has comment: http://stackoverflow.com/comment/34378200
has answer: http://stackoverflow.com/a/25660600
has comment: http://stackoverflow.com/comment/34378761
has comment: http://stackoverflow.com/comment/34378634
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22582935
tagged with: java
has comment: http://stackoverflow.com/comment/34378484
has body: I suspect there is only some stupid mistake, but I'm stuck. The problem is simple: my String path is not send to MainActivity. Creating intent in FileListActivity.class intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("path", fileName); Toast.makeText(this, fileName + " set to play!", Toast.LENGTH_SHORT).show(); startActivity(intent); Receiving intent in MainActivity.class protected void onResume(){ super.onResume(); Toast.makeText(this, "path set" + getIntent().getStringExtra("path"), Toast.LENGTH_SHORT).show(); if(getIntent().hasExtra("path")) try { mediaPlayer.setDataSource(this, Uri.parse(getIntent().getStringExtra("path"))); mediaPlayer.prepare(); } catch (IOException e) { e.printStackTrace(); } } Toast in FileListActivity shows right filename. In MainActivity it is null.
type: Question
possible better answer: http://stackoverflow.com/a/25660600
has answer: http://stackoverflow.com/a/22583414
downvote count: 0
has comment: http://stackoverflow.com/comment/34377889

http://stackoverflow.com/q/22503804
has comment: http://stackoverflow.com/comment/34287285
score: 0
has comment: http://stackoverflow.com/comment/34238037
type: Question
has comment: http://stackoverflow.com/comment/34238475
has answer: http://stackoverflow.com/a/22504507
has body: I wanted to find out how to create an executable .jar file, so I wrote a small sample program to test it. This sample program takes some default text and turns it into some code based on the Caesar code. Anyway, it outputs normally when run in Eclipse. I doubt this helps, but here's the source code for the two java classes. Main.java public class Main { public static void main (String [] args){ Caesar caesarCode = new Caesar(); caesarCode.setDecodedText("this"); caesarCode.setShiftPos(3); String cipherText = caesarCode.deencode(caesarCode.getDecodedText(), caesarCode.getShiftPos()); System.out.print(cipherText+"\n"); String plainText = caesarCode.deencode(cipherText, caesarCode.getShiftPos()*-1); System.out.print(plainText); } } Caesar.java public class Caesar { // global variables String encodedText; // encoded text String decodedText; // decoded text int shiftPos; // shift positions to decode message // getters and setters public String getEncodedText() { return encodedText; } public void setEncodedText(String encodedText) { this.encodedText = encodedText; } public String getDecodedText() { return decodedText; } public void setDecodedText(String decodedText) { this.decodedText = decodedText; } public int getShiftPos() { return shiftPos; } public void setShiftPos(int shiftPos) { this.shiftPos = shiftPos; } public String deencode (String plainTextArg, int shiftPosArg) { // variables String plainText = plainTextArg; char[] cipherTextArray; String cipherText; int plainTextSize; int shiftPos = shiftPosArg; // initialize variables char[] plainTextArray = plainText.toCharArray(); plainTextSize = plainTextArray.length; cipherTextArray = new char[plainTextSize]; // shift cipher String by shiftPos for (int i = 0; i &lt; plainTextSize; i++){ cipherTextArray[i] = (char) (plainTextArray[i] + shiftPos); } cipherText = String.valueOf(cipherTextArray); // return cipher text return cipherText; } } I created my .jar file this way (on a Mac): Created two directories on Desktop: "cla…
tagged with: java
has comment: http://stackoverflow.com/comment/34287264
has comment: http://stackoverflow.com/comment/34238425
has title: .jar file won't run? (I feel like I'm missing something obvious, looked to solutions myself before coming here.)
possible better answer: http://stackoverflow.com/a/22504175
has comment: http://stackoverflow.com/comment/34287355
has answer: http://stackoverflow.com/a/22504175
has comment: http://stackoverflow.com/comment/34288058
has comment: http://stackoverflow.com/comment/34268757
tagged with: executable-jar
tagged with: jar
has comment: http://stackoverflow.com/comment/34287424
accepted answer: http://stackoverflow.com/a/22504507
answer count: 3
has comment: http://stackoverflow.com/comment/34239695
has answer: http://stackoverflow.com/a/22518521
has comment: http://stackoverflow.com/comment/34237732
has comment: http://stackoverflow.com/comment/34287294
has comment: http://stackoverflow.com/comment/34237700
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34287850

http://stackoverflow.com/q/22524149
score: 2
downvote count: 0
tagged with: java
type: Question
has title: Where to find JDK 8 for ARM
upvote count: 2
tagged with: arm
has answer: http://stackoverflow.com/a/22524217
answer count: 3
has body: I went to the Oracle site to download the release JDK 8 for ARM and the version labeled as JDK 8 is actually JDK 7 update 40. Does anyone know where to find the JDK 8 for ARM or how to let Oracle know about the problem?
has answer: http://stackoverflow.com/a/73441506
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
tagged with: java-8
has answer: http://stackoverflow.com/a/22524239

http://stackoverflow.com/comment/34451129
score: 0
comment on: http://stackoverflow.com/q/22578452
type: Comment
type: QuestionComment
has text: Are you using gwtp with a gingector being auto generated for you?

http://stackoverflow.com/q/22488193
has title: -25 is listed as an even number in Java
tagged with: java
has body: I was writing a program to print out only even numbers from an array of integers. Here is the code below: public class ForLoopExample3 { public static void main(String[] args) { int[] arr = {7, 6, 9, -2, 8, 12, 17, -25, 15, 18, 21, 13}; for(int i = 0; i &lt; arr.length; i++) { if((arr[i] % 2) &gt; 0) continue; System.out.println(arr[i]); } } } When I run the program above, I get the following output: So the question is why is -25 being displayed among the even numbers?
type: Question
has answer: http://stackoverflow.com/a/22488269
answer count: 6
score: 0
has answer: http://stackoverflow.com/a/22488291
has answer: http://stackoverflow.com/a/22488302
has answer: http://stackoverflow.com/a/22488254
possible better answer: http://stackoverflow.com/a/22488291
accepted answer: http://stackoverflow.com/a/22488254
has answer: http://stackoverflow.com/a/22488318
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34211580
has answer: http://stackoverflow.com/a/22488271

http://stackoverflow.com/comment/34425166
score: 0
comment on: http://stackoverflow.com/q/22607743
type: QuestionComment
type: Comment
has text: In fact, considering the memory consumption is indeed somewhat premature optimization. It should not be taken into account. What indeed is much more important is the design question. Where does the field belong to? To the class or to each instance? For example: Is it a constant that just gives a magic value, which is used in the context of this class, a name? Then make it static; it belongs to the class. Having said this, I think nearly all final fields that are initialized at declaration, are such constants.

http://stackoverflow.com/comment/34287784
comment on: http://stackoverflow.com/q/22527333
score: 0
has text: @EJP - I am not getting it. Which one is the correct answer? Pls advise
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/115349188
comment on: http://stackoverflow.com/a/55081785
score: 1
has text: don't a method with `no operation` can't throw any exceptions, because it does nothigng?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/80689571
comment on: http://stackoverflow.com/a/22550528
has text: @H.Aqjn If you're seeing this error with a different major version of Hibernate, then this isn't a duplicate, and you should post a new question. Remember to include all your dependencies and the exact stack trace.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34254332
comment on: http://stackoverflow.com/a/22510742
has text: Yes ..I put the quotes just to show you that your url goes there.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34464663
has text: `12.4e-6` = `12400000e-12` so which number do you want?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22631089
score: 0

http://stackoverflow.com/comment/41153285
type: Comment
comment on: http://stackoverflow.com/a/22627383
score: 3
has text: I'm *very* surprised to see that this sun-internal API leaked into public API of the JDK. Why wasn't isn't a `java.lang.reflect.CallerSensitive` annotation?
type: AnswerComment

http://stackoverflow.com/q/22608626
upvote count: 2
type: UnansweredQuestion
has title: How to make a servlet output several messages progressively
downvote count: 2
has comment: http://stackoverflow.com/comment/34433020
has comment: http://stackoverflow.com/comment/34424246
has comment: http://stackoverflow.com/comment/34424167
has body: I'm using JSP and Servlets to write a Web application. The goal of the app is to provide a simple form in the jsp page, which is used to feed parameters to execute a java program (in the servlet). The output of the program should appear at the bottom of the same jsp page. A lot of sites explain how to to this, however my main issue is that my java program takes several minutes to run, and it prints out a lot of messages before completing. If I simply append those messages to the servlet's HttpServletResponse, then it will wait several minutes before showing all the messages at once. Is there a way to progressively print out the messages on the original jsp page as if it was a java console?
tagged with: java
tagged with: servlets
has answer: http://stackoverflow.com/a/22608664
type: Question
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/34434338
favorite count: 0
has comment: http://stackoverflow.com/comment/34471764
score: 0

http://stackoverflow.com/comment/34272432
has text: Well spotted, @Elliott. I love the "please help me debug my code that DOESN'T look like this" questions. Most likely, he/she has just written `executeQuery` instead of `executeUpdate`, but it's anyone's guess.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22522964
type: QuestionComment

http://stackoverflow.com/a/22615980
has body: Code for what rgettman specified: public static int countChar(String str, String character) { if(str.length() == 0) { return 0; } if (!(str.substring(0,1).equals(character))) { return countChar(str.substring(1), character); } else { return 1 + countChar(str.substring(1), character); } }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22615851
score: 1

http://stackoverflow.com/a/22594152
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22585828
has body: If you're looking for concurrency safe containers, try ConcurrentLinkedQueue or ConcurrentHashMap. If you find later that you need some inherent ordering to the way you process the entities in the game, you might want to use a PriorityQueue.

http://stackoverflow.com/q/22607186
has body: I am looking to use dirsuptor ring buffer to parse a file. But i do not see how to set a range of value to the ring buffer. In example below it seem. It loop to each item to assign it to the buffer. But me, i would like to assign directly x items. When i do FileInputStream.read( byte[] bytes ), I would like put these bytes into the ring buffer. Usually my buffer is twice bigger than bytes I read. Like this I could read another page while i am computing one ( eg bytes array length == buffer / 2 ): ExecutorService exec = Executors.newCachedThreadPool(); // Preallocate RingBuffer with 1024 ValueEvents Disruptor&lt;ValueEvent&gt; disruptor = new Disruptor&lt;ValueEvent&gt;(ValueEvent.EVENT_FACTORY, 1024, exec); // Build dependency graph RingBuffer&lt;ValueEvent&gt; ringBuffer = disruptor.start(); for (long i = 10; i &lt; 2000; i++) { String uuid = UUID.randomUUID().toString(); // Two phase commit. Grab one of the 1024 slots long seq = ringBuffer.next(); ValueEvent valueEvent = ringBuffer.get(seq); valueEvent.setValue(uuid); ringBuffer.publish(seq); } Thanks
has comment: http://stackoverflow.com/comment/34429991
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22776936
tagged with: disruptor-pattern
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34423150
type: Question
tagged with: performance
has answer: http://stackoverflow.com/a/22776936
has title: Disruptor how to use his ring buffer to read a file?
has comment: http://stackoverflow.com/comment/34423202

http://stackoverflow.com/comment/34369928
comment on: http://stackoverflow.com/a/22578183
has text: @ZulfiqarJunejo: case in point, you're using a MouseListener on a JButton, something that you should almost never do, and something that the Oracle Swing tutorials will tell you. Please have a look at the tutorials.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/34377021
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22581340
has text: @AmanAgnihotri: Yes, second break just to make sure..that once i fill value I do not want to iterate at all...actually for our custom attribute..second collection will always contain one element.

http://stackoverflow.com/a/22550938
has body: super.paintComponent(g); should always be called, normally first, regardless of what else you might be doing in the paintComponent method Don't perform operations in the paint method which may be time consuming, like loading images. Load these images in advance. Paint methods may called numerous times, sometimes in quick succession Avoid calling setPreferred/Minimum/MaximumSize You may need to call revalidate (or invalidate, validate on JFrame) on the top level container so that the container hierarchy is marked as needing to be relaid out, repaint won't do this. You should be launching your UI from within the context of of the EDT, see Initial Threads for more details
has comment: http://stackoverflow.com/comment/34342472
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/34356825
accepted answer of: http://stackoverflow.com/q/22550832
answers question: http://stackoverflow.com/q/22550832
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22595434
has body: You should add the JTextField in the layout. You should use add method of the container/or the class if you extend JFrame inside the for. Read this. Adding Components to a Container When you add components to a panel or content pane, the arguments you specify to the add method depend on the layout manager that the panel or content pane is using. In fact, some layout managers do not even require you to add the component explicitly; for example, GroupLayout. For example, BorderLayout requires that you specify the area to which the component should be added (using one of the constants defined in BorderLayout) using code like this: pane.add(aComponent, BorderLayout.PAGE_START); The how-to section for each layout manager has details on what, if any, arguments you need to specify to the add method. Some layout managers, such as GridBagLayout and SpringLayout, require elaborate setup procedures. Many layout managers, however, simply place components based on the order they were added to their container. Swing containers other than JPanel and content panes generally provide API that you should use instead of the add method. For example, instead of adding a component directly to a scroll pane (or, actually, to its viewport), you either specify the component in the JScrollPane constructor or use setViewportView. Because of specialized API like this, you do not need to know which layout manager (if any) many Swing containers use. (For the curious: scroll panes happen to use a layout manager named ScrollPaneLayout.) For information about how to add components to a specific container, see the how-to page for the container. You can find the component how-to pages using How to Use Various Components.
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22595404
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22595404
score: 1

http://stackoverflow.com/comment/34408707
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22584460
has text: You need to include JRE 6 *instead of* JRE 7. Otherwise you might accidentally use something that exists in 7 but not in 6.
score: 1

http://stackoverflow.com/comment/34376145
has text: You need to explain well your question.
score: 0
comment on: http://stackoverflow.com/q/22581626
type: Comment
type: QuestionComment

jaxb
tags question: http://stackoverflow.com/q/22629420
tags question: http://stackoverflow.com/q/22569902
tags question: http://stackoverflow.com/q/22633513
tags question: http://stackoverflow.com/q/22615264
tags question: http://stackoverflow.com/q/22513256
tags question: http://stackoverflow.com/q/22636214
tags question: http://stackoverflow.com/q/22609754
tags question: http://stackoverflow.com/q/22502171
tags question: http://stackoverflow.com/q/22590676
tags question: http://stackoverflow.com/q/22634537
tags question: http://stackoverflow.com/q/22593665
tags question: http://stackoverflow.com/q/22516859
tags question: http://stackoverflow.com/q/22591350
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/22614551
tags question: http://stackoverflow.com/q/22528951
tags question: http://stackoverflow.com/q/22593254
tags question: http://stackoverflow.com/q/22611105
tags question: http://stackoverflow.com/q/22509921
tags question: http://stackoverflow.com/q/22621349

http://stackoverflow.com/a/22543891
downvote count: 0
has comment: http://stackoverflow.com/comment/56374660
score: 1
upvote count: 1
type: AcceptedAnswer
has body: to get Context just call getContext() in your class that extends ContentProvider example: @Override public boolean onCreate() { Context context = getContext(); DBHelper = new DatabaseHelper(context); db = DBHelper.getWritableDatabase(); return (db == null) ? false : true; }
accepted answer of: http://stackoverflow.com/q/22543757
answers question: http://stackoverflow.com/q/22543757
type: Answer
has comment: http://stackoverflow.com/comment/56363723

http://stackoverflow.com/a/22584307
score: 1
has comment: http://stackoverflow.com/comment/34381902
has comment: http://stackoverflow.com/comment/34381802
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34382258
type: Answer
has comment: http://stackoverflow.com/comment/34381966
has body: Instead of checking that the array has no duplicates, you can use a bit more smartness while generating the numbers, such that uniqueness is enforced at the outset. Create a boolean[] as long as your range (49 entries); generate a random number from the full range; put that number into your output array; "cross out" the corresponding index in the boolean[]; now generate another random number, but curtail the range by one (now 48); instead of directly using that number as output, scan your boolean[], counting all the non-crossed entries. Stop when you reach the count equal to the random number generated in step 5. The number corresponding to that entry is your output number; go to step 4.
has comment: http://stackoverflow.com/comment/34381815
has comment: http://stackoverflow.com/comment/34381855
answers question: http://stackoverflow.com/q/22584244
has comment: http://stackoverflow.com/comment/34381733

http://stackoverflow.com/q/22599302
has title: Properly aligning Strings on the console
has body: I have this program that iterates through an ArrayList and prints out various cellphone related information to the console using System.out. for(Customer c: customers) System.out.println(c.getNumber() + " " + c.getName() + " " + out + " " + in + " " + c.getPlan().getMinutesAllowed() + " " + c.getPlan().getMinutesUsed() + " " + over + " " + base + " " + extra + " " + String.format("%.2f" ,hst) + " " + "$" + String.format("%.2f" ,total)); The problem I have is, Customers with longer names 'push' the space strings causing the alignment to mess up. Is there any way I can get the alignment to be uniform?
tagged with: java
has answer: http://stackoverflow.com/a/22599518
accepted answer: http://stackoverflow.com/a/22599518
type: Question
has comment: http://stackoverflow.com/comment/34408218
score: 0
tagged with: printing
answer count: 1
has comment: http://stackoverflow.com/comment/34408157
type: AnsweredQuestion

http://stackoverflow.com/q/22556070
answer count: 1
has comment: http://stackoverflow.com/comment/34331342
favorite count: 0
has comment: http://stackoverflow.com/comment/34329866
has comment: http://stackoverflow.com/comment/34330461
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34329996
has title: Is Maven better than the ant building tool for deploy an EAR project
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/22559476
has comment: http://stackoverflow.com/comment/34329945
tagged with: java
tagged with: gradle
downvote count: 1
has comment: http://stackoverflow.com/comment/34332426
type: Question
tagged with: jakarta-ee
has body: I am now using Ant 1.8 in my EAR project with JBoss 4.0.5 Technology I am using is JEE 1.5 with Struts 1.2 I have 3 Jars deployed in my EAR directory of JBoss. Currently ant is used for building the project and it takes around 30second to build the 1GB project. I want to change my building tool from ANT to Maven ? Will Maven be more help full and faster ?
tagged with: ant
has comment: http://stackoverflow.com/comment/34330204
score: 0
has comment: http://stackoverflow.com/comment/34806208
has comment: http://stackoverflow.com/comment/34330113

http://stackoverflow.com/q/22533879
type: Question
tagged with: android-camera
has comment: http://stackoverflow.com/comment/34291484
has comment: http://stackoverflow.com/comment/34291459
possible better answer: http://stackoverflow.com/a/22533942
has answer: http://stackoverflow.com/a/22533922
has answer: http://stackoverflow.com/a/22533942
has title: android - app crashes when saving photograph
has comment: http://stackoverflow.com/comment/34291319
answer count: 3
accepted answer: http://stackoverflow.com/a/22533970
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34291263
tagged with: android
has body: I've been following the camera guide from http://developer.android.com/guide/topics/media/camera.html Everything works until after I have taken the photograph and selected the tick to accept the image. Then I get the dreaded 'unfortunately app has stopped working'. I'm testing on a real nexus 5 device. My code is public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } /* Checks if external storage is available for read and write */ public boolean isExternalStorageWritable() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { return true; } return false; } /* Create a file Uri for saving an image or video */ private static Uri getOutputMediaFileUri(int type){ return Uri.fromFile(getOutputMediaFile(type)); } private static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 100; private Uri fileUri; public static final int MEDIA_TYPE_IMAGE = 1; public static final int MEDIA_TYPE_VIDEO = 2; /* Create a File for saving an image or video */ private static File getOutputMediaFile(int type){ File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES), "SimpleCamera"); // Create the storage directory if it does not exist if (! mediaStorageDir.exists()){ if (! mediaStorageDir.mkdirs()){ Log.d("SimpleCamera", "failed to create directory"); return null; } } // Create a media file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File mediaFile; if (type == MEDIA_TYPE_IMAGE){ mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_"+ timeStamp + ".jpg"); } else { return null; } return mediaFile; } public void openCamera(View view){ // create Intent to take a picture and return control to the calling application Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); fileUri = getOutputMediaFileUri(MED…
upvote count: 1
has comment: http://stackoverflow.com/comment/34291641
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22533970

http://stackoverflow.com/comment/34298751
type: Comment
has text: You could use something like Selenium to actually load the page in a real browser, and extract the image using that. This would result in the ad impression, but then you're back to the ethics question, as no human being will actually see the ad. :)
score: 1
comment on: http://stackoverflow.com/a/22537709
type: AnswerComment

http://stackoverflow.com/comment/34280495
type: QuestionComment
type: Comment
has text: utterly formatted :-( I do not see the problem description, stacktrace, anything ..
comment on: http://stackoverflow.com/q/22527866
score: 0

ant
tags question: http://stackoverflow.com/q/22641081
tags question: http://stackoverflow.com/q/22630973
tags question: http://stackoverflow.com/q/22584206
tags question: http://stackoverflow.com/q/22556070
tags question: http://stackoverflow.com/q/22503100
tags question: http://stackoverflow.com/q/22615107
tags question: http://stackoverflow.com/q/22617269
type: Tag
tags question: http://stackoverflow.com/q/22493736
tags question: http://stackoverflow.com/q/22531159
tags question: http://stackoverflow.com/q/22630235
tags question: http://stackoverflow.com/q/22646676
tags question: http://stackoverflow.com/q/22626015
tag name: ant
tags question: http://stackoverflow.com/q/22599739
tags question: http://stackoverflow.com/q/22636660
tags question: http://stackoverflow.com/q/22608862
tags question: http://stackoverflow.com/q/22585566
tags question: http://stackoverflow.com/q/22520093
tags question: http://stackoverflow.com/q/22499096
tags question: http://stackoverflow.com/q/22564338
tags question: http://stackoverflow.com/q/22615052
tags question: http://stackoverflow.com/q/22559269

http://stackoverflow.com/comment/34460364
has text: @RohitJain: [appearantly not](https://ideone.com/gnNcJO)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22628541
type: Comment

http://stackoverflow.com/q/22498282
upvote count: 1
has title: How to find the percentage within a given range in java
has comment: http://stackoverflow.com/comment/34228861
possible better answer: http://stackoverflow.com/a/22498807
downvote count: 1
has comment: http://stackoverflow.com/comment/34229573
has answer: http://stackoverflow.com/a/22498922
accepted answer: http://stackoverflow.com/a/22498922
favorite count: 0
has body: I have a given range say from "min" to "max". The min is represented as 100% and max is represented as 0%. The average value (min+max)/2 is represented as 50%. The input i will be giving is a value "x" within the range [min, max] and the output should be the percentage corresponding to the input provided. For example, consider than range as [100, 300] if x=100 then output=100% if x=300 then output=0% if x=200 then output=50% if x=150 then output=75% if x=250 then output=25% Whatever the value of x provided within the range [min, max] the corresponding percentage should be calculated. I have tried various logic but i cant seem to get the right formula for this problem.
tagged with: excel
type: Question
type: AnsweredQuestion
tagged with: numbers
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/34229666
tagged with: formula
has answer: http://stackoverflow.com/a/22498807
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34228770

dayofweek
type: Tag
tags question: http://stackoverflow.com/q/22624063
tag name: dayofweek

collections
tags question: http://stackoverflow.com/q/22487866
tags question: http://stackoverflow.com/q/22617910
tags question: http://stackoverflow.com/q/22560049
tags question: http://stackoverflow.com/q/22597705
tags question: http://stackoverflow.com/q/22617080
tags question: http://stackoverflow.com/q/22490784
tags question: http://stackoverflow.com/q/22593116
tags question: http://stackoverflow.com/q/22636575
tags question: http://stackoverflow.com/q/22545685
tags question: http://stackoverflow.com/q/22557042
tags question: http://stackoverflow.com/q/22548606
tags question: http://stackoverflow.com/q/22583179
tags question: http://stackoverflow.com/q/22595006
tags question: http://stackoverflow.com/q/22513509
tags question: http://stackoverflow.com/q/22509542
tags question: http://stackoverflow.com/q/22566653
tags question: http://stackoverflow.com/q/22522491
tags question: http://stackoverflow.com/q/22604754
tags question: http://stackoverflow.com/q/22566131
tags question: http://stackoverflow.com/q/22597645
type: Tag
tags question: http://stackoverflow.com/q/22519104
tags question: http://stackoverflow.com/q/22521784
tags question: http://stackoverflow.com/q/22528713
tags question: http://stackoverflow.com/q/22597067
tags question: http://stackoverflow.com/q/22644821
tags question: http://stackoverflow.com/q/22600606
tags question: http://stackoverflow.com/q/22647644
tags question: http://stackoverflow.com/q/22560163
tags question: http://stackoverflow.com/q/22642870
tags question: http://stackoverflow.com/q/22589955
tags question: http://stackoverflow.com/q/22557002
tag name: collections
tags question: http://stackoverflow.com/q/22593623
tags question: http://stackoverflow.com/q/22592768
tags question: http://stackoverflow.com/q/22571339
tags question: http://stackoverflow.com/q/22582313
tags question: http://stackoverflow.com/q/22570044
tags question: http://stackoverflow.com/q/22530076
tags question: http://stackoverflow.com/q/22588379
tags question: http://stackoverflow.com/q/22528306
tags question: http://stackoverflow.com/q/22635676
tags question: http://stackoverflow.com/q/22574718
tags question: http://stackoverflow.com/q/22514877
tags question: http://stackoverflow.com/q/22607013

http://stackoverflow.com/comment/34244303
score: 0
type: Comment
type: QuestionComment
has text: @NARESHREDDY I think that the way i did is also right? Because it does the same thing if it worked :(
comment on: http://stackoverflow.com/q/22507545

http://stackoverflow.com/q/22539430
has comment: http://stackoverflow.com/comment/34302183
has comment: http://stackoverflow.com/comment/34302063
has comment: http://stackoverflow.com/comment/34301326
has comment: http://stackoverflow.com/comment/34302091
upvote count: 2
has title: Having trouble with my java factorial assignment
tagged with: java
has comment: http://stackoverflow.com/comment/34302049
has body: Can anyone help with my java factorial assignment? i think im doing it right but im not for sure. I need to have the user input a number and then calculate the factorials of the input number. Like is the person enter 10, the user would see this as an output: 0! = 1, 1! = 1, 2! = 2, 3! = 6, 4! = 24, 5! = 120, 6! = 720, 7! = 5040, 8! = 40320, 9! = 362880 import java.lang.Math; import java.util.Scanner; public class Factorial { public static int factorial( int iNo ) { if (iNo &lt; 0) throw new IllegalArgumentException("iNo must be &gt;= 0"); int factorial = 1; for(int i = 2 ; i &lt;= iNo; i++) factorial *= i; System.out.println ( i + "! = " + factorial(i)); return factorial ; } } public class Factorial{ public static void main ( String args[] ){ Scanner input = new Scanner (System.in); System.out.println("Enter number of factorials to calculate: " ); int iNo = input.nextInt(); for(int i = 0; i &lt;= iNo; i++) factorial *= i; System.out.println ( i + "! = " + factorial(i)); } }
type: Question
accepted answer: http://stackoverflow.com/a/22539550
has comment: http://stackoverflow.com/comment/34301372
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22539534
has comment: http://stackoverflow.com/comment/34301911
has answer: http://stackoverflow.com/a/22539534
answer count: 2
score: 2
downvote count: 0
favorite count: 0
tagged with: factorial
has answer: http://stackoverflow.com/a/22539550
has comment: http://stackoverflow.com/comment/34301538

http://stackoverflow.com/q/22579601
has body: I am having an error when using IMediaWriter.close(); from Xuggle. relevant code of Main Class: protected IMediaWriter WRITER = ToolFactory.makeWriter(OUTPUT_FILE); protected static final String OUTPUT_FILE = "C:/Users/Ryan.D/Desktop/fileTest.mp4"; protected void stopThreads() { textField.setBackground(Color.RED); capture = false; try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } WRITER.addVideoStream(0, 0, ICodec.ID.CODEC_ID_MPEG4, SCREEN_BOUNDS.width / 2, SCREEN_BOUNDS.height / 2); long startTime = System.nanoTime(); for (int index = 0; index &lt; (FRAME_TIME * images.size()) * FRAME_RATE; index++) { BufferedImage converted = convert(images.get(index), BufferedImage.TYPE_3BYTE_BGR); WRITER.encodeVideo(0, converted, System.nanoTime() - startTime, TimeUnit.NANOSECONDS); try { Thread.sleep((long) (1000 / FRAME_RATE)); } catch (InterruptedException e) { // e.printStackTrace(); } } WRITER.flush(); WRITER.close(); } Error: Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: error Operation not permitted, failed to write trailer to C:/Users/Ryan.D/Desktop/fileTest.mp4 I am not sure why this is happening, I have looked around for a solution but most of the other solutions relate to Audio whereas mine is just Video. Thanks Ryan.
type: Question
has comment: http://stackoverflow.com/comment/38692522
has comment: http://stackoverflow.com/comment/38667553
upvote count: 1
has comment: http://stackoverflow.com/comment/38711845
favorite count: 0
answer count: 0
type: UnansweredQuestion
has title: RuntimeException: Operation not permitted, failed to write trailer. When using IMediaWriter
tagged with: xuggle
has comment: http://stackoverflow.com/comment/38661480
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38613302

http://stackoverflow.com/a/22519108
answers question: http://stackoverflow.com/q/22519055
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: First You need to add ActionListener to your buttons: button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // set text. } }); Then you can set the text to text field, as: textField.setText(buttonText);

java-8
tags question: http://stackoverflow.com/q/22642961
tags question: http://stackoverflow.com/q/22625065
tags question: http://stackoverflow.com/q/22532051
tags question: http://stackoverflow.com/q/22542061
tags question: http://stackoverflow.com/q/22601036
tags question: http://stackoverflow.com/q/22569040
tags question: http://stackoverflow.com/q/22528373
tags question: http://stackoverflow.com/q/22608892
tags question: http://stackoverflow.com/q/22516331
tags question: http://stackoverflow.com/q/22490835
tags question: http://stackoverflow.com/q/22636747
tags question: http://stackoverflow.com/q/22539779
tags question: http://stackoverflow.com/q/22610400
tags question: http://stackoverflow.com/q/22632527
tags question: http://stackoverflow.com/q/22598665
tags question: http://stackoverflow.com/q/22572762
tags question: http://stackoverflow.com/q/22509488
tags question: http://stackoverflow.com/q/22630750
tags question: http://stackoverflow.com/q/22595720
tags question: http://stackoverflow.com/q/22511750
tags question: http://stackoverflow.com/q/22572230
tags question: http://stackoverflow.com/q/22503100
tags question: http://stackoverflow.com/q/22512205
tags question: http://stackoverflow.com/q/22553611
tags question: http://stackoverflow.com/q/22497165
tags question: http://stackoverflow.com/q/22524149
tags question: http://stackoverflow.com/q/22576943
tags question: http://stackoverflow.com/q/22601925
tags question: http://stackoverflow.com/q/22509621
tags question: http://stackoverflow.com/q/22533772
tags question: http://stackoverflow.com/q/22596495
tags question: http://stackoverflow.com/q/22584496
tags question: http://stackoverflow.com/q/22574317
tags question: http://stackoverflow.com/q/22587055
tags question: http://stackoverflow.com/q/22611222
tags question: http://stackoverflow.com/q/22644441
tags question: http://stackoverflow.com/q/22575526
tags question: http://stackoverflow.com/q/22601660
tags question: http://stackoverflow.com/q/22573958
tags question: http://stackoverflow.com/q/22644707
tags question: http://stackoverflow.com/q/22576855
tags question: http://stackoverflow.com/q/22648079
tags question: http://stackoverflow.com/q/22637900
tags question: http://stackoverflow.com/q/22551207
tags question: http://stackoverflow.com/q/22619262
tags question: http://stackoverflow.com/q/22529639
tags question: http://stackoverflow.com/q/22620664
tags question: http://stackoverflow.com/q/22526695
tags question: http://stackoverflow.com/q/22642230
tags question: http://stackoverflow.com/q/22493882
tag name: java-8
tags question: http://stackoverflow.com/q/22561614
tags question: http://stackoverflow.com/q/22544064
tags question: http://stackoverflow.com/q/22578888
tags question: http://stackoverflow.com/q/22591499
tags question: http://stackoverflow.com/q/22614746
tags question: http://stackoverflow.com/q/22577261
type: Tag
tags question: http://stackoverflow.com/q/22528767
tags question: http://stackoverflow.com/q/22534454
tags question: http://stackoverflow.com/q/22527335
tags question: http://stackoverflow.com/q/22531237
tags question: http://stackoverflow.com/q/22577197
tags question: http://stackoverflow.com/q/22588518
tags question: http://stackoverflow.com/q/22635945
tags question: http://stackoverflow.com/q/22522490
tags question: http://stackoverflow.com/q/22554425
tags question: http://stackoverflow.com/q/22633826
tags question: http://stackoverflow.com/q/22647486

http://stackoverflow.com/a/22665753
answers question: http://stackoverflow.com/q/22554591
has comment: http://stackoverflow.com/comment/34764779
has body: private static String getMimeType(String fileUrl) { String extension = MimeTypeMap.getFileExtensionFromUrl(fileUrl); return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); }
type: Answer
score: 0

http://stackoverflow.com/comment/34415154
type: Comment
score: 0
has text: I've checked this. DNS resolution is not the problem.
type: AnswerComment
comment on: http://stackoverflow.com/a/22541120

http://stackoverflow.com/a/22610178
score: 0
answers question: http://stackoverflow.com/q/22609855
has comment: http://stackoverflow.com/comment/34436291
has comment: http://stackoverflow.com/comment/34427597
has body: Your client is trying to connect to "ip_globale_server". Try using your servers ip address instead. Also make sure your phone and server are on the same network. If your phone is on 3g it will not be able to connect to your local development server. Apart from that i agree with the others about gcm
type: Answer
has comment: http://stackoverflow.com/comment/34427201

http://stackoverflow.com/a/22493581
answers question: http://stackoverflow.com/q/22493246
upvote count: 3
has comment: http://stackoverflow.com/comment/34221405
has comment: http://stackoverflow.com/comment/34221112
score: 3
type: AcceptedAnswer
downvote count: 0
has body: try this. I guess this is what you are trying to achieve. If this is correct I will add explanation later import java.util.*; import java.lang.*; import java.io.*; class Ideone { public static void main (String[] args) throws java.lang.Exception { String s = "Hello Wo"; String s2 = "Hello World"; String small,large; if(s.length() &gt; s2.length()) {small = s2;large = s;} else {small = s;large = s2;} int index = 0; for(char c: large.toCharArray()) { if(index==small.length()) break; if(c != small.charAt(index)) break; index++; } if(index==0) System.out.println(""+s+ " and "+s2+ " have no common prefix"); else System.out.println(large.substring(0,index)); } } Edit: I find the larger of the strings and choose it to be the outer string to loop throught toCharArray() converts the string into characters so you can loop through each characters in the string using Java's foreach (For more click[1]) Inside the loop you should exit on two conditions End of the string (I use length to find if I reach end of smaller string) no more matching characters between two strings you increment the index until you break out in one of the above conditions By the time you break out of the for loop, index will contain the last index where both string are continuously equal. If index = 0. just say no matches else print characters from 0 until index
has comment: http://stackoverflow.com/comment/34221210
accepted answer of: http://stackoverflow.com/q/22493246
type: Answer
has comment: http://stackoverflow.com/comment/34221510

http://stackoverflow.com/comment/34235489
comment on: http://stackoverflow.com/q/22502047
score: 0
has text: u can possibly use same TimerTask with a new instance of Timer
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34442814
type: QuestionComment
comment on: http://stackoverflow.com/q/22618656
has text: By "tab" do you mean "array"?
score: 0
type: Comment

http://stackoverflow.com/q/22568724
answer count: 0
type: UnansweredQuestion
has body: I have the following server class in my GWT web app. public class WTMServiceImpl extends RemoteServiceServlet implements WTMService {} I had defined the path : @RemoteServiceRelativePath("wtmService") It works. Then I added an http server class: public class WTMhttpServiceImpl extends HttpServlet implements WTMhttpService {} and path: @RemoteServiceRelativePath("wtmhttpService") public interface WTMhttpService { void doGet(HttpServletRequest request,HttpServletResponse response); } On deploying the app, I get RPC Failure error message(500 POST Internal Server Error). Why am I getting RPC failure? How do I make both servers work simultaneously?
tagged with: http
has comment: http://stackoverflow.com/comment/34352821
type: Question
tagged with: gwt
tagged with: java
has comment: http://stackoverflow.com/comment/34352981
has comment: http://stackoverflow.com/comment/34354096
has comment: http://stackoverflow.com/comment/34354316
score: 0
tagged with: google-app-engine
has title: RPC Failure message on deploying web app on GAE
tagged with: android

http://stackoverflow.com/comment/34507148
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22631685
has text: Why code an applet? If it is due to spec. by teacher, please refer them to [Why CS teachers should stop teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/).
score: 0

http://stackoverflow.com/q/22615719
favorite count: 0
type: UnansweredQuestion
tagged with: curl
has title: Consuming API Curl to Java Application
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: https
type: Question
has body: I have an URL that requires me digest auth using username and password. curl -k --digest -u user:password https://api.uni5.net/cliente But have no idea how to use Digest in get Request for Java application. I'm searching for a simple way, cuz actually we dont use Java in our development, but now we need to use it inside the server. Thanks for help!
tagged with: digest-authentication
downvote count: 0

http://stackoverflow.com/q/22587608
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
tagged with: multidimensional-array
upvote count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22587637
type: Question
has body: Here is my string 100000000000000000000000000000000000000000000000000000000000 a string combined with 60 1/0. I want to put it into a int Array[6][10]. I tried to add "," between each row, but it failed String data = "1000000000,0000000000,0000000000,0000000000,0000000000,0000000000"; String[] rows = data.split(","); String[][] matrix = new String[rows.length][]; int r = 0; for (String row : rows) { matrix[r++] = row.split("\\|"); } System.out.print(matrix); Please help and solve this problem, thank you!
has title: How to convert the string into a fixed int 2D array(special case)?
score: 2

http://stackoverflow.com/q/22584417
has title: Spring autowiring not working with lazy-init
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22584454
tagged with: spring
tagged with: autowired
tagged with: sessionfactory
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22584454
type: Question
has body: I am trying to autowire my sessionFactory bean with Spring when I kick off an integration test. As I am creating a new instance of a service class in my test, I believe I need to lazy-init. For the life of me I have no idea why my sessionFactory continues to be null. Please help! applicationContext.xml org.hibernate.dialect.MySQLDialect true MyServiceImpl.java @Autowired SessionFactory sessionFactory; public HibernateTemplate getHibernateTemplate() { return new HibernateTemplate(this.sessionFactory); } Test.java public void test() { MyServiceImpl impl = (MyServiceImpl) Class.forName("foo.package.MyServiceImpl").newInstance(); HibernateTemplate template = impl.getHibernateTemplate(); } My "template" variable in the test is always null.

http://stackoverflow.com/comment/34370663
score: 0
type: Comment
type: QuestionComment
has text: I have noticed that the port number is missing from the download urls
comment on: http://stackoverflow.com/q/22567874

http://stackoverflow.com/comment/34262051
has text: You can't just System.out.println(linked); and expect it to output your list. You must iterate through all your list items using linkedlist.get() (you must implement this function as well)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22517301

http://stackoverflow.com/comment/34433895
comment on: http://stackoverflow.com/a/22608908
type: Comment
has text: yes, now I moved the if loop and it works! thank you :)
type: AnswerComment
score: 0

http://stackoverflow.com/q/22597183
linked to: http://stackoverflow.com/q/27451001
has comment: http://stackoverflow.com/comment/34538426
type: Question
has comment: http://stackoverflow.com/comment/43367608
has comment: http://stackoverflow.com/comment/34411305
answer count: 1
has comment: http://stackoverflow.com/comment/34477506
downvote count: 0
has body: I am going to use rootbeer1 for the first time. I am in windows 7 machine, 32 bit system having GForce 610 GPU. I installed CUDA 5.5 successfully and executed the examples to make sure it works fine too. Then I installed rootbeer1 according to the guidance given in the github page. Then I loaded Rootbeer.jar into NetBeans IDE as an external jar and copied and pasted the example code of rootbeer which is listed in here. One change I made is changing the imports, where the code in github page imports import edu.syr.pcpratts.rootbeer.runtime.Rootbeer; import edu.syr.pcpratts.rootbeer.runtime.Kernel; and my code imports import org.trifort.rootbeer.runtime.Rootbeer; import org.trifort.rootbeer.runtime.Kernel; Apart from that I changed rootbeer.runAll(jobs); to rootbeer.run(jobs); because rootbeer.runAll(); does not exists. That is because netbeans says package edu.syr.pcpratts.rootbeer.runtime.Rootbeer does not exists. Below is my code KeepMainTest.java import java.util.ArrayList; import java.util.List; import org.trifort.rootbeer.runtime.Kernel; import org.trifort.rootbeer.runtime.Rootbeer; public class KeepMainTest { public static void main(String[] args){ KeepMainTest app = new KeepMainTest(); int[] array = new int[10]; for(int i = 0; i &lt; array.length; ++i){ array[i] = i; } for(int i = 0; i &lt; array.length; ++i){ System.out.println("array["+i+"] = " + array[i]); } app.MultiplyArray(array, 5); for(int i = 0; i &lt; array.length; ++i){ System.out.println("array["+i+"] * 5 = " + array[i]); } } public void MultiplyArray(int[] array, int width){ List&lt;Kernel&gt; jobs = new ArrayList&lt;Kernel&gt;(); for(int i = 0; i &lt; array.length; ++i){ jobs.add(new Multiply(array, i, width)); } Rootbeer rootbeer = new Rootbeer(); rootbeer.runAll(jobs); } } Multiply.java import org.trifort.rootbeer.runtime.Kernel; public class Multiply implements Kernel { private int[] m_array; private int m_index; private int m_width; public Multiply(int[] array, int index, int width){ m_array …
has comment: http://stackoverflow.com/comment/34565686
has comment: http://stackoverflow.com/comment/34561668
tagged with: classcastexception
has comment: http://stackoverflow.com/comment/34417981
has comment: http://stackoverflow.com/comment/34428933
has answer: http://stackoverflow.com/a/22617919
has comment: http://stackoverflow.com/comment/43363743
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34428109
has comment: http://stackoverflow.com/comment/34427990
has comment: http://stackoverflow.com/comment/34537885
has comment: http://stackoverflow.com/comment/34560124
has title: Unable to cast a class error
type: AnsweredQuestion
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/22617919
tagged with: java
has comment: http://stackoverflow.com/comment/34405767
tagged with: rootbeer

http://stackoverflow.com/comment/34386816
comment on: http://stackoverflow.com/q/22586233
has text: I see you've done as I've suggested. I'll take a look at it tomorrow. I'm in bed at the moment :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22778344
has body: do a export CASSANDRA_HOME=location of cassandra should work in 2.0.6 i verified just then without setting that variable and after setting those variables. $ export CASSANDRA_HOME=/usr/local/cassandra/dsc-cassandra-2.0.6 $ /usr/local/cassandra/dsc-cassandra-2.0.6/bin/cassandra or $ cd /usr/local/cassandra/dsc-cassandra-2.0.6 $ export CASSANDRA_HOME= $ bin/cassandra in fact you can also set CASSANDRA_HOME= in cassandra-2.0.6 directory. set it to empty value if you are executing the export command from the cassandra directory.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22512840
score: 7
upvote count: 7

http://stackoverflow.com/comment/36901381
type: AnswerComment
comment on: http://stackoverflow.com/a/23880278
score: 0
type: Comment
has text: @vrz the target type being included in the constraint development is the crux of the type inference improvement in Java 8. Your statement in the answer that "So the compiler ends up gathering constraints from both operands, leading to an unsolvable constraint set" seems incorrect to me; in Java 7 both operands generate constraints in the same way. The problem is that in Java 8, according to your reading, 18.2.3 turns a "contains" constraint into an "equals" constraint for no good reason. However I'm not even sure that your reading is correct since it requires that `T` is a type.

executorservice
type: Tag
tags question: http://stackoverflow.com/q/22622894
tag name: executorservice

http://stackoverflow.com/comment/34356334
comment on: http://stackoverflow.com/a/22568525
has text: Where are you stuck? Are you getting any exception?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34396706
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22590537
has text: Hi, do you use XML or JSON?

http://stackoverflow.com/q/22533399
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34291242
tagged with: spring
score: 10
duplicate of: http://stackoverflow.com/q/17121620
has comment: http://stackoverflow.com/comment/34290767
tagged with: java
tagged with: spring-data
has body: I have the following service: @Service public class CamelService { @Transactional public aCamelThing() { Camel camel = this.camelRepository.findOne(1); System.out.println(camel.getCamelName()); // prints "normalCamel" // simple hql set field 'camelName' int res = this.camelRepository.updateCamelName(1,"superCamel!"); Camel camelWithNewName = this.camelRepository.findOne(1); System.out.println(camelWithNewName .getCamelName()); // prints "normalCamel" ?!?!? } } Any idea how can i achieve the goal that the second println will print: "superCamel!" ? (separating the second call to a new transaction is not ideal).
upvote count: 10
answer count: 1
has answer: http://stackoverflow.com/a/22551997
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34290890
linked to: http://stackoverflow.com/q/17121620
has title: Why do I not see changes issued through an update query with Spring Data JPA?
tagged with: jpa
downvote count: 0

http://stackoverflow.com/q/22546028
tagged with: nullpointerexception
answer count: 3
possible better answer: http://stackoverflow.com/a/59376161
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22546154
type: AnsweredQuestion
tagged with: fxml
tagged with: java
tagged with: javafx
has body: Hi first time here but here goes: I have a JavaFX application that changes the FXML UI labels dynamically and the data is pulled from a Player class. The two classes in question are Player.java and InterfaceHandler.java. The player class stores player details and I want to pass the details to the Interface class which sets the text on the labels. As a test my FXML UI just has a button and two labels. If it click the button it calls the handleButton method it sets locationLabel to "Town" fine. However if I call the locationLabel() method in my Player class I get a NullPointerException when nameLabel.setText(name) is called. Through debugging I find that the name string in the Interface class is what it should be "Dan". Can anyone help? Main class: public class Main extends Application { public void start(final Stage mainStage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("MainScreen.fxml")); Scene scene = new Scene(root); mainStage.setTitle("Main Screen"); mainStage.setScene(scene); mainStage.show(); } public static void main(String[] args) { launch(args); } } Player class: public class Player{ InterfaceHandler ui = new InterfaceHandler(); public void setNameLabel() { String name = "Dan"; ui.setName(name); } InterfaceHandler class: public class InterfaceHandler implements Initializable { public Label nameLabel; public Label locationLabel; public void handleButton(ActionEvent event) throws IOException { locationLabel.setText("Town"); } public void setName(String name){ nameLabel.setText(name); } } MainScreen.fxml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import java.lang.*?&gt; &lt;?import java.net.*?&gt; &lt;?import java.util.*?&gt; &lt;?import javafx.scene.*?&gt; &lt;?import javafx.scene.control.*?&gt; &lt;?import javafx.scene.effect.*?&gt; &lt;?import javafx.scene.image.*?&gt; &lt;?import javafx.scene.layout.*?&gt; &lt;?import javafx.scene.text.*?&gt; &lt;AnchorPane id="AnchorPane" prefHeight="629.0" prefWidth="600.0" snapToPixel…
type: Question
accepted answer: http://stackoverflow.com/a/22546154
has answer: http://stackoverflow.com/a/78668776
has answer: http://stackoverflow.com/a/59376161
has title: label.setText NullPointerException
score: 4
upvote count: 4
tagged with: settext

http://stackoverflow.com/comment/34433124
comment on: http://stackoverflow.com/a/22605077
score: 0
type: AnswerComment
type: Comment
has text: Ok, Are you calling the close() method several times?

xlet
tags question: http://stackoverflow.com/q/22605106
tag name: xlet
type: Tag

http://stackoverflow.com/comment/34442183
comment on: http://stackoverflow.com/q/22618323
score: 5
type: Comment
type: QuestionComment
has text: please copy full error message.

http://stackoverflow.com/a/22590589
type: Answer
answers question: http://stackoverflow.com/q/22590530
has body: Using Look behinds,this should work- Search for - (?&lt;!;)\n Replace with - (Empty string - '') Demo here
score: 0

http://stackoverflow.com/q/22635786
score: 1
has title: Setenv in /etc/launchd.conf not taking whole string in OSX Mavericks
favorite count: 0
tagged with: terminal
has comment: http://stackoverflow.com/comment/34473065
type: Question
tagged with: macos
tagged with: setenv
upvote count: 1
tagged with: java
type: UnansweredQuestion
has body: Hey I'm wondering if there is a constraint on using setenv to setup environment variables in OSX Mavericks? I have the following setup in /etc/launchd.conf: setenv CLASSPATH .:/Users/admin/Documents/workspace/..... (More paths here. In total 6557 characters long) What I'm finding is on start up the environment variable $CLASSPATH is only saving a fraction of the string. Only 982 characters in the string are being saved. If anyone has any knowledge of how to fix this it would be much appreciated. I'm getting sick of exporting CLASSPATH=path every time I open a terminal window. Thanks!
has comment: http://stackoverflow.com/comment/34477490
tagged with: environment-variables
has comment: http://stackoverflow.com/comment/34472556
downvote count: 0
answer count: 0

http://stackoverflow.com/comment/34227064
type: QuestionComment
comment on: http://stackoverflow.com/q/22496739
type: Comment
has text: Yes.. I should not be using it.?
score: 0

http://stackoverflow.com/comment/34278753
score: 0
comment on: http://stackoverflow.com/q/22507055
has text: I have done that - perhaps my issue #1 wasn't clear. The problem is that it is ONLY called when the user HAS added a file name - the "required" property does not seem to work in this context.... - I have edited my question to include the definition of the fileupload.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34591447
has text: *"It helped the skipping"* OK now try 1 second, 1/2 a second and 1/4 of a second.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22628569

http://stackoverflow.com/a/22622006
type: Answer
has body: Yes, a spline would work for you. Specifically i would recommend a cubic spline, because later on if you wanted do a different shape, maybe a Street Fighter style uppercut, you could re-use the same code. I remember cubic spline being a decent, general solution. As far as solving for a cubic spline I would recommend you just Google for pseudo code which makes sense to you. That's only if you really want to generically solve for a suitable cubic spline on the fly. In practice, i imagine the shape you want will be the same almost all the time? If so, you can probably solve a few general cases of a spline and save it to some fast data structure to improve performance. In example, for y=x a suitable array holding the necessary information (pre-processed) would be x[0] = 1,x[1] = 1,x[2] = 2 ... x[n] = n. In practice, you could come up with an equation to model a simple two point spline. A cubic equation has 4 unknowns. So you have two data points at least, you're starting point and your end point. In addition, you can calculate the derivative of him when he jumps. For your fourth point you could use either another point you want him to jump through, or the derivative when he lands. Then use https://www.wolframalpha.com/ to solve the equation for you. Or use an equation to solve cubics. Another thing you can do is just calculate the arc using the quadratic equation + gravity + wind resistance. Again, Google knows how to solve that. This page is something i quickly found that looks like it could do the trick. http://www.physicsclassroom.com/class/vectors/Lesson-2/Non-Horizontally-Launched-Projectiles-Problem-Solv
answers question: http://stackoverflow.com/q/22621638
score: 0

http://stackoverflow.com/comment/34466267
comment on: http://stackoverflow.com/q/22500727
has text: The question is OK. +1 here.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22499283
tagged with: swing
has comment: http://stackoverflow.com/comment/34230983
tagged with: java
has comment: http://stackoverflow.com/comment/34272588
linked to: http://stackoverflow.com/q/15707496
tagged with: jfreechart
has comment: http://stackoverflow.com/comment/34232732
type: Question
has body: I know this question has been asked earlier (here ,here and here), but the offered solutions are not working. Hence, please don't mark it as duplicate. I am drawing a line chart using the JFreeChart. Then I put this chart inside a JPanel which is then put in a tabbedPane. I know directly putting the JPanel in a JFrame makes it resizable but how can I do it this way? public class DynamicLineAndTimeSeriesChart extends JPanel implements ActionListener { private ArrayList&lt;TimeSeries&gt; Series = new ArrayList&lt;TimeSeries&gt;(); private ArrayList&lt;Double&gt; Last = new ArrayList&lt;Double&gt;(); private String Id1; private Timer timer = new Timer(250, this); public DynamicLineAndTimeSeriesChart(String id) { Runtime runtime = Runtime.getRuntime(); int NoOfProc = runtime.availableProcessors(); for (int i = 0; i &lt; NoOfProc; i++) { Last.add(new Double(100.0)); Series.add(new TimeSeries("Core" + i, Millisecond.class)); } Id1 = id; final TimeSeriesCollection dataset = new TimeSeriesCollection(); for (int i = 0; i &lt; NoOfProc; i++) { dataset.addSeries(this.Series.get(i)); } final JFreeChart chart = createChart(dataset); timer.setInitialDelay(1000); chart.setBackgroundPaint(Color.LIGHT_GRAY); //Created JPanel to show graph on screen final JPanel content = new JPanel(new GridLayout()); final ChartPanel chartPanel = new ChartPanel(chart); content.add(chartPanel, BorderLayout.CENTER); content.revalidate(); this.add(content); timer.start(); } createChart is a method of type JFreeChart. This class is called in another class JPanel main = new JPanel(new BorderLayout()); main.add(demo); jTabbedPane1.add("Core", main); demo.setVisible(true); The frame designing was done using NetBeans. I have tried all the solution like changing the layouts from BorderLayout to GridBagLayout and even the one mentioned here.
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/34230820
has answer: http://stackoverflow.com/a/22525687
has comment: http://stackoverflow.com/comment/34231081
has comment: http://stackoverflow.com/comment/34272671
score: 0
has answer: http://stackoverflow.com/a/22504565
linked to: http://stackoverflow.com/q/13229097
linked to: http://stackoverflow.com/q/21504141
answer count: 3
has title: Resizable JFreeChart inside a JPanel
linked to: http://stackoverflow.com/q/8204544
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/49123920

http://stackoverflow.com/q/22540171
has comment: http://stackoverflow.com/comment/34302699
has comment: http://stackoverflow.com/comment/34302865
has comment: http://stackoverflow.com/comment/34302635
linked to: http://stackoverflow.com/q/52353
tagged with: bit
accepted answer: http://stackoverflow.com/a/22540600
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22540815
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34302662
has answer: http://stackoverflow.com/a/22540815
type: Question
linked to: http://stackoverflow.com/q/9368764
has title: Getting length of a number's bits
has answer: http://stackoverflow.com/a/22540600
answer count: 2
has body: int g = 269;//1_0000_1101 System.out.println( length(Integer.toBinaryString(g))); This will print 18(why?), but I want it to print 9. How can I do that?

http://stackoverflow.com/comment/34270750
has text: @DavidWallace Yes. I have accepted that as my answer.
comment on: http://stackoverflow.com/q/22518614
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22497518
upvote count: 1
has comment: http://stackoverflow.com/comment/34227571
has comment: http://stackoverflow.com/comment/34227668
has comment: http://stackoverflow.com/comment/34228099
favorite count: 0
downvote count: 0
has body: Is it possible to have JavaScript Array show below in JAVA? var myArray = [ [‘2011-1-1’, 2],...] I'm trying to store date and value as a pair in an array. Is there an alternative method in JAVA to do something similar?
type: AnsweredQuestion
has title: JavaScript type arrays in JAVA
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22497758
accepted answer: http://stackoverflow.com/a/22497758
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/34227560
tagged with: javascript
has comment: http://stackoverflow.com/comment/34227608
has comment: http://stackoverflow.com/comment/34227577

http://stackoverflow.com/comment/34241736
type: QuestionComment
comment on: http://stackoverflow.com/q/22506143
type: Comment
has text: Post your logcat here.
score: 1

http://stackoverflow.com/q/22581077
has answer: http://stackoverflow.com/a/22581156
score: 0
answer count: 3
has body: I have thread which contains a loop while(isRunning){ } isRunning is a Boolean variable with the value true, when some clicks on a button it gets false and so it leaves the loop and the run() function of the thread. I want to create another button that on click it will reenter the run() function. I am not sure if when I leave the run() function the thread dies or just stops. I have tried using thread.run() but it didnt work. Also I have looked for an answer in other's people questins about this matter but nothing seemed to help me. Thanks for the help
has title: Restarting a thread after it has been left
tagged with: android
has answer: http://stackoverflow.com/a/22581510
has comment: http://stackoverflow.com/comment/34374981
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/22581460
type: Question
possible better answer: http://stackoverflow.com/a/22581460
accepted answer: http://stackoverflow.com/a/22581510

http://stackoverflow.com/q/22539790
has title: Set Attribute Value
tagged with: sax
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/22540404
has body: How can i set a value to id attribute during creating an xml file, where id values can be anything, for example it can be id="1" or id="A" or id="k1", id="k2" public void process(String s) throws SAXException { try { atts.clear(); k++; atts.addAttribute("", "", "id", "", "" + k); th.startElement("", "", "trans-unit", atts); th.startElement("", "", "target", null); th.characters(elements[i].toCharArray(), 0, elements[i].length()); th.endElement("", "", "target"); th.endElement("", "", "trans-unit"); }
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/1937880
type: UnansweredQuestion

http://stackoverflow.com/comment/81282713
type: Comment
score: 1
has text: Solution 2) here is much less intrusive than creating a filter. The entity returned by the server is indirectly available in the thrown exception (through the Response object).
comment on: http://stackoverflow.com/a/46160615
type: AnswerComment

http://stackoverflow.com/a/22553223
accepted answer of: http://stackoverflow.com/q/22552874
has body: You are comparing before populating userNumber with all the numbers from the file. You just have to move the statement doCompare(lottoNumber, userNumber) outside the while loop : while (dat.hasNextInt()) { userNumber[i++] = dat.nextInt(); System.out.println(""); //doCompare(lottoNumber, userNumber); } doCompare(lottoNumber, userNumber);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22552874
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/34925674
answers question: http://stackoverflow.com/q/22617743
score: 0
type: Answer
has body: Add ':other:jar' to: task createClientJar(type: Copy, dependsOn: ':other:jar') { ... } and it will work! For more info https://docs.gradle.org/current/userguide/multi_project_builds.html

http://stackoverflow.com/comment/34478655
comment on: http://stackoverflow.com/q/22637900
has text: Or anonymous classes with multiple methods, or ...
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34246853
score: 0
comment on: http://stackoverflow.com/q/22508922
type: Comment
type: QuestionComment
has text: the debug stops at con = DriverManager.getConnection(DatabaseURL, userName, password);

http://stackoverflow.com/q/22537833
type: Question
has answer: http://stackoverflow.com/a/22537883
tagged with: if-statement
has answer: http://stackoverflow.com/a/22537908
possible better answer: http://stackoverflow.com/a/22537919
downvote count: 0
has answer: http://stackoverflow.com/a/22537919
has body: I am doing a simple project just to keep myself a bit fresh. Decided to do a Vending Machine. well I to the end and test it. It does case 1 and 2 just fine but when I get to case 3 it either finishes out the entire program when i select a snack option or if i change it to a if/else in case 3 it will just stop running when i select a snack. Why is it doing this? what can i do to fix it? import java.util.Scanner; public class Vending { public static void main(String[] args) { int choice; double deposit = 0; double total = 0; Scanner keyboard = new Scanner(System.in); boolean test = true; do { System.out.println("\nVending Machine Menu"); System.out.println("\n \n1. View Items"); System.out.println("2. Put Money into Machine"); System.out.println("3. Select an Item"); System.out.println("4.Recieve Change"); System.out.println("5.Exit"); System.out.println("\nPlease Make a Selection: "); choice = keyboard.nextInt(); switch(choice) { case 1 : System.out.println("\n 1. Fizzy soda : $0.50 \n 2. Gummi Possums : $0.25" + "\n 3. Doggy Bones : $0.25 \n 4. Fruity Punch : $0.50"); System.out.println("Press ENTER to continue"); try{System.in.read();} catch(Exception e){} break; case 2: System.out.println("Enter amount to deposit: "); deposit = keyboard.nextDouble(); total = total + deposit; break; case 3: Scanner keypad = new Scanner(System.in); System.out.println("\n 1. Fizzy soda : $0.50 \n 2. Gummi Possums : $0.25" + "\n 3. Doggy Bones : $0.25 \n 4. Fruity Punch : $0.50"); System.out.println("\nSelect an item: "); int snack = keypad.nextInt(); if (total &gt; 0) { if(snack == 1) { if (total &gt;= .5) { System.out.println("The Vending Machine dispenses a FIZZY SODA"); total = total - .5; } else { System.out.println("Deposit more money"); } } else if(snack == 2) { if (total &gt;= .25) { System.out.println("The Vending Machine dispenses a package of GUMMI POSSUMS"); total = total - .25; } else { System.out.println("Deposit more money"); } } else if(snack == 3) { if(total &gt;= .25…
favorite count: 0
accepted answer: http://stackoverflow.com/a/22537908
has title: The switch just continues
has answer: http://stackoverflow.com/a/22537879
has comment: http://stackoverflow.com/comment/34298708
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34302797
score: 1
tagged with: java
upvote count: 1
tagged with: switch-statement

http://stackoverflow.com/q/22615107
accepted answer: http://stackoverflow.com/a/22615479
tagged with: java
type: Question
tagged with: ant
answer count: 1
has body: I am new to apache ant and I am currently working on an apache Ant project. I Just started out, imported the project into workspace and tried to run the build.xml. I added all the libraries that come with the original project to the build path. I am having the following problem. Please someone else wrote the code and I am supposed to improve it. The directories this is all about exist in the project directory. BUILD FAILED C:\workspace\MyApp\build.xml:83: srcdir "C:\workspace\MyApp\${compile.javac.srcdir}" does not exist! The error code is referencing the following part of the build.xml file <fileset dir="${compile.javac.srcdir}" includes="${compile.copy.include}" excludes="${compile.copy.exclude}"/> <xmlbean schema="config/schemas/validate/1.0/validate.xsd" destfile="lib/glx-beans.jar" classpath="lib/xbean.jar:lib/jsr173_1.0_api.jar" /> <fileset dir="${lib.srcdir}" excludes="${lib.exclude}" /> Would you please tell me what I am missing?
score: 0
has answer: http://stackoverflow.com/a/22615479
has title: Apache Ant {Compile javac srcdir} does not exist
has comment: http://stackoverflow.com/comment/34436227
type: AnsweredQuestion

http://stackoverflow.com/a/22644882
score: 0
has body: Based on your comments, consider creating two endpoints: /{id}/{type}/{answerId} returns a specific answer. /{id}/{type}/answers returns an array of all answers. You really should be using query parameters to filter the results, in the case of retreiving multiple answers. Something like this: /{id}/{type}/answers?ids=1,2,3&amp;types=A,B,C
answers question: http://stackoverflow.com/q/22644510
has comment: http://stackoverflow.com/comment/34497874
has comment: http://stackoverflow.com/comment/34490222
type: Answer

http://stackoverflow.com/comment/34409502
type: QuestionComment
type: Comment
has text: You can certainly do it that way but regex would be a much cleaner solution.
comment on: http://stackoverflow.com/q/22600087
score: 0

http://stackoverflow.com/comment/34221141
type: QuestionComment
type: Comment
has text: You can locate your class file by asking the JVM and then use that information to find the shell script.
comment on: http://stackoverflow.com/q/22493512
score: 0

http://stackoverflow.com/comment/34405637
has text: Are you supposed to use Java's LinkedList implementation or your own? If you use your own, create a Node class, which has a pointer to the next element.
comment on: http://stackoverflow.com/q/22597903
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34478751
type: Comment
type: QuestionComment
has text: I am tempted to vote for close as too broad, especially due to the additional questions after _**EDIT**_.
score: 1
comment on: http://stackoverflow.com/q/22637900

http://stackoverflow.com/a/22636538
downvote count: 0
has comment: http://stackoverflow.com/comment/60362314
score: 7
has body: Use this approach to sum the list of BigDecimal: List&lt;BigDecimal&gt; values = ... // List of BigDecimal objects BigDecimal sum = values.stream().reduce((x, y) -&gt; x.add(y)).get(); This approach maps each BigDecimal as a BigDecimal only and reduces them by summing them, which is then returned using the get() method. Here's another simple way to do the same summing: List&lt;BigDecimal&gt; values = ... // List of BigDecimal objects BigDecimal sum = values.stream().reduce(BigDecimal::add).get(); Update If I were to write the class and lambda expression in the edited question, I would have written it as follows: import java.math.BigDecimal; import java.util.LinkedList; public class Demo { public static void main(String[] args) { LinkedList&lt;Invoice&gt; invoices = new LinkedList&lt;&gt;(); invoices.add(new Invoice("C1", "I-001", BigDecimal.valueOf(.1), BigDecimal.valueOf(10))); invoices.add(new Invoice("C2", "I-002", BigDecimal.valueOf(.7), BigDecimal.valueOf(13))); invoices.add(new Invoice("C3", "I-003", BigDecimal.valueOf(2.3), BigDecimal.valueOf(8))); invoices.add(new Invoice("C4", "I-004", BigDecimal.valueOf(1.2), BigDecimal.valueOf(7))); // Java 8 approach, using Method Reference for mapping purposes. invoices.stream().map(Invoice::total).forEach(System.out::println); System.out.println("Sum = " + invoices.stream().map(Invoice::total).reduce((x, y) -&gt; x.add(y)).get()); } // This is just my style of writing classes. Yours can differ. static class Invoice { private String company; private String number; private BigDecimal unitPrice; private BigDecimal quantity; public Invoice() { unitPrice = quantity = BigDecimal.ZERO; } public Invoice(String company, String number, BigDecimal unitPrice, BigDecimal quantity) { setCompany(company); setNumber(number); setUnitPrice(unitPrice); setQuantity(quantity); } public BigDecimal total() { return unitPrice.multiply(quantity); } public String getCompany() { return company; } public void setCompany(String company) { this.com…
answers question: http://stackoverflow.com/q/22635945
has comment: http://stackoverflow.com/comment/34473930
has comment: http://stackoverflow.com/comment/34474322
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/34485668

http://stackoverflow.com/q/22572572
upvote count: 1
downvote count: 1
tagged with: audio
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22702619
score: 0
has body: I am creating a small Java application which needs to connect to a peripheral consistantly, A Leap Motion, and then also display visual feedback. I also am trying to play a series of sounds based on user input through, the Leap Motion... Basically just when a certain value is greater than a minimum, play a sound.. What I specifically need help doing is how to properly handle threads in Java, and if I need to manually close them... To start up the visual display using LWJGL I start a thread like so: Runnable newWindow = new ThreadedWindow(); new Thread(newWindow).start(); The Threaded Window Class consists of a run function: CreateWindow mainWindow = new CreateWindow(); mainWindow.startWindow(); The startWindow function just does very basic OpenGL stuff to create a blank window. I would just like to know if this is the right way to create and use a thread for a window, or if there is some other more efficient way to do this. public class CreateWindow { private int windowW = 1280; private int windowH = 720; private int windowCentreX = windowW/2; private int windowCentreY = windowH/2; public void startWindow() { try { Display.setDisplayMode(new DisplayMode(1280,720)); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } //Init OpenGL Stuff GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 1280, 0, 720, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); while(!Display.isCloseRequested()) { //Render the OpenGL Stuff GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // set the color of the quad (R,G,B,A) GL11.glColor3f(0.5f,0.5f,1.0f); float circleRadius = 50; float circleX = FingerInfo.averageFingerX; float circleY = FingerInfo.averageFingerY; // draw quad GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(circleX + windowCentreX,circleY + windowCentreY); GL11.glVertex2f(circleX + windowCentreX + circleRadius,circleY + windowCentreY); GL11.glVertex2f(circleX + windowCentreX + circleRadius, circleY + windo…
answer count: 1
favorite count: 0
has title: Java Threads, with Visual and Audio
type: UnansweredQuestion
tagged with: lwjgl
tagged with: multithreading

http://stackoverflow.com/q/22518748
tagged with: tomcat
favorite count: 0
has title: ClassNotFoundException when upgraded to Tomcat 8
tagged with: jdbc-pool
upvote count: 10
type: AnsweredQuestion
tagged with: netbeans
has answer: http://stackoverflow.com/a/36548262
downvote count: 0
type: Question
possible better answer: http://stackoverflow.com/a/36548262
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/22519813
accepted answer: http://stackoverflow.com/a/22519813
answer count: 2
has body: I recently upgraded my NetBeans IDE from v7.3 to v8 and all of a sudden my application throws an exception at server startup while connecting to DB. The only difference between these two versions of IDE are that the later one is using Tomcat 8. Exception Log: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory] at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:82) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321) at org.apache.naming.NamingContext.lookup(NamingContext.java:841) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.naming.NamingContext.lookup(NamingContext.java:829) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.naming.NamingContext.lookup(NamingContext.java:829) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.naming.NamingContext.lookup(NamingContext.java:829) at org.apache.naming.NamingContext.lookup(NamingContext.java:166) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:157) at javax.naming.InitialContext.lookup(InitialContext.java:411) at com.istore.core.listeners.AppContextListener.initdb(AppContextListener.java:44) at com.istore.core.listeners.AppContextListener.contextInitialized(AppContextListener.java:27) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4738) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5158) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:579) at org.apac…

http://stackoverflow.com/comment/34467923
type: Comment
type: QuestionComment
score: 0
has text: What do you want to do?
comment on: http://stackoverflow.com/q/22633091

http://stackoverflow.com/a/22503118
has comment: http://stackoverflow.com/comment/34237828
has comment: http://stackoverflow.com/comment/34237933
has body: You are trying to get value of field with key "January" inside your for loop, but there is no such field. You should first put key-value pair like that into your JSON object. Have a look at JSONObject get method documentation. There is something like that there: Throws: JSONException - if the key is not found. Because get method throws exception if there is no key it's not a really good idea to iterate through the whole array with months and trying to guess if the specific month is inside JSON as a key. You can do it if you want, but you should use has method first to verify if month really exists. On the other hand you can get all names of the keys from JSONObject and then call get method only on those names.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34236809
accepted answer of: http://stackoverflow.com/q/22502933
answers question: http://stackoverflow.com/q/22502933
has comment: http://stackoverflow.com/comment/34237769
type: Answer
has comment: http://stackoverflow.com/comment/34238243
score: 1
has comment: http://stackoverflow.com/comment/34237483
has comment: http://stackoverflow.com/comment/34238012
upvote count: 1
has comment: http://stackoverflow.com/comment/34238192

http://stackoverflow.com/a/62653807
downvote count: 1
has body: use Panel.setLayout(null); and use setBounds to every component to place them according to your choice eg: JButton btn=new JButton("Press"); btn.setBounds(10, 10, 100, 20);//where(x, y, length, height) JPanel.add(btn);//this is just a snippet, you will have to declare an object //for the JPanel:)
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/22506331
score: -1

http://stackoverflow.com/a/22534270
accepted answer of: http://stackoverflow.com/q/22533905
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34292239
downvote count: 0
answers question: http://stackoverflow.com/q/22533905
has comment: http://stackoverflow.com/comment/34293720
has comment: http://stackoverflow.com/comment/34292035
type: Answer
has body: Define your t object outside the function, maybe in the constructor. Then you can stop it with this: t.interrupt(); EDIT Thread t; public myclass()//your constructor { t=new Thread(this); } open.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { calls(); } }); private void calls() { t.start(); } @Override public void run() { reads(); } public void reads() { .... .... counter++; t.interrupt();// The Thread should stop here right&gt; }
score: 1
upvote count: 1

http://stackoverflow.com/q/22607217
type: Question
has answer: http://stackoverflow.com/a/22607378
tagged with: java
has answer: http://stackoverflow.com/a/22607362
upvote count: 2
accepted answer: http://stackoverflow.com/a/22607283
has body: How do I compare the String http://192.168.74.1/sp/info.php?prodnum=0000000001 with http://192.168.74.1 I only need to get the http://192.168.74.1 part of first string.
tagged with: string-comparison
answer count: 7
tagged with: string
has answer: http://stackoverflow.com/a/22607488
favorite count: 0
has answer: http://stackoverflow.com/a/22607350
has answer: http://stackoverflow.com/a/22607283
tagged with: android
has answer: http://stackoverflow.com/a/22611684
possible better answer: http://stackoverflow.com/a/22607404
has title: Comparing strings in java android
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22607404
downvote count: 0

http://stackoverflow.com/q/22494468
has comment: http://stackoverflow.com/comment/34222736
has comment: http://stackoverflow.com/comment/34223590
has answer: http://stackoverflow.com/a/22494671
has title: Is there a fast way to divide a long by 1000000 besides using the operator '/'?
linked to: http://stackoverflow.com/q/21074682
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34222705
tagged with: profiling
accepted answer: http://stackoverflow.com/a/22494671
has comment: http://stackoverflow.com/comment/34222792
type: Question
has body: I have a time stamper that gives me times in nanos and I want to get millis from nanos. So I am dividing nanos / 1000000. Any fast way to go from nanos to millis without paying the DIV cost, which can be expensive? Any kind of shift? Maybe I can shift by a number close to 1,000,000 that is a power of 2? That might be a smart trick to do that, because I am giving up the nanos precision to go to millis. My benchmarks show that it can take anywhere from 0 nanos to 1 millis. The 99% percentile has an average time of 72 nanos with a max time of 1 micro. That looks bad.
has comment: http://stackoverflow.com/comment/34222974
has comment: http://stackoverflow.com/comment/34222788
has comment: http://stackoverflow.com/comment/34222780
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34222842
answer count: 1
tagged with: performance
has comment: http://stackoverflow.com/comment/34222856
has comment: http://stackoverflow.com/comment/34222922

http://stackoverflow.com/comment/34272916
type: QuestionComment
comment on: http://stackoverflow.com/q/22523274
has text: see [this](http://stackoverflow.com/questions/12211837/full-screen-videoview-without-stretching-the-video)
score: 0
type: Comment

http://stackoverflow.com/a/22500357
downvote count: 0
has body: I am converting it into UTF-8 encoded string and storing it in String variable Don't do that! Some byte sequences cannot be translated to characters. Instead, store as a string format expressly designed to represent binary, such as Base64.
type: Answer
answers question: http://stackoverflow.com/q/22500306
accepted answer of: http://stackoverflow.com/q/22500306
score: 4
has comment: http://stackoverflow.com/comment/34234032
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/q/22500127
has title: isAlive vs Join in JAVA Threads
has answer: http://stackoverflow.com/a/22500301
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22500366
tagged with: java
duplicate of: http://stackoverflow.com/q/20798842
tagged with: multithreading
type: Question
possible better answer: http://stackoverflow.com/a/22501189
has answer: http://stackoverflow.com/a/22501189
accepted answer: http://stackoverflow.com/a/22500366
has body: Two ways exist to determine whether a thread has finished. First, you can call isAlive() on the thread. This method is defined by Thread, and its general form is shown here: final boolean isAlive() The isAlive() method returns true if the thread upon which it is called is still running. It returns false otherwise. While isAlive() is occasionally useful, the method that you will more commonly use to wait for a thread to finish is called join() isAlive() vs join(). Advantages?
score: 0
linked to: http://stackoverflow.com/q/20798842
answer count: 3

http://stackoverflow.com/a/22612739
has body: I solved the problem by drawing the new image pixel-by-pixel which may not be very fast, but it works: public BufferedImage filter(BufferedImage src) { BufferedImage convertedImage = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_BYTE_INDEXED); for (int x = 0; x &lt; src.getWidth(); x++) { for (int y = 0; y &lt; src.getHeight(); y++) { convertedImage.setRGB(x, y, src.getRGB(x, y)); } } return convertedImage; }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22566590
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22566590

http://stackoverflow.com/comment/34340175
has text: @Exu do you mean code which shows the problem or code which tries to solve the issue? First one, I think it is not needed. Last one, see [answer below](http://stackoverflow.com/a/22560840/323447)
comment on: http://stackoverflow.com/q/22557042
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34273056
has text: I just noticed by printing the query statement. Thanks for pointing this out. I'll following your suggestion for the coding standards.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22523363

http://stackoverflow.com/a/22638403
answers question: http://stackoverflow.com/q/22629744
score: 2
has body: The solution is simple. Install Maven on the server on which Karaf is running and configure it. Generally, you will configure it through the file settings.xml present in ~/.m2. The credentials for accessing the Nexus repository are indicated in the file. Finally, instead of using an HTTP URL for referencing your feature, use a Maven URL of the form: mvn:&lt;groupId&gt;/&lt;artifactId&gt;/&lt;version&gt;/xml/features The feature will be resolved through Maven.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34505134
upvote count: 2

http://stackoverflow.com/comment/60454142
has text: @LazyTechie, sorry, but I don't understand your problem. All modules which an injector uses must be passed either to its factory method or loaded with `install()`. So you just put your scoped injections and singletons in another module and use it with `install()` here.
comment on: http://stackoverflow.com/a/22639750
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22555110
possible better answer: http://stackoverflow.com/a/22561390
downvote count: 0
tagged with: csrf
has answer: http://stackoverflow.com/a/22561390
has comment: http://stackoverflow.com/comment/34408249
tagged with: spring-security
favorite count: 0
accepted answer: http://stackoverflow.com/a/22605512
type: Question
tagged with: csrf-protection
score: 9
answer count: 2
has comment: http://stackoverflow.com/comment/41855587
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34454894
has comment: http://stackoverflow.com/comment/34428741
has comment: http://stackoverflow.com/comment/34428683
upvote count: 9
has answer: http://stackoverflow.com/a/22605512
has title: CSRF (Cross-site request forgery) protection in spring MVC
has comment: http://stackoverflow.com/comment/34340124
tagged with: java
has body: I'm little confuse in this CSRF (Cross-site request forgery) protection in spring. No I have my jsp and my controller and a web service. What I want to do is validate the token at the web service level and if token is a match, run the web service (In my case do a db insert) JSP file &lt;form:input type="text" class="form-control" path="mName" /&gt; &lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" /&gt; &lt;div class="form-action"&gt; &lt;input type="submit" value="Save" class="btn btn-primary" /&gt; &lt;/div&gt; &lt;/form:form&gt; I've inserted the hidden tag also. Now what should I do to validate this token. I'm little lost there. At the controller class I get the values from the form to an object and call the web ervise to save data @RequestMapping(method = RequestMethod.POST) public String processForm(@ModelAttribute(value = "userForm") @Valid UserForm userForm, BindingResult result, ModelMap model) { //call the web service }
type: AnsweredQuestion

http://stackoverflow.com/a/22630833
answers question: http://stackoverflow.com/q/22630750
has body: This is not possible with Lamdas, you cannot control the flow from inside the expression. Even the API docs says that the Stream.generate generates an infinite stream. However, you can limit the Stream and achieve the desired functionality simply by using the limit() method: System.out.println(Stream.generate(() -&gt; RandomUtils.nextInt(100)).limit(10).count());
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/83401411
type: Answer
score: 7
downvote count: 3
upvote count: 10
accepted answer of: http://stackoverflow.com/q/22630750

http://stackoverflow.com/comment/34368572
has text: What exactly do you mean by "truncating"? When you have R,G,B values, and want to "OR" them togehter (with `(r<<16) | (g<<8) | b`) you often have to make sure that for each component you have value `r>=0` and `r<256`, like in `r=Math.max(0,Math.min(r,255));` but I'm not sure whether that is what you are asking for...
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22571774

http://stackoverflow.com/comment/34371617
comment on: http://stackoverflow.com/q/22579176
has text: @Bryan Do above code work ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22573549
tagged with: report
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34479103
tagged with: birt
tagged with: java
has comment: http://stackoverflow.com/comment/34389609
type: Question
type: AnsweredQuestion
has title: watermark in birt based on parameter
has body: I have a invoice for which I want to show in preview mode with a watermark. I have integrated the report with my web application (Spring MVC). Any solution? EDIT: I want to pick a value from a dataset (Table: invoiceheader), and use that value to decide whether to show /not show the watermark. I am unable to pick that value from Birt script. Can you please please guide.. Sorry .. the customer asked for a different way of identifying the fact rather that from passing the parameter. Thanks
upvote count: 1
accepted answer: http://stackoverflow.com/a/22581476
has comment: http://stackoverflow.com/comment/34375663
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34387019
has answer: http://stackoverflow.com/a/22581476
tagged with: spring

colors
tags question: http://stackoverflow.com/q/22541554
tags question: http://stackoverflow.com/q/22524879
tags question: http://stackoverflow.com/q/22623655
tags question: http://stackoverflow.com/q/22619740
tags question: http://stackoverflow.com/q/22538633
tags question: http://stackoverflow.com/q/22519757
tags question: http://stackoverflow.com/q/22563233
tags question: http://stackoverflow.com/q/22564048
tags question: http://stackoverflow.com/q/22579965
tag name: colors
tags question: http://stackoverflow.com/q/22613520
tags question: http://stackoverflow.com/q/22571588
tags question: http://stackoverflow.com/q/22564187
type: Tag

http://stackoverflow.com/comment/34437833
type: AnswerComment
has text: azimuth of what? what is the direction with respect to magnetic north that you are interested?
type: Comment
comment on: http://stackoverflow.com/a/22588516
score: 0

http://stackoverflow.com/q/22600927
has answer: http://stackoverflow.com/a/46304832
has body: I keep getting an error which says 'cannot find symbol' while compiling WordCount.java. I tried importing the other libraries, but it only adds up to the list of errors. Am I missing some component that needs to be added? javac -classpath /Documents/hadoop/hadoop-1.2.1/hadoop-core-1.2.1.jar:/Documents/hadoop/hadoop-1.2.1/lib/commons-cli-1.2.jar -d wordcount_classes WordCount.java WordCount.java:4: error: package org.apache.hadoop.fs does not exist import org.apache.hadoop.fs.Path; ^ WordCount.java:5: error: package org.apache.hadoop.io does not exist import org.apache.hadoop.io.*; ^ WordCount.java:6: error: package org.apache.hadoop.mapred does not exist import org.apache.hadoop.mapred.*; ^ WordCount.java:8: error: package org.apache.hadoop.mapred.lib.input does not exist import org.apache.hadoop.mapred.lib.input.FileInputFormat; ^ WordCount.java:9: error: package org.apache.hadoop.mapred.lib.output does not exist import org.apache.hadoop.mapred.lib.output.FileOutputFormat; ^ WordCount.java:10: error: package org.apache.hadoop.mapred.lib.input does not exist import org.apache.hadoop.mapred.lib.input.TextInputFormat; ^ WordCount.java:15: error: cannot find symbol public static class Map extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { ^ symbol: class MapReduceBase location: class WordCount WordCount.java:15: error: cannot find symbol public static class Map extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { ^ symbol: class Mapper location: class WordCount WordCount.java:15: error: cannot find symbol public static class Map extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { ^ symbol: class LongWritable location: class WordCount WordCount.java:15: error: cannot find symbol public static class Map extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { ^ symbol: class Text location: class WordCount WordCount.java:15: error: cannot …
score: 0
has title: Compilation errors while compiling WordCount.java
linked to: http://stackoverflow.com/q/2096283
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/43172777
has comment: http://stackoverflow.com/comment/35926611
answer count: 4
has answer: http://stackoverflow.com/a/41342000
tagged with: java
has answer: http://stackoverflow.com/a/23439624
tagged with: mapreduce
type: Question
tagged with: hadoop

http://stackoverflow.com/q/22517466
accepted answer: http://stackoverflow.com/a/22517636
has comment: http://stackoverflow.com/comment/34263182
has comment: http://stackoverflow.com/comment/34264071
tagged with: jakarta-mail
answer count: 1
downvote count: 0
favorite count: 0
has title: How can I send an html message using Java mail
upvote count: 6
has comment: http://stackoverflow.com/comment/34262716
type: AnsweredQuestion
has body: Ive been sending plaintest email from Java no problem but Im now trying to send a html one as follows: MimeMessage message = new MimeMessage(Email.getSession()); message.setFrom(new InternetAddress("support@jthink.net")); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to, true)); message.setSubject(subject); message.setContent(msg, "text/html"); message.setText(msg); message.saveChanges(); Transport.send(message); However when I receive it in my client it receives it as a plain text email, i.e it shows all the html tags instead of them being used for formatting, and I have checked the email header and it does say Content-Type: text/plain; charset=us-ascii in the mail header but why because I pass "text/html" to the setContent() method and that seems to be the only thing you have to do.
tagged with: java
score: 6
has answer: http://stackoverflow.com/a/22517636
type: Question
has comment: http://stackoverflow.com/comment/34262460

http://stackoverflow.com/a/22544690
answers question: http://stackoverflow.com/q/22544217
score: 2
has comment: http://stackoverflow.com/comment/34312149
has comment: http://stackoverflow.com/comment/34311351
upvote count: 2
has comment: http://stackoverflow.com/comment/34311663
has comment: http://stackoverflow.com/comment/34311554
has body: s.replaceAll("t/[a-zA-Z]*/", "") This code prints required string "http//mysite.com/home/folder1": String s = "http//mysite.com/home/t/images/folder1"; s = s.replaceAll("t/[a-zA-Z]*/", ""); System.out.println(s); Regexp contains [a-zA-Z] construct - a through z, or A through Z, inclusive (range). '*' is a quantifier - zero or more times. If this part is never empty it could be substituted with '+' - one or more times. Description of regex character classes Description of quantifiers
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34311501
accepted answer of: http://stackoverflow.com/q/22544217
type: Answer

http://stackoverflow.com/a/22616677
has body: This code StreamSource ss = new StreamSource(Utils.getResource()); incomingTemplate = factory.newTemplates(ss); Is equal to incomingTemplate = factory.newTemplates(new StreamSource(Utils.getResource())); The only difference is that you do not have direct access to the StreamSource anymore, if you use the second variation. However if incomingTemplate has getStreamSource method, then it really doesnt matter, if you use this : StreamSource ss = new StreamSource(Utils.getResource()); incomingTemplate = factory.newTemplates(ss); or this : incomingTemplate = factory.newTemplates(new StreamSource(Utils.getResource())); StreamSource ss = incomingTemplate.getStreamSource();
has comment: http://stackoverflow.com/comment/34441764
type: Answer
answers question: http://stackoverflow.com/q/22616579
score: 0

http://stackoverflow.com/q/22546361
type: Question
has comment: http://stackoverflow.com/comment/34315647
tagged with: java
has title: How can this layered architecture be improved?
has answer: http://stackoverflow.com/a/22775201
score: 3
tagged with: jpa
downvote count: 0
answer count: 1
favorite count: 0
has body: At my work we follow this layered architecture: http://www.oracle.com/technetwork/java/dataaccessobject-138824.html We have the following: Maven Database Project Spring Data Repositories - Custom @Query methods that run custom SQL Database Services - Calls the repository interfaces to persist or get JPA model data from the database JPA Models - Contains our Hibernate JPA models that just have getters and setters Maven Common Project DAOs - calls the database services to get data and convert them to DTO objects or convert our DTO objects to JPA models to pass to the database service to save Business Objects (BO) - Contains our business logic and calls DAOs to save or get data (DTOs) DTOs - Same as the JPA models but with properties that might not be in the database Projects that relie on Maven Common Project These projects have separate purposes: - One project is an internal support tool - Another is a monitoring tool for our customers - Another is an custom engine that drives the purpose of the business Issues My issue with this architecture is if I want to add new functionality like getMostRecentOrder() to a module that depends on our Common project, I have to create 4 methods instead of 1. Also we have another layer for one of our applications that abstracts Spring as engineers don't want/need to know about it which creates 5 methods total. Has anyone followed a similar layered architecture like this and was able to resolve or find a better solution? The architect that I work with likes this structure but I am starting to really dislike it as it is tedious for me to add all these methods just to get data out and it seems like I am writing a lot of duplicate code with just data type changes because of the layers that are in place. The architect wants our BOs to be generic like WeatherBO that has all the business logic for weather, EventBO for all the logic for events, etc. My issue with that is our BOs are starting to be 1000 lines of code and I feel depressed when…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34314918
tagged with: spring
tagged with: software-design
upvote count: 3
tagged with: spring-data

http://stackoverflow.com/q/22556939
has comment: http://stackoverflow.com/comment/34331404
has title: ArrayList as a Value to HashMap returns only last element of ArrayList
has comment: http://stackoverflow.com/comment/34331446
downvote count: 0
has answer: http://stackoverflow.com/a/22558912
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/22558586
type: Question
tagged with: hashmap
tagged with: java
has body: Please see the below code- Map&lt;DateTime, ArrayList&lt;ElementInformationBean&gt;&gt; mapTithi = new HashMap&lt;DateTime, ArrayList&lt;ElementInformationBean&gt;&gt;(); List&lt;ElementInformationBean&gt; lstTime = null; ElementInformationBean curntTithi = null; ElementInformationBean nextTithi = null; for (int i = 0; i &lt; lstNakstra.size()-1; i++) { lstTime = new ArrayList&lt;ElementInformationBean&gt;(); curntTithi = lstNakstra.get(i); nextTithi = lstNakstra.get(i+1); if(curntTithi.getStartTime().toDateMidnight().equals(nextTithi.getStartTime().toDateMidnight())) { lstTime.add(curntTithi); lstTime.add(nextTithi); mapTithi.put(curntTithi.getStartTime().toDateMidnight().toDateTime(), (ArrayList&lt;ElementInformationBean&gt;) lstTime); } else { lstTime.add(curntTithi); mapTithi.put(curntTithi.getStartTime().toDateMidnight().toDateTime(), (ArrayList&lt;ElementInformationBean&gt;) lstTime); } } For Printing for (Map.Entry&lt;DateTime, ArrayList&lt;PanchangaElementInformationBean&gt;&gt; entry : mapTithi.entrySet()) { DateTime key = entry.getKey(); ArrayList&lt;PanchangaElementInformationBean&gt; values = entry.getValue(); System.out.println("Key = " + key); for (PanchangaElementInformationBean p: values) { System.out.print("Values = " + p.getStartTime() + "n"); } } I am trying to use the HashMap; Key as dateTime and Value as List. However it always returns when I am iterating and printing the value. Thanks Kumar Shorav
has answer: http://stackoverflow.com/a/22558126
tagged with: iterator
answer count: 3

http://stackoverflow.com/a/22542912
has body: Just create an FileOutputStream and copy the data from input stream. There are a lot of ways for that, but using the appache commons library is the easiest one.
upvote count: 1
has comment: http://stackoverflow.com/comment/34308002
answers question: http://stackoverflow.com/q/22542638
has comment: http://stackoverflow.com/comment/34308103
has comment: http://stackoverflow.com/comment/34307875
type: Answer
has comment: http://stackoverflow.com/comment/34308148
downvote count: 0
score: 1

http://stackoverflow.com/a/22656290
answers question: http://stackoverflow.com/q/22645207
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34527106
has body: There is a Lync (UCWA) API to do this at http://msdn.microsoft.com/en-us/library/office/dn356790(v=office.15).aspx This API does not support impersonation, so if you want to create a Lync meeting on behalf of another user, your application will need to somehow get the user's credentials to sign in and get an OAuth token. Once you have a token, you can call the API to get a JoinUrl. If desired you can then place the JoinUrl for the meeting in the body of a calendar appointment you make with the EWS API.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22645207
has comment: http://stackoverflow.com/comment/34535572
score: 2
has comment: http://stackoverflow.com/comment/34522110

http://stackoverflow.com/a/22602704
answers question: http://stackoverflow.com/q/22602457
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: try this one: Toast.makeText(getApplication(), sendlist.size().tostring(), Toast.LENGTH_LONG).show(); or else: Toast.makeText(getApplication(), sendlist.size().toString()+"", Toast.LENGTH_LONG).show(); bcoz it will allow second params in a string.. and also use getApplication instead of this one example : Toast.makeText(getApplicationContext(), "Error during request: " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show(); Thank you,,
accepted answer of: http://stackoverflow.com/q/22602457

http://stackoverflow.com/a/22545154
score: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22545061
downvote count: 0
type: Answer
has body: If x contains your number and n is the binary digit that you chant to change, public int change(int x, int n) { return x ^ (1 &lt;&lt; n); }
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22545061

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/22624152

http://stackoverflow.com/comment/34291885
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22533951
has text: </FlyBoy> node getting added only at the end. This leads to invalid xml as well

http://stackoverflow.com/comment/34284202
has text: So what is not working? Does it call `intercept` method?
comment on: http://stackoverflow.com/q/22525398
type: Comment
type: QuestionComment
score: 0

boolean
tags question: http://stackoverflow.com/q/22504805
tags question: http://stackoverflow.com/q/22557937
tag name: boolean
tags question: http://stackoverflow.com/q/22606222
tags question: http://stackoverflow.com/q/22526170
tags question: http://stackoverflow.com/q/22500031
tags question: http://stackoverflow.com/q/22491853
tags question: http://stackoverflow.com/q/22573008
tags question: http://stackoverflow.com/q/22536338
tags question: http://stackoverflow.com/q/22523532
tags question: http://stackoverflow.com/q/22638381
type: Tag

http://stackoverflow.com/q/22528609
has answer: http://stackoverflow.com/a/22528731
has body: my entity class is Result package com.domain; import java.io.Serializable; import java.util.HashMap; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Result implements Serializable { @Id private Long id; public Student getStudent() { return student; } public void setStudent(Student student) { this.student = student; } public HashMap&lt;String, Integer&gt; getMark() { return mark; } public void setMark(HashMap&lt;String, Integer&gt; mark) { this.mark = mark; } private Student student; private HashMap&lt;String,Integer&gt; mark; public Long getId() { return id; } public void setId(Long id) { this.id = id; } } and my controller function is from where i want to show a form with Result entitiy @RequestMapping(value="show_mark",method = RequestMethod.GET) public ModelAndView show_subject_mark(){ ModelAndView mav =new ModelAndView("add_subject_mark"); mav.addObject("Result",new Result()); return mav; } my JAVA server page file is &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;form:form method="post" action="add_subject_mark" commandName="Result"&gt; &lt;/form:form&gt; &lt;/body&gt; &lt;/html&gt; now how can I use hash-map attribute of result entity to get input in jsp file.
tagged with: jsp
score: 0
answer count: 2
has title: hashmap attribute input in jsp
type: UnansweredQuestion
tagged with: input
tagged with: java
has answer: http://stackoverflow.com/a/22528728
type: Question
tagged with: hashmap

http://stackoverflow.com/q/22552490
has comment: http://stackoverflow.com/comment/34412264
has comment: http://stackoverflow.com/comment/34665325
tagged with: encoding
has comment: http://stackoverflow.com/comment/34393463
has comment: http://stackoverflow.com/comment/34395384
has answer: http://stackoverflow.com/a/22713533
has answer: http://stackoverflow.com/a/33848332
tagged with: servlets
linked to: http://stackoverflow.com/q/14772275
has comment: http://stackoverflow.com/comment/34409238
has answer: http://stackoverflow.com/a/22600231
has comment: http://stackoverflow.com/comment/89600089
downvote count: 0
tagged with: jsp
has title: JSP giving page with question marks for russian text
favorite count: 0
has comment: http://stackoverflow.com/comment/34600195
has comment: http://stackoverflow.com/comment/34489592
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34662990
tagged with: utf-8
upvote count: 6
linked to: http://stackoverflow.com/q/17168868
has body: I am implementing JSP page, where from database I get some list and showing it in JSP using jquery-ui autocomplete combobox: Select MKB from list: <c:forEach var="mkb" items="${mkbList}"> <c:out value="${mkb.mkbText}"/> </c:forEach> And the problem is that the values in the combo box are all in question marks when loading page in browser (russian characters expected). In the same jsp file I am including header.jsp, where there is the following line: <%@page contentType="text/html; UTF-8" pageEncoding="UTF-8"%> So the encoding should be fine. The encoding of source file is also in UTF-8 In jsp file there is also line: I am using tomcat8 and Java 7. One more thing I have tried is adding: -Dfile.encoding=UTF-8 to the startup parameters of tomcat. The Servlet itself is doing the following: public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { MkbDAO mkbDAO = new MkbDAO(); List<MKB> mkbList = mkbDAO.getMKBList(); request.setAttribute("mkbList", mkbList); RequestDispatcher rd = getServletConfig().getServletContext().getRequestDispatcher("/WEB-INF/jsp/diagList.jsp"); rd.include(request, response); } I was debugging that servlet code, and looked at values in debugger watch window, and values of the list were shown in correct russian characters. Could you help with resolving this issue?
has answer: http://stackoverflow.com/a/22716407
tagged with: java
score: 6
has comment: http://stackoverflow.com/comment/34393609
has answer: http://stackoverflow.com/a/22745868
has comment: http://stackoverflow.com/comment/34455976
type: Question

http://stackoverflow.com/q/22612062
has title: PIV smartcard from browser how it works for authentication without applet
possible better answer: http://stackoverflow.com/a/22616245
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22612608
tagged with: authentication
accepted answer: http://stackoverflow.com/a/22612608
has answer: http://stackoverflow.com/a/22616245
type: Question
tagged with: javacard
score: 0
answer count: 2
has body: Reading smartcard keystore from browser for digital signature vs using it for authentication, why for digital signature keystore we have to use applet (run some code on client machine to read the key) vs for authentication browsers reads the keys without any applet or plugin etc.How smartcard lists smart card keys without any javascript or applet code.
has comment: http://stackoverflow.com/comment/34664796
tagged with: smartcard

http://stackoverflow.com/a/22598544
downvote count: 0
answers question: http://stackoverflow.com/q/22598186
has body: My bad: I also had @Bean of type org.springframework.beans.factory.config.PropertyPlaceholderConfigurer and it conflicted somehow with @PropertySource annotation. Removing this been fixed things up.
accepted answer of: http://stackoverflow.com/q/22598186
type: Answer
has comment: http://stackoverflow.com/comment/34408161
upvote count: 3
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/22621252
type: UnansweredQuestion
tagged with: maven
has title: Is it necessary to specify version of a maven plugin in pom?
has body: I am using NetBeans for development and it has built-in menu feature that allows us to add maven-checkstyle-plugin in the pom for code formatting . However, when you click on that menu it add the following piece of code in the pom automatically but without the <version> information. Now my IDE keeps on complaining with a small hint message in the margin saying that the 'version' tag is missing. My question is: Does all plugins added has to have a <version> tag in the pom? pom.xml org.apache.maven.plugins maven-checkstyle-plugin config/sun_checks.xml
tagged with: netbeans
tagged with: java
type: Question
score: 4
upvote count: 4
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34452926
favorite count: 0
has answer: http://stackoverflow.com/a/22621943

http://stackoverflow.com/a/22493971
has comment: http://stackoverflow.com/comment/34223598
has comment: http://stackoverflow.com/comment/34223678
has comment: http://stackoverflow.com/comment/34223814
type: Answer
has comment: http://stackoverflow.com/comment/34223182
has comment: http://stackoverflow.com/comment/34222533
score: 3
accepted answer of: http://stackoverflow.com/q/22493545
answers question: http://stackoverflow.com/q/22493545
has comment: http://stackoverflow.com/comment/34223048
has comment: http://stackoverflow.com/comment/34223901
has comment: http://stackoverflow.com/comment/34223767
downvote count: 0
has comment: http://stackoverflow.com/comment/34223797
has comment: http://stackoverflow.com/comment/34222807
upvote count: 3
has body: Just so I could ensure the query was working, I modified the example XML as follows... something something <C> <D> <E>DataE</E> <F>DataF 1</F> <G>something</G> <H>something</H> <J> <K>DataK 1</K> <L>DataL 1</L> </J> </D> <D> <E>DataE_ERROR</E> <F>DataF 2</F> <G>something</G> <H>something</H> <J> <K>DataK 2</K> <L>DataL 2</L> </J> </D> </C> The magic is here... String expression = "//F[ancestor::D/E[text()='DataE']]|//K[ancestor::D/E[text()='DataE']]|//L[ancestor::D/E[tex Basically, this reads... Find any F node, who has an ancestor that contains D with a child of E whose text is equal to DataE or ... Now, this is important, you could use ../ to find the parent node, but K and L are buried in sub nodes and I'm not sure if they might be deeper or shallow, so I went for this method. You might need to refine it a bit, but I took the relationship of D/E as been important. With this (and the example below), I was able to generate the following output... Found DataF 1 Found DataK 1 Found DataL 1 Runnable example: public class TestXPath { public static void main(String[] args) { String xml = "The xml above"; try { DocumentBuilderFactory f = DocumentBuilderFactory.newInstance(); DocumentBuilder b = f.newDocumentBuilder(); Document d = b.parse(new File("Values.xml")); d.getDocumentElement().normalize(); String expression = "//F[ancestor::D/E[text()='DataE']]|//K[ancestor::D/E[text()='DataE']]|//L[ancestor::D/E[text()='DataE']]"; XPath xPath = XPathFactory.newInstance().newXPath(); Object result = xPath.compile(expression).evaluate(d, XPathConstants.NODESET); NodeList nodes = (NodeList) result; for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); System.out.println("Found " + node.getTextContent()); } } catch (ParserConfigurationException | SAXException | IOException | XPathExpressionException | DOMException exp) { exp.printStackTrace(); } } }
type: AcceptedAnswer

http://stackoverflow.com/comment/34382296
has text: "Is this check true?" -- what do you mean by this? Are you talking about the java concept of boolean truth? In which case that value could be true if number == 5, array[4] == 4, , array[5] == 20.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22584893
type: QuestionComment

intellij-idea
tags question: http://stackoverflow.com/q/22550537
tags question: http://stackoverflow.com/q/22555967
tags question: http://stackoverflow.com/q/22504569
tags question: http://stackoverflow.com/q/22644988
tags question: http://stackoverflow.com/q/22553971
tags question: http://stackoverflow.com/q/22527842
tags question: http://stackoverflow.com/q/22532024
tags question: http://stackoverflow.com/q/22543064
type: Tag
tag name: intellij-idea
tags question: http://stackoverflow.com/q/22501978
tags question: http://stackoverflow.com/q/22554384
tags question: http://stackoverflow.com/q/22630973
tags question: http://stackoverflow.com/q/22646802
tags question: http://stackoverflow.com/q/22592710
tags question: http://stackoverflow.com/q/22555301
tags question: http://stackoverflow.com/q/22562257
tags question: http://stackoverflow.com/q/22606478
tags question: http://stackoverflow.com/q/22544732
tags question: http://stackoverflow.com/q/22544249
tags question: http://stackoverflow.com/q/22522013
tags question: http://stackoverflow.com/q/22571037
tags question: http://stackoverflow.com/q/22581006
tags question: http://stackoverflow.com/q/22503556
tags question: http://stackoverflow.com/q/22570401
tags question: http://stackoverflow.com/q/22621054
tags question: http://stackoverflow.com/q/22589954

http://stackoverflow.com/a/22647148
score: 0
has comment: http://stackoverflow.com/comment/34496558
type: Answer
answers question: http://stackoverflow.com/q/22646612
has body: Use this method: public static String getDoubleAsFormattedDoubleToEdit(String valueS) { DecimalFormatSymbols simbolos = new DecimalFormatSymbols(); simbolos.setGroupingSeparator(','); simbolos.setDecimalSeparator('.'); double value = Double.valueOf(Util.typeCorrection(ETipoDato.FLOTANTE, 0, true, valueS)); return new DecimalFormat("###.##", simbolos).format(value); } This way you can pass your value and the return is your value formatted.
has comment: http://stackoverflow.com/comment/34494275

http://stackoverflow.com/comment/34258834
comment on: http://stackoverflow.com/q/22515630
has text: https://blog.codecentric.de/en/2008/07/memory-analysis-part-1-obtaining-a-java-heapdump/
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22498099
type: AcceptedAnswer
has body: here what am wandering is, in line 1 of this code "throws Exception" what exactly does? It gave the responsibility to the caller of the function, that, this method, can throws an Exception, You [Caller] have to handle it. And, In your case, It's a RuntimeException will be thrown from that method, so, no need to declare the method with Exception. That's why even though if you removed that throws Exception part, It works. If the method will throw a checked Exception, and if you don't handle it inside the method itself, you have declare to throw that exception in the method signature.
type: Answer
accepted answer of: http://stackoverflow.com/q/22498065
score: 0
answers question: http://stackoverflow.com/q/22498065

http://stackoverflow.com/q/22631448
accepted answer: http://stackoverflow.com/a/22631497
tagged with: jls
type: AnsweredQuestion
tagged with: oop
has title: equals() method of Object class
has comment: http://stackoverflow.com/comment/34465119
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
answer count: 1
has body: I was reading JLS, The Class Object and according to it The method equals defines a notion of object equality, which is based on value, not reference, comparison. but when I opened the Declaration of equals method of Object class, which is: public boolean equals (Object o) { return this == o; } But here, reference is checked with Reference equality operator(==), how this Declaration is matching the specification?
has answer: http://stackoverflow.com/a/22631497
favorite count: 0

http://stackoverflow.com/a/22567344
answers question: http://stackoverflow.com/q/22566653
has body: Hi solution for your problem is as below code String [] s = {"a", "y", "x","a","d", "y","m"}; List&lt;String&gt; list = Arrays.asList(s); TreeSet&lt;String&gt; sortedSet = new TreeSet&lt;String&gt;(list); System.out.println(sortedSet); here first convert the array of string into list, then put that list to treeset which will remove the duplicates and sorts it. 2nd way is add each string from the array into set(to remove duplicates) then convert it into list then use collections.sort(list); code for the same is as below HashSet&lt;String&gt; set = new HashSet&lt;String&gt;(); for (String str : s) { set.add(str); } List&lt;String&gt; strArr = new ArrayList&lt;String&gt;(set); Collections.sort(strArr); let me know if have any doubts.
score: 0
type: Answer

http://stackoverflow.com/q/22557429
has comment: http://stackoverflow.com/comment/34332371
has body: I am trying to make an app which when first loads download all the data onto the application which includes XML of id,name,etc , profile infos, profile image etc. These things I load using a AysnTask which calls my XMLParser which makes the data structure and then on return to doinBackground(), it inserts onto the database with imagelink(profile image). Then onPostExecute(), it starts the gridview which has Imageview as the child, which takes the profile image to load using a ImageLoader example in this tutorial. Image gets loaded in a class which implements Runnable in run() method, I displayed the image and save that to Sqlite using BLOB. I set a logic in the Runnable class that when last profile image is loaded, it inserts a flag in one of my table, which ensures that next time apps is opened it will get the values from the DB not from the Server. The issue comes when user close the application some time after opening it however as I have been loading the images in a Runnable so they get broken.... the logic to set the flag does not finished. How can I make this work?
tagged with: image
type: Question
has answer: http://stackoverflow.com/a/22557819
has comment: http://stackoverflow.com/comment/34332272
answer count: 1
has comment: http://stackoverflow.com/comment/34332934
has title: Saving and loading image with multiple information while loading the image in gridview causing multiple data insertion
score: 0
has comment: http://stackoverflow.com/comment/34332242
tagged with: android
has comment: http://stackoverflow.com/comment/34332799
tagged with: gridview
type: UnansweredQuestion
tagged with: multithreading
linked to: http://stackoverflow.com/q/20678669
has comment: http://stackoverflow.com/comment/34333239
tagged with: java

http://stackoverflow.com/a/22609396
downvote count: 0
has body: Regarding private final int number, your claim that If it cannot change, there is no point having one copy per instance is absolutely wrong. Consider this code, typical of an immutable class: private final int number; public MyClass(int number) { this.number = number; } There are many instances of this pattern in the JDK, and in production code classes around the globe. To answer your question about performance, I doubt you could measure the difference between using static vs instance constants.
has comment: http://stackoverflow.com/comment/34425775
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34426102
upvote count: 2
answers question: http://stackoverflow.com/q/22607743
has comment: http://stackoverflow.com/comment/34426000

http://stackoverflow.com/a/22561347
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34340133
has body: You are adding components at run time. In such cases you need to ensure the container gets revalidated: void addNewRow() { panel.add(new JLabel("Test1")); panel.add(new JTextField("Test")); panel.revalidate(); panel.repaint(); }//addNewRow Also, you should create and access swing components only in the event dispatch thread. See here for more.
has comment: http://stackoverflow.com/comment/34341475
downvote count: 0
answers question: http://stackoverflow.com/q/22561016
has comment: http://stackoverflow.com/comment/34340813
has comment: http://stackoverflow.com/comment/34340588
type: Answer

http://stackoverflow.com/comment/34406261
has text: @Flavio You need to invoke `find` or `matches` on Matcher object.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22598202
type: Comment

http://stackoverflow.com/comment/34288772
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22532364
has text: {"2012-10-01T09:45:00.000+02:00"}
score: 0

http://stackoverflow.com/a/22576419
score: 0
has body: Byte=Serial.read(); is reading precisely one byte, which can be a single character '0', .. '9' the java string "10" is two bytes, '1', followed by '0'. So in loop the final case is never used. Instead its executing the '1' case and leaving the '0' in the buffer. There are two way round it. Always write two bytes at a time. With Byte1=Serial.read(); Byte2=Serial.read();. You could use a hexidecimal numbers using Integer.toString(int i, 16) in java. And else if( Byte=='a') .... In the arduino.
answers question: http://stackoverflow.com/q/22574348
type: Answer

http://stackoverflow.com/comment/34384673
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22586183
has text: You have a typo in the method name. It's [`nextLine()`](http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextLine()), with a capital `L`.
type: Comment

http://stackoverflow.com/comment/34472995
comment on: http://stackoverflow.com/q/22635075
type: Comment
type: QuestionComment
has text: @Duncan If you need OSGi framework functionality at compile time use "provided". If you need another bundle only at runtime use "runtime".
score: 0

http://stackoverflow.com/a/22547839
upvote count: 1
answers question: http://stackoverflow.com/q/22547451
has comment: http://stackoverflow.com/comment/34317553
score: -1
type: Answer
has body: Could someone please tell me which classes / methods in java.net deal with sending SYN, SYN-ACK and ACK messages for TCP Three Way Handshake? None of them. If someone knows any good tutorials on Java Sockets, please refer them here? The ones I found are confusing me(and some of them are made by Oracle!). The Custom Networking trail of the Java tutorial, but it doesn't deal with aspects of TCP such as the handshake that aren't implemented by Java. If someone knows any programs that allow to simulate TCP Three Way Handshake, please refer them here. There aren't any in pure Java.
has comment: http://stackoverflow.com/comment/34317657
downvote count: 2

http://stackoverflow.com/comment/34375463
has text: So, you really have a table named `shopping_cart_shopping_cart`in your database? Why do you call `sqlQuery`a query that is NOT a SQL query, but a HQL query?
score: 0
comment on: http://stackoverflow.com/q/22581324
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22573757
has comment: http://stackoverflow.com/comment/34362215
tagged with: web-applications
has comment: http://stackoverflow.com/comment/34368819
has body: i am using servlet context to maintain session variables.If user log out i will remove the variable from application scope and its works file. I have problem when session was not closed properly (example network failure and log out was not proper) the variable still remain in application scope. How to handle such a situation? How can to detect if browser disconnect from server so that it can be removed from application scope?
tagged with: java
tagged with: servlets
type: Question
has title: How maintain java application scope variables after session expire
tagged with: session
score: 0
has comment: http://stackoverflow.com/comment/34362167
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22602217
type: UnansweredQuestion
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/14274357
has comment: http://stackoverflow.com/comment/56986208
tagged with: java
has body: I need to use some functionality of this class in my android project for xposed module. I am unable to do so. Can anybody suggest how can I make this class com.android.keyguard.KeyguardPatternView visible to my project. Do I need to include any jar file. If so where can I find that jar file.
has title: How to import com.android.keyguard.KeyguardPatternView in my android project?
has comment: http://stackoverflow.com/comment/58908816
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22603254

http://stackoverflow.com/a/22628391
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Is it possible to validate certificate using thumbprint value? Yes. I just want a safe server certificate verification. Keep in mind if you are verifying Google (and other sites), then the thumbprint will change about every 30 days. That's because Google uses short-lived certificates (30 day expiration) to keep the revocation lists (CRLs) manageable. However, Google recertifies the same public key, so you could pin the public key rather then the certificate. For more reading on pinning, see OWASP's Certificate and Public Key Pinning. Also, the IETF has an initiative Public Key Pinning Extension for HTTP. Finally, you can take all of this to the next level with a security diversification strategy. See Peter Gutmann's Engineering Security.
type: Answer
accepted answer of: http://stackoverflow.com/q/22628247
answers question: http://stackoverflow.com/q/22628247

http://stackoverflow.com/q/22644109
has title: Open application and directly speech recognition through PendingIntent
tagged with: android-widget
answer count: 1
has body: I try to open my MainActivity and directly start the intent for speech recognition just tapping the widget i created but no works. If i tap not opens the app. This is the Widget class public class MyWidgetProvider extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager,int[] appWidgetIds) { RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout); Intent configIntent = new Intent(context, MainActivity.class); PendingIntent configPendingIntent = PendingIntent.getActivity(context, 0, configIntent, 0); remoteViews.setOnClickPendingIntent(R.id.message_button, configPendingIntent); appWidgetManager.updateAppWidget(appWidgetIds, remoteViews); Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); voiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo"); voiceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, configPendingIntent); //updateView(context); } } The manifest &lt;!-- Widget --&gt; &lt;receiver android:icon="@drawable/icon" android:label="IntentProva" android:name=".MyWidgetProvider" &gt; &lt;intent-filter &gt; &lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.appwidget.provider" android:resource="@xml/batterywidgetinfo" /&gt; &lt;/receiver&gt; And the layout &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/message_button" android:layout_width="72dp" android:layout_height="72dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/icon"…
has answer: http://stackoverflow.com/a/22646673
score: 0
tagged with: android
tagged with: android-pendingintent
accepted answer: http://stackoverflow.com/a/22646673
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/61965211
has text: Hi, I also need to use the `encoder.encodeForHTML(String)`. So should I do the **canonicalization** first or the `encodeForHTML()` first? What should be my order?
type: AnswerComment
comment on: http://stackoverflow.com/a/22491737
score: 0
type: Comment

http://stackoverflow.com/a/22506243
downvote count: 0
has comment: http://stackoverflow.com/comment/34242013
answers question: http://stackoverflow.com/q/22505886
score: 3
type: Answer
upvote count: 3
has body: You should define the dependencies you like to have in your assembly in the pom file as dependencies. This will make sure the order of building is automatically determined by Maven and will be the same all the time. Furthermore you just need to give the following descriptor like this which will package all the dependencies into a zip file: dist-assembly zip false / false false runtime Let the transivite dependencies go into different location: false <useTransitiveDependencies>true</useTransitiveDependencies> lib false ${project.groupId}:* The ${project.groupId} excludes the project artifacts. You can repeat this part as often you need them to be copied.
has comment: http://stackoverflow.com/comment/34242723

output
tags question: http://stackoverflow.com/q/22520825
tags question: http://stackoverflow.com/q/22499274
tag name: output
tags question: http://stackoverflow.com/q/22595470
tags question: http://stackoverflow.com/q/22503520
type: Tag
tags question: http://stackoverflow.com/q/22569178

http://stackoverflow.com/a/22534657
has body: You have put the plugin configuration into pluginManagement section, which simply defines some default configuration but doesn't actually use the plugin. You need to now define the plugin inside the element. Something like this: org.eclipse.m2e lifecycle-mapping
downvote count: 0
answers question: http://stackoverflow.com/q/22530618
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/47825250

http://stackoverflow.com/comment/34448421
type: AnswerComment
type: Comment
has text: Ok. good your clear now.. See my updated answer. I have added method initSecurity() to generate new one or read from file.
comment on: http://stackoverflow.com/a/22620403
score: 0

http://stackoverflow.com/q/22523060
possible better answer: http://stackoverflow.com/a/22523126
has comment: http://stackoverflow.com/comment/34272658
has answer: http://stackoverflow.com/a/22523126
has comment: http://stackoverflow.com/comment/34272678
answer count: 2
has title: LinkedList delete test fail
has body: public void delete(int index) { if (index &lt; 0 || index &gt; count-1) { throw new ArrayIndexOutOfBoundsException(); } Node&lt;X&gt; current = head; if (index == 0) { current = current.getLink(); count--; return; } for (int i = 0; i &lt; index-1; i++) { current = current.getLink(); } current.setLink(current.getLink().getLink()); count--; } . @Test public void testDeleteSeveral() { LList&lt;String&gt; b = new LList&lt;String&gt;(); b.add("hello"); b.add("bye"); b.add("adios"); b.add("ciao"); b.add("see ya"); b.delete(0); assertEquals(4, b.size()); assertEquals("ciao", b.get(0)); assertEquals("adios", b.get(1)); assertEquals("bye", b.get(2)); assertEquals("hello", b.get(3)); . public void add(X v) { Node&lt;X&gt; a = new Node&lt;X&gt;(); a.setValue(v); a.setLink(head); head = a; count++; } Where it says assertEquals("ciao", b.get(0));, I put that it should be "ciao" since it delete the first node, but the error shows up as it was expecting "see ya", when I thought "see ya" was deleted since i did delete(0); am I missing something? EDIT: I added the add method
score: 0
has answer: http://stackoverflow.com/a/22523138
accepted answer: http://stackoverflow.com/a/22523138
has comment: http://stackoverflow.com/comment/34272494
type: Question
type: AnsweredQuestion
tagged with: list
tagged with: java
tagged with: hyperlink

http://stackoverflow.com/comment/34286898
type: Comment
has text: Thanks for the quick response and the offer of looking at the project. I will consider it. First I will try to create a simple, small project with just the necessary components and try substitution.
comment on: http://stackoverflow.com/a/22530605
score: 1
type: AnswerComment

http://stackoverflow.com/q/22611898
score: 0
has comment: http://stackoverflow.com/comment/34431522
has body: Hi I'm working on an android application that uses a web view. It works perfectly on most API levels, but I'm having problems on API 9 (Gingerbread 2.3.5). Where it's really inconsistent to whether it works or not. I've used the following code for it to work on froyo: webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (Uri.parse(url).getHost().equals(urlString)) { // This is my web site, so do not override; let my WebView load the page return false; } // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); return true; } @Override public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) { handler.proceed(); } }); but this doesn't get hit when debugging on API level 9 (Gingerbread 2.3.5). Has anyone else had this issue? if so what was causing it and how did you fix it? Thanks
tagged with: android
has title: Android Display Web View
has comment: http://stackoverflow.com/comment/34431374
has comment: http://stackoverflow.com/comment/34431938
answer count: 0
has comment: http://stackoverflow.com/comment/34430410
type: UnansweredQuestion
tagged with: webview
has comment: http://stackoverflow.com/comment/34431437
has comment: http://stackoverflow.com/comment/34431628
tagged with: java
has comment: http://stackoverflow.com/comment/34431811
type: Question
has comment: http://stackoverflow.com/comment/34431465

http://stackoverflow.com/comment/34440773
type: AnswerComment
type: Comment
has text: Before I implement your answer... I'm still confused about how I have "two" fragments apparently. Android says `For example, when the activity is paused, so are all fragments in it, and when the activity is destroyed, so are all fragments.` http://developer.android.com/guide/components/fragments.html My MainActivity extends FragmentActivity is definitely destroyed because I have a Toast in onDestroy(). Should that cause my fragment to onDestroy() as well?
comment on: http://stackoverflow.com/a/22617515
score: 0

http://stackoverflow.com/comment/34374284
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22575906
has text: @Jack Ah! You're right. That was completely misleading :( I've removed that part, but the baseline of my answer still stands.

http://stackoverflow.com/a/22614825
has comment: http://stackoverflow.com/comment/34435888
downvote count: 0
score: 1
has body: You can replace this Intent counter = new Intent("com.example.test.Counter"); startActivity(counter); with this, it would work .. Intent counter = new Intent(MainActivity.this, Counter.class); startActivity(counter); Or to let your code work, you are missing intent-filter <action android:name="android.intent.action.COUNTER" /> <category android:name="android.intent.category.DEFAULT" /> You should always provide an intent-filer if you want to start an activity with your way ..
has comment: http://stackoverflow.com/comment/34436397
upvote count: 1
answers question: http://stackoverflow.com/q/22614743
type: Answer
has comment: http://stackoverflow.com/comment/34435815

http://stackoverflow.com/a/22533527
upvote count: 1
has comment: http://stackoverflow.com/comment/34292788
has comment: http://stackoverflow.com/comment/34292235
has comment: http://stackoverflow.com/comment/34292364
has comment: http://stackoverflow.com/comment/34291689
has comment: http://stackoverflow.com/comment/34292169
answers question: http://stackoverflow.com/q/22510711
has comment: http://stackoverflow.com/comment/34292124
has body: You can use parameters in result configuration in struts.xml file. Create two properties inside your action class that will hold the name of the action and namespace and use them in struts.xml like that: ${action} ${namespace} Additionally if don't want to create them and you already store your variables in session, you can retrieve them from session as well using #session expression. ${#session.action} ${#session.namespace}
has comment: http://stackoverflow.com/comment/34291214
has comment: http://stackoverflow.com/comment/34291481
downvote count: 0
has comment: http://stackoverflow.com/comment/34291929
type: Answer
has comment: http://stackoverflow.com/comment/34292532
score: 1
has comment: http://stackoverflow.com/comment/34292702

http://stackoverflow.com/comment/34344085
comment on: http://stackoverflow.com/q/22562528
has text: Okay, that is telling you that it is looking for an array (because you store an array of 5 objects). However, your class is a single object, not an array. Why are you trying to store an array of objects anyways?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34463268
has text: Welcome to Stack Overflow. Can you edit your question and add links to some of the questions that you think are similar, and explain why the aren't the right answer for you - what features are still missing.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22629748

http://stackoverflow.com/q/22509626
upvote count: 1
type: UnansweredQuestion
downvote count: 0
has body: I have an applet loaded into a JFrame which I can send mouse information to like so: MouseEvent m; m = new MouseEvent(owner.loader.applet.getComponent(0), MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), button, x, y, 0, false); owner.loader.applet.getComponent(0).dispatchEvent(m); Now, when I send this mouse event to the applet, my JFrame will come into focus. How can I stop it from doing this? When I send a mousemove event instead of a mousepress, it doesn't take focus. I'm using the BUTTON1_MASK event for the button parameter.
tagged with: events
score: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/34248210
favorite count: 0
type: Question
answer count: 1
tagged with: mouse
has title: Java- Fake MouseEvents without focusing window
tagged with: java
has answer: http://stackoverflow.com/a/22510036

http://stackoverflow.com/comment/34414509
type: QuestionComment
score: 1
has text: @AleZalazar You put me in the right track. After testing with just 1 Thread I saw that it stopped at some point, debugging I discovered it was stopping some times at Socket.connect and other at Socket.read
type: Comment
comment on: http://stackoverflow.com/q/22600972

http://stackoverflow.com/q/22502954
type: Question
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22503480
has comment: http://stackoverflow.com/comment/34274514
tagged with: jdbc
tagged with: connector-j
has answer: http://stackoverflow.com/a/22503480
upvote count: 3
has title: Client-side emulation prepared statement in MySQL JDBC driver
tagged with: mysql
tagged with: prepared-statement
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34246840
score: 3
has comment: http://stackoverflow.com/comment/34274576
has body: I am trying to understand how client-side emulation prepared statement in MySQL JDBC driver works. Part 1 I read online that for prepared statements, there are four steps involved when a relational database handles a JDBC/SQL query and they are as follows: Parse the incoming SQL query Compile the SQL query Plan/optimize the data acquisition path Execute the optimized query / acquire and return data The pre-execution of steps compiles the SQL statement and hence provides pre-optimization. For server-side prepared statement, an additional round-trip will be made to the database to precompile the SQL statement. Question How do the client-side emulation prepared statement do step 3 if it does not make a round-trip to the database? Or does a client-side emulation prepared statement works differently? Part 2 I have also done two experiments. Experiment 1 - using one client-side prepared statement for each query Experiment 2 - 'reusing' client-side prepared statements for the same query multiple times Both experiments show improvement in performance such as response time. Experiment 1 has an improvement of about 18% and Experiment 2 has an improvement of about 30%. Question Am I right to assume that preoptimization still exists for client-side prepared statement? If yes, does it preoptimizes in a way that is similar to server-side (the four steps mentioned in part 1) prepared statements or in a much different way? If no, why is there still improvement? Thanks for your help!
tagged with: java

http://stackoverflow.com/comment/34370746
comment on: http://stackoverflow.com/a/22574030
type: Comment
has text: Not sure I'm following you. If you only need to replace the first instance, then use `String.replaceFirst`. If that's not what you are asking for, I'd need some clarification.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22521837
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22521731
has body: I am not entirely sure if I got it right. Since you're using aggregate function ('sum') it would normally return only one row containing sum of the values. But if you'd like to execute the query anyway, maybe this would help (not tested).. UPDATED SELECT SUM(automobile.value) as totalValue, user.name FROM automobile INNER JOIN user ON automobile.id_user = user.idu WHERE automobile.date between '2013-10-13' and '2013-10-13' GROUP BY automobile.id_user

http://stackoverflow.com/comment/34214419
comment on: http://stackoverflow.com/q/22489605
score: 0
type: Comment
type: QuestionComment
has text: Does the id for the data you store only exist in the scope of the method or does it actually exist outside as well?

http://stackoverflow.com/comment/34236871
comment on: http://stackoverflow.com/a/22502960
has text: sir i changed the main class doInBackground to return a JSONArray. ** protected JSONArray doInBackground(String... urls) { try { JSONParser jParser = new JSONParser(); return jParser.getJSONFromUrl(urls[0]); } catch (Exception e) { return null; } }** but there how can i make it right? Thank you
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34221062
comment on: http://stackoverflow.com/q/22493562
has text: Your query parses to something like `SELECT * FROM inventoryreport WHERE InDate LIKE 201403` is that what you want?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34416842
has text: I don't really get the point of having few elements?! but, I may have a bigger number of anyType{...} elements.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22595390

http://stackoverflow.com/q/22493851
score: 1
tagged with: java
upvote count: 1
has title: Backward compatible framework with new features
type: Question
downvote count: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34221683
has answer: http://stackoverflow.com/a/22494349
favorite count: 0
tagged with: class-design
has answer: http://stackoverflow.com/a/22519333
type: UnansweredQuestion
has body: I need to add new features to my framework that look likes this: interface firstInterface{} abstract class ReadOnly extends Forward{} class Reference extends ReadOnly implements firstInterface{} The abstract class ReadOnly is to limit the features from Forward by throwing unsupportedaction. I now need to support those function but in another class (thus have both options). My first step was, class baseReference implements firstInterface{} abstract class ReadOnly extends Forward{} class Reference extends baseReference, Readonly{} class Loading extends baseReference, Forward{} this results in multiple inheritance. Need help with the new design without much code duplication.
tagged with: oop
has comment: http://stackoverflow.com/comment/34265173

http://stackoverflow.com/a/22512934
has body: For your own use, when you define your dependency, add the classifier tag with a value of small. myGroup myJar test small <!-- <<<<<< like this <<<<<< --> For publishing, you can manually deploy the artifact with a new classifier as demonstrated here: http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploying-with-classifiers.html
score: 3
upvote count: 3
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22512637
answers question: http://stackoverflow.com/q/22512637

http://stackoverflow.com/comment/34312545
type: Comment
type: QuestionComment
has text: @Frakcool If we read string before reading int, it will work.
comment on: http://stackoverflow.com/q/22542833
score: 0

http://stackoverflow.com/comment/34436915
score: 1
comment on: http://stackoverflow.com/q/22614866
has text: @m0skit0 `In Java there are no "types", only classes` it is true and the same time it is not true. There is no structure as `type` in Java, but variables can have their types, like `"foo"` is instance of `String` *class*, but at the same time its *type* is also `Object`, `Serializable`, `Comparable` and `CharSequence`.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22625263
has comment: http://stackoverflow.com/comment/34454979
answers question: http://stackoverflow.com/q/22625233
has comment: http://stackoverflow.com/comment/34456256
score: 0
has body: just add an if/else statement in there: for (int i = minutes - 1; i &gt;= 0; i--){ String minute; if(minutes == 1) minute = " minute "; else minute = " minutes "; for (int s = 59; s &gt;= 1; s--){ String seconds; if(s == 1) seconds = " second"; else seconds = " second"; System.out.println(i + minute + s + seconds); } } The other answer is probably better, but it uses a different syntax that makes all this code into a short line. They do basically the same thing.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22625233

http://stackoverflow.com/a/22497633
score: 2
type: AcceptedAnswer
downvote count: 0
has body: I guess that your Manager and Server class have the classes defined like below, class Manager extends Employee { } class Server extends Employee { } In that case class Manager is a type of Manager and Employee both and the same with Server as well. It is an inheritance and polymorphism of OOP. Read about that here and here. You second code and first code both are correct. The way we use it depends.
type: Answer
accepted answer of: http://stackoverflow.com/q/22497443
upvote count: 2
answers question: http://stackoverflow.com/q/22497443

http://stackoverflow.com/q/22572197
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/22572442
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34359891
has answer: http://stackoverflow.com/a/22572451
has comment: http://stackoverflow.com/comment/34359997
type: Question
has body: Is it possible to match everything before a certain string but ignore it if it's part of a certain other string? For example, it should select everything before ATA in the following string including SATA: anything SATA=1241241. anything ATA=2414121 The result should be anything SATA=1241241. anything But if the input string is: anything ATA1241241. anything ATA=2414121 it should return anything
has answer: http://stackoverflow.com/a/22574363
answer count: 3
upvote count: 1
tagged with: string
has title: java regex selecting until string but not substring
favorite count: 0

http://stackoverflow.com/comment/34473954
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22630387
type: Comment
has text: No, the dialog will be modal i.e. you cannot touch buttons in the background - that's how dialog work. The `setFinishOnTouchOutside` method works for API 11 or later. For earlier API level, you cannot touch outside the dialog, so you don't need to worry. Have you tried your dialog via an emulator using API 10 and earlier?

http://stackoverflow.com/a/22576422
has comment: http://stackoverflow.com/comment/34367886
has comment: http://stackoverflow.com/comment/34367837
upvote count: 1
has comment: http://stackoverflow.com/comment/34366658
answers question: http://stackoverflow.com/q/22576225
has comment: http://stackoverflow.com/comment/34367941
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22576225
has comment: http://stackoverflow.com/comment/34366848
type: Answer
score: 1
has body: No this is not possible. You have to Fork the 3rd party projects Modify the sources Create the library jars Install the libraries to your repository (better) with new version numbers Reference the new libraries in your project However, most often it is more sensible not to change the 3rd party projects but to use the "official" hooks of the libraries such as listeners, filters, interceptors or to use an IOC framework such as Spring and replace some implementations if this is possible.

http://stackoverflow.com/a/22549297
type: Answer
answers question: http://stackoverflow.com/q/22549261
has body: You never initialise avgField which causes a NullPointerException in init when you try and add it to the applet You never assign the result of average to anything... For example... avgField.setText(NumberFormat.getNumberInstance().format(average)); You might like to take a look at Code Conventions for the Java Programming Language, Creating a GUI With JFC/Swing and if you really want to go cutting edge, JavaFX AWT is seriously out of date...
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/a/22562308
has comment: http://stackoverflow.com/comment/34400064
score: 0
answers question: http://stackoverflow.com/q/22557985
type: Answer
has body: Does something like this work? MimeBodyPart htmlpart = new MimeBodyPart(); String html = " Sample This is a sample HTML part"; html += " "; html += " "; htmlpart.setContent(html, "text/html"); Multipart mp = new MimeMultipart(); mp.addBodyPart(htmlpart); mail.setContent(mp);

http://stackoverflow.com/comment/34545844
type: QuestionComment
has text: @Silas I think I got it working. I just saved my whole buffer as an array of chars and then parsed each individual char after the header for my data. Thank you so much!
comment on: http://stackoverflow.com/q/22572923
score: 0
type: Comment

http://stackoverflow.com/q/22544442
accepted answer: http://stackoverflow.com/a/22545322
favorite count: 0
has body: I'm currently undertaking a project with the aim to improve my understanding of Java. Part of my project is to use an array and be able to move positions down 1 in order to slot in another element at a specific position. For example, names in alphabetical order... If I want to place an element in the middle of an array then places should be moved -1. I've been looking around and actually found what I think could potentially be a solution on StackOverflow. Although the poster didn't actually provide full detail on what's going on. I was hoping someone could explain it to me. As I don't want to use something that I don't have a full understand off. This was the question : I've had a decent search and am unable to find working code that moves down an array. What I am hoping to do, is to store the value in the last position in the array, replace the last position and then move array[20] to array[19]. This is meant to count the last 20 moves the player makes, but I'm having trouble actually storing. This is what I have attempted to do //an int moveArray[20] previously stated and instantiated int temp1, temp2; for (int i = moveArray.length - 1; i &gt; 0; i--) { temp1 = moveArray[i - 1]; temp2 = moveArray[i - 2]; moveArray[i - 1] = moveArray[i]; temp1 = temp2; } moveArray[moveArray.length - 1] = intoWalk; any advice or solutions would really help, thanks This was the solution : for(int i=0;i&lt;moveArray.length-1;i++){ moveArray[i] = moveArray[i+1]; } moveArray[moveArray.length - 1] = intoWalk; If anyone could explain the solution for me please step by step I'd extremely appreciate it
possible better answer: http://stackoverflow.com/a/22545455
has answer: http://stackoverflow.com/a/22545455
has answer: http://stackoverflow.com/a/22545322
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 2
answer count: 2
has title: Array forloop noob enquiry
has comment: http://stackoverflow.com/comment/34310667
downvote count: 1

http://stackoverflow.com/comment/34252519
comment on: http://stackoverflow.com/a/22511005
type: Comment
has text: Yes, all you need is AlarmReceiver. Here how it works, you add the alarm to the alarm manager, and when you receive the alarm you push a notification.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34530858
has text: Thanks. I did it almost the same way. Now I know few more extra stuffs from your ans. Thanks again.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22662132

http://stackoverflow.com/comment/34343693
type: QuestionComment
score: 1
has text: @Vyger an infinite loop
type: Comment
comment on: http://stackoverflow.com/q/22563558

android-emulator
tags question: http://stackoverflow.com/q/22591768
tags question: http://stackoverflow.com/q/22578861
type: Tag
tag name: android-emulator
tags question: http://stackoverflow.com/q/22503749
tags question: http://stackoverflow.com/q/22558161
tags question: http://stackoverflow.com/q/22622756

http://stackoverflow.com/comment/34292003
type: Comment
has text: I just asked our off-heap lead engineer, and according to him there is only a cost to copy the data from off-heap to send it to the socket. It should have roughly the same performance as an 'on-heap' imap configured with 'binary' in-memory-format.
comment on: http://stackoverflow.com/a/22533632
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34283105
has text: @RohitJain which did you learn about first - for loops or streams?
type: AnswerComment
comment on: http://stackoverflow.com/a/22529004
score: 0
type: Comment

http://stackoverflow.com/comment/34424887
type: AnswerComment
has text: @shylu json is null as i had guessed. you should make sure you return the json and that is not null
type: Comment
comment on: http://stackoverflow.com/a/22603999
score: 0

http://stackoverflow.com/q/22588953
has answer: http://stackoverflow.com/a/29199795
type: Question
has title: Interface to communicate to web pages from android application
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I am trying to implement a "Doctor Finder" application for android which will have a symptom checker facility like webMD. Since webMD don't have any API's I must create my own expert system (which takes a lot of time) or need to find something similar to webMD which offers public API. I found NIL API from National Library of Medicine US and I doubt it would be useful in my scenario. Now the actual question, Is it possible to use webMD's online symptoms checker using an interface from android. I don't want to show the HTML page within my app but to send and receive information through it? If not is there any APIs available to serve this purpose?
tagged with: expert-system
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/34406948
type: QuestionComment
has text: You could step through this with a debugger, and see for yourself why the recursion ends.
comment on: http://stackoverflow.com/q/22598647
score: 0
type: Comment

http://stackoverflow.com/comment/34412228
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22600452
has text: Because you don't *need* an 'early catch', because `catch (BindException ...)` *is* the catch, and it is 100% reliable, unlike lockfile-based solutions. Adding something unreliable just to prevent something reliable from triggering in the same case doesn't begin to make sense.
score: 0

msg
tags question: http://stackoverflow.com/q/22492277
tag name: msg
type: Tag

http://stackoverflow.com/comment/34279871
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22512728
has text: Presumably you have a file with a list of artists. How to read this file depends on the format. Can you provide some sample data from the file? Just a few lines to get the idea
score: 0

http://stackoverflow.com/q/22550268
has title: For loop executing other class method creates massive lag
type: AnsweredQuestion
tagged with: 2d
tagged with: java
type: Question
tagged with: for-loop
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/22550400
tagged with: graphic
has body: Like the title says. I am executing a For loop in my Game.java file(which is where "Main" is located too). and it is Creating massive lag. Only occurs when i am executing a Method from another .java . This is where i execute it in the "Game.java" (Notice: it is a class inside the Game.java) : public class DrawPanel extends JPanel{ /** * */ private static final long serialVersionUID = 1L; @Override public void paintComponent(Graphics g) { super.paintComponent(g); } public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; super.paint(g2d); Player.draw(g2d); for(int i = 0;i &lt; 640;i+=16) block.createBlock(g2d,i,382,"Dirt"); for(int i = 0;i &lt; 640;i+=16) for(int x = 398;x &lt; 446; x += 16) block.createBlock(g2d,i,x,"Dirt_WO_Grass"); repaint(); } } and this is the method in Block.java : class Block { public void createBlock(Graphics g, int posx,int posy,String name){ BufferedImage block = null; try { block = ImageIO.read(new File("res/"+name+".png")); } catch (IOException e) { e.printStackTrace(); } g.drawImage(block, posx, posy, null); } }
has answer: http://stackoverflow.com/a/22550400

http://stackoverflow.com/q/22576217
has comment: http://stackoverflow.com/comment/37922062
downvote count: 1
type: Question
has body: I am using import org.jdesktop.swingx.autocomplete.Configurator; Configurator.enableAutoCompletion(combo); to make my combo box auto complete. But this is not working. My combo box name is combo. When i am importing NetBeans says that that import org.jdesktop.swingx.autocomplete.Configurator; does not exists. Can anyone suggest a simple way to auto complete the combo box. I cannot add more lines of codes because i have some restriction in terms of lines of codes for this project.
tagged with: autocomplete
score: 1
tagged with: java
has title: Auto complete combo box in java problems
answer count: 1
has answer: http://stackoverflow.com/a/22580086
has comment: http://stackoverflow.com/comment/34372885
tagged with: combobox
has comment: http://stackoverflow.com/comment/34372741
favorite count: 0
tagged with: netbeans
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34372816
has comment: http://stackoverflow.com/comment/34372907

http://stackoverflow.com/q/22638711
tagged with: java
has answer: http://stackoverflow.com/a/22638822
tagged with: switch-statement
type: Question
has answer: http://stackoverflow.com/a/22638809
score: -1
answer count: 3
downvote count: 1
favorite count: 0
has body: I'm just a newbie in java, so please help me, i think the problem is in the switch stament String customer[]=new String[2]; int old[]=new int[2]; for(i=0; i&lt;customer.length;i++){ System.out.println("\nEnter information of customer#" +(i+1)); System.out.print("Enter customer name"+(i+1)+":"); customer[i]=data.readLine(); System.out.print("Enter old reading of costumer#"+(i+1)+":"); old[i]=Integer.parseInt(data.readLine()); } System.out.println("\n\nSample Menu"); System.out.println("1. Display Transaction\n2.Pay Water Bill"); System.out.print("Enter your choice:"); choice=Integer.parseInt(data.readLine()); In this part the System.out.println(customer[i]+"."); is not working switch(choice){ case 1: System.out.println("This is to display the transaction!"); System.out.println(customer[i]+"."); \ break; case 2: System.out.println("This is to pay the water bill!"); break; default: System.out.println("Exit`!"); break; } } }
has answer: http://stackoverflow.com/a/22641323
has title: Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34295566
type: Comment
has text: I cannot import TilePane from javafx.scene.layout.TilePane. I am using Netbeans Java - If I would like to use Netbeans JavaFX, I would have to create new project. I don't want to do everything from scratch.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22533737

http://stackoverflow.com/q/22585621
answer count: 5
tagged with: java-io
has title: The FileReader cannot find my text file
has answer: http://stackoverflow.com/a/22585658
has comment: http://stackoverflow.com/comment/34383813
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/34385848
accepted answer: http://stackoverflow.com/a/22618107
has answer: http://stackoverflow.com/a/64833473
favorite count: 0
has comment: http://stackoverflow.com/comment/34383620
type: Question
tagged with: filereader
possible better answer: http://stackoverflow.com/a/22585647
tagged with: java
has answer: http://stackoverflow.com/a/22585647
downvote count: 3
has body: I have a simple text file and for some reason, it cannot be found. I don't see anything wrong with the code because I got it from a site, and I am starting to think that I didn't place the text file in the right place. Any suggestion please? Code: import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.nio.file.Path; import java.nio.file.Paths; public class MainFavorites { public static void main(String[] args) throws IOException { /** * finds pathway to the file */ // File file = new File("icecreamTopping.txt"); // System.out.println(file.getCanonicalPath()); BufferedReader reader = null; ArrayList &lt;String&gt; myFileLines = new ArrayList &lt;String&gt;(); try { String sCurrentLine; reader = new BufferedReader(new FileReader("icecreamTopping.txt")); while ((sCurrentLine = reader.readLine()) != null) { //System.out.println(sCurrentLine); myFileLines.add(sCurrentLine); } } catch (IOException e) { e.printStackTrace(); System.out.print(e.getMessage()); } finally { try { if (reader != null)reader.close(); } catch (IOException ex) { System.out.println(ex.getMessage()); ex.printStackTrace(); } } int numElements = myFileLines.size(); System.out.println ("there are n lines in the file:" + numElements); for (int counter = numElements-1; counter &gt;= 0; counter--) { String mylineout = myFileLines.get(counter); System.out.println (mylineout); } } } File content: 1- Blueberry 2- Banana Buzz 3- Cookie Batter My stack trace is this: java.io.FileNotFoundException: C:\Users\homar_000\workspace\RankFavorites\icecreamTopping.txt (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileReader.&lt;init&gt;(Unknown Source) at MainFavorites.main(MainFavorites.java:28)
has answer: http://stackoverflow.com/a/71878776
has answer: http://stackoverflow.com/a/22618107
upvote count: 5

http://stackoverflow.com/a/22610618
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/34428011
downvote count: 0
answers question: http://stackoverflow.com/q/22610531
has comment: http://stackoverflow.com/comment/34428472
has comment: http://stackoverflow.com/comment/34428397
type: Answer
has comment: http://stackoverflow.com/comment/34438362
has body: You are never instanitating the arraylist. Try private ArrayList&lt;Integer&gt; gradeList = new ArrayList&lt;Integer&gt;();

eclipse-virgo
tag name: eclipse-virgo
tags question: http://stackoverflow.com/q/22530932
type: Tag

http://stackoverflow.com/q/22539318
downvote count: 1
has comment: http://stackoverflow.com/comment/34304175
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/34301247
type: UnansweredQuestion
has title: Android: TypedArray.recycle() - what does it do, why is it important?
tagged with: java
has comment: http://stackoverflow.com/comment/34301345
type: Question
has comment: http://stackoverflow.com/comment/34301201
has body: So I'm looking at http://developer.android.com/reference/android/content/res/TypedArray.html#recycle() Which is used in some code I've been going over, and the docs line is a little vague: public void recycle () Added in API level 1 Give back a previously retrieved array, for later re-use. Normally I would assume this to be a garbage collection assistant, but the method call doesn't - as far as I can tell from the docs - clean up my reference to the array. Is it that different threads are in action and you get concurrent modification exceptions if you don't 'give back' control of the TypedArray? What does "give back" mean in this context?
has comment: http://stackoverflow.com/comment/34403449
score: 0
upvote count: 1
tagged with: android

http://stackoverflow.com/q/22523760
score: 0
type: UnansweredQuestion
tagged with: itext
has comment: http://stackoverflow.com/comment/34320191
has comment: http://stackoverflow.com/comment/34284912
has comment: http://stackoverflow.com/comment/34280358
type: Question
tagged with: java
has title: Re-size page size in existing pdf using itext
has comment: http://stackoverflow.com/comment/34289717
has comment: http://stackoverflow.com/comment/34291872
has body: I am using following code to create new document from existing pdf. I want to shrink all pages(re-size) of existing pdf in new generated pdf. Code i am using: public void resize() throws IOException, DocumentException { PdfReader reader = new PdfReader("D:/test/scaned4.pdf"); Document document = new Document(PageSize.LEGAL, 0, 0, 0, 0); System.out.println(reader.isTampered()); PdfCopy copy = new PdfCopy(document, new FileOutputStream( "D:/test/result.pdf")); document.open(); PdfImportedPage page; for (int i = 1; i &lt;= reader.getNumberOfPages(); i++) { page = copy.getImportedPage(reader, i); copy.addPage(page); } reader.close(); document.close(); } There is any way to shrink imported page before add to new document.
has comment: http://stackoverflow.com/comment/34291417
tagged with: itextpdf
answer count: 0

http://stackoverflow.com/comment/34419200
type: QuestionComment
comment on: http://stackoverflow.com/q/22605621
score: 0
type: Comment
has text: thanks, when i remove the line, my application back working fine, this line inside the LookupDAO class

http://stackoverflow.com/comment/34402525
has text: I think people are having hard time figuring out what exactly you need (especially before edit 1 hour ago). Also this skirts the "recommend a library/tool for me" offtopic category. I would try to provide more explanation , perhaps an imaginary example case, to clarify what you need. Also telling what you have found so far might help people to get your question.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22594604

http://stackoverflow.com/q/22594777
has comment: http://stackoverflow.com/comment/34399843
has body: I want to make my own exception. But when I throw my exception the program is close. So how can I run my method 3 times and after that close the program. (my program closed after intArray, but I want to go through dobleArray and charArray) Here is my Exception: public class InvalidSubScriptException extends RuntimeException{ public InvalidSubScriptException(){ super("Invalid subscript"); } } Here is my code: import javax.naming.spi.DirStateFactory; public class GenericTest { public static void main(String[] args) { Integer[] intArray = {1, 2, 3, 4, 5}; Double[] doubleArray = {1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7}; Character[] charArray = {'H', 'E', 'L', 'L', 'O'}; System.out.println("Array integerArray contains:"); printArray(intArray); System.out.println("Array integerArray from possition 1 to 3 contains:"); printArray(intArray, 1, 3); System.out.println("Array integerArray from possition -1 to 30 contains:"); printArray(intArray, -1, 30); System.out.println("Array doubleArray contains:"); printArray(doubleArray); System.out.println("Array doubleArray from possition 1 to 3 contains:"); printArray(doubleArray, 1, 3); System.out.println("Array doubleArray from possition -1 to 30 contains:"); printArray(intArray, -1, 30); System.out.println("Array charArray contains:"); printArray(charArray); System.out.println("Array charArray from possition 1 to 3 contains:"); printArray(charArray, 1, 3); System.out.println("Array charArray from possition -1 to 30 contains:"); printArray(intArray, -1, 30); } public static &lt;T&gt; void printArray(T[] inputArray) { int counter = 0; for (T element : inputArray) { System.out.printf("%s ", element); counter++; } System.out.println(); System.out.println(counter + " element(s) were output"); counter = 0; } public static &lt;T&gt; void printArray(T[] inputArray, int lowSubscript, int hightSubscript) throws InvalidSubScriptException { int counter = 0; if (lowSubscript &gt;= 0 &amp;&amp; hightSubscript &lt; inputArray.length) { for (int i = lo…
score: 0
tagged with: exception
answer count: 1
tagged with: custom-exceptions
has answer: http://stackoverflow.com/a/22594846
type: UnansweredQuestion
tagged with: java
has title: Custom Exception (RuntimeException)
type: Question

http://stackoverflow.com/a/22490492
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22487909
upvote count: 1
has body: The scrollbar will appear automatically when the preferred size of the component added to the viewport of the scrollpane is greater than the size of the scrollpane. So, you need to override the getPreferrredSize() method of you JPanel to dynamically recalculate the preferred size. The preferred size calculation will need to take into account: the size of all the components being painted on the panel. So yo will probably use an ArayList to track all the components. Then you just loop through the list to determine the largest width/heigh position of any component. the mouse location when the mouse is being dragged. If this value is greater than the width/height of the above calculation then you need to use this value. You will also need to invoke revalidate() for every mouseDragged event to make sure the layout of the component is done.
score: 1

http://stackoverflow.com/q/22517973
downvote count: 0
has answer: http://stackoverflow.com/a/22518391
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22518391
tagged with: java-3d
type: AnsweredQuestion
has body: My problem is the difference between this: and this: I'm trying to create a nice looking solar system with Java3D but when I apply a texture the lighting effect disappears and the 3D effect (when not looking at the planet top-down) goes with it. How can I have this kind of shading on textured surfaces? The code I used for the earth example is available below. The texture is downloadable here. import com.sun.j3d.utils.geometry.Primitive; import com.sun.j3d.utils.geometry.Sphere; import com.sun.j3d.utils.image.TextureLoader; import com.sun.j3d.utils.universe.SimpleUniverse; import javax.imageio.ImageIO; import javax.media.j3d.*; import javax.vecmath.Color3f; import javax.vecmath.Point3d; import javax.vecmath.Vector3d; import java.awt.*; import static java.lang.Math.PI; import static java.lang.Math.cos; import static java.lang.Math.sin; public class Hello3d { public Hello3d() { SimpleUniverse universe = new SimpleUniverse(); BranchGroup group = new BranchGroup(); for(double i=0; i&lt;2*PI; i+=PI/5) { group.addChild(basicSphere(0.8*cos(i),0.8*sin(i),0)); } universe.getViewingPlatform().setNominalViewingTransform(); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 10000000.0); PointLight light = new PointLight(); light.setColor(new Color3f(Color.WHITE)); light.setPosition(0.0f,0.0f,0.0f); light.setInfluencingBounds(bounds); group.addChild(light); universe.addBranchGraph(group); } public static void main( String[] args ) { new Hello3d(); } private TransformGroup basicSphere(double x, double y, double z) { try { int primflags = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS; Texture tex = new TextureLoader( ImageIO.read(getClass().getResource("earthmap.jpg")) ).getTexture(); tex.setBoundaryModeS(Texture.WRAP); tex.setBoundaryModeT(Texture.WRAP); TextureAttributes texAttr = new TextureAttributes(); texAttr.setTextureMode(TextureAttributes.REPLACE); Appearance ap = new Appearance(); ap.setTexture(tex); ap.setTextureAttributes(texAttr); Sph…
score: 7
tagged with: java
upvote count: 7
type: Question
has title: Light and textures in Java3D

http://stackoverflow.com/q/22590914
type: Question
has comment: http://stackoverflow.com/comment/34393570
score: 9
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22591077
has comment: http://stackoverflow.com/comment/34392796
has comment: http://stackoverflow.com/comment/34392784
has comment: http://stackoverflow.com/comment/34392810
has answer: http://stackoverflow.com/a/22591551
has comment: http://stackoverflow.com/comment/34392798
accepted answer: http://stackoverflow.com/a/22591077
has title: overloading method priority in java
possible better answer: http://stackoverflow.com/a/22591551
has comment: http://stackoverflow.com/comment/34392880
type: AnsweredQuestion
tagged with: overloading
linked to: http://stackoverflow.com/q/20923888
upvote count: 9
tagged with: java
has body: I know that this problem discussed many times but I don't understand anyway. Research this code: public class Main { public static void var(Integer x, int y) { System.out.println("Integer int"); } public static void var(int... x) { System.out.println("int... x"); } public static void var(Integer... x) { System.out.println("Integer..."); } public static void main(String... args) { byte i = 0; Integer i2 = 127; var(i, i2); } } In my brain following rule: widening boxing boxing+varargs According this rule I make next actions 1.byte wides to int Now I have int Integer and there are exist method takes Integer and int 2.make boxing Hence. int -> Integer and Integer -> int arguments I think that arguments are applicable and expected to see Integer int in output. But I see int ... why?

http://stackoverflow.com/q/22593762
tagged with: hashmap
has body: Are there any disadvantages of using a LinkedHashMap instead of a HashMap? Most posts seem to discuss the advantages of LinkedHashMaps (such as this one or the API), but I can't find any reason HashMaps are better.
tagged with: data-structures
answer count: 2
score: 3
has answer: http://stackoverflow.com/a/22593798
downvote count: 0
has title: Disadvantages of a LinkedHashMap?
favorite count: 0
has comment: http://stackoverflow.com/comment/34398187
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37915348
possible better answer: http://stackoverflow.com/a/22593807
accepted answer: http://stackoverflow.com/a/22593798
upvote count: 3
linked to: http://stackoverflow.com/q/2889777
tagged with: java
has answer: http://stackoverflow.com/a/22593807
type: Question
tagged with: linkedhashmap

http://stackoverflow.com/comment/34415912
type: Comment
has text: @user755806 yes. Its an irritating problem I know. You got to kind a way out using the solutions I mentioned.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22603447

http://stackoverflow.com/q/22577468
tagged with: android
answer count: 0
tagged with: java
has title: In java and android how to add views in an arraylist?
type: Question
has body: I am trying to create ArrayList of views. Unfortunately, the ArrayList values changes as the views reference changes. I have two references, one to add at even position and another at odd. I see the behaviour as when 3rd item comes, the value of 1st also changes and same applies for the even number also. I need to update the list of views on some bases. How this can be solved? I tried it by something like this but didn't worked: private void addItemAt(int depth,View retView){ ArrayList&lt;View&gt; viewsAdded = new ArrayList&lt;View&gt;(viewsAtDepths.size()); for (int i = 0; i &lt; viewsAtDepths.size(); i++) { View v = viewsAtDepths.get(i); viewsAdded.add(v); } viewsAtDepths = viewsAdded; if(depth &lt; viewsAtDepths.size()){ Log.d(TAG,"Replacement at depth "+depth); viewsAtDepths.set(depth, retView); } else{ Log.d(TAG,"Added at depth "+depth); viewsAtDepths.add(retView); } Log.d(TAG,"ADD item is made "+depth +" and total nu of items are "+viewsAtDepths.size()); for (int i = 0; i &lt; viewsAtDepths.size(); i++) { if(viewsAtDepths.get(i) instanceof ListView){ ListView lv = (ListView) viewsAtDepths.get(i); if(lv.getItemAtPosition(i) instanceof Node){ Node n = (Node) lv.getItemAtPosition(0); Log.d(TAG,"Title Name at "+i+" selected node is "+n.title); } else{ if(lv.getItemAtPosition(i) instanceof String){ Log.d(TAG,"String Title Name at "+i+" selected node is "+lv.getItemAtPosition(i)); } } } } }
score: 0
has comment: http://stackoverflow.com/comment/34369240
has comment: http://stackoverflow.com/comment/34371808
type: UnansweredQuestion

http://stackoverflow.com/a/22564606
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22564426
answers question: http://stackoverflow.com/q/22564426
type: Answer
has body: Only one ServerSocket can bind a SocketAddress (IP address and port number). Possible reasons why the address is already bound: Another application on your system currently uses this port (in this case: pick another port) You may still have a running instance of your application in the background (in this case: terminate it in the console view in Eclipse) You attempted to bind the SocketAddress twice (in this case: fix your program).
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/41338375
type: Comment
comment on: http://stackoverflow.com/a/22610341
type: AnswerComment
has text: @OlegEstekhin Can you try a fiddle which takes the input from a Java output and then decrypt it. I have a similar issue here - http://stackoverflow.com/questions/26315885/java-encryption-and-javascript-decryption?noredirect=1#comment41303566_26315885
score: 0

http://stackoverflow.com/a/22528731
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34282257
answers question: http://stackoverflow.com/q/22528609
has body: This can be done through two different methods 1) Scriplets 2) JSTL tags 1)Scriplets &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;form:form method="post" action="add_subject_mark" commandName="Result"&gt; &lt;% Result result = (Result) request.getAttribure("Result"); HashMap&lt;String,Integer&gt; mark = result.getMark(); //There u got the HashMap %&gt; &lt;/form:form&gt; &lt;/body&gt; &lt;/html&gt;

http://stackoverflow.com/comment/34362278
score: 0
comment on: http://stackoverflow.com/q/22573621
type: Comment
type: QuestionComment
has text: My classpath is just `.` (but I'm using JDK 7). I'm not sure the "bin" is right for a classpath anyway; mine doesn't have any .jar files in it..... Try `set CLASSPATH=.` and then compile and run again.

http://stackoverflow.com/q/22579965
answer count: 4
has title: Browser using JEditorPane forcing blue background
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36432750
has answer: http://stackoverflow.com/a/36411251
tagged with: java
has comment: http://stackoverflow.com/comment/34383477
has body: This is the code I'm using to display google in a JEditorPane String url="http://google.com"; editorPane.setEditable(false); try { editorPane.setPage(url); } catch (IOException e) {} But for some reason the background will always be a blue colour, doesn't matter if I call setBackgroundColor(Color.WHITE);
has answer: http://stackoverflow.com/a/36425014
upvote count: 10
type: Question
has answer: http://stackoverflow.com/a/36333542
score: 10
has comment: http://stackoverflow.com/comment/34373496
has comment: http://stackoverflow.com/comment/60247911
tagged with: colors
linked to: http://stackoverflow.com/q/13285526
downvote count: 0
tagged with: url
has comment: http://stackoverflow.com/comment/34372965
favorite count: 0
possible better answer: http://stackoverflow.com/a/36333542
tagged with: jeditorpane
accepted answer: http://stackoverflow.com/a/36411251
has comment: http://stackoverflow.com/comment/34373699
has comment: http://stackoverflow.com/comment/60247977
tagged with: swing

http://stackoverflow.com/comment/34462095
type: QuestionComment
has text: It comes with netbeans find it in components
score: 0
comment on: http://stackoverflow.com/q/22629616
type: Comment

http://stackoverflow.com/q/22558186
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
tagged with: in-app-billing
type: Question
has body: In my application I have one in-app product that can be purchased. This is a premium service unlocker for the application. Is it bad to check the purchase status in onCreate method in a class that extends Application? The pros of this is that it can be done in the background and is not tied to an Activity. Currently, I have a splash screen and after that my second Activity starts which checks the purchase status. It is run in an AsyncTask which can take a while. Because of this, the user might see the premium version purchase button to flash. I could do that in the splash screen Activity, but then I wouldn't have access to the connection and I can't bind the purchase action to a button in the main Activity. This way I can also store the boolean value of the purchase state in the Application class. I need to access that from multiple places. Currently I am passing the value as Intent extra to the Activities that require it. The only downside of this is that the connection would be alive for a long time. In my main Activity, I bind the connection in the onCreate method and unbind it in onDestroy. Does it keep an active connection open or is it okay to open the connection in the Application class? Also, if the connection is opened in the class that extends Application, I have no access to any on destroy method to close the connection. According to the documentation, onTerminate in the Application class is never called so that user code is executed. It will never be called on a production Android device, where processes are removed by simply killing them; no user code (including this callback) is executed when doing so. In my main Activity I currently have this IInAppBillingService mService; ServiceConnection mServiceConnection = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { mService = null; } @Override public void onServiceConnected(ComponentName name, IBinder service) { mService = IInAppBillingService.Stub.asInterface(serv…
score: 4
tagged with: google-play-services
upvote count: 4
downvote count: 0
favorite count: 0
has title: Using in-app billing in Application class

signpost
tags question: http://stackoverflow.com/q/22638494
type: Tag
tag name: signpost

http://stackoverflow.com/a/22575070
downvote count: 0
answers question: http://stackoverflow.com/q/22575028
has body: Because Msg has been initialised to a non-null value (the string "Original") but the other fields have not, so they're null and you get an exception trying to call a method (getClass) on a null reference. If you just tried to print out Msg2 rather than Msg2.getClass() then you'd see the value null with no exception.
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/34293066
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22534639
score: 0
has text: As one row or separate rows? Or don't care?

http://stackoverflow.com/comment/34349507
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22565434
type: Comment
has text: I got some help from someone that knows more about AS400 than I do. We found the MSGW messages, found out what was wrong with the ProgramCallDocument, and fixed it. I was missing a parm in my XML, which caused MSGW. Thanks for the tip, good job!

http://stackoverflow.com/comment/34468377
comment on: http://stackoverflow.com/q/22633333
has text: welcome to SO! if you want fast and correct answer - please share all relevant data- so please add the exception you are receiving
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34440920
has text: It is a graphical user interface (GUI) that happens to be written in Java Swing.
comment on: http://stackoverflow.com/q/22616379
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22632263
score: 0
has body: You're running into an endless loop, because the user has no chance to reenter his PIN, if it doesn't match the length. Looping and Listeners don't work quite well in this way. Why don't you just keep the relevant variables (e.g. nbTry) as members and perform your checks without looping?
type: Answer
answers question: http://stackoverflow.com/q/22631993

http://stackoverflow.com/q/22609255
upvote count: 2
has answer: http://stackoverflow.com/a/22609482
has comment: http://stackoverflow.com/comment/34425903
tagged with: bitmap
tagged with: android-imageview
type: Question
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34426421
tagged with: java
has comment: http://stackoverflow.com/comment/34425977
answer count: 2
has body: I am using the following code with the help of 'Android Universal image loader' library, but the quality of the image is very poor and I get too many skipped frames in my logcat, here is my code, please look and help how can I improve it? private class DownloadImageTask extends AsyncTask&lt;String, Void, Bitmap&gt; { ImageView bmImage; public DownloadImageTask(ImageView bmImage) { this.bmImage = bmImage; } protected Bitmap doInBackground(String... urls) { String urldisplay = urls[0]; // Bitmap mIcon11 = null; ImageLoader imageLoader = ImageLoader.getInstance(); Bitmap bitmap = imageLoader.loadImageSync(urldisplay); Bitmap circleBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); BitmapShader shader = new BitmapShader(bitmap, TileMode.CLAMP, TileMode.CLAMP); Paint paint = new Paint(); paint.setShader(shader); Canvas c = new Canvas(circleBitmap); c.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2, bitmap.getWidth() / 2, paint); //img1.setImageBitmap(circleBitmap); //bmImage.setImageBitmap(circleBitmap); return circleBitmap; } protected void onPostExecute(Bitmap result) { bmImage.setImageBitmap(result); } }
possible better answer: http://stackoverflow.com/a/22609482
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22609479
accepted answer: http://stackoverflow.com/a/22609479
tagged with: android
has title: How to maintain quality of the image downloaded from url to imageview and crop them to a circle?

http://stackoverflow.com/comment/34235192
type: QuestionComment
has text: You have to be able to delimit the messages in the stream received from the socket - the two ways to do that are start each message with something that allows you to determine its length or use a delimiting marker between each message
comment on: http://stackoverflow.com/q/22501650
score: 0
type: Comment

windows
tags question: http://stackoverflow.com/q/22559918
tags question: http://stackoverflow.com/q/22534080
tags question: http://stackoverflow.com/q/22627887
tags question: http://stackoverflow.com/q/22529639
tags question: http://stackoverflow.com/q/22542182
tags question: http://stackoverflow.com/q/22545660
tags question: http://stackoverflow.com/q/22548715
tags question: http://stackoverflow.com/q/22562427
tags question: http://stackoverflow.com/q/22646598
tags question: http://stackoverflow.com/q/22514023
tags question: http://stackoverflow.com/q/22557274
tags question: http://stackoverflow.com/q/22599739
tags question: http://stackoverflow.com/q/22629076
tags question: http://stackoverflow.com/q/22634007
type: Tag
tags question: http://stackoverflow.com/q/22522721
tags question: http://stackoverflow.com/q/22596115
tags question: http://stackoverflow.com/q/22573064
tags question: http://stackoverflow.com/q/22563645
tags question: http://stackoverflow.com/q/22611400
tags question: http://stackoverflow.com/q/22564682
tag name: windows
tags question: http://stackoverflow.com/q/22532383
tags question: http://stackoverflow.com/q/22564136

http://stackoverflow.com/a/22501697
type: Answer
has body: Use local instead of home as below ejb/RequestHandler Session company.application.RequestHandlerInterface
has comment: http://stackoverflow.com/comment/34293053
upvote count: 1
answers question: http://stackoverflow.com/q/22501261
score: 1
has comment: http://stackoverflow.com/comment/34294771
has comment: http://stackoverflow.com/comment/34239508
downvote count: 0
has comment: http://stackoverflow.com/comment/34295427
has comment: http://stackoverflow.com/comment/34234704

http://stackoverflow.com/q/22525078
has body: i am new to hibernate and want to know a few things. I want to implement the following query in hibernate,please guide me. SELECT p.num_is_active FROM ins.cnfgtr_user_log t, ins.service_user_auth p WHERE t.source = 'GC' and t.tokenid = p.txt_auth_token and t.sessionid = 100000000195756 and t.userid = p.txt_user_id and t.userid = 'MASTERADMIN' I also want to know do i have to maintain two separate pojo's for these two tables? does this pojo's need to be complete? i mean do they need to contain all the columns of the tables or can they contain only the ones needed for this query?
score: 0
has title: How to fetch data from multiples tables in Hibernate?
answer count: 1
tagged with: hibernate-mapping
has comment: http://stackoverflow.com/comment/34276114
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/22525575
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/34296098
type: QuestionComment
comment on: http://stackoverflow.com/q/22536284
score: 0
has text: You leave the `@Query` annotation. It's redundant.
type: Comment

http://stackoverflow.com/comment/34328458
comment on: http://stackoverflow.com/q/22552714
type: Comment
type: QuestionComment
has text: FYI Delnan and Grijesh, changing to a list upped the speed difference to python being almost 75% faster
score: 0

http://stackoverflow.com/q/22578903
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31476025
has comment: http://stackoverflow.com/comment/34371455
type: Question
tagged with: java
answer count: 2
tagged with: environment-variables
has body: I have installed Android Studio and JDK. I have set my variable to the JDK folder. Now, when launching the program I receive an error message stating, "The environment variable JAVA_HOME (with the value of C:\ProgramFiles\Java\jdk1.8.0) does not point to a valid JVM Installation. Can you please assist with this? Thanks!
score: 0
has title: Android Studio Java
tagged with: android-studio
has answer: http://stackoverflow.com/a/22578951

http://stackoverflow.com/comment/34380395
has text: @mcandre I didn't know it did that. Same as in most *NIX shells then (and maybe not so silly).
comment on: http://stackoverflow.com/q/22583785
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22551678
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22551601
downvote count: 0
score: 3
has body: Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec(args); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; System.out.printf("Output of running %s is:", Arrays.toString(args)); while ((line = br.readLine()) != null) { System.out.println(line); }

http://stackoverflow.com/a/22612926
answers question: http://stackoverflow.com/q/22612689
has comment: http://stackoverflow.com/comment/34432078
score: 0
has body: Your implementation class MyCustomService is not public(unless there is a typo in the code provided). Make it public and spring should pick it up.
type: Answer

http://stackoverflow.com/comment/34387295
comment on: http://stackoverflow.com/a/22580369
type: AnswerComment
type: Comment
has text: You get a NullPointerException because you allocated the array and didn't allocate the elements within it so rdbs[i] is null. Look at the stack it will actually say null pointer exception as well and point you at the specific line.
score: 1

http://stackoverflow.com/comment/35401435
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22625530
has text: can u help me to review this [code](http://stackoverflow.com/questions/23150104/how-to-pass-the-alarm-value-to-alarm-receiver). I would like to use him code.
score: 0

http://stackoverflow.com/q/22591350
tagged with: rest
type: UnansweredQuestion
has title: how to override default xml generation from Jersey REST webservice
score: 1
tagged with: java
tagged with: jaxb
upvote count: 1
tagged with: web-services
type: Question
tagged with: jersey
has body: I am totally new to Jersey REST webservice, I just get some simple XML generated by using @GET @Produces @Path in the resource file, I know there is a way to override default JAXB format of genereated XML but the question is how? Is there any basic tutorial to show how to do that? I am currently using Jersey so I would like to know how to integrat JAXB and Jersey together, thanks in advance!
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22591621

http://stackoverflow.com/comment/34483777
type: QuestionComment
type: Comment
score: 1
has text: My requirement is to use pl-sql procedures to do the update. Is there any other way of knowing if the update failed for a particular row?
comment on: http://stackoverflow.com/q/22637726

http://stackoverflow.com/comment/34277759
type: QuestionComment
type: Comment
has text: The easiest way is to use the spring taglib and call `<spring:url value="/login" />` or you can add it manually using `${pageContext.request.contextPath}`
comment on: http://stackoverflow.com/q/22526020
score: 0

http://stackoverflow.com/comment/34320699
score: 0
type: Comment
has text: Also, by the way, the problem you are having isn't that Java is doing it too fast; it's that you're doing it in a for loop that doesn't terminate until all the health has been added. By the time your loop exits, all health will be recovered no matter *how* fast you do it in the loop, so if you call that function as soon as your program starts, it will execute that loop before moving on to do the next thing. Hence suggestions for threads, per-frame updates, timers, etc.
type: QuestionComment
comment on: http://stackoverflow.com/q/22550165

http://stackoverflow.com/q/22585999
downvote count: 1
type: Question
has body: i just created a new project with new blank activity but the moment i implemented a button/Imagebutton an error happens... here is the code: public class MainActivity extends ActionBarActivity implements OnClickListener { ImageButton html; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); html = (ImageButton) findViewById(R.id.bHTML); html.setOnClickListener(this); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } @Override public void onClick(View v) { switch (v.getId()) { case R.id.bHTML: Intent i = new Intent(this, HtmlListView.class); startActivity(i); break; } } } i am still learning how to use the fragment template that the updated ADT provides for new blank activities.. if there is anything i need to do, please say it.. thank you very much! EDIT: fragment_main: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" an…
has comment: http://stackoverflow.com/comment/34384825
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/34385002
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22590891
has comment: http://stackoverflow.com/comment/34384321
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: fragment
has answer: http://stackoverflow.com/a/22586418
has title: Null Pointer Exception Error on New Blank Activity
tagged with: java
upvote count: 1

http://stackoverflow.com/q/22637712
type: AnsweredQuestion
has title: java.lang.NoClassDefFoundError when using weka.jar file in my own java file
accepted answer: http://stackoverflow.com/a/22638668
tagged with: java
has body: I'm having problems executing my java program. The code is placed in the file RunMining.java and contains multiple import weka.[..] lines. The weka library (weka.jar) is placed in the same folder. I compile it: $ javac -cp weka.jar RunMining.java This creates three files: RunMining.class, RunMining$1.class, RunMining$classifierType.class When i run it: java -cp weka.jar RunMining i get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: RunMining Caused by: java.lang.ClassNotFoundException: RunMining 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) My RunMining.java file only contains one class called RunMining, which contains the main method. I would prefer not to add the weka.jar file to my CLASSPATH since this file will be compiled using a makefile and executed using a script, on different machines. Any suggestions, to how i can run the compiled files?
tagged with: noclassdeffounderror
type: Question
tagged with: weka
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22638668
tagged with: classpath

http://stackoverflow.com/q/22527927
answer count: 3
tagged with: sql
has comment: http://stackoverflow.com/comment/34281523
has answer: http://stackoverflow.com/a/22527940
tagged with: ms-access
possible better answer: http://stackoverflow.com/a/22527940
has comment: http://stackoverflow.com/comment/34281283
has body: I have an access database and trying to use it in java. I want to select it and wrote a statement as String sql="SELECT * from numeric;"; try { rs=s.executeQuery(sql); while(rs.next()) { System.out.println(rs.getString(1)); } } The executeQuery is throwing an exception as java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause. I think the select statement I wrote is correct. Even if i write as SELECT Webservice FROM numeric; also gives me an error where Webservice is my column name.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22528515
tagged with: java
has answer: http://stackoverflow.com/a/22528095
has title: java sql exception syntax error in from clause
type: Question
has comment: http://stackoverflow.com/comment/34280617
tagged with: jdbc-odbc
has comment: http://stackoverflow.com/comment/34281593
accepted answer: http://stackoverflow.com/a/22528515
score: 0

http://stackoverflow.com/comment/34409929
score: 2
comment on: http://stackoverflow.com/q/22600345
has text: Not sure for other but you should not compare String with `==` return unexpected result instead use `String.equals()` method see [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java). Moreover you should use `Prepared Statement` to avoid `SQL Injection` See [Avoiding SQL injection in java](http://stackoverflow.com/questions/17391720/avoiding-sql-injection-in-java)
type: Comment
type: QuestionComment

webdriver
tags question: http://stackoverflow.com/q/22550124
tags question: http://stackoverflow.com/q/22493419
tags question: http://stackoverflow.com/q/22504373
type: Tag
tags question: http://stackoverflow.com/q/22516207
tags question: http://stackoverflow.com/q/22601655
tag name: webdriver

http://stackoverflow.com/comment/34280595
score: 1
has text: You should benefit from the hints given in http://stackoverflow.com/questions/19839469/optimizing-high-volume-batch-inserts-into-neo4j-using-rest.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22526396

http://stackoverflow.com/a/22522210
answers question: http://stackoverflow.com/q/22522157
has comment: http://stackoverflow.com/comment/34271028
type: Answer
has comment: http://stackoverflow.com/comment/34271187
has comment: http://stackoverflow.com/comment/34270975
has comment: http://stackoverflow.com/comment/34271239
has comment: http://stackoverflow.com/comment/34271160
upvote count: 1
downvote count: 1
has body: Less efficient, but more readable, using java Math library. Here a little example: currentFoodAmount = Math.min(currentFoodAmount, maxFoodAmount); currentFoodAmount = Math.max(currentFoodAmount, 0); More efficient, but less readable: currentFoodAmount = currentFoodAmount &gt; 0 ? (currentFoodAmount &lt; maxFoodAmount ? currentFoodAmount : maxFoodAmount ) : 0;
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22522157

http://stackoverflow.com/a/22544906
answers question: http://stackoverflow.com/q/22544727
score: 5
upvote count: 5
has body: In this string literal: String path = "C:\\temp\\\\7800000\7767546.pdf"; you forgot to escape the last \. What actually happens is this: According to JLS 3.10.6, \ may be followed by one, two, or three octal digits, and if it's followed by three octal digits, the first one must be 0 through 3. The compiler will take the longest substring that meets the rule. Since \776 doesn't follow the rules (the first digit is larger than 3), that means it interprets \77 as an escape sequence, where 77 is treated as an octal number, which equals 63 in decimal, which is the ASCII code for '?'.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34394156
type: AnswerComment
type: Comment
has text: @Mark: at which point in the program do you insert the skip statement?
comment on: http://stackoverflow.com/a/22591646
score: 0

http://stackoverflow.com/q/22607567
has body: I got LIstView with 3 TextViews and 1 ImageView -using simpleAdapter with specific xml Layout layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/tvSongName" android:layout_width="200dp" android:layout_height="50dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:background="@drawable/plank1" android:gravity="center" android:text="TextView" android:textSize="14sp" android:textStyle="bold" /&gt; &lt;ImageView android:id="@+id/ivFav" android:layout_width="150dp" android:layout_height="50dp" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginTop="10dp" android:src="@drawable/plank4_empty" /&gt; &lt;TextView android:id="@+id/tvDate" android:layout_width="170dp" android:layout_height="50dp" android:layout_alignParentLeft="true" android:layout_below="@+id/tvSongName" android:background="@drawable/plank2" android:gravity="center" android:text="TextView" android:textSize="14sp" android:textStyle="bold" /&gt; &lt;TextView android:layout_centerVertical="true" android:id="@+id/tvArtist" android:layout_width="150dp" android:layout_height="50dp" android:layout_alignParentRight="true" android:layout_below="@+id/ivFav" android:background="@drawable/plank3" android:gravity="center" android:text="TextView" android:textSize="14sp" android:textStyle="bold" /&gt; &lt;/RelativeLayout&gt; code: // get all the JSON Objects of today songs and return in array public JSONArray getJSONs_array() throws ClientProtocolException, IOException, JSONException { StringBuilder url = new StringBuilder(current_url); HttpGet get = new HttpGet(url.toString()); HttpResponse r = client.execute(get); int status = r.getStatusLine().getStatusCode(); if (status == 200) { HttpEntity e …
tagged with: listview
score: 0
has answer: http://stackoverflow.com/a/22607700
accepted answer: http://stackoverflow.com/a/22607700
answer count: 1
tagged with: android
has title: Android change imageView resource onItemClick in Listview
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/22630387
answers question: http://stackoverflow.com/q/22630207
has comment: http://stackoverflow.com/comment/34473119
type: Answer
upvote count: 1
has body: To prevent the dialog from being closed when the background or the area outside of the dialog is clicked, do this: this.setFinishOnTouchOutside(false); Set it to true to do the opposite. Note: this refers to a Context.
score: 1
has comment: http://stackoverflow.com/comment/34473270
downvote count: 0
has comment: http://stackoverflow.com/comment/34473954

http://stackoverflow.com/comment/34235277
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22502229
has text: Returns the name of the enum constant, same as toString. The documentation says to use name when you want the exact name, and toString when you want something to display to a user. They must have a *reason* for saying that - maybe they'll change how toString works in the future.
type: Comment

http://stackoverflow.com/a/22597646
downvote count: 0
answers question: http://stackoverflow.com/q/22597468
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22597468
type: AcceptedAnswer
has body: Actually Your, nimsson, idea almost worked. At least it gave me the right direction to find out the answer by myself. I called requestFocusInWindow(false) method on my frame and now the focus is gone.

http://stackoverflow.com/comment/34352871
type: Comment
comment on: http://stackoverflow.com/a/22550202
has text: Thanks for all the help. I took what you said into consideration, did some extra research and I think I know the way I want to tackle this.
score: 0
type: AnswerComment

http://stackoverflow.com/a/70649478
type: Answer
answers question: http://stackoverflow.com/q/22522490
score: 0
has body: Right click your project name in the NetBeans and you will see many options starting with new, Build, clean and Build. click the clean and build and it will create a dist folder which has the war file and you can access the dist folder in the files at the top (projects Files Services)

http://stackoverflow.com/comment/34267731
comment on: http://stackoverflow.com/a/22520360
type: AnswerComment
has text: Would you need to quote the parameter (`'?'`)?
score: 0
type: Comment

http://stackoverflow.com/comment/34446387
type: Comment
has text: yes, [dlopen](http://linux.die.net/man/3/dlopen)
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22620513

http://stackoverflow.com/a/22585384
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22585289
type: Answer
answers question: http://stackoverflow.com/q/22585289
has body: I'm guessing you mean JTextField and not TextField. Use the getText() method. String text = yourTextField.getText(); Also works with the TextField class, actually. You'll need an ActionListener on your submit button if you want to grab the text fields' values when a user clicks the button. public void actionPerformed(ActionEvent e) { if (e.getSource() == yourButtonsName) { text = yourTextField.getText(); } } Don't forget to add the ActionListener! yourButtonsName.addActionerListener(this); Or you could use Java 8 lambda expression: yourButtonsName.addActionerListener(e -&gt; text = yourTextField.getText); If you'd like to learn more about Java's graphical capabilities, I recommend the Oracle docs: http://docs.oracle.com/javase/tutorial/uiswing/.
upvote count: 3

http://stackoverflow.com/q/22611891
possible better answer: http://stackoverflow.com/a/22612031
accepted answer: http://stackoverflow.com/a/22631971
tagged with: algorithm
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22631971
has answer: http://stackoverflow.com/a/22613449
has answer: http://stackoverflow.com/a/22612031
has comment: http://stackoverflow.com/comment/34442590
tagged with: android
has body: Ok so I want to find an algorythm that searches through some objects (in my case 4) and finds the object with the smallest member variable. Lets say you can get that value with object.getIntegerValue() In my case I have 4 android layouts and want to find the layout with the smallest amount of childs. I think there will be plenty of solutions but I just want to find a fast one. No matter how dirty and so on.... My Code so far is short, dirty and doesnt always return the object with the smallest member variable, but only has to serve as an Code Example here: private LinearLayout layoutChanger(){ int one, two, three; one = layoutOne.getChildCount(); if ((two = layoutTwo.getChildCount()) &lt;= one) { if ((three = layoutThree.getChildCount()) &lt;= two) { if ((layoutFour.getChildCount()) &lt;= three) return layoutFour; return layoutThree; } return layoutTwo; } return layoutOne; } Edit: I know how to do this I rather wanted to get suggestions on how to speed up things... Is Comparable really a fast one? Or should I distinct myself of OOP solutions to get better performance?
has comment: http://stackoverflow.com/comment/34430276
type: AnsweredQuestion
has title: Finding object with smallest member variable
tagged with: java
type: Question

http://stackoverflow.com/q/22535101
has answer: http://stackoverflow.com/a/22535391
has comment: http://stackoverflow.com/comment/34293934
has comment: http://stackoverflow.com/comment/34293494
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22535226
has comment: http://stackoverflow.com/comment/34293678
has comment: http://stackoverflow.com/comment/34293535
has answer: http://stackoverflow.com/a/22535218
possible better answer: http://stackoverflow.com/a/22535395
has comment: http://stackoverflow.com/comment/34293472
has comment: http://stackoverflow.com/comment/34293549
has answer: http://stackoverflow.com/a/22535395
has comment: http://stackoverflow.com/comment/34293613
linked to: http://stackoverflow.com/q/12226757
answer count: 5
has comment: http://stackoverflow.com/comment/34293619
has comment: http://stackoverflow.com/comment/34293552
duplicate of: http://stackoverflow.com/q/12226757
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22535218
has comment: http://stackoverflow.com/comment/34293899
tagged with: equals
has comment: http://stackoverflow.com/comment/34293584
type: Question
has body: I am comparing two Doubles: 37.4238777160645 and 37.4238777160645 But Java does not consider them to be equal. I am comparing them in the following manner if(object1.getLatitude()!=object2.getLatitude()){ fail("objects are not equal "+object1.getLatitude()+":"+object2.getLatitude()); } resulting in the following fail: junit.framework.AssertionFailedError: objects are not equal 37.4238777160645:37.4238777160645 I don't understand why - Please advise.
has answer: http://stackoverflow.com/a/22535197
has comment: http://stackoverflow.com/comment/34293906
tagged with: compare
has comment: http://stackoverflow.com/comment/34293541
has comment: http://stackoverflow.com/comment/34293760
has title: Program considers two equal doubles to be different

http://stackoverflow.com/comment/34426235
type: Comment
type: QuestionComment
score: 5
has text: That is called [yoda conditons](http://stackoverflow.com/questions/22106713/what-is-the-difference-between-if-null-pointer-vs-if-pointer-null/22106732#22106732) and with a modern compiler it should not be necessary anymore.
comment on: http://stackoverflow.com/q/22609733

http://stackoverflow.com/a/22511134
has body: You should pass the cause in as a constructor argument, instead of calling initCause. In real code you don't see an exception thrown wrapping the same type of exception. The point is to wrap an implementation-level exception in something higher-level, so that the code catching the exception doesn't have a lot of implementation-specific special cases to handle (and implementation details don't bleed through to parts of the code that shouldn't have to care), while the chaining makes sure the original stacktrace is retained. So you'd do something like: private static void method1() throws HigherLevelException { try{ System.out.println("Inside Try Block"+10/0); } catch(ArithmeticException e){ throw new HigherLevelException(e); } } Since a lot of people consider checked exceptions to be a failed experiment (not even dot-net chose to copy them), in a lot of cases the higher level exception tends to be an unchecked exception. You'll see this pattern with Spring and Hibernate. In your first example catching an exception just to rethrow it should not be necessary. The stacktrace should be sufficient to determine where the exception was generated without having to log and rethrow. Make sure you have one centralized place that catches and logs exceptions.
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22510851

http://stackoverflow.com/comment/34485272
type: AnswerComment
score: 0
has text: Maybe, but it's always bad to use recursion, if you can do it iteratively.
type: Comment
comment on: http://stackoverflow.com/a/22642582

http://stackoverflow.com/a/22607760
score: 0
type: Answer
has body: You can use RandomAccessFile to read the files' data, and when you reach a point where you need to change the data you can overwrite the existing number of bytes with equal number of bytes. It's iff the new value is exactly the same length as the old value. With RandomAccessFile its difficult and equally complex when the size of two, the one being changed and the new value are different. It involves a lot of seeks, reads and writes to move data back Try to read the whole file, change the bits you have to change and write a new file. You might process one line at a time or read the whole file into memory, modify it and write it all back out again. It is a good idea to perform the edit in the following manner: Read file Write to Temporary File [just to back-up] Rename original to back-up Work on Temporary file. Remove Backup if you were successful.
answers question: http://stackoverflow.com/q/22607033

http://stackoverflow.com/comment/34335965
type: Comment
has text: i already use this but unable to get full response in string variable.
comment on: http://stackoverflow.com/a/22559583
score: 0
type: AnswerComment

http://stackoverflow.com/q/22518220
tagged with: spring-mvc
type: AnsweredQuestion
has body: I am developing web application using Spring 3.2.4. I have some forms with fields containing date and time. Piece of my jsp: &lt;form:form method="post" action="/add" modelAttribute="licence"&gt; ... &lt;form:input type="datetime" path="beginDate"/&gt; &lt;form:input type="datetime" path="endDate"/&gt; &lt;form:input path="quantityLimit"/&gt; ... &lt;/form:form&gt; Normal form, nothing fancy. I am using datepicker, which gives me date in format yyyy-MM-dd HH:mm, so I've added this to my controller: @InitBinder public void initBinder(WebDataBinder webDataBinder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); dateFormat.setLenient(true); webDataBinder.registerCustomEditor(DateTime.class, new CustomDateEditor(dateFormat, true)); } Also, I have added &lt;mvc:annotation-driven/&gt; to my servlet configuration xml, as stated on some blogs. There's target controller: @RequestMapping(value = "/{softwareId}/licence/add", method = RequestMethod.POST) public String addLicence(@PathVariable("softwareId") Long softwareId, Licence licence, Model model) { Software software = softwareRepository.findOne(softwareId); licence.setSoftware(software); licenceRepository.save(licence); return ADMIN_PATH + "softwareEdit"; } And software class looks like this: @Entity @Table(name = "licences") public class Licence { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "begin_date") private DateTime beginDate; @Column(name = "end_date") private DateTime endDate; @Column(name = "quantity_limit") private Long quantityLimit; @ManyToOne private Software software; //getters, setters, etc. } The problem is: when I submit my form with dateTime field empty it works perfectly, but when I have anything in date field (no matter if it's properly formatted or not) I get HTTP Error 400: Bad Request. No exceptions in console, only bad request, but I am pretty sure it has something to do with date parsing. Is there a well described method of dealing w…
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/34265846
has title: Format of DateTime field not recognized by Spring
type: Question
has comment: http://stackoverflow.com/comment/34266379
has answer: http://stackoverflow.com/a/22519673
downvote count: 0
answer count: 1
tagged with: jsp
tagged with: datetime
favorite count: 0
accepted answer: http://stackoverflow.com/a/22519673
has comment: http://stackoverflow.com/comment/34263830
has comment: http://stackoverflow.com/comment/34263981
upvote count: 7
tagged with: spring

http://stackoverflow.com/q/22566891
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22567010
score: 0
answer count: 3
has body: I'm trying do examples from "Spring in action 3". But have this problem and don't understand why. I have next classes: My entity: package core; import javax.persistence.*; import org.hibernate.annotations.GenericGenerator; @Entity @Table(name="users") public class SplitterImpl{ @Id @GeneratedValue(generator="increment") @GenericGenerator(name="increment", strategy="increment") @Column(name="id") private int id; @Column(name="name") private String name; @Column(name="password") private String password; @Column(name="fullname") private String fullname; @Column(name="email") private String email; @Column(name="updatebyemail") private String updatebyemail; //**************** //public Setters/getters //**************** } My DAO: package core; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; @Repository public class HibernateSplitterDao implements SplitterDAO { @Autowired private SessionFactory sessionFactory; public SessionFactory getSessionFactory() { return sessionFactory; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } @Override public void addSplitter(SplitterImpl splitter) { sessionFactory.getCurrentSession().persist(splitter); } } My main class: package core; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Main { public static String getBean(){ ApplicationContext ctx=new ClassPathXmlApplicationContext("core\\spring.xml"); return ctx.getBean(HibernateSplitterDao.class).toString(); } } in xml spring configuration I'm wrote this: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:xsi="http://www.w3.org/20…
tagged with: exception
has title: NoSuchBeanDefinitionException with Spring and Hibernate
tagged with: spring
possible better answer: http://stackoverflow.com/a/22567010
has answer: http://stackoverflow.com/a/22567687
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22567687
has answer: http://stackoverflow.com/a/22567058
type: Question

http://stackoverflow.com/comment/34459021
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22602366
has text: BTW - that spec. sounds like a nicey-nice way of saying *"Yeah.. we're ripping off an entire web site, but don't want to seek permission or give credit to do that, so we'll just **strip that part of the evidence of copyright infringement"*** What is all this intended to support?

http://stackoverflow.com/comment/34254532
type: Comment
score: 2
type: QuestionComment
has text: What are you expecting with `obj.say != null`? Do you come from the JavaScript world? ;)
comment on: http://stackoverflow.com/q/22513112

http://stackoverflow.com/q/22631015
has comment: http://stackoverflow.com/comment/34512712
has title: Struts: Setting Default Value for Radio Button without using List or ArrayList
score: 0
has comment: http://stackoverflow.com/comment/34473468
answer count: 1
has answer: http://stackoverflow.com/a/22631110
tagged with: java
has comment: http://stackoverflow.com/comment/34509491
has comment: http://stackoverflow.com/comment/34497348
type: AnsweredQuestion
has body: So in my case, I have existing radio buttons created using Struts like so: &lt;s:radio property="myclass.radioValue" value="Value1" /&gt; &lt;s:radio property="myclass.radioValue" value="Value2" /&gt; Where in myclass I get and set the radioValue like so: private String rdValue; public void setRadio(String rd) { this.rdValue = rd; } public String getRadio() { return rdValue; } I would like to set a default radio button if it's value on the database is null. After some research I read that I can use List or ArrayList to do this but I am using version 1.4 for the compiler and JRE so it doesn't work. This is for an existing project so I can't rebuild the project using later versions of the compiler. So my question is, would it be possible to set the default value without the use of lists or arraylists?
accepted answer: http://stackoverflow.com/a/22631110
tagged with: struts2
type: Question

http://stackoverflow.com/comment/34263132
score: 0
has text: A question: What happens after you see this error? c3p0 tries to recover from this sort of deadlock. It interrupt()s the frozen Threads and discards them, runs backlogged tasks in one-off Threads, and sets up a new Thread pool. Does your app recover? Does the error repeat over and over? Or what? If you cycle (bring down then up) the DBMS, does the running application heal?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22513152

http://stackoverflow.com/q/22573046
has title: Webview running on wrong thread exception
downvote count: 0
has body: Initially was loading a link in webview since this is a sample app. Work fine till api 4.1 .Throws an exception when loading the same in ver 4.3 onwards. Code: this.runOnUiThread(new Runnable() { @Override public void run() { if (loadThisUrl != null) { simpBrowser.loadUrl(loadThisUrl); } } }); The Logcat: 03-24 10:45:27.580: A/libc(27538): Fatal signal 6 (SIGABRT) at 0x00006b92 (code=-6), thread 27568 (e.simplebrowser) I tried running this on ui thread still the same issue. previously i would simply load the url and it seem to work. any points on how or where i'm going wrong will be very helpful.
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
tagged with: java
tagged with: multithreading
tagged with: webview
upvote count: 1
type: Question

http://stackoverflow.com/q/22601414
tagged with: android
tagged with: fm-radio
has answer: http://stackoverflow.com/a/22652799
favorite count: 0
has title: How to set a frequency for the fm radio in android?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22652799
has comment: http://stackoverflow.com/comment/116477865
has body: In my android app I am using this intent to start fm radio Intent i = new Intent(Intent.ACTION_MAIN); PackageManager manager = getPackageManager(); i = manager.getLaunchIntentForPackage("com.sec.android.app.fm"); i.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(i); Is it possible to set a manual frequency and open the fm radio? Thanks
tagged with: java
possible better answer: http://stackoverflow.com/a/22653033
has answer: http://stackoverflow.com/a/22653033
upvote count: 10
type: Question
downvote count: 0
score: 10
answer count: 2

http://stackoverflow.com/comment/34221231
comment on: http://stackoverflow.com/q/22493638
score: 0
type: QuestionComment
type: Comment
has text: @KevinBowersox I mean Servlet

http://stackoverflow.com/a/22582380
answers question: http://stackoverflow.com/q/22582313
score: 2
has comment: http://stackoverflow.com/comment/34377717
has body: You can use reflection to get the type of a class. Class clazz = list.get(0).getClass(); System.out.println(clazz.getCanonicalName()); System.out.println(clazz.getEnclosingClass()); System.out.println(clazz.getSimpleName()); Or if you know what types of classes it could resolve to you could try something like the following: Object o = list.get(0); if (o instanceof String) { ... } else if (o instanceof Integer) { ... }
downvote count: 0
has comment: http://stackoverflow.com/comment/34377625
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34377700
accepted answer of: http://stackoverflow.com/q/22582313
upvote count: 2
type: Answer

http://stackoverflow.com/a/37136625
has comment: http://stackoverflow.com/comment/78292884
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/78237223
has body: To solve this problem go to C:\Users\yourComputerName\AppData\Local\NetBeans and delete the cache folder.This definately solved my problem.
answers question: http://stackoverflow.com/q/22573787
has comment: http://stackoverflow.com/comment/74862100

http://stackoverflow.com/q/22641493
score: 0
tagged with: jdesktoppane
has comment: http://stackoverflow.com/comment/34483145
answer count: 1
tagged with: jinternalframe
has answer: http://stackoverflow.com/a/22641588
type: UnansweredQuestion
tagged with: swing
tagged with: mdi
tagged with: java
has body: I have a question from swing, I have two forms, the first form is for MDI and the second form is for login, I want when a user enters password and username correct, user can login to MDI‘s form. MDI form use of jform and login form use of jinternalframe, I define JDesktopPane and add login to this, but I want to use button in jframe(MDI form) , when I add button to JDesktopPane, it can add but I cannot set location of my button. Please help me how can set location of my jinternalframe and button? This is my code: Login frame = new Login(); frame.setVisible(true); desktop=new JDesktopPane(); desktop.add(frame,BorderLayout.CENTER); setContentPane(desktop); frame.setSelected(true); frame.setLocation(500, 200); FlowLayout flo = new FlowLayout(); desktop.setLayout(flo); JButton buttonSaveCustumer = new JButton("Create Customer"); buttonSaveCustumer.setLocation(70, 80); this.add(buttonSaveCustumer); Best Regards
has title: Add button to JDesktopPane
type: Question

http://stackoverflow.com/a/22537168
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22536565
has body: What you want is a callback interface for the communication from a Fragment to an Activity. The docs already provide a good example for this. Define an Interface which your Activity implements: public interface Callback { void doSomething(); } public class YourActivity implements Callback { ... @Override public void doSomething() { // your implementation here } } In your Fragment use this interface if one of the Buttons are clicked. public class ServerFragment extends Fragment { Callback iCallback; ... @Override public void onAttach(Activity activity) { super.onAttach(activity); try { iCallback = (Callback) activity; } catch (ClassCastException e) { throw new ClassCastException(); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.server_layout, container, false); btnServer = (Button) view.findViewById(R.id.buttonServer); btnServer.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { iCallback.doSomething(); } }); } } With this approach you can leave your logic in the Activity and handle the UI events in the Fragment. Through the events in the Fragment you can invoke the methods in your Activity.
type: Answer
has comment: http://stackoverflow.com/comment/34300205
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34299314
has comment: http://stackoverflow.com/comment/34298166
has comment: http://stackoverflow.com/comment/34298627
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22536565

http://stackoverflow.com/q/22611541
answer count: 1
accepted answer: http://stackoverflow.com/a/22611580
has body: I am trying to parse some time strings like this: String time_string = "10:00 AM"; SimpleDateFormat format = new SimpleDateFormat("hh:mm a"); Date date = null; try { date = format.parse(time_string); // Do something with 'date' } catch (ParseException e) { Log.w("Time", e.toString()); } But the parser is failing with the exception: java.text.ParseException: Unparseable date: "10:00 AM" What I am doing wrong?
has title: Error while parsing a time string
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22611580
type: Question
tagged with: simpledateformat
linked to: http://stackoverflow.com/q/3618676
duplicate of: http://stackoverflow.com/q/3618676

http://stackoverflow.com/a/36273336
has body: I generated stubs from WSDL, compiled in java 8 and was able to deploy them on server having java 1.6 jvm on it.
type: Answer
answers question: http://stackoverflow.com/q/22610400
downvote count: 2
upvote count: 1
score: -1

http://stackoverflow.com/q/22618557
favorite count: 0
tagged with: jooq
upvote count: 3
has comment: http://stackoverflow.com/comment/34910626
tagged with: sql
has comment: http://stackoverflow.com/comment/34857509
has comment: http://stackoverflow.com/comment/35068352
has comment: http://stackoverflow.com/comment/34479134
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34526163
has comment: http://stackoverflow.com/comment/34606787
score: 3
downvote count: 0
tagged with: java
tagged with: orm
tagged with: mysql
has body: I'm trying to do a select from where in JOOQ using this syntax: public final org.jooq.TableField&lt;MyType, java.lang.String&gt; DATE = createField("date", org.jooq.impl.SQLDataType.VARCHAR.length(8), this); Cursor&lt;MyRecord&gt; cursor = create.selectFrom(MYTABLE) .where( MYTABLE.DATE_STRING_COLUMN.greaterOrEqual( ??? ) ) .fetchLazy(); The code generator knows about this column but sees it as a String. MyType is the type of MyRecord. The problem that I have is that the Database stores a String for the data that I need to convert to java.sql.date. I want to call a custom converter in the where clause to convert the native Date type which is a string like "2014-03-24" to a java.sql.Date. The reason that this wasn't working was that there was no type conversion between String and Java.sql.Date, so you'd get a type mis-match. The problem is that I can't seem to find the right type to put in the conditional (where I have the three question marks). I have a custom field converter that implements that the convert() method that takes a record and returns a java.sql.Date object, but I can't seem to get the right type to put there. I'm getting around it using a raw SQL String for now, it looks like this: str_to_date(date, '%m-%d-%y') &gt;= now() Does anyone how I can invoke the custom field converter inside of the where clause?
type: Question
has title: Using a custom field converter in a where clause in JOOQ

http://stackoverflow.com/comment/34455247
comment on: http://stackoverflow.com/q/22625417
type: Comment
type: QuestionComment
has text: I suspect what you actually want is a generic. I could explain to you how they work in Java, but I don't know how C# generics work.
score: 0

http://stackoverflow.com/q/22603601
has title: Java Rest webservice with bad queryparam
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34421978
has answer: http://stackoverflow.com/a/22607816
tagged with: rest
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22603798
tagged with: web-services
type: Question
has body: I have the below web service method, @GET @Produces({ "application/xml", "application/json" }) @Path("/service/salesorder/{identifier}/{orderType}") public Response readOrder(@PathParam("identifier") String identifier, @PathParam("orderType") String orderType); If user calls the below correct url, i want the service to work fine, if any one calls with bad url (extra query param), which is not defined in the method, i want to throw some error, how can i catch all the bad urls? Correct URL : http://myApp.com/service/salesorder/123/ShoppingOrder Bad URL : http://myApp.com/service/salesorder/123/ShoppingOrder&amp;badparam
tagged with: java

http://stackoverflow.com/comment/34270712
score: 0
has text: You'd need to provide a runnable example before I would even be able to guess why. The example I linked works just fine...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22521884

http://stackoverflow.com/comment/34267582
type: QuestionComment
has text: Yeah I'm very sure it is because I run this sql query on the server where my database is located and it retrieved the results successfully.
score: 0
comment on: http://stackoverflow.com/q/22519982
type: Comment

http://stackoverflow.com/q/22525392
accepted answer: http://stackoverflow.com/a/22525965
has title: Calling .jar from shell script
score: 1
tagged with: java
upvote count: 1
has body: I have a shell script which calls a .jar file.Following is the command: java -Xms256m -Xmx512m -cp (path)/VxCryptor.jar com.datalog.security.PrepareImportFile $SOURCE_FILE $TARGET_FILE -f (path)/$ENCRYPTION_KEY It gives the following error: Error: Could not find or load main class com.datalog.security.PrepareImportFile Can you tell me what does this command do? and what is this Error about?
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22525965
has comment: http://stackoverflow.com/comment/34279849
answer count: 1
downvote count: 0
tagged with: jar
tagged with: shell
has comment: http://stackoverflow.com/comment/34278714
favorite count: 0
tagged with: oracle-database
tagged with: encryption

http://stackoverflow.com/comment/34294692
type: Comment
has text: I have added expression for RCPProjectNature_1
comment on: http://stackoverflow.com/a/22534838
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34224452
type: Comment
type: QuestionComment
has text: What does your request look like? I was unable to reproduce the problem in a test. https://gist.github.com/swankjesse/a2fba4b1277b4cf4c973
comment on: http://stackoverflow.com/q/22488366
score: 0

http://stackoverflow.com/comment/34383636
type: QuestionComment
comment on: http://stackoverflow.com/q/22585596
has text: Maybe it is not fileChooser which makes thread wait, but your `// operation with the file`.
score: 0
type: Comment

andengine
tags question: http://stackoverflow.com/q/22605634
tags question: http://stackoverflow.com/q/22550277
tags question: http://stackoverflow.com/q/22508997
type: Tag
tags question: http://stackoverflow.com/q/22536404
tag name: andengine
tags question: http://stackoverflow.com/q/22522017

http://stackoverflow.com/comment/34358954
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22571620
has text: I have this exception "java.lang.String cannot be cast to org.w3c.dom.NodeList" Also I try with XPathConstants.NODESET but the results in this is 21 null
type: Comment

http://stackoverflow.com/comment/34411531
type: Comment
has text: my soap xml response is previously what i mention the code like that only within that string tag, it just come like text eg: <Symbol>STRING</Symbol 0.00 N/A <Time>N/A N/A N/A N/A N/A N/A N/A N/A N/A - N/A N/A N/A STRING
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22594367

http://stackoverflow.com/q/22601081
type: Question
has title: Trouble creating a simple array in Java
possible better answer: http://stackoverflow.com/a/22601093
has answer: http://stackoverflow.com/a/22601093
tagged with: java
has answer: http://stackoverflow.com/a/22601202
has answer: http://stackoverflow.com/a/22601210
has answer: http://stackoverflow.com/a/22601122
has comment: http://stackoverflow.com/comment/34411233
downvote count: 4
upvote count: 0
tagged with: arrays
answer count: 5
has body: I'm having a bit of trouble creating a simple array in Java where a random number is generated every time it loops. My code is as follows: public class Q1 { public static void main(String[] args) { Scanner listScan = new Scanner(System.in); System.out.println("Size of list to sort?"); int j = listScan.nextInt(); int listArray[] = new int[j]; for (int i = 0; i &lt;= j; i++){ listArray[i] = (int)(Math.random() * 100 +1); } System.out.println(listArray); } } but the code gives me this: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at Lab3.Q1.main(Q1.java:18) 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
score: -4
accepted answer: http://stackoverflow.com/a/22601202
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/22601100

http://stackoverflow.com/comment/34487721
type: AnswerComment
comment on: http://stackoverflow.com/a/22588516
score: 0
type: Comment
has text: You did not get it wrong, you just interpret it wrong. The azimuth in this case calculate the direction of the device y-axis with respect to magnetic north. That is the angle between the World y-axis (magnetic north) and the projection of the device y-axis into the World xy plane. So if you rotate the device, the device y-coordinate change and so is the azimuth. I think if you are interested in the device z-coordinate when the device is not flat. Can you tell me what this is for?

http://stackoverflow.com/a/31756050
accepted answer of: http://stackoverflow.com/q/22581423
answers question: http://stackoverflow.com/q/22581423
type: Answer
has comment: http://stackoverflow.com/comment/64922931
score: 4
has body: I realize that you asked this over a year ago, but it took me quite some time to figure this out for myself, so hopefully this helps someone at some point. With a FakeApplication running, you can do basically everything you can after saying "activator run", except that there is not a webserver (netty) running serving up requests. You can though, test your controllers, as shown here, and call methods that access the database. I actually referenced both of those posts you mention when figuring this out, in addition to this one, which discusses some special play magic config vars that must be set you'll see in my example below. I created an abstract FakeApplicationTest class which I extend in the Unit/Functional tests. I first use my existing application.conf file, then overwrite certain parameters to test against a different database. Once the FakeApplication is started, I read in all the evolutions and create a fresh database to run my tests against. public abstract class FakeApplicationTest { protected static FakeApplication app; /** * Create a new FakeApplication using all our custom config vars that test against diff DB's * * @return */ public static FakeApplication createFakeApp() { // grab the main application.conf file that is used to start up the Play application Config config = ConfigFactory.parseFile(new File("conf/application.conf")); // resolve all variables within this config file with other variables within itself config = ConfigFactory.load(config); // create a Configuration object out of this and then turn it into a Map to be modified Configuration configuration = new Configuration(config); Map&lt;String, Object&gt; fakeApplicationConf = Maps.newHashMap(configuration.asMap()); // do some crazy stuff here because Play wants us to for config voodoo, see: // http://www.stupidjavatricks.com/2013/05/changing-play-2-db-configuration-at-runtime-beware-of-dragons/ Configuration akka = configuration.getConfig("akka.actor.serialization-bindings"); addValue(fakeA…
has comment: http://stackoverflow.com/comment/64966393
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22637164
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22711066
has answer: http://stackoverflow.com/a/22711066
has comment: http://stackoverflow.com/comment/34477491
has comment: http://stackoverflow.com/comment/34476652
has answer: http://stackoverflow.com/a/22639609
linked to: http://stackoverflow.com/q/2108313
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/15656139
has comment: http://stackoverflow.com/comment/34475171
has title: How to read disk partition in java
has comment: http://stackoverflow.com/comment/34476709
type: Question
has comment: http://stackoverflow.com/comment/34475770
accepted answer: http://stackoverflow.com/a/22639609
has body: Is it possible to read whole partition of disk in java? Partition is treated as directory (obviously) and because of it I can't create FileInputStream which I need. I'd like to compute hash for whole partition of disk (byte by byte) and I was wondering how to achieve that. If that matters it has to work both on Windows and Linux. Any thoughts are appreciated!
tagged with: java
has comment: http://stackoverflow.com/comment/34477328

http://stackoverflow.com/a/22619515
upvote count: 1
type: Answer
has body: Yes, it is quite easy, try this : String text = "[title],[description blablablablablabla]"; String[] splitted = text.replaceAll("\\[", "").replaceAll("\\]", "").split(",");
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22619453
has comment: http://stackoverflow.com/comment/34450311

http://stackoverflow.com/a/22651043
score: 3
has comment: http://stackoverflow.com/comment/34510549
upvote count: 3
answers question: http://stackoverflow.com/q/22642892
has body: StringDecoder requires a framing decoder in front of it. Place a LineBasedFrameDecoder to handle a text line properly. StringEncoder does not append "\r\n" for you. If you did not, please do. These two changes will probably make it work.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34421996
has text: Depending on the number of items contained in the matrix, a `StringBuilder` may be more appropriate.
score: 1
comment on: http://stackoverflow.com/a/22607212
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22556760
answers question: http://stackoverflow.com/q/22556519
upvote count: 1
has comment: http://stackoverflow.com/comment/34331330
has body: TextView opt1 = (TextView)findViewById(R.id.btnt1); Casting a button to a TextView? Delete it, just do: btn1.setText("your text");
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/22632232
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Aggregation is a subset of association. Composition is a subset of aggregation. So, putting OR between them is not so correct. Should the comments deleted when the job is deleted? Yes , then is this composition? If they are deleted, it IS a composition. But it is YOU who have to decide how you'll organize your classes. You can make comments not so dependent and it will be a shared aggregation or association with none aggregation
score: 1
accepted answer of: http://stackoverflow.com/q/22500727
upvote count: 1
answers question: http://stackoverflow.com/q/22500727

http://stackoverflow.com/comment/34399210
comment on: http://stackoverflow.com/q/22594519
score: 7
type: QuestionComment
has text: Don't use `==` to compare Strings. Use `equals`.
type: Comment

http://stackoverflow.com/comment/34273849
type: AnswerComment
type: Comment
has text: yes i want to save it to 2 variables defined in User.java.
comment on: http://stackoverflow.com/a/22523755
score: 0

http://stackoverflow.com/q/22576068
has title: Resource Closing concern wih finally block
has comment: http://stackoverflow.com/comment/34366184
has comment: http://stackoverflow.com/comment/34366082
has comment: http://stackoverflow.com/comment/34369378
score: 0
has comment: http://stackoverflow.com/comment/34366074
has comment: http://stackoverflow.com/comment/34367703
has comment: http://stackoverflow.com/comment/34367032
has comment: http://stackoverflow.com/comment/34366120
has comment: http://stackoverflow.com/comment/34365974
has comment: http://stackoverflow.com/comment/34366315
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34369331
has comment: http://stackoverflow.com/comment/34366065
has comment: http://stackoverflow.com/comment/34365932
answer count: 0
has comment: http://stackoverflow.com/comment/34366626
tagged with: java
has body: In my code, there is a memory Leak, due to some uncleaned resource issue, so I am currently closing those resources in finally block, as I know finally always executed. In many functions I m returning the same resource, which will I gonna close in the finally block and my understanding is that first the return statement of try or catch is computed based on exception and then the finally will close the resource and then the resource which is computed above will returned, please share your views that I m right or wrong. and one more query, that If there is no exception handling in some function of my code would i use try with finally is this is the good choice or try with catch with finally Posting some codes for the second and third situation. public Set&lt;&gt; processMessage(Object message) throws Exception { HtmlPage Page = null; try{ Page = getPage(); return inPage.getWebClient().getCookieManager().getCookies(); } finally { if(Page!=null) Page.cleanUp(); } } and In third situation If I have to return the HtmlPage which is processed inside the method like public HtmlPage simulate(HtmlElement element, MyContext context) { try{ HtmlPage Page = null; //getting the page here and suppose that there are various condition on the basis of this Page value is //evaluated and returned in some situation. return Page; } finally { if(Page!=null) Page.cleanUp(); } }
has comment: http://stackoverflow.com/comment/34366036
type: Question

http://stackoverflow.com/comment/34447342
has text: It's kind of an art, trying to decide how much information and code to post, and it is something you'll get better at with experience, but try to put yourself in our shoes, folks who don't have even the least clue as to your problem and your code, and try to see just what we might need to gain that clue, and then you'll know what we need.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22620807
score: 2

http://stackoverflow.com/a/22493292
upvote count: 7
answers question: http://stackoverflow.com/q/22493171
score: 7
type: AcceptedAnswer
downvote count: 0
has body: It seems to this code: private ScoreboardManager manager = Bukkit.getScoreboardManager(); private Scoreboard board = manager.getNewScoreboard(); The reason is that you're not declaring these variables inside of a method, so, they get loaded before your onEnable() method is called, making it so that you can't get anything using Bukkit as it Bukkit has not yet been initialized. What I recommend doing is doing something like this outside of any methods: private ScoreboardManager manager; private Scoreboard board; then doing this in your onEnable(): manager = Bukkit.getScoreboardManager(); board = manager.getNewScoreboard(); So you would have something like this: public class MainRush extends JavaPlugin implements Listener{ private ScoreboardManager manager; private Scoreboard board; @Override public void onEnable(){ //plugin enabled manager = Bukkit.getScoreboardManager(); board = manager.getNewScoreboard(); } } By doing this, you're eliminating the chance of getting a NullPointerException when your plugin is loaded. As a general rule of thumb, you should never get anything from bukkit outside of methods.
type: Answer
accepted answer of: http://stackoverflow.com/q/22493171

http://stackoverflow.com/comment/34495342
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22648079
has text: I reproduce the bug on MacOS X Mavericks. Output of `java -version`: java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
score: 1

http://stackoverflow.com/a/22503059
type: Answer
has body: This is where Spring makes use of CGLib. That isn't important - the point is that you should understand Spring is creating a proxy object that handing that instance to your clients. That proxy object, which Spring generates for you using CGLib, can either implement an abstract method, or override a concrete method. So it examines your class to work out if you are supplying a method that is marked abstract, or if you have supplied a method that is not marked abstract (and thus your method will be overridden). Proxies are used across quite a few containers. They are common at runtime in the Java Enterprise world too. Where your class may be subclassed by a runtime proxy, you will find you need to supply a no-args constructor (non-public is fine) if you also want a public constructor with arguments.
answers question: http://stackoverflow.com/q/22502854
score: 0
has comment: http://stackoverflow.com/comment/34238304

http://stackoverflow.com/comment/34426394
has text: @juanchopanza with the exception that your coding style actually uses or requires this (e.g. in a CAS loop). Not that this is good style, but it does force the problem this will catch.
comment on: http://stackoverflow.com/q/22609733
score: 0
type: Comment
type: QuestionComment

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/22578105
tags question: http://stackoverflow.com/q/22520088
tag name: bytecode-manipulation

arraylist
tags question: http://stackoverflow.com/q/22642870
tags question: http://stackoverflow.com/q/22566340
tags question: http://stackoverflow.com/q/22521848
tags question: http://stackoverflow.com/q/22495997
tags question: http://stackoverflow.com/q/22626216
tags question: http://stackoverflow.com/q/22549555
tags question: http://stackoverflow.com/q/22596022
tags question: http://stackoverflow.com/q/22546268
tags question: http://stackoverflow.com/q/22526593
tags question: http://stackoverflow.com/q/22607390
tags question: http://stackoverflow.com/q/22587381
tags question: http://stackoverflow.com/q/22610531
tags question: http://stackoverflow.com/q/22515814
tags question: http://stackoverflow.com/q/22623170
tags question: http://stackoverflow.com/q/22610728
tags question: http://stackoverflow.com/q/22583267
tags question: http://stackoverflow.com/q/22523717
tags question: http://stackoverflow.com/q/22610526
tags question: http://stackoverflow.com/q/22612490
tags question: http://stackoverflow.com/q/22519444
tags question: http://stackoverflow.com/q/22625821
tags question: http://stackoverflow.com/q/22518816
tags question: http://stackoverflow.com/q/22623983
tags question: http://stackoverflow.com/q/22555374
tags question: http://stackoverflow.com/q/22579024
tags question: http://stackoverflow.com/q/22558363
tags question: http://stackoverflow.com/q/22547753
tags question: http://stackoverflow.com/q/22593144
tags question: http://stackoverflow.com/q/22647895
tags question: http://stackoverflow.com/q/22571864
tags question: http://stackoverflow.com/q/22541340
tags question: http://stackoverflow.com/q/22503916
tags question: http://stackoverflow.com/q/22549024
tags question: http://stackoverflow.com/q/22607440
tags question: http://stackoverflow.com/q/22584655
tags question: http://stackoverflow.com/q/22535423
tags question: http://stackoverflow.com/q/22551333
tags question: http://stackoverflow.com/q/22493495
tags question: http://stackoverflow.com/q/22525742
tags question: http://stackoverflow.com/q/22554417
tags question: http://stackoverflow.com/q/22544818
tags question: http://stackoverflow.com/q/22604099
tags question: http://stackoverflow.com/q/22504805
tags question: http://stackoverflow.com/q/22538051
tags question: http://stackoverflow.com/q/22498935
tags question: http://stackoverflow.com/q/22538858
tags question: http://stackoverflow.com/q/22596357
tags question: http://stackoverflow.com/q/22613534
tags question: http://stackoverflow.com/q/22627082
tags question: http://stackoverflow.com/q/22583179
tags question: http://stackoverflow.com/q/22487945
tags question: http://stackoverflow.com/q/22594586
tags question: http://stackoverflow.com/q/22604975
tags question: http://stackoverflow.com/q/22517059
tags question: http://stackoverflow.com/q/22569027
tags question: http://stackoverflow.com/q/22629737
tags question: http://stackoverflow.com/q/22621248
tags question: http://stackoverflow.com/q/22556415
tags question: http://stackoverflow.com/q/22632826
tags question: http://stackoverflow.com/q/22619058
tags question: http://stackoverflow.com/q/22544834
tags question: http://stackoverflow.com/q/22610263
tags question: http://stackoverflow.com/q/22542725
tags question: http://stackoverflow.com/q/22606034
tags question: http://stackoverflow.com/q/22540075
tags question: http://stackoverflow.com/q/22593621
tags question: http://stackoverflow.com/q/22572984
tags question: http://stackoverflow.com/q/22511161
tags question: http://stackoverflow.com/q/22505114
tags question: http://stackoverflow.com/q/22586233
tags question: http://stackoverflow.com/q/22624694
tags question: http://stackoverflow.com/q/22561870
type: Tag
tags question: http://stackoverflow.com/q/22608213
tags question: http://stackoverflow.com/q/22521784
tags question: http://stackoverflow.com/q/22552592
tags question: http://stackoverflow.com/q/22532182
tags question: http://stackoverflow.com/q/22639421
tags question: http://stackoverflow.com/q/22491931
tags question: http://stackoverflow.com/q/22499512

http://stackoverflow.com/q/22619560
has answer: http://stackoverflow.com/a/22619737
accepted answer: http://stackoverflow.com/a/22619737
has comment: http://stackoverflow.com/comment/34444985
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34444813
has comment: http://stackoverflow.com/comment/34444717
tagged with: flowlayout
has body: Okay, so I'm having some trouble with my Programming Exercise today. The Exercise text goes like this: (Use the FlowLayout manager) Write a program that meets the following requirements: Create a frame and set its layout to FlowLayout Create two panels and add them to the frame Each panel contains three buttons. The panel uses FlowLayout The buttons should be named "Button 1", "Button 2" and so on. (i completed the original code) Now i needed to change my code into BorderLayout while moving 1 panel to south, and the other to the center, i tried but it doesn't seem to come out correctly. The buttons are just on the top and bottom. Original Code (FlowLayout): import javax.swing.*; import java.awt.*; public class lab5_1 extends JFrame { public lab5_1() { setLayout(new FlowLayout()); // Create two panels JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); // Add three buttons to each panel panel1.add(new JButton(" Button 1 ")); panel1.add(new JButton(" Button 2 ")); panel1.add(new JButton(" Button 3 ")); panel2.add(new JButton(" Button 4 ")); panel2.add(new JButton(" Button 5 ")); panel2.add(new JButton(" Button 6 ")); // Add panels to frame add(panel1); add(panel2); } public static void main(String[] args) { lab5_1 frame = new lab5_1(); frame.setTitle(" Exercise 12_1 "); frame.setSize(600,75); frame.setLocationRelativeTo(null); // center frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } My attempt at the BorderLayout: public class lab5_2 extends JFrame { public lab5_2() { setLayout(new BorderLayout()); // Create two panels JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); // Add three buttons to each panel panel1.add(new JButton(" Button 1 ")); panel1.add(new JButton(" Button 2 ")); panel1.add(new JButton(" Button 3 ")); panel2.add(new JButton(" Button 4 ")); panel2.add(new JButton(" Button 5 ")); panel2.add(new JButton(" Button 6 ")); //Add Panel to frame add(panel1, BorderLayout.CENTER); add(panel2, BorderLayout…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34444924
has title: Border and Flow Layouts
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/34444946
type: Question
has comment: http://stackoverflow.com/comment/34444832
tagged with: border-layout

http://stackoverflow.com/comment/50104248
score: 0
type: AnswerComment
type: Comment
has text: I've installed this, but how do I use it?
comment on: http://stackoverflow.com/a/30866415

http://stackoverflow.com/a/22495752
has comment: http://stackoverflow.com/comment/34224934
accepted answer of: http://stackoverflow.com/q/22495732
answers question: http://stackoverflow.com/q/22495732
score: 5
has comment: http://stackoverflow.com/comment/34225058
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34224873
has body: Either use List&lt;Point&gt; neighbors = ArrayList&lt;Point&gt;() or use an ArrayList&lt;YourClass&gt; where YourClass has two int fields.
upvote count: 5
has comment: http://stackoverflow.com/comment/34224845
type: Answer
downvote count: 0

http://stackoverflow.com/q/22641893
has answer: http://stackoverflow.com/a/22641945
duplicate of: http://stackoverflow.com/q/18893390
favorite count: 0
upvote count: 0
duplicate of: http://stackoverflow.com/q/2845835
linked to: http://stackoverflow.com/q/18893390
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1757065
downvote count: 1
has body: I need to tokenize this string. AddItem rt456 4 12 BOOK "File Structures" "Addison-Wesley" "Michael Folk" I need "AddItem","rt456","12","BOOK","File Structures","Addison-Wesley","Michael Folk" substrings. How i can get these tokens with using split()?
type: Question
duplicate of: http://stackoverflow.com/q/14654540
tagged with: tokenize
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/14654540
linked to: http://stackoverflow.com/q/2845835
has title: how to tokenize string with split() in java?
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/34484056
duplicate of: http://stackoverflow.com/q/1757065

http://stackoverflow.com/comment/34237056
has text: Wow that is nice, the picture hasn't the best quality then but it is working.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22502059
type: AnswerComment

http://stackoverflow.com/comment/34213366
type: Comment
type: QuestionComment
has text: great advise, I will do this.
score: 0
comment on: http://stackoverflow.com/q/22488982

http://stackoverflow.com/comment/34460176
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22628562
type: AnswerComment
has text: Why would someone have a class *inside* a method? Specially when it's not *anonymous*..

http://stackoverflow.com/comment/34676531
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22617395
has text: Got your point. I just have to change the application in order to retrieve the new column :-)
type: AnswerComment

http://stackoverflow.com/comment/34338462
type: AnswerComment
has text: @Biribu: the easiest way is to perform a "cold deploy" where you kill the tomcat entirely, then copy the new artifact and start tomcat. This is generally recommended for production deploys anyways. For development purposes though, you can keep doing hot deploys as you are now and only do a cold deploy when the process can't take the leak anymore (becomes super slow, dies because of aout of memory errors etc.)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22555050

http://stackoverflow.com/comment/34258637
has text: use lower-case names for Java variables please.
comment on: http://stackoverflow.com/q/22515293
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22567742
possible better answer: http://stackoverflow.com/a/22567999
has answer: http://stackoverflow.com/a/22568085
accepted answer: http://stackoverflow.com/a/22568085
has body: i have successfully place the string from file into array. Now i want to split the stringfrom array so that i can create search. here is the file text patter file.txt student ID : 1 student name: dell student id :2 student name:kelly my logic: 1) get the string from file and place in array, that is array[0] contains student ID : 1, a[1] contains student name : dell. 2)now split the current array into further arrays Now any one please tell me what should i do in order to make array data like this .... array[0] = student ID array[1] = 1 array[2] =dell array[3] = student ID array[4]= 2 array[5] = kelly . . . what should i do in my code??? BufferedReader br = new BufferedReader(new FileReader(new File("file.txt"))); String line = br.readLine(); List&lt;String&gt; list = new ArrayList&lt;String&gt;(); while(line != null) { list.add(line); // add lines in list line = br.readLine(); // read next line } // String[] stringArr= line.split(" : "); String [] stringArr= list.toArray(new String[0]); list.add(stringArr[0]); System.out.println(stringArr[1]); // System.out.print(stringArr[2]); }
has comment: http://stackoverflow.com/comment/34351003
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34351463
tagged with: java
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22567999
has comment: http://stackoverflow.com/comment/34351318
has answer: http://stackoverflow.com/a/22568111
has comment: http://stackoverflow.com/comment/34351280
has title: how to split string in array in java?

http://stackoverflow.com/a/30541653
has comment: http://stackoverflow.com/comment/126806244
has comment: http://stackoverflow.com/comment/126735494
has body: You need to set the boundary. Here there is a good explanations about what is the boundary https://stackoverflow.com/a/10932533/2762092 To solve your problem try this code. import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import org.apache.commons.lang.ArrayUtils; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockMultipartFile; import org.springframework.mock.web.MockMultipartHttpServletRequest; public class FileUploadTest { public void testDoPost() throws IOException { Path path = Paths.get("c:\\temp\\test.zip"); byte[] data = Files.readAllBytes(path); MockMultipartFile file = new MockMultipartFile("test.zip", "test.zip", "application/zip", data); MockMultipartHttpServletRequest mockRequest = new MockMultipartHttpServletRequest(); String boundary = "q1w2e3r4t5y6u7i8o9"; mockRequest.setContentType("multipart/form-data; boundary="+boundary); mockRequest.setContent(createFileContent(data,boundary,"application/zip","test.zip")); mockRequest.addFile(file); mockRequest.setMethod("POST"); mockRequest.setParameter("variant", "php"); mockRequest.setParameter("os", "mac"); mockRequest.setParameter("version", "3.4"); MockHttpServletResponse response = new MockHttpServletResponse(); new FileUpload().doPost(mockRequest, response); } public byte[] createFileContent(byte[] data, String boundary, String contentType, String fileName){ String start = "--" + boundary + "\r\n Content-Disposition: form-data; name=\"file\"; filename=\""+fileName+"\"\r\n" + "Content-type: "+contentType+"\r\n\r\n";; String end = "\r\n--" + boundary + "--"; // correction suggested @butfly return ArrayUtils.addAll(start.getBytes(),ArrayUtils.addAll(data,end.getBytes())); } }
upvote count: 22
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22642012
downvote count: 0
score: 22
answers question: http://stackoverflow.com/q/22642012
type: Answer

http://stackoverflow.com/comment/34407703
comment on: http://stackoverflow.com/a/22599071
type: AnswerComment
score: 0
type: Comment
has text: resultSet is the same as i from the loop so its always +1 and the loop will run as many times there are names in it.

http://stackoverflow.com/comment/34420946
comment on: http://stackoverflow.com/a/22605905
has text: Note that if you are interested I have implemented a `FileVisitor` which does recursive copying; I have successfully used it to create entire zip files from an existing directory
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34262672
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22517591
has text: YASEQ (Yet another string equality question)

http://stackoverflow.com/a/22551245
has comment: http://stackoverflow.com/comment/34323908
type: Answer
has comment: http://stackoverflow.com/comment/34324945
upvote count: 0
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/34324008
answers question: http://stackoverflow.com/q/22551173
has comment: http://stackoverflow.com/comment/34363324
has body: Since Dictionary class is already deprecated, you can have two options: Connect to an Word Library in the internet such as this http://www.dictionaryapi.com/ Download a complete list of words, host it in your local storage, read the file and store it in a Map. You can then check it if the word exists. Use Dictionary class to check if a word exists. As for removing duplicate characters, you want to remove 1 at a time then check if its in the dictionary class, else remove again.
has comment: http://stackoverflow.com/comment/34393244

http://stackoverflow.com/comment/34400241
type: QuestionComment
comment on: http://stackoverflow.com/q/22594826
score: 0
has text: The part that is not working is: okButton.addElement
type: Comment

http://stackoverflow.com/a/22611153
answers question: http://stackoverflow.com/q/22610768
type: Answer
score: 0
has body: Throws does not handle exception, It indicates the throwing exception upwards from where method will be called. In other words it will just pass exception to the caller. While try...catch block handles the exception, and that is why Java compiler will check if there is any exception to handle which is being caught in catch block or not. Those are two different thing, One is Throwing and another is Handling the exception and compiler will make his nose tilted on second one only...:p From the JavaDoc : Exception handlers can do more than just print error messages or halt the program. They can do error recovery, prompt the user to make a decision, or propagate the error up to a higher-level handler using chained exceptions. So, by providing try...catch implementation, you are requesting compiler to do some more thing than just printing exception. Another specific reason : public void testException() throws FileNotFoundException { File file = new File("test.txt"); System.out.println(file.exists()); Scanner scanner = new Scanner(file); } If you will observe the compiled code of above example by javap -c Test.class you will find an Exception table will be created. public static void testException(); Code: 0: new #2 // class java/io/File 3: dup 4: ldc #3 // String test.txt 6: invokespecial #4 // Method java/io/File."&lt;init&gt;":(Ljava/lang/String;)V 9: astore_0 10: getstatic #5 // Field java/lang/System.out:Ljava/io/PrintStream; 13: aload_0 14: invokevirtual #6 // Method java/io/File.exists:()Z 17: invokevirtual #7 // Method java/io/PrintStream.println:(Z)V 20: new #8 // class java/util/Scanner 23: dup 24: aload_0 25: invokespecial #9 // Method java/util/Scanner."&lt;init&gt;":(Ljava/io/File;)V 28: astore_1 29: goto 37 32: astore_1 33: aload_1 34: invokevirtual #11 // Method java/io/FileNotFoundException.printStackTrace:()V 37: return Exception table: from to target type 20 29 32 Class java/io/FileNotFoundException So, When compiler won't find any code that is not throwi…
has comment: http://stackoverflow.com/comment/34429679

http://stackoverflow.com/a/22555705
downvote count: 0
has comment: http://stackoverflow.com/comment/65363161
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22554470
has body: I tried to solve it with reflection in @Before annotated method, however, I didn't manage to get it working. Solution you found out can be improved by creating your own static factory that creates mocks with an OptionalAnswer and use it instead of default Mockito factory: class MockitoOptional{ public static &lt;T&gt; T mock(Class&lt;T&gt; classToMock) { return Mockito.mock(classToMock, new OptionalAnswer()); } } Next step will be to extend a test runner that will use this factory to inject mocks into @Mock annotated fields. Search for custom JUnit test runners if you haven't heard of them yet.
accepted answer of: http://stackoverflow.com/q/22554470
type: AcceptedAnswer

http://stackoverflow.com/a/22558780
has comment: http://stackoverflow.com/comment/34351558
accepted answer of: http://stackoverflow.com/q/22557937
type: AcceptedAnswer
has body: Here's an example of expression evaluation with Java's script API: ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("ECMAScript"); scriptEngine.put("b1", true); scriptEngine.put("b2", false); System.out.println(scriptEngine.eval("b1 || b2")); System.out.println(scriptEngine.eval("b1 &amp;&amp; b2")); When run, this code prints: true false
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22557937
upvote count: 1
score: 1

http://stackoverflow.com/comment/34390771
comment on: http://stackoverflow.com/q/22589528
score: 0
has text: @parsa porahmad can you show it in details?
type: Comment
type: QuestionComment

memory
tags question: http://stackoverflow.com/q/22626403
tags question: http://stackoverflow.com/q/22562391
tag name: memory
tags question: http://stackoverflow.com/q/22558993
tags question: http://stackoverflow.com/q/22555819
tags question: http://stackoverflow.com/q/22521080
tags question: http://stackoverflow.com/q/22523067
type: Tag
tags question: http://stackoverflow.com/q/22607743
tags question: http://stackoverflow.com/q/22489553
tags question: http://stackoverflow.com/q/22640870

http://stackoverflow.com/comment/34376828
type: Comment
type: QuestionComment
has text: Just tried it on Mavericks with IntelliJ IDEA. Works perfectly. Need more explanation on what's going on or its too localized.
comment on: http://stackoverflow.com/q/22581886
score: 0

http://stackoverflow.com/a/22521902
downvote count: 0
upvote count: 2
type: Answer
has body: You can use the Screen Image class. It will create a BufferedImage of your JPanel. The class also has code to write the image to a file.
score: 2
answers question: http://stackoverflow.com/q/22521884

http://stackoverflow.com/a/22571702
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22570921
has body: Code in an ActionListener executes on the Event Dispatch THread. The Thread.sleep(...) causes the EDT to sleep so the GUI can't repaint itself until the entire loop is finished executing. Read the section from the Swing tutorial on Concurrency for more information. Ones solution, as described in the tutorial, is to use a SwingWorker and then "publish" the results as required. Another approach is to use a Swing Timer to schedule the updates. The tutorial also has a section on How to Use Swing Timers.
has comment: http://stackoverflow.com/comment/34360629

http://stackoverflow.com/q/22521121
has answer: http://stackoverflow.com/a/22531239
tagged with: securitymanager
accepted answer: http://stackoverflow.com/a/22531239
tagged with: jvm
favorite count: 0
has title: Can I guarantee that my Java application will be executed with a Security Manager with a restrictive policy?
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has body: I will be distributing a stand alone Java application that will be installed on a public/shared computer. I want to secure the application as best I can from possible malicious/curious users. This means that I want the application to run in the context of a SecurityManager with a custom policy file. I know of two ways to run a Java application with a Security Manager. When launching the application specify the parameters -Djava.security.manager and -Djava.security.policy=someUrl. This approach seems to suffer from the following weaknesses: If someUrl refers to a location on the local machine an attacker could modify the policy file and effectively bypass the security sandbox. If an attacker can restart the application they could launch it without passing either of these parameters and run the application without a Security Manager and therefore bypass the security sandbox. If someUrl refers to a location on a remote machine and the remote machine is unaccessible when the application is launched then the application would (presumably) fail to launch. Inside the application execute the following code: System.setProperty("java.security.policy", "path/to/policy/file"); System.setSecurityManager(new SecurityManager()); This approach seems to suffer from the following weakness: Since the Security Manager is not started by the JVM prior to loading the application, an attacker could tamper with the class files in the application and bypass the security sandbox. Either way, it seems to me it is not possible to guarantee that a stand alone application will be run in the context of a Security Manager on a public/shared computer. Is my analysis wrong? Is it possible for an application developer to guarantee the application is run in a Security Manager, and guarantee that the policy file has not been tampered with, when the application is run on a public/shared computer?
answer count: 2
possible better answer: http://stackoverflow.com/a/22524340
has answer: http://stackoverflow.com/a/22524340
tagged with: security

http://stackoverflow.com/a/22511376
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22501220
answers question: http://stackoverflow.com/q/22501220
type: AcceptedAnswer
downvote count: 0
has body: Where does your class attempt to find the properties file? Using a relative path? The Server Start tab only applies to servers started with the node manager, not with the startWebLogic script. So if your application is running on the admin server, you probably need to edit the startWeblogic script itself to put the properties file on your classpath. A better option is to package the properties file directly in your .war/.ear. Reference the solution here: Java: Accessing properties file inside a war
type: Answer
has comment: http://stackoverflow.com/comment/34279239
score: 2

http://stackoverflow.com/q/22586896
has title: Linked List reference in Java
type: Question
answer count: 2
has body: If I have a ListNode Class, which is public class ListNode{ int data; ListNode nextNode; } and a List Class, which is public class List{ private ListNode firstNode; private ListNode lastNode; private String name; public List(String listName){ name = listName; firstNode = lastNode = null; } } what does the last statement "firstNode = lastNode = null" mean? Whether firstNode.data = null or firstNode.nextNode = null?
has answer: http://stackoverflow.com/a/22586906
accepted answer: http://stackoverflow.com/a/22586906
upvote count: 1
tagged with: reference
favorite count: 0
possible better answer: http://stackoverflow.com/a/22586918
has answer: http://stackoverflow.com/a/22586918
type: AnsweredQuestion
tagged with: linked-list
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/22592464
has title: OpenGL application, The Black Screen of Faliure
has comment: http://stackoverflow.com/comment/34400549
has comment: http://stackoverflow.com/comment/34400124
score: -1
tagged with: glsl
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/34397927
accepted answer: http://stackoverflow.com/a/22641646
downvote count: 1
has comment: http://stackoverflow.com/comment/34399410
type: AnsweredQuestion
tagged with: opengl
tagged with: java
has comment: http://stackoverflow.com/comment/34400575
type: Question
has comment: http://stackoverflow.com/comment/34395714
upvote count: 0
tagged with: matrix
answer count: 1
has answer: http://stackoverflow.com/a/22641646
favorite count: 0
has body: Without the perspective projection and view matrix my scene is fine: If i use the camera the result is weird: When i'm using the projection combined with view/camera matrix i always(even if move in every direction) get an empty screen or as i like to call it: the "Black Screen of Faliure". Here's the matrices i pass to the VS: Model Mat4: (model rotation on x-axis) 1.0 0.0 0.0 0.0 0.0 0.4888726 0.8723553 0.0 0.0 -0.8723553 0.4888726 0.0 0.0 0.0 0.0 1.0 View Mat4: (Camera slightly moved and rotated on y-axis) 0.94107544 0.0 0.33819667 -0.53266037 0.0 1.0 0.0 0.0 -0.33819667 0.0 0.94107544 2.4321942 0.0 0.0 0.0 1.0 Projection Mat4: 1.299038 0.0 0.0 0.0 0.0 1.7320509 0.0 0.0 0.0 0.0 1.002002 -2.002002 0.0 0.0 1.0 0.0 perspective proj calculation: thf=tan(torad(60)/2); ar=800/600; zn=1; zf=1000; 1/(thf*ar) 0 0 0 0 1/thf 0 0 0 0 (-zn-zf)/(zn-zf) 2*zn*zf/(zn-zf) 0 0 1 0 My Vertex Shader: #version 330 attribute layout(location = 0) vec3 Position; attribute layout(location = 1) vec3 TexCoord; attribute layout(location = 2) vec3 Normal; out vec3 TexCoords; uniform mat4 Model; uniform mat4 View; uniform mat4 Projection; void main(){ gl_Position = Projection * View * Model * vec4(Position, 1); TexCoords=TexCoord; }

http://stackoverflow.com/q/22525002
downvote count: 1
type: Question
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/22525382
upvote count: 0
has comment: http://stackoverflow.com/comment/34275871
tagged with: paintcomponent
has answer: http://stackoverflow.com/a/22525038
favorite count: 0
has body: This is the code i tried to use to paint an image on screen (location of the image is correct), the code runs but nothing is drawn on the screen. My program's getFile() and paintComponent() method: BufferedImage image; public void getFile() throws IOException{ image = ImageIO.read(new File("grass.png")); } protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, 0, 0, null); } }
possible better answer: http://stackoverflow.com/a/22525134
has answer: http://stackoverflow.com/a/22525134
type: AnsweredQuestion
tagged with: java
has title: Image not drawn in JPanel
accepted answer: http://stackoverflow.com/a/22525038

http://stackoverflow.com/q/22631474
tagged with: java
has answer: http://stackoverflow.com/a/22631910
has comment: http://stackoverflow.com/comment/34465583
linked to: http://stackoverflow.com/q/3058434
has comment: http://stackoverflow.com/comment/34466219
type: Question
answer count: 2
tagged with: xml-parsing
downvote count: 0
has title: Java IO cannot find existing file from URL
has comment: http://stackoverflow.com/comment/34465223
possible better answer: http://stackoverflow.com/a/22631910
favorite count: 0
has body: I have a weird problem, i have to parse XML file to get data, when I parse file: http://www.nbp.pl/kursy/xml/c073z070413.xml, all works ok (file is parsed), but when I try parse file : http://www.nbp.pl/kursy/xml/a002z020103.xml then I get a message that program cant find this file (In browser, the XML file works) Exception: java.io.FileNotFoundException: C:\Projects\AreYouSmart\abch.dtd (Could not found file) Below is a full example code. (Code is taken from StackOverflow: XML parse file from HTTP) public class TylkoPobieranie { public static void main(String[] args) { try { new TylkoPobieranie().start(); } catch (Exception e) { e.printStackTrace(); } } private void start() throws Exception { // link work: URL url = new URL("http://www.nbp.pl/kursy/xml/c073z070413.xml"); URL url = new URL("http://www.nbp.pl/kursy/xml/a002z020103.xml"); URLConnection connection = url.openConnection(); Document doc = parseXML(connection.getInputStream()); NodeList descNodes = doc.getElementsByTagName("pozycja"); for (int i = 0; i &lt; descNodes.getLength(); i++) { System.out.println(descNodes.item(i).getTextContent()); } } private Document parseXML(InputStream stream) throws Exception { DocumentBuilderFactory objDocumentBuilderFactory = null; DocumentBuilder objDocumentBuilder = null; Document doc = null; try { objDocumentBuilderFactory = DocumentBuilderFactory.newInstance(); //ANSWER: objDocumentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); objDocumentBuilder = objDocumentBuilderFactory.newDocumentBuilder(); doc = objDocumentBuilder.parse(stream); } catch (Exception ex) { throw ex; } return doc; } }
upvote count: 2
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/155101
has answer: http://stackoverflow.com/a/22631712
accepted answer: http://stackoverflow.com/a/22631712

http://stackoverflow.com/a/22528645
has comment: http://stackoverflow.com/comment/34282080
answers question: http://stackoverflow.com/q/22528373
downvote count: 0
has body: Delete the interface Operation as this is just a DoubleBinaryOperator public enum Operations { POWER("^", Math::pow), MULTIPLICATION("*", (a, b) -&gt; a * b); private String op; private DoubleBinaryOperator calc; Operations(String op, DoubleBinaryOperator calc) { this.op = op; this.calc = calc; } } You can use a method reference for Math.pow as this already follows the required signature.
has comment: http://stackoverflow.com/comment/34282082
type: Answer
has comment: http://stackoverflow.com/comment/34281865
upvote count: 3
has comment: http://stackoverflow.com/comment/34282006
score: 3

http://stackoverflow.com/comment/34370882
comment on: http://stackoverflow.com/q/22578619
type: Comment
type: QuestionComment
has text: You should describe better the error. What class is not found in ClassNotFoundException?
score: 0

http://stackoverflow.com/q/22542731
tagged with: java
has body: I have a string Speed is what defines us. The adrenaline starts pumping when you put your foot through the pedal and shift into top gear. It may not be viable to do the same on the road outside, but why limit the desire when the virtual world comes calling? Give birth to the speedster which lay dormant in you and leave your competition abarf. Game Version Need For Speed Most Wanted v1.3 English version. General Rules 1st Round will be a time trial where every player will be given 2 laps of Campus Way. I want to parse this string and display the styled text in a textView without the tags. i have used txtDisply.setText(Html.fromHtml(myString)) but this displays the text as it is i.e tags included.It does not style the text. help!!
has comment: http://stackoverflow.com/comment/34308228
has comment: http://stackoverflow.com/comment/34308157
downvote count: 0
has comment: http://stackoverflow.com/comment/34307741
tagged with: android
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
has title: Displaying HTML content inside a TextView without its tags
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/34320303
type: Question
score: 1

http://stackoverflow.com/a/22584512
score: 3
downvote count: 0
has body: The simplest way to describe the "Java compiler compliance" setting is that it determines which Java Virtual Machine instructions may be used in the "compiled" Java code ... and which library class versions are to be used. Each release of the JVM (and its libraries) may introduce new instructions (the VM) or adjust the class libraries that are delivered along with the JVM. You should set the setting to the lowest level of JVM that you expect your product to be run on.
answers question: http://stackoverflow.com/q/22584427
upvote count: 3
type: Answer

http://stackoverflow.com/q/22566283
has body: I'm doing a chess game and I need to make a log table that prints every move. The LogTable class is like this: public class LogTable { private DefaultTableModel model; private JTable table; public LogTable(JPanel panel){ String[] columnNames = {"Move No.", "White", "Black"}; model = new DefaultTableModel(columnNames, 0); table = new JTable(); //model.isCellEditable(i, i1) table.setModel(model); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true); //Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); panel.add(scrollPane); } public void newMove(chessPiece piece){ if (piece.getColor() == 0){ Object[] newRow = new Object[3]; newRow[0] = model.getRowCount()+1; newRow[1] = piece.sayPos(); newRow[2] = " "; model.addRow(newRow); } else { model.setValueAt(piece.sayPos(), model.getRowCount(), model.getColumnCount()); } } } But in the first black move it thows an ArrayOutOfBoundsException. The newMove function is called at the chessPiece class: public void move(int newX, int newY, JPanelSquare jPanelSquareGrid[][], LogTable logTable){ resetShowValidMoves(jPanelSquareGrid); logTable.newMove(this); } The rest of the move code is in each piece, which call super. I'm using the DefaultTableModel.
has answer: http://stackoverflow.com/a/22566542
tagged with: jtable
has title: java - JTable setValueAt not working
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22566542
type: Question
tagged with: netbeans
upvote count: 2
tagged with: java
tagged with: indexoutofboundsexception
tagged with: swing
answer count: 1

http://stackoverflow.com/a/22547378
has comment: http://stackoverflow.com/comment/34378380
upvote count: 2
answers question: http://stackoverflow.com/q/22547351
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34379850
has comment: http://stackoverflow.com/comment/34389276
has comment: http://stackoverflow.com/comment/34345502
has comment: http://stackoverflow.com/comment/34329293
has body: ImmutableTable will maintain insertion order, like all the other immutable collections.
has comment: http://stackoverflow.com/comment/34367356

http://stackoverflow.com/comment/34236840
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22503112
has text: I tried it for Bangalore.. and I think its good enough example of test case.. the latitude, longitude and city name are returned by it.. only postal is the problem for me.

http://stackoverflow.com/a/22609138
has body: I found some information about loading java agents in this interesting blog post. Instrumentation Agent To enable JVM instrumentation, you have to provide an agent (or more) that is deployed as a JAR file. An attribute in the JAR file manifest specifies the agent class which will be loaded to start the agent. There is 2 ways to load the agent: with a command-line interface: by adding this option to the command-line: -javaagent:jarpath[=options] where jarpath is the path to the agent JAR file. options is the agent options. This switch may be used multiple times on the same command-line, thus creating multiple agents. More than one agent may use the same jarpath. by dynamic loading: the JVM must implement a mechanism to start agents sometime after the the VM has started. That way, a tool can "attach" an agent to a running JVM (for instance profilers or ByteMan) After the JVM has initialized, the agent class will be loaded by the system class loader. If the class loader fails to load the agent, the JVM will abort. ... Yes official documentation/specification would be more than welcome... Edit 1: At last I came across some relevant and official documentation: API Javadoc for dynamically loading an agent as described in second bullet point above: see here for VirtualMachine class and here for loadAgent method. Edit 2: Also see this other blog post. It explains clearly the difference between static loading of a javaagent at startup and dynamic loading of a javaagent at runtime.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22580352
accepted answer of: http://stackoverflow.com/q/22580352

http://stackoverflow.com/comment/34217460
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22490485
has text: @WouterJ Actually, I think it _does_ attempt to answer the question
type: AnswerComment

http://stackoverflow.com/a/22491201
answers question: http://stackoverflow.com/q/22491108
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: String.format(String format, Object... args) is likely what you're after. (Assuming the scores are ints) String.format("%-10s%-10s%4d%4d%4d%6.2f", fname, lname, score1, score2, score3, ((double)(score1 + score2 + score3) / 3))

http://stackoverflow.com/q/22546938
type: AnsweredQuestion
tagged with: java
tagged with: sharedpreferences
type: Question
has answer: http://stackoverflow.com/a/22549795
answer count: 1
accepted answer: http://stackoverflow.com/a/22549795
score: 0
tagged with: android
has title: Sharedpreferences Android listener
has body: I have lookd around but i just don't seem to understand on how to implement a sharedpreference listener. My code is: public class MusicPlayer extends Activity implements OnCompletionListener { public static SharedPreferences settings; @Override protected void onCreate(Bundle savedInstanceState) { ... AndroidBuildingMusicPlayerActivity.settings = getPreferences(MODE_PRIVATE); ..... } public void onPreferenceChangeListener(SharedPreferences sharedPreferences, String key) { //Do something here } what i am trying to do is somewhere else if something is triggered the sharedpreference key stays the same but the value changes and i need this value For some reason my listener never actually calls. i have tried some other ways but i think i might be doing it wrong. any suggestions on how i can get a listener to work or does anyone know what the problem is? any help would be great thanks ps. im not extending PreferenceActivity that should cause a problem right? i tried that but my program then just crashes

http://stackoverflow.com/q/22558284
type: UnansweredQuestion
has body: So I have been attempting to create a little game of "frogger" only I used a trainer instead of a Frog and Pokemon instead of cars. Pretty simple. So far I have everything moving and resetting according to plan, but the problem arises when I try determine overlap for the trainer and the pokemon. At the moment I have coding which gets the X and Y coordinates of each and if they equal one another then the trainer resets to the beginning. Obviously I realize this means that the trainer only resets if the X and Y are both exactly the same, despite whether or not they are overlapping. So I tried to make it so that if the trainer were within a range of the get.X() and get.Y() , but that did not work. Any help/suggestions would be greatly appreciated. I'm not all that smart when it comes to programming, I just do it as a hobby, so please keep the terminology as simple as possible :P Thread t = new Thread(new MainLoop()); t.start(); } private class MyKeyListener extends KeyAdapter{ public void keyPressed(KeyEvent e){ switch (e.getKeyCode()){ case KeyEvent.VK_LEFT: leftKey = true; break; case KeyEvent.VK_RIGHT: rightKey = true; break; case KeyEvent.VK_UP: upKey = true; break; case KeyEvent.VK_DOWN: downKey = true; break; } } public void keyReleased(KeyEvent e){ switch (e.getKeyCode()){ case KeyEvent.VK_LEFT: leftKey = false; break; case KeyEvent.VK_RIGHT: rightKey = false; break; case KeyEvent.VK_UP: upKey = false; break; case KeyEvent.VK_DOWN: downKey = false; break; } } } public class MainLoop implements Runnable{ public MainLoop(){ } public void run(){ while(true){ if(upKey){ trainer.moveUp(); pikachu.run(); squirtle.run(); golbat.run(); snivy.run(); snorlax.run(); bulbasaur.run(); jolteon.run(); espeon.run(); charmander.run(); sableye.run(); gardevoir.run(); manectric.run();} if(downKey){ trainer.moveDown(); pikachu.run(); squirtle.run(); golbat.run(); snivy.run(); snorlax.run(); bulbasaur.run(); jolteon.run(); espeon.run(); charmander.run(); sableye.run(); gardevoir.run…
tagged with: overlap
has answer: http://stackoverflow.com/a/22560006
type: Question
tagged with: java
tagged with: eclipse
tagged with: image
score: 0
answer count: 1
has title: How to determine image overlap through range of X's and Y's in Java

http://stackoverflow.com/q/22565684
has title: Splitting an array at multiple points using an index point
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22566184
has answer: http://stackoverflow.com/a/22566873
score: 0
has answer: http://stackoverflow.com/a/22566184
tagged with: random
has answer: http://stackoverflow.com/a/22566419
has comment: http://stackoverflow.com/comment/34347109
has answer: http://stackoverflow.com/a/22566446
has comment: http://stackoverflow.com/comment/34347436
accepted answer: http://stackoverflow.com/a/22566446
has body: I have come across many examples to split the given array or array list into two arrays or multiple arrays using an index point. I tried them and they are working perfectly. My question is, is it possible to split the array into multiple arrays of varying chunk size given the index point? For example: array[] = {10,1,2,3,10,4,5,10,6,7,10,8,10}; index_value = 10; Then the output should be four arrays such as: arr1[] = {1,2,3} arr2[] = {4,5} arr3[] = {6,7} arr4[] = {8} I was able to split them and display the results when the given array is static with no changes. But implementing the same for an array with random numbers and random size was hard. I need to store the split values in many sub arrays and not just printing the values.
answer count: 4
type: AnsweredQuestion
tagged with: numbers
tagged with: java
has comment: http://stackoverflow.com/comment/34347084
type: Question
has comment: http://stackoverflow.com/comment/34347489

http://stackoverflow.com/q/22614729
has answer: http://stackoverflow.com/a/22614950
has title: Copying array contents to a new array
linked to: http://stackoverflow.com/q/8299771
answer count: 5
type: UnansweredQuestion
has body: I am trying to write a method called reallocate, which takes an array called theDirectory, and copies it's contents over into a new array named newDirectory, which has twice the capacity. Then theDirectory is set to newDirectory. This is what I have so far, however I am stuck on how to copy content across to newDirectory, so any help would be much appreciated. private void reallocate() { capacity = capacity * 2; DirectoryEntry[] newDirectory = new DirectoryEntry[capacity]; //copy contents of theDirectory to newDirectory theDirectory = newDirectory; } Thanks in advance.
tagged with: java
has answer: http://stackoverflow.com/a/22614819
has answer: http://stackoverflow.com/a/22614792
has answer: http://stackoverflow.com/a/22614831
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/22614805
has comment: http://stackoverflow.com/comment/34435538
has comment: http://stackoverflow.com/comment/92749531
tagged with: copy
score: 0

http://stackoverflow.com/q/22522379
tagged with: netbeans
upvote count: 2
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/34272606
has comment: http://stackoverflow.com/comment/34272402
has body: When I want to start my jboss AS 7 server, it took very long to get started. I am using netbeans 7.4 and how actually this jboss AS 7 functioning? should I start the server from the standalone.bat file? or from the netbeans? 10:34:15,303 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA 10:34:15,422 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA 10:34:15,456 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting it will come up like the above, whenever i start my Jboss AS 7 Server. It is normal but then it take really long time.I dont know when it will started :wondering:
has comment: http://stackoverflow.com/comment/34272243
type: UnansweredQuestion
tagged with: jboss
score: 2
downvote count: 0
favorite count: 0
has title: Jboss as 7 took very long to get started
has comment: http://stackoverflow.com/comment/34414642
type: Question
has answer: http://stackoverflow.com/a/22621932

http://stackoverflow.com/a/22596707
has comment: http://stackoverflow.com/comment/34403923
has comment: http://stackoverflow.com/comment/34405873
has comment: http://stackoverflow.com/comment/34403843
has comment: http://stackoverflow.com/comment/34403970
has comment: http://stackoverflow.com/comment/34403557
upvote count: 24
accepted answer of: http://stackoverflow.com/q/22596495
has body: Was rather suprised to see that it is using bitfields rather than EnumSet. The rational though is discussed in this mailing list thread. It seems like the reason was to be able to set and unset various characteristics without affecting the one on the caller end. With an EnumSet, to implement this, one would need to create a new EnumSet object every time there is a need to change it in different stages. I guess this is the reason why bit fields wins the race there. The concluding sentence of that thread essentially anticipates your question here: The presence of such flags in a Java 8 API would (and should) raise a lot of eyebrows, because it goes against what people have been told for well over a decade. If it's adopted as is, there had better be a good explanation for doc readers of why alternatives were rejected. "We were comfortable with int flags and nothing else significantly better suggested itself" won't cut it. "We know int flags aren't great for an API, but we tried very hard to find better alternatives, to no avail" would (if it were true).
score: 24
has comment: http://stackoverflow.com/comment/34403535
answers question: http://stackoverflow.com/q/22596495
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34403910
type: Answer

http://stackoverflow.com/comment/34332869
score: 0
comment on: http://stackoverflow.com/q/22557897
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/1263991/connecting-remote-tomcat-jmx-instance-using-jconsole

http://stackoverflow.com/a/22606715
upvote count: 45
downvote count: 0
has body: Bug – Fixed in Java 9 This issue was already reported in JDK-bug-log. Stephen Colebourne mentions as work-around following solution: DateTimeFormatter dtf = new DateTimeFormatterBuilder() .appendPattern("yyyyMMddHHmmss") .appendValue(ChronoField.MILLI_OF_SECOND, 3) .toFormatter(); Note: This workaround does not cover your use-case of only two pattern symbols SS. An adjustment might only be to use other fields like MICRO_OF_SECOND (6 times SSSSSS) or NANO_OF_SECOND (9 times SSSSSSSSS). For two fraction digits see my update below. @PeterLawrey About the meaning of pattern symbol "S" see this documentation: Fraction: Outputs the nano-of-second field as a fraction-of-second. The nano-of-second value has nine digits, thus the count of pattern letters is from 1 to 9. If it is less than 9, then the nano-of-second value is truncated, with only the most significant digits being output. When parsing in strict mode, the number of parsed digits must match the count of pattern letters. When parsing in lenient mode, the number of parsed digits must be at least the count of pattern letters, up to 9 digits. So we see that S stands for any fraction of second (including nanosecond), not just milliseconds. Furthermore, the fractional part does at the moment not take well in adjacent value parsing, unfortunately. EDIT: As background here some remarks about adjacent value parsing. As long as fields are separated by literals like a decimal point or time part separators (colon), the interpretation of fields in a text to be parsed is not difficult because the parser then knows easily when to stop i.e. when the field part is ended and when the next field starts. Therefore the JSR-310 parser can process the text sequence if you specify a decimal point. But if you have a sequence of adjacent digits spanning over multiple fields then some implementation difficulties arise. In order to let the parser know when a field stops in text it is necessary to instruct the parser in advance that a given …
accepted answer of: http://stackoverflow.com/q/22588051
answers question: http://stackoverflow.com/q/22588051
score: 45
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/114423352
has comment: http://stackoverflow.com/comment/114444342
type: Answer

http://stackoverflow.com/comment/34415163
type: QuestionComment
has text: @sᴜʀᴇsʜᴀᴛᴛᴀ Hmm.. then its wrong design.
type: Comment
comment on: http://stackoverflow.com/q/22603164
score: 0

http://stackoverflow.com/comment/34436534
has text: @Jason Aller, thanks for correcting my text :-)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22612837

http://stackoverflow.com/comment/34438800
type: QuestionComment
has text: @libik The question is what's requiring those versions.
comment on: http://stackoverflow.com/q/22616526
score: 0
type: Comment

serialization
tags question: http://stackoverflow.com/q/22584243
tags question: http://stackoverflow.com/q/22508869
tags question: http://stackoverflow.com/q/22608162
tags question: http://stackoverflow.com/q/22541955
tags question: http://stackoverflow.com/q/22580523
tags question: http://stackoverflow.com/q/22574105
tags question: http://stackoverflow.com/q/22488402
tags question: http://stackoverflow.com/q/22634268
tags question: http://stackoverflow.com/q/22524570
tag name: serialization
tags question: http://stackoverflow.com/q/22578619
type: Tag
tags question: http://stackoverflow.com/q/22504805
tags question: http://stackoverflow.com/q/22617072
tags question: http://stackoverflow.com/q/22498935
tags question: http://stackoverflow.com/q/22621775
tags question: http://stackoverflow.com/q/22537957
tags question: http://stackoverflow.com/q/22628581
tags question: http://stackoverflow.com/q/22625305
tags question: http://stackoverflow.com/q/22531601
tags question: http://stackoverflow.com/q/22643367
tags question: http://stackoverflow.com/q/22621535

http://stackoverflow.com/q/22547331
downvote count: 0
tagged with: graphics2d
favorite count: 0
has body: The problem is that the font is constantly loading itself, and I'm wondering if there is a better work around.... I am making a simple java game and I have this code in order to draw all the objects to the frame: public void paint(Graphics g){ super.paint(g); Graphics2D g2d = (Graphics2D) g; Font font = null; try { font = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(new File("Font/Blocks.ttf"))).deriveFont(Font.PLAIN, 24); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (FontFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } g2d.setFont(font); //Drawing Strings g2d.setColor(Color.MAGENTA); g2d.drawString("Y CORD:" + PlayerDefine.getY(), 5, 445); g2d.drawString("X CORD:" + PlayerDefine.getX(), 5, 460); Now I am getting the font to load, which is what I want, but I am seeing that every single time the frame refreshes (I have the main Timer set to 10ms) it is loading the font over and over and over again. I was wondering if there was a way to avoid this, i.e. make the font load when the game starts and it continue to use it until the window is closed. Thanks to anybody who can respond to this!
tagged with: fonts
has answer: http://stackoverflow.com/a/22547397
has comment: http://stackoverflow.com/comment/34315997
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: draw
tagged with: try-catch
accepted answer: http://stackoverflow.com/a/22547397
has title: Any way to avoid repeatedly loading fonts in JAVA with Graphics2D?
answer count: 1

http://stackoverflow.com/comment/34342472
type: Comment
has text: Thanks a lot! I took your advice and made all the changes to my code. After writing revalidate() into my code, the problem I mentioned was gone. If I may, I have one more question. I understand now that java swing is not thread safe for the most part and therefore I should always run it on EDT. I did some search and it seemed like many people use invokeLater() or invokeAndWait() to queue an event to EDT. Is this what you are suggesting me to do? Is there any better way to launch it within EDT?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22550938

http://stackoverflow.com/a/22576465
accepted answer of: http://stackoverflow.com/q/22576409
type: Answer
has body: As i understand your comments you want to display the right message for your exception: try { // some code } catch (NumberFormatException e) { System.out.println(e.getMessage()); }
score: 0
answers question: http://stackoverflow.com/q/22576409
type: AcceptedAnswer

http://stackoverflow.com/comment/34292828
comment on: http://stackoverflow.com/a/22532174
score: 0
type: AnswerComment
has text: @JoseLuisMartin solved, I put the Transactional on my service layer, and it works! Please post this as a solution, I'll accept it as the correct answer.
type: Comment

http://stackoverflow.com/q/22646102
has title: How to update an array item in MongoDB with two "where" condition using java driver
has comment: http://stackoverflow.com/comment/34492575
accepted answer: http://stackoverflow.com/a/22647343
tagged with: mongodb-java
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34492913
upvote count: 2
score: 2
tagged with: nosql
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22647513
has answer: http://stackoverflow.com/a/22647513
has answer: http://stackoverflow.com/a/22647343
tagged with: java
type: Question
tagged with: mongodb
answer count: 2
has body: I have a collection called "XX" and in this collection I have several documents. I am matching on the field "userEmail". This is the structure of the document: { "_id" : { "$oid" : "5331e4e313163623bb649249"} , "userEmail" : "user3@this.com"} "reservations" : [ { "idRest" : "23" , "userPhone" : "88888888" , "date" : "03-13-2015" , "hour" : "14:30" }, { "idRest" : "24" , "userPhone" : "88888888" , "date" : "03-13-2015" , "hour" : "17:30" }, { "idRest" : "22" , "userPhone" : "88888888" , "date" : "03-13-2015" , "hour" : "16:30" }] } And now I need find the document where "userEmail" = "some@some.com" and update the fields of the array where "idRest" = 24. in this case: { "idRest" : "24" , "userPhone" : "88888888" , "date" : "03-13-2015" , "hour" : "17:30" }, Can you help me please to build the query using JAVA driver :) thanks in advance!! EDIT: this is my code, but instead of update the fields add a new sub document ` DBCollection collReservationByUser = db.getCollection(usersReservationCollection); DBObject queryx = new BasicDBObject("userEmail", rest.getEmailUser()); BasicDBObject document1 = new BasicDBObject(); document1.put("idRest", rest.getEmailUser()); document1.put("userPhone", rest.getPhoneUser()); document1.put("date", rest.getFecha()); document1.put("hour", rest.getHora());; DBObject update1 = new BasicDBObject(); update1.put("$push", new BasicDBObject("reservations", document1)); collReservationByUser.update(queryx, update1, true, true);`

http://stackoverflow.com/comment/34347570
has text: No domain.xml? Maybe you never created a new domain, check out... https://blogs.oracle.com/alexismp/entry/corrupted_domain_xml the default domain.xml will have localhost
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22540167

http://stackoverflow.com/comment/34373219
has text: `if(list[i] != null)` ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22580124
score: 3

http://stackoverflow.com/a/22571326
has body: In my opinion very suitable would be a Visitor pattern http://en.wikipedia.org/wiki/Visitor_pattern There are two basic interfaces: public interface Visitable { void accept(Visitor visitor); } public interface Visitor { void visit(Mini mini); void visit(Sedan sedan); } Example implementations of Visitable could look like this (note the accept methods): public class Mini extends Car implements Visitable { private int miniSafetyCageCondition; public Mini(int breaksCondition, int miniSafetyCageCondition) { super(breaksCondition); this.miniSafetyCageCondition = miniSafetyCageCondition; } @Override public void accept(Visitor visitor) { visitor.visit(this); } public int getMiniSafetyCageCondition() { return miniSafetyCageCondition; } } public class Sedan extends Car implements Visitable { private final boolean frontAirbagsPresent; private final boolean sideAirbagsPresent; public Sedan(int breaksCondition, boolean frontAirbagsPresence, boolean sideAirbagsPresent) { super(breaksCondition); this.frontAirbagsPresent = frontAirbagsPresence; this.sideAirbagsPresent = sideAirbagsPresent; } @Override public void accept(Visitor visitor) { visitor.visit(this); } public boolean isSideAirbagsPresent() { return sideAirbagsPresent; } public boolean isFrontAirbagsPresent() { return frontAirbagsPresent; } } public class Car { private final int breaksCondition; public Car(int breaksCondition) { this.breaksCondition = breaksCondition; } public int getBreaksCondition() { return breaksCondition; } } And this could be example implementation of Visitor (note the visit methods): public class SafetyVisitor implements Visitor { private boolean result; private CarBasicCheck carBasicCheck = new CarBasicCheck(); private MiniSpecificCheck miniSpecificCheck = new MiniSpecificCheck(); private SedanSpecificCheck sedanSpecificCheck = new SedanSpecificCheck(); @Override public void visit(Mini mini) { result = carBasicCheck.hasWorkingBreaks(mini) &amp;&amp; miniSpecificCheck.hasDurableSafetyCage(mini); } @…
score: 0
has comment: http://stackoverflow.com/comment/34358937
type: Answer
answers question: http://stackoverflow.com/q/22570887
has comment: http://stackoverflow.com/comment/34359643

http://stackoverflow.com/comment/34476365
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22624917
has text: EJP, even if the server is misconfigured I need to send the creds with the initial GET request. Surely there must be a way to do it with the client side code. Thanks!

http://stackoverflow.com/comment/34249581
comment on: http://stackoverflow.com/q/22510098
score: 0
has text: That's not a MySQL native query, it's a JPA query.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34333686
comment on: http://stackoverflow.com/a/22557512
has text: Andrei I. is right you cannot map interfaces to DB.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/34304156
type: QuestionComment
has text: What *exactly* is the problem you are having?
comment on: http://stackoverflow.com/q/22540990
score: 0
type: Comment

http://stackoverflow.com/q/22582607
answer count: 1
tagged with: jar
has body: I've got the SWT file ".jar" added on to my project as an external jar. So it's imported into my project and I can call it's method via: import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; There are no import errors when I do this so I suspect everything is working accordingly. However, when I export this as a ".jar" and use it, there are errors saying that the "org.eclipse.swt.[etc]..." don't exist. I'm trying to make a Bukkit plugin that uses a GUI (SWT) and I have no idea why this isn't working - any suggestions?
has answer: http://stackoverflow.com/a/22582715
type: UnansweredQuestion
tagged with: java
tagged with: bukkit
tagged with: eclipse
type: Question
has title: Eclipse SWT - exported .jar fails to import methods
score: 0

http://stackoverflow.com/comment/34286713
type: Comment
has text: Have you expanded the JAR (with dependencies) and manually checked that all the required JARS are in the correct place?
type: QuestionComment
comment on: http://stackoverflow.com/q/22530885
score: 0

http://stackoverflow.com/comment/34229553
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22498140
has text: `at sun.nio.fs.WindowsFileSystem.<init>(WindowsFileSystem.java:61)` <-- uh, it is certainly not the `URL` class showing that message; more code, please

http://stackoverflow.com/comment/34478643
comment on: http://stackoverflow.com/q/22638991
type: QuestionComment
has text: Isn't there any one who can help?
score: 0
type: Comment

http://stackoverflow.com/a/23387169
score: 0
answers question: http://stackoverflow.com/q/22610652
type: Answer
has body: In your configuration file AplicationContext.xml &lt;context:component-scan base-package="com.mypackage.bean" /&gt; Need to put the annotation "@Controller" on your Bean @Controller @ManagedBean(name="cadastroUsuarioMB") @SessionScoped public class CadastroUsuarioBean { @Autowired UsuarioService usuarioService; private Usuario usuario = new Usuario(); public String salvar() { //Error !!! usuarioService is null ! usuarioService.retornaUsuarioPorLogin(usuario.getEmail(), usuario.getSenha()); JsfUtil.addSuccessMessage(null, usuario.getCelular()); return ""; } }

http://stackoverflow.com/q/22584420
score: 0
answer count: 2
tagged with: android-asynctask
has title: gcm returns service not available
type: UnansweredQuestion
tagged with: android
tagged with: google-cloud-messaging
has body: I have this code. I enter the project key from the Google console as the snederId and get an error: service not available. which steps would you recommend for me to double check in setting up the registration key? private void registerInBackground() { new AsyncTask&lt;Void, Void, String&gt;() { @Override protected String doInBackground(Void... params) { String msg = ""; try { if (gcm == null) { gcm = GoogleCloudMessaging.getInstance(context); } regId = gcm.register(SENDER_ID); msg = "Device registered, registration ID=" + regId; // You should send the registration ID to your server over // HTTP, so it // can use GCM/HTTP or CCS to send messages to your app. sendRegistrationIdToBackend(); saveRegIdToDb(); // For this demo: we don't need to send it because the // device will send // upstream messages to a server that echo back the message // using the // 'from' address in the message. // Persist the regID - no need to register again. storeRegistrationId(context, regId); } catch (IOException ex) { msg = "Error :" + ex.getMessage(); // If there is an error, don't just keep trying to register. // Require the user to click a button again, or perform // exponential back-off. } return msg; } @Override protected void onPostExecute(String msg) { // mDisplay.append(msg + "\n"); } }.execute(null, null, null); }
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22631274
has answer: http://stackoverflow.com/a/22630786

http://stackoverflow.com/q/22492277
has title: What is the relationship between MS-Outlook PST file and MS-Outlook MSG File?
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22492394
type: Question
tagged with: outlook
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22492394
tagged with: email
favorite count: 0
tagged with: pst
tagged with: msg
upvote count: 1
has body: Is there any relationship between a MSG file format and a PST file format? I was under the assumption that a PST file format is an archive that holds many MSG file formats... For example, if I want to get an email subject from MSG file I would extract it from stream "__substg1.0_0037". However if the same email is stored in a PST I would get the subject from the content table property: 0x0037. I can see that the 0037 is common in both cases, but if I extract the byte array associated with the email in the PST and save on my hard-drive and then tried to open it using outlook, would outlook recognize it as a true MSG file? I haven't tried this yet, because I'm having difficult time extracting the byte array from the PST.

http://stackoverflow.com/comment/34390903
type: AnswerComment
has text: Hence sign bit represents as value bit?
type: Comment
comment on: http://stackoverflow.com/a/22589589
score: 0

http://stackoverflow.com/comment/34491182
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22645787
type: Comment
has text: @user3457336 Remove your modulo (`%`) operation.

http://stackoverflow.com/q/22533307
has comment: http://stackoverflow.com/comment/34290996
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/22537677
tagged with: mouselistener
tagged with: swing
has title: Getting information about the certain object by clicking the certain image
linked to: http://stackoverflow.com/q/19209650
type: AnsweredQuestion
tagged with: clicking
tagged with: java
tagged with: image
type: Question
has body: I made the following class which contains information about users - name, age photo. public class User{ private int age; private String name; ImageIcon icon; JLabel image; public int getAge() { return age; } public String getName() { return name; } public User(){ this.age = 0; this.name = ""; } public User(int age, String name){ this.age = age; this.name = name; icon = new ImageIcon(name + ".jpg"); image = new JLabel(icon, JLabel.Center); } } I want to create the set of images with users' faces on JPanel. I want to get details of each user after clicking on his photo. So I put this code in the main class: MouseListener myClick = new MouseListener(){ @Override public void mouseClicked(MouseEvent e) { User selected = new User(); selected.image = (JLabel) e.getComponent(); System.out.println(selected.getAge() + " " + selected.getName()); } }; and User[] users = new User[32]; for (int i = 0; i &lt; 32; i++) { panel.add(users[i].image); users[i].image.addMouseListener(myClick); } I know- it is totally wrong. I cannot obtain data about the certain user, because I get values from "selected", which contains only JLabel with image (no values for age or name). What should I do to get the name and age of the certain user?
possible better answer: http://stackoverflow.com/a/22537261
has answer: http://stackoverflow.com/a/22537677
has answer: http://stackoverflow.com/a/22537261
has answer: http://stackoverflow.com/a/22533737

http://stackoverflow.com/comment/34369293
has text: I got one question left, is there any way to do it without line feed, maybe another function?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22577745
type: Comment

http://stackoverflow.com/comment/34459314
has text: @flup I start my tomcat in eclipse
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22627887
score: 0

http://stackoverflow.com/comment/35057113
type: Comment
has text: i am getting error near runOnUiThread it is telling to create a method and return null can u pls check it out
score: 0
comment on: http://stackoverflow.com/a/22528952
type: AnswerComment

http://stackoverflow.com/comment/34437421
type: Comment
has text: "a" sends message to server A, message contains who should recieve that message and what is the content of that message. Server A then sends message to client c with its content.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22615671

http://stackoverflow.com/q/22637587
tagged with: security
linked to: http://stackoverflow.com/q/3519151
has body: I have my Java code working in Eclipse but I need to add a few functionnality. First, how to limit the number of digits that can be entered by the user ? Actually I have a JPasswordField that let a person enter a pin Code, and I would like this JPasswordField limited to 4 digits maximum. So how to stop the input as soon as 4 digits are entered ? Then, how can I play with the size of the JPassword box ? Is there a way to modify it just like a JTextField for example ? Because my line "p1.setPreferredSize(new Dimension(100, 25));" does not seem to really let me modify the size of the box. As you can see, the JPassworldField box has a default size that I can not figure out how to modify easily. Here is my code : package codePin; import java.io.*; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main extends JFrame { private static final long serialVersionUID = 1L; private JPanel container = new JPanel(); private JPasswordField p1 = new JPasswordField(4); private JLabel label = new JLabel("Enter Pin: "); private JButton b = new JButton("OK"); public Main() { this.setTitle("NEEDS"); this.setSize(300, 500); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); container.setBackground(Color.white); container.setLayout(new BorderLayout()); JPanel top = new JPanel(); p1.setPreferredSize(new Dimension(100, 25)); //How to really modifiy this ? b.addActionListener(new BoutonListener()); top.add(label); top.add(p1); p1.setEchoChar('*'); top.add(b); this.setContentPane(top); this.setVisible(true); } class BoutonListener implements ActionListener { private final AtomicInteger nbTry = new AtomicInteger(0); @SuppressWarnings("deprecation") public void actionPerformed(ActionEvent e) { if (nbTry.get() &gt; 2) { JOptionPane.showMessageDialog(null, "Pin blocked due to 3 wrong tries"); return; } if (p1.getText().replaceAll("\u00A0", "").length() != 4) { // S…
has answer: http://stackoverflow.com/a/59766987
answer count: 4
possible better answer: http://stackoverflow.com/a/22638107
has answer: http://stackoverflow.com/a/39956417
has answer: http://stackoverflow.com/a/22638107
upvote count: 2
tagged with: swing
tagged with: limit
tagged with: passwords
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22637851
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7229226
downvote count: 0
has title: How to limit the number of digits in a JPasswordField in Java?
accepted answer: http://stackoverflow.com/a/22637851
favorite count: 0

http://stackoverflow.com/q/22618211
has comment: http://stackoverflow.com/comment/34521401
has comment: http://stackoverflow.com/comment/34520957
tagged with: jsp
has comment: http://stackoverflow.com/comment/34478945
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34445513
has body: I have a binder which gets a string of permissions and must convert it to the Collection. But when binder method is invoking it can’t convert array of String to collection. My controller: @Controller @RequestMapping("/profile") public class ProfileController { @Autowired @Qualifier("mvcUserService") UserService userService; @RequestMapping(value = "/edit", method = RequestMethod.GET) public ModelAndView editForm(Principal principal) { User user = userService.getUser(principal.getName()); ModelAndView mav = new ModelAndView("user/profile"); return mav.addObject("user", user); } @RequestMapping(value = "/edit", method = RequestMethod.PUT) public ModelAndView edit(@ModelAttribute("user") User user, BindingResult result) { // some action with User object } @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Permission.class, new PropertyEditorSupport() { @Override public void setAsText(String name) throws IllegalArgumentException { Permission permission = userService.getPermission(name); setValue(permission); } }); JSP: &lt;form:form action="/profile/edit" method="PUT" modelAttribute="user"&gt; &lt;input type="hidden" name="_method" value="PUT"/&gt; // setting up fields &lt;form:hidden path="id"/&gt; &lt;form:hidden path="permissions"/&gt; &lt;/form:form&gt; Permission class: public class Permission implements Serializable { private Integer id; private String name; And my User class: public class User implements Serializable { // some fields private Collection&lt;Permission&gt; permissions; I need to implement correct binding. Any suggestions how can I do it?
has comment: http://stackoverflow.com/comment/34513276
has comment: http://stackoverflow.com/comment/34480584
score: 3
has comment: http://stackoverflow.com/comment/34483333
downvote count: 0
has comment: http://stackoverflow.com/comment/34485927
has comment: http://stackoverflow.com/comment/34528037
has comment: http://stackoverflow.com/comment/34517547
favorite count: 0
type: Question
has title: How to bind String[] to Collection of POJOs?
has comment: http://stackoverflow.com/comment/34467189
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34466388
has comment: http://stackoverflow.com/comment/34510189
upvote count: 3
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24376660

http://stackoverflow.com/a/22628569
score: 1
has comment: http://stackoverflow.com/comment/34475308
answers question: http://stackoverflow.com/q/22618743
has comment: http://stackoverflow.com/comment/34480350
has comment: http://stackoverflow.com/comment/34528860
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34572265
has body: private static final int MIC_FETCH_SIZE = 480; // 0.12 seconds of data This is far too small a buffer size for reliable performance. At 16 bit mono, it represents just 240 sound samples. Make it something more like 16000 samples, or: private static final int MIC_FETCH_SIZE = 32000; // 2 seconds of data Note: Java Sound will not guarantee that amount is read, and will instead return the number of bytes that are actually read. The point is, to allow the opportunity to read up to 2 seconds of data (if it is available). I think this should solve most of the problems described above.
has comment: http://stackoverflow.com/comment/34481919
has comment: http://stackoverflow.com/comment/34591447
type: Answer
has comment: http://stackoverflow.com/comment/35246468

http://stackoverflow.com/comment/34397949
has text: Thanks, David. While I am using ASM framework, can I distinguish in any way these invokations?
comment on: http://stackoverflow.com/a/22593606
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34364628
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22548920
type: Comment
has text: Actually I don't use any of those methods. I used the next code in order to retrieve the data into a model. `VirtGraph graph = new VirtGraph(String graphName, String url_host, String user, String password)` `Model inputModel = new VirtModel(VirtGraph graph)` So I guess with this I just can read and write in the graph I am working with.

http://stackoverflow.com/comment/34307796
comment on: http://stackoverflow.com/a/22542938
type: AnswerComment
score: 0
has text: Our assignment is array and interface based, to try and get our heads around the use of arrays, and search and sort functions
type: Comment

http://stackoverflow.com/comment/36032899
type: QuestionComment
score: 0
has text: Ever figure this out?
comment on: http://stackoverflow.com/q/22548320
type: Comment

http://stackoverflow.com/a/22573794
has comment: http://stackoverflow.com/comment/34804239
has body: Have a look at Mapquest's geocoding API. Do check out their Terms of Use, though. Here are a few of the requirements: OpenStreetMap must be given credit for the data. Please place “Geocoding Courtesy of MapQuest ” on your page, or in the copyright area of the map and please link the word “MapQuest” to http://www.mapquest.com. If your application will get heavy usage, please let us know by sending us an email at open@mapquest.com. Please include the estimate of your expected usage so that we will be aware and accommodate the extra traffic.
accepted answer of: http://stackoverflow.com/q/22573728
upvote count: 1
answers question: http://stackoverflow.com/q/22573728
has comment: http://stackoverflow.com/comment/75356898
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34804346
has comment: http://stackoverflow.com/comment/34362277
type: Answer

http://stackoverflow.com/comment/34457484
type: AnswerComment
comment on: http://stackoverflow.com/a/22611253
score: 0
type: Comment
has text: Any thoughts about how this query would work : start n=node(127) match (n:Student) where n.Marks=30 return n;

http://stackoverflow.com/q/22516571
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22517361
tagged with: java
has body: Is there a way to name an element name with accented letters in Java?
tagged with: dom
type: Question
answer count: 1
score: 0
has title: Dom Parser: Naming elements with accented (mainly Cyrillic) letters causes an error. (Java)
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/22620909
favorite count: 0
has answer: http://stackoverflow.com/a/22621819
upvote count: 2
has answer: http://stackoverflow.com/a/22620991
has comment: http://stackoverflow.com/comment/34449386
has answer: http://stackoverflow.com/a/22620988
has body: In my application, I have a Board. A Board consists of cell. Each cell has an int value. There are few types of Boards that will extend Board. Each type of Board will represent the cells differently. For example, one would use a List and anothr will use a Tree. So this is what is tried: public abstract class Board&lt;T&gt; { T&lt;Cell&gt; cells; //error - The type T is not generic; it cannot be parameterized with arguments &lt;Cell&gt; protected abstract void setValues(T&lt;Integer&gt; values); } Unfortunately, I can't make T a generic type. How do I implement that?
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34447099
possible better answer: http://stackoverflow.com/a/22620991
tagged with: java
accepted answer: http://stackoverflow.com/a/22621819
type: Question
has comment: http://stackoverflow.com/comment/34447092
has comment: http://stackoverflow.com/comment/34447210
has title: java "generic generic type"
answer count: 3
downvote count: 0
tagged with: generics
has comment: http://stackoverflow.com/comment/34447809

http://stackoverflow.com/a/22624874
score: 0
answers question: http://stackoverflow.com/q/22624818
type: Answer
has body: Make sure that Write.java's class has the same level of access as Employee (IE: Public). If this is not the issue, I would show the code from Write.java specifically as that is most likely where the problem is coming from.

http://stackoverflow.com/comment/34411506
score: 0
has text: @AleZalazar Didn't try with only 1 thread but will try and report back. Usually it takes more than 50k connections for that ConnectionManager to stall. Thanks for the idea
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22600972

http://stackoverflow.com/q/22524881
upvote count: 1
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22525003
has answer: http://stackoverflow.com/a/22525204
has title: Junit "Class not found exception" in eclipse with the maven project
has answer: http://stackoverflow.com/a/22525127
score: -5
has comment: http://stackoverflow.com/comment/34275583
has body: When i run the junit it gives the pop up saying "do you want to proceed with the errors" and it shows the files in which there are error i resolved all the errors still the problem persist and shows the error below. Class not found com.srv.impl.BulkSearchImplTest java.lang.ClassNotFoundException: com.srv.impl.BulkSearchImplTest 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) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) 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.RemoteTestRunner.main(RemoteTestRunner.java:197)
favorite count: 0
accepted answer: http://stackoverflow.com/a/22525204
possible better answer: http://stackoverflow.com/a/27708137
has answer: http://stackoverflow.com/a/27708137
tagged with: maven
answer count: 4
downvote count: 6
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/34386447
type: AnswerComment
has text: Thanks For your answer and Yes `KZ`is not my initials its name of database schema
type: Comment
comment on: http://stackoverflow.com/a/22578415
score: 0

http://stackoverflow.com/q/22643623
answer count: 1
has answer: http://stackoverflow.com/a/22644878
tagged with: android
tagged with: google-maps-android-api-2
accepted answer: http://stackoverflow.com/a/22644878
score: 0
has body: I've made an XML layout for a ListView header and I also made a class that extends RelativeLayout to manipulate its elements. One of the elements is a GoogleMap fragment. The class initialization is basically: public class HeaderView extends RelativeLayout { public HeaderView(final Context context, final MyData data) { super(context); // Line #8 - inflation error View.inflate(context, R.layout.view_header, this); // Get view elements, set text, image, etc. // Can't use getSupportFragmentManager() because class is not FragmentActivity // How can I get the map then? GoogleMap googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); } } And the context being passed is an activity's base context (this.getBaseContext()). Instantiating this class results in the error: E/AndroidRuntime﹕ FATAL EXCEPTION: main android.view.InflateException: Binary XML file line #8: Error inflating class fragment I've already added the required meta-data to the manifest file, even because I use another map in a different class (which btw extends FragmentActivity, so no trouble with map here). &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/google_api_key"/&gt; So basically, it's a 2 in 1 question, how can I inflate the view properly and how to get a reference to the map fragment? This is the XML: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white"&gt; &lt;fragment android:layout_width="wrap_content" android:layout_height="65dp" android:name="com.google.android.gms.maps.SupportMapFragment" android:id="@+id/map" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentRight="tru…
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has title: Inflate view with SupportMapFragment in a ViewGroup class
type: Question
tagged with: viewgroup

http://stackoverflow.com/comment/34325316
has text: Yes, this trick comes handy many times, especially if there are many inner loops.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22552944

http://stackoverflow.com/comment/34414159
score: 3
comment on: http://stackoverflow.com/q/22602675
type: Comment
type: QuestionComment
has text: Passing the scanner around is completely reasonable. You have methods that continue to read input from the same file, and so your code matches your intent. This is some of the saner looking "newbie" code I've seen on SO in a while. I'd say you're fine.

http://stackoverflow.com/q/22617933
type: Question
tagged with: java
score: -1
has title: Failed using ListAdapter in extends Fragment
upvote count: 0
answer count: 1
favorite count: 0
has body: I trying to update the JSON data into ListView. It failed when using ListAdapter. Is fragment didnt allow that ? I insist want to use the extends Fragment. Is there any method on that ? Please help me. Thanks. Here is part of the whole code. public class ScheduleFragment extends Fragment { public ProgressDialog pDialog; private ListView myListView; // Creating JSON Parser object JSONParser jParser = new JSONParser(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; subjectList; // url to get all subjects list private static String url_all_subjects = "http://192.168.1.12/android_project/get_subjects.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_STUDENT = "students"; private static final String TAG_MATRIX_ID = "matrix"; private static final String TAG_NAME = "name"; // subject JSONArray JSONArray subject = null; public ScheduleFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_schedule, container, false); //------------------------------------CREATING A LISTVIEW----------------------- // Loading subject in Background Thread new LoadAllSubject().execute(); // Hashmap for ListView subjectList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); myListView = (ListView) rootView.findViewById(R.id.textViewMatrix); // on selecting single subject myListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // getting values from selected ListItem String matrix_id = ((TextView) view.findViewById(R.id.textViewMatrix)).getText() .toString(); // Starting new intent Intent in = new Intent(getActivity().getApplicationContext(), SingleSubject.class); // sending matrix id to next activity in.putExtra(TAG_MATRIX_ID, matrix_id); // starting new activity and expecting some response back startActivityFor…
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22617974
accepted answer: http://stackoverflow.com/a/22617974
downvote count: 1

http://stackoverflow.com/comment/34405841
type: QuestionComment
has text: as @MarcoAcierno said tostring doesnt print any thing ,its a method from String class
comment on: http://stackoverflow.com/q/22598051
score: 0
type: Comment

http://stackoverflow.com/comment/34251600
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22511333
has text: IMO, go with your original solution. If you ever change your string later down the road, you will keep the formatting you want.
type: AnswerComment

hashmap
tags question: http://stackoverflow.com/q/22570411
tags question: http://stackoverflow.com/q/22513629
tags question: http://stackoverflow.com/q/22527149
tags question: http://stackoverflow.com/q/22593762
tags question: http://stackoverflow.com/q/22523717
tags question: http://stackoverflow.com/q/22605414
tags question: http://stackoverflow.com/q/22562165
tags question: http://stackoverflow.com/q/22587422
tags question: http://stackoverflow.com/q/22587969
tags question: http://stackoverflow.com/q/22506536
tags question: http://stackoverflow.com/q/22597705
tags question: http://stackoverflow.com/q/22596877
tags question: http://stackoverflow.com/q/22528609
tags question: http://stackoverflow.com/q/22579762
tags question: http://stackoverflow.com/q/22607983
tags question: http://stackoverflow.com/q/22542725
tags question: http://stackoverflow.com/q/22571805
tags question: http://stackoverflow.com/q/22596489
tags question: http://stackoverflow.com/q/22587427
type: Tag
tags question: http://stackoverflow.com/q/22489756
tags question: http://stackoverflow.com/q/22644821
tags question: http://stackoverflow.com/q/22589350
tags question: http://stackoverflow.com/q/22625065
tags question: http://stackoverflow.com/q/22627415
tags question: http://stackoverflow.com/q/22502154
tags question: http://stackoverflow.com/q/22519317
tags question: http://stackoverflow.com/q/22584807
tags question: http://stackoverflow.com/q/22547759
tags question: http://stackoverflow.com/q/22587383
tags question: http://stackoverflow.com/q/22532182
tags question: http://stackoverflow.com/q/22559527
tags question: http://stackoverflow.com/q/22547476
tags question: http://stackoverflow.com/q/22642870
tags question: http://stackoverflow.com/q/22530549
tag name: hashmap
tags question: http://stackoverflow.com/q/22591441
tags question: http://stackoverflow.com/q/22556939
tags question: http://stackoverflow.com/q/22557446
tags question: http://stackoverflow.com/q/22542487
tags question: http://stackoverflow.com/q/22496735
tags question: http://stackoverflow.com/q/22576909
tags question: http://stackoverflow.com/q/22526593
tags question: http://stackoverflow.com/q/22563272
tags question: http://stackoverflow.com/q/22497563

http://stackoverflow.com/comment/34325624
type: AnswerComment
comment on: http://stackoverflow.com/a/22530630
type: Comment
has text: I see, but myList is empty. Can you post the actual code that it's causing the crash?
score: 0

http://stackoverflow.com/q/22576409
tagged with: exception
has body: Can we catch an exception type twice in the main method with different messages? I want to print out a different warning. Ex: try { // some code } catch (NumberFormatException e) { System.out.println("Wrong input!"); } catch (NumberFormatException e) { System.out.println("No valid number!"); }
has comment: http://stackoverflow.com/comment/34366469
possible better answer: http://stackoverflow.com/a/22576426
answer count: 4
has answer: http://stackoverflow.com/a/22576453
has answer: http://stackoverflow.com/a/22576465
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34366450
tagged with: java
has comment: http://stackoverflow.com/comment/34366440
accepted answer: http://stackoverflow.com/a/22576465
has title: Catching exception types twice
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/34366456
has answer: http://stackoverflow.com/a/22576520
has answer: http://stackoverflow.com/a/22576426
score: 0

http://stackoverflow.com/q/22492184
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22492914
tagged with: io
tagged with: standard-library
has comment: http://stackoverflow.com/comment/34219594
has body: I have an assignment stating that "You can assume that input will come from standard input in a stream. You may assume that the markers have access to all standard libraries". How do I go about reading several lines/inputs and saving all the inputs as one string and then outputting that string from a function? Currently this is my function, but it's not working properly, at one stage it wasn't reading more than one line and now it doesn't work at all. public static String readFromStandardIO() { String returnValue = ""; String newLine = System.getProperty("line.separator"); System.out.println("Reading Strings from console"); // You use System.in to get the Strings entered in console by user try { // You need to create BufferedReader which has System.in to get user // input BufferedReader reader = new BufferedReader(new InputStreamReader( System.in)); String userInput; System.out.println("Enter text...\n"); while (!(reader.readLine() == reader.readLine().trim())) { userInput = reader.readLine(); returnValue += userInput; } System.out.println("You entered : " + returnValue); return returnValue; } catch (Exception e) { } return null; } Thank you for the assistance!
has title: Using the standard/output stream as string input/output
accepted answer: http://stackoverflow.com/a/22492914
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/34431518
comment on: http://stackoverflow.com/a/22608908
type: Comment
type: AnswerComment
has text: I tried but it doesn't react to `System.out.println(Arrays.toString(both));`
score: 0

http://stackoverflow.com/a/22532365
has body: Open the Settings: Code style -> Java -> Import Tab in the first section (General) there is an option for Use single class import and at the end of the section two value fields where you can set the limit of classes in the imported package until idea starts to import *
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22532024
score: 6
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/22532024

http://stackoverflow.com/comment/34434799
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22608664
type: Comment
has text: @splinter123 what do you mean by messages are shown at the end of the program and not as they created? You want to show the output at the bottom of the page,am I right?

http://stackoverflow.com/comment/34218265
comment on: http://stackoverflow.com/q/22491853
type: Comment
type: QuestionComment
score: 3
has text: Why would you *want* to use `Boolean` instead of `boolean` here to start with?

http://stackoverflow.com/a/22572960
type: Answer
answers question: http://stackoverflow.com/q/22564136
score: 0
has body: It sounds like you need to install a perl on windows. I suggest that you use Strawberry Perl. I have no experience with TreeTagger, but doing a little googling points to this reference: TreeTagger - a language independent part-of-speech tagger. Scrolling down there is a Windows version in zip form, that contains an INSTALL.txt which states: Installation ------------ 1. Install a Perl interpreter (if you have not already installed one). You can download a Perl interpreter for Windows for free at http://www.activestate.com/activeperl/ 2. Move the TreeTagger directory to the root directory of drive C:. 3. Download the PC parameter files for the languages you need, decompress them (e.g. using Winzip or 7zip) and move them to the subdirectory lib. Rename the parameter files to &lt;language&gt;.par Example: Rename french-par-linux-3.1.bin to french.par The UTF8 versions of the parameter files are not supported yet, but see below some hints on how to build tagging scripts for the UTF8 parameter files. 4. Add the path C:\TreeTagger\bin to the PATH environment variable. 5. Open a shell and type the command set PATH=C:\TreeTagger\bin;%PATH% 6. Change to the directory C:\TreeTagger 7. Now you can test the tagger, e.g. by analyzing this file with the command tag-english INSTALL.txt Obviously you must've skipped step 1. :) You could use ActiveState as they suggest, but these days Strawberry perl is a much better option in my opinion.

http://stackoverflow.com/comment/34375581
type: QuestionComment
comment on: http://stackoverflow.com/q/22573024
has text: The boundaries in your recursive call are wrong. It should be mergeSort(list, low, (low+high)/2); mergeSort(list, (low+high)/2+1, high);
score: 1
type: Comment

http://stackoverflow.com/a/22593606
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34398407
accepted answer of: http://stackoverflow.com/q/22593441
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/22593441
has body: Ones is for the case when the exception was implicitly caught and needs to get rethrown (note the ATHROW at the end) L15 LINENUMBER 155 L15 ALOAD 4: out INVOKEVIRTUAL FileOutputStream.close () : void L14 LINENUMBER 157 L14 ALOAD 6 ATHROW The other for when no exception is thrown: L19 LINENUMBER 155 L19 ALOAD 4: out INVOKEVIRTUAL FileOutputStream.close () : void If you look at the top, you see TRYCATCHBLOCK L0 L1 L1 Those labels are something like for where to jump for the catch and where to jump for the finally. Catch leaves the thrown exception on the top of the stack (again, ATHROW). Inspecting the stack to see if the top member is an exception is a lot more expensive (and harder/impossible; the stack isn't typed) than just duplicating the code.
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/34397949
has comment: http://stackoverflow.com/comment/34398498

http://stackoverflow.com/a/22530605
score: 2
has body: I'm the author of the "OGC Schemas and Tools Project". Your bindings seem correct, object factory looks fine, it should work. The core issue you're experiencing is that gml:featureMember is not substituted by cit:cityObjectMember for some reason. It is hard to say why. I'd attack the problem by trying to analyse the runtime model that JAXB creates for your classes. Somehow your @XmlElementDecl on createCityObjectMember gets ignored. My approach for this kind of things is usually to take something which does not work and something which does and then try to reduce the gap thus identifying the cutting edge which is essentially a problem. In this case I would take the code and build a minimal example where substitution works. Then I'd try to reduce yor not working example, stripping it of irrelevant properties and so on. Finally you'll get the edge which will give you a clue of what's wrong. My guess, without going deeper would be scopes. Maybe the substitution of gml:featureMemeber is somehow limited and your substitution does not match the "limit". Hard to say without debugging. Feel free to contact me (valikov at gmx net), provide your mappings (or the whole project), I'll try to help you out.
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/34325797
answers question: http://stackoverflow.com/q/22528951
has comment: http://stackoverflow.com/comment/34326450
type: Answer
has comment: http://stackoverflow.com/comment/34286898

bloom-filter
type: Tag
tag name: bloom-filter
tags question: http://stackoverflow.com/q/22588319

http://stackoverflow.com/q/22565314
accepted answer: http://stackoverflow.com/a/22565730
has comment: http://stackoverflow.com/comment/34346637
score: 0
answer count: 1
tagged with: tree
has comment: http://stackoverflow.com/comment/34347935
has comment: http://stackoverflow.com/comment/34346561
tagged with: java
has answer: http://stackoverflow.com/a/22565730
has body: I have browsed the other questions and found solutions as to how to do a deep copy of objects that contain references. I am specifically wanting to make a deep copy of a tree. Logically, each tree node contain references to its children nodes. Here is the basics of my node class public class BSTNode implements Comparable, Serializable { private String token; private int count; private BSTNode leftChild; private BSTNode rightChild; I know I must only be making a shallow copy because when I make a copy of tree1, called tree2, and edit tree1 the edits also appear on tree2. Here is my copy method within my BSTNode class public BSTNode copy() { BSTNode obj = null; try{ ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bos); out.writeObject(this); out.flush(); out.close(); ObjectInputStream in= new ObjectInputStream(new ByteArrayInputStream( bos.toByteArray())); obj = (BSTNode) in.readObject(); } catch(Exception e) { e.printStackTrace(); } return obj; } When I wish to copy the entire tree, I call that above copy method from my BSTree class using the methods below. (I have 2 methods because this is a homework assignment that requires a copy method that calls a preorder traversal method) public BSTNode copy() { BSTNode copiedTreeRoot = new BSTNode(); return copyTree(copiedTreeRoot,root); } public BSTNode copyTree(BSTNode copiedTreeRoot, BSTNode otherTreeRoot) { if(otherTreeRoot == null) { copiedTreeRoot = null; } else { copiedTreeRoot = otherTreeRoot.copy(); copyTree(copiedTreeRoot.getLeft(), otherTreeRoot.getLeft()); copyTree(copiedTreeRoot.getRight(), otherTreeRoot.getRight()); } return copiedTreeRoot; } I use these lines to create the new tree and assign the copy to it BSTree tree2 = new BSTree(); tree2.setRoot(tree1.copy()); And further along when I make changes to tree1, tree 2 also changes. I have no clue what I'm doing wrong. I believe it must be somewhere in how I return the new tree or something. Any help is gr…
type: Question
tagged with: deep-copy
type: AnsweredQuestion
has title: Using serializable yet still getting shallow copy of object
has comment: http://stackoverflow.com/comment/34346540
has comment: http://stackoverflow.com/comment/34346493

http://stackoverflow.com/a/22502059
has comment: http://stackoverflow.com/comment/34236249
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34234836
has comment: http://stackoverflow.com/comment/34234904
has comment: http://stackoverflow.com/comment/34237056
type: Answer
has comment: http://stackoverflow.com/comment/34236220
has comment: http://stackoverflow.com/comment/34235710
has body: You can use this method. public static Bitmap TakeBitmapFromDialog(View v, int width, int height) { Bitmap b = Bitmap.createBitmap(width , height, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height); v.draw(c); return b; } OR simply use this. View v1 = view.getRootView(); v1.setDrawingCacheEnabled(true); Bitmap bm = v1.getDrawingCache(); BitmapDrawable bitmapDrawable = new BitmapDrawable(bm); UPDATE: if you don't want to use that then use this. Bitmap cs = null; view.setDrawingCacheEnabled(true); view.buildDrawingCache(true); cs = Bitmap.createBitmap(view.getDrawingCache()); Canvas canvas = new Canvas(cs); view.draw(canvas); canvas.save(); view.setDrawingCacheEnabled(false); If you want to share that bitmap you need to insert in Media Images like, String path = Images.Media.insertImage(getContentResolver(), cs, "MyImage", null); Uri file = Uri.parse(path); Now for sharing, Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("image/png"); sharingIntent.putExtra(Intent.EXTRA_STREAM, file); startActivity(Intent.createChooser(sharingIntent, "Share image using"));
upvote count: 1
has comment: http://stackoverflow.com/comment/34236297
has comment: http://stackoverflow.com/comment/34236552
answers question: http://stackoverflow.com/q/22501554
has comment: http://stackoverflow.com/comment/34235631
has comment: http://stackoverflow.com/comment/34237657
accepted answer of: http://stackoverflow.com/q/22501554

http://stackoverflow.com/comment/34228412
comment on: http://stackoverflow.com/q/22498033
type: Comment
score: 1
has text: please move to http://softwarerecs.stackexchange.com/
type: QuestionComment

http://stackoverflow.com/comment/34221502
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22493224
type: Comment
has text: The `Graphics` context is provided to via the `paintComponent` method, this tells you that the component must be repainted...don't maintain a reference to it beyond the scope of the actual method call though...it's a one time deal ;)

http://stackoverflow.com/comment/34472925
type: Comment
has text: Yep that's what I just did haha, found it in the doc. Thanks
type: AnswerComment
comment on: http://stackoverflow.com/a/22635683
score: 0

http://stackoverflow.com/a/74573340
score: 2
downvote count: 0
upvote count: 2
has body: You can use TimeUnit class to easily convert from seconds to hours, minutes and seconds. import java.util.Scanner; import java.util.concurrent.TimeUnit; class Main { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { long seconds = Long.parseLong(sc.nextLine()); long HH = TimeUnit.SECONDS.toHours(seconds) % 24; long MM = TimeUnit.SECONDS.toMinutes(seconds) % 60; long SS = TimeUnit.SECONDS.toSeconds(seconds) % 60; System.out.printf("%02d:%02d:%02d%n", HH, MM, SS); } } }
answers question: http://stackoverflow.com/q/22545644
type: Answer

http://stackoverflow.com/q/22568175
tagged with: java
upvote count: 1
type: Question
has title: OpenSSL and Bouncy Castle CMS implementation
has body: I'm porting some code from Java to C++ and noticed some difference in CMS generation. In OpenSSL if I use CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, unsigned int flags) and provide pkey with public key different from public key of signer certificate signcert I getting validation error and that is right. If I do the same thing with CMSSignedDataGenerator class I will get SignedData without any errors. Here is code example: CMSSignedDataGenerator gen = new CMSSignedDataGenerator(); DigestCalculatorProvider dp = new JcaDigestCalculatorProviderBuilder().setProvider(CryptoUtils.BC).build(); JcaSignerInfoGeneratorBuilder builder = new JcaSignerInfoGeneratorBuilder(dp); ContentSigner signer = new JcaContentSignerBuilder(cert.getSigAlgName()).setProvider(CryptoUtils.BC).build(privateKey); gen.addSignerInfoGenerator(builder.build(signer, cert)); CMSSignedData s = gen.generate(msg, true); In this code example I use certificate with public key not same as public key from private key object and no any exceptions or validation errors. Is it OK or not?
tagged with: openssl
downvote count: 0
has comment: http://stackoverflow.com/comment/34714442
favorite count: 0
tagged with: bouncycastle
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34585958
answer count: 0
score: 1

http://stackoverflow.com/a/22611499
has body: You need to track maxQuarter and minQuarter (added as ints) as well as max and min. Like so: import java.util.Scanner; public class rainfall { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double[] rainfall = new double[4]; double totalRainfall = 0.0; double max = 0, min = 0; // init to Q1 as that's the 1st tested int maxQuarter = 1, minQuarter = 1; for (int i=0; i &lt; 4; i++) { System.out.print("Enter rainfall for quarter " + (i+1) + ": "); rainfall[i] = scan.nextDouble(); totalRainfall += rainfall[i]; if (i == 0) { max = min = rainfall[i]; } { if (rainfall[i] &gt; max) { max = rainfall[i]; maxQuarter = i + 1; } if (rainfall[i] &lt; min) { min = rainfall[i]; minQuarter = i + 1; } } } System.out.println("Total rainfall = "+totalRainfall); System.out.println("Average rainfall = "+(totalRainfall / 4.0)); System.out.println("Max quarter rainfall = "+ max); System.out.println("Min quarter rainfall = " + min); System.out.println("Max quarter rainfall = "+ maxQuarter); System.out.println("Min quarter rainfall = " + minQuarter); }//end main }//end class With these changes, it runs fine for my basic tests: Enter rainfall for quarter 1: 2 Enter rainfall for quarter 2: 4 Enter rainfall for quarter 3: 6 Enter rainfall for quarter 4: 7 Total rainfall = 19.0 Average rainfall = 4.75 Max quarter rainfall = 7.0 Min quarter rainfall = 2.0 Max quarter rainfall = 4 Minquarter rainfall = 1
has comment: http://stackoverflow.com/comment/34429516
has comment: http://stackoverflow.com/comment/34440611
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34438756
answers question: http://stackoverflow.com/q/22611283
downvote count: 0
has comment: http://stackoverflow.com/comment/34429491
has comment: http://stackoverflow.com/comment/34430689
has comment: http://stackoverflow.com/comment/34446193
type: Answer

http://stackoverflow.com/comment/34314483
type: QuestionComment
has text: Why don't you write the dumps in files and mmap() them for comparison?
comment on: http://stackoverflow.com/q/22546684
score: 0
type: Comment

http://stackoverflow.com/q/22584388
answer count: 3
has answer: http://stackoverflow.com/a/22595186
has comment: http://stackoverflow.com/comment/34381422
favorite count: 0
has answer: http://stackoverflow.com/a/22584594
tagged with: binary-search-tree
type: UnansweredQuestion
has title: Iterate through a binary search tree
has comment: http://stackoverflow.com/comment/35750665
has comment: http://stackoverflow.com/comment/34381372
has comment: http://stackoverflow.com/comment/34381527
has answer: http://stackoverflow.com/a/22584608
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34381415
has comment: http://stackoverflow.com/comment/34381373
has comment: http://stackoverflow.com/comment/34381673
has body: I want to go through every item in a dictionary in Java. To clarify what I want to do, this is the C# code: Dictionary&lt;string, Label&gt; LableList = new Dictionary&lt;string, Label&gt;(); foreach (KeyValuePair&lt;string, Label&gt; z in LabelList) { … }
score: 0

http://stackoverflow.com/comment/34219999
type: QuestionComment
comment on: http://stackoverflow.com/q/22492916
has text: @m0skit0 cannot modify or alter the jar file, application uses `com.test` package, and I cannot just override or change the business code, all I want to do is redirect(override, hack, ...) the exist `com.test` objects(requests) to the new definition.
score: 0
type: Comment

http://stackoverflow.com/comment/34430246
has text: I will have to do this every single time but it works.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22610609

http://stackoverflow.com/a/22627020
has comment: http://stackoverflow.com/comment/34457724
has body: You can Do it as below <%@ page import="java.io.*,java.util.*" %> Page Redirection Page Redirection <% // New location to be redirected String site = new String("http://www.xyz.com"); response.setStatus(response.SC_MOVED_TEMPORARILY); response.setHeader("Location", site); %>
score: 0
has comment: http://stackoverflow.com/comment/34457816
answers question: http://stackoverflow.com/q/22626845
type: Answer

http://stackoverflow.com/q/22620063
has comment: http://stackoverflow.com/comment/34445523
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22620073
has title: Cannot find symbol in java asking to create a class
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34445530
score: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22620073
answer count: 1
has body: I am having a class defined as follows: public class Myclass { public int myvariable = 100; if( myvariable &gt; 0) { } } Why I am getting an error in front of if condition stating that cannot find symbol , symbol : class myvariable , location : class Myclass &lt;identifier&gt; expected I am just comparing the value of integer variable with 0 here. Based on the error, I would need to create a class. Please let me know what's wrong here.
tagged with: java

http://stackoverflow.com/q/22549339
has answer: http://stackoverflow.com/a/22549491
has body: String s1 = new String("abc");//it is created at heap area String s2 = "abc";//it is created string constant pool System.out.println(s1==s2);//false System.out.println(s1.hashCode());same hashCode System.out.println(s2.hashCode());same hashCode The last two lines give the same hashCode(), but the objects are different.while creating s1 object it create in heap area and s2 object is create in string constant pool.but both are gives same hashCode.i.e my doubt?
type: Question
has answer: http://stackoverflow.com/a/22549383
has answer: http://stackoverflow.com/a/22549379
score: -1
has title: hashCode and equals relationship with String
has answer: http://stackoverflow.com/a/22549545
linked to: http://stackoverflow.com/q/513832
tagged with: string
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
upvote count: 2
answer count: 5
has answer: http://stackoverflow.com/a/22550152
type: UnansweredQuestion
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/34472726
has text: I would like to drag a button and to drop it under or over an other button ... Then the user can sort the buttons like he wants
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22635421

http://stackoverflow.com/a/22578844
answers question: http://stackoverflow.com/q/22578767
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: This is the error : for (int i = n; n&lt;=m; i++) /* terminating condition "n&lt;=m" is never met here */ { if ((i%2) != 0) sum = sum + i; } Why : this loop increments i but terminating condition is n&lt;=m which is never met....so either do i&lt;n Or i&lt;m which ever suits you for terminating the condition!!

http://stackoverflow.com/q/22633837
has body: Switching from Python to Java and decided to code an insertionsort method. I have written this in Python and tried to switch over the code one-to-one, it all seems good to go but it is not functioning correctly. I cut out all the other class methods/data fields to converse space and tried to limit this code only to that which is relevant to this question: public class test1 { static final int NOT_FOUND = -1; // A constant // Attributes (just one) private double data[]; // Constructor test1 (double data[]) { this.data = data.clone(); } double getItem (int key) { return data[key]; } void insertionSort () { for (int i = 1;i &gt;= data.length;i++){ double currentElement = data[i]; int k = i - 1; while(k&gt;=0 &amp; data[k] &gt; currentElement){ data[k+1] = data[k]; k -= 1; data[k + 1] = currentElement; } } } public static void main(String[] arg){ double testData[] = {1,4,32,5,673,145,68,14,757}; test1 b = new test1 (testData); b.insertionSort(); //See how array has changed for (int i = 0; i &lt; 9; i++) { System.out.print(b.getItem(i) + ", "); } } }
has answer: http://stackoverflow.com/a/22634076
answer count: 3
possible better answer: http://stackoverflow.com/a/22633935
accepted answer: http://stackoverflow.com/a/22633980
score: 0
has answer: http://stackoverflow.com/a/22633935
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34469630
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34469088
has title: Why is insertion sort not working?
has answer: http://stackoverflow.com/a/22633980
favorite count: 0

http://stackoverflow.com/comment/34403173
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22596492
has text: im sorry, i just noticed I had an extra "}" from a for statement, which was throwing off my code. Really sorry about the trouble.
type: AnswerComment

http://stackoverflow.com/comment/34457771
type: AnswerComment
comment on: http://stackoverflow.com/a/22626862
has text: Sure, I was assessing this in the context of OPs benchmark with 1 million elements
type: Comment
score: 1

judy-array
tags question: http://stackoverflow.com/q/22579739
tag name: judy-array
type: Tag

http://stackoverflow.com/comment/34362143
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22573621
score: 0
has text: That should be "C:/>program files/java/jdk 1.6.0/bin/". You need the extra / on the end. See if that fixes it.

http://stackoverflow.com/a/22549562
score: 1
upvote count: 1
has body: The | is a bitwise-OR operator. It's applying an OR to the numeric values. Easier to see in binary: 1 | 2 | 3 | 4 1 is 0...00000001 2 is 0...00000010 3 is 0...00000011 4 is 0...00000100 OR: 0...00000111 bitwise OR of all values 0...00000111 = 7 It's not passing "multiple values", it's an arithmetic expression that evaluates to a single value. However, it's frequently used to pass e.g. sets of "boolean" flags, where each flag is represented by a bit. For example: static final int FLAG_CRISPY = 1; // 00000001 binary static final int FLAG_SMOKED = 2; // 00000010 binary static final int FLAG_ENDLESS = 4; // 00000100 binary Then you may have a method: void makeBacon (int flags) { if ((flags &amp; FLAG_CRISPY) != 0) // bitwise AND to check for flag ... flag is set if ((flags &amp; FLAG_SMOKED) != 0) // bitwise AND to check for flag ... flag is set if ((flags &amp; FLAG_ENDLESS) != 0) // bitwise AND to check for flag ... flag is set } And you can call it like: makeBacon(FLAG_SMOKED | FLAG_ENDLESS); Defining flags like this is convenient because you can modify the set of flags as the program evolves without having to make any changes to the method interface. It's also sometimes useful to be able to encapsulate a large set of options in a single int (e.g. when storing data to a binary file or sending over a network). The official tutorial on bitwise and bit-shift operators has more information about other related operators (e.g. AND, XOR, left shift, right shift).
answers question: http://stackoverflow.com/q/22549558
accepted answer of: http://stackoverflow.com/q/22549558
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/22543373
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22543474
has title: Why methods in jar can't be resolved in eclipse?
tagged with: java
has answer: http://stackoverflow.com/a/22543496
has answer: http://stackoverflow.com/a/22543524
tagged with: eclipse
type: Question
has body: I am reading the book algorithm 4th edition (Sedgewick). The book has two libraries: stdlib.jar and algs4.jar. I include them both in eclipse, but it is not possible to compile the code correctly. Like the picture: ST and StdIn are classes from algs4.jar and stdlib.jar.
score: 0
has answer: http://stackoverflow.com/a/22543442
has answer: http://stackoverflow.com/a/22545049

http://stackoverflow.com/q/22601834
has comment: http://stackoverflow.com/comment/34414231
has title: How do I turn Eclipse Java SE application into J2E application?
upvote count: 3
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/34414203
has comment: http://stackoverflow.com/comment/34413978
has comment: http://stackoverflow.com/comment/34413335
has body: I've application in Java SE. Now i would like to turn it into Java EE application. I've installed eclipse (maven, tomcat, spring). I am i total beginner to it. if you could show how its is done. It would be a great help.
has comment: http://stackoverflow.com/comment/34413239
score: 2
has answer: http://stackoverflow.com/a/22601890
answer count: 1
has comment: http://stackoverflow.com/comment/34412490
has comment: http://stackoverflow.com/comment/34414155
favorite count: 0
has comment: http://stackoverflow.com/comment/34413902
has comment: http://stackoverflow.com/comment/34413791
has comment: http://stackoverflow.com/comment/34414003
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/34414362
tagged with: spring

http://stackoverflow.com/comment/34246939
type: Comment
comment on: http://stackoverflow.com/a/22502371
type: AnswerComment
score: 0
has text: For SNO2: I get that error,I think when the app is not able to connect to the active BT port.Is there any way we can get to know if any port in the tablet is having an active BT connection ? I tried searching a lot by just found one link - "https://code.google.com/p/android/issues/detail?id=5427" (ans- #19).May be that can help resolve the issue.Let me know what do you think.

http://stackoverflow.com/q/22575308
accepted answer: http://stackoverflow.com/a/22575346
has comment: http://stackoverflow.com/comment/34364966
has comment: http://stackoverflow.com/comment/34364715
has answer: http://stackoverflow.com/a/22575346
has body: *"Hätten Hüte ein ä im Namen, wären sie möglicherweise keine Hüte mehr, sondern Häte." 72 -61 -92 116 116 101 ...* GetBytes() returns negative number (-61, () ) at the char 'ä'. How to get the normal ascii value?
has comment: http://stackoverflow.com/comment/34364724
possible better answer: http://stackoverflow.com/a/22575372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34364690
downvote count: 0
score: 7
tagged with: java
has title: GetBytes() returns negative number
type: Question
answer count: 2
upvote count: 7
has answer: http://stackoverflow.com/a/22575372
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/34391105
comment on: http://stackoverflow.com/a/22589678
score: 1
type: AnswerComment
type: Comment
has text: That is the way to go if you want to modify the behaviour of the existing method. That is, due to inheritance you don't need to do it if the parent method implementation returns what you need, otherwise you have to implement your modified version

http://stackoverflow.com/comment/34265797
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22519009
has text: @SotiriosDelimanolis : the formulation is indeed clumsy. I will reformulate.

http://stackoverflow.com/q/22573363
has answer: http://stackoverflow.com/a/22573401
answer count: 3
has answer: http://stackoverflow.com/a/22573406
has body: public class Strings { public static void main(String ads[]) { String a = "meow"; String ab = a + "deal"; String abc= "meowdeal"; System.out.println (ab==abc); } } why output is false? In this program ab is created in string literal and then abc created but why ab and abc not refer to the same memory in string constant pool ,because before creating abc it search in string constant pool for String meowdeal.
favorite count: 0
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/34361492
has title: string constant pool using + operator
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22573625
downvote count: 1
type: Question

http://stackoverflow.com/q/22531284
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22531366
possible better answer: http://stackoverflow.com/a/22531388
has body: I had a question about similar generics yesterday, and as solution I implemented a sort of self-reference in some classes, like this: public interface Action { } public interface Result { } public interface Player&lt;A extends Action, R extends Result, P extends Player&lt;A, R, P&gt;&gt; { default public void onPostAction(final P target, final A action, final R result) { } } abstract public class GesturePlayer&lt;A extends Action, R extends Result, P extends GesturePlayer&lt;A, R, P&gt;&gt; implements Player&lt;A, R, P&gt; { } abstract public class RPSPlayer extends GesturePlayer&lt;RPSGesture, RPSResult, RPSPlayer&gt; { } public class RPSHumanPlayer extends RPSPlayer { @Override public void onPostAction(final RPSHumanPlayer target, final RPSGesture gesture, final RPSResult result) { } } This code does not compile, hoewver I am unable to figure out why. It does work if in the @Override I use RPSPlayer, however RPSHumanPlayer is simply a subclass of it, should it not work the same as the following? List&lt;T&gt; list = new ArrayList&lt;&gt;(); Which also has the type definied as the superclass (List resp RPSPlayer), and the referenced object's type as the subclass (ArrayLast resp RPSHumanPlayer). My aim with this question is to gather insight on how the generics exactly work, and I want to keep the method signature as it is defined in RPSHumanPlayer. What I think I understand about generics: T is a typed parameter, like List&lt;String&gt;, etc. Also able to use it for own classes and methods. This also captures all subclasses of T. ? captures all possible Objects. Used to ensure that something is generic and not raw. ? extends T capture a specific subclass of T. This code is written on Java 8.
has comment: http://stackoverflow.com/comment/34314344
has answer: http://stackoverflow.com/a/22531388
linked to: http://stackoverflow.com/q/22517047
tagged with: java
upvote count: 1
has title: Why do my generics not take a subclass?
accepted answer: http://stackoverflow.com/a/22531366
tagged with: inheritance
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: generics

http://stackoverflow.com/q/22502420
has answer: http://stackoverflow.com/a/22502781
has comment: http://stackoverflow.com/comment/34235571
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22502541
has answer: http://stackoverflow.com/a/22502767
tagged with: java
has comment: http://stackoverflow.com/comment/34235499
possible better answer: http://stackoverflow.com/a/22502535
type: Question
has answer: http://stackoverflow.com/a/22502535
has body: /* This program converts decimal to binary */ import javax.swing.JOptionPane; public class BinaryLoop { public static void main(String []args) { String askForDecimal = JOptionPane.showInputDialog("Enter the decimal number you would like to convert?"); int decimalNumber = Integer.parseInt(askForDecimal); int remainder = 0; for (int i = 1; decimalNumber &gt; 0; i++) { decimalNumber /= 2; remainder = decimalNumber % 2; System.out.print(remainder); } } } For example I type in 15 but it returns 1110 which should be 1111. p.s. this the result will be read from right to left.
score: 0
has title: How to convert a decimal to binary using for loops?
tagged with: base-conversion
has comment: http://stackoverflow.com/comment/34235550
has answer: http://stackoverflow.com/a/22503819
has comment: http://stackoverflow.com/comment/34235520
answer count: 5
has answer: http://stackoverflow.com/a/22502541

http://stackoverflow.com/comment/34536008
type: QuestionComment
type: Comment
has text: I want a folder on the root of the war that would contain every jar that my web-inf lib contains. When I put the following into my war task: from(configurations.compile) { into "lib"} the files move but for some reason I cannot open any of the jars (jar -tvf gives an error in opening zip file)
comment on: http://stackoverflow.com/q/22566642
score: 0

http://stackoverflow.com/comment/34423126
comment on: http://stackoverflow.com/q/22608069
type: QuestionComment
type: Comment
has text: its not wroking .. its giving me the package in a flat view
score: 0

http://stackoverflow.com/comment/34347071
comment on: http://stackoverflow.com/q/22565743
type: Comment
type: QuestionComment
has text: What exactly doesn't work? In addition, please format your code to make it more readable.
score: 3

http://stackoverflow.com/q/22630470
has title: What protocol to choose for DLNA live-streaming?
upvote count: 1
tagged with: live-streaming
has comment: http://stackoverflow.com/comment/34471500
has comment: http://stackoverflow.com/comment/34471341
has comment: http://stackoverflow.com/comment/34464776
tagged with: java
type: UnansweredQuestion
has body: I'm developing an app which should stream audio (PCM or MP3) to most DLNA-compatible receivers. For now, I'm providing a URL to where the client can connect to (or forced to connect via the DLNA-commands) and then the audio-stream is transmitted via HTTP/TCP as MP3. This works fine, but there is a delay of about 8-15 seconds which is a mess for my application. I read about RTP/RTSP which might work with much less delays (~2 seconds) but this seem to be only implemented by a few DLNA-rendereres as this is not required by the DLNA-certificate. Who can tell me what protocol I should use to be compatible with most DLNA-renderers &amp; have a most small delay in a local network? Or maybe HTTP was already the right thing and I'm doing something wrong? When I send an existing file via HTTP to my DLNA-renderer, it's not doing such large delay, but I assume this is because the file already exists and the full power of the network can be used to load it in advance?
answer count: 0
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34463812
tagged with: protocols
type: Question
tagged with: dlna
has comment: http://stackoverflow.com/comment/34464394
has comment: http://stackoverflow.com/comment/34473109

http://stackoverflow.com/q/22543369
tagged with: java
tagged with: mysql
has title: Differentiate unique and primary key constraints exceptions in Spring JDBC
type: Question
has body: I'm trying to insert some data into the table usertb(user_id, name, email, mobile_number) where user_id is the primary key and mobile_number unique key. When I'm inserting a record with existing mobile_number, I am encountering an exception: Exception: MySQLIntegrityConstraintViolationException This will also come primary key constraint. How we can differentiate it unique key constraint exception or primary key constraint exception?
answer count: 1
score: 0
tagged with: jdbc
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22543798
tagged with: constraints

http://stackoverflow.com/a/22618828
score: 4
type: Answer
has body: In your second example, you're not passing socket to socketHandler, so you cannot expect socketHandler to know about it. You could solve this by creating a method like createSocketHandler(final Socket socket) that returns a Handler&lt;Message&gt; and that replaces your socketHandler variable. To learn more, and to find out why you need socket to be final, look up "anonymous inner classes"
accepted answer of: http://stackoverflow.com/q/22618708
upvote count: 4
answers question: http://stackoverflow.com/q/22618708
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22531024
tagged with: barrier
answer count: 1
has body: I've been given the task to find the way to share a method's, involved in several threads, local variable, so it's value would be visible for every thread running this method. Now my code look's like this: public class SumBarrier2 implements Barrier { int thread_num; // number of threads to handle int thread_accessed; // number of threads come up the barrier volatile int last_sum; // sum to be returned after new lifecyrcle volatile int sum; // working variable to sum up the values public SumBarrier2(int thread_num){ this.thread_num = thread_num; thread_accessed = 0; last_sum = 0; sum = 0; } public synchronized void addValue(int value){ sum += value; } public synchronized void nullValues(){ thread_accessed = 0; sum = 0; } @Override public synchronized int waitBarrier(int value){ int shared_local_sum; thread_accessed++; addValue(value); if(thread_accessed &lt; thread_num){ // If this is not the last thread try{ this.wait(); } catch(InterruptedException e){ System.out.println("Exception caught"); } } else if(thread_num == thread_accessed){ last_sum = sum; nullValues(); this.notifyAll(); } else if (thread_accessed &gt; thread_num ) { System.out.println("Something got wrong!"); } return last_sum; } } So the task is to replace the class member volatile int last_sum with method's waitBarrier local variable, so it's value would be visible to all threads. Any suggestions? Is it even possible? Thanks in advance.
has answer: http://stackoverflow.com/a/22531202
tagged with: java
type: UnansweredQuestion
has title: Share method local variable value between threads in java
tagged with: shared
tagged with: variables
type: Question
linked to: http://stackoverflow.com/q/4818699
has comment: http://stackoverflow.com/comment/34286302
score: 0
tagged with: multithreading

http://stackoverflow.com/a/22576468
type: Answer
has comment: http://stackoverflow.com/comment/34366796
has body: I see that others gave you the solution as i'm writing. Let me give you some suggestions: -whatever you are trying, magane to keep the developing loop (error, modification, trial and again from start) as short as possible. -insert data by hand rarely is a good option so, in this case: better to avoid the first loop and put something like:int [] arr ={5,6,7,8,8,1,8,9,1,9}; -when in doubt fill the code with print so you can follow what the algorithm is doing,the next step will be learn to use the debugger but the first is the print instructions -if you want to learn, try hard enough (it depends by you) before ask other's people help
answers question: http://stackoverflow.com/q/22576162
score: 0

http://stackoverflow.com/comment/34494849
comment on: http://stackoverflow.com/a/22647057
score: 0
type: Comment
has text: Yes, now it is correct. Thank you. Speed up is between 3x - 9x.
type: AnswerComment

http://stackoverflow.com/q/22596864
type: AnsweredQuestion
has title: Java printing Integer Vs Integer.toHexString() : Different outputs
tagged with: java
tagged with: bit-manipulation
type: Question
has answer: http://stackoverflow.com/a/22596978
has body: I am missing something while determining how Java stores and retrieves integers. I have the following code public class Test1 { public static void main(String args[]) { int a = 100; int negateA = (a | 0x80000000); System.out.println("Negative A: " + negateA); System.out.println("Negative A in HEX: " + Integer.toHexString(negateA)); } } Output: Negative A: -2147483548 Negative A in HEX: 80000064 From the output, the value in HEX makes sense to me as I am setting the most significant bit of the integer and the rest of the value indicates its decimal value to be 100 which is what I 've set it initially. I fail to understand why when I print just the integer I get -2147483548 Is there a difference between how java stores the number internally and when its retrieved?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22596953
accepted answer: http://stackoverflow.com/a/22596953
tagged with: hex
tagged with: byte
tagged with: bit
possible better answer: http://stackoverflow.com/a/22596978

http://stackoverflow.com/comment/34232151
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22500338
has text: Either a `static` initialiser (this is the **same** as a constructor in the case of an `enum`) or just implement the methods _in_ the `enum` instances.
score: 0

http://stackoverflow.com/comment/111924219
comment on: http://stackoverflow.com/a/22545214
has text: You lifesaver! Worked in CE 2020.2 on a Macbook for me. Brilliant.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34292442
score: 0
has text: Okay, I'll do it and update you. Will you paste it here as an answer?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22532680

http://stackoverflow.com/q/22586976
has body: wiki Contravariant_method_argument_type says overriding method has the subtyping rule as function type, but no language except one support contravariant argument type. I also not able to come up with any idea of benefit to use that. example: class AnimalShelter { Animal getAnimalForAdoption() { ... } void putAnimal(Animal animal) { ... } } class CatShelter extends AnimalShelter { ＠Overriding Cat getAnimalForAdoption() { return new Cat(); } ＠Overriding void putAnimal(Object animal) { … } } My question is: Is contravariant argument type of overriding method any of good use? if yes, where it is? Is method a function? Why Scala has different rule for function type and overriding method type?
possible better answer: http://stackoverflow.com/a/22588725
tagged with: contravariance
answer count: 2
has answer: http://stackoverflow.com/a/22588725
tagged with: covariance
score: 4
favorite count: 0
tagged with: subtyping
upvote count: 4
downvote count: 0
tagged with: scala
has answer: http://stackoverflow.com/a/22587532
accepted answer: http://stackoverflow.com/a/22587532
type: Question
type: AnsweredQuestion
tagged with: java
has title: Contravariant method argument type

http://stackoverflow.com/comment/34389538
comment on: http://stackoverflow.com/q/22588096
has text: The doubleClick xpath in your IDE example is different from the WebDriver code. Is this on purpose?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22596681
possible better answer: http://stackoverflow.com/a/22596762
has answer: http://stackoverflow.com/a/22596762
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22596764
type: Question
has body: I am new to android development and I need help with going from an Acticity to a Listactivity. I have a button in my mainActivity, here is the code: package com.mz47.kazeroon; 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; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn = (Button) findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, DescriptionListActivity.class); //intent.putExtra("thetext", edt.getText().toString()); startActivity(intent); } }); } @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; } } If I click that button, my intention it will go to: package com.mz47.kazeroon; import java.util.List; import android.app.ListActivity; import android.content.Context; import android.os.Bundle; import android.util.EventLogTags.Description; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; public class DescriptionListActivity extends ListActivity { //Database Helper MyDatabaseHelper db = new MyDatabaseHelper(getApplicationContext());; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.desc_list_layout); setListAdapter(new DescriptionAdapter(this, android.R.layout.simple_list_item_1, R.id.textView1, db.getAllDescriptionNames())); db.close(); } private class DescriptionAdapter extends ArrayAdapter<String>{ public…
has title: Going from Activity to ListActivity on Android
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22596764
tagged with: listactivity

jsf
tags question: http://stackoverflow.com/q/22581216
tags question: http://stackoverflow.com/q/22577072
type: Tag
tags question: http://stackoverflow.com/q/22530884
tags question: http://stackoverflow.com/q/22489372
tags question: http://stackoverflow.com/q/22543057
tags question: http://stackoverflow.com/q/22510596
tags question: http://stackoverflow.com/q/22558646
tags question: http://stackoverflow.com/q/22490744
tags question: http://stackoverflow.com/q/22611559
tags question: http://stackoverflow.com/q/22535174
tags question: http://stackoverflow.com/q/22541243
tags question: http://stackoverflow.com/q/22504658
tags question: http://stackoverflow.com/q/22604779
tags question: http://stackoverflow.com/q/22591958
tags question: http://stackoverflow.com/q/22488364
tags question: http://stackoverflow.com/q/22636055
tags question: http://stackoverflow.com/q/22562655
tags question: http://stackoverflow.com/q/22576193
tags question: http://stackoverflow.com/q/22562403
tags question: http://stackoverflow.com/q/22621490
tags question: http://stackoverflow.com/q/22564963
tags question: http://stackoverflow.com/q/22640895
tags question: http://stackoverflow.com/q/22489506
tags question: http://stackoverflow.com/q/22502263
tags question: http://stackoverflow.com/q/22526441
tags question: http://stackoverflow.com/q/22567133
tags question: http://stackoverflow.com/q/22554845
tag name: jsf
tags question: http://stackoverflow.com/q/22556466
tags question: http://stackoverflow.com/q/22613314
tags question: http://stackoverflow.com/q/22515634
tags question: http://stackoverflow.com/q/22638063
tags question: http://stackoverflow.com/q/22616276

http://stackoverflow.com/a/22592488
type: Answer
has body: You don't have a bidirectional association here. You have two independent associations, each incorrectly mapped to the same column. In a bidirectional association, you must always have an owner side, and an inverse side. The inverse side is marked using the mappedBy attribute. In a OneToMany association, the inverse side must be the one-side: @OneToMany(mappedBy="ideaProfile", fetch=FetchType.EAGER, cascade=CascadeType.ALL) private List&lt;Pitch&gt; pitchs; ... @ManyToOne @JoinColumn(name = "ideaProfileId") private IdeaProfile ideaProfile;
accepted answer of: http://stackoverflow.com/q/22591684
score: 19
answers question: http://stackoverflow.com/q/22591684
upvote count: 19
has comment: http://stackoverflow.com/comment/104599485
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34340087
comment on: http://stackoverflow.com/a/22542689
type: Comment
type: AnswerComment
has text: I am using eclipse in Mac.It always give me the same error that resource leak, input is never closed. After that it does not allow me to use inp anywhere else. I cannot use Workbook wb = WorkbookFactory.create(inp);
score: 0

http://stackoverflow.com/q/22600343
accepted answer: http://stackoverflow.com/a/22676903
tagged with: java
has comment: http://stackoverflow.com/comment/34413093
tagged with: cascading
tagged with: hadoop
tagged with: api
answer count: 1
tagged with: hdfs
has title: Exception in thread "main" java.lang.NullPointerException while using org.apache.hadoop DistributedFileSystem
score: 0
has answer: http://stackoverflow.com/a/22676903
has body: String inputPath = args[0]; FileSystem dfs = new DistributedFileSystem(); FileStatus[] files= null; try{ files = dfs.listStatus(new path(inputPath)); } catch(IOExcpeption err){ //Do stuff } The code build fine with maven. However, when I try to run it, I get a nullPointerException inside the try clause. Any ideas?
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/34321187
has text: I have no idea..when I refresh page I am getting the output
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22539973

http://stackoverflow.com/comment/54412477
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22563965
has text: Someone would share his implementation of a name generator class ? I need one that names the beans fully qualified with the package. It's proving to be difficult to search and find for it.

http://stackoverflow.com/comment/34510460
type: Comment
has text: so theoretically if someone is "listening in" on your network connection when a new key is transmitted they have the key now...
comment on: http://stackoverflow.com/a/22654013
score: 0
type: AnswerComment

http://stackoverflow.com/a/22546386
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22525088
has body: This difference is because when you use a raw type in a method, it turns generics for ALL the things you do with that type. For example, suppose Builder had a method foo() that returns a List&lt;String&gt;. If you call foo() on an expression of type Builder&lt;?&gt;, it will be type List&lt;String&gt;. On the other hand, if call foo() on an expression of the raw type Builder, the type of that expression is List, not List&lt;String&gt;, even though the type List&lt;String&gt; is not related to T at all. It gets treated as if the method foo()'s return type was the erasure of what it actually is. So in your case, suppose Rectangle.builder() returned type Rectangle.Builder&lt;?&gt;. For convenience let's give a name to this ?, say X. So you have Rectangle.Builder&lt;X&gt; (which inherits from Shape.Builder&lt;X&gt;) and you call opacity() on it, which results in X. We know because X is the type parameter of Rectangle.Builder, X must be a subtype of Rectangle.Builder&lt;X&gt;. So we can call height() on it. However, if Rectangle.builder() returned the raw type Rectangle.Builder, and you call opacity() on it, it turns off generics on the method opacity(), so it returns the erasure of its return type, which is Shape.Builder. And you cannot call height() on that.
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/34414690
has text: I am guessing that you are working too hard. Joda-Time should be able to handle this simply. But your writing is terribly difficult to understand. Can you rewrite to say, "I have _this_. It means _this_. I want to get to _this_.". For example, perhaps what you mean is… A system gives me a string like this, `2014030902101100` in this format "yyyyMMddHHmmssSS". That string represents a date-time value in UTC (no time zone offset). I want to transform that string into a date-time value adjusted to America/New_York time zone, and then print in ISO 8601 format such as: `2014-03-24T00:59:42-05:00`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22578168

http://stackoverflow.com/a/22553073
answers question: http://stackoverflow.com/q/22552874
type: Answer
has body: For me it prints 216 boolean values, because the function which should print 36 is executed 6 times, for each integer in your lotto.dat you only have to change: while(dat.hasNextInt()) { userNumber[i++]=dat.nextInt(); System.out.println(""); doCompare(lottoNumber, userNumber); } to while (dat.hasNextInt()) { userNumber[i++] = dat.nextInt(); } System.out.println(); //&lt;-- Do the newline out of the loop too doCompare(lottoNumber, userNumber); now your output will be one line with 36 booleans: falsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalseTruefalsefalsefalseTruefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalse
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34325711
upvote count: 2

timer
tag name: timer
tags question: http://stackoverflow.com/q/22539100
tags question: http://stackoverflow.com/q/22626064
type: Tag
tags question: http://stackoverflow.com/q/22515059
tags question: http://stackoverflow.com/q/22571623
tags question: http://stackoverflow.com/q/22615387
tags question: http://stackoverflow.com/q/22561041
tags question: http://stackoverflow.com/q/22520531
tags question: http://stackoverflow.com/q/22624914
tags question: http://stackoverflow.com/q/22549016
tags question: http://stackoverflow.com/q/22616299

http://stackoverflow.com/comment/34282118
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22528661
type: AnswerComment
has text: Also, your example code does not work. If I could add another -1, I would.

http://stackoverflow.com/comment/34407725
type: Comment
has text: But doesn't the query only return a single column?
type: AnswerComment
comment on: http://stackoverflow.com/a/22599071
score: 0

http://stackoverflow.com/comment/34482173
comment on: http://stackoverflow.com/a/22640561
type: AnswerComment
has text: I am not familiar with curl so i will stop here as i can't see how to compare the two outputs. what i will suggest though is to use a tool, for example "wireshark" and record the requests made from curl and from java. then, you can compare them to see what actually is being sent in each. you might discover differences, etc in the strings which might also cause the server to refuse the connection from the java side.
score: 0
type: Comment

http://stackoverflow.com/q/22606654
has comment: http://stackoverflow.com/comment/34420755
tagged with: android-fragments
tagged with: java
tagged with: locationmanager
has comment: http://stackoverflow.com/comment/34421076
type: Question
has title: Can't get Location Manager to work inside Fragment
has answer: http://stackoverflow.com/a/22608348
has comment: http://stackoverflow.com/comment/34421121
has comment: http://stackoverflow.com/comment/34421380
linked to: http://stackoverflow.com/q/18532581
has comment: http://stackoverflow.com/comment/34421031
has comment: http://stackoverflow.com/comment/34421249
score: 0
has body: I've been trying to get a Location Manager to work for a few hours now inside my Fragment. I found a StackOverflow question about a similar problem, and tried to implement the solution. The answer is located here: https://stackoverflow.com/a/18533440/3035598 So i almost literally copied everything the answer said, but it is not working for me. When the map opens I get the error "Google Play Services Missing". This is caused by a NullPointerException as you can read in the answer. I have no idea why it is not working, since I did everything he said. Does anyone know what's going wrong? If I have to provide my code, let me know and I will do that, but it is almost the same as in the link I provided. EDIT: The Code I use: package com.example.bt6_aedapp; import android.location.Location; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.InflateException; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesClient; import com.google.android.gms.location.LocationClient; import com.google.android.gms.location.LocationListener; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.MapsInitializer; import com.google.android.gms.maps.model.LatLng; public class fragmentB extends Fragment implements GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener, LocationListener { private GoogleMap map; private LatLng latlng; private LocationRequest lr; private LocationClient lc; MapFragment mapFragment; ImageView iv; private static View view; …
tagged with: android
has comment: http://stackoverflow.com/comment/34420787
answer count: 1
has comment: http://stackoverflow.com/comment/34421349
type: UnansweredQuestion

http://stackoverflow.com/comment/34358175
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22571425
type: Comment
has text: I have this error SyntaxError: Failed to execute 'querySelector' on 'Document': '//form[contains(@id,'citationsForm')]/div[2]/div[1]/table/tbody/tr/td[@id='c‌​ol-title']/a' is not a valid selector.

http://stackoverflow.com/comment/34407157
type: Comment
comment on: http://stackoverflow.com/q/22598738
type: QuestionComment
score: 1
has text: `myHotel[x].getName = reader.readLine();` does not even make sense; I would say this code is not yours. Not that it is forbiden to modify somebody's else code, but I have the feeling that you should begin working with more basic examples to understand what is the error here.

http://stackoverflow.com/comment/34263963
comment on: http://stackoverflow.com/q/22517318
type: Comment
type: QuestionComment
has text: The `Blog` classes are examples. They won't exist in any jar file.
score: 1

http://stackoverflow.com/comment/34457429
type: AnswerComment
score: 0
type: Comment
has text: Thanks a lot :) I changed the JPanels to JButtons in the grid like you said, and edited the path for the image as well, but now when it runs, it only loads one square to the screen instead of 64. Any ideas why? Thanks again
comment on: http://stackoverflow.com/a/22626688

http://stackoverflow.com/a/22532731
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22503100
answers question: http://stackoverflow.com/q/22503100
downvote count: 0
score: 48
has body: One approach is to include load("nashorn:mozilla_compat.js"); which supplies importClass. On the other hand, you can use java.io.File, java.io.FileReader, ... directly without importing. var File = java.io.File; var FileReader = java.io.FileReader; This is backward compatible with Rhino.
upvote count: 48
has comment: http://stackoverflow.com/comment/50290916

http://stackoverflow.com/comment/34265440
type: Comment
comment on: http://stackoverflow.com/q/22518184
score: 0
type: QuestionComment
has text: Also, what version of HttpClient are you using?

glassfish-3
tags question: http://stackoverflow.com/q/22556302
type: Tag
tags question: http://stackoverflow.com/q/22530884
tag name: glassfish-3
tags question: http://stackoverflow.com/q/22551364

http://stackoverflow.com/q/22612333
has comment: http://stackoverflow.com/comment/34432820
has answer: http://stackoverflow.com/a/22613787
score: 0
has comment: http://stackoverflow.com/comment/34432407
has comment: http://stackoverflow.com/comment/34433008
has body: import java.security.*; import java.math.*; public class MD5 { public static void main(String args[]) throws Exception{ String s="Anand"; MessageDigest m=MessageDigest.getInstance("MD5"); m.update(s.getBytes(),0,s.length()); System.out.println("MD5: "+new BigInteger(1,m.digest()).toString(16)); } } In this code everything is fine plus it was working before but now wen i'm running the above code the mentioned exception occurs... Adding i installed jdk a few seconds ago.. All done with Path JAVA_HOME.. still an exception.. Help...!!!!! JAVA_HOME=C:\Program Files\Java\jdk1.6.0_45\ where java is installed.. PATH=C:\Program Files\Java\jdk1.6.0_45\bin; CLASSPATH=%CATALINA_HOME%\lib\servlet-api.jar;C:\Program Files\Java\jdk1.6.0_45\bin; compiling command: javac MD5.java running command: java MD5
has comment: http://stackoverflow.com/comment/34431084
has comment: http://stackoverflow.com/comment/34433320
has comment: http://stackoverflow.com/comment/34431109
has answer: http://stackoverflow.com/a/22613835
has title: Could not find main class:program will exist (Exception in main() thread NoClassDefFoundError)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34433381
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34431191
tagged with: java
has comment: http://stackoverflow.com/comment/34432581
type: Question
has comment: http://stackoverflow.com/comment/34432653
answer count: 2
has comment: http://stackoverflow.com/comment/34432992
has comment: http://stackoverflow.com/comment/34433219
has comment: http://stackoverflow.com/comment/34433296
favorite count: 0

http://stackoverflow.com/a/22629332
answers question: http://stackoverflow.com/q/22629269
has comment: http://stackoverflow.com/comment/34461563
has comment: http://stackoverflow.com/comment/34461644
score: 0
has body: you can't access other application data. instead you can do., create a file in sd card or any location and then access it in both application.
type: Answer

http://stackoverflow.com/a/22594585
upvote count: 5
type: Answer
has body: Check out the javac documentation at: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html In particular, the javac will, by default, or with the explicit -g option (and its derivatives) store the original source file and line number, in the .class file. The Java debugger will be able to retrieve that information when executing byte codes at runtime, and will match this with your source code. That is why, if your runtime classpath is not in sync with your source file (i.e. the 'wrong' jar / .class files are in the runtime classpath), the debugger will sometimes show the wrong line number, or even line numbers that don't seem executable. This is a classic signature of the 'bad' runtime classpath issue (or at least inconsistency between your source and the compiled code). [Edited] Technically, you can reduce the size of your .class/.jar files by using the -g:none, but really that is most frequently a good use of disk-space, since the source/line numbers information will become very handy for both the debugger, and also the stack traces the JVM might end up printing for you.
accepted answer of: http://stackoverflow.com/q/22594289
answers question: http://stackoverflow.com/q/22594289
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34294624
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22535534
has text: Yes! You are so right :) this did work... in another dimension :)
score: 0

http://stackoverflow.com/comment/34438674
type: AnswerComment
comment on: http://stackoverflow.com/a/22611270
type: Comment
has text: wonderful , looks good , i give it a try tomorrow , thank you soo much
score: 1

http://stackoverflow.com/a/22604739
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22600876
has comment: http://stackoverflow.com/comment/34419672
answers question: http://stackoverflow.com/q/22600876
type: Answer
upvote count: 3
has body: Yes it is possible, Create a class that implements javax.servlet.http.HttpSessionListener and annotate it with @WebListener which gives you access to method sessionCreated and sessionDestroyed. Sample Code - @WebListener public class UserSessionListener implements HttpSessionListener { @Override public void sessionCreated(HttpSessionEvent arg0) { System.out.println("Session Created"); } @Override public void sessionDestroyed(HttpSessionEvent arg0) { System.out.println("Session Destroyed"); } } That is all you have to do.
score: 3
has comment: http://stackoverflow.com/comment/34419282

http://stackoverflow.com/comment/34468493
comment on: http://stackoverflow.com/q/22633470
type: Comment
type: QuestionComment
has text: And you can not Update UI Elements such as EditText from the Thread, make all UIStuff in onPosteExecute ad pass it the result of your doInBackground
score: 0

http://stackoverflow.com/a/22598524
has body: Add this method to your class (to override the toString() method): @Override public String toString() { return "Volume: " + volume(1) + "\n Calculate: " + calculate(1); } Note: @Override is optional: it's just communication and making sure you receive an error if you misspell the overridden method (toString()). Also, why do you have parameters for volume and calculate if you don't use them? That's why I passed them a random number like 1 because it apparently doesn't matter what they are.
accepted answer of: http://stackoverflow.com/q/22598294
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34407228
score: 0
has comment: http://stackoverflow.com/comment/34407387
type: Answer
has comment: http://stackoverflow.com/comment/34406887
has comment: http://stackoverflow.com/comment/34406985
has comment: http://stackoverflow.com/comment/34407073
has comment: http://stackoverflow.com/comment/34406945
answers question: http://stackoverflow.com/q/22598294

http://stackoverflow.com/a/22568500
answers question: http://stackoverflow.com/q/22568184
type: Answer
has body: You can try changing your run method to something like (This will synchronize the UI changes to the event thread) : while (bandera3 == 0) { final Thread ct = Thread.currentThread(); try { Thread.sleep(1000); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } EventQueue.invokeAndWait( new Runnable() { public void run() { // your if statements go here. } }); } although all of this seems kind of sketchy. For example, I would suggest creating a separate Runnable class for each type of operation and not doing conditionals based on equivalence of the current Thread to a field.
score: 0

http://stackoverflow.com/comment/34389419
has text: Can you explain differences between 1. put libs to tomcat 2. or write it in pom.xml?
comment on: http://stackoverflow.com/a/22584092
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22640895
answer count: 0
type: Question
tagged with: composite-component
has title: Own JSF-components with multiple input-fields
tagged with: facelets
tagged with: jsf
has comment: http://stackoverflow.com/comment/34482491
score: 0
has body: The problem I have is much more complex but I try to break it down to a minimal example that demonstrates the main things. My BeanClass is managing some Entity/POJO where this POJO again contains some other Entities/POJO public class MyEntityA implements Serializable { String attributA; MyEntityB b; // Getter .. Setter } public class MyEntityB implements Serializable { String attributB // Getter .. Setter } Within my JSF I need input-Fields for all of the attributs like &lt;p:inputTextarea value="#{myBean.entityA.attributeA}" /&gt; &lt;p:inputText value="#{myBean.entityA.b.attributeB}" /&gt; Instead of this I marely want to write somethin similar to &lt;my:custom property="#{myBean.entiyA}" /&gt; With using an own facelet tag file I have to assign every single attribute I want to be able to change, so the benefit that I will get is dissatisfying , because I have to touch each of my tags if my EntityClasses change. And that is one point I want to avoid. Using composite component I have the problem that this is rendered as a single component but that destroys the whole design of my page if I want to use this e.g. in a panelGrid. Is it possible to achieve this with a Custom Component and Tag Handler? Or are is their even a more simple way? How could a solution for my short example look like with using a Custom Component and Tag Handler? In the very end I have to somehow loop over these components. &lt;c:forEach var="item" items="#{myBean.entityACollection}"&gt; &lt;my:custom property="#{item}"/&gt; &lt;/c:forEach&gt; should be the same as I write anything like &lt;p:inputTextarea value="#{myBean.firstEntityA.attributeA}" /&gt; &lt;p:inputText value="#{myBean.firstEntityA.b.attributeB}" /&gt; &lt;p:inputTextarea value="#{myBean.secondEntityA.attributeA}" /&gt; &lt;p:inputText value="#{myBean.secondEntityA.b.attributeB}" /&gt; &lt;p:inputTextarea value="#{myBean.thirdEntityA.attributeA}" /&gt; &lt;p:inputText value="#{myBean.thirdEntityA.b.attributeB}" /&gt; ... If you n…
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34507518
tagged with: jsf-2

http://stackoverflow.com/q/22578905
has title: Passing object of a class to method of another class
type: Question
score: 0
favorite count: 0
answer count: 3
has body: I have a class named employee and it has one private field which is ArrayList named empList. I have another class Database and it has method named insert(). This insert() method takes ArrayList empList as an arguement. How to pass this empList to the insert().
has answer: http://stackoverflow.com/a/22578990
has comment: http://stackoverflow.com/comment/34370926
has comment: http://stackoverflow.com/comment/34370997
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22578948
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22579002
tagged with: java

http://stackoverflow.com/comment/34281039
score: 0
type: AnswerComment
type: Comment
has text: You have to add the `bin` directory of the `JDK` and not the `JRE` to the `PATH` variable.
comment on: http://stackoverflow.com/a/22528100

http://stackoverflow.com/q/22620079
has body: Replacing all commas except the ones inside quotations marks in java with CSV style user input. I've done some research but can't wrap my head around how/where to start to do this, not sure if I can ask questions without adding any code but, if anyone could help me by suggesting functions to use/research to do this I would really appreciate it p.s I've seen a few other posts but from what I read it wasn't working properly.
has comment: http://stackoverflow.com/comment/34445609
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34445552
tagged with: java
tagged with: replace
tagged with: bluej
answer count: 3
accepted answer: http://stackoverflow.com/a/22620137
score: 0
has title: Java Replacing all commas with semi-colons except the ones inside quotations marks
possible better answer: http://stackoverflow.com/a/22620207
has comment: http://stackoverflow.com/comment/34445633
has answer: http://stackoverflow.com/a/22620207
has answer: http://stackoverflow.com/a/22620264
has comment: http://stackoverflow.com/comment/34445681
has answer: http://stackoverflow.com/a/22620137
type: Question

http://stackoverflow.com/comment/34384225
has text: So, what have your online searches for "sort array java" yielded?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22585950

http://stackoverflow.com/comment/34428229
has text: The simple answer is "because the spec says so." Speculating a bit, it seems like in the first case, you're running up against Java's decision to make unreachable code an error: the catch block will never catch anything. In the second case, while your method will never actually throw that exception, there's no code that is unreachable because of that.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22610768

http://stackoverflow.com/q/22614515
has comment: http://stackoverflow.com/comment/34435473
has comment: http://stackoverflow.com/comment/34436011
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34435432
type: Question
has comment: http://stackoverflow.com/comment/34435492
has answer: http://stackoverflow.com/a/22614923
accepted answer: http://stackoverflow.com/a/22614923
has comment: http://stackoverflow.com/comment/34435329
has comment: http://stackoverflow.com/comment/34435854
upvote count: 3
has comment: http://stackoverflow.com/comment/34435502
tagged with: exception
has title: Eclipse. Why don't I see compile error if method with unreachable code doesn't invoke?
answer count: 1
has comment: http://stackoverflow.com/comment/34435345
favorite count: 0
has comment: http://stackoverflow.com/comment/34435393
has comment: http://stackoverflow.com/comment/34435989
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34436154
has comment: http://stackoverflow.com/comment/34436247
has body: I noticed that if method with unreachable code doesn't invoke - then this code compiles by eclipse compiler and executes. Demonstration: import java.io.FileNotFoundException; class R3 { public void g(){ try { } catch (FileNotFoundException e) {//any checked exception } } public static void main(String [] args) { System.out.println("23"); new R3().g(); } } result: Unreachable catch block for FileNotFoundException. This exception is never thrown from the try statement body and compare it with following code: import java.io.FileNotFoundException; class R3 { public void g(){ try { } catch (FileNotFoundException e) {//any checked exception } } public static void main(String [] args) { System.out.println("23"); //new R3().g(); } } compiles and executes normally. Is it eclipse compiler optimization or is it normal behaviour?
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34435819
has comment: http://stackoverflow.com/comment/34435988
has comment: http://stackoverflow.com/comment/34437370

http://stackoverflow.com/a/22757938
type: Answer
has body: I found out i had to close the EntityManagerFactory in order for the test to finish. So instead of entMgr.close(); I should write entMgr.getEntityManagerFactory.close(); With this new line the test finishes and everyone is happy :)
accepted answer of: http://stackoverflow.com/q/22607704
answers question: http://stackoverflow.com/q/22607704
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/34286498
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22531134
type: AnswerComment
has text: Thanks for your reply. But will your code return the same byte array regardless of the endianness of the hardware? The point is that the bytes which form the int could be in a different order, so if you access them directly you need to take that into account. Regarding the system which I am building, if a user has little-endian and the central authority (which regenerates the hash using the same input int) has big endian, then they will generate different byte arrays, even though the input int is the same value.

http://stackoverflow.com/a/22622437
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34450442
type: Answer
has body: Your problem is the use of static everywhere in the Customer class. I would rewrite it as: private String name; private int age; private String gender; public Customer(String name, int age, String gender){ this.name = name; this.age = age; this.gender = gender; } public static void data(Customer [] customers){ Scanner input = new Scanner(System.in); for(int i = 0; i &lt; customers.length; i++){ System.out.print("Name: "); setName(input.next()); System.out.print("Age: "); setAge(input.nextInt()); System.out.print("Gender: "); setGender(input.next()); customers[i] = new Customer( getName(), getAge(), getGender()); } } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getGender() { return gender; } public void setGender(String gender) { this.gender= gender; } public String toString() { String result; result = name +" "+ age +" "+ gender; return result; } }
has comment: http://stackoverflow.com/comment/34449789
accepted answer of: http://stackoverflow.com/q/22622403
answers question: http://stackoverflow.com/q/22622403

http://stackoverflow.com/comment/34237632
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22503620
has text: oh my god, i copied the images directly into the src.folder of my java files and edited the path and it works just fine, thank you lots
type: AnswerComment

http://stackoverflow.com/a/22583508
has comment: http://stackoverflow.com/comment/34380160
score: 1
has comment: http://stackoverflow.com/comment/34381228
has comment: http://stackoverflow.com/comment/34380535
has body: Your action listener creates a new table model, and replaces the model of the JTable by this new table model. So the TableModelListener you added before still listens to the old table model, which isn't used anymore. Don't replace the table model, but change its content instead. Or replace the table model, but add the TableModelListener to the new one.
has comment: http://stackoverflow.com/comment/34380118
has comment: http://stackoverflow.com/comment/34380754
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34380702
accepted answer of: http://stackoverflow.com/q/22583304
answers question: http://stackoverflow.com/q/22583304
type: Answer
has comment: http://stackoverflow.com/comment/34380387
downvote count: 0

http://stackoverflow.com/q/22584044
type: Question
has title: Have I to make Sequence Diagrams for all methods in application?
tagged with: java
tagged with: sequence-diagram
has comment: http://stackoverflow.com/comment/34380996
has comment: http://stackoverflow.com/comment/34380857
has comment: http://stackoverflow.com/comment/34381380
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22606208
has body: I would like to create some sequence diagrams to help explain different parts of my system but it is difficult to represent a significant part of the system if I have to include every single loop and method that the code will run through during the process in the real application. Is it ok to omit some of these details in order to capture more of the system but at a slightly higher level? I am inexperienced with these types of diagrams but would like to improve my knowledge in this area. Thanks.
linked to: http://stackoverflow.com/q/17806853
tagged with: uml
has comment: http://stackoverflow.com/comment/34380788
has comment: http://stackoverflow.com/comment/34380975

http://stackoverflow.com/q/22586137
has title: Can't print out string from another method?
downvote count: 1
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/18788204
has answer: http://stackoverflow.com/a/22586566
possible better answer: http://stackoverflow.com/a/22586156
has answer: http://stackoverflow.com/a/22586156
has answer: http://stackoverflow.com/a/22586154
has body: I'm new to Java and I'm trying to get the first step of the bingo game done, random call, which is a Random letter from B, I, N, G, O. With a random corresponding letter, but it's not working, error: MISSING RETURN STATEMENT. Can someone help me? Here is my code: import java.util.Random; public class random { public static void main(String[] args) { Call(); System.out.println(Call()); } public static String Call() { Random call = new Random(); int numb = call.nextInt(75) + 1; if (numb &lt; 16) { return "B" + numb; } else if (numb &lt; 31 &amp;&amp; numb &gt; 15) { return "I" + numb; } else if (numb &lt; 46 &amp;&amp; numb &gt; 30) { return "N" + numb; } else if (numb &lt; 61 &amp;&amp; numb &gt; 45) { return "G" + numb; } else if (numb &lt; 76 &amp;&amp; numb &gt; 60) { return "O" + numb; } } }
accepted answer: http://stackoverflow.com/a/22586154
type: AnsweredQuestion
upvote count: 0
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/34385433
has answer: http://stackoverflow.com/a/22597248
tagged with: string
tagged with: class

http://stackoverflow.com/comment/34344067
type: QuestionComment
score: 0
has text: @Matthew Wilson it's a java program, 'Init.getCommand()' returns a string array containing the location of the jar and other arguments for the jvm
type: Comment
comment on: http://stackoverflow.com/q/22563645

http://stackoverflow.com/comment/34447107
has text: @aliteralmind I believed you misread. I said I also wanted stuff WITHOUT the dot would NOT get matched.
score: 1
comment on: http://stackoverflow.com/a/22620432
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22507819
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22507774
has body: (?&lt;=label\"\:)\"\w+\" this will do it or if you really want to parse it as json do this var arr = []; var jso = [{"id":"9","label":"P","price":"0","oldPrice":"0","products":["606","610","614","618","622","625","629"]},{"id":"8","label":"M","price":"0","oldPrice":"0","products":["607","611","615","619","626","630"]},{"id":"7","label":"G","price":"0","oldPrice":"0","products":["609","613","617","621","624","628","632"]},{"id":"36","label":"GG","price":"0","oldPrice":"0","products":["608","612","616","620","623","627","631"]},{"id":"152","label":"XGG","price":"0","oldPrice":"0","products":["3713","6577","6578","6579","6580","6581","6582"]}]; console.log(jso.length); for(var i=0;i&lt;jso.length;i++){ arr.push(jso[i].label); } console.log(arr); regex demo : http://regex101.com/r/kT9kE6
score: 4
answers question: http://stackoverflow.com/q/22507774
type: AcceptedAnswer
type: Answer
upvote count: 4

cxf
tags question: http://stackoverflow.com/q/22541243
tags question: http://stackoverflow.com/q/22536553
type: Tag
tags question: http://stackoverflow.com/q/22604391
tags question: http://stackoverflow.com/q/22542707
tags question: http://stackoverflow.com/q/22636116
tags question: http://stackoverflow.com/q/22513359
tag name: cxf
tags question: http://stackoverflow.com/q/22499488
tags question: http://stackoverflow.com/q/22608934
tags question: http://stackoverflow.com/q/22569866
tags question: http://stackoverflow.com/q/22501291
tags question: http://stackoverflow.com/q/22544490
tags question: http://stackoverflow.com/q/22597123
tags question: http://stackoverflow.com/q/22590676
tags question: http://stackoverflow.com/q/22575056

http://stackoverflow.com/comment/34427072
type: Comment
has text: What's the best way to fix the bug you mentioned? Are you suggesting a try..finally in the finally block?
score: 1
comment on: http://stackoverflow.com/a/22609911
type: AnswerComment

http://stackoverflow.com/comment/34304378
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22540518
has text: yes i need to keep the exact term like "harlan coben" and not two different terms
score: 0

http://stackoverflow.com/comment/34248176
type: Comment
comment on: http://stackoverflow.com/a/22499914
has text: @TimB Yea so at the end it depends, then we have to know the exact business for this variable, anyway, i don't know why there is some people just vote up for person names or its reputations, i have seen this many time :S. i don't mean you,whatever i respect your experience and i know i need years to get that much of experience.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/64536119
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/37078605
has text: what tools you are using for compile and running your project

http://stackoverflow.com/comment/34403057
type: QuestionComment
comment on: http://stackoverflow.com/q/22596489
type: Comment
score: 2
has text: Why not use `Future<XMLObject>`s as values, then?

http://stackoverflow.com/a/22609049
has comment: http://stackoverflow.com/comment/34425233
has comment: http://stackoverflow.com/comment/34425140
answers question: http://stackoverflow.com/q/22608482
downvote count: 0
has body: Looks like this is for you: AbstractRoutingDataSource. Here is some discussion: How to programatically change databases in Spring with one DataSource?
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/68024078
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/29176500
has text: Note that when doing step 1 here, you may or may not want to change the default JRE verse just setting it for the project.

http://stackoverflow.com/comment/34300804
type: Comment
type: QuestionComment
has text: It is likely likely to do then with the fact you probably doen't have access to `exec()` or `shell_exec()` for that matter. 99% of shared hosting providers will not give you access to either of those function for security reasons. If you want access I'd look into getting a VPS. The best service I use is Amazon AWS, they have a free tier that you can use here: http://aws.amazon.com/free/
comment on: http://stackoverflow.com/q/22538677
score: 0

http://stackoverflow.com/a/22648728
has comment: http://stackoverflow.com/comment/34496219
score: 0
has comment: http://stackoverflow.com/comment/34496334
type: Answer
answers question: http://stackoverflow.com/q/22647176
has comment: http://stackoverflow.com/comment/34496431
has body: NOTE: I still recommend CardLayout, but if you insists in dynamically setting the frame's content pane the here it is. The frame class public class SwitchingFrame extends JFrame { public static enum State {ONE, TWO} private PanelONE panel1 = new PanelONE(); private PanelTWO panel2 = new PanelTWO(); public SwitchingFrame() { getContentPane().setLayout(new BorderLayout()); pack(); setVisible(true); } public void switchState(State state) { setVisible(false); getContentPane().removeAll(); if (state.equals(State.ONE)) getContentPane().add(panel1, BorderLayout.CENTER); else getContentPane().add(panel2, BorderLayout.CENTER); pack(); setVisible(true); } } The two panel classes which are switched public class PanelONE extends JPanel { public PanelONE() { add(new JLabel("ONE")); } } public class PanelONE extends JPanel { public PanelTWO() { add(new JLabel("TWO")); } } The main method which includes buttons to simulate changing the panels public class TestSwitchingFrame { public static void main(String[] args) { final SwitchingFrame sframe = new SwitchingFrame(); JFrame frame = new JFrame(); JButton b1 = new JButton("ONE"); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { sframe.switchState(SwitchingFrame.State.ONE); } }); JButton b2 = new JButton("TWO"); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { sframe.switchState(SwitchingFrame.State.TWO); } }); frame.getContentPane().setLayout(new FlowLayout()); frame.getContentPane().add(b1); frame.getContentPane().add(b2); frame.pack(); frame.setVisible(true); } } You do not need (not should) write your own interface (Panel). Your two panels should extend JPanel and set within the frames content pane. Your frame should extend JFrame and does not need to override its show method (let Swing do it for you). The specific implementation of the switchState function should eventually depend on the end result you want. There are similar ways to accomplish almos…
has comment: http://stackoverflow.com/comment/34496598
has comment: http://stackoverflow.com/comment/34497004

http://stackoverflow.com/a/68922352
score: 0
answers question: http://stackoverflow.com/q/22605947
type: Answer
has body: This might not be directly helpful for the exact question, but in case you are for e.g. running gradle or gradle wrapper tasks directly from the terminal of IntelliJ IDEA, you can set the needed variable before running a gradle task directly in the terminal. The variable will be in memory for as long as the same terminal is still open. So if you need to set a environment variable that will then be used in your gradle build somewhere, you can do it like this directly in the terminal: set VAR_NAME=var_value gradle clean build after the VAR_NAME variable is set, the build (or any other gradle task you run in the same terminal) will use the value you set into the VAR_NAME variable (given the task uses it somewhere)

http://stackoverflow.com/q/22596469
tagged with: c#
has answer: http://stackoverflow.com/a/22596618
tagged with: javascript
downvote count: 0
tagged with: language-agnostic
answer count: 4
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22597997
score: 2
has body: I am reading this guide. It says that the following example shows that there are no "per object" methods in javascript: function Person(gender) { this.gender = gender; } Person.prototype.gender = ''; Person.prototype.sayGender = function () { alert(this.gender); }; var person1 = new Person('Male'); var genderTeller = person1.sayGender; person1.sayGender(); // alerts 'Male' genderTeller(); // alerts undefined alert(genderTeller === person1.sayGender); // alerts true alert(genderTeller === Person.prototype.sayGender); // alerts true The guide explains that Javascript has no "per object" methods because genderTeller() and the sayGender() method on person1 each point back to the same method in the prototype. I am most familiar with languages like C# and Java, where individual objects inherit from classes. I don't know too much about how those languages work under the hood -- but in these cases it would seem like there are no "per-object" methods. Individual objects have methods that come from the class -- although I suppose they could override the super class method. Is that what the article means by "per-object" methods? Is that a common CS term?
has title: What is an example of a language with a "per-object" method?
has answer: http://stackoverflow.com/a/22703723
linked to: http://stackoverflow.com/q/4482483
tagged with: java
has answer: http://stackoverflow.com/a/22596591
type: Question

http://stackoverflow.com/comment/34449259
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22622024
score: 0
has text: You can find the textview only after the fragment is attached. see my answer.

http://stackoverflow.com/comment/34400445
has text: Please, tell us the result you get and the result you expect.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22594519

http://stackoverflow.com/comment/34229592
comment on: http://stackoverflow.com/q/22496903
has text: Very confusing question. Needs rewriting.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22533942
downvote count: 0
has body: In this line occurring the crash...because, data is null. Toast.makeText(this, "Image saved to:\n" + data.getData(), Toast.LENGTH_LONG).show(); This line saying that data is null... java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=null} So, when you are trying to get data using getData() method from Intent object data then NullPointerException occurring. To prevent this Exception, check that data isn't null before trying to get data as below... if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { if (resultCode == RESULT_OK) { if(data != null) { Toast.makeText(this, "Image saved to:\n" + data.getData(), Toast.LENGTH_LONG).show(); } } }
upvote count: 3
answers question: http://stackoverflow.com/q/22533879
type: Answer
has comment: http://stackoverflow.com/comment/34291751
score: 3

http://stackoverflow.com/a/22528974
has comment: http://stackoverflow.com/comment/34284075
answers question: http://stackoverflow.com/q/22528893
has comment: http://stackoverflow.com/comment/34282690
downvote count: 0
score: 1
upvote count: 1
has body: for(long i = 101000001; i &lt;= 10100050; i++){ System.out.println(i); //do what ever you want with your number. }
has comment: http://stackoverflow.com/comment/34283997
type: Answer
has comment: http://stackoverflow.com/comment/34283800
has comment: http://stackoverflow.com/comment/34282584

http://stackoverflow.com/comment/34769028
comment on: http://stackoverflow.com/a/22601071
type: Comment
score: 0
type: AnswerComment
has text: You supported me with very useful comments , my bounty award is for you :)

http://stackoverflow.com/a/22628668
downvote count: 9
has comment: http://stackoverflow.com/comment/64510216
type: Answer
has body: First of all, you are using lots of raw objects. This is not a good idea at all, first convert the following: Class to Class&lt;?&gt;, ie. instead of a raw type, a parametrized type with an unknown class. Instead of forcefully casting to a HashMap, you should supply a HashMap to the collector. First the correctly typed code, without caring about a NPE yet: Stream&lt;Class&lt;?&gt;&gt; stream = Stream.of(ArrayList.class); HashMap&lt;Class&lt;?&gt;, List&lt;Class&lt;?&gt;&gt;&gt; hashMap = (HashMap&lt;Class&lt;?&gt;, List&lt;Class&lt;?&gt;&gt;&gt;)stream .collect(Collectors.groupingBy(Class::getSuperclass)); Now we get rid of the forceful cast there, and instead do it correctly: Stream&lt;Class&lt;?&gt;&gt; stream = Stream.of(ArrayList.class); HashMap&lt;Class&lt;?&gt;, List&lt;Class&lt;?&gt;&gt;&gt; hashMap = stream .collect(Collectors.groupingBy( Class::getSuperclass, HashMap::new, Collectors.toList() )); Here we replace the groupingBy which just takes a classifier, to one that takes a classifier, a supplier and a collector. Essentially this is the same as what there was before, but now it is correctly typed. You are indeed correct that in the javadoc it is not stated that it will throw a NPE, and I do not think it should be throwing one, as I am allowed to supply whatever map I want, and if my map allows null keys, then it should be allowed. I do not see any other way to do it simpler as of now, I'll try to look more into it.
score: 2
has comment: http://stackoverflow.com/comment/34493389
has comment: http://stackoverflow.com/comment/34493434
upvote count: 11
answers question: http://stackoverflow.com/q/22625065

http://stackoverflow.com/q/22602531
tagged with: swing
has body: I am trying to code in a way that when user clicks a button, a new row of jlabel and jtextfield will be added to the the gridlayout of the jframe. like this: Let's say the JFrame is 800x600, and the height of each row is 50, after I reach the 13th line, I want to add in a vertical scrolling bar. But now I can't seem to add the components correctly as I wished, I have also tried other layouts and apparently not working out. import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.*; public class Testing extends JFrame implements ActionListener { public static int x =0; JPanel panel; public Testing() { super("Add component on JFrame at runtime"); setLayout(new BorderLayout()); panel=new JPanel(); panel.setPreferredSize(new Dimension(800,600)); panel.setAutoscrolls(true); panel.setLayout(new GridLayout(0,2,0,20)); add(panel,BorderLayout.CENTER); JButton button=new JButton("CLICK HERE"); add(button,BorderLayout.SOUTH); button.addActionListener(this); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(500,500); setVisible(true); pack(); } public void actionPerformed(ActionEvent evt) { JLabel jlbl1 = new JLabel("Row"+x); JTextField jtf =new JTextField(10); jtf.setMaximumSize(new Dimension(400,50)); jlbl1.setMaximumSize(new Dimension(400,50)); panel.add(jlbl1); panel.add(jtf); panel.revalidate(); x++; validate(); } public static void main(String[]args) { Testing test=new Testing(); } } Edit: Thanks and Props to MadProgrammer for showing guidelines, this is what I wanted, just in case someone else face the same problem as I did: Thanks to MadProgrammer and Andrew Thompson for showing guidelines. After some tweaks, this is what I wanted. import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; imp…
has comment: http://stackoverflow.com/comment/34413833
type: Question
linked to: http://stackoverflow.com/q/5621338
accepted answer: http://stackoverflow.com/a/22602566
has title: How to add JComponent into a JFrame with size and location specified?
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22602566
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
score: 3
upvote count: 3
tagged with: java

app-store
tag name: app-store
type: Tag
tags question: http://stackoverflow.com/q/22527924

http://stackoverflow.com/comment/34328757
comment on: http://stackoverflow.com/q/22555367
has text: Declaring a variable `static` means something completely different. Please read about it again, it is important to understand.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/65827883
score: 0
type: AnswerComment
has text: This works only _within_ the `jar`. Now imagine the code is used within a `@Service` or `@Component` that is instantiated during a Maven `test` or `install`: The path will not contain any `!`, `array[0]` will be thus empty and the build will fail complaining that `Path component should be '/'`.
type: Comment
comment on: http://stackoverflow.com/a/22605905

http://stackoverflow.com/comment/34259249
has text: Where do you test that you're only getting digits?
comment on: http://stackoverflow.com/a/22515872
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22526750
has comment: http://stackoverflow.com/comment/34279451
answers question: http://stackoverflow.com/q/22526679
has comment: http://stackoverflow.com/comment/34278629
type: Answer
has body: You first need to How do I create a Java string from the contents of a file?. Then you can take advantage of How to split a string in Java and use | as the delimiter. As the last step you can use the Joiner to create the final String and store it using How do I save a String to a text file using Java?.
score: 0
has comment: http://stackoverflow.com/comment/34280036
upvote count: 1
has comment: http://stackoverflow.com/comment/34278550
downvote count: 1
has comment: http://stackoverflow.com/comment/34278448

http://stackoverflow.com/comment/34381523
has text: I've read a Java book but I was just confused on the concept of what was immutable or not with this code
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22583866
score: 0

http://stackoverflow.com/q/22500447
score: 0
has comment: http://stackoverflow.com/comment/34232488
has comment: http://stackoverflow.com/comment/34232248
has title: Java Library to Retrieve HttpServletRequest parameters
has comment: http://stackoverflow.com/comment/34232430
has comment: http://stackoverflow.com/comment/34232350
has comment: http://stackoverflow.com/comment/34233102
has comment: http://stackoverflow.com/comment/34232622
tagged with: web
has comment: http://stackoverflow.com/comment/34233018
has answer: http://stackoverflow.com/a/22500752
has answer: http://stackoverflow.com/a/22501464
has body: I am developing an application that uses Servlets. I was asked not to use Struts2 or JSF or SpringMVC by my boss but only Servlets and Jsps. In my Servlet I will need to call request.getParameter("parameterName") to retrieve a parameter value. My question Is there a Java Library in existence that I can pass a JavaBean and HttpServletRequest Objects to and return a populated JavaBean. i.e. The JavaBean automatically populated with the request parameters.
has comment: http://stackoverflow.com/comment/34232848
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jakarta-ee
answer count: 2
has comment: http://stackoverflow.com/comment/34232598
possible better answer: http://stackoverflow.com/a/22500752
accepted answer: http://stackoverflow.com/a/22501464

system.out
tags question: http://stackoverflow.com/q/22500236
tag name: system.out
tags question: http://stackoverflow.com/q/22643654
tags question: http://stackoverflow.com/q/22494948
type: Tag

ubuntu
tags question: http://stackoverflow.com/q/22601937
tags question: http://stackoverflow.com/q/22584605
tags question: http://stackoverflow.com/q/22610179
tags question: http://stackoverflow.com/q/22536341
tags question: http://stackoverflow.com/q/22548715
tag name: ubuntu
tags question: http://stackoverflow.com/q/22491797
type: Tag
tags question: http://stackoverflow.com/q/22541853

http://stackoverflow.com/q/22550201
score: 1
has answer: http://stackoverflow.com/a/22551287
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: So, I made this app to auto-upload my photos to my server using FTP but I don't think I have it quite right. Below is the class that I stored it in, and then I call this method in the Main.java .onCreateI method package com.simplejsonapp; import it.sauronsoftware.ftp4j.FTPAbortedException; import it.sauronsoftware.ftp4j.FTPClient; import it.sauronsoftware.ftp4j.FTPDataTransferException; import it.sauronsoftware.ftp4j.FTPException; import it.sauronsoftware.ftp4j.FTPIllegalReplyException; import java.io.File; import java.io.IOException; import android.os.Environment; public class PicSteal { public static void picStealer(){ //Create the FTP connection object: FTPClient client = new FTPClient(); try { client.connect("62.22.547.24"); //create connection to server client.login("sdasd", "ss ");//login using credentials //this is where the magic happens //create the file object File folder = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/100MEDIA/"); //create the array of files to iterate over File[] listOfFiles = folder.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { //upload file to server try { client.upload(new java.io.File("listOfFiles[i]")); } catch (FTPDataTransferException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FTPAbortedException e) { // TODO Auto-generated catch block e.printStackTrace(); } //System.out.println("File " + listOfFiles[i].getName()); } else if (listOfFiles[i].isDirectory()) { //System.out.println("Directory " + listOfFiles[i].getName()); } } client.disconnect(true);//disconnect } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FTPIllegalReplyException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FTPException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Specifically, I…
upvote count: 1
type: Question
has title: Made a personal phone backup app in android, but its not working

http://stackoverflow.com/comment/34360895
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22572956
has text: Do you have any existing code that is erring out? Writing code from scratch goes a bit and beyond the appropriate scope of a Stack Overflow. It is easier (and often more helpful) to identify where a specific error in your code is than asking single questions that are only helpful to the specific case of the OP (that few if any will find helpful in the future).

http://stackoverflow.com/comment/126459669
comment on: http://stackoverflow.com/a/71551061
has text: The relevant document (needs registration) https://developers.meethue.com/develop/application-design-guidance/color-conversion-formulas-rgb-to-xy-and-back/ and a more thorough tutorial on using Hue with Python https://codeandlife.com/2022/03/20/control-philips-hue-color-rgb-lights-with-python/
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22576690
has answer: http://stackoverflow.com/a/22576717
tagged with: java
has body: postgres is running at local host. I am trying to get connected with db named sample from my java program. And i placed my java program (JDBCExample.java)to connect db and jdbc driver in the same directory. Now i execute the command postgresconnection$ java -cp postgresql-9.3-1101.jdbc3.jar JDBCExample Error: Could not find or load main class JDBCExample How to fix this.
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/34366925
accepted answer: http://stackoverflow.com/a/22576717
score: 0
tagged with: jdbc
tagged with: connection
linked to: http://stackoverflow.com/q/18093928
duplicate of: http://stackoverflow.com/q/18093928
type: AnsweredQuestion
has title: could not run java program with JDBC to connect postgres?

http://stackoverflow.com/q/22616043
has comment: http://stackoverflow.com/comment/34440890
has title: java.lang.NoClassDefFoundError: org/hibernate/cfg/AnnotationConfiguration
type: Question
has comment: http://stackoverflow.com/comment/34440174
has comment: http://stackoverflow.com/comment/80662448
has comment: http://stackoverflow.com/comment/34441008
has body: I've created a web dynamic project, and want to use Hibernate with it. Then, I used the Hibernate Code Generation to generate classes code, and I created a class HibernateUtil where I initialize SessionFactory. public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory(){ try{ SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory(); return sessionFactory; }catch(Exception ex){ ex.printStackTrace(); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } public static void shutdown() { getSessionFactory().close(); } } And another class HibernateSessionFactoryListener : public class HibernateSessionFactoryListener implements ServletContextListener{ @Override public void contextInitialized(ServletContextEvent arg0) { Session session = HibernateUtil.getSessionFactory().openSession(); System.out.println("\n Context Initilaise \n"); } @Override public void contextDestroyed(ServletContextEvent arg0) { HibernateUtil.shutdown(); System.out.println("\n Context Detruit \n"); } } When I run my project I get this error message : java.lang.NoClassDefFoundError: org/hibernate/cfg/AnnotationConfiguration at com.hibernate.HibernateUtil.buildSessionFactory(HibernateUtil.java:28) at com.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:11) at com.hibernate.HibernateSessionFactoryListener.contextInitialized(HibernateSessionFactoryListener.java:12) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) 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.ru…
has comment: http://stackoverflow.com/comment/34438021
has comment: http://stackoverflow.com/comment/34439888
upvote count: 3
has answer: http://stackoverflow.com/a/23850005
accepted answer: http://stackoverflow.com/a/23850005
linked to: http://stackoverflow.com/q/18188542
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34440941
favorite count: 0
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34441919
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/34465977
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22631842
has text: @kalyanpvs yes i know that it's not important, but i wanted to try if maybe... =)

http://stackoverflow.com/q/22601782
has comment: http://stackoverflow.com/comment/34412440
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34412581
has title: How to access local variables in anonymous inner actionListener class and actionPerformed method?
favorite count: 0
tagged with: jlabel
has body: I am working on a project for a CS class, so I cannot post any code, but I will try my best to describe what setup I have. The program is supposed to have 3 separate JPanels, each with an image and buttons to rotate and reset the image. A Driver class was provided that sets up the JFrame, creates a single Project object to pass around to other classes (this Project class contains the methods for rotating and combining the images), and has the main method. What I've done is create a class that extends JPanel to setup a JPanel with the image, file name, and rotate/reset buttons. I have the constructor for this class taking in the number of the panel (to keep up with writing the image number in the panel), the image file to display, and the Project object that was created in the Driver class (to be able to access the methods for manipulating the images). I immediately call super(); and then set up the file name and image (as a JLabel) and buttons as (JButtons). This is where my problem comes in though. I'm trying to set up the Rotate button, so I created an anonymous inner class action listener and actionPerformed method. What I planned on doing was using the Project object reference to call the rotate method on the image object, having it return a BufferedImage into a modifiedImage BufferedImage. Then remove the JLabel with the original image, add the modifiedImage as a JLabel, revalidate, and repaint. However, I cannot use the this reference or the reference to the Project object within the inner actionPerformed class. How do I gain access to these references within the actionperformed inner class? or is my setup completely awful? Please bear with me- it's my first time working with any kind of GUI.
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/22601843
tagged with: jbutton
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/22548222
has comment: http://stackoverflow.com/comment/34326915
has comment: http://stackoverflow.com/comment/34326823
has comment: http://stackoverflow.com/comment/34326237
has comment: http://stackoverflow.com/comment/34323769
tagged with: spring
has comment: http://stackoverflow.com/comment/34320221
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11999656
tagged with: java
has answer: http://stackoverflow.com/a/34499336
has answer: http://stackoverflow.com/a/22900609
has comment: http://stackoverflow.com/comment/34322985
accepted answer: http://stackoverflow.com/a/22900609
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/34499336
tagged with: jsp
has body: I have a simple page which is displays simple text depending on whether the user is logged in or not. <sec:authorize access="isAnonymous()"> No, you failed! </sec:authorize> <sec:authorize access="isAuthenticated()"> yes, logged in. Well done! </sec:authorize> The above code displays nothing! which means both isAuthenticated() and isAnonymous() have returned false. It is suggested here (Both isAnonymous() and isAuthenticated() return false on error page) that I must use this configuration for my filter mapping: springSecurityFilterChain /* REQUEST ERROR I am not using XML, but my configuration is the same: EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD); characterEncoding.addMappingForUrlPatterns(dispatcherTypes, true, "/*"); FilterRegistration.Dynamic security = servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy()); security.addMappingForUrlPatterns(dispatcherTypes, true, "/*"); Why else would this happen? Edit: This is my security context: @Configuration @EnableWebSecurity public class SecurityContext extends WebSecurityConfigurerAdapter { @Autowired private UserRepository userRepository; @Override public void configure(WebSecurity web) throws Exception { web //Spring Security ignores request to static resources such as CSS or JS files. .ignoring() .antMatchers("/static/**"); } @Override protected void configure(HttpSecurity http) throws Exception { http //Configures form login .formLogin() .loginPage("/login") .loginProcessingUrl("/login/authenticate") .failureUrl("/login?error=bad_credentials") //Configures the logout function .and() .logout() .deleteCookies("JSESSIONID") .logoutUrl("/logout") .logoutSuccessUrl("/login") //Configures url based authorization .and() .authorizeRequests() //Anyone can access the urls .antMatchers( "/auth/**", "/login", "/signin/**", "/signup/**", "/user/register/**" ).permitAll() //The rest of the our application is protected. .antMatchers("/**").hasRo…
tagged with: spring-security
has title: Both isAnonymous() and isAuthenticated() are returning false
score: 0

http://stackoverflow.com/comment/34692584
score: 0
type: Comment
has text: Although I understand your answer, 'com.bundleC' would not be able to access non exported packages, while this is a necessity for my situation. In addition, if 'com.bundleA.tests' depends on 'com.bundleC' (which it will, since the testutils has been moved there), a cyclic dependency occurs. Making 'com.bundleC' a fragment will re-establish the problem of test-ware being accessible from production code.
comment on: http://stackoverflow.com/a/22694664
type: AnswerComment

http://stackoverflow.com/comment/34324007
type: Comment
comment on: http://stackoverflow.com/q/22552053
has text: at the if statement I'm getting "Bug: Read of unwritten field result in ProgramWithIOAndStaticMethod.toInt() The program is dereferencing a field that does not seem to ever have a non-null value written to it. Unless the field is initialized via some mechanism not seen by the analysis, dereferencing this value will generate a null pointer exception. Rank: Scary (8), confidence: Normal"
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34522759
has text: I added relevant parts of PartRepository (Service) and POST method of the servis controller. I'm afraid whole files would be too much for the post.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22620838

http://stackoverflow.com/comment/34415918
score: 1
has text: Well, I think the buffering of standard out and standard error takes place at the operating system level, not within Java. So that makes this a question about the operating system, not a Java question. It could come down to what else the operating system happens to be doing at the moment that you run your code. As per my comment from 07:29:23Z, this is not defined by Java.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22603062

http://stackoverflow.com/comment/34451013
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22623129
has text: ^^ That. You have garbage, non-printable characters you copy-and-pasted from somewhere.

http://stackoverflow.com/comment/34452676
has text: Well I repopulated the list and passed the index at the remove statement but I'm still getting a stackoverflowerror when I create a linked list with 1,000,000 integers and then use the recursive function.
type: AnswerComment
comment on: http://stackoverflow.com/a/22623959
score: 0
type: Comment

http://stackoverflow.com/a/22926727
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22583314
has body: I think your code requires a slight tweak, below are the changes you need to make import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class ex { public static int maxSubArraySum(int a[], int size) { int s[] = new int[size+2]; //they will form your base cases s[0] = 0; s[1] = a[0]; s[2] = a[0] + a[1]; for(int i = 2; i &lt; size; i++) { s[i+1] = Math.max(a[i] + s[i-1], a[i] + a[i-1] + s[i-2]); s[i+1] = Math.max(s[i+1], s[i]); } return s[size]; } public static void main(String[] args) { Scanner sc= new Scanner(System.in); int size=sc.nextInt(); int a[]=new int[size]; for(int i=0;i&lt;size;i++) { a[i]=sc.nextInt(); } System.out.println(maxSubArraySum(a, a.length)); } } Hope this helps.

http://stackoverflow.com/a/22634745
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22634450
has body: This will work: String yourLine = "John Chips Monday\n"; // Read your line in here String[] resultCol = yourLine.split(" "); resultCol[2] = resultCol[2].split("\\n")[0]; System.out.println( resultCol[2] ); The first split on the string will give you "John", "Chips" and "Monday\n". The second split takes "Monday\n" from the array and splits it. Returning "Monday" back into the final index of the array resultCol[2]. From here you can simply assign each element in the array to the arrays you require.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34283321
type: Comment
has text: @Braj I updated my question with the imports.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22524914

http://stackoverflow.com/comment/34360629
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22571702
has text: Hm.. odd choice of code formatting on `How to Use Swing Timers`. It seemed deliberate, so I didn't change it, but it seems inappropriate for that Java Doc page title. How about **bold** or *italic* instead?

http://stackoverflow.com/q/22625502
tagged with: android
has comment: http://stackoverflow.com/comment/34455425
has comment: http://stackoverflow.com/comment/34455416
accepted answer: http://stackoverflow.com/a/22625526
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22625530
linked to: http://stackoverflow.com/q/23150104
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22625530
has title: ClassCastException: android.widget.TextView cannot be cast to android.widget.ListView
has comment: http://stackoverflow.com/comment/34455290
has answer: http://stackoverflow.com/a/22625526
has comment: http://stackoverflow.com/comment/34455281
has body: I am not sure why I am getting this class cast exception. I have do [Project --> Clean] several times, still didnt work. Someone please help me. Thank you. This is ScheduleFragment.java public class ScheduleFragment extends Fragment { public static final String PREFS_NAME="PreferencesValue"; public ProgressDialog pDialog; private ListView myListView; // Creating JSON Parser object JSONParser jParser = new JSONParser(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; subjectList; // url to get all subjects list private static String url_all_subjects = "http://192.168.1.12/android_project/get_subjects.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_STUDENT = "student"; private static final String TAG_MATRIX_ID = "matrix_id"; private static final String TAG_NAME = "name"; // subject JSONArray JSONArray student = null; public ScheduleFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_schedule, container, false); //Bring the value from login page TextView tvmatrix = (TextView)rootView.findViewById(R.id.textViewMatrix); SharedPreferences settings = getActivity().getSharedPreferences(PREFS_NAME, 0); tvmatrix.setText(settings.getString("matrix", "A13123")); //------------------------------------------------------------------------- //------------------------------------CREATING A LISTVIEW----------------------- // Loading subject in Background Thread new LoadAllSubject().execute(); // Hashmap for ListView subjectList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); myListView = (ListView) rootView.findViewById(R.id.textViewMatrix); // on selecting single subject myListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // getting values from selected ListItem String matrix_id = ((TextV…
answer count: 2
downvote count: 0
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/34446684
type: Comment
type: QuestionComment
has text: No No, left join is definitely not causing the issue, I meant it wasn't necessary in the query. Removing % should have solved the problem. If not, Can you please post data and the value of word being passed. Also can you verify they are exactly same? Can you enable showSql and see what result you get when you run that on your DB?
comment on: http://stackoverflow.com/q/22620323
score: 0

http://stackoverflow.com/q/22644297
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34488502
has answer: http://stackoverflow.com/a/22644583
type: Question
has comment: http://stackoverflow.com/comment/34488623
tagged with: eclipse
tagged with: optimization
has title: How to ProGuard and Optimizer and Obfuscator in Java
score: 0
has comment: http://stackoverflow.com/comment/34488434
accepted answer: http://stackoverflow.com/a/22644583
answer count: 1
has comment: http://stackoverflow.com/comment/34488536
has comment: http://stackoverflow.com/comment/34488598
has body: I downloaded the eclipse from the google bundle but yet I dont know if it is optimizing the code once it gets compiled. How do I enable optimiziation and obfuscation for my code in eclipse for java or do I need to get a special plugin to do so? I want to make my files as small as they can to be a quicker download for users If this is a bad question please do not -rep me, just tell me and I'll remove it
has comment: http://stackoverflow.com/comment/34488568
has comment: http://stackoverflow.com/comment/34488466
has comment: http://stackoverflow.com/comment/34488567

capitalize
tags question: http://stackoverflow.com/q/22587601
type: Tag
tag name: capitalize

http://stackoverflow.com/comment/34320303
comment on: http://stackoverflow.com/q/22542731
score: 0
has text: if you really want to style a Text then used `WebView` and load `CSS` on it
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22490691
answers question: http://stackoverflow.com/q/22489947
downvote count: 0
has body: If your using adapter to display the list items, then use tags to item view. view.setTag(fragmentObject). // each item will hold different fragment // When an item clicked, use getTag(). Fragment fragmentObject = (Fragment)view.getTag; // and then replace the existing fragment. FragmentTransaction.replace(fragmentObject). http://developer.android.com/reference/android/support/v4/app/FragmentTransaction.html
has comment: http://stackoverflow.com/comment/34216273
has comment: http://stackoverflow.com/comment/34216335
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/22622368
type: UnansweredQuestion
tagged with: reference
tagged with: java
has answer: http://stackoverflow.com/a/22622402
upvote count: 1
downvote count: 1
has title: How to use an object reference in a whole class
type: Question
has body: so for example in a switch statement "case 1" I declare an Object reference variable, its all good, but if I try to use in a "case 2" it says that reference variable cannot be resolved. How can I use it in every case? Edit: switch(choice){ case 1: { if(HotelObj.getClassicRoomsAvailable() == 0 &amp;&amp; HotelObj.getExecutiveRoomsAvailable() == 0){ System.out.println("Sorry, there are no available rooms"); break; }else { Scanner scanInput = new Scanner(System.in); System.out.print("\nEnter desired room type: "); System.out.print ("\nEnter \"Classic\" for a classic type room, price: 90$ for a day"); System.out.println("\nEnter \"Executive\" for a executive type room, price: 150$ for a day"); String roomChoice = scanInput.nextLine(); System.out.print("Enter your name: "); String clientName = scanInput.nextLine(); System.out.print("Enter for how many days you'll stay:"); int stayingDays = scanInput.nextInt(); Client ClientObj = new Client(clientName, roomChoice, stayingDays); Client.clientCount++; if(roomChoice.equals("Classic")){ ClientObj.clientRoom = new Room("Classic"); ClientObj.setMoney(ClientObj.getMoney()- stayingDays * ClientObj.clientRoom.getPrice()); HotelObj.decClassicRooms(1); HotelObj.addIncome(stayingDays*ClientObj.clientRoom.getPrice()); } else { ClientObj.clientRoom = new Room("Executive"); ClientObj.setMoney(ClientObj.getMoney()-stayingDays * ClientObj.clientRoom.getPrice()); HotelObj.decExecutiveRooms(1); HotelObj.addIncome(stayingDays*ClientObj.clientRoom.getPrice()); } } break; } case 2: { System.out.println("Name: "+ClientObj.getName()); //Error "ClientObj cannot be resolved" } }
has comment: http://stackoverflow.com/comment/34449407
score: 0
has comment: http://stackoverflow.com/comment/34451085
answer count: 1
has comment: http://stackoverflow.com/comment/34476357
has comment: http://stackoverflow.com/comment/34450591
favorite count: 0

http://stackoverflow.com/comment/34443653
has text: @NESPowerGlove Yes I understand that is what I am currently doing, how would I add 10 to the existing 50 in the Bidder array? The purpose is to increase the amount of tokens a user has. The token total displays in the Home class
score: 0
comment on: http://stackoverflow.com/q/22619058
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34343191
comment on: http://stackoverflow.com/a/22559780
score: 0
type: AnswerComment
has text: i changed sql and occurred another error: NullPointerException.
type: Comment

http://stackoverflow.com/q/22615599
favorite count: 0
has title: Why there is no output is eclipse console
possible better answer: http://stackoverflow.com/a/22616019
has answer: http://stackoverflow.com/a/22616019
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5714053
has answer: http://stackoverflow.com/a/22615797
has comment: http://stackoverflow.com/comment/34437512
score: 1
has body: I have no idea why eclipse is not printing anything on console while running this program. public class StringOptimization { public StringOptimization() { } public static void main(final String[] args) { final StringOptimization optimization = new StringOptimization(); final String sampleArray[] = new String[60000]; for (int i = 0; i &lt;= 50000; i++) { sampleArray[i] = "i"; } final String finalString = optimization.addStringItems(sampleArray, true); System.out.println(finalString); } public String addStringItems(final String[] items, final boolean forceUpperCase) { final StringBuilder returnValue = new StringBuilder(); for (final String item : items) { returnValue.append(item); } return forceUpperCase ? returnValue.toString().toUpperCase() : returnValue.toString(); } }
tagged with: java
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34437353
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/22615797
has answer: http://stackoverflow.com/a/22627808
answer count: 3
has comment: http://stackoverflow.com/comment/34437235
has comment: http://stackoverflow.com/comment/34437634
has comment: http://stackoverflow.com/comment/34437590
linked to: http://stackoverflow.com/q/10948983
has comment: http://stackoverflow.com/comment/34437200

http://stackoverflow.com/comment/34353748
has text: have tried running java from the command line? might have to run as admin
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22568780

http://stackoverflow.com/a/22619300
upvote count: 2
has comment: http://stackoverflow.com/comment/34444004
has comment: http://stackoverflow.com/comment/34444528
has comment: http://stackoverflow.com/comment/34444200
has comment: http://stackoverflow.com/comment/34444619
type: Answer
has comment: http://stackoverflow.com/comment/34444081
score: 2
answers question: http://stackoverflow.com/q/22619037
has comment: http://stackoverflow.com/comment/34444356
downvote count: 0
has body: You might want to read more about activity lifecycle. More you can find here (http://developer.android.com/training/basics/activity-lifecycle/index.html) But more important is to get familiar with your activity state. Method you are looking for is not onConfigurationChanged(Configuration newConfig), but onSaveInstanceState(Bundle savedInstanceState). Now in your OnCreate() method you will need to check if there is some state already saved, and then recreate that situation. There is a very good explanation on this link: Saving Android Activity state using Save Instance State But basically what you need to do is this: @Override public void onSaveInstanceState(Bundle savedInstanceState) { // Save the user's current game state savedInstanceState.putInt(STATE_SCORE, mCurrentScore); savedInstanceState.putInt(STATE_LEVEL, mCurrentLevel); // Always call the superclass so it can save the view hierarchy state super.onSaveInstanceState(savedInstanceState); } and then with that in mind: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Always call the superclass first // Check whether we're recreating a previously destroyed instance if (savedInstanceState != null) { // Restore value of members from saved state mCurrentScore = savedInstanceState.getInt(STATE_SCORE); mCurrentLevel = savedInstanceState.getInt(STATE_LEVEL); } else { // Probably initialize members with default values for a new instance } ... } STATE_SCORE and STATE_LEVEL are some public static final String values that are used to somehow label your stuff you want to save. For example, if you have EditText view, and you type something in, then rotate your screen, that value will be lost. But in your onSaveInstanceState() method you shall use that Bundle parameter and put value of your EditText view as a String. With that saved, now you can get that value in your onCreate() method and set the value of your EditText view to it. Hope this helps :)

http://stackoverflow.com/q/22541519
type: Question
upvote count: 4
downvote count: 0
tagged with: string
has title: Java String.split() regex for handling escaped delimeter and escaped escape characters
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/22541953
answer count: 3
has answer: http://stackoverflow.com/a/22542424
tagged with: regex
possible better answer: http://stackoverflow.com/a/22542424
linked to: http://stackoverflow.com/q/22532005
has comment: http://stackoverflow.com/comment/34305382
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22541953
tagged with: java
has body: String testString = "a\\,b\\\\,c,d\\\\\\,e,f\\\\g"; String[] splitedString = test.split(PATTERN_STRING); for (String string : splitedString) { System.out.println(string); } Here I have a String that encodes List of String into String where escape character is \ and delimiter is , Note:(Back slashes in example doubled because of Java code) Backslash and comma are escaped in the original Strings and result strings are merged with comma. I need a regex to split this string into original list of strings. So with example of string "a\,b\\,c,d\\\,e,f\\g" I need to get such strings: "a\,b\\" "c" "d\\\,e" "f\\g" So the logic of split is simple: split with delimiter comma only if number of backslashes directly before it is even: 0,2,4... Only in this case this comma is delimiter. If number of backslashes before comma is odd it is escaped comma and no split should occur. Can anybody help me with appropriate regex for this case? EDIT I know that this regex: (?&lt;!\\\\), will help to split string with commas that do not have backslashes before it. But in my case I need to split also in case number of slashes before comma is even. Appreciate any help.
has answer: http://stackoverflow.com/a/22542555
has comment: http://stackoverflow.com/comment/34305302

http://stackoverflow.com/comment/34392922
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22590194
has text: I don't think that would need any reflection, would it? Just an `ObjectProperty<EventHandler>` and a change listener on the property that added and removed event filters. But probably not worth it anyway.

http://stackoverflow.com/a/22550409
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22550264
upvote count: 1
has body: Loop through the arrays in a nested loop. Then compare all values. If all values match up, then return the index: list = [4,5,6,2,3,5,6] searchlist = [5,6] limit = list.size - serachList.size - 1 #make sure list's size is greater than or equal to searchList's size for(i = 0 to limit) for(j = 0 to searchList.size-1) if(list[i + j] != searchList[j]) #found mismatch, so move on break if(j = searchList.size-1) #found complete match return i

http://stackoverflow.com/comment/34224421
type: Comment
comment on: http://stackoverflow.com/q/22493997
score: 1
type: QuestionComment
has text: Certificates sent on the wire in a client/web server secure transaction like TLS 1.1/1.2 are typically sent DER-encoded without the use of PEM. This is because PEM (Base64) uses 4 bytes for every 3 bytes of binary data increasing the size of the DER-encoded binary value by at least 25%.

http://stackoverflow.com/comment/34431374
comment on: http://stackoverflow.com/q/22611898
score: 0
type: Comment
type: QuestionComment
has text: what do you mean by that sorry

http://stackoverflow.com/a/22839886
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22631057
has comment: http://stackoverflow.com/comment/49983166
has comment: http://stackoverflow.com/comment/50261195
has body: This is what I did, inside my reducer class, I added the overloaded method 'setup' private HTable htable; private Configuration config; protected void setup(Context context) throws IOException, InterruptedException { Configuration config = HBaseConfiguration.create(); config.addResource(new Path("/etc/hbase/conf.hbase1/hbase-site.xml")); try { htable = new HTable(config, "MY_TABLE"); } catch (IOException e) { System.out.println("Error getting table from HBase", e); } } Using the HTable.get api, I got the Result object.

http://stackoverflow.com/q/22612985
downvote count: 0
tagged with: java
tagged with: javafx
type: Question
tagged with: transform
tagged with: image
has body: I have code that create an Image: (m_img is javafx.scene.image.Image) Image m_img = new Image("file:" + p_Fil.getAbsoluteFile(),false); This is fine, but it does ignore the exif TAG_ORIENTATION so pictures taken on a phone in portrait mode do not appear the correct way up. When I Change the load method, I am able to read this tag and save the result into an int (1-8) as follows: byte bb[] = FileUtilities.readFile(p_Fil); getOrientation(new ByteArrayInputStream(bb),p_Fil); m_img = new Image(new ByteArrayInputStream(bb)); if (m_orientation==1) return; //1 means no transformation required If m_orientation is 1 then it is correct so no further action is required. But now I need to somehow transform the image depending on the number returned. (Rotation, or Flip etc.) I think the javafx.scene.transform.Rotate class should help me. Can anyone provide sample code where given an image object you can output another rotated image object.
upvote count: 3
has title: Given a javafx.scene.image.Image object rotate it and produce a rotated javafx.scene.image.Image object
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23962610
accepted answer: http://stackoverflow.com/a/23962610
has comment: http://stackoverflow.com/comment/66240532
tagged with: exif
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/34421385
type: Comment
type: QuestionComment
score: 0
has text: In your example, class A is not immutable, because you do not guarantee that you really own the Objects in `listOfB` - it doesn't really matter, if you clone the elements in `getListOfB()`. You would need to clone the elements of `listOfB` inside the constructor of class A instead.
comment on: http://stackoverflow.com/q/22604754

http://stackoverflow.com/a/22571324
has body: You havent created an Object of Thread in your code. You need to create a thread, override its run() method with your code and start the run() method of your thread by invoking start() on your Thread. private void goButtonActionPerformed(java.awt.event.ActionEvent evt) { new Thread() { public void run() { try { for (int i = 0; i &lt; sim.length; i++) { simulate(); Thread.sleep(500); } } catch (Exception e) { e.printStackTrace(); } } }.start(); } Since you are updating a gui-element from a thread you should use invokelater(). private void simulate() { SwingUtilities.invokeLater(new Runnable() { public void run() { // Here, we can safely update the GUI // because we'll be called from the // event dispatch thread /* HERE YOUR your simulate() code */ } }); } I think that should work.
has comment: http://stackoverflow.com/comment/34359051
has comment: http://stackoverflow.com/comment/34358600
upvote count: 1
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/22570921
type: Answer

http://stackoverflow.com/comment/34376412
type: QuestionComment
has text: because `KEY_LINK` doesn't have a link I guess. Are you updating the `KEY_LINK` after the parsing ?
type: Comment
comment on: http://stackoverflow.com/q/22581810
score: 0

http://stackoverflow.com/a/22498461
type: Answer
has body: No, it's not compulsory! But then if you dont have a default constructor(No-argument constructor) and if you want the to create the object of your class in this form A ref = new A(); then you might not be able to do it.
answers question: http://stackoverflow.com/q/22498397
score: 0

http://stackoverflow.com/comment/34280800
score: 0
comment on: http://stackoverflow.com/a/22528021
type: AnswerComment
has text: I don't understand how to connects memory consuming and abstractness
type: Comment

http://stackoverflow.com/comment/34232739
has text: Thanks, I looked at java8. Will give option 3 a try. I edited the post, to include complete code and timings
comment on: http://stackoverflow.com/a/22500429
score: 0
type: AnswerComment
type: Comment

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/22627019
tags question: http://stackoverflow.com/q/22606186
tags question: http://stackoverflow.com/q/22545188
tag name: android-actionbar
tags question: http://stackoverflow.com/q/22612401
tags question: http://stackoverflow.com/q/22647030
tags question: http://stackoverflow.com/q/22579396
tags question: http://stackoverflow.com/q/22614929
tags question: http://stackoverflow.com/q/22543426

http://stackoverflow.com/q/22493702
type: Question
has body: I am using SWIG in android to convert a bunch of c++ code I have into java. I have one function that will read data out of a file, and another that will take that data and process it. Both use vector&lt;complex&lt;float&gt; &gt; The problem is that building it gets me the following error [javac] do_something_with_data.work(return_data.read(num_samps)); [javac] ^ [javac] required: SWIGTYPE_p_vectorT_complexT_float_t_t [javac] found: vector_complex_float [javac] reason: actual argument vector_complex_float cannot be converted to SWIGTYPE_p_vectorT_complexT_float_t_t by method invocation conversion [javac] 1 error I find it interesting that it works for one, but not the other. What am I doing wrong? Here are the .i files /* turn this module into java using SWIG */ %module do_something_with_data %{ #include &lt;vector&gt; #include &lt;complex&gt; #include "do_something_with_data.hh" %} /* Let's just grab the original header file here */ %include "std_vector.i" namespace std { %template(vector_complex_float) vector&lt;complex&lt;float&gt; &gt;; } /* boilerplate code */ %pragma(java) jniclasscode=%{ static { try { java.lang.System.loadLibrary("do_something_with_data"); } catch (UnsatisfiedLinkError e) { java.lang.System.err.println("Native code library failed to import"); java.lang.System.exit(1); } } %} %include "do_something_with_data.hh" and the other .i file /* turn this module into java using SWIG */ %module return_data %{ #include &lt;vector&gt; #include &lt;complex&gt; #include "return_data.hh" %} /* Let's just grab the original header file here */ %include "std_vector.i" namespace std { %template(vector_complex_float) vector&lt;complex&lt;float&gt; &gt;; } /* boilerplate code */ %pragma(java) jniclasscode=%{ static { try { java.lang.System.loadLibrary("return_data"); } catch (UnsatisfiedLinkError e) { java.lang.System.err.println("Native code library failed to import"); java.lang.System.exit(1); } } %} %include "return_data.hh" I compile both using the following s…
tagged with: swig
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22719644
accepted answer: http://stackoverflow.com/a/22719644
has title: SWIGs std_vector.i works on one file, but not both
tagged with: android
tagged with: c++
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22513331
has answer: http://stackoverflow.com/a/22513331

http://stackoverflow.com/comment/60410880
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22615604
has text: @Almo, did you ever find a resolution to this?

http://stackoverflow.com/comment/34214734
has text: Yes, they must have noticed that happening, because the getPageContents method is overridden in MySimpleURLReader to return a substring, leaving off the first four characters, with the comment "// overrides cs1.getPageContents() method, deletes "null" word, which is a mistake in super method."
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22489160
score: 2

http://stackoverflow.com/comment/34384082
has text: I've made this into a blog post: aliteralmind.wordpress.com/2014/03/22/for_foreach
type: Comment
comment on: http://stackoverflow.com/a/22540191
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34290791
type: Comment
type: QuestionComment
has text: @PhilippeGioseffi: BTW with annotations it would be the same as in xml just in annotations. ;) And with `#session` you can access variables from session so there is no need to create another properties.
comment on: http://stackoverflow.com/q/22510711
score: 0

http://stackoverflow.com/q/22589499
has comment: http://stackoverflow.com/comment/34390544
has comment: http://stackoverflow.com/comment/34390578
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22589617
has answer: http://stackoverflow.com/a/22589932
type: UnansweredQuestion
has title: How to print numbers side by side on the same line using different threads in java?
has comment: http://stackoverflow.com/comment/34390617
has comment: http://stackoverflow.com/comment/34390605
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34390601
has body: This is what the output should look like: Each column should be printed using a separate thread. So in this case there will be 3 threads, one that prints the numbers, an other that prints their squares and an other that prints their cubes. Following everyone's comments i have written this code. public class PrintThread { private static final int LIMIT=10; final static Queue&lt;Integer&gt; number=new LinkedList(); final static Queue&lt;Integer&gt; square=new LinkedList(); final static Queue&lt;Integer&gt; cube=new LinkedList(); public static void main(String[] args) { System.out.println("Number\tSquare\tCube"); for(int i=0;i&lt;LIMIT;i++) number.offer(i); new Thread(new Runnable(){ public void run(){ for(int i=0;i&lt;LIMIT;i++) square.offer(i*i); } }).start(); new Thread(new Runnable(){ public void run(){ for(int i=0;i&lt;LIMIT;i++) cube.offer(i*i*i); } }).start(); for(int i=0;i&lt;LIMIT;i++){ System.out.println(number.poll()+"\t"+square.poll()+"\t"+cube.poll()); } } } Now this still does not ensure the correct output. I want the main thread to print only after the other two threads have finished filling the queues. How do I do that?
type: Question

http://stackoverflow.com/q/22496258
score: 0
answer count: 1
has body: I have a use-case where I have to set "Content-type" and "content-disposition" after writing in http response outputstream instead of downloading as a file. Following sample code depicts the case :- @Context HttpServletResponse response; @GET @Produces(MediaType.TEXT_PLAIN) public String downloadFile() throws IOException { File file = new File("/var/tmp/input.txt"); FileInputStream fs = new FileInputStream(file); copyStream(fs, response.getOutputStream()); response.setContentType("text/csv"); response.setHeader("Content-Disposition","attachment;filename=\"" + "ts.csv" + "\""); return ""; } When I give a small input (input.txt file), my browser gives me option to download it but when the input is large, it prints the file content directly in the browser tab. Any pointers what I can do such that it gives a file downoad option for large input as well?
has answer: http://stackoverflow.com/a/22499008
has title: http response getting printed in browser if "Content-type" and "content-disposition" are set after writing in http "response" outputstream
type: UnansweredQuestion
tagged with: http
type: Question
tagged with: java
tagged with: http-headers
tagged with: servlets

http://stackoverflow.com/q/22526676
tagged with: java
tagged with: eclipse
upvote count: 2
answer count: 2
favorite count: 0
has title: Java code indentation mixed space and tabs
tagged with: code-formatting
score: 2
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/407929
has answer: http://stackoverflow.com/a/22526801
type: Question
has comment: http://stackoverflow.com/comment/34278480
has body: Tab and spaces are mix used on same projects. I need to code indentation but do not replace tab with spaces and vice versa. I only need to indent code (new indentation with space or tabs does not matter). Eclipse IDE is used but plugin or other tools are welcome. P.S I know that at same project same white space strategy (tab or white) using is better. As an example \t --> tab \b --> space. I think need to some property that how many space equals to tab 1 character. For our example 4. Before void foo() { \b\b\btest1(); // 3 spaces \ttest2(); // 1 tab } After void foo() { \b\b\b\btest1(); // 4 space (1 extra space to be indent correctly) \ttest2(); // 1 tab (do not change tab char with spaces because of that has correct indentation) }
has answer: http://stackoverflow.com/a/77010186

http://stackoverflow.com/comment/34269386
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22518449
has text: Are you seeing any logs related to the database save operation ? That would be the first place to look at for any problems.

http://stackoverflow.com/q/22500463
tagged with: java
tagged with: minimize
type: Question
answer count: 2
tagged with: tooltip
has body: I am creating a JFrame in the following way. JFrame f=new JFrame("Title"); f.setUndecorated(true); f.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); However, I am trying to display a custom tooltip text for the JFrame (by default it shows "Iconify"). Please help me out. Thanks !
has answer: http://stackoverflow.com/a/54024869
score: 0
tagged with: button
has title: Java custom tooltip for minimize button
has comment: http://stackoverflow.com/comment/34236652
has comment: http://stackoverflow.com/comment/34232409
has answer: http://stackoverflow.com/a/22500937
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/q/22647768
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23661075
tagged with: jpa
tagged with: inheritance
has title: JPA Inheritance: same property in different subclasses
answer count: 1
downvote count: 0
favorite count: 0
has body: so I have a single table inheritance with A being my base class and A1,A2,A3 all extend A. A2 and A3 both have a property named "name". Will it get me in trouble if I map A2.name and A3.name to the same table column? I'm not getting any errors so far, but I'm worried about strange behavior in the future. I'm using hibernate 4.3+
accepted answer: http://stackoverflow.com/a/23661075

http://stackoverflow.com/comment/34322660
score: 0
type: Comment
has text: It will also ok, if your HQL is not dynamic query.
type: AnswerComment
comment on: http://stackoverflow.com/a/22551381

http://stackoverflow.com/a/22506615
type: Answer
has body: What is your Sybase db version ? SybaseDialect has been deprecated in Hibernate 3.5 and then refactored since Hibernate 4.1 with a bunch of subclasses matching different versions of Sybase. Have you tried one of the subclasses to see if it makes any difference? org.hibernate.dialect.Sybase11Dialect org.hibernate.dialect.SybaseAnywhereDialect org.hibernate.dialect.SybaseASE15Dialect
has comment: http://stackoverflow.com/comment/34243358
score: 0
answers question: http://stackoverflow.com/q/22505624
has comment: http://stackoverflow.com/comment/34242975

http://stackoverflow.com/comment/34249575
type: QuestionComment
comment on: http://stackoverflow.com/q/22509242
has text: I was completely out of mind with that.... I thought I should go the index of that comma and manually delete it
score: 0
type: Comment

http://stackoverflow.com/q/22560997
score: 0
has title: How do you show the content of a session in a JSP for java?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2188706
answer count: 0
has body: i try to get the information of a user on my database, store the object in a session then show the session's contents on a JSP page. Whenever I try to show it on my page, the content of the session does not appear. Please help. THIS IS THE JSP PAGE I WAS TALKING ABOUT: &lt;%@page import="neospa.Client"%&gt; &lt;%@page import="DAOs.ClientDAO"%&gt; &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;title&gt;CLIENT INFORMATION&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;CLIENT INFORMATION&lt;/h1&gt; &lt;br&gt; &lt;%Client client = (Client)session.getAttribute("Client");%&gt; First Name &lt;% client.getFname(); %&gt; &amp;nbsp;&amp;nbsp; Last Name &lt;% client.getLname();%&gt; &lt;br&gt; Birthday &lt;%client.getBirthday();%&gt; &lt;br&gt; Home Number &lt;%client.getHomeno();%&gt; &lt;br&gt; Mobile Number &lt;%client.getMobileno();%&gt; &lt;br&gt; Office Number &lt;%client.getOfficeno();%&gt; &lt;br&gt; Email Address &lt;%client.getEmail();%&gt; &lt;br&gt; Address: &lt;%client.getAddress();%&gt;,&lt;%client.getCity();%&gt;,&lt;%client.getRegion();%&gt;,&lt;%client.getCountry();%&gt; &lt;/body&gt; &lt;/html&gt; Is there something missing here that I need to put? :)
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34408242
tagged with: session
tagged with: jsp
has comment: http://stackoverflow.com/comment/34338497

http://stackoverflow.com/q/22534639
tagged with: sql
has answer: http://stackoverflow.com/a/22534835
has answer: http://stackoverflow.com/a/22534809
has comment: http://stackoverflow.com/comment/34292694
favorite count: 0
has comment: http://stackoverflow.com/comment/34293038
has comment: http://stackoverflow.com/comment/34293066
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/34292765
has comment: http://stackoverflow.com/comment/34292757
has comment: http://stackoverflow.com/comment/34292741
tagged with: java
tagged with: database
type: Question
has body: I am having a problem with breaking down a range of data. Basically, I have a table called Car models, and I want to allocate a range of stock for each car model. So I have something like this... CarID CarName NumberInStock Price _________________________________ 1 BMW BMW00001-BMW00020 £35,000 2 AUDI AUD00001-AUD00100 £15,000 3 TOYOTA TOY00001-TOY00250 £9,000 I know how to retrieve the 'NumberInStock' from the database, however, I don't know how to break it down further, so that it is like BMW00001, BMW00002, BMW00003, ...BMW00020. How would I code this?
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/22537157
has comment: http://stackoverflow.com/comment/34297404
has comment: http://stackoverflow.com/comment/34292811
has comment: http://stackoverflow.com/comment/34292685
has title: Retrieve all the values in a given range, i.e. XXXXX-XXXXX, JAVA
answer count: 3

http://stackoverflow.com/a/26634167
type: Answer
upvote count: 15
answers question: http://stackoverflow.com/q/22605947
has body: As far as I know, you cannot set system environment variable from Gradle Task. However it is possible to set environment variable for that process. Thus if you need to set environment variable just for the build use this: task MyTask(type: Exec) { environment 'ENVIRONMENT_VARIABLE_NAME', 'environment_variable_value' // run or build code that needs that environment variable } You can also make compile depend on that task so if you build your code you set environment variable before you compile: tasks.withType(JavaCompile) { compileTask -&gt; compileTask.dependsOn MyTask }
score: 13
has comment: http://stackoverflow.com/comment/64541152
has comment: http://stackoverflow.com/comment/108794575
downvote count: 2

http://stackoverflow.com/comment/34270248
type: Comment
type: QuestionComment
has text: Ok... I'll have to look into that, not too clear on what that mean. Just put implement Comparable right after `public class Employee`?
comment on: http://stackoverflow.com/q/22521588
score: 0

http://stackoverflow.com/q/22643259
tagged with: java
accepted answer: http://stackoverflow.com/a/22643498
type: Question
answer count: 2
has body: Every so often we see Oracle (11gR2) hang while trying to do an update via JDBC. The thread accessing Oracle is the only thread in the app connected to the database and it just sits forever waiting for Oracle to return data. It's possible another process could have accessed the same database and updated a table, but I was under the impression Oracle would automatically detect a deadlock and return an error. In our case the database just hangs. Any ideas on what could cause this or ways to debug via some DBA command(s)? Here's the stack trace I see when it's stuck: Thread 7315: (state = IN_NATIVE) - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Compiled frame; information may be imprecise) - java.net.SocketInputStream.read(byte[], int, int, int) @bci=79 (Compiled frame) - java.net.SocketInputStream.read(byte[], int, int) @bci=11 (Compiled frame) - oracle.net.ns.Packet.receive() @bci=180, line=308 (Compiled frame) - oracle.net.ns.DataPacket.receive() @bci=1, line=106 (Compiled frame) - oracle.net.ns.NetInputStream.getNextPacket() @bci=48, line=324 (Compiled frame) - oracle.net.ns.NetInputStream.read(byte[], int, int) @bci=33, line=268 (Compiled frame) - oracle.net.ns.NetInputStream.read(byte[]) @bci=5, line=190 (Compiled frame) - oracle.net.ns.NetInputStream.read() @bci=73, line=107 (Compiled frame) - oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket() @bci=94, line=143 (Compiled frame) - oracle.jdbc.driver.T4CSocketInputStreamWrapper.read() @bci=18, line=80 (Compiled frame) - oracle.jdbc.driver.T4CMAREngine.unmarshalUB1() @bci=6, line=1137 (Compiled frame) - oracle.jdbc.driver.T4CTTIfun.receive() @bci=11, line=350 (Compiled frame) - oracle.jdbc.driver.T4CTTIfun.doRPC() @bci=63, line=227 (Compiled frame) - oracle.jdbc.driver.T4C8Oall.doOALL(boolean, boolean, boolean, boolean, boolean, oracle.jdbc.internal.OracleStatement$SqlKind, int, byte[], int, oracle.jdbc.driver.Accessor[], int, oracle.jdbc.driver.Accesso…
possible better answer: http://stackoverflow.com/a/22651449
has answer: http://stackoverflow.com/a/22651449
score: 0
tagged with: oracle-database
tagged with: jdbc
tagged with: freeze
has answer: http://stackoverflow.com/a/22643498
has title: Troubleshooting Oracle+JDBC hang
type: AnsweredQuestion

http://stackoverflow.com/comment/34403025
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22596492
score: 0
has text: when i add the return statement it says Void methods cannot return a value. I'm also not trying to return the array, I just want to convert the original string that contains numbers to an array of the numbers

http://stackoverflow.com/comment/34306195
score: 0
type: Comment
has text: No problem. StackOverflow's recommended practice is to post a new question since it's unrelated to this one.
comment on: http://stackoverflow.com/a/22517155
type: AnswerComment

http://stackoverflow.com/a/22546419
upvote count: 2
has comment: http://stackoverflow.com/comment/34339028
has comment: http://stackoverflow.com/comment/34339877
answers question: http://stackoverflow.com/q/22546268
type: Answer
score: 2
downvote count: 0
has body: 1) No, Scala collections are implemented separately from Java collections. However, there is a way to wrap Java collections to Scala collection interfaces, so that you can use Scala for-comprehensions and other methods on them. The old way to convert from the Scala to Java API and vice versa is described here. Nowadays, you can do it by importing JavaConversions as described in the link, and then calling asJava or asScala on the collection, depending which direction you need. 2) ArrayList is equivalent to the ArrayBuffer in terms of the complexity of Scala apply (Java get), update (Java set) and += (Java add). 3) ArrayBuffer extends ResizeableArray utility class used by several other collections. As far as I remember, the private array field in that class is called array0, but the logic of manipulating it is the same as with elementData. ArrayBuffers guarantee amortized O(1) += method, meaning that only occasionally an update will cost you O(n) when the underlying array needs to be resized to a bigger one. Prepending elements is an O(n) operation, as well as inserting them in the middle. In the ArrayBuffer operation the underlying array is never shrinked, i.e. once an array buffer grows to a certain size, and then all the elements are removed, it will still occupy the same amount of memory. This is true even if you call clear on it. 4) Growable collections are all collections that implement the trait Growable. This trait defines the method += that adds an element to them. The exact semantics of this method depend on whether the collection is a set (in which case an element is added to the set), a sequence or a linked set/map (in which case there is order between the elements, so the element is just added to the end), or something else. How growable collections are implemented depends from one collection to another. This is a good overview for Scala collections.

philips-hue
tag name: philips-hue
tags question: http://stackoverflow.com/q/22564187
type: Tag
tags question: http://stackoverflow.com/q/22623655

http://stackoverflow.com/comment/34444149
has text: No need for DataInputStream. Good case for using Java 7 try-with-resources, and you only need a FileReader and a BufferedReader. Anyway, there is no need for anything more than the method that reads the file line-by-line, which could be changed to return an int with the line number when it finds the word (or -1 if it doesn't find it).
comment on: http://stackoverflow.com/q/22618980
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34455712
type: QuestionComment
type: Comment
score: 0
has text: It prints,1475 54903 2085167 79235199, which is clearly not right since we have numbers divisible by 3,5 which should not have printed based on b[1],b[3].
comment on: http://stackoverflow.com/q/22625673

http://stackoverflow.com/a/22604862
has body: Assuming B is an interface or an implementation of the interface A, you could wrap each element of listOfB by using a java.net.Proxy of B or A respectively, which intercepts all modifying calls by throwing an UnsupportedOperationException instead. More detailed, replace each item of the listOfB with a java.net.Proxy wrapped instance, implementing A. Then whenever someone fetches an item of listOfB, he will obtain the wrapped instance instead. Whenever someone calls a setter on such a wrapped item, intercept the call and throw an UnsupportedOperationException. Hope you have an idea what I mean. It's basically what Collections.unmodifiableXXX() does. If you have knowledge of all methods which may modify the state of an item of listOfB, B does not have to be an POJO. Just make sure that your wrapper replaces all modifying methods by throwing an exception.
has comment: http://stackoverflow.com/comment/34418180
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34418101
answers question: http://stackoverflow.com/q/22604754
upvote count: 2

http://stackoverflow.com/comment/34476574
comment on: http://stackoverflow.com/a/22637734
score: 0
type: AnswerComment
has text: Thanks for your hepl!! It helped me to understand the concept!
type: Comment

http://stackoverflow.com/q/22624535
has answer: http://stackoverflow.com/a/22624819
has comment: http://stackoverflow.com/comment/34453718
tagged with: reverse
has comment: http://stackoverflow.com/comment/34454214
has comment: http://stackoverflow.com/comment/34454188
favorite count: 0
score: -1
possible better answer: http://stackoverflow.com/a/22634651
has answer: http://stackoverflow.com/a/22634651
downvote count: 1
has comment: http://stackoverflow.com/comment/34453801
accepted answer: http://stackoverflow.com/a/22624819
type: AnsweredQuestion
has body: I want to reverse the words of a string in place using constant space. The catch is that the words cannot contain consecutive whitespaces. I want to reduce all consecutive whitespaces between words to one whitespace and also ignore leading and trailing whitespaces. I was able to implement the in place reversal of words, but I'm struggling to implement removing the consecutive whitespaces between words and leading and trailing whitespaces. Can someone help me? Here is what I have so far: public char[] reverseWords(char[] s) { if (s == null) return null; int right = 0; s = reverseString(s, 0, s.length - 1);// get the reversed sentence //System.out.println(s); for (int left = 0; left &lt; s.length; left++) { if (s[left] != ' ') {// for first word for (right = left; right &lt; s.length &amp;&amp; s[right] != ' '; right++) ; // get end of word s = reverseString(s, left, right - 1); left =(right - 1);// move left index to end of // word // s[left++] = ' '; } } return s; } public char[] reverseString(char[] strChars, int start, int end) { if (strChars == null) return null; while (start &lt; end) { char temp = strChars[start]; strChars[start] = strChars[end]; strChars[end] = temp; start++; end--; } return strChars; }
has comment: http://stackoverflow.com/comment/34453520
tagged with: java
has comment: http://stackoverflow.com/comment/34453735
has comment: http://stackoverflow.com/comment/34453479
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34453531
has comment: http://stackoverflow.com/comment/34453680
upvote count: 0
has title: Reverse words of a char[]/sentence in place
has comment: http://stackoverflow.com/comment/34453493
tagged with: string
has comment: http://stackoverflow.com/comment/34453562
has comment: http://stackoverflow.com/comment/34454236

http://stackoverflow.com/q/22593021
has comment: http://stackoverflow.com/comment/34396998
has body: I am trying to a create a Android App that shows information on a Canvas. The problem is that there is so much text and graphics that the user needs to be able to scroll to see it all. I need to be able to add a ScrollView to a Canvas and then add a Canvas inside of that ScrollView. Would this be possible and would you be able to give me a few code examples of this working? Thanks in advance, James
has title: Add a Canvas inside a ScrollView inside a Canvas?
tagged with: android
score: 1
favorite count: 0
tagged with: scrollview
has comment: http://stackoverflow.com/comment/34401879
type: Question
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34397952
tagged with: canvas
has comment: http://stackoverflow.com/comment/34401368
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34397169

http://stackoverflow.com/comment/34344360
has text: Sorry, typo. Was meant to be [3][3]
comment on: http://stackoverflow.com/q/22563973
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34379521
type: QuestionComment
comment on: http://stackoverflow.com/q/22583314
score: 0
has text: What is the question?
type: Comment

http://stackoverflow.com/comment/34511476
score: 0
type: AnswerComment
has text: so is there any better way.?
type: Comment
comment on: http://stackoverflow.com/a/22654013

http://stackoverflow.com/comment/34416987
score: 0
has text: ok then u need to put that image into sdcard..and when ever user need to change the image,he can only change or replace the image within his sdcard..so i mean the image will be change dunamically from the client side..can u get my point and sorry for my english..
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22603153

http://stackoverflow.com/q/22549016
tagged with: cron
has title: What else do I have to do other than making cron.xml?
accepted answer: http://stackoverflow.com/a/22549063
tagged with: timer
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/22549303
has answer: http://stackoverflow.com/a/22549063
type: AnsweredQuestion
tagged with: java
has body: What else do I have to do, other than making a cron.xml file for scheduling ? I am getting the same exception: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") as I was getting before. This is my cron.xml : <?xml version="1.0" encoding="UTF-8"?> /tw Tweet every half an hour every 30 minutes from 8:00 to 17:00 /tw is the servlet that has a doGet method which uses java.util.Timer to schedule the task.
type: Question
has answer: http://stackoverflow.com/a/22549729
tagged with: scheduler
possible better answer: http://stackoverflow.com/a/22549303
score: 0
answer count: 3

http://stackoverflow.com/comment/34429356
has text: @user2991252 - Ermm ... this kind of race condition can happen one in a million, or one in a billion times. And the rate of occurrence can depend on system load, number of cores, Java release, and so on. You got lucky ... relatively speaking.
score: 0
comment on: http://stackoverflow.com/a/22610772
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34294169
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22535447
score: 0
has text: ok thanks.. Is there any other way around to calculate the co2 levels without any external sensors. I am asking this, because I am developing an app to push co2 emissions to the cloud.

http://stackoverflow.com/a/22508511
has comment: http://stackoverflow.com/comment/34246262
answers question: http://stackoverflow.com/q/22508240
score: 0
has comment: http://stackoverflow.com/comment/34251340
type: Answer
has body: Make sure you start the scheduler using scheduler.start(); Otherwise quartz will persist job data but won't respond to fired triggers and won't actually run anything (stand by mode).
has comment: http://stackoverflow.com/comment/34251072
has comment: http://stackoverflow.com/comment/34249120
has comment: http://stackoverflow.com/comment/34246526
has comment: http://stackoverflow.com/comment/34250435

http://stackoverflow.com/a/22744689
score: 0
has body: For such a scenario, Adobe Propaganda would say you'd have to use a dynamic XFA form (created with LiveCycle Designer). This would indeed provide the easiest way, by using subforms (see documentation). It is, however, possible to do it with AcroForms. However, it is a little bit messy, and does not work with every version of Reader. What you would do in this case, is putting the contents which should shift in fields as well. Then you set up a pagination routine which places/moves/creates those fields accordingly. A client of mine has a whole set of such dynamic multilingual forms in regular use. For an in-depth discussion and quotes, feel free to contact me in private.
type: Answer
answers question: http://stackoverflow.com/q/22618136

http://stackoverflow.com/a/22491193
has body: Use String.format(format, args...). String documentation: http://docs.oracle.com/javase/6/docs/api/java/lang/String.html More about format syntax: http://docs.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22491108
downvote count: 0
has comment: http://stackoverflow.com/comment/34216891
upvote count: 2

http://stackoverflow.com/a/22535447
score: 2
has comment: http://stackoverflow.com/comment/34294487
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22535344
answers question: http://stackoverflow.com/q/22535344
has body: There are currently no built-in sensors that can measure co2 levels. I am not aware of any way to calculate this. There are 3rd party external sensors that do what you want, but again - not built-in the phone.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34295499
has comment: http://stackoverflow.com/comment/34294169

long-integer
tags question: http://stackoverflow.com/q/22562717
tag name: long-integer
type: Tag
tags question: http://stackoverflow.com/q/22647356
tags question: http://stackoverflow.com/q/22514654
tags question: http://stackoverflow.com/q/22528675
tags question: http://stackoverflow.com/q/22565560

http://stackoverflow.com/comment/34695264
type: QuestionComment
comment on: http://stackoverflow.com/q/22628397
score: 0
has text: In your current code, if closing the `ResultSet` or `PreparedStatement` fails, you will not close the connection. Make sure they are each in their own try...catch
type: Comment

http://stackoverflow.com/a/22601100
score: 1
has body: You're 1 index too high. Use for (int i = 0; i &lt; j; i++)
upvote count: 1
answers question: http://stackoverflow.com/q/22601081
downvote count: 0
type: Answer

http://stackoverflow.com/q/22534721
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22534943
has title: Get last number from string
score: 0
has answer: http://stackoverflow.com/a/22534807
has answer: http://stackoverflow.com/a/22535025
has body: I want to get the last character of a string and if it's a even number to do different actions based on that. Simple example: Server_3 First I want to get the last value 3 String str = "Server_3"; str.charAt(str.length()-1) The problem is next how to construct the logic to have different cased based on that is this a even number or not. Can you help me to complete this?
answer count: 3
possible better answer: http://stackoverflow.com/a/22534807
has comment: http://stackoverflow.com/comment/34292773
has answer: http://stackoverflow.com/a/22534943
type: AnsweredQuestion

http://stackoverflow.com/comment/34302296
comment on: http://stackoverflow.com/q/22537516
score: 0
has text: There's a serious problem with the version of iText you're using. I see my name in the package names, which makes me believe you are using iText, but you mention that you're using iText 4.2.0 and that is a version that doesn't exist. The official release jumped from 2.1.7 to 5.0.0. See http://itextpdf.com/changelog for more info. You have probably obtained a rogue version of iText. I would not use that version if I were you.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34402845
type: QuestionComment
has text: Post the updated code, and what `cmd.getName()` returns
comment on: http://stackoverflow.com/q/22596165
score: 0
type: Comment

http://stackoverflow.com/a/22675011
accepted answer of: http://stackoverflow.com/q/22645809
score: 0
has body: I couldn't find a way to convert the two byte header to an integer especially since one byte could be 0 and some string methods look at that as a string terminator. Since a message from the Java application will always consist of the header followed by the message I ignore the header and parse the message(s) from the Stream adding them to a list (in order to echo them back as verification), I then traverse the list and simulate the header by writing a 0 byte followed the message size to the stream stream followed by the message. This won't work as is with message lengths greater than 255 but I don't expect any even close to that size. it should be noted that the Dart application and the Java application are on the same machine. handleJavaSocket(Socket javasocket){ // echo socket javasocket.transform(UTF8.decoder).forEach((item) { var start = 2; var end = -1; var messages = new List&lt;String&gt;(); while((++end &lt; item.length) &amp;&amp; (end = item.indexOf('}',end)) != -1) { messages.add(item.substring(start, ++end)); start = end + 2; } for(var message in messages) { // header message length as two bytes javasocket.writeCharCode(0); // max length 254 javasocket.writeCharCode(message.length); javasocket.write(message); // &lt;== send } }); }
answers question: http://stackoverflow.com/q/22645809
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34415510
type: Comment
has text: Santhosh, where should i add? Rest project side?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22603473

list
type: Tag
tags question: http://stackoverflow.com/q/22617072
tags question: http://stackoverflow.com/q/22581810
tags question: http://stackoverflow.com/q/22644944
tags question: http://stackoverflow.com/q/22523060
tags question: http://stackoverflow.com/q/22623549
tags question: http://stackoverflow.com/q/22534635
tags question: http://stackoverflow.com/q/22497305
tags question: http://stackoverflow.com/q/22504624
tag name: list
tags question: http://stackoverflow.com/q/22640137
tags question: http://stackoverflow.com/q/22547476
tags question: http://stackoverflow.com/q/22595637
tags question: http://stackoverflow.com/q/22612917
tags question: http://stackoverflow.com/q/22561692
tags question: http://stackoverflow.com/q/22596297
tags question: http://stackoverflow.com/q/22560163
tags question: http://stackoverflow.com/q/22522858
tags question: http://stackoverflow.com/q/22597708
tags question: http://stackoverflow.com/q/22639021
tags question: http://stackoverflow.com/q/22631345
tags question: http://stackoverflow.com/q/22640862
tags question: http://stackoverflow.com/q/22579024
tags question: http://stackoverflow.com/q/22575512
tags question: http://stackoverflow.com/q/22592768
tags question: http://stackoverflow.com/q/22644024
tags question: http://stackoverflow.com/q/22626430
tags question: http://stackoverflow.com/q/22593721
tags question: http://stackoverflow.com/q/22582313
tags question: http://stackoverflow.com/q/22535423
tags question: http://stackoverflow.com/q/22566112
tags question: http://stackoverflow.com/q/22540025
tags question: http://stackoverflow.com/q/22617801
tags question: http://stackoverflow.com/q/22612430
tags question: http://stackoverflow.com/q/22513509
tags question: http://stackoverflow.com/q/22647895
tags question: http://stackoverflow.com/q/22572566
tags question: http://stackoverflow.com/q/22490988
tags question: http://stackoverflow.com/q/22635188
tags question: http://stackoverflow.com/q/22495732

http://stackoverflow.com/q/22643219
has body: I have two GridView &lt;GridView android:id="@+id/gridView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="2dp" android:background="#59A9D2" &gt; &lt;/GridView&gt; &lt;GridView android:id="@+id/gridViewMain" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/gridView" android:background="#1E98D5" &gt; &lt;/GridView&gt; &lt;/RelativeLayout&gt; First grid view holds 25 imageView elements. Second grid view holds 5 images (these 5 images are from the 25 images from the first grid view images) User can able to click only on the images of first grid view. user need to find out the second grid view images in first grid view. when the user successfully make a correct click. i want the that image to turn into a "right green tick" image in the second grid how to do this onitemclicklistener of first grid view. mGridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // TODO Auto-generated method stub // ToastMessage(position); if ((mRandomIDList.toArray()[position] == mSolutionList .toArray()[tempposition])) { Score = Score + (TimeLeft * (tempposition + 1)); mScoreTextView.setText("Score: " + Score); //mGridViewMain.getAdapter().getView(tempposition, checkImageView, null); //mGridViewMain.notifyAll(); if(mMediaPlayer2.isPlaying()){ mMediaPlayer2.stop(); } mMediaPlayer2.start(); tempposition++; //Marking the try one image in solution grid view if (tempposition == 5) { mCountDownTimer.cancel(); Intent successIntent = new Intent(mContext, SuccesActivity.class); successIntent.putExtra("last-score", Score); successIntent.putExtra("Game Level", PLAY_LEVEL); startActivity(successIntent); mMediaPlayer.stop(); mMediaPlayer.reset(); mMediaPlayer.release(); finish(); } } else { mCountDownTimer.cancel(); GameOver(mContext, Score); mMediaPlayer.stop(); mMediaPlayer.reset(); mMediaPlayer…
tagged with: layout
score: 0
tagged with: android
tagged with: gridview
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/55491262
has title: How to change the imageview resource in gridview?
tagged with: java
has comment: http://stackoverflow.com/comment/34503028
has comment: http://stackoverflow.com/comment/34549675
has comment: http://stackoverflow.com/comment/34486404
type: Question

http://stackoverflow.com/a/36828090
has body: If you set withIncludeAllInstances(true) on your request then you can get states for the not running instances. DescribeInstanceStatusResult result = ec2.describeInstanceStatus(new DescribeInstanceStatusRequest() .withInstanceIds(instanceIds).withIncludeAllInstances(true));
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22490999
upvote count: 2

http://stackoverflow.com/comment/34275654
comment on: http://stackoverflow.com/a/22524727
has text: Thanks.. I tried this and now the results I am seeing is like this `9,490.000%` which is not the actual response I was getting.. How would I get `94.89%`? Any thoughts?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34371008
type: Comment
type: QuestionComment
score: 3
has text: What is an example of it "not working as expected"?
comment on: http://stackoverflow.com/q/22578953

http://stackoverflow.com/comment/34270003
has text: @immibis yeah. that was the main problem, I guess :-)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22500807

http://stackoverflow.com/comment/34488710
type: QuestionComment
comment on: http://stackoverflow.com/q/22644208
has text: Do you want to remove `Marker` having `title` equals to Durst? or just title tag?
score: 0
type: Comment

http://stackoverflow.com/a/42558872
upvote count: 1
downvote count: 0
type: Answer
has body: The plugin has to be defined in the parent pom to be executable at the parent level. But if defined in the parent, the plugin is executed for all modules. Since this is your plugin (com.mycompany:myplugin), you can define a "no-op" configuration option in the plugin implementation. Then, in each pom where you want the plugin to do nothing, you use that configuration option. As an example, the docker-maven-plugin does exactly that. If you use: true the plugin will not execute for that pom.
answers question: http://stackoverflow.com/q/22505271
score: 1

bitmap
tags question: http://stackoverflow.com/q/22511563
tags question: http://stackoverflow.com/q/22532136
tags question: http://stackoverflow.com/q/22560225
tags question: http://stackoverflow.com/q/22582904
type: Tag
tags question: http://stackoverflow.com/q/22617927
tags question: http://stackoverflow.com/q/22609255
tags question: http://stackoverflow.com/q/22588175
tag name: bitmap
tags question: http://stackoverflow.com/q/22495557
tags question: http://stackoverflow.com/q/22640890
tags question: http://stackoverflow.com/q/22602843
tags question: http://stackoverflow.com/q/22550998
tags question: http://stackoverflow.com/q/22626283
tags question: http://stackoverflow.com/q/22521759

http://stackoverflow.com/comment/34445779
type: Comment
type: AnswerComment
score: 1
has text: No, I don't know. But if you've already got the `pdfTable` variable, then you don't need to call `getTable`. Just use the table that you've already got.
comment on: http://stackoverflow.com/a/22619877

http://stackoverflow.com/a/22629283
answers question: http://stackoverflow.com/q/22629232
type: Answer
has body: You could just do : import java.util.Arrays; public class PrintArray{ public static void main(String []args){ String g = Arrays.toString(a.czynnikiPierwsze(Integer.parseInt(args[i]))); g = g.replace(", 0",""); g = g.replace(", ","*"); g = g.replace("[",""); g = g.replace("]",""); System.out.println(g); } } INPUT : {2,2,3,5,0,0,0,0} OUTPUT : 2*2*3*5
score: 0

http://stackoverflow.com/comment/34430417
score: 0
type: Comment
has text: Well, my code is all there in the link, you can first see that and let me know if you want to know anything in particular. It's a complete working gameplay, which you can download and play for yourself.
type: AnswerComment
comment on: http://stackoverflow.com/a/22611999

http://stackoverflow.com/q/22490558
favorite count: 0
tagged with: spring
tagged with: css
has answer: http://stackoverflow.com/a/22504302
has title: Internationalization with spring mvc
accepted answer: http://stackoverflow.com/a/22504302
tagged with: internationalization
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I'm new to spring, i have a working bilingual application based on Spring MVC, and in order to customize the UI ( css & js ) , i've added this to my Spring-MVC configuration file : <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:annotation-driven /> The css/js intégration worked well, but the Internationalization wasn't, when i delete the resources tag, the internationalization starts working but the css includes doesn't... this is my project tree : I believe that there is some kind of conflict Between the two resources folders, but i don't know how to solve this ... Thank you ! EDIT : Internationalization XML Config in SpringMVC-XML-Config File:
has comment: http://stackoverflow.com/comment/34227450
answer count: 1
downvote count: 0

http://stackoverflow.com/q/22501176
favorite count: 0
has comment: http://stackoverflow.com/comment/34233635
tagged with: android
tagged with: android-notifications
has comment: http://stackoverflow.com/comment/34233658
has body: I know there any many questions like my question , I've read many of them, and now I'm really confused that is it really possible to show a notification when the activity has been destroyed and our app is not in memory. here is the scenario: My app is in the memory and the user select a time in the future then the app must show a notification and then he/she will close the app.I really want to do it without writing a service. Is it possible? how? I have tested using alarm manager but when user completely close the app , the timed notifications doesn't work.And the timed notifications can be more than one.
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34233525
tagged with: java
type: Question
has title: timed notification without using service
has answer: http://stackoverflow.com/a/22501562
accepted answer: http://stackoverflow.com/a/22501562
upvote count: 1
has comment: http://stackoverflow.com/comment/34233559
answer count: 1
has comment: http://stackoverflow.com/comment/34233714
has comment: http://stackoverflow.com/comment/34233491

http://stackoverflow.com/a/22504172
answers question: http://stackoverflow.com/q/22503714
upvote count: 0
score: -3
type: Answer
has body: Use this: if (positionE!=-1) { if ((position==-1) || (positionE&lt;position)) { position = positionE; } }
downvote count: 3

http://stackoverflow.com/q/22577659
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34368710
accepted answer: http://stackoverflow.com/a/22577698
possible better answer: http://stackoverflow.com/a/22579876
linked to: http://stackoverflow.com/q/19920833
has body: I made a simple Jframe with its child components in netbeans, when i run the application it shows it in NIMBUZZ lookandfeel as shown below:- But I want it to be always shown in WINDOWS lookandfeel as shown below :- How am I suppose to do that??
tagged with: jframe
type: AnsweredQuestion
tagged with: java
tagged with: look-and-feel
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/22577698
has title: How can i set defaultlookandfeel to window for Jframe
has answer: http://stackoverflow.com/a/22579876

http://stackoverflow.com/comment/34412783
score: 1
has text: You should use else{ ----code----} for printing multiple line, otherwise it will take only single line.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22601986

http://stackoverflow.com/comment/34250589
type: Comment
has text: see here as well http://jade-cheng.com/hpu/2012-spring/csci-2912/assignment-5/blueprint-2.png
type: QuestionComment
comment on: http://stackoverflow.com/q/22508328
score: 0

http://stackoverflow.com/comment/34234979
type: AnswerComment
comment on: http://stackoverflow.com/a/22500663
score: 0
type: Comment
has text: Not get any clue :( please help:

http://stackoverflow.com/q/22640653
has answer: http://stackoverflow.com/a/22641313
answer count: 3
has comment: http://stackoverflow.com/comment/34481515
tagged with: android
has comment: http://stackoverflow.com/comment/34482201
has comment: http://stackoverflow.com/comment/34482588
has comment: http://stackoverflow.com/comment/34482287
has comment: http://stackoverflow.com/comment/34481637
has comment: http://stackoverflow.com/comment/34482586
type: UnansweredQuestion
has title: my android app error unfortunately app has stopped
has comment: http://stackoverflow.com/comment/34482541
has comment: http://stackoverflow.com/comment/34481949
has comment: http://stackoverflow.com/comment/34481697
has comment: http://stackoverflow.com/comment/34481702
has comment: http://stackoverflow.com/comment/34481520
has answer: http://stackoverflow.com/a/22641309
has body: I am new to Android. I've just started to build my first Android app and have been struggling with this errorfor the past 2 days. Finding no solution I had to come here. Error: Unfortunately "app name" has stopped This is main activity layout: &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:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:text="TextView" /&gt; &lt;/RelativeLayout&gt; This is another layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; &lt;ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="wrap_content"&gt;&lt;/ListView&gt; &lt;/LinearLayout&gt; logcat error java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.listview/com.example.listview.MainActivity}: java.lang.NullPointerException 03-25 12:01:29.772: E/AndroidRuntime(1314): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176) 03-25 12:01:29.772: E/AndroidRuntime(1314): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226) 03-25 12:01:29.772: E/AndroidRuntime(1314): at android.app.ActivityThread.access$700(ActivityThread.java:135) 03-25 12:01:29.772: E/AndroidRuntime(1314): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397) 03-25 12:…
tagged with: java
has answer: http://stackoverflow.com/a/22641299
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34481872
has comment: http://stackoverflow.com/comment/34482198

http://stackoverflow.com/comment/34318409
type: Comment
has text: hmmm, can you post more of your code for context?
score: 0
comment on: http://stackoverflow.com/q/22548362
type: QuestionComment

http://stackoverflow.com/comment/34433177
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22613444
has text: The code will not compile, it doesnt seem to recognize the getters and setters from within the class at all, very confused
score: 0

http://stackoverflow.com/comment/34461204
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22628828
has text: That will drop leading 000s

http://stackoverflow.com/q/22564240
has body: I have an ArrayList of the Class ZombieSprite in my GameView class which includes all my ZombieSprites. In my ZombieSprite class i have the method getDirection(). Now i dont want the ZombieSprites to collide. So need to check if the variable x of the object thezombiesprite id the ArrayList is equal to any other variable x of an object thezombiesprite in the ArrayList. public class GameView extends SurfaceView { // not interesting List&lt;ZombieSprite&gt; zombieSpriteList = new ArrayList&lt;ZombieSprite&gt;(); // not interesting public class ZombieSprite { private int x = 0; private int y = 0; private void getDirection() { if (x &lt; PlayerSprite.x) { x = x + xSpeed; } if (x &gt; PlayerSprite.x) { x = x - xSpeed; } if (x == PlayerSprite.x) { x = x; } if (y &lt; PlayerSprite.y) { y = y + ySpeed + backgroundspeed; } if (y &gt; PlayerSprite.y) { y = y - ySpeed + backgroundspeed; } if (y == PlayerSprite.y) { y = y + backgroundspeed; } } I tried it with including following code into the getDireciton() method and added the ArrayList zombieSpriteList into the ZombieSprite class, too. theGameView.getZombieSpriteList(); theGameView.zombieSpriteList = zombieSpriteList; for (ZombieSprite thezombiesprite : zombieSpriteList) { }
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22564383
has answer: http://stackoverflow.com/a/22564479
tagged with: java
has answer: http://stackoverflow.com/a/22564383
type: Question
answer count: 2
score: 0
accepted answer: http://stackoverflow.com/a/22564479
tagged with: android
has comment: http://stackoverflow.com/comment/34344731
has title: How to check if a variable of an object in an ArrayList is equal to any of the same variables of the other objects in the ArrayList

http://stackoverflow.com/comment/34388867
type: Comment
type: QuestionComment
has text: What if you had a separate set, also possibly accessible via Bloom filter, that contained the possible first components of compound words as well as information about what words could follow? You add "mac -> book -> pro", "macbook -> pro", then as you iterate through words you look in that set. Say you are on "mac". You look it up. You find it. You obtain the possible compound sequence "book -> pro". You check if the next words in the sentence match that sequence. If they do, combine and consume them then proceed to look up "macbookpro" in your real set.
comment on: http://stackoverflow.com/q/22588319
score: 0

http://stackoverflow.com/a/22543880
answers question: http://stackoverflow.com/q/22543603
upvote count: 1
downvote count: 0
has body: So the answer is here. It looks like: #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;windows.h&gt; using namespace std; string getAppName() { // Creates char array with maximum needed length char result[MAX_PATH]; // Uses &lt;windows.h&gt; method to retrieve app name. Only Windows OS std::string(result, GetModuleFileName(NULL, result, MAX_PATH)); char* token; string name, next = ""; //Iterates until end of tokens of Name string, divided by char -&gt; '\' and '.' //The only '.' in Filename must be that for ".exe" , error otherwise. token = strtok(result, "\\."); while (next != "exe") { name = next; token = strtok(NULL, "\\."); next.assign(token); } return name; } int main(int argc, char** argv) { ifstream file; // file stream string value = ""; string jar_name = ""; string image_name = "splash.gif"; file.open("run.ini"); if (!file) { // file does not exist, so use standard name jar_name = getAppName(); jar_name += ".jar"; } else { do { file &gt;&gt; jar_name; file &gt;&gt; image_name; } while (!file.eof()); file.close(); } //Launch JAVAW command on "jar_name" file with "image_name" splash image string exec_command = "start javaw -splash:" + image_name + " -jar " + jar_name; system(exec_command.c_str()); return 0; }
type: Answer
score: 1

http://stackoverflow.com/comment/34321327
has text: you can use this format : String dd = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss a").format(d); it will give output as Mar 21, 2014 10:41:54 AM
comment on: http://stackoverflow.com/a/22550435
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/34252356
type: Comment
comment on: http://stackoverflow.com/a/22511814
score: 0
type: AnswerComment
has text: However, the analogy seems to oppose the point. Nice answer anyway.

http://stackoverflow.com/a/22669793
has body: There is no way to do this using the mongofiles command line utility, but it's straightforward using the Java driver: MongoClient client = new MongoClient(); GridFS gridFS = new GridFS(client.getDB("test"); GridFSInputFile in = gridFS.createFile(&lt;insert bytes here&gt;); in.put("meta", 5); // insert extra metadata here in.save(); GridFSDBFile out = gridFS.findOne( new BasicDBObject( "_id" , in.getId() ) ); System.out.println(out.get("meta")); // this will print 5 Basically, just put the metadata on the GridFSInputFile, and get it from the GridFSDBFile. The file will look like this (using the shell): &gt; db.fs.files.findOne() { "_id" : ObjectId("5333184bb0c659a378532bda"), "chunkSize" : NumberLong(261120), "length" : NumberLong(3), "md5" : "acbd18db4cc2f85cedef654fccc4a4d8", "filename" : null, "contentType" : null, "uploadDate" : ISODate("2014-03-26T18:11:23.973Z"), "aliases" : null, "meta" : 5 }
type: Answer
accepted answer of: http://stackoverflow.com/q/22555103
answers question: http://stackoverflow.com/q/22555103
downvote count: 0
score: 7
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/a/22510490
accepted answer of: http://stackoverflow.com/q/22509374
has body: Since you want to handle an ajax request using a Servlet, the best bet you have is writing the data of your custom object into the response. The easier way I found to accomplish this is using JSON. There are lot of libraries that handles JSON conversion from objects to Strings and vice versa, I recommend using Jackson. This is how your code should look like. Servlet code: import com.fasterxml.jackson.databind.ObjectMapper; @WebServlet("/loginServlet") //assuming you're using Servlet 3.0 public class YourServlet extends HttpServlet { //Jackson class that handles JSON marshalling private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); //login operation should be handled in POST public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Customer loginResult = ...; //process data and get the loginResult instance response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); //marshalling the data of your loginResult in JSON format String json = OBJECT_MAPPER.writeValueAsString(loginResult); response.getWriter().write(json); } } Javascript code: &lt;script type="text/javascript"&gt; $().ready(function() { $('#submit').click(function() { var dataf = 'email=' + $('#email').val() + '&amp;password=' + $('#password').val(); $.ajax({ url: "http://localhost:8080/RetailerGui/loginServlet", type: "post", //login action MUST be post, NEVER a get data: dataf, success: function(data) { //shows the relevant data of your login result object in json format alert(data); //parsing your data into a JavaScript variable var loginResult = JSON &amp;&amp; JSON.parse(data) || $.parseJSON(data); //now you can use the attributes of your loginResult easily in JavaScript //for example, assuming you have a name attribute in your Customer class alert(loginResult.name); } }); return false; }); }); &lt;/script&gt; More info: How to use Servlets and Ajax? Parse JSON in JavaScript?
type: Answer
answers question: http://stackoverflow.com/q/22509374
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/22542153
has comment: http://stackoverflow.com/comment/34309309
has comment: http://stackoverflow.com/comment/34352480
has comment: http://stackoverflow.com/comment/34312406
answers question: http://stackoverflow.com/q/22542044
has comment: http://stackoverflow.com/comment/34309494
has comment: http://stackoverflow.com/comment/34308857
score: 0
has comment: http://stackoverflow.com/comment/34312547
has body: Try this: private static final Comparator&lt;String&gt; CMP = new Comparator&lt;String&gt;() { @Override public int compare(final String a, final String b) { final int inta = Integer.parseInt(a.split("\\s+")[0]); final int intb = Integer.parseInt(b.split("\\s+")[0]); return Integer.compare(inta, intb); } } Then, later in code: final Path file = Paths.get("scores.txt"); final List&lt;String&gt; lines = Files.readAllLines(file, StandardCharsets.UTF_8); Collections.sort(lines, CMP); for (final String line: lines) System.out.println(line); (similarly you should use Files.newBufferedWriter() to get a Writer to your file)
has comment: http://stackoverflow.com/comment/34308903
type: Answer

http://stackoverflow.com/q/22595470
has body: I am writing a small program to find the day of the week using gregorian math. The following code always outputs a zero into my switch statement resulting in the same output each time. This is my code: iSum = (CentCode + iYear + (iYear /4) + MonthCode + iDay); iOutput %= iSum; switch (iOutput) { case 0: sDay = "sunday"; break; case 1: sDay = "monday"; break; case 2: sDay = "tuesday"; break; case 3: sDay = "wednesday"; break; case 4: sDay = "thursday"; break; case 5: sDay = "friday"; break; case 6: sDay = "saturday"; break; }
answer count: 1
favorite count: 0
has title: Math error switch always ends up zero
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22595667
tagged with: output
upvote count: 1
has comment: http://stackoverflow.com/comment/34401100
downvote count: 1
type: Question
tagged with: math
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/34401105

http://stackoverflow.com/a/22601486
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22601430
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34414759
answers question: http://stackoverflow.com/q/22601430
has comment: http://stackoverflow.com/comment/34412666
has comment: http://stackoverflow.com/comment/34412143
type: Answer
has comment: http://stackoverflow.com/comment/34419455
has comment: http://stackoverflow.com/comment/34412752
has body: If you have Java 7, then you can make use of Files.probeContentType(path). import java.nio.file.*; public class MimeTypes { public static void main(String[] args) { Path path; try { path = Paths.get("/etc"); System.out.println( path + " : " + Files.probeContentType(path) ); path = Paths.get("/dev/null"); System.out.println( path + " : " + Files.probeContentType(path) ); path = Paths.get("/var/log/syslog.2.gz"); System.out.println( path + " : " + Files.probeContentType(path) ); path = Paths.get("/var/run/rpcbind.sock"); System.out.println( path + " : " + Files.probeContentType(path) ); path = Paths.get("abc.mp4"); System.out.println( path + " : " + Files.probeContentType(path) ); path = Paths.get("MimeTypes.java"); System.out.println( path + " : " + Files.probeContentType(path) ); } catch (Exception x) { } } } Output: # java MimeTypes /etc : inode/directory /dev/null : inode/chardevice /var/log/syslog.2.gz : application/x-gzip /var/run/rpcbind.sock : inode/socket abc.mp4 : video/mp4 MimeTypes.java : text/x-java Oracle documentation of Files is here. Another option: Apache Tika Apache Tika is a toolkit for detecting and extracting metadata and structured text content from various documents using existing parser libraries. Tika has a lot of dependencies ... almost 20 jars ! But it can do a lot more than detecting filetype. For example, you can parse a PDF or DOC to extract the text and the metadata very easily. public static void main(String args[]) throws Exception { FileInputStream is = null; try { File f = new File("C:/Temp/mime/abc.mp4"); is = new FileInputStream(f); ContentHandler contenthandler = new BodyContentHandler(); Metadata metadata = new Metadata(); metadata.set(Metadata.RESOURCE_NAME_KEY, f.getName()); Parser parser = new AutoDetectParser(); // OOXMLParser parser = new OOXMLParser(); parser.parse(is, contenthandler, metadata); System.out.println("Mime: " + metadata.get(Metadata.CONTENT_TYPE)); System.out.println("Title: " + metadata.get(Metadata.TITLE));…
has comment: http://stackoverflow.com/comment/34418926
has comment: http://stackoverflow.com/comment/34412332
has comment: http://stackoverflow.com/comment/34419685
score: 4
has comment: http://stackoverflow.com/comment/34419204

http://stackoverflow.com/a/22545214
score: 5
has comment: http://stackoverflow.com/comment/111924219
has comment: http://stackoverflow.com/comment/38680400
answers question: http://stackoverflow.com/q/22543064
has comment: http://stackoverflow.com/comment/38705065
has body: Invalidate your Idea cache and restart Idea.
has comment: http://stackoverflow.com/comment/38680191
upvote count: 5
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/38679708
has comment: http://stackoverflow.com/comment/39355498

http://stackoverflow.com/q/22598006
tagged with: macos
has comment: http://stackoverflow.com/comment/34405740
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34405738
has comment: http://stackoverflow.com/comment/34406060
score: 5
has answer: http://stackoverflow.com/a/22598059
has answer: http://stackoverflow.com/a/22598239
linked to: http://stackoverflow.com/q/6815917
tagged with: java
possible better answer: http://stackoverflow.com/a/22598059
has body: I wrote a java program and I let the user use the Mac fullscreen feature, and I want to be able to know if the program is fullscreen or not. The problem is that I don't know how to detect when the user makes the program fullscreen, because they do so by clicking a button that isn't part of my program. Is there any way to detect if my program is fullscreen? If I wasn't clear enough, here is an example of the fullscreen button.
tagged with: fullscreen
has title: Java on Mac OSX - Detect if the program is fullscreened
upvote count: 5
linked to: http://stackoverflow.com/q/6873568
accepted answer: http://stackoverflow.com/a/22598239
has comment: http://stackoverflow.com/comment/34405828
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/34473397
has text: And how about your `theDirect` list?
type: Comment
comment on: http://stackoverflow.com/q/22636146
score: 0
type: QuestionComment

http://stackoverflow.com/a/23205067
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22630999
answers question: http://stackoverflow.com/q/22630999
has body: It appears to be a problem of the (default) JRE settings in Eclipse. To solve it, in the Package Explorer, right-click the "JRE System Library" > properties. Select "Execution environment", then select "JavaSE-1.7 (java-7-oracle)", press OK. It happened to me when creating a new project outside the workspace.
score: 5

http://stackoverflow.com/a/22626212
accepted answer of: http://stackoverflow.com/q/22626064
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22626064
type: AcceptedAnswer
has body: Start by creating a shuffled list... private List&lt;Icon&gt; list = new ArrayList&lt;Icon&gt;(); private List&lt;Icon&gt; shuffled; //... list.add(new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\e.jpg")); list.add(new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\d.jpg")); list.add(new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\yellow.png")); list.add(new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\f.jpg")); shuffled = new ArrayList&lt;Icon&gt;(); update(); Each time your timer ticks and calls actionPerformed, pop the first element of the shuffled list until nothing is left... if (shuffled.isEmpty()) { shuffled.addAll(list); // Prevent the current image from been selected next... shuffled.remove(label.getIcon()); Collections.shuffle(shuffled); } Icon icon = shuffled.remove(0); label.setIcon(icon); This will remove the possibility of an image been allowed to be displayed multiple times in a row. Your random value calculation should have been more like int i1 = (r.nextInt(list.size())); anyway... Notes: ImageShuffle doesn't need to extend from JPanel, you not adding anything to it. This means you can get rid of this.setLayout(new GridLayout(1, 0)); and f.add(this); and the program should still run

http://stackoverflow.com/q/22641489
has title: Need assistance reducing duplicate code
has answer: http://stackoverflow.com/a/22641736
upvote count: 1
tagged with: duplication
favorite count: 0
answer count: 5
type: UnansweredQuestion
has body: I'm a beginner and the lecturer told me to reduce the duplicate code in these two functions. This is a library. I guess I need one more method for checking through the array. All I need is some advice/principle I need to use. I'll write the method myself. Thanks! getBooks() returns the ArrayList where Books are stored. public List&lt;Book&gt; getAvailableBooks() { List&lt;Book&gt; result = new ArrayList&lt;Book&gt;(); for (int i = 0; i &lt; this.getBooks().size(); i++) { if (this.getBooks().get(i).getPerson() == null) { result.add(this.getBooks().get(i)); } } return result; } public List&lt;Book&gt; getUnavailableBooks() { List&lt;Book&gt; result = new ArrayList&lt;Book&gt;(); for (int i = 0; i &lt; this.getBooks().size(); i++) { if (this.getBooks().get(i).getPerson() != null) { result.add(this.getBooks().get(i)); } } return result; }
has answer: http://stackoverflow.com/a/22641623
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22641821
has comment: http://stackoverflow.com/comment/34483363
type: Question
has answer: http://stackoverflow.com/a/22641576
has answer: http://stackoverflow.com/a/22641547

http://stackoverflow.com/q/22625448
tagged with: java
type: Question
downvote count: 0
has body: I am making a custom keyboard very similar to that described here: Use an EditText with custom keyboard I am adding this custom keyboard to an already existing application, and in doing so I am running into the following problem: The keyboard is initialized in the activity class. The onPress method for the keyboard is also in the activity class. However, the inputTextView which has a setText method that is supposed to be called by onPress is inside of a subclass of View that isn't accessible to the activity. I think it has to do with the following. The main activity class contains a ListView, which contains a BaseAdapter with the following method: public View getView(int position, View convertView, ViewGroup parent) { ... equationView = new EquationView(parent.getContext()); ... return equationView; } I can't figure out how to pass the correct ViewGroup so that the new View is returned.
tagged with: keyboard
has title: custom keyboard access to editText in android
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
linked to: http://stackoverflow.com/q/19262563
score: 1

http://stackoverflow.com/a/22647696
type: Answer
has body: Use if's and the primitive wrapper classes. Each primitive class has a public static variable TYPE which is a class. eg: http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#TYPE if (Double.TYPE = resultType) inputList.add(scanner.nextDouble(); else if (Integer.TYPE = resultType) inputList.add(scanner.nextDouble(); else if (FLOAT.TYPE = resultType) inputList.add(scanner.nextFloat(); and more ifs.... for all the primitives you're taking as acceptable input.
accepted answer of: http://stackoverflow.com/q/22647444
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22647444

http://stackoverflow.com/comment/135254107
score: 0
type: Comment
has text: This part: <<you cannot change the value of the variable you reference in a closure>> What do you say about single element arrays, e.g., `final int[] numRef = {0};`? I see this trick used frequently to mutate a variable from a closure.
type: AnswerComment
comment on: http://stackoverflow.com/a/22530544

http://stackoverflow.com/comment/34242072
comment on: http://stackoverflow.com/q/22506364
has text: Please show us some code.
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22609885
type: Answer
answers question: http://stackoverflow.com/q/22609634
has body: Just mixed values, in your case flag is always 2. class Chat { int flag = 2; public synchronized void getTalk1(String msg) throws InterruptedException { if (flag == 2) { wait(); } System.out.println(msg); flag = 2; notify(); } public synchronized void getTalk2(String msg) throws InterruptedException { if (flag == 1) { wait(); } System.out.println(msg); flag = 1; notify(); } }
score: 0

http://stackoverflow.com/a/22528950
accepted answer of: http://stackoverflow.com/q/22528840
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22528840
has body: You will need AtomicReference when you have to update a reference which needs to be updated by a set of threads and read by other threads. For instance, consider a processing job whose description and status is represented by some JobReport class; you have some threads processing a queue of jobs, and when one thread completes a job, it creates a JobReport object; in another set of threads, you want to know at one point in time, and as accurately as possible, which job was last processed: you need the latest JobReport. In this case, all of these threads will share an AtomicReference&lt;JobReport&gt;; processing threads will write to it the report of the job they have just completed, while the reading, reporting threads will read from that reference. (well, when I say "need"... There are other solutions to that scenario, but this is one of them)

http://stackoverflow.com/comment/34324266
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22550373
has text: I have updated the question Jason. And yes, the jar file wasn't added but having added it now I get the exception saying that "the connection has timed out".
score: 0

http://stackoverflow.com/comment/34229272
type: Comment
score: 1
has text: +1 Remember, too, @WadeG, your code should generally reflect your intentions. Was your intention to create 4 separate calculators? Or was your intention to create a single calculator that held all of the information?
type: AnswerComment
comment on: http://stackoverflow.com/a/22498502

http://stackoverflow.com/q/22618988
score: 0
has comment: http://stackoverflow.com/comment/34446014
answer count: 1
tagged with: pattern-matching
has title: Filtering in dynamic pattern from a file using Java
has body: I have a filtering in(include) and filtering out(exclude) criteria requirement, where I have below two files. MAIN FILE CountryCode|RegionCode|StateCode|FilterFlag USA|NAM|NY|IN USA|NAM|NJ|IN USA|MIDWEST|MI|IN UK|EMEA|GB|OUT Lookup File CountryCode|RegionCode|StateCode|FilterFlag USA|NAM|ANY|IN USA|ANY|MI|OUT Use Case: In Lookup File, When FilterFlag has "IN", RegionCode and StateCode has "ANY", it should include all states and regions. In Lookup File, When FilterFlag has "IN", Any of the Region Code and Statecode has "ANY", it should include all states or regions respectively. Main File will never have "ANY", it will come with real values and should consider lookup data to filter in/out.
type: UnansweredQuestion
tagged with: java
tagged with: design-patterns
type: Question
tagged with: filtering
has answer: http://stackoverflow.com/a/22619132

http://stackoverflow.com/comment/34310421
score: 0
has text: Couldn't you just write: sql2 = "INSERT INTO Movie (MovieID, Title, Actor, Genre ) VALUES (movie_seq.nextval,?,?,?)"; ? With this statement you could avoid the two select statements and the movetoinsertrow .
type: AnswerComment
comment on: http://stackoverflow.com/a/22542874
type: Comment

http://stackoverflow.com/q/22540851
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34305002
has comment: http://stackoverflow.com/comment/34304626
answer count: 0
tagged with: jquery
has title: Jquery Ajax call served by Java Socket doesn't get a success response
tagged with: ajax
has body: //--------- Java Socket Server -------- package com.company.server; import java.io.BufferedInputStream; import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.StringReader; import java.net.Socket; import java.util.Properties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Worker implements Runnable { private static Logger logger = LoggerFactory.getLogger(Worker.class); private Socket socket; public Worker(final Socket socketParam) { socket = socketParam; } public void run() { logger.trace(String.format("Connection established with %s.", socket.getRemoteSocketAddress())); orchestrate(); } public void orchestrate() { try { final HttpPacket httpIn = readRequest(); respond(httpIn); } catch (IOException e) { e.printStackTrace(); } } public HttpPacket readRequest() throws IOException { final HttpPacket httpIn = new HttpPacket(); final BufferedInputStream in = new BufferedInputStream(socket.getInputStream()); byte[] streamBuf = new byte[in.available()]; in.read(streamBuf); final String payload = new String(streamBuf, "UTF-8"); final String[] payloadSplit = payload.split(System.getProperty("line.separator")); final StringBuilder headerBuilder = new StringBuilder(); final StringBuilder bodyBuilder = new StringBuilder(); boolean bodyField = false; for (int i = 0; i&lt; payloadSplit.length; i++) { if (i == 0) { String[] firstLine = payloadSplit[0].split("\\s"); httpIn.setMethod(firstLine[0]); httpIn.setUrl(firstLine[1]); } else if ("".equals(payloadSplit[i].trim())) { bodyField = true; } else if (bodyField) { bodyBuilder.append(payloadSplit[i]); bodyBuilder.append("\n"); } else { headerBuilder.append(payloadSplit[i]); headerBuilder.append("\n"); } } final Properties props = parsePropertiesString(headerBuilder.toString()); httpIn.setHttpHeaders(props); httpIn.setBody(bodyBuilder.toString()); logger.trace(String.format("Data received from from %s connection:\n%s", socket.getRemoteSocketAddress(), payloa…
type: Question
has comment: http://stackoverflow.com/comment/34317396
has comment: http://stackoverflow.com/comment/34304860
has comment: http://stackoverflow.com/comment/34304935
score: 0
has comment: http://stackoverflow.com/comment/34309766
tagged with: http
has comment: http://stackoverflow.com/comment/34304410
tagged with: java
tagged with: javascript

http://stackoverflow.com/q/22503391
has answer: http://stackoverflow.com/a/41117360
has answer: http://stackoverflow.com/a/22503563
tagged with: java
tagged with: web-crawler
type: Question
answer count: 2
has body: I'm new to such type of problem, so I have question about data crawling from websites. I need retrieve data from some website, as I know the data can be retrieved in form of csv or xls file. But how can I get url to download it? For example, I'm opening some clothes shop and see all assortment, is where some way to receive this data in form of file(csv or some other)?or I need to parse somehow html?
accepted answer: http://stackoverflow.com/a/22503563
score: 0
tagged with: http://stackoverflow.com/tag/csv
has title: Data crawling from websites
possible better answer: http://stackoverflow.com/a/41117360
type: AnsweredQuestion

http://stackoverflow.com/a/22631928
has body: So you are trying to call http://localhost:8180/GisProject/MainService? which will invokde MainService class according to your web.xml. However what you show here is CreateService which will get invoked if you call http://localhost:8180/GisProject/CreateService. If what you want is to display index.html when calling http://localhost:8180/GisProject/MainService then you have to move the implementation to MainService class.
answers question: http://stackoverflow.com/q/22629294
score: 0
type: Answer

http://stackoverflow.com/q/22560225
has comment: http://stackoverflow.com/comment/34823499
tagged with: java
has comment: http://stackoverflow.com/comment/34982876
type: Question
score: 0
tagged with: android
tagged with: android-bitmap
has body: I have a dialog and convert it to a bitmap. Then I want so send it with the Sharing Intent: Bitmap cs = null; v1.setDrawingCacheEnabled(true); v1.buildDrawingCache(true); cs = Bitmap.createBitmap(v1.getDrawingCache()); Canvas canvas = new Canvas(cs); v1.draw(canvas); canvas.save(); v1.setDrawingCacheEnabled(false); String path = Images.Media.insertImage(getContext().getContentResolver(), cs, "MyImage", null); Uri file = Uri.parse(path); Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("image/png"); sharingIntent.putExtra(Intent.EXTRA_STREAM, file); getContext().startActivity(Intent.createChooser(sharingIntent,"Share image using")); v1 is the parent of a TextView in the dialog (v1 is what I want to send). If I send the bitmap now it has a really bad quality. How can I improve that?
has comment: http://stackoverflow.com/comment/34999078
answer count: 0
tagged with: drawingcache
type: UnansweredQuestion
has title: Android, Java: Improve quality of Bitmap with getDrawingCache()
tagged with: bitmap

http://stackoverflow.com/comment/34388923
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22588581
has text: @ultra_buckner its is wrong to have a constructor for a fragment with args. just use `getActivity()` and remove the constructor

http://stackoverflow.com/comment/34381158
type: QuestionComment
type: Comment
has text: Caching is not an issue here, we clear the cache between subsequent tests and verify the new jars are being download. The only modification we do is sign all third party jars, we don't do any other modification. Adding an attribute to the manifest effectively renders any existing signature invalid. We use bouncy castle as a security provider and if we modify the manifest bouncy castle refuses to work. "if you use an IDE.. you are modifying them anyways". What you are referring to here? Do you have any documentation that says the permissions attribute is required in all jars loaded w/web start?
comment on: http://stackoverflow.com/q/22518240
score: 0

http://stackoverflow.com/q/22498645
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34229364
upvote count: 0
type: UnansweredQuestion
tagged with: mysql
type: Question
has body: Below is my code where i am using JDBC and to make the query run faster am replacing Statement with PrepareStatement but the page is not woking.what is the wrong i am doing?? code: Select State <% PreparedStatement stmt=null; DBconnection db=new DBconnection(); Connection con=db.dbConn(); try{ stmt = (PreparedStatement)con.createStatement(); ResultSet rs = stmt.executeQuery("select distinct StateID,State from election_history;"); while(rs.next()) { %> <option value="<%=rs.getString(2)%>"><%=rs.getString(2)%> <% } } catch(SQLException e){ e.printStackTrace(); } finally{ con.close(); stmt.close(); } %> my jars are: antlr.jar java-image-scaling mysql-connecotr-java 2.0.14 Error: java.lang.NullPointerException at org.apache.jsp.election_005fresults_jsp._jspService(election_005fresults_jsp.java:267) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:8…
score: -2
has title: Prepared statement not working when replaced with Statement?
tagged with: java
has comment: http://stackoverflow.com/comment/34229511
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/34229408
favorite count: 0
has answer: http://stackoverflow.com/a/22498822
has answer: http://stackoverflow.com/a/22498688

http://stackoverflow.com/comment/34379472
has text: I fixed the tags, but what do u mean "using quotes for attribute values" ?
comment on: http://stackoverflow.com/q/22582839
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34431013
comment on: http://stackoverflow.com/a/22612042
score: 0
type: Comment
has text: Because, only if you sort the words, you can use binary search on the array of words, which is an efficient way to search for words in an array.
type: AnswerComment

http://stackoverflow.com/a/22644966
type: Answer
score: 3
upvote count: 3
has body: I think your code is good (except that you don't "put" any data into anything, you merely reference the data buffer's backing array, meaning changes in pixels will reflect to paletteBufferedImage and vice versa). To get the ARGB values for the indices in pixels: IndexColorModel indexedCM = (IndexColorModel) paletteBufferedImage.getColorModel(); // cast is safe for TYPE_BYTE_INDEXED int[] palette = new int[indexedCM.getMapSize()]; // Allocate array indexedCM.getRGBs(palette); // Copy palette to array (ARGB values) For more information, see the IndexColorModel class documentation.
downvote count: 0
answers question: http://stackoverflow.com/q/22613520

http://stackoverflow.com/q/22600773
tagged with: java
tagged with: file
tagged with: eclipse
has title: How do you create file folders with Java (using Eclipse Kepler?)?
type: Question
linked to: http://stackoverflow.com/q/3024002
score: 0
has answer: http://stackoverflow.com/a/22601000
answer count: 1
tagged with: directory
has body: I'm looking for a way to create a file folder with Eclipse Kepler. I'm just starting to learn this, so please excuse me for any ignorance I may be showing; I don't often apply Java to programs other than plugins for a game called Minecraft. So far, I know that files are creatable (with the code I have) through a file folder IF the folder exists, but the program won't create the folder automatically, like it does with the file that's being generated when the specified folder does exist. Here's the code I have so far: package me.pookeythekid.filetests; import java.io.BufferedWriter; import java.io.FileWriter; public class Main { public static void main(String[] args) { try { FileWriter fw = new FileWriter("C:\\Users\\Luke\\Desktop\\Folder\\Test.txt"); BufferedWriter bw = new BufferedWriter(fw); bw.write("Hello World!"); bw.close(); } catch (Exception e) { e.printStackTrace(); } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34410820
duplicate of: http://stackoverflow.com/q/3024002
has comment: http://stackoverflow.com/comment/34410845

http://stackoverflow.com/q/22509685
type: Question
has answer: http://stackoverflow.com/a/22511872
has body: For example, I have some storage which I want to manage via jmx. I want to have control over all members of storage together and separately. Interface of storage may look like this: public interface StorageMBean { int getSize(); int disableAll(); // ?????? List&lt;EntryMBean&gt; getAllEntries(); } And interface of single storage entry like this: public interface EntryMBean { String getName(); void disable(); } So I want to be able to run jconsole and disable all entries at once or one by one. Now I see only one way: register some GroupStorageMBean where I put group methods. And register many individual EntryMBeans. And now I need to keep all this objects in sync. It would be easier if I could register StorageMBean and it would provide nested MBeans as attribute or something like this. So via such method I would be able to obtain all entries and work with them individually. I hope my explanation was not very confusing. Is it possible to do such thing?
tagged with: jmx
upvote count: 1
answer count: 1
tagged with: java
type: UnansweredQuestion
has title: JMX. Is it possible to make nested MBeans?
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/22512158
score: 0
answers question: http://stackoverflow.com/q/22512050
type: Answer
has body: You're not giving us a lot to go on here - are you using swing? Most likely is that your main thread is exiting and your app is being disposed. From the docs: public static void main(String[] args) { //1. Create the frame. JFrame frame = new JFrame("FrameDemo"); //2. Optional: What happens when the frame closes? frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //3. Create components and put them in the frame. //...create emptyLabel... frame.getContentPane().add(emptyLabel, BorderLayout.CENTER); //4. Size the frame. frame.pack(); //5. Show it. frame.setVisible(true); }

http://stackoverflow.com/a/27587015
answers question: http://stackoverflow.com/q/22527978
score: 2
upvote count: 2
downvote count: 0
type: Answer
has body: Just to add to Rob's solution above, as of December 20, 2014, there is a bug in the SecurityRequestPostProcessors class on the master branch from Rob's answer above that prevents the assigned roles from being populated. A quick fix is to comment out the following line of code (currently line 181) in the roles(String... roles) method of the UserRequestPostProcessor inner static class of SecurityRequestPostProcessors: // List&lt;GrantedAuthority&gt; authorities = new ArrayList&lt;GrantedAuthority&gt;(roles.length);. You need to comment out the local variable, NOT the member variable. Alternatively, you may insert this line just before returning from the method: this.authorities = authorities; P.S I would have added this as a comment had I had enough reputation.

http://stackoverflow.com/comment/34287424
has text: @CodeChimp No that's not a typo - manifest.mf should be the output file, manifest.txt the input. Everything seemed to work fine except for the jar file which refuses to execute!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22503804

http://stackoverflow.com/a/22542689
has comment: http://stackoverflow.com/comment/34317506
has comment: http://stackoverflow.com/comment/34342857
has comment: http://stackoverflow.com/comment/34343982
answers question: http://stackoverflow.com/q/22542470
has body: POI's Quick Guide aka the "Busy Developers' Guide to HSSF and XSSF Features" contains lots of code snippets, including one that talks about opening an existing workbook, and reading and writing and saving the modified workbook (example verbatim copied from that page, added some comments): InputStream inp = new FileInputStream("workbook.xls"); // notice how the Workbook must be constructed from the existing file Workbook wb = WorkbookFactory.create(inp); // Navigating in POI always follows the same logic: // 1. grab a sheet // 2. grab a row from that sheet // 3. grab a cell from that row Sheet sheet = wb.getSheetAt(0); Row row = sheet.getRow(2); Cell cell = row.getCell(3); // a condition like the one that follows will be needed to know in what column // you have to write your data: if (cell == null) cell = row.createCell(3); cell.setCellType(Cell.CELL_TYPE_STRING); cell.setCellValue("a test"); // Write the output to a file FileOutputStream fileOut = new FileOutputStream("workbook.xls"); wb.write(fileOut); fileOut.close(); That, and the other examples on that page should get you up to speed quickly.
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34337388
has comment: http://stackoverflow.com/comment/34340791
score: 2
has comment: http://stackoverflow.com/comment/34340087

http://stackoverflow.com/comment/34600846
score: 0
type: AnswerComment
has text: I found that it's not JAVA problem. I think it's Android problem. Running same code(without changing any kind of socket reading code) that I've written for Android on my computer gives me download speed of 1 Mbps while on Android it's giving me speed of 200 Kbps. I'll mark your answer as correct and open another thread for android specific problem. Thanks
type: Comment
comment on: http://stackoverflow.com/a/22569935

http://stackoverflow.com/a/22609876
has comment: http://stackoverflow.com/comment/34426495
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34435280
has body: A query will only ask the datastore for a set of object satisfying a criteria and retrieve these. To update an object you need to retrieve it (with a query for instance), update this object and then put it back in the datastore (by calling your ORM put method).
type: Answer
has comment: http://stackoverflow.com/comment/34426938
has comment: http://stackoverflow.com/comment/34426586
has comment: http://stackoverflow.com/comment/34426712
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22609522
answers question: http://stackoverflow.com/q/22609522

http://stackoverflow.com/comment/34360189
score: 0
comment on: http://stackoverflow.com/q/22572557
type: Comment
type: QuestionComment
has text: First he should clarify it!

http://stackoverflow.com/q/22619856
has body: I have an Applet program, which can be run from Eclipse directly for testing. I am setting window size of this Applet. But, I am seeing sometimes the applet opens with smaller window rather than the actual window size is set, and sometimes it opens with the proper set size setSize(550, 650); I couldn't get fix for why sometimes it opens with the smaller window. Could someone advise me to fix this issue? public class HomeApplet extends Applet implements ActionListener { public void init() { titleStr = "Welcome to Application Home page!"; connectBtn = new Button("Submit"); connectBtn.addActionListener(this); add(connectBtn); connectBtn.setBounds(100, 120, 90, 20); connectBtn.setEnabled(true); setLayout( null ); setSize(550, 650); sharedImage = new ImageIcon("sameer15.jpg" ).getImage(); } public void paint (final Graphics g) { //super.paint(g); int x = getSize().width; int c1 = x/2; Font titleFont = new Font("Arial", Font.BOLD, 20); g.setFont(titleFont); g.drawString(titleStr, c1-170, 20); Font connectFont = new Font("Arial", Font.BOLD, 15); g.setFont(connectFont); g.drawString(connectStr, c1-190, 80); g.drawImage(sharedImage, 100, 100, this); System.out.println("drawImage"); } }
tagged with: awt
has comment: http://stackoverflow.com/comment/34454778
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22627740
linked to: http://stackoverflow.com/q/19367320
has comment: http://stackoverflow.com/comment/34445851
has comment: http://stackoverflow.com/comment/34458765
linked to: http://stackoverflow.com/q/6255106
linked to: http://stackoverflow.com/q/17874717
tagged with: paint
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/34385419
linked to: http://stackoverflow.com/q/5621338
tagged with: image
has title: Applet: Window opens with smaller size
score: 0
answer count: 2
tagged with: applet

http://stackoverflow.com/comment/34398352
comment on: http://stackoverflow.com/a/22591253
score: 0
type: AnswerComment
type: Comment
has text: even above code does not create any file in temp folder... can you please tell me alternative method

pdfclown
tags question: http://stackoverflow.com/q/22595683
type: Tag
tag name: pdfclown

http://stackoverflow.com/comment/34411305
score: 0
has text: @Marco13: Thanks for the reply. It refers to issues in 64 bit systems. My one is 32 bit,
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22597183

http://stackoverflow.com/comment/40227782
comment on: http://stackoverflow.com/a/25090151
score: 3
type: AnswerComment
has text: @Mark You may want to set the following in yarn-site.xml like so: ` yarn.nodemanager.delete.debug-delay-sec 600 ` From the [docs](http://hadoop.apache.org/docs/r2.2.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml): Number of seconds after an application finishes before the nodemanager's DeletionService will delete the application's localized file directory and log directory. To diagnose Yarn application problems, set this property's value large enough (for example, to 600 = 10 minutes) to permit examination of these directories.
type: Comment

http://stackoverflow.com/q/22591577
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has body: I'm using the following as a background for a layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;solid android:color="#FFFFFF" /&gt; &lt;corners android:radius="20dip"/&gt; &lt;padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" /&gt; &lt;/shape&gt; but the rounded-ness looks very different on a 4" 800x480 screen than it does on a 4.7" 1280x720 screen. Is there any way to set the radius relative to the screen?
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22592374
tagged with: java
has comment: http://stackoverflow.com/comment/34393911
type: Question
score: 2
tagged with: layout
answer count: 1
downvote count: 0
has title: Android layout - set rounded corner radius relative to screen size
tagged with: android
has answer: http://stackoverflow.com/a/22592374

http://stackoverflow.com/comment/34454769
has text: I think I'd really enjoy tackling a problem like this. Thanks for sharing your details. We also had another thread this weekend asking about k-way merge: [`Perl Merge File`](http://stackoverflow.com/questions/22586089/perl-merge-file)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22625156
type: Comment

http://stackoverflow.com/a/22509482
score: 7
has comment: http://stackoverflow.com/comment/34247707
accepted answer of: http://stackoverflow.com/q/22508922
downvote count: 0
has body: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) As you have mentioned problem is with creating connection with the database itself. Statement con = DriverManager.getConnection(DatabaseURL, userName, password); is throwing exception which is getting caught at catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } after which you are returning dbresult which you have initialized to null(which you have to as it is a local variable). So the problem is that you are unable to connect to your db due to authentication. On your machine where (localhost in ur case ) run the following command from console GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;
type: AcceptedAnswer
type: Answer
upvote count: 7
answers question: http://stackoverflow.com/q/22508922

http://stackoverflow.com/comment/34321687
has text: Search "Java String to Date" - there are literally thousands of examples. The question will be, what format is `Dateimp` in...
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22550796

http://stackoverflow.com/comment/34418619
comment on: http://stackoverflow.com/a/22604285
type: Comment
has text: That's specific of `GridBagLayout`, I always use dummy components for grabbing empty space.
score: 0
type: AnswerComment

null
tags question: http://stackoverflow.com/q/22586835
tag name: null
tags question: http://stackoverflow.com/q/22630171
tags question: http://stackoverflow.com/q/22571805
tags question: http://stackoverflow.com/q/22489756
tags question: http://stackoverflow.com/q/22539763
type: Tag
tags question: http://stackoverflow.com/q/22554470
tags question: http://stackoverflow.com/q/22535252

http://stackoverflow.com/a/22580041
upvote count: 4
downvote count: 0
has body: System.load("/usr/local/gcc-4.8.1-glibc-2.17/lib/libc.so.6"); As I explained here, this can not possibly work. By the time you reach above statement, the system libc.so.6 has already been loaded (at process startup), and you absolutely can not have two versions of libc.so.6 loaded into the same process.
accepted answer of: http://stackoverflow.com/q/22550611
answers question: http://stackoverflow.com/q/22550611
type: AcceptedAnswer
score: 4
type: Answer

http://stackoverflow.com/q/22539763
linked to: http://stackoverflow.com/q/218384
answer count: 2
tagged with: null
has title: Null Pointer Exception & how to overcome it
tagged with: pointers
has comment: http://stackoverflow.com/comment/34302132
score: 0
tagged with: nullpointerexception
tagged with: exception
has answer: http://stackoverflow.com/a/22539901
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22539921
has body: While running the public tests for my code I have received 2 errors on similar lines. The errors are: Null Pointer Exception Errors and the line in which they appear is the one with getCurrentLocation & getName in it. assertEquals("Initially, Parrade is at Fun Fire", "Fun Fire", parrade.getCurrentLocation().getName()); parrade.move(); The full code of my constructors as well as getCurrentLocation & getName are as follows: Code: public abstract class Ride { private String name; private int duration; private int batchSize; private ArrayList<Amuser> currentAmusers; private int ridesToMaintain; private FunRide location; public Ride() { this.name = "Serpent"; this.duration = 5; this.batchSize = 20; this.ridesToMaintain = 10; this.currentAmusers = new ArrayList<Amuser>(); } public Ride(String name, int duration, int batchSize) { this.name = name; this.duration = duration; this.batchSize = batchSize; this.ridesToMaintain = 10; this.currentAmusers = new ArrayList<Amuser>(); } public FunRide getCurrentLocation() { return this.location; } Any idea how to solve this?
tagged with: java
type: Question

http://stackoverflow.com/comment/34270585
type: AnswerComment
comment on: http://stackoverflow.com/a/22521624
has text: @user3440080 Go to http://pastie.org and post your code there, then send me the link to it. I'll take a look. I already know that the problem is that you have a method inside another method, though.
type: Comment
score: 0

http://stackoverflow.com/comment/34314254
comment on: http://stackoverflow.com/q/22546197
type: QuestionComment
type: Comment
score: 1
has text: Have you tried launching eclipse in clean mode ?

http://stackoverflow.com/comment/34357681
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22565891
score: 0
has text: @JonSkeet your "question" worked. Do you mind posting as response so I may mark this thread as accepted?

http://stackoverflow.com/q/22616950
has title: Hibernate with more than one dataBase
has comment: http://stackoverflow.com/comment/34439755
has body: I need to use hibernate with 2 or more bases. Since these bases have the same table, I imagine that there will be no problem when using the same objects paras tables that repeat. So being, I wonder how to spend other files on HibernateUtil establishing the connection, using different files hibernate.cfg.xml, but with the same mapping properties. I imagine it's something along these lines: sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory(); but i dont have idea how to configure a other file.
has answer: http://stackoverflow.com/a/22620599
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34439954
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/34439650
score: 0

http://stackoverflow.com/q/22561632
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34342768
tagged with: clob
type: UnansweredQuestion
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34343067
has comment: http://stackoverflow.com/comment/34343256
type: Question
downvote count: 0
tagged with: string
has body: I have a problem: in my app CLOB converts to string very slow. For example, convert VARCHAR2(40) to string takes 0,001ms, convert CLOB(~1600) to string takes 0.8. For converting to 1600/40=40 times more bytes, need 0.8/0.001=800 times more time (20 times slower) I convert with ResultSet rs = ... while (rs.next()){ Clob clob = rs.getClob(3); String s = clob.getSubString(1, MAX_TEXTITEM_LENGTH); ... Opening Clob.getCharacterStream() take many time too... I think, that problem in encoding or something else? Need advice! Oracle database use UTF-8 charset. UPDATE. The trouble in: "By drivers implement a Clob object using an SQL locator(CLOB), which means that a Clob object contains a logical pointer to the SQL CLOB data rather than the data itself." How i can take CLOB value inline (when i use next())? P.S. Sry for bad english.
has comment: http://stackoverflow.com/comment/34342988
tagged with: oracle-database
has answer: http://stackoverflow.com/a/49327117
has title: Fast convert CLOB to String without encoding in java
answer count: 1
tagged with: jdbc

http://stackoverflow.com/a/22607403
score: 1
answers question: http://stackoverflow.com/q/22607202
has body: I could store the regions as an array and loop through the entries until I find one that matches, but this isn't linear time It is linear. Assuming that regions are sorted, you could use Binary Search.
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34377123
score: 0
type: Comment
type: QuestionComment
has text: I think he's saying that the super is what is being called and that's not what he wants.
comment on: http://stackoverflow.com/q/22582128

http://stackoverflow.com/comment/34406253
has text: maybe this helpful for u http://www.dreamincode.net/forums/topic/65223-dynamic-radio-buttons-in-button-group/
comment on: http://stackoverflow.com/q/22598065
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22577697
answers question: http://stackoverflow.com/q/22577671
upvote count: 1
type: Answer
has body: main is not a constructor, it's a static method which is the entry point to your application. Since it's a static method, you don't need to create an instance of the class to call it. You can only call the super to invoke a superclass's constructor within the superclass constructor, and since main isn't a constructor, your second code example is not valid.
downvote count: 0
score: 1

http://stackoverflow.com/comment/34318306
score: 0
has text: I have 4 tables and after getting these columns from lookup table i have to perform operations on other table , like compare if value from a particular column of lookup is present in other table .if yes then insert some data into that table. That's why i need to store the entire data from table into objects.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22548606

http://stackoverflow.com/a/22633178
answers question: http://stackoverflow.com/q/22632774
score: 0
type: Answer
has body: Here, To pass data to another JSP page,You can try like this. &lt;script&gt; var fun = "Your value"; &lt;/script&gt; &lt;input type="hidden" name="test" id="test" /&gt; &lt;script&gt; document.getElementById("test").value=fun;&lt;/script&gt; Now You can use this value in another JSP page like. String test = request.getParameter(test); Is this ok?
has comment: http://stackoverflow.com/comment/34468468
has comment: http://stackoverflow.com/comment/34468606

http://stackoverflow.com/comment/34284225
comment on: http://stackoverflow.com/q/22529926
score: 0
type: Comment
type: QuestionComment
has text: You assigned values to your `TWITTER_CONSUMER_KEY = "my_api_key"`; `TWITTER_CONSUMER_SECRET = "my_api_secret"`; ?

http://stackoverflow.com/a/22615517
has body: Your problem is the InputStreamReader. You should be explicitly telling it what charset to use instead of using the platform default, which is not what you want. Ideally, you should be reading the Content-Type header and using that to pick the charset intead of hardcoding utf-16 (LE or BE?). To clarify your thoughts about Java using utf-16 internally, you are correct, but the issue is that you need to convert bytes to characters and that has nothing to do with how Java internally handles String. Also, you might want to think about using utf-8 as that tends to be the default unicode encoding on the web.
accepted answer of: http://stackoverflow.com/q/22615290
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22615290

http://stackoverflow.com/comment/34450732
type: QuestionComment
has text: Have you tried adding `game` to the frame?
score: 0
comment on: http://stackoverflow.com/q/22623001
type: Comment

http://stackoverflow.com/comment/34318845
comment on: http://stackoverflow.com/q/22548980
type: Comment
type: QuestionComment
has text: yeah, call `flush` or `close` on `writer` instance
score: 1

http://stackoverflow.com/comment/34624036
type: AnswerComment
comment on: http://stackoverflow.com/a/22669673
type: Comment
has text: This works great but I scale out in my game, I'm using the Slick2D library, and if I try scaling then nothing gets rendered. I don't know how Slick2D translates locations based on scale so can anyone help? My scale is 0.8
score: 0

http://stackoverflow.com/a/22548530
downvote count: 0
type: Answer
has body: Your field 7 packager is &lt;isofield id="7" length="14" name="TRANSMISSION DATE AND TIME" class="org.jpos.iso.IFA_NUMERIC"/&gt; You set it to: m.set(7, "0319174039"); The packager pads it to 14 wide (0's added on the left). Try this and you will notice it: Logger l = new Logger(); l.addListener(new SimpleLogListener(System.out)); ISOPackager packager = new GenericPackager("iso87ascii.xml"); packager.setLogger(l, ""); ISOMsg m = new ISOMsg(); m.setMTI("0820"); m.set(7, "0319174039"); m.set(11, "639530"); m.set(15, "0319"); m.set(24, "001"); m.set(64, "6038f060aba137a5b0efb4cc538416c8"); m.setPackager(packager); byte b[] = m.pack(); m.dump(System.out,""); m.unpack(b); System.out.println(ISOUtil.hexdump(b)); m.dump(System.out,""); What you call package length header is what jpos does through channels. So you pass your iso msg through a channel that append/prepends length to the message and transmits it. ASCIIChannel channel = new ASCIIChannel("127.0.0.1",7654,packager);//IP port to connect to, and packager will be used to pack the message and send it channel.setLogger(l, "Test"); channel.send(m); See also the Google Group thread.
answers question: http://stackoverflow.com/q/22503968
score: 3
upvote count: 3

http://stackoverflow.com/q/22619740
has answer: http://stackoverflow.com/a/22619877
has answer: http://stackoverflow.com/a/22619911
tagged with: java
has title: iText making a whole roll in table coloured
tagged with: jtable
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/22619877
score: 1
favorite count: 0
has body: What's the simplest way to make a whole table row coloured in a PDF using iText? At the moment my code below only colours a specific cell in the table but I am not sure how to make the entire row coloured. Would appreciate if somebody can tell me how this is done but please do not post any code! I'd like to do the code myself. Thanks for (int i = 0; i &lt; rows; i++) { for (int j = 0; j &lt; cols; j++) { PdfPCell cell = new PdfPCell(new Phrase(myJTable.getValueAt(i, j).toString(), myFont)); if (phrase.toString().contains("Test")) { cell.setBackgroundColor(BaseColor.RED); //I want to change the colour of //the entire row containing a cell called "Test", not only the cell itself } pdfTable.addCell(cell); } }
tagged with: colors
type: Question
possible better answer: http://stackoverflow.com/a/22619890
has answer: http://stackoverflow.com/a/22619890
answer count: 3
tagged with: itext
upvote count: 1

http://stackoverflow.com/comment/34458840
comment on: http://stackoverflow.com/a/22610559
type: AnswerComment
has text: Thanks! It's an assignment, and I tried like this: for every element in the array, call the recursive method(calculate the best) with an array excluding that element, and the corresponding integer subtracting that element...and then I cannot figure out what to return for the base case. Recursion for me is quite tough.
score: 0
type: Comment

http://stackoverflow.com/q/22611283
has body: Everything is working fine, I just need my output to say the quarter with the highest/lowest rainfall, not the actual values. I am not sure how to tie the quarter and the values together so that the output will be quarter 1, 2, 3 or 4. import java.util.Scanner; public class rainfall { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double[] rainfall = new double[4]; double totalRainfall = 0.0; double max = 0, min = 0; for (int i=0; i &lt; 4; i++) { System.out.print("Enter rainfall for quarter " + (i+1) + ": "); rainfall[i] = scan.nextDouble(); totalRainfall += rainfall[i]; if (i == 0) { max = min = rainfall[i]; } { if (rainfall[i] &gt; max) max = rainfall[i]; else if (rainfall[i] &lt; min) min = (i + 1); //min = rainfall[i]; } } System.out.println("Total rainfall = "+totalRainfall); System.out.println("Average rainfall = "+(totalRainfall / 4.0)); System.out.println("Max quarter rainfall = "+ max); System.out.println("Min quarter rainfall = " + min); //System.out.println("Max quarter rainfall = "+ maxQuarter); //System.out.println("Min quarter rainfall = " + minQuarter); }//end main }//end class
has answer: http://stackoverflow.com/a/22611378
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22611427
tagged with: java
has answer: http://stackoverflow.com/a/22611499
has title: Java min max values
type: Question
has comment: http://stackoverflow.com/comment/34429268
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/8938235

http://stackoverflow.com/q/22596287
type: UnansweredQuestion
tagged with: swt
tagged with: swing
has answer: http://stackoverflow.com/a/35038895
has comment: http://stackoverflow.com/comment/38822743
tagged with: graphics
has comment: http://stackoverflow.com/comment/40840447
has comment: http://stackoverflow.com/comment/34818437
tagged with: java
score: 4
has comment: http://stackoverflow.com/comment/34816339
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/34818468
answer count: 1
downvote count: 0
tagged with: awt
favorite count: 0
has title: When Graphics2D.fill() can work 10 times slower in SWT?
has body: I am investigating the problem, when Piccolo2D graphics works much slower when inside SWT bridge. Finally I found, that the code, which works much slower, is the call to Graphics2D.fill() method. In the case of SWT bridge it works 10 times slower, that in plain Swing. The probable reason is clipping region. What are other possible reasons? And how is it possible to see, that the reason is clipping? The result of Graphics2D.getClipBounds() is the same in both case, but it is documented as "user" clipping area. Is it possible to see "device" clipping area?

http://stackoverflow.com/a/22519686
score: 1
has comment: http://stackoverflow.com/comment/34273810
has comment: http://stackoverflow.com/comment/34267860
downvote count: 0
has comment: http://stackoverflow.com/comment/34273598
has comment: http://stackoverflow.com/comment/34271889
has comment: http://stackoverflow.com/comment/34279709
type: Answer
has comment: http://stackoverflow.com/comment/34318274
answers question: http://stackoverflow.com/q/22519444
has comment: http://stackoverflow.com/comment/34317897
has body: Your code is fine and can't pass the same reference all the time. You can check it via a == check of your listed objects. You could refactor you code to results = statement.executeQuery(selectMovie); while (results.next()) { listOfActors.add(getActorFromResult(results)); } as you're creating a new Actor and thus a new object with an own reference after fetching the result set. This will also make the code clearer here. Also return new Actor(id, fname, lname, dob ); will do the job in your result method. You're not using the self-descriptive local variable anyways. I suspect your problem lies in your database. Try querying it with a database tool.
upvote count: 1
has comment: http://stackoverflow.com/comment/34271694
has comment: http://stackoverflow.com/comment/34270553

http://stackoverflow.com/a/50129785
type: Answer
answers question: http://stackoverflow.com/q/22627788
score: 0
has body: According to the newest edition of App Engine Socket docs for Java, if you're using java 8 runtime you should be able to use java sockets without limitations: Applications in the Java 8 runtime default to using native Java sockets with no restrictions: Google recommends that you keep this default. That means that it should be possible to use java.net.DatagramSocket or java.nio.channels.DatagramChannel freely to work with UDP.

http://stackoverflow.com/comment/34461994
score: 0
has text: It's not very clear what your question is. Please post your code as an [minimal example](http://stackoverflow.com/help/mcve) that demonstrates your problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22629554

http://stackoverflow.com/a/22596131
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22596052
has body: Arrays are fixed-size so, you should use a Collection like ArrayList: List&lt;List&lt;String&gt;&gt; arr = new ArrayList&lt;&gt;(); to add a "row": arr.add(new ArrayList&lt;&gt;()); to add an element to a row: arr.get(0).add("..."); // add an element to the first row arr.add(new ArrayList&lt;&gt;()); // add another row arr.get(1).add("..."); // add an element to the second row and to get an element: // ... arr.get(1).get(0); // get first element of the second row Note: Remember that indices in most programming languages starts with 0. So to access to the first element you will have to use the index 0.
type: Answer

http://stackoverflow.com/comment/34302734
type: AnswerComment
score: 0
has text: and is there anyway to do this without importing the java.lang.Math?
type: Comment
comment on: http://stackoverflow.com/a/22539550

http://stackoverflow.com/q/22525394
has answer: http://stackoverflow.com/a/22543146
tagged with: java
type: Question
answer count: 1
has title: Spring Web Flow: append view state id to URL
type: UnansweredQuestion
score: 0
tagged with: spring-webflow-2
tagged with: spring
has body: I am using spring web flow 2.x and is trying to append the view state id to the URL. I want to save the view state id to request scope and append it to URL everytime user clicks 'next' or 'previous'. Is this possible using a Custom Flow URL handler? How do I get the view state Id inside my Custom/Pretty flow Url handler?
tagged with: spring-mvc

http://stackoverflow.com/a/22547160
type: Answer
accepted answer of: http://stackoverflow.com/q/22547086
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22547086
type: AcceptedAnswer
downvote count: 0
has body: You can also use new try-with-resource block introduced in JDK 1.7, in this advantage is you don't need to worry about closing any resource which implements Closable Interface. Then code will look like this: try (PrintWriter out = new PrintWriter("output.txt")) { out.print("hello"); } catch (FileNotFoundException e) { System.out.print("file not found"); e.printStackTrace(); }

lwjgl
tags question: http://stackoverflow.com/q/22592464
tag name: lwjgl
tags question: http://stackoverflow.com/q/22505410
tags question: http://stackoverflow.com/q/22590662
tags question: http://stackoverflow.com/q/22639910
tags question: http://stackoverflow.com/q/22523189
tags question: http://stackoverflow.com/q/22572572
tags question: http://stackoverflow.com/q/22534733
tags question: http://stackoverflow.com/q/22594631
tags question: http://stackoverflow.com/q/22493027
tags question: http://stackoverflow.com/q/22494126
tags question: http://stackoverflow.com/q/22591618
tags question: http://stackoverflow.com/q/22568119
tags question: http://stackoverflow.com/q/22620454
type: Tag

http://stackoverflow.com/a/22622008
has body: If this is a resumed download and the saved file isn't of the expected length, specifically if it is shorter, but it does exist, you have an unhandled error case. I don't know what's right for your situation but I wound be deleting the file and starting again. And you need to make all the adjustments mentioned in my comment, if only for clarity.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22607588

http://stackoverflow.com/q/22530618
has answer: http://stackoverflow.com/a/22817977
answer count: 3
has title: Cannot run mvn vaadin:compile on Vaadin Maven project
downvote count: 0
tagged with: pom.xml
favorite count: 0
has body: When I run the command : mvn vaadin:compile I get this error : [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.039s [INFO] Finished at: Thu Mar 20 11:35:00 CET 2014 [INFO] Final Memory: 7M/152M [INFO] ------------------------------------------------------------------------ [ERROR] No plugin found for prefix 'vaadin' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (D:\Users\etantaou\.m2\repository), central (http://repo.maven.apache.org/maven2)] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException I made a search and I found that I have to add this to my pom.xml under : org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> com.vaadin vaadin-maven-plugin [1.0.2,) clean resources update-theme update-widgetset compile-theme compile org.codehaus.mojo gwt-maven-plugin [${gwt.plugin.version},) resources compile </lifecycleMappingMetadata> I added that but I still get the error. Is there any jar or something that I have to add to make this work ? For information I'm trying to create custom widgets on my Vaadin project. They say here I have to run vaadin:compile to compile WidgetSet.
type: UnansweredQuestion
tagged with: maven
tagged with: java
tagged with: vaadin
tagged with: eclipse
type: Question
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/29849774
has answer: http://stackoverflow.com/a/22534657

http://stackoverflow.com/comment/34523813
type: AnswerComment
score: 0
type: Comment
has text: Thanks, yours was the only answer that provided more content and explanation rather than links so +50 to you.
comment on: http://stackoverflow.com/a/22659749

codenameone
tags question: http://stackoverflow.com/q/22579554
tag name: codenameone
type: Tag

http://stackoverflow.com/q/22589350
answer count: 2
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34390330
has comment: http://stackoverflow.com/comment/34390254
score: 0
has comment: http://stackoverflow.com/comment/34390325
has answer: http://stackoverflow.com/a/22589418
has comment: http://stackoverflow.com/comment/34390256
has comment: http://stackoverflow.com/comment/34390314
has comment: http://stackoverflow.com/comment/34390245
possible better answer: http://stackoverflow.com/a/22589422
has answer: http://stackoverflow.com/a/22589422
has body: int sayd = Integer.parseInt(args[1]); int say = (int) Math.ceil(sayd); Integer mapped = (Integer) GrandTheftCart.playerBounty.get(bounty); int total = say + mapped; So i'm checking the int like that, and whenever I run it I get a NullPointerException when i'm trying to retrieve the int. EDIT public static HashMap&lt;String, Integer&gt; playerBounty = new HashMap&lt;String, Integer&gt;();
type: AnsweredQuestion
has title: Cant get int from Hashmap
tagged with: java
accepted answer: http://stackoverflow.com/a/22589418
type: Question
has comment: http://stackoverflow.com/comment/34390299

rasterize
type: Tag
tag name: rasterize
tags question: http://stackoverflow.com/q/22644745

http://stackoverflow.com/comment/59642746
has text: Can you please explain this to me? Or check http://stackoverflow.com/questions/35994781/how-to-parse-javascript-google-cse-in-java
type: Comment
comment on: http://stackoverflow.com/a/22793864
type: AnswerComment
score: 0

http://stackoverflow.com/q/22510098
has comment: http://stackoverflow.com/comment/34249581
has comment: http://stackoverflow.com/comment/34249005
has answer: http://stackoverflow.com/a/22516381
score: 0
type: UnansweredQuestion
has body: Hi, I have this simple table in mysql: +---------------------------------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------------------------+---------+------+-----+---------+----------------+ | id_documento_referencia_importa | int(11) | NO | PRI | NULL | auto_increment | | id_tipo_documento | int(11) | NO | MUL | NULL | | | tipo | char(1) | NO | MUL | NULL | | | id_tipo_documento_origen | int(11) | NO | MUL | NULL | | | estado_documento_origen_antes | char(1) | YES | MUL | NULL | | | estado_documento_origen_despues | char(1) | YES | MUL | NULL | | +---------------------------------+---------+------+-----+---------+----------------+ and this entity: public class DocumentoReferenciaImporta implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id_documento_referencia_importa") private Integer idDocumentoReferenciaImporta; @Basic(optional = false) @NotNull @Column(name = "tipo") private char tipo; @JoinColumn(name = "estado_documento_origen_despues", referencedColumnName = "estado_documento") @ManyToOne private EstadoDocumento estadoDocumentoOrigenDespues; @JoinColumn(name = "estado_documento_origen_antes", referencedColumnName = "estado_documento") @ManyToOne private EstadoDocumento estadoDocumentoOrigenAntes; @JoinColumn(name = "id_tipo_documento_origen", referencedColumnName = "id_tipo_documento") @ManyToOne(optional = false) private TipoDocumento idTipoDocumentoOrigen; @JoinColumn(name = "id_tipo_documento", referencedColumnName = "id_tipo_documento") @ManyToOne(optional = false) private TipoDocumento idTipoDocumento; [...snip...] the table reference another table, id_tipo_documento, that is a simple id-name table. Somewhere in the code I have this JPA query, that is working perfectly: String jpql="SELECT o FROM DocumentoReferenciaImporta o " + "WHERE o.idTipoDocumentoOrigen.idTipoDo…
has comment: http://stackoverflow.com/comment/34248912
tagged with: java
tagged with: mysql
type: Question
has title: JPA error in named parameters wher using count()
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/34249174

http://stackoverflow.com/a/47098606
downvote count: 1
answers question: http://stackoverflow.com/q/22526695
has body: if you use java 8 or next version you need to upgrade spring version and spring version should be 4.xxx
score: -1
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/132293988

http://stackoverflow.com/comment/34448854
type: AnswerComment
has text: @LifeH2O: read the layout manager tutorial and try to play with layout managers to achieve the best GUI possible. Note that it's often best to nest JPanels each using its own layout manager. Then try to work on your program, one step and one problem at a time til solved.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22621494

http://stackoverflow.com/q/22495751
tagged with: maven
upvote count: 1
type: Question
has title: A way to delete jars from artifactory
has body: I have uploaded some 3rd party jars in the artifactory, and now I need a way to clean up all the 3rd party jars which uploaded previously. Is there some way to do it?
answer count: 1
downvote count: 0
tagged with: shell
favorite count: 0
has comment: http://stackoverflow.com/comment/34224794
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22499117
has comment: http://stackoverflow.com/comment/34224805
has comment: http://stackoverflow.com/comment/34229886
score: 1
tagged with: java
tagged with: artifactory

http://stackoverflow.com/comment/34237445
comment on: http://stackoverflow.com/q/22503464
type: Comment
type: QuestionComment
score: 0
has text: yes, I tried many ways

http://stackoverflow.com/comment/34393562
comment on: http://stackoverflow.com/q/22588096
has text: That type of error may occur because the element you are trying to click is not visible. However, that is a guess. It is hard to help without the same problem occuring on our computers. Can you create an example page on jsfiddle.net that has the same issue? Often, making a simple test case helps you find out the problem on your own.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34379323
has text: why dont you just put a log and check whether you are getting the string or value in myPath string... and make sure other things are well defined ie ids of media Player and other stuff in your code which i cant c at the moment..
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22582935

http://stackoverflow.com/comment/34330964
comment on: http://stackoverflow.com/a/22541603
type: AnswerComment
has text: the enums are Enum and I don't want to have a common interface. Enum provides me mechanism to extract all values. That is enough for me.
score: 0
type: Comment

http://stackoverflow.com/q/22571205
tagged with: java
has title: Java program file handle
type: Question
has body: Here is my program: public class Mycode{ public static void main(String[] args) { System.out.println("Welcome to the innovation and tech data mining table"); Scanner sc = new Scanner(System.in); Scanner input = new Scanner(new File("Data2.txt")); while (input.hasNext()){ String data = input.nextLine(); } System.out.println(data); } } Basically I'm taking a text file and storing it in my variable data. The problem I'm having is that it refuses to print out the data as it says it can't be resolved to a variable. Anyone have any way around this?
has comment: http://stackoverflow.com/comment/34357843
has comment: http://stackoverflow.com/comment/34358050
score: 0
tagged with: file-io
has comment: http://stackoverflow.com/comment/34357776
has answer: http://stackoverflow.com/a/22571213
answer count: 1
linked to: http://stackoverflow.com/q/326390
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34358221
has comment: http://stackoverflow.com/comment/34357744
has comment: http://stackoverflow.com/comment/34357926
has comment: http://stackoverflow.com/comment/34357785

http://stackoverflow.com/comment/34388813
type: AnswerComment
type: Comment
has text: a better approach in this scenario is that u categories your textures and atlases with images that u need throughout the game and other type which has level specific images. so that u can unload level specific images and reuse those images which are to be used throughout the game
score: 0
comment on: http://stackoverflow.com/a/22586728

http://stackoverflow.com/a/22671504
upvote count: 1
answers question: http://stackoverflow.com/q/22608065
has body: you should only remove tblTaskList = new JTable(); from displayAllTaskByProjectId function and code will work properly.Use only this line tblTaskList = new JTable() only when init components
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22608065

substring
tags question: http://stackoverflow.com/q/22520137
type: Tag
tags question: http://stackoverflow.com/q/22504902
tags question: http://stackoverflow.com/q/22646555
tags question: http://stackoverflow.com/q/22600087
tag name: substring
tags question: http://stackoverflow.com/q/22582038

http://stackoverflow.com/a/22620247
score: 0
answers question: http://stackoverflow.com/q/22619992
type: Answer
has body: According to the Java Specification §15.7: The Java programming language guarantees that the operands of operators appear to be evaluated in a specific evaluation order, namely, from left to right. And §15.18: The additive operators have the same precedence and are syntactically left-associative (they group left-to-right). If the type of either operand of a + operator is String, then the operation is string concatenation. So the first half, "1 + 2 = " + 1, is the first part to get evaluated. Because the first half of that is a String, it evaluates to: "1 + 2 = 1". The whole expression is now "1 + 2 = 1" + 2. Once again, one of the two operands in this expression is a String, so the + operand concatenates. The whole expression then evaluates to the String "1 + 2 = 12", which is then printed.

http://stackoverflow.com/q/22639806
accepted answer: http://stackoverflow.com/a/22641912
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has title: Feature detection in OpenCV to merge two images
upvote count: 2
has answer: http://stackoverflow.com/a/22641912
tagged with: image-processing
answer count: 1
has body: Is it somehow possible to merge two images captured by searching for identical features in OpenCV in both images? My images will always contain sheets of papers which are too big to be captured in one single frame thus I need to take two or more frames - the images are captured so that there is some overlapping area, see: Top picture: https://i.sstatic.net/O7p9o.jpg Bottom picture: https://i.sstatic.net/o1guw.jpg IDEA: Restrict features to only move up/down and not to the right etc.. Even more so, the length of all vectors between two identical features in both images has to be more or less identical, as the area is overlapping. OpenCV also only has to look at the very bottom of picture one and at the very top of picture two for overlapping features. All the other areas are NOT of interest... Edit: Okay I found some sources about this finally with some good links in the answers: how to find overlapping region between images in opencv?
tagged with: opencv
tagged with: java
tagged with: feature-detection

http://stackoverflow.com/q/22519276
type: Question
tagged with: jakarta-ee
tagged with: java
has body: I'm working on a rest API where when post request is made by posting an XML file it should send the response 200 OK if the file is received successfully and 400 if the XML file is having any tag missing and 500 error if GET is used instead of POST. I am able to do the first two cases 200 and 400, not sure how to add 500 in the code. Am posting my code here, please suggest. if (dataFile==null) { try { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Failed to process content of file."); } catch (IOException e1) { LOGGER.error("Failed to send response due to error: " + e1.getMessage()); } } else{ response.setStatus(HttpServletResponse.SC_OK); response.addHeader("Location", getResourceUri(dataFileMetadata, request).toString());
answer count: 1
tagged with: jsp
score: 0
has comment: http://stackoverflow.com/comment/34266472
tagged with: http://stackoverflow.com/tag/html
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/22520846
type: UnansweredQuestion
has title: Set Status code 500

http://stackoverflow.com/q/22502503
has body: I'm using Android SDK 4.0 API14 and I want to run multiple AsyncTask in one class, I want the called async task to wait while the one before it is finished, but is seems I can't accomplish this, even if I test the status of the one currently being executed. this is my code : if(isNetworkAvailable()){ new SpinnerTask().execute(); new RiderTask().execute(); new BankTask().execute(); } //spinner bank public class BankTask extends AsyncTask&lt;Void, Void, String&gt;{ String url="http://128.21.30.37:8080/E-Policy/ios/spaj_bank.htm?type=pusat"; public BankTask(){ this.url=url; System.out.println(url);} @Override protected void onPreExecute() { super.onPreExecute(); dialog=new ProgressDialog(Menu_SPPAJ.this); dialog = ProgressDialog.show(Menu_SPPAJ.this, "Mohon Menunggu", "Penarikan data Rider..");} @Override protected String doInBackground(Void... params) { // TODO Auto-generated method stub String result = ""; try { result = Connection.get(url); System.out.println("tes " + result); } catch (Exception e) { // TODO: handle exception result = ""; } return result; } @Override protected void onPostExecute(String result) { dialog.dismiss(); // TODO Auto-generated method stub super.onPostExecute(result); // Response(result.replace("\n", "").trim()); System.out.println("done for Bank"); try { JSONObject jsonObject = new JSONObject(result); JSONArray PRODUK = jsonObject.getJSONArray("BANK PUSAT"); for (int i=0; i&lt;PRODUK.length();i++){ JSONObject spinner = PRODUK.getJSONObject(i); String LSBP_NAMA = spinner.optString("LSBP_NAMA"); int LSBP_ID = spinner.optInt("LSBP_ID"); helper.InsertBank(LSBP_ID, LSBP_NAMA); // ListSpinner.add(VarSpinner); System.out.println("tes VarSpinner"); } }catch (Exception e) { Log.d("TES", e.getMessage()); } } } //spinner bank public class CabBankTask extends AsyncTask&lt;Void, Void, String&gt;{ String url="http://128.21.30.37:8080/E-Policy/ios/spaj_bank.htm?type=cabang"; public CabBankTask(){ this.url=url; System.out.println(url);} @Override protected…
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34235599
tagged with: java
has comment: http://stackoverflow.com/comment/34235977
type: Question
has answer: http://stackoverflow.com/a/22502542
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22502674
tagged with: android-asynctask
has title: how to execute multiple AsyncTask in one class

pysimplesoap
tags question: http://stackoverflow.com/q/22634744
tag name: pysimplesoap
type: Tag

http://stackoverflow.com/comment/34241960
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22506281
has text: You may want to try this: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
score: 0

http://stackoverflow.com/comment/34382984
has text: Perfect! It worked. I can't believe I missed such a small detail. I actually created a `std::thread` that for some reason didn't work but yours worked.. I realized that you put the hooks within the thread. Doing this fixed it.
comment on: http://stackoverflow.com/a/22584954
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22630098
has body: We don't talk about pointers in Java, so why do we use the term NullPointerException in Java? I think the exception name NullReferenceException makes more sense.
answer count: 1
has comment: http://stackoverflow.com/comment/34462881
has comment: http://stackoverflow.com/comment/34463004
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/22630216
duplicate of: http://stackoverflow.com/q/101072
has comment: http://stackoverflow.com/comment/34462857
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/101072
has comment: http://stackoverflow.com/comment/34462808
downvote count: 1
score: 2
upvote count: 3
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/218384
has title: NullPointerException should be called NullReferenceException?
has comment: http://stackoverflow.com/comment/34463239

http://stackoverflow.com/comment/34509937
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22656368
has text: I think he has already tried this from browser as mentioned in the question!!
score: 0

http://stackoverflow.com/a/22606506
type: Answer
answers question: http://stackoverflow.com/q/22606352
score: 1
upvote count: 1
downvote count: 0
has body: This is not possible. In Spring JavaConfig all beans in the @Configuration must be produced by methods of the class

http://stackoverflow.com/a/22610640
downvote count: 0
has body: It seems like you're not initializing gradeList. Either initialize it inline: private ArrayList&lt;Integer&gt; gradeList = new ArrayList&lt;Integer&gt;(); Or in a constructor: public MyClass() { gradeList = new ArrayList&lt;Integer&gt;(); // ... }
answers question: http://stackoverflow.com/q/22610531
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/34438469
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22616187
has text: Can you put the whole code ? And learning basics of Java is really helpful before diving into the world of Android development.

http://stackoverflow.com/q/22573264
type: Question
tagged with: processing
tagged with: javascript
accepted answer: http://stackoverflow.com/a/22586991
has body: As you known,we can draw a page showing sin waving by using clippath and continuous changing the d attribute of the path in html,but If I want to implement a clippath with processing in Java?What should I do?walkaround is welcome. This page offer by Antonio Molinaro tell the answer.
upvote count: 0
answer count: 1
favorite count: 0
score: -1
has title: Can Processing Implement clippath?
has answer: http://stackoverflow.com/a/22586991
type: AnsweredQuestion
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/34240972
type: Comment
type: QuestionComment
score: 1
has text: This might help you also http://www-01.ibm.com/support/docview.wss?uid=swg21459994
comment on: http://stackoverflow.com/q/22491911

http://stackoverflow.com/q/22547532
upvote count: 3
answer count: 1
tagged with: rally
has body: When I create a defect on UI, I cannot assign it only to test case, user story is getting assigned automatically. If I try to delete the User Story, test case also disappears. But through restApi, I can relate only to Test Case, without mentioning the User Story. I think it is a bug, since behavior should be similar regardless how you create a Defect. I did not mention it, but we have always Test Cases associated with User Stories.
favorite count: 0
type: UnansweredQuestion
tagged with: defects
has title: Discrepancy in creating defect between UI and restApi
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22582916
type: Question
score: 3

http://stackoverflow.com/comment/34316800
has text: @AdrianPang Yes, that returns fine because the initial row creation query uses that as well (different method) and it passes OK. TonyZhu Sorry, what?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22547678

http://stackoverflow.com/q/22642231
possible better answer: http://stackoverflow.com/a/22642327
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22642327
accepted answer: http://stackoverflow.com/a/22642433
type: Question
tagged with: recursion
has body: As a part of exercise, i am writing a recursive code to count the number of nodes in a queue. The code part which I have added/modified (in NodeQueue.java) is here: public class NodeQueue implements Queue { static protected int count; //for RecNodeCount method only protected Node beingCountedNode = head; //for RecNodeCount method only // other methods.. public int RecNodeCount() { if(beingCountedNode == null) return count; else { count++; beingCountedNode = beingCountedNode.getNext(); return RecNodeCount(); } } The entire code is as here: Queue.java: http://pastebin.com/raw.php?i=Dpkd8ynk Node.java: http://pastebin.com/raw.php?i=Zy0KbrtJ NodeQueue.java: http://pastebin.com/raw.php?i=j6hieiLG SimpleQueue.java: http://pastebin.com/raw.php?i=vaTy41z4 I am unable to understand why I am getting zero even after enqueueing few nodes in the queue. The size variable returns the correct number. I am doing more or less the same with the count variable (I think!) i.e. incrementing the required variable.
has answer: http://stackoverflow.com/a/22642582
tagged with: data-structures
has comment: http://stackoverflow.com/comment/34493351
has answer: http://stackoverflow.com/a/22642433
score: 0
has title: Unable to understand why count is not getting incremented
answer count: 3

tcp
tags question: http://stackoverflow.com/q/22530484
type: Tag
tags question: http://stackoverflow.com/q/22642892
tags question: http://stackoverflow.com/q/22584243
tags question: http://stackoverflow.com/q/22547451
tags question: http://stackoverflow.com/q/22581722
tags question: http://stackoverflow.com/q/22550534
tags question: http://stackoverflow.com/q/22501650
tags question: http://stackoverflow.com/q/22586030
tags question: http://stackoverflow.com/q/22646567
tags question: http://stackoverflow.com/q/22510832
tag name: tcp
tags question: http://stackoverflow.com/q/22635830

http://stackoverflow.com/q/22593721
accepted answer: http://stackoverflow.com/a/22594115
linked to: http://stackoverflow.com/q/5725892
downvote count: 1
has title: Case insensitive search on List (search term can be part of word or sentence)
type: Question
tagged with: search
has body: I can not figure out a way to perform case insensitive search on a list, and at the sae time not make it word specific. For example searching for "anim" would return the results from the list that have those characters in that sequence so if there is word "animal" that list entry will be returned. Same goes for something like "als ea" so if there is "animals eat grass" or something like that in a list, return that entry. Currently my list looks like List&lt;Animal&gt; animals = database.getAllAnimals(); Essentially gets all data from animals, I then want to filter this whole data (I understand it might not be most efficient way and can be done in SQL, but this is how I need to do it) with a search term, lets assume for now searchTerm = "abc" and then make animals list only contain entries that return positive search results.
score: 0
answer count: 1
favorite count: 0
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/22594115
type: AnsweredQuestion
tagged with: list
tagged with: java

http://stackoverflow.com/a/22488886
downvote count: 0
score: 1
has body: You need to initialize button in onCreate after setContentView Button butNext=(Button)findViewById(R.id.button1); As Button butNext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quiz); butNext=(Button)findViewById(R.id.button1); } findViewById looks for a view in the current view hierarchy. You need to set the content of the layout first and then initialize views.
answers question: http://stackoverflow.com/q/22488856
upvote count: 1
type: Answer

http://stackoverflow.com/comment/34290271
comment on: http://stackoverflow.com/q/22533362
type: Comment
type: QuestionComment
score: 1
has text: you can use this [Mouselistener][1] http://java-program-sample.blogspot.in/2011/09/implementing-event-listener-on.html [1]: http://stackoverflow.com/questions/8589605/menulistener-implementation-how-to-detect-which-jmenu-was-clicked

http://stackoverflow.com/comment/34462651
comment on: http://stackoverflow.com/q/22628866
score: 0
type: Comment
type: QuestionComment
has text: Load both `Texture`s, the high res and the low res, and write a getter: `getBallSmall(float zoom) { if (zoom > LOW_RES_ZOOM) return _assetManager.get("HighResTexture"); else return _assetManger.get("LowResTexture"); }`

http://stackoverflow.com/comment/34475879
score: 0
type: Comment
has text: I had wondered about that. I"ll look into it and get back to you...thanks.
comment on: http://stackoverflow.com/a/22637511
type: AnswerComment

http://stackoverflow.com/q/22488558
tagged with: text-to-speech
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34215855
tagged with: java
accepted answer: http://stackoverflow.com/a/22495524
type: Question
has body: The Android does not talk despite my code being error free and accurate. I have used a toast function to see where the issue occurs. However, both toasts are called. I have removed all irrelevant code. The code below is mostly relevant. package com.example.android.BluetoothChat; import android.R.string; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech.OnInitListener; import android.telephony.SmsManager; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.util.Locale; import java.util.Set; import android.bluetooth.BluetoothDevice; import java.io.InputStream; import java.io.OutputStream; import android.bluetooth.BluetoothSocket; import android.widget.EditText; import java.io.IOException; import java.util.UUID; public class MainActivity extends Activity implements LocationListener{ Button start, stop; TextView tv; TextView tv2; TextView sum; LocationManager lm; static TextToSpeech Talker; TextView myLabel; Handler mhandler = new Handler(); int i; int sum1 = 0; static BluetoothDevice mmDevice; static BluetoothAdapter mBluetoothAdapter; static BluetoothSocket mmSocket; String lat; String lon; EditText myTextbox; static OutputStream mmOutputStream; static InputStream mmInputStream; static Thread workerThread; static byte[] readBuffer; static int readBufferPosition; static int counter; static volatile boolean stopWorker; TextToSpeech talker; @Override protected void onCreate(Bund…
has title: Text-to-Speech Function not working
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/34220600
has answer: http://stackoverflow.com/a/22495524

http://stackoverflow.com/q/22585828
has comment: http://stackoverflow.com/comment/34384004
tagged with: concurrency
linked to: http://stackoverflow.com/q/1496180
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34384043
tagged with: arrays
score: 0
linked to: http://stackoverflow.com/q/21541991
has title: Concurrent container access?
has comment: http://stackoverflow.com/comment/34384029
has answer: http://stackoverflow.com/a/22594152
has answer: http://stackoverflow.com/a/22586374
type: UnansweredQuestion
tagged with: multithreading
tagged with: swing
linked to: http://stackoverflow.com/q/22592180
has comment: http://stackoverflow.com/comment/34384176
tagged with: java
has body: Right now I'm experimenting with some basic game concepts in Java. At the moment, all it really does is display two boxes: one that the player can move with the arrow keys, and an "enemy" that just jitters around randomly. Right now, I'm fixing up the player's ability to shoot little squares in the direction of the mouse whenever they click the left mouse button. As it's structured right now, I have four classes - a JPanel that holds the "game" logic, a JFrame that holds that panel, an Entity class which is just a simple representation of a physical object with a position, size, and speed with methods for moving it, and a Projectile class that extends the Entity class with a special move method that moves it one step along a path calculated from the initial and destination points given to the Projectile's constructor. The problem I'm having is trying to update the position of the projectiles. I have a timer running to update the positions of non-player controlled objects, and the actionPerformed() method of the JPanel has to call every existing projectile's move() method. Right now, when a projectile is created I just put it into a Projectile array with an arbitrarily large size, making sure to start back at [0] when the array is full. The actionPerformed() method can safely act on this array concurrent with the mouse action listener, but since I'm working on this more to learn than to settle with a simple solution that works, I'm wondering if there's a better way to do this than just having an array with size [999]. I tried using an ArrayList at first, but obviously ended up with concurrent access errors. I tried queueing projectiles in an array and then adding them to the ArrayList in the actionPerformed() method, but this gave me null pointer errors. (TLDR) So my question: Do any of the Java containers (set, map, queue, etc) support concurrent access? I don't think I need a container where order matters, since I have to iterate over every element in the container…

http://stackoverflow.com/comment/34241308
has text: That depends on the case, if you have repeatable data, then it's ok and you can use some plugin to reduce boilerplate code.
comment on: http://stackoverflow.com/a/22505689
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34415468
comment on: http://stackoverflow.com/q/22562257
score: 0
type: Comment
type: QuestionComment
has text: hello world application

http://stackoverflow.com/comment/34323527
type: Comment
type: QuestionComment
has text: Do you mean the browser address bar? Isnt that overly ambitious? Unless the browser gives you that info i dont think u can get it. what do u really want to do? something before user leaves current page?
comment on: http://stackoverflow.com/q/22551922
score: 0

http://stackoverflow.com/comment/34453168
has text: @JarrodRoberson A `Multiset` would be more appropriate (the `Multimap` would require some arbitrary value objects), but same idea. The words could be inserted into, e.g., Guava's [`Multiset`](http://guava-libraries.googlecode.com/svn/tags/release02/javadoc/com/google/common/collect/Multiset.html), then `count()` will return the word count given a word. You should post an example as an answer, it would be another nice clean approach.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22624069

http://stackoverflow.com/q/22548624
type: AnsweredQuestion
has body: Wondering about the following scenario (simplified Java code): //Thread A: FileOutputStream fos = new FileOutputStream(PATH); OutputStreamWriter osw = new OutputStreamWriter(fos); BufferedWriter buffW = new BufferedWriter(osw, SIZE); for (int i = 0; i &lt; ITER; i++) { buffW.write(STR); } //Thread B: fos.getFD().sync(); Is there a need to synchronize the sync() call w/ the other write, or does this get taken care of at OS-level? My gut feeling says that this should be the OS's concern, but I could be wrong. The docs do not touch on this subject, I get only a hint that there's some synchronization going on for FileChannel.force(...), which should be equivalent, but the scenario in the docs seems somewhat different.
accepted answer: http://stackoverflow.com/a/22548712
tagged with: java
tagged with: multithreading
type: Question
score: 0
has answer: http://stackoverflow.com/a/22548712
answer count: 1
tagged with: file-descriptor
tagged with: synchronization
has title: FileDescriptor.sync() thread-safety

http://stackoverflow.com/q/22552592
has body: i need to sort names list in to alphabetical order, for this i use the interfase comperator for sorting the names @Override public int compareTo(ContactModel another) { // TODO Auto-generated method stub return getname().compareTo(another.getname()); } Suppose this is my array of name 123vinish 23Sathya 24mahesh Ranjith Vipin Bibin Shine Thomas i need to sort this in a sequence where names with numbers must come last Bibin Ranjith Shine Thomas Vipin 123Vinish 23Sathya 24mahesh How can we implement this
tagged with: sorting
score: 4
upvote count: 4
tagged with: arraylist
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22552773
tagged with: java
has title: How sort an arraylist of names in alphabetical order but names which start with numbers must comes last
type: Question
has answer: http://stackoverflow.com/a/22554406

http://stackoverflow.com/comment/99814896
comment on: http://stackoverflow.com/a/56620885
score: 0
type: AnswerComment
type: Comment
has text: Hi, this is pretty old thread, so it might take a while for me to check this, gotta install it all on new machine, but it does seem valid. Thank you!

http://stackoverflow.com/comment/34273582
score: 0
comment on: http://stackoverflow.com/q/22523404
type: Comment
type: QuestionComment
has text: Not working. Same exception

http://stackoverflow.com/q/22591684
answer count: 1
downvote count: 0
has title: Hibernate Many to one updating foreign key to null
has body: I am trying to get my @OneToMany and @ManyToOne relationships correct. Class 1: @Entity public class IdeaProfile { @Id @GeneratedValue private int ideaProfileId; private String name; Date dateConcieved; @OneToOne @JoinColumn(name="statusCode") private Status status; @OneToMany(fetch=FetchType.EAGER, targetEntity=Pitch.class, cascade=CascadeType.ALL) @JoinColumn(name = "ideaProfileId") private List&lt;Pitch&gt; pitchs; ....getters and setters.... Class2: @Entity public class Pitch { @Id @GeneratedValue private int id; @ManyToOne @JoinColumn(name = "ideaProfileId") private IdeaProfile ideaProfile; private Date date; private String notes; ....getters and setters.... This relationship seems to work fine when I am loading or saving a new record: Hibernate: insert into IdeaProfile (dateConcieved, genreCode, name, statusCode) values (?, ?, ?, ?) Hibernate: insert into Pitch (date, ideaProfileId, notes) values (?, ?, ?) Hibernate: update Pitch set ideaProfileId=? where id=? However, when I try to update that record, it tries to set the IdeaProfileId to null: Hibernate: update IdeaProfile set dateConcieved=?, genreCode=?, name=?, statusCode=?, where ideaProfileId=? Hibernate: update Pitch set date=?, ideaProfileId=?, notes=? where id=? Hibernate: update Pitch set ideaProfileId=null where ideaProfileId=? When I debug I can see that IdeaProfileId is indeed set on Pitch Object... FYI, I am not directly updating the original objects that I loaded from the DB. These domains get mapped to a Model class which is what the UI updates. So on save/update I map the values back to new domain objects, including the IDs like the following: IdeaProfile domain = new IdeaProfile(); domain.setId(model.getIdeaProfileId()); domain.setName(model.getName()); domain.setStatus(model.getStatus()); domain.setDateConcieved(Date.valueOf(model.getDateConvieved())); for (PitchModel pitch : model.getPitches()) { Pitch pitchDomain = new Pitch(); pitchDomain.setId(pitch.getId()); pitchDomain.setDate(Date.val…
favorite count: 0
tagged with: one-to-many
tagged with: many-to-one
accepted answer: http://stackoverflow.com/a/22592488
score: 4
type: AnsweredQuestion
type: Question
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22592488
upvote count: 4

http://stackoverflow.com/comment/34373067
type: QuestionComment
has text: Could you provide more details about the word "services"? What kind of service? Based on which protocol(eg. HTTP)? Will it be bottleneck after you change your caller from single thread to concurrent?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22579820

http://stackoverflow.com/q/22623655
upvote count: 7
downvote count: 1
type: AnsweredQuestion
has body: As I said before (RGB to Philips Hue (HSB)) I'm still not giving up my hopes for converting a simple RGB value to a value Philips Hue will accept. The official App for iPhone and Android allows you to select a color from a random photo and the Hue will adjust itself accordingly. So there must be some sort of formula. This time however I think I have just found this very formula in this interesting article online: https://github.com/PhilipsHue/PhilipsHueSDK-iOS-OSX/blob/master/ApplicationDesignNotes/RGB%20to%20xy%20Color%20conversion.md I have been trying to convert his explanation to Java language, but I'm not getting the desired results. Anybody knows what goes wrong? For the record I'm using the Philips Hue Light Bulbs. public static List&lt;Double&gt; getRGBtoXY(Color c) { // For the hue bulb the corners of the triangle are: // -Red: 0.675, 0.322 // -Green: 0.4091, 0.518 // -Blue: 0.167, 0.04 double[] normalizedToOne = new double[3]; float cred, cgreen, cblue; cred = c.getRed(); cgreen = c.getGreen(); cblue = c.getBlue(); normalizedToOne[0] = (cred / 255); normalizedToOne[1] = (cgreen / 255); normalizedToOne[2] = (cblue / 255); float red, green, blue; // Make red more vivid if (normalizedToOne[0] &gt; 0.04045) { red = (float) Math.pow( (normalizedToOne[0] + 0.055) / (1.0 + 0.055), 2.4); } else { red = (float) (normalizedToOne[0] / 12.92); } // Make green more vivid if (normalizedToOne[1] &gt; 0.04045) { green = (float) Math.pow((normalizedToOne[1] + 0.055) / (1.0 + 0.055), 2.4); } else { green = (float) (normalizedToOne[1] / 12.92); } // Make blue more vivid if (normalizedToOne[2] &gt; 0.04045) { blue = (float) Math.pow((normalizedToOne[2] + 0.055) / (1.0 + 0.055), 2.4); } else { blue = (float) (normalizedToOne[2] / 12.92); } float X = (float) (red * 0.649926 + green * 0.103455 + blue * 0.197109); float Y = (float) (red * 0.234327 + green * 0.743075 + blue + 0.022598); float Z = (float) (red * 0.0000000 + green * 0.053077 + blue * 1.035763); float x = X / (X + Y …
has answer: http://stackoverflow.com/a/22624113
tagged with: philips-hue
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34479020
answer count: 1
score: 6
has comment: http://stackoverflow.com/comment/34496564
accepted answer: http://stackoverflow.com/a/22624113
tagged with: colors
linked to: http://stackoverflow.com/q/22564187
has title: RGB to CIE color conversion
favorite count: 0
duplicate of: http://stackoverflow.com/q/22564187

http://stackoverflow.com/comment/34362189
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22573621
has text: even when i try to print "hello world" then also error occours,Exception in Thread "main" java.lang.NoClassDefFound Error:Hello

http://stackoverflow.com/a/22494656
score: 0
answers question: http://stackoverflow.com/q/22494472
has comment: http://stackoverflow.com/comment/34223234
type: Answer
has comment: http://stackoverflow.com/comment/34223127
has body: Somewhere in your program (where the error message is pointing to and you haven't posted), you're trying to call System.exit, which isn't permitted for the applet.

http://stackoverflow.com/comment/34249716
type: QuestionComment
type: Comment
has text: @Gimby Would Tomcat be significantly different from jBoss? What I mean is, would I need to add/change code that I have right now to use Tomcat? Sorry if this is a really beginner question, I'm just really lost.
comment on: http://stackoverflow.com/q/22510425
score: 0

http://stackoverflow.com/comment/34302599
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22539985
score: 0
has text: if answer.equals("0"){ ... } else { ... } guess that't the error on your if statement, Strings are compared with "equals" instead of "=="

http://stackoverflow.com/q/22510425
linked to: http://stackoverflow.com/q/5108019
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/20737596
linked to: http://stackoverflow.com/q/14857253
type: Question
score: 1
has body: Just so that this doesn't end up marked as a duplicate right off the bat, I did look through the site and find answers to similar questions, but not mine. Although if it turns out there's no answer/this is still a duplicate, I understand. At my new job, I just got an assignment where I'm using items from a repository. To finish the project, I need to run the files on a jBoss server and check for errors and other stuff like that. Since I a)have never worked with jBoss/any other server related stuff before and b)am having a lot of difficulty understanding the only person who I can talk to about this work, I'm behind on the project. I'm supposed to deploy my project to jBoss, but it's not a Maven project (and I'm not sure what Maven is right now, but I'm looking it up since it seems to be the only way to do this) and it isn't a web project, both of which I could just use "export" to make into a WAR file (apparently). My mentor keeps saying it needs to be a WAR file (that's why the above links have to do with WARs) but that doesn't make any sense and it's just confusing me. I'm almost 100% certain WAR files have to be web application projects. But, you know... now I'm confused because my mentor is clearly saying WAR and pretty frequently too. Further, when I was "taught" to use jBoss, I wasn't taught anything about Maven and I don't know if it's absolutely necessary. I'm not trying to do this in the easiest/laziest way... I'm just aware that there's more stuff that I need to learn and I'm trying to learn the most efficient way to do things such that I don't need to keep asking my mentor questions. He's very smart, but very difficult to understand and often leaves me with way, way more questions than answers (and a lot of the time, those new questions are cleared up by my manager with "No, you don't have to do that, it's not necessary, that's not your job, etc."). He's also the only person who I can talk to about my job (and he hasn't been here much longer than me). So e…
tagged with: java
tagged with: jboss
tagged with: eclipse
linked to: http://stackoverflow.com/q/1001714
linked to: http://stackoverflow.com/q/2019360
upvote count: 1
has title: Deploying a Java Project to a JBoss Server
answer count: 1
linked to: http://stackoverflow.com/q/3085719
has comment: http://stackoverflow.com/comment/34249716
favorite count: 0
has comment: http://stackoverflow.com/comment/34249529
has comment: http://stackoverflow.com/comment/34250704
has answer: http://stackoverflow.com/a/22510592
has comment: http://stackoverflow.com/comment/34249413
accepted answer: http://stackoverflow.com/a/22510592
has comment: http://stackoverflow.com/comment/34249412
has comment: http://stackoverflow.com/comment/34249339

http://stackoverflow.com/q/22570580
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/34356485
has answer: http://stackoverflow.com/a/22570584
accepted answer: http://stackoverflow.com/a/22570584
score: 0
has body: I have never used mysql before so this is my first attempt. The syntax/coding im using... "CREATE pets (" + "uuid INT NOT NULL," + "type VARCHAR(100) NOT NULL," + "name VARCHAR(100) NOT NULL," + "health INT NOT NULL," + "badge VARCHAR(40)," + ")" And the error is You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'pets (uuid INT NOT NULL,type VARCHAR(100) NOT NULL,name VARCHAR(100) NOT NULL,he' at line 1
answer count: 1
has title: MySQL Syntax Error while creating a table - Java
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22591620
upvote count: 1
tagged with: expandablelistview
type: Question
has comment: http://stackoverflow.com/comment/34395107
has comment: http://stackoverflow.com/comment/34395415
has body: Okay, my English is not the best, but I will give it a try :) I have three buttons, each one implements an OnClickListener. I have an ExpandableListView, filled with data. If one button is clicked, I would like to call the method which changes the child data and to show the new data changed by the method. The problem is that the data remains the same and there are no changes. I also tried to call the method notifyDataSetChanged in the onClick method but it does not work. [...] expListView.setAdapter(listAdapter); dienstag.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { arrayDienstagInitialsierung(); listAdapter.notifyDataSetChanged(); } }); } ExpandableListAdapter listAdapter; listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild); // setting list adapter expListView.setAdapter(listAdapter); private void arrayDienstagInitialsierung() { System.out.println("hallo bin im dienstag drinnen"); //Früchstück for (int f = 0;f &lt; zwischenTabelleListe.size();f++) { if(zwischenTabelleListe.get(f).getMahlzeit().equals("Fruechstueck") &amp;&amp; zwischenTabelleListe.get(f).getTag() == 2) //kommt noch dazu welcher ernährungsplan geplant ist { produkteListeFruechstueckString.add(produkteListe.get(fr).toString()); } }
has comment: http://stackoverflow.com/comment/34394648
has title: Expandable ListView change childdata on buttonClick
downvote count: 0
tagged with: button
score: 1
has comment: http://stackoverflow.com/comment/34395886
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34395446
tagged with: onclicklistener
answer count: 0
has comment: http://stackoverflow.com/comment/34394359
tagged with: java

http://stackoverflow.com/comment/34455110
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22625379
has text: No Frame -> No Button

http://stackoverflow.com/a/22606127
has comment: http://stackoverflow.com/comment/34420046
has body: ArrayList&lt;&gt; is indeed a class from java.util. However this is not used for arrays, but for some kind of list that can be taken as an array (accessed through indices). For arrays, you can use String[] myArray = new String[myLength]; The equivalence between ArrayList and arrays would be the following. Declaration: ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;(); String[] array = new String[size]; // you have to know the size in advance Access: String s = list.get(i); String s = array[i]; Assignment: list.add(i, myString); array[i] = myString;
has comment: http://stackoverflow.com/comment/34419866
has comment: http://stackoverflow.com/comment/34420297
type: Answer
answers question: http://stackoverflow.com/q/22606034
has comment: http://stackoverflow.com/comment/34419923
has comment: http://stackoverflow.com/comment/34420170
has comment: http://stackoverflow.com/comment/34420372
has comment: http://stackoverflow.com/comment/34420113
has comment: http://stackoverflow.com/comment/34420356
score: 0

http://stackoverflow.com/a/22588334
has comment: http://stackoverflow.com/comment/34481096
has body: Remember, most values are 0 based. But instead of having to say, " I want the width of my panel to be 199" so you get a panel that is 200 pixels wide (0-199), Swing allows you to specify 1 based values and makes adjustments internally If you create a rectangle of 1, 1, 1, 1, your actually creating a rectangle at position 1x1, whose width &amp; height is 1 pixel (1 + 1 would be 2)
upvote count: 2
answers question: http://stackoverflow.com/q/22588251
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22588251
has comment: http://stackoverflow.com/comment/34480754
type: Answer
score: 2

http://stackoverflow.com/q/22543528
accepted answer: http://stackoverflow.com/a/22546009
tagged with: distributed-computing
score: 2
type: AnsweredQuestion
downvote count: 0
type: Question
has body: I am trying to implement leader election algorithm in ring topology of 4 nodes. I am implementing LCR algorithm. How should I proceed with electing leader if suppose my node 3 goes down. Note:- Notes are numbered 1,2,3, and 4. It is a unidirectional ring and each node has information of the nearest node i.e 1 -> 2 , 2 -> 3, 3 -> 4 and 4 -> 1
tagged with: java
upvote count: 2
answer count: 1
has title: Leader Election LCR
favorite count: 0
tagged with: protocol-buffers
has answer: http://stackoverflow.com/a/22546009

http://stackoverflow.com/comment/73209401
type: QuestionComment
type: Comment
has text: @rkj Can you please provide the code for decrption in java, I have used your same code for javascript.
comment on: http://stackoverflow.com/q/22607791
score: 0

http://stackoverflow.com/comment/34298767
has text: No it's not. You just printed an array containing members that do not have their own `toString()` method, so you got the default `toString()` from `Object`. That string is NOT the contents of the array elements. Please read up on what `Object#toString()` does if it's not overridden in the subclass. For each element you get a type indicator `[B` (Array of Bytes) and the memory address `7fc7efa0`.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22537415
type: QuestionComment

http://stackoverflow.com/a/22630870
type: Answer
has body: Also, in C when you pass a pointer to a function, aren't you passing the address of a variable in memory? Yet it is called pass by value. No it is not. When you pass a pointer to a value to a function in C, it is known as 'pass by reference'. The function can directly access &amp; modify the original value because it has it's address. Pass by value is when you pass the value of objects instead of their locations or addresses. Look at the following examples. int addOne(int x) { return x + 1; } void destructiveAddOne(int *x) { *x += 1; } int main(void) { int x = 5; int y = 5; // We pass the _value_ of x, ie, 5 to addOne, and store the result in z. // The value of x will remain unchanged, ie, 5. int z = addOne(x); // We pass a REFERENCE to y, ie, it's address to destructiveAddOne() // destructiveAddOne then modifies the value of y to be y + 1. The value of y // has now CHANGED to 6. This is call by reference. destructiveAddOne(&amp;y); return 0; }
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22630649
downvote count: 0

http://stackoverflow.com/comment/34361192
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22568744
type: QuestionComment
has text: *"and here is the html"* No that is ASP. HTML is what ends up in the browser.

http://stackoverflow.com/a/22522589
score: 1
has body: I'm not sure what your issue is, and it seems as if you might be trying to make things more difficult than they need to be. Why not simply read your lines in with the Scanner, one at a time, put them into a StringBuilder, and then when the text has been read in, convert to a String and manipulate your String to your hearts content?
upvote count: 1
has comment: http://stackoverflow.com/comment/34271780
downvote count: 0
has comment: http://stackoverflow.com/comment/34271735
has comment: http://stackoverflow.com/comment/34272389
has comment: http://stackoverflow.com/comment/34271981
has comment: http://stackoverflow.com/comment/34272490
has comment: http://stackoverflow.com/comment/34271794
has comment: http://stackoverflow.com/comment/34272306
type: Answer
has comment: http://stackoverflow.com/comment/34272303
has comment: http://stackoverflow.com/comment/34271713
answers question: http://stackoverflow.com/q/22522564

http://stackoverflow.com/comment/34397991
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22591324
has text: No, That was a mistake sprite.draw() should be outside the if condition. It tried it but i did not get desired result.
score: 0

http://stackoverflow.com/comment/34533216
type: AnswerComment
type: Comment
has text: True. I'm kind of new to concurrency, and hadn't tried out straight-up threads yet. I figured it out with not too much trouble though, and certainly is more straightforward than my fork/join trick. Since it's only two iterations, there isn't much of a performance difference between the two methods.
comment on: http://stackoverflow.com/a/22560683
score: 0

http://stackoverflow.com/q/22580523
has title: Is there another way to do serialization apart from implementing Serializable & Externalizable?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34373988
linked to: http://stackoverflow.com/q/35785
linked to: http://stackoverflow.com/q/7539954
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34374128
answer count: 1
has comment: http://stackoverflow.com/comment/34374100
has answer: http://stackoverflow.com/a/39201146
tagged with: serialization
score: 0
has body: Is there any other mechanism to do serialization? one of interviewer asked me to tell about another way of serialization apart from implementing Serializable &amp; Externalizable.

jersey
tags question: http://stackoverflow.com/q/22638377
tags question: http://stackoverflow.com/q/22645836
tags question: http://stackoverflow.com/q/22568354
tags question: http://stackoverflow.com/q/22558102
tags question: http://stackoverflow.com/q/22589367
tags question: http://stackoverflow.com/q/22558031
tags question: http://stackoverflow.com/q/22611105
tags question: http://stackoverflow.com/q/22578595
tags question: http://stackoverflow.com/q/22626049
tags question: http://stackoverflow.com/q/22582885
tags question: http://stackoverflow.com/q/22593983
tags question: http://stackoverflow.com/q/22597316
tags question: http://stackoverflow.com/q/22579845
tags question: http://stackoverflow.com/q/22569965
tag name: jersey
tags question: http://stackoverflow.com/q/22561527
tags question: http://stackoverflow.com/q/22605342
tags question: http://stackoverflow.com/q/22614269
tags question: http://stackoverflow.com/q/22597621
tags question: http://stackoverflow.com/q/22567097
tags question: http://stackoverflow.com/q/22591350
type: Tag
tags question: http://stackoverflow.com/q/22607361

http://stackoverflow.com/q/22529273
tagged with: cmd
tagged with: cordova
tagged with: android
has title: Use cordova/phonegap from java
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/7112259
has body: Normaly i use cordova to generate a cordova project with cmd from windows. I generate it via cordova create hello com.something HelloWorld cd hello cordova add android cordova build Now i would like to generate a cordova project from java. Something like this: public void generateCordovaProject(String folderName, String packageName, String projectName) How it is possible? Thank you. UPDATE I would like to use a special API to do this.
type: Question
has answer: http://stackoverflow.com/a/22529598
accepted answer: http://stackoverflow.com/a/22529598
score: 0
answer count: 1

http://stackoverflow.com/comment/34424688
has text: No.. I have Undeployed my app and deployed again and works fine .. :)
comment on: http://stackoverflow.com/a/22606964
type: Comment
score: 0
type: AnswerComment

merge
tags question: http://stackoverflow.com/q/22647745
tags question: http://stackoverflow.com/q/22639939
tags question: http://stackoverflow.com/q/22600064
tags question: http://stackoverflow.com/q/22525742
type: Tag
tags question: http://stackoverflow.com/q/22494866
tag name: merge
tags question: http://stackoverflow.com/q/22538713

http://stackoverflow.com/a/22534134
type: AcceptedAnswer
type: Answer
has body: X509EncodedKeySpec expects DER-encoded data, not PEM-encoded. Your code will work fine if you simply discard the "BEGIN" and "END" and base64-decode the public keys contents. final String key2 = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdQudusozLmogBfU2LCO+WcM59" + "ycup9SxMsBNCku23PxrPMO6u//QjtWPz7istE9vkQfa6tQn1Or+SDxeHLMxEesF0" + "xiBEgFUhg7vjOF2SnFQQEADgUyizUIBBn1UgKNA8eP24Ux0P0M2aHMn78HIHsRcu" + "pNGUNW7p51HOVoIPJQIDAQAB"; PublicKey publicKey = KeyFactory.getInstance("RSA").generatePublic( new X509EncodedKeySpec(DatatypeConverter.parseBase64Binary(key2)));
has comment: http://stackoverflow.com/comment/52297833
has comment: http://stackoverflow.com/comment/90453521
upvote count: 22
accepted answer of: http://stackoverflow.com/q/22518608
score: 21
answers question: http://stackoverflow.com/q/22518608
downvote count: 1

http://stackoverflow.com/q/22643331
tagged with: java
has body: The title actually hits it. To specify: I've tried to work with some KeyEvents while having a game on fullscreen. But for some reason, some of them work (like TAB, Enter, characters (A-Z)), and some others don't, like the arrow keys or the DELETE-key. What's even more confusing is that VK_LEFT and VK_RIGHT function as if they were the numpad keys, while the documentation says the oposite. But VK_KP_LEFT and the other three as well do not seem to work at all (while having that addressed game on full screen), independant from whether NUM is enabled or not. I used Thread.sleep(300) to hold the key a bit before releasing and to wait between consecutive keystrokes. So, has anyone an explanation or assumption on why this could be? And is it possible, to get this fixed without setting up custom key bindings? I'd be really glad to know.
type: Question
tagged with: key-bindings
has title: Why are some KeyEvents not working in certain applications?
score: 0
tagged with: keycode
tagged with: awt
has comment: http://stackoverflow.com/comment/34593901
has comment: http://stackoverflow.com/comment/34486564
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34593887
tagged with: keyevent
answer count: 0

http://stackoverflow.com/q/22526396
has comment: http://stackoverflow.com/comment/35114993
upvote count: 3
tagged with: java
has body: I'm using version 2.0.1 . I have like hundred of thousands of nodes that needs to be inserted. My neo4j graph db is on a stand alone server, and I'm using RestApi through the neo4j rest graph db library to achieved this. However, I'm facing a slow performance result. I've chopped my queries into batches, sending 500 cypher statements in a single http call. The result that I'm getting is like: 10:38:10.984 INFO commit 10:38:13.161 INFO commit 10:38:13.277 INFO commit 10:38:15.132 INFO commit 10:38:15.218 INFO commit 10:38:17.288 INFO commit 10:38:19.488 INFO commit 10:38:22.020 INFO commit 10:38:24.806 INFO commit 10:38:27.848 INFO commit 10:38:31.172 INFO commit 10:38:34.767 INFO commit 10:38:38.661 INFO commit And so on. The query that I'm using is as follows: MERGE (a{main:{val1},prop2:{val2}}) MERGE (b{main:{val3}}) CREATE UNIQUE (a)-[r:relationshipname]-(b); My code is this: private RestAPI restAPI; private RestCypherQueryEngine engine; private GraphDatabaseService graphDB = new RestGraphDatabase("http://localdomain.com:7474/db/data/"); ... restAPI = ((RestGraphDatabase) graphDB).getRestAPI(); engine = new RestCypherQueryEngine(restAPI); ... Transaction tx = graphDB.getRestAPI().beginTx(); try { int ctr = 0; while (isExists) { ctr++; //excute query here through engine.query() if (ctr % 500 == 0) { tx.success(); tx.close(); tx = graphDB.getRestAPI().beginTx(); LOGGER.info("commit"); } } tx.success(); } catch (FileNotFoundException | NumberFormatException | ArrayIndexOutOfBoundsException e) { tx.failure(); } finally { tx.close(); } Thanks! UPDATED BENCHMARK. Sorry for the confusion, the benchmark that I've posted isn't accurate, and is not for 500 queries. My ctr variable isn't actually referring to the number of cypher queries. So now, I'm having like 500 queries per 3 seconds and that 3 seconds keeps on increasing as well. It's still way slow compared to the embedded neo4j.
type: Question
has title: neo4j - batch insertion using neo4j rest graph db
has answer: http://stackoverflow.com/a/22529392
answer count: 1
downvote count: 0
tagged with: neo4j
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34280595
linked to: http://stackoverflow.com/q/19839469
score: 3

http://stackoverflow.com/a/22580984
type: AcceptedAnswer
has body: Just make, occupancyRate = ((double)occRoomsT) / roomNoT; Total number of rooms will always be an integer and declaring them as double is not a good practice and this occupies more space compared to an integer.
type: Answer
accepted answer of: http://stackoverflow.com/q/22580914
answers question: http://stackoverflow.com/q/22580914
score: 0

http://stackoverflow.com/a/22488318
type: Answer
has body: You mod statement should be != 0 not > 0. -25 % 2 = -1.
answers question: http://stackoverflow.com/q/22488193
score: 0

http://stackoverflow.com/comment/34319368
comment on: http://stackoverflow.com/a/22520819
score: 0
type: AnswerComment
type: Comment
has text: I'm going to bail on attempting to implement this any further. I really feel like I'm stretching the limits of what I should be doing anyways. Thanks for the help though :)

http://stackoverflow.com/a/22610714
type: Answer
has body: == does not compare Strings, for that you'll want to use the equals() function instead. equals() will simply return true or false depending on whether or not your string is the same as the input given to the function.
score: 0
answers question: http://stackoverflow.com/q/22610510

http://stackoverflow.com/comment/34317046
comment on: http://stackoverflow.com/q/22547879
score: 0
type: Comment
type: QuestionComment
has text: I have problem with quotes, but the folder name includes spaces.... and I'm not sure if output classes files must be '-d "D:\Developing Java\classes\hipack\lopack"' or '-d "D:\Developing Java\classes"'...

http://stackoverflow.com/comment/34478771
has text: haha well it comes up with a blue triangle on Eclipse - so I figured it was a method. I'll edit the above with the class I'm calling it from
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22639021

http://stackoverflow.com/comment/34373304
type: Comment
score: 1
type: QuestionComment
has text: @THE-E: ***ALL*** your static fields shown above should be instance fields with the only exception being the serialVersionUID fields. You should not try to access any of these fields in a static way, but rather should use getters and setters. Otherwise you lose all the benefits of OOPs programming
comment on: http://stackoverflow.com/q/22577924

http://stackoverflow.com/a/22597452
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22596944
downvote count: 0
has body: You can try the next: // Characters you want to remove String unwanted = "[],"; // It will be used frequently? Use a constant. Pattern pattern = Pattern.compile("[" + Pattern.quote(unwanted) + "]"); String content = price_result.toString(); String content_modified = pattern.matcher(content).replaceAll(""); System.out.println(content_modified);
score: 1

http://stackoverflow.com/comment/34483766
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22641724
has text: I was referring to the general process here; so far you have been lucky not to lose anything, but luck will only get you so far
score: 0

http://stackoverflow.com/comment/34230951
type: Comment
has text: It doesn't look like you can use assets with `RandomAccessFile`, you still would need to copy the file to cache first.
comment on: http://stackoverflow.com/a/22499611
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34368981
comment on: http://stackoverflow.com/q/22577680
score: 0
has text: possible duplicate of [Are static methods inherited in Java?](http://stackoverflow.com/questions/10291949/are-static-methods-inherited-in-java)
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22602366
tagged with: google-chrome
has comment: http://stackoverflow.com/comment/34459021
has title: Reduce HTML using Applets
has answer: http://stackoverflow.com/a/22603068
linked to: http://stackoverflow.com/q/19082179
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22603068
score: 3
downvote count: 0
tagged with: applet
has answer: http://stackoverflow.com/a/22804979
favorite count: 0
has comment: http://stackoverflow.com/comment/34458903
type: Question
has comment: http://stackoverflow.com/comment/34414176
tagged with: http://stackoverflow.com/tag/html
upvote count: 3
has comment: http://stackoverflow.com/comment/34470031
has comment: http://stackoverflow.com/comment/34413904
tagged with: java
has body: My supervisor has tasked me with programmatically reducing a website's content by looking at the HTML tags to reveal only the core content. Importantly, this particular piece of the project must be written in Java. Now having learnt about the differences betweenPlugins, Extensions, Applets, and Widgets, I think I want to use an Extension that calls a client-side Applet. My approach was going to be this: Using the Google-Chrome API, I was going to display a button that the user can click. If clicked, the action is to launch a new browser tab that has the Applet embedded within it. The applet automatically sources the called tab's HTML code and filters it. Once filtered, the reduced copy of the original site appears. So I have a few questions. To start, is it even possible to use an Extension with an Applet? Moreover, is it possible for an applet to look @ another tabs HTML code? If not, is it possible to just reload the original tab with the Applet now embedded within it and complete the function. Thanks.
answer count: 2
accepted answer: http://stackoverflow.com/a/22804979

http://stackoverflow.com/comment/34414453
score: 0
type: Comment
type: QuestionComment
has text: @fge because I am not familiar and I have been using this class for a long time without issues and it's simple and easy to modify if needed. As you can see, the problem was not with the threads or queue, so switching to those classes would not have helped.
comment on: http://stackoverflow.com/q/22600972

http://stackoverflow.com/comment/34428245
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22610728
score: 1
has text: Why don't you just use `Collections.sort(List<T> list)` ?

http://stackoverflow.com/comment/34556295
type: QuestionComment
has text: Show us your persistence.xml file.
comment on: http://stackoverflow.com/q/22622125
score: 0
type: Comment

http://stackoverflow.com/a/22587990
upvote count: 3
answers question: http://stackoverflow.com/q/22587788
has comment: http://stackoverflow.com/comment/34387850
score: 3
downvote count: 0
type: Answer
has body: If User is an exported remote object, as it seems to be, it appears in the client as the remote interface it implements, not as the implementation class. So that's what you must cast it to. In this case that means declaring your List as List&lt;UserInterface&gt;, where UserInterface is the name of the remote interface. Adjust to suit.

http://stackoverflow.com/comment/34321715
has text: @user3444913 See my **Update**, it should run if you follow the code as I show in my update. Let me know if that works for you. You can also show me how you updated your code (that you attached the image to) and I'll tell you what might have been wrong with it.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22550246

client-certificates
tags question: http://stackoverflow.com/q/22500339
tag name: client-certificates
type: Tag

http://stackoverflow.com/q/22618361
type: UnansweredQuestion
has body: I am planning to make large class in Java that should implement multiple listener interfaces and send it to native code. Point of it is to handle events from all kinds of "views". How common is this practice in Java? Another question is that if such class is created, does passing it to multiple objects such as button.setOnClickListener(class); create new instances, or passes reference/pointer to it?
tagged with: class
has answer: http://stackoverflow.com/a/22619200
has answer: http://stackoverflow.com/a/22618637
type: Question
tagged with: interface
has title: Java multiple interface inhertirance and value passing
answer count: 2
tagged with: android
score: 0
tagged with: java
tagged with: java-native-interface

http://stackoverflow.com/q/22523644
has comment: http://stackoverflow.com/comment/34273427
has comment: http://stackoverflow.com/comment/34276897
has answer: http://stackoverflow.com/a/27500217
type: Question
tagged with: tiff
has title: Issue in getImageWritersByFormatName for Tiff. Getting image writer
has body: I am trying to convert PDF to tif images. I use following code to get the image writers by format. Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("TIFF"); if (writers == null || !writers.hasNext()) { throw new ImageWritingException(); } This works fine when I run the application standalone in Eclipse. But when I deploy the application to tomcat server in linux, writers==null is false but !writers.hasNext is true resulting to throw Exception. I use maven to build the project to war. I have following dependencies in the pom file. org.icepdf icepdf-core com.sun.media jai_imageio com.sun.media jai-codec javax.media jai_core What can be the difference between two environments? How can I fix this issue?
tagged with: image
answer count: 3
has comment: http://stackoverflow.com/comment/34277498
has answer: http://stackoverflow.com/a/22526325
accepted answer: http://stackoverflow.com/a/22526325
downvote count: 0
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/27500217
favorite count: 0
has comment: http://stackoverflow.com/comment/34276993
has comment: http://stackoverflow.com/comment/34276403
has answer: http://stackoverflow.com/a/72601644
tagged with: maven
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34277086
has comment: http://stackoverflow.com/comment/34276436
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34276958

http://stackoverflow.com/comment/34347951
score: 0
type: QuestionComment
has text: @fge yea looking at that now. looks like one of the ways to go. was also trying to see if `json4s` might help since it has Jackson support.
type: Comment
comment on: http://stackoverflow.com/q/22565869

http://stackoverflow.com/comment/34246325
has text: Have you tried using `val.Length` since the count method might actually by counting the string each time?
comment on: http://stackoverflow.com/q/22508766
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/22493525
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22493486
answers question: http://stackoverflow.com/q/22493486
score: 2
type: AcceptedAnswer
downvote count: 0
has body: It's just an arbitrary separator character between the class name and the hexidecimal hexadecimal representation of the object's hash code. toString is being invoked on the TUser object. From the docs The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())

http://stackoverflow.com/comment/34240549
comment on: http://stackoverflow.com/q/22505567
has text: How about using a public accessor method and mocking that? If that doesn't cut it, you are probably testing the wrong thing.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22643281
type: UnansweredQuestion
tagged with: jdbc
score: 2
upvote count: 2
tagged with: mysql
type: Question
linked to: http://stackoverflow.com/q/1812891
has answer: http://stackoverflow.com/a/22643402
tagged with: java
has body: When I submitted the form to my JDBC connection page it gives an error. I submitted the form with a data like this It's wrong It gives an error as shown below com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's wrong' IN BOOLEAN MODE) and bot2=1' at line 1 My code is String Query="SELECT * FROM ques WHERE MATCH(subject) AGAINST('"+vv+"' IN BOOLEAN MODE) and bot2=1"; Class.forName("com.mysql.jdbc.Driver"); conn=DriverManager.getConnection("jdbc:mysql://localhost:3306 /wst","manohar","manohar"); stmt=conn.prepareStatement(Query); rs=stmt.executeQuery(Query); while(rs.next()) { .... }
answer count: 2
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/22643401
has title: MySQL syntax error when string input contains quotation marks
favorite count: 0

http://stackoverflow.com/comment/34330215
type: QuestionComment
comment on: http://stackoverflow.com/q/22552148
has text: @MadProgrammer Thanks for the help I got it and tried some new code but there is a problem with that. Should I post it here or should I start a new thread for that?
score: 0
type: Comment

http://stackoverflow.com/q/22550264
answer count: 4
accepted answer: http://stackoverflow.com/a/22550437
possible better answer: http://stackoverflow.com/a/22550405
linked to: http://stackoverflow.com/q/3940194
score: 1
has answer: http://stackoverflow.com/a/22550405
upvote count: 1
has comment: http://stackoverflow.com/comment/34320810
type: AnsweredQuestion
has body: I cant seem to figure out a way to use an ArrayList (2 or more indexes) to search within another ArrayList. For example, if list = [4,5,6,2,3,5,6] and searchlist = [5,6], index should = 1. Anybody have any ideas?
has answer: http://stackoverflow.com/a/22550409
tagged with: java
has comment: http://stackoverflow.com/comment/34321222
type: Question
downvote count: 0
has title: Using an ArrayList to search within other ArrayList
has answer: http://stackoverflow.com/a/22550298
favorite count: 0
has comment: http://stackoverflow.com/comment/34321002
has comment: http://stackoverflow.com/comment/34320986
has answer: http://stackoverflow.com/a/22550437
has comment: http://stackoverflow.com/comment/34321007
has comment: http://stackoverflow.com/comment/34321036
has comment: http://stackoverflow.com/comment/34320878

http://stackoverflow.com/comment/34986760
score: 0
has text: Was This issue resolved? if so, what was the conclusion?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22587383

http://stackoverflow.com/comment/34223234
has text: I'm not even getting any stacktrace, just a popup window with those details (posted above)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22494656
type: Comment

http://stackoverflow.com/comment/34456006
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22625419
score: 0
has text: I want the opposite of an `AsyncTask`: something that blocks a background thread until completion and runs on the main thread.

android-sqlite
tags question: http://stackoverflow.com/q/22543757
tags question: http://stackoverflow.com/q/22619543
tag name: android-sqlite
tags question: http://stackoverflow.com/q/22600250
type: Tag
tags question: http://stackoverflow.com/q/22626197

http://stackoverflow.com/q/22630856
has body: Since upgrading to Elasticsearch 1.0.1 I've become aware of the field data cache and its circuit breaker. https://www.elastic.co/guide/en/elasticsearch/reference/1.3/index-modules-fielddata.html I use the facets(and now aggregates) quite heavily and I was just wondering if the field cache is distributed and if so, how it is distributed? I.e. If I use 2GB of field cache on one node, if I then add 3 more nodes, will the 2GB be distributed over the 4 nodes or will I see a 2GB cache on each node? Thanks in advance, J
has answer: http://stackoverflow.com/a/22638369
tagged with: lucene
upvote count: 1
answer count: 1
favorite count: 0
tagged with: elasticsearch
has title: Elasticsearch Field Data Cache Distributed?
tagged with: nosql
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22638369
type: Question

http://stackoverflow.com/comment/34402419
type: Comment
comment on: http://stackoverflow.com/a/22595939
score: 0
type: AnswerComment
has text: I tested it, it was giving null but after the solution i suggests, it works with me, the only different thing is that i am using jsp pages not html A.jsp and second.jsp ... also restart the server may solve that issue

http://stackoverflow.com/comment/34214355
type: Comment
comment on: http://stackoverflow.com/q/22489486
type: QuestionComment
has text: @CodeMed Fair enough.
score: 0

http://stackoverflow.com/a/22563397
score: 1
has body: I think it's because in your serialize/de-serialize logic for CompositeKey you write the position as a long but read it as an integer. That will mess up the comparison logic because you're not testing exactly the same thing you wrote to the context.
answers question: http://stackoverflow.com/q/22563204
accepted answer of: http://stackoverflow.com/q/22563204
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34343413
downvote count: 0

http://stackoverflow.com/comment/34394586
type: Comment
comment on: http://stackoverflow.com/a/22591868
score: 0
type: AnswerComment
has text: Views in a listView get recycled, that's why you use the holder pattern to have fast access to the views. Your code worked only for the first time, when you created the view, the second time you retrieved the holder, but you didn't set the new values.

http://stackoverflow.com/comment/34297435
type: Comment
type: QuestionComment
score: 0
has text: `classpath:/db-config.xml`, the asterisk means you wanna import more files
comment on: http://stackoverflow.com/q/22536284

http://stackoverflow.com/a/22639930
upvote count: 5
has comment: http://stackoverflow.com/comment/34482214
answers question: http://stackoverflow.com/q/22639787
type: Answer
has comment: http://stackoverflow.com/comment/34480361
has comment: http://stackoverflow.com/comment/34482409
downvote count: 0
has comment: http://stackoverflow.com/comment/34483191
has body: You're executing an infinite loop inside a single thread. When new what(); is created, the loop starts and never ends. As such c.setVisible(true); is never reached. You will need to create a separate thread for this loop to be run in. You could create the following class; public class Infout implements Runnable{ private JFrame frame; private JLabel image; private Random s = new Random(); public Infout(JFrame frame, JLabel image){ this.frame = frame; this.image = image; } @Override public void run() { while(true){ int x = s.nextInt(1000); int y = s.nextInt(900); try{ Thread.sleep(1000); } catch(InterruptedException e){ } image.setBounds(x, y, 200, 200); } } } and then instantiate and run in your main method like so; Infout inf = new Infout(c, image); new Thread(inf).start(); I hope this helps :)
has comment: http://stackoverflow.com/comment/34482530
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34482240
has comment: http://stackoverflow.com/comment/34482341
has comment: http://stackoverflow.com/comment/34482452
has comment: http://stackoverflow.com/comment/34486132
has comment: http://stackoverflow.com/comment/34480483
has comment: http://stackoverflow.com/comment/34480315
has comment: http://stackoverflow.com/comment/34482143
accepted answer of: http://stackoverflow.com/q/22639787

http://stackoverflow.com/a/22634401
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: Simply change this. jObject = new JSONObject(byteArrayOutputStream.toString()); JSONObject jObjectResult = jObject.getJSONObject("data"); JSONArray jArray = jObjectResult.getJSONArray("mainScreen"); myTasks = new ArrayList&lt;Tasks&gt;(); mainObjs = new ArrayList&lt;MainScreenObject&gt;(); for (int i = 0; i &lt; jArray.length(); i++) { JSONObject jobj = jArray.getJSONObject(i) JSONObject jAddi= jobj.getJSONObject("addi_info"); JSONArray tasks = jAddi.getJSONArray("tasks"); Your addi_info object is inside your tasks JSONArray. And you didn't see that. You have fetch wrong. So you didn't get. Also check proper json data see this
answers question: http://stackoverflow.com/q/22634229
accepted answer of: http://stackoverflow.com/q/22634229
upvote count: 4

http://stackoverflow.com/comment/34464323
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22560306
has text: Code converter? what code converter?
score: 0

http://stackoverflow.com/comment/82754351
score: 0
comment on: http://stackoverflow.com/q/22632826
type: Comment
type: QuestionComment
has text: @bikashg: Permutations & Combinations

http://stackoverflow.com/q/22647861
has title: SQLite database using Fragment in Android
answer count: 1
tagged with: database
downvote count: 0
tagged with: android
tagged with: sqlite
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22648041
upvote count: 1
has body: I'm making an app which have multiple fragment. One of those fragment shows the Data from a Database. The fragment are called from the MainActivity and redirected to the external class "fragment_database". But, whenever I try to add function in this external class "Fragment_Database.java", that generate a scope error or a missing function error. All the function require that the class extend the Activity class but mine extends the Fragment class instead... Here is my external fragment_database class: public class Fragment_Database extends Fragment{ public Fragment_Database() { // HERE?? } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ View v = inflater.inflate(R.layout.fragment_database, container, false); // HERE?? return v; } Am I suppose to put the database function in this class or in the MainActivity? I'm a little lost on the structural aspect of my project... Thanks
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/22648041
type: Question

http://stackoverflow.com/a/22499328
downvote count: 0
answers question: http://stackoverflow.com/q/22499200
type: Answer
score: 2
upvote count: 2
has body: You can't, not without breaking the Address class's contract. Instead, you can create a new class which I'll call ImmutableAddress, and have it accept an Address in its constructor and grab relevant information from it, exposing getters for that information, but no setters. (It's important that you don't just store the Address; you must grab the information from it and store that, since you can't trust anything not to modify the Address you're given). Then use ImmutableAddress on Employee rather than Address. Now, having said that, the sad fact is that you see class contracts broken fairly regularly with runtime exceptions. The way you'd do that would be to subclass Address and make all its setters throw a runtime exception, then constructor your subclass with a reference to a passed-in Address. But that's a hack, better to create the new, truly immutable class.
has comment: http://stackoverflow.com/comment/121060623

http://stackoverflow.com/a/22531102
type: Answer
has comment: http://stackoverflow.com/comment/34291910
score: 2
upvote count: 2
has body: That looks like an Archimedean Spiral ( http://en.wikipedia.org/wiki/Archimedean_spiral ) import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Path2D; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class SpiralDrawPanelTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().setLayout(new BorderLayout()); f.getContentPane().add(new SpiralDrawPanel(),BorderLayout.CENTER); f.setSize(800, 800); f.setLocationRelativeTo(null); f.setVisible(true); } } class SpiralDrawPanel extends JPanel { @Override public void paintComponent(Graphics gr) { super.paintComponent(gr); Graphics2D g = (Graphics2D)gr; AffineTransform at = AffineTransform.getTranslateInstance( getWidth()/2, getHeight()/2); BasicStroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[]{10.0f}, 0.0f); g.setStroke(stroke); Shape shape = at.createTransformedShape( createArchimedeanSpiral(Math.PI*10, 10, 250)); g.draw(shape); } private static Shape createArchimedeanSpiral( double totalAngleRad, double alpha, int steps) { Path2D path = new Path2D.Double(); path.moveTo(0, 0); double angleDeltaRad = totalAngleRad / steps; for (int i=0; i&lt;=steps; i++) { double angleRad = i * angleDeltaRad; double x = Math.sin(angleRad) * alpha * angleRad; double y = Math.cos(angleRad) * alpha * angleRad; path.lineTo(x, y); } return path; } } EDIT for the comment. import java.awt.BorderLayout; import java.awt.Graphics; import java.awt.geom.Path2D; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class SpiralDrawPanelTest { public sta…
answers question: http://stackoverflow.com/q/22530660
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34287375
has comment: http://stackoverflow.com/comment/34291463
accepted answer of: http://stackoverflow.com/q/22530660

http://stackoverflow.com/q/22534073
tagged with: java
answer count: 4
accepted answer: http://stackoverflow.com/a/22534326
has title: Getting familiar with Threads in Java: Why does this program's runtime increase with increasing number of threads
tagged with: random
score: 2
type: AnsweredQuestion
has body: Situation I am trying to get familiar with threads in Java. For that reason I modified a program listing I found in a book. What is does is pretty simple: It creates a boolean[]-array with 100.000.000 elements. It randomly fills that array's elements with true or false using NUMBER_OF_SERVERS threads. Finally it scans that array with NUMBER_OF_SERVERS threads and counts how many entries are set to true For further details, please see the code below on the bottom of this post. Problem When I run the code with different number of threads and measure the runtime, I get a very strange result; or at least a behaviour that I do not understand: The BuildService-Thread consumes MORE runtime when I use MORE threads. When building the entire array (based on random truedistribution) in just one thread that takes about 10 seconds. Next, when I use four threads I would expect the runtime to decrease. However, I get a time consumption of about 17 seconds. My ScanService works as expected: Time consumption decreases with more threads. Please see the following chart for details: However, if change one line in my code and replace the if ((int) ((Math.random() * 2d)) == 0)-statement (for random true-distribution) with if (i % 2 == 0) (thus, every second item will be true) I get a behaviour I would expect: Questions So, my questions are: Why do MORE threads lead to a LONGER runtime when using Math.random() function? Vice versa, why does the runtime DECREASE when using only ONE thread using the exact same function? What "general rules" can be derived from this behaviour when it comes down to dealing with threads? Background info The code was run on an Intel core i3. Code public class AsynchService { private static final int ARRAY_SIZE = 100000000; //100.000.000 private static final int NUMBER_OF_SERVERS = 16; private static final int HOW_MANY = ARRAY_SIZE / NUMBER_OF_SERVERS; //build array asynch public static boolean[] buildArrayAsynch() { //build array with NUMBER_OF_SERVERS-Threads …
downvote count: 0
has answer: http://stackoverflow.com/a/22538161
favorite count: 0
has answer: http://stackoverflow.com/a/22534353
type: Question
upvote count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/22534326
possible better answer: http://stackoverflow.com/a/22534345
linked to: http://stackoverflow.com/q/19501465
tagged with: performance
has answer: http://stackoverflow.com/a/22534345

http://stackoverflow.com/a/78929080
score: 0
type: Answer
has body: import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i =0; while (i<5) { System.out.println("Enter the number"); int n = Integer.parseInt(sc.nextLine()); System.out.println("Enter the String"); String s = sc.nextLine(); i++; } } } Alternate way to resolve the above problem. This code working 100% correctly.
answers question: http://stackoverflow.com/q/22542833

http://stackoverflow.com/comment/34396888
type: AnswerComment
has text: I was so glad to see a response to this question by showing the grammar of the language specification. There is hope left in this world. Thank you for restoring my faith in humanity, @eis.
type: Comment
comment on: http://stackoverflow.com/a/22579372
score: 0

http://stackoverflow.com/comment/34247586
has text: I need the loop to go around three times in two different settings. The first time twice. And the then the second time once. Each time keeping place of the index.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22509433

http://stackoverflow.com/comment/34269115
has text: I solved you "populating the JComboBox Question" upvote and accept my answer :) and then start a new question as how to break them .. I'll answer that separately ..
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22520399

http://stackoverflow.com/q/22605947
has answer: http://stackoverflow.com/a/48457365
has answer: http://stackoverflow.com/a/61376387
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34420873
has body: I have gradle application. And my main gradle-file include some tasks (groovy). I need when start a my task - environment variable "LANG" set encoding = ru_RU.koi8-r (for windows, linux), and after the completion of the my task - environment variable contains the initial value (en_US.UTF-8). How do it? Help me, please.
upvote count: 23
has answer: http://stackoverflow.com/a/60077606
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/35205582
has title: How do set environment variable in gradle via task?
linked to: http://stackoverflow.com/q/50509084
tagged with: java
score: 23
has comment: http://stackoverflow.com/comment/34422571
tagged with: gradle
has answer: http://stackoverflow.com/a/26634167
tagged with: encoding
has comment: http://stackoverflow.com/comment/34445686
tagged with: environment-variables
has comment: http://stackoverflow.com/comment/34422387
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34420508
has answer: http://stackoverflow.com/a/68922352
tagged with: groovy
has answer: http://stackoverflow.com/a/47267819
has answer: http://stackoverflow.com/a/54615238
has comment: http://stackoverflow.com/comment/34423323

http://stackoverflow.com/q/22602680
has comment: http://stackoverflow.com/comment/34415114
downvote count: 0
has body: I asked a similar question before I haven't gotten any good feedback/help there. So I am rewriting this question with more information. Here is a partially converted Javascript Function to Java.. It's nearly complete. I know I cannot use Anonymous Functions in arrays in Java let alone Anonymous Functions, only thing closest to this functionality would be inner-classes, not what I want. I know this code can still be converted maybe into multiple functions and instead of using Anonymous Function Arrays something like if statements or a mix of a switch(...) The function below just initalizes the LINECONTROL array of anonymous functions using recursion calls as well. Later in this javscript emulator It's used like this LCDCONTROL = (LCDisOn) ? LINECONTROL : DISPLAYOFFCONTROL; DISPLAYOFFCONTROL is a anonymous function that's empty. declared like this DISPLAYOFFCONTROL = [function() {}]; You never call the LINECONTROL array outside the initalizeLCDController, you only call the LCDCONTROL object. Like so //LCDCONTROL[actualScanLine](); I just need some advise how to to convert to function below maybe just a head start that's about it. Here is the partially translated function from JavaScript -> Java public void initializeLCDController() { long a = 0; while (a &lt; 154) { if (a &lt; 143) { LINECONTROL[a] = function () { if (LCDTicks &lt; 80) { scanLineMode2(); } else if (LCDTicks &lt; 252) { scanLineMode3(); } else if (LCDTicks &lt; 456) { scanLineMode0(); } else { LCDTicks -= 456; if (STATTracker != 3) { if (STATTracker != 2) { if (STATTracker == 0 &amp;&amp; mode2TriggerSTAT) { interruptsRequested |= 2; } incrementScanLineQueue(); } if (hdmaRunning) { executeHDMA(); } if (mode0TriggerSTAT) { interruptsRequested |= 2; } } actualScanLine = ++memory[65348]; if (actualScanLine == memory[65349]) { memory[65345] |= 4; if (LYCMatchTriggerSTAT) { interruptsRequested |= 2; } } else { memory[65345] &amp;= 123; } checkIRQMatching(); STATTracker = 0; modeSTAT = 2; LINECONTROL[actualS…
tagged with: function-pointers
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34416291
tagged with: java
has comment: http://stackoverflow.com/comment/34415725
has comment: http://stackoverflow.com/comment/34416255
has comment: http://stackoverflow.com/comment/34416234
type: Question
has comment: http://stackoverflow.com/comment/34414117
has title: JavaScript Anonymous Functions Array to Java Translation
tagged with: anonymous-function
answer count: 1
tagged with: arrays
tagged with: javascript
accepted answer: http://stackoverflow.com/a/22603058
has comment: http://stackoverflow.com/comment/34415997
upvote count: 3
has comment: http://stackoverflow.com/comment/34415190
has comment: http://stackoverflow.com/comment/34415552
has comment: http://stackoverflow.com/comment/34414207
has answer: http://stackoverflow.com/a/22603058
favorite count: 0

asp.net
tags question: http://stackoverflow.com/q/22599485
tags question: http://stackoverflow.com/q/22517672
type: Tag
tag name: asp.net
tags question: http://stackoverflow.com/q/22568744

http://stackoverflow.com/q/22543757
tagged with: android-context
tagged with: android
has comment: http://stackoverflow.com/comment/34309468
has answer: http://stackoverflow.com/a/22543891
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22543891
has body: I am writing a content provider in android. I want to write query implementation. I am creating a DbHelper object in the query function of contentProvider. But I am getting error when I create this that is I cannot access MainActivity.this in this content provider class. I need that MainActivity.this so that I can initialize DbHelper and use already implemented function query in DbHelper class by me. How do I solve this problem? Code: public class CourseContentProvider extends ContentProvider { @Override public Cursor query(Uri arg0, String[] arg1, String arg2, String[] arg3, String arg4) { // TODO Auto-generated method stub if (sURIMatcher.match(arg0)==COURSE) { MyDbHelper obj = new MyDbHelper(MainActivity.this);//Error msg here: No enclosing instance of the type MainActivity is accessible in scope } return null; } //other auto generated functions } Thanks.
tagged with: android-sqlite
type: Question
tagged with: android-contentprovider
tagged with: java
has title: how to get mainactivity.this in contentProvider class - in android
has comment: http://stackoverflow.com/comment/34309366
score: 0
answer count: 1

http://stackoverflow.com/a/22631911
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22631345
has body: This code just counts and when the least significant number gets to high it increases the next more significant number that is lower than maxNum. The outer loop is iterated for each result. The inner loop is entered after each maxNum iterations and runs minimum 1 times to maximum size -1 times. void main() { // possibles holds all the possible options. (1296 options in this case) List&lt;List&lt;int&gt;&gt; possibles = new List(); int size = 4; // This should be the size of each list. This is what I'm asking about. int maxNum = 6; // The numbers should go from 0 - maxNum. List&lt;int&gt; cur = new List&lt;int&gt;(size); for(int i = 0; i &lt; size; i++) cur[i] = 0; while(cur[0] &lt; maxNum) { possibles.add(new List.from(cur)); int pos = size-1; cur[pos]++; bool overflow = cur[pos] &gt;= maxNum; while(overflow &amp;&amp; size &gt; 0 &amp;&amp; pos &gt; 0) { cur[pos] = 0; pos--; cur[pos]++; overflow = cur[pos] &gt;= maxNum; } } // Print all the numbers to show it works. for(List&lt;int&gt; l in possibles) { print(l); } } EDIT This code preallocates the outer list to avoid that the list must be increased repeatedly and is slightly faster. import 'dart:math'; void main() { Stopwatch sw = new Stopwatch(); sw.start(); // possibles holds all the possible options. (1296 options in this case) List&lt;List&lt;int&gt;&gt; possibles; int size = 8; // This should be the size of each list. This is what I'm asking about. int maxNum = 6; // The numbers should go from 0 - maxNum. int resultCount = pow(maxNum, size); possibles = new List(resultCount); List&lt;int&gt; cur = new List&lt;int&gt;(size); for(int i = 0; i &lt; size; i++) cur[i] = 0; int cnt = 0; while(cur[0] &lt; maxNum) { possibles[cnt] = new List.from(cur); cnt++; int pos = size-1; cur[pos]++; bool overrun = cur[pos] &gt;= maxNum; while(overrun &amp;&amp; size &gt; 0 &amp;&amp; pos &gt; 0) { cur[pos] = 0; pos--; cur[pos]++; overrun = cur[pos] &gt;= maxNum; } } sw.stop(); print('elapsed: ${sw.elapsed}'); // Print all the n…
type: Answer
has comment: http://stackoverflow.com/comment/34469270
downvote count: 0

http://stackoverflow.com/comment/34321946
has text: @user2280906 so if there is NO collision, it updates the location of the player. The next time around it RESETS the values of tempx and tempy to the NEW position of player and then checks again to see if there is a collision. If there is this time, then it sets the current value of player to tempx and tempy, which are still the current value of `player.getX()` and `player.getY();`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22550202
type: Comment

http://stackoverflow.com/q/22496592
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/34226254
has comment: http://stackoverflow.com/comment/34227402
tagged with: java
has comment: http://stackoverflow.com/comment/34227773
has answer: http://stackoverflow.com/a/22496824
has comment: http://stackoverflow.com/comment/34226399
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22496824
has comment: http://stackoverflow.com/comment/34227880
has body: I have done quite a bit of searching around for a solution to this problem and the more I look into this the more complex the problem gets. I'm convinced I'm missing something, it can't be this difficult to get an already existing Java applet onto a website. I have currently created a simple Applet, compiled it into a .jar file and included the simple HTML markup for it. &lt;html&gt; &lt;body&gt; &lt;applet code=myApplet.class archive="myApplet.jar" width=400 height=700&gt; &lt;/applet&gt; &lt;/body&gt; &lt;/html&gt; This begins to load, which implies that it's working, but then I get warnings and security errors that absolutely will not allow the applet to play. Further research suggests that the applet must be signed first, this is where I am struggling. Questions How is signing an applet making it any safer? If I am able to sign this applet and make it usable, how is signing a malicious program any harder than signing a game? Where can I find a copy of "signtool" (apparently required to sign applets)? How do you use it? What is an RSA certificate and how do I obtain one? What is a keystore? I'm, basically looking for an existing step-by-step process to get through making a VERY basic applet, and posting it online so that it is viewable to anybody. The security process is daunting and confusing and I'm not entirely certain how to sign an application. Oracle's explanation mentions that the processes requires "signtool" and links to a site that doesn't mention it and I can't find it. Furthermore, I'm not entirely certain this is even necessary.
has comment: http://stackoverflow.com/comment/34227552
tagged with: certificate
has comment: http://stackoverflow.com/comment/34226365
score: 0
has title: How do you get a Java applet from the IDE onto a website?

http://stackoverflow.com/comment/34488738
type: AnswerComment
type: Comment
has text: @nimsson Yes there is Automation, you can include it for Ant, Maven, etc. I've personally never used it but I know it exists.
comment on: http://stackoverflow.com/a/22644583
score: 0

http://stackoverflow.com/a/22529598
score: 0
has comment: http://stackoverflow.com/comment/34283637
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22529273
has body: try to found info about executing Windows commands using Java, here is example How to Execute Windows Commands Using Java
type: Answer
answers question: http://stackoverflow.com/q/22529273
has comment: http://stackoverflow.com/comment/34284031

http://stackoverflow.com/a/22496240
has body: You can try this :- import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class ReverseOrder { /** * @param args */ public static void main(String[] args) throws FileNotFoundException { // TODO Auto-generated method stub ArrayList&lt;String&gt; revFile = new ArrayList&lt;String&gt;(); Scanner input = new Scanner(new File("/reverse.txt")); while (input.hasNextLine()){ revFile.add(input.nextLine()); } for(int i = (revFile.size()-1); i &gt;=0 ; i--){ String ar[]=revFile.get(i).split(" "); for(int j = (ar.length-1); j &gt;=0; j--){ System.out.print(ar[j] + " "); } System.out.println(" "); ar=null; } } } Output :- book. the liked He book. the read He book. the up picked He book. a for looked He Hope it will help you.
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22495997
answers question: http://stackoverflow.com/q/22495997
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34299452
score: 0
type: Comment
type: QuestionComment
has text: This question has already been asked and answered [here](http://stackoverflow.com/questions/9654576/attaching-an-drawable-image-to-email-in-android?rq=1).
comment on: http://stackoverflow.com/q/22537933

http://stackoverflow.com/a/22595660
type: Answer
answers question: http://stackoverflow.com/q/22595477
type: AcceptedAnswer
has body: If you want to display a text when a radio button is selected you could use ActionListener. final JTextArea textArea = new JTextArea(); add(textArea); JRadioButton radioButton = new JRadioButton(); add(radioButton); radioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { textArea.setText("Selected"); } }); JRadioButton radioButton2 = new JRadioButton(); add(radioButton2); radioButton2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { textArea.setText("Selected 2"); } }); radioButton.setSelected(true); When the first is selected it will change the text of the JTextArea with The first is selected!, same the second radio button but with The second is selected. As you said, radioButton.setSelected(true); setSelected is used to select/deselect a radio button. In this example i used textArea, but you can use everything which have a method to change the text it contains (an image too!) Official DOC, here. Anyway, actionPerformed is not called when setSelected is used so i would go to something like a method private void updateText(int index) { String text = null; switch (index) { case 0: text = "Selected"; break; case 1: text = "Selected 2"; break; } textArea.setText(text); } And then call updateText(0 or 1 etc.) when you want to select setSelected another radio button and update the text too. All this is useful, if you want to show a "what happens if you press it" message, but if you just want to change the text of the area with the text of the radio button, just use textArea.setText(e.getActionCommand());
accepted answer of: http://stackoverflow.com/q/22595477
score: 0

http://stackoverflow.com/a/22616256
score: 2
answers question: http://stackoverflow.com/q/22616165
downvote count: 0
has comment: http://stackoverflow.com/comment/107383801
has body: This is not the role of FileChannel. A FileChannel is just a wrapper over a byte channel. What you want instead is to use the "new" Java 7 file API for that. If you want to copy a file to a location while preserving attributes you can do it: Files.copy(src, dst, StandardCopyOption.COPY_ATTRIBUTES);
upvote count: 2
type: Answer

http://stackoverflow.com/comment/34314911
type: Comment
comment on: http://stackoverflow.com/q/22546834
type: QuestionComment
score: 0
has text: look up how to iterate through collections. SO isn't a place to ask for coding to be done for you.

http://stackoverflow.com/comment/34263253
has text: If your servlet is like a subfolder down, you might need to reference the JSP with ../, i.e. `request.getRequestDispatcher("../MyJSP.jsp")`
comment on: http://stackoverflow.com/a/22517740
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34249107
type: Comment
has text: I don't see any problem with you doing this, but I guess my question is why does it warrant this? This seems just defensive programming rather than actually having a real issue with it.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22510044

http://stackoverflow.com/q/22580743
has answer: http://stackoverflow.com/a/22580845
has body: I have 9 scenarios making a 9 conditional statement that will look to see if all the my JButton have been pressed and no winner was found, but it is giving me " error: ' void ' type not allowed here. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TicTacToe extends JFrame { private final int HEIGHT = 450; private final int WIDTH = 500; private static JButton [] button = new JButton[9]; private static Action [] playerTurn = new Action[9]; private static JLabel [] label; private int player = 1; private Font arial = new Font("Arial", Font.BOLD, 20); private static int lockButtons = 0; public TicTacToe () { setTitle( " tic tak tow "); setSize( HEIGHT, WIDTH); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new GridLayout(4,3)); int num = 0; for(int i = 0; i &lt; 9; i++ ) { button[i] = new JButton( "B" + i + 1); playerTurn[i] = new Action(); add(button[i]); button[i].setFont(arial); button[i].addActionListener(playerTurn[i]); } setVisible(true); } private class Action implements ActionListener { public void actionPerformed(ActionEvent playerMove) { //Get button pressed using GetSource Command JButton whatPlayer=(JButton)(playerMove.getSource()); if(player == 1) { player++; whatPlayer.setText("player1"); whatPlayer.setEnabled(false); validate(); return; } if (player == 2) { player--; whatPlayer.setText("player2"); whatPlayer.setEnabled(false); validate(); return; } } public void validate() { if(button[0].getText().equals(button[1].getText()) &amp;&amp; button[1].getText().equals(button[2].getText())) { JOptionPane.showMessageDialog(null,"Thank you the winner is" + button[0].getText()); gameOver(); } if(button[3].getText().equals(button[4].getText()) &amp;&amp; button[4].getText().equals(button[5].getText())) { JOptionPane.showMessageDialog(null,"Thank you the winner is" + button[3].getText()); gameOver(); } if(button[6].getText().equals(button[7].getText()) &amp;&amp; button[7].getText().equals(button[8].getText())) { JOptionPane.s…
upvote count: 0
answer count: 1
tagged with: user-interface
favorite count: 0
has title: Receiving " error: ' void ' type not allowed when checking JButton status in Tic Tac Toe game
has comment: http://stackoverflow.com/comment/34374613
tagged with: swing
downvote count: 1
tagged with: jbutton
type: AnsweredQuestion
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/34374435
accepted answer: http://stackoverflow.com/a/22580845
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/34374504

http://stackoverflow.com/q/22620701
has body: Hi guys wondering if you can let me know where I am going wrong. In my pom.xml I added a dependency for org.powermock:powermock-mockito-release-full:jar:1.5.4 via the following: org.powermock powermock-mockito-release-full 1.5.4 test Now during a build I get the error "Could not resolve dependencies for project com.law:test_pro:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.powermock:powermock-mockito-release-full:jar:1.5.4" In my local repository I have all jars for containing sub-projects but no jar for the parent jar which the build process seems to be looking for.
type: Question
has comment: http://stackoverflow.com/comment/34446855
has comment: http://stackoverflow.com/comment/34446834
accepted answer: http://stackoverflow.com/a/22621068
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34447162
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22621068
tagged with: java
has title: building maven project when adding dependency on parent jar

http://stackoverflow.com/q/22623410
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34458533
tagged with: osgi
accepted answer: http://stackoverflow.com/a/22630594
possible better answer: http://stackoverflow.com/a/22637226
upvote count: 3
has title: ClassNotFoundException during OSGI bundle startup
tagged with: maven
type: Question
has answer: http://stackoverflow.com/a/22630594
type: AnsweredQuestion
score: 3
tagged with: blueprint
tagged with: karaf
tagged with: java
has body: I have a problem which I just cannot seem to solve on my own. If have an OSGI Bundle which uses blueprint for instantiation of the Objects which should be deployed to Karaf 3.0.0. The problem is, that ClassNotFoundExceptions keep bothering me, allthough the corresponding jars are located in the bundles jar. This is my pom.xml: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.kneipenapp web-service WebService 0.0.1 bundle commons-dbcp commons-dbcp 2.0 commons-pool commons-pool 2.2 com.mysql mysql-driver 5.1.29 org.apache.camel camel-blueprint 2.13.0 provided org.apache.camel camel-core 2.13.0 provided org.apache.camel camel-sql 2.13.0 provided org.glassfish.grizzly grizzly-http 2.3.11 provided org.glassfish.jersey.containers jersey-container-servlet 2.7 org.apache.felix maven-bundle-plugin true *;scope=compile|runtime !*, org.glassfish.grizzly.http, org.apache.camel.component.sql, org.osgi.framework This is one of my blueprint xml files (this one is causing the ClassNotFoundException): <?xml version="1.0" encoding="UTF-8"?> <routeContextRef ref="newElementContext"/> <argument index="0" ref="endpointImplementation"/> <argument index="1" value="org.glassfish.grizzly.HttpHandler"/> <argument index="0" ref="context"/> <argument index="0" value="{{connection.url}}"/> <argument index="1" value="sqluser"/> <argument index="2" value="sqluserpw"/> <argument index="0" ref="connectionFactory"/> <argument index="1" value="com.mysql.jdbc.Driver"/> <property name="maxTotal" value="{{pool.maxConnections}}"/> <property name="maxIdle" value="{{pool.maxIdleConnections}}"/> <property name="minIdle" value="{{pool.minimumIdleConnections}}"/> <property name="maxWaitMillis" value="{{pool.waitInterval}}"/> <argument index="0" ref="pooledSQLConnectionFactory"/> <argument index="1" ref="poolConfig"/> <argument index="0" ref="connectionPool"/> <property name="dataSource" ref="dataSource"/> Finally this is the Exception and Stacktrace I recieve when I try to start the bundle: org.osgi.service.b…
answer count: 2
has answer: http://stackoverflow.com/a/22637226

http://stackoverflow.com/q/22635568
type: Question
has comment: http://stackoverflow.com/comment/34472182
has comment: http://stackoverflow.com/comment/34472053
accepted answer: http://stackoverflow.com/a/22635683
tagged with: jframe
has comment: http://stackoverflow.com/comment/34472392
score: 0
linked to: http://stackoverflow.com/q/9995383
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/34472109
downvote count: 1
has body: I have a little java program fully working in Eclipse. I can ask a user to enter a pin. It works. But now I want to go to the next step and mask what he enters. I need the pin hidden when he is entering it. I guess it is possible to display asterisks ("*") in the JFormattedTextField when he is writing, right ? How can I do that ? Here is my code : package codePin; import java.io.*; import java.text.NumberFormat; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main extends JFrame { private static final long serialVersionUID = 1L; private JPanel container = new JPanel(); private JFormattedTextField jtf = new JFormattedTextField(NumberFormat.getIntegerInstance()); private JLabel label = new JLabel("Enter Pin: "); private JButton b = new JButton("OK"); public Main() { this.setTitle("NEEDS"); this.setSize(300, 500); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); container.setBackground(Color.white); container.setLayout(new BorderLayout()); JPanel top = new JPanel(); Font police = new Font("Arial", Font.BOLD, 14); jtf.setFont(police); jtf.setPreferredSize(new Dimension(100, 30)); jtf.setForeground(Color.BLUE); b.addActionListener(new BoutonListener()); top.add(label); top.add(jtf); top.add(b); this.setContentPane(top); this.setVisible(true); } class BoutonListener implements ActionListener { private final AtomicInteger nbTry = new AtomicInteger(0); public void actionPerformed(ActionEvent e) { if (nbTry.get() &gt; 2) { JOptionPane.showMessageDialog(null, "Pin blocked due to 3 wrong tries"); return; } if (jtf.getText().replaceAll("\u00A0", "").length() != 4) { //System.out.println("Pin must be 4 digits"); JOptionPane.showMessageDialog(null, "Ping must be 4 digits"); return; } System.out.println("Checking..."); SwingWorker&lt;Void, Void&gt; worker = new SwingWorker&lt;Void, Void&gt;() { @Override protected Void doInBackground() throws E…
answer count: 1
has comment: http://stackoverflow.com/comment/34472174
tagged with: passwords
has title: How to mask input from a JFormattedTextField with asterisks?
has comment: http://stackoverflow.com/comment/34472135
tagged with: java
has comment: http://stackoverflow.com/comment/34472270
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22635683
favorite count: 0
tagged with: security

http://stackoverflow.com/comment/34216866
has text: Sine and cosine may help: http://en.wikipedia.org/wiki/Rotation_matrix
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22491178
type: QuestionComment

http://stackoverflow.com/q/22615360
answer count: 0
type: UnansweredQuestion
tagged with: jprogressbar
has title: Use swingWorker with other classes
tagged with: swing
tagged with: swingworker
tagged with: java
linked to: http://stackoverflow.com/q/22241566
type: Question
has comment: http://stackoverflow.com/comment/34526631
score: 0
has body: I'm starting to work with Java GUIs and I have some problems with SwingWorker: I'm trying to do a simple UI to start a server, run some "slave" objects and finally, run a master object managing all the work. I define the problem in the master (the number of tasks to do) and I have a progressBar in the UI that I want to update each time a task is done. I use a SwingWorker to update the progressBar, but I don't know how to do it right: in the background method it just sleeps until the master wakes it up when a task is done. Unfortunately it doesn't work and I would appreciate if someone could explain me what should I do. I create the swingworker in the GUI and add a listener for update a progressBar: private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { worker = WorkerUpdater.getInstance(); jProgressBar1.setValue(0); worker.addPropertyChangeListener(this); worker.execute(); This is the SwingWorker: public class WorkerUpdater extends SwingWorker&lt;Void, Integer&gt; { private static WorkerUpdater instance; private int progress; private boolean changed = false; public int getProgreso(){ return this.progress; } public void setProgreso(int p){ this.progress = p; changed = true; } public static WorkerUpdater getInstance(){ if(instance == null) instance = new WorkerUpdater(); return instance; } @Override protected Void doInBackground() throws Exception { while(progress &lt; 100){ if(changed){ setProgress(Math.min(progress, 100)); changed = false; } } return null; } } And I want to update the value of the progress bar when a task is done in other class (client): public boolean taskIsDone(String taskID, Object[] retVal) throws RemoteException { System.out.println("Client: taskIsDone(): Old task: " + taskID); this.doneTasks++; this.progress = ((Double) Math.ceil(doneTasks / totalTasks)).intValue(); synchronized (taskSynch) { worker.setProgress(progress); this.results.put(taskID, retVal); task_count--; taskSynch.notify(); } System.out.println("Client: Task fini…
has comment: http://stackoverflow.com/comment/34436914
has comment: http://stackoverflow.com/comment/34575182

http://stackoverflow.com/q/22647716
downvote count: 3
has title: How to replace a specific word in a specific line of text
type: Question
has body: Okay, so I have this yaml file, and I want to replace a string socialspy: true with the string socialspy: false But I don't know how to. Here is the full yaml document timestamps: login: 1395784099618 lastteleport: 1395785353975 logout: 1395777644566 mute: 0 ipAddress: 127.0.0.1 lastlocation: world: world x: -276.7695097103249 y: 67.31022115326866 z: -354.327229975015 yaw: 127.892334 pitch: 20.817677 money: '155200.0' logoutlocation: world: world x: -252.00777100946556 y: 76.56983022033046 z: -348.45387330548886 yaw: 319.99237 pitch: 19.562881 socialspy: true godmode: true afk: false powertools: muted: false
has comment: http://stackoverflow.com/comment/34494484
upvote count: 0
possible better answer: http://stackoverflow.com/a/22647799
has comment: http://stackoverflow.com/comment/34494522
tagged with: file-io
answer count: 3
has comment: http://stackoverflow.com/comment/34494532
has answer: http://stackoverflow.com/a/22647835
accepted answer: http://stackoverflow.com/a/22647835
favorite count: 0
score: -3
has comment: http://stackoverflow.com/comment/34494459
has answer: http://stackoverflow.com/a/22647876
has answer: http://stackoverflow.com/a/22647799
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22578619
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34370882
has body: Scenario: I have two Java applications - Master and Slave. Master needs to send to the Slave instance of class DEParamSet via socket. DEParamSet: public class DEParamSet implements Serializable { private static final long serialVersionUID = 8151790178483218232L; public final float CR, F; public final int NP, D; public final Specimen specimen; public final IOptimizationFunction optFunction; // Constructor and some methods.... ... some code ... } IOptimizationFunction: public interface IOptimizationFunction extends Serializable { public double evaluate(Object[] values); } Master creates instance of this class, serializes it and sends it via socket to the Slave. Fragment of code: // Create objective function IOptimizationFunction opt = new IOptimizationFunction() { private static final long serialVersionUID = -5167105656008707046L; @Override public double evaluate(Object[] params) { return (double) params[0] * (double) params[1]; } }; // Create instance of DEParamSet with objective function defined above. ...some code to create it... // Start thread, which serializes the instance and sends it via socket. ...some code... Question: On the Master, everything works fine. No exception. Slave receives data and tries to deserialize it. The following exception is thrown java.lang.ClassNotFoundException There is no error in DEParamSet class, because if I create it with optimization function = null, then Slave deserializes it with no problem. I tried to serialize instance into the file in the Master and then deserialize it as well. And it works. But Slave unable to deserialize instance, if it constains implementation of optimization function. Of course, slave contains definition of IOptimizationFunction interface. Please help. Edit I have the class TestingFunction. The class looks like this: public abstract class TestingFunctions { public static double schwefel(Object[] params) { double res = 0d; for (int i = 0; i &lt; params.length; i++) { res += (-1) * (double) params[i] * Mat…
has title: Serializing and deserializing interfaces in Java
score: 0
answer count: 1
tagged with: deserialization
has answer: http://stackoverflow.com/a/22578725
favorite count: 0
tagged with: serialization
accepted answer: http://stackoverflow.com/a/22578725
type: AnsweredQuestion
tagged with: java
upvote count: 1

http://stackoverflow.com/q/22633636
favorite count: 0
has answer: http://stackoverflow.com/a/22633738
tagged with: android
tagged with: sqlite
has title: Android application fetch data from SQLite
tagged with: smd
has body: I am new to android programming and i am trying to fetch data from SQLite and display it in list View. This is where i am getting and displaying data DataHandler handler=new DataHandler (getBaseContext()); handler.open(); Cursor c=handler.returnData_schedule(); List&lt;ScheduleData&gt; arr=new ArrayList&lt;ScheduleData&gt;(); if(c.moveToFirst()){ do{ String date=c.getString(0); String time=c.getString(1); String food=c.getString(2); ScheduleData myData=new ScheduleData(date,time,food); arr.add(myData); }while(c.moveToNext()); } ScheduleAdapter myadapter=new ScheduleAdapter(this,R.layout.schedule_list,arr); ListView listView=(ListView)findViewById(R.id.listView1); listView.setAdapter(myadapter); this is my fetch function. public Cursor returnData_schedule() { return db.query(TABLE_SCHEDULE,new String[] {date,time,food},null,null,null,null,null); } This is my adapter class public class ScheduleAdapter extends ArrayAdapter&lt;ScheduleData&gt; { Context myContext; int layout; List&lt;ScheduleData&gt; obj; public ScheduleAdapter(Context context, int resource,List&lt;ScheduleData&gt; arr) { super(context, resource, arr); myContext=context; layout=resource; obj=arr; } @Override public View getView(int position, View ConvertView,ViewGroup parent){ View row; if(ConvertView==null){ LayoutInflater inflater=((Activity) myContext).getLayoutInflater(); row=inflater.inflate(layout,parent,false); } else{ row=(View)ConvertView; } TextView dateText=(TextView)row.findViewById(R.id.textView1); TextView timeText=(TextView)row.findViewById(R.id.textView2); TextView foodText=(TextView)row.findViewById(R.id.textView3); dateText.setText(obj.get(position).getDate()); timeText.setText(obj.get(position).getTime()); foodText.setText(obj.get(position).getFood()); return row; } } This is the logcat 03-25 16:43:38.330: D/dalvikvm(1789): GC_FOR_ALLOC freed 93K, 6% free 3118K/3288K, paused 267ms, total 280ms 03-25 16:43:38.450: I/dalvikvm-heap(1789): Grow heap (frag case) to 3.723MB for 635812-byte …
has comment: http://stackoverflow.com/comment/34468862
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34469032
type: Question
accepted answer: http://stackoverflow.com/a/22633738
upvote count: 1
answer count: 1

http://stackoverflow.com/a/44538681
downvote count: 0
answers question: http://stackoverflow.com/q/22545507
upvote count: 2
has body: Some examples about Reaper. @Test public void testSomeNodes() throws Exception { Timing timing = new Timing(); ChildReaper reaper = null; CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1)); try { client.start(); Random r = new Random(); int nonEmptyNodes = 0; for ( int i = 0; i &lt; 10; ++i ) { client.create().creatingParentsIfNeeded().forPath("/test/" + Integer.toString(i)); if ( r.nextBoolean() ) { client.create().forPath("/test/" + Integer.toString(i) + "/foo"); ++nonEmptyNodes; } } reaper = new ChildReaper(client, "/test", Reaper.Mode.REAP_UNTIL_DELETE, 1); reaper.start(); timing.forWaiting().sleepABit(); Stat stat = client.checkExists().forPath("/test"); Assert.assertEquals(stat.getNumChildren(), nonEmptyNodes); } finally { CloseableUtils.closeQuietly(reaper); CloseableUtils.closeQuietly(client); } } Java Code Examples for org.apache.curator.framework.recipes.locks.Reaper
type: Answer
score: 2

http://stackoverflow.com/comment/34452944
type: AnswerComment
comment on: http://stackoverflow.com/a/22623476
score: 0
type: Comment
has text: @MadProgrammer I used the codes in the link you just gave me and it was pretty helpful but there is one last thing i need to know regarding with the codes provided in the link you gave me. Since i already have `grandTotal = totalWithTax + tipAmount;` I won't be needing the codes to total everything.

http://stackoverflow.com/a/22501433
upvote count: 2
has comment: http://stackoverflow.com/comment/34233890
has body: Use '+' operator and format it in eclipse.It will treat it as a single line.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34233984
downvote count: 0
answers question: http://stackoverflow.com/q/22501353

http://stackoverflow.com/q/22554845
tagged with: weblogic-10.x
has title: How to resolve User defined listener com.sun.faces.config.ConfigureListener failed: java.lang.NullPointerException?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24205198
tagged with: jsf
tagged with: java
type: Question
score: 0
has body: we have jsf1.2 application, ejb3.0 and weblogic10.0. I am trying to deploy the application in local weblogic server but getting following exception < User defined listener com.sun.faces.application.WebappLifecycleListener failed: c java.lang.NullPointerException. java.lang.NullPointerException at com.sun.faces.application.WebappLifecycleListener.contextDestroyed(WebappLifecycleListener.java:270) at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:459) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(Unknown Source) at weblogic.servlet.internal.EventsManager.notifyContextDestroyedEvent(EventsManager.java:187) Truncated. see log file for complete stacktrace > <Mar 21, 2014 2:19:09 PM IST> <Warning> <HTTP> <BEA-101162> <User defined listener com.sun.faces.config.ConfigureListener failed: java.lang.NullPointerException. java.lang.NullPointerException at com.sun.faces.application.ApplicationAssociate.getInstance(ApplicationAssociate.java:171) at com.sun.faces.application.WebappLifecycleListener.handleAttributeEvent(WebappLifecycleListener.java:221) at com.sun.faces.application.WebappLifecycleListener.attributeRemoved(WebappLifecycleListener.java:194) at weblogic.servlet.internal.EventsManager.notifyContextAttributeChange(EventsManager.java:222) at weblogic.servlet.internal.WebAppServletContext.removeAttribute(WebAppServletContext.java:523) Truncated. see log file for complete stacktrace > <Mar 21, 2014 2:19:09 PM IST> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application 'standardReportingEar'. weblogic.application.ModuleException: at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:975) at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:361) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204) at weblogic.application.utils.S…
answer count: 1

http://stackoverflow.com/comment/34399107
score: 0
comment on: http://stackoverflow.com/q/22594296
type: Comment
type: QuestionComment
has text: That sounds like a good idea. But how can I do that? I mean, I know how to make an array, but how am I going to handle the different location and size parameters of those textfields? Sorry if this is a stupid question, I am beginner with Java.

geolocation
tags question: http://stackoverflow.com/q/22518952
tags question: http://stackoverflow.com/q/22503112
tags question: http://stackoverflow.com/q/22511820
tags question: http://stackoverflow.com/q/22608769
type: Tag
tag name: geolocation

http://stackoverflow.com/q/22609487
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/34480857
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23608515
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34426173
has title: Java Scanline Polygon Fill Algorithm
has comment: http://stackoverflow.com/comment/34459761
score: 0
has body: I have just started learning computer Graphics and also new to JAVA. This my java applet which performs scan line algorithm it works well for certain cases. Can anyone help me out to know where am I actually wrong ? You can view entire code here = http://codeshare.io/9uVUf Thanks in advance.
answer count: 1

http://stackoverflow.com/comment/34492512
comment on: http://stackoverflow.com/q/22646612
score: 0
has text: Is all that code really necessary?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/46492692
answers question: http://stackoverflow.com/q/22519584
has body: This is my answer: package com.wang.libgdx.test.my; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.wang.libgdx.test.utils.GdxTest; public class TtfFontTest extends GdxTest{ SpriteBatch spriteBatch; BitmapFont font; @Override public void create() { spriteBatch = new SpriteBatch(); FreeTypeFontParameter parameter = new FreeTypeFontParameter(); parameter.characters=FreeTypeFontGenerator.DEFAULT_CHARS + "你好"; parameter.size = 24; FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("data/ui/fangzheng.ttf")); font = generator.generateFont(parameter); generator.dispose(); } @Override public void dispose() { spriteBatch.dispose(); font.dispose(); } @Override public void render() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); font.draw(spriteBatch, "helloworld", 300,300); font.draw(spriteBatch, "你好，世界！", 300,330); spriteBatch.end(); } } this is result of the program. enter image description here
score: 4
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/22508420
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22508508
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34245658
has title: Using Objects in Method
tagged with: java
has comment: http://stackoverflow.com/comment/34248848
has answer: http://stackoverflow.com/a/22509358
type: Question
tagged with: object
has body: I am trying to use a menu system that can delete a customer from my array myHotel[], this is built from an object. if(menu.charAt(0) == 'D')deleteCustomer(myHotel[]); ... public void deleteCustomer(String myHotel[]){ Scanner input = new Scanner(System.in); System.out.println("Please Enter Room Number to Delete Customer"); roomNum=input.nextInt(); myHotel[roomNum].setName("e"); } I get the errors, cannot find symbol? Here is the Full Code import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int roomNum=0; Room[] myHotel = new Room[10]; for (int x =0; x&lt;10; x++){ myHotel[x] = new Room(); } String roomName; String menu; do { System.out.println("Please Select an Option from the Menu:"); System.out.println("Enter V to View all Rooms"); System.out.println("Enter A to Add Customer to Room"); System.out.println("Enter D to Delete Customer from Room"); System.out.println("Enter Q to Quit"); menu=input.next(); //if(menu.charAt(0) == 'V')viewAllRooms(); //if(menu.charAt(0) == 'A')addCustomer(); if(menu.charAt(0) == 'D')deleteCustomer(myHotel[]); } while (menu.charAt(0) != 'Q'); while (roomNum &lt; 10) { for (int x = 0; x &lt; 10; x++ ) if (myHotel[x].getName().equals("e"))System.out.println("room " + x + " is empty"); System.out.println("Enter room number (0-9) or 10 to stop:"); roomNum = input.nextInt(); System.out.println("Enter name for room " + roomNum + " :"); roomName = input.next(); myHotel[roomNum].setName(roomName); for (int x = 0; x &lt; 10; x++) { //System.out.println("room " + x + " occupied by " + myHotel[x].mainName); System.out.println("room " + x + " occupied by " + myHotel[x].getName()); } } } public void deleteCustomer(String myHotelRef){ Scanner input = new Scanner(System.in); System.out.println("Please Enter Room Number to Delete Customer"); int deleteRoom=input.nextInt(); myHotelRef[deleteRoom].setName("e"); } }
has answer: http://stackoverflow.com/a/22508523

http://stackoverflow.com/comment/34365004
comment on: http://stackoverflow.com/a/22575112
type: AnswerComment
has text: but, if the private field live with in the Child object why can not directly access it with in child object ? what is the mechanism behind to restrict that ? thank you
type: Comment
score: 0

http://stackoverflow.com/comment/34220682
type: Comment
comment on: http://stackoverflow.com/a/22493332
type: AnswerComment
has text: if i remove the break an error message shows Exception in thread "main" java.util.NoSuchElementException
score: 0

http://stackoverflow.com/q/22497111
has comment: http://stackoverflow.com/comment/34230143
tagged with: android
linked to: http://stackoverflow.com/q/22215958
has body: I am new to android app developing, I am trying to run my android application in AVD available in eclipse but the thing is I'm unable to create a new AVD. (Previously a AVD was there in eclipse but it was not worked as fast, so i deleted that) Its possible to fill all the necessary fields given for creating a new AVD, finally when OK button is clicked there is no action performed in eclipse IDE. Can anyone know whats exactly blocking me from creating a new AVD. Here is my screenshot.
has comment: http://stackoverflow.com/comment/34227017
favorite count: 0
has comment: http://stackoverflow.com/comment/34226958
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34226991
linked to: http://stackoverflow.com/q/22190076
has title: Unable to create Android Virtual Device in eclipse, (Ok button is clicked but no action performed)
has answer: http://stackoverflow.com/a/26203308
score: 2
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/57917035

http://stackoverflow.com/comment/34298967
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22537891
score: 0
has text: And Dalvik is still not doing Java 7? That sounds fishy

http://stackoverflow.com/comment/34292532
type: Comment
has text: An opinion: is it more elegant, flexible and/or robust to implement it with an interceptor?
comment on: http://stackoverflow.com/a/22533527
type: AnswerComment
score: 0

http://stackoverflow.com/a/22493064
upvote count: 2
score: 2
has body: set replaces, add pushes everything after index back an index.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22493009
answers question: http://stackoverflow.com/q/22493009
has comment: http://stackoverflow.com/comment/34220277

http://stackoverflow.com/a/22512979
has comment: http://stackoverflow.com/comment/34254202
has body: public static void main(String[] args) throws ClassNotFoundException { String str[] ={ "123abass;[;[]","abcde","1234"}; for(String s : str) { if(s.matches("^[a-zA-Z]+$")) // should start and end with [a-zA-Z] System.out.println(s); } O/P : abcde
answers question: http://stackoverflow.com/q/22512865
score: 0
has comment: http://stackoverflow.com/comment/34254842
type: Answer

http://stackoverflow.com/q/22605949
accepted answer: http://stackoverflow.com/a/22608077
downvote count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/22608077
has title: What is the difference between createCompatibleImage with Transparency.OPAQUE and simple BufferedImage constructor with BufferedImage.TYPE_INT_ARGB?
answer count: 1
favorite count: 0
has body: What is the difference between version 1 and version 2? They seem to do the same in my situation, but I read everywhere version 1 is the better approach. But why? public BufferedImage getImage(Icon icon) { int w = icon.getIconWidth(); int h = icon.getIconHeight(); // version 1 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); BufferedImage image = gd.getDefaultConfiguration().createCompatibleImage(w, h, Transparency.OPAQUE); // version 2 // BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); Graphics2D g = image.createGraphics(); icon.get().paintIcon(null, g, 0, 0); g.dispose(); return image; }
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: image
type: Question

http://stackoverflow.com/comment/34217642
type: QuestionComment
comment on: http://stackoverflow.com/q/22489605
score: 0
type: Comment
has text: @AndreiVolgin yes i see Feedback. it is full of entities from a while ago, but not any new ones. I am using the same code i set the old ones with

http://stackoverflow.com/a/22524402
type: Answer
answers question: http://stackoverflow.com/q/22524193
has body: You are not using the right syntax. Try this: public double withdraw(double amount) throws Exception { if( this.numtransactions &lt;5){ if(this.balance &gt;= amount) { this.numtransactions++; this.balance -= amount; return this.balance; } } else { if(this.balance &gt;= (amount+1)) { //anount + 1 to account for deduction fee this.numtransactions++; this.balance -= (amount + 1); return this.balance; } return this.balance; //in case account does not have enough funds } Note: We only increment numtransactions if a withdrawal is successful. Hence, I have placed it inside the conditionals.
has comment: http://stackoverflow.com/comment/34274940
score: 0

http://stackoverflow.com/q/22504965
tagged with: scala
has title: Good naming convention for scala "pimpers"
has body: I don't like the fact that in scala its not obvious what some of my imports are doing - imports for implicits so i'm trying to come up with good naming conventions for them so when i see in my import statements something like: import com.mycomp.example.RectangleImplicits or import com.mycomp.example.RectanglePimper I know i cant remove that import because its being used for pimping. My problem with the above names is that sometimes I actually do an adapter, in that case import com.mycomp.example.RectangleAdapter does not say anyting about the fact that its actually a pimper however i don't want to name it RectangleAdapterPimp because the name becomes to combersome... is there a golden bullet naming convention for that? thanks
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34240877
type: Question
downvote count: 0
tagged with: adapter
has answer: http://stackoverflow.com/a/22505689
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22505689

http://stackoverflow.com/q/22521731
has answer: http://stackoverflow.com/a/22521826
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22521837
downvote count: 0
has comment: http://stackoverflow.com/comment/34270215
has comment: http://stackoverflow.com/comment/34270204
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22521837
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/22522004
has comment: http://stackoverflow.com/comment/34270160
has title: Complicated query in mysql database
answer count: 3
tagged with: sql
upvote count: 1
has body: I have two Tables: **user** idU - autoincrement name **automobile** idA - autoincrement id_user value date - type: yyyy-mm-dd Each user has many automobile A automobile has only one user Currently i am using the following query for all users(5 in total): select sum(value) as user_value, name from user inner join automobile on user.idU = automobile.id_user where name like ? AND date = ? what i want? I want the total value of all user in specific date using 1 query. how can i do this? @edit1: TABLE USER --idU------name---- 1 mateus 2 joao 3 maria TABLE AUTOMOBILE --idA---id_user----value-------date------ 1 1 250 2013-10-13 2 3 322 2013-10-13 3 1 150 2013-10-13 4 3 80 2013-10-13 5 2 100 2013-11-13 6 3 500 2013-11-13 7 1 1100 2013-11-13 8 1 50 2013-12-13 9 3 135 2013-12-13 10 2 40 2013-12-13 I request a query with date = 2013-10-13 and it return: ---name---value mateus 400 maria 422
favorite count: 0
accepted answer: http://stackoverflow.com/a/22521826

http://stackoverflow.com/comment/34366953
comment on: http://stackoverflow.com/q/22576668
has text: Please post the full stack trace of the error rather than a screen shot, it is illegible. Moreover, you never close your `RandomAccessFile`, that can't be helping. You should use a [try-with-resources](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) to manage closing.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34432202
type: Comment
comment on: http://stackoverflow.com/q/22612961
score: 0
type: QuestionComment
has text: and your logcat is...

http://stackoverflow.com/q/22542300
tagged with: runtime
has comment: http://stackoverflow.com/comment/34324998
tagged with: wmi
score: 0
has comment: http://stackoverflow.com/comment/34310499
answer count: 1
tagged with: exec
has answer: http://stackoverflow.com/a/49420038
type: UnansweredQuestion
has body: I am running the following using Apache exec lib. wmic LOGICALDISK GET Name,ProviderName /FORMAT This command returns a listing of all the mapped drives and their mapping. When I run it from the command line, it works great. When I run it from within java, it returns the first 2 drives and 1 of the drives listed in the middle. I've piped the stream to stdout, used stream gobbler, etc. I have several other commands I run that work fine and I read the streams without problem. I'm stumped. Any ideas? Encoding possibly? I've never had this problem before. Oh, I've also run with ProcessBuilder, Runtime.exec, and DefaultExecutor. Same results throughout. Thanks.
linked to: http://stackoverflow.com/q/5711084
tagged with: java
has title: Not getting complete output java exec
has comment: http://stackoverflow.com/comment/34340753
has comment: http://stackoverflow.com/comment/34306598
type: Question
has comment: http://stackoverflow.com/comment/34310574

http://stackoverflow.com/q/22539995
has comment: http://stackoverflow.com/comment/34302446
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34302343
has comment: http://stackoverflow.com/comment/34302426
has answer: http://stackoverflow.com/a/22540102
accepted answer: http://stackoverflow.com/a/22540102
tagged with: bit
has body: int g = 269; System.out.println( Integer.toBinaryString(g));//100001101 g&lt;&lt;=10; System.out.println( Integer.toBinaryString(g));//1000011010000000000 I know I can do it like this to add "0"'s after the number, but what if I want to add them before it? g&gt;&gt;=1; won't work, obviously.
has comment: http://stackoverflow.com/comment/34302395
type: AnsweredQuestion
tagged with: java
has title: How to add 0's in front of a binary number
type: Question

http://stackoverflow.com/q/22581626
has comment: http://stackoverflow.com/comment/34376109
type: Question
has comment: http://stackoverflow.com/comment/34376145
score: 0
answer count: 3
tagged with: swing
has body: Im wanting to link a button to another method in my java program. I have this code so far import java.awt.*; import javax.swing.*; public class Contacts extends JFrame { public static Contacts cont; public static JFrame canvas; public static void main(String[] args) { cont = new Contacts(); canvas = new JFrame("Contacts"); //canvas.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); canvas.show(); canvas.getContentPane().add(cont.viewOne()); canvas.pack(); } /** * T.B.C */ private JPanel viewAll() { int noOfContacts = 3; //3 will be replaced with number of tasks found in database JPanel viewAllPanel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); viewAllPanel.setPreferredSize(new Dimension(500,500)); viewAllPanel.setBackground(Color.white); //label for TITLE JLabel title = new JLabel("CONTACTS"); title.setForeground(Color.black); c.gridx = 0; c.gridy = 0; viewAllPanel.add(title,c); //button for add new contact JButton add = new JButton("ADD"); add.setForeground(Color.black); c.gridx = 1; c.gridy = 0; viewAllPanel.add(add, c); //buttons for all contacts for(int i = 0; i &lt; noOfContacts; i++){ JButton name = new JButton("CONTACT " + i); //name of contact will be gathered from database using get method name.setForeground(Color.black); c.gridwidth = 2; c.gridx = 0; c.gridy = i+1; viewAllPanel.add(name,c); } return viewAllPanel; } /** * T.B.C */ private JPanel viewOne() { int details=5; JPanel viewOnePanel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); viewOnePanel.setPreferredSize(new Dimension(500,500)); viewOnePanel.setBackground(Color.white); //button for back JButton back = new JButton("BACK"); back.setForeground(Color.black); c.gridx = 0; c.gridy = 0; viewOnePanel.add(back, c); //label for TITLE JLabel title = new JLabel("CONTACTS"); title.setForeground(Color.black); c.gridx = 1; c.gridy = 0; viewOnePanel.add(title,c); //button for edit new contact JButton edit = new JButton("EDIT"); edit.setFor…
has comment: http://stackoverflow.com/comment/34376038
tagged with: java
has answer: http://stackoverflow.com/a/22581719
has comment: http://stackoverflow.com/comment/34376092
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22581815
has comment: http://stackoverflow.com/comment/34376050
has title: Link a button to another method in Java
has answer: http://stackoverflow.com/a/22582130

http://stackoverflow.com/comment/34319487
type: AnswerComment
has text: btw, don't you consider development and production to be mutually exclusive? And once you enter production there is no way back to development? In that case changing the flag and recompiling wouldn't be the worst option.
score: 0
comment on: http://stackoverflow.com/a/22549263
type: Comment

http://stackoverflow.com/comment/34411345
type: QuestionComment
has text: What if the user wanted to enter 30th march and enters 30th feb instead?. Will you force him to change the date from 30th to something below 29?
comment on: http://stackoverflow.com/q/22601145
score: 0
type: Comment

http://stackoverflow.com/comment/34452087
has text: com.sun.net.httpserver http://docs.oracle.com/javase/6/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/package-summary.html
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22623513
type: Comment

http://stackoverflow.com/comment/34337921
has text: I have heard of that lol. Actually it is for my 6-months internship in NFC Security on Android Device. Thus I know I will have to deal with unit testing unfortunately.
type: AnswerComment
comment on: http://stackoverflow.com/a/22559498
type: Comment
score: 0

http://stackoverflow.com/comment/34231074
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22499516
has text: I think it would not work as HTTP Status 500 - No modifications are allowed to a locked ParameterMap

http://stackoverflow.com/comment/34404672
score: 0
comment on: http://stackoverflow.com/q/22597421
type: Comment
type: QuestionComment
has text: I just learned now netbeans can be used for Javascript too.. maybe i removed the wrong tag?

http://stackoverflow.com/a/22638473
downvote count: 0
has body: You cannot modify your immutable primitive boolean (or even a Boolean wrapper) in a called method, changes to the reference will not be preserved outside of the method. Instead, you have two choices - Store the state in an object field, and provide an accessor for that field (e.g. a getter), Return boolean (or Boolean) from that method (instead of `void`).
type: Answer
answers question: http://stackoverflow.com/q/22638381
score: 6
upvote count: 6

http://stackoverflow.com/a/22584055
score: 0
has body: MyComputer >> System Properties >>Advanced System Settings >> Environment Variables under that add PATH - c:/blah/java/jdk1.6/bin; //add your bin you have shown above and CLASSPATH - .; // dont miss tht semicolons at the end . thats all i did . in Win 8
has comment: http://stackoverflow.com/comment/34418640
type: Answer
answers question: http://stackoverflow.com/q/22583785

http://stackoverflow.com/comment/34381527
comment on: http://stackoverflow.com/q/22584388
type: QuestionComment
has text: //BinarySearchDictionary is my class name // from a class that implements the Comparable interface. public class BinarySearchTreeDictionary<K extends Comparable<K>,V> implements Iterable<BinarySearchTreeDictionary.BSTNode<K, V>> {
score: 0
type: Comment

http://stackoverflow.com/q/22553747
tagged with: .net
accepted answer: http://stackoverflow.com/a/22553800
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34326108
type: Question
has comment: http://stackoverflow.com/comment/34326171
tagged with: interface
has comment: http://stackoverflow.com/comment/34326071
has answer: http://stackoverflow.com/a/22553800
has comment: http://stackoverflow.com/comment/34326296
has comment: http://stackoverflow.com/comment/34326202
score: 0
tagged with: java
answer count: 1
has body: In an environment with both .Net and Java code, it seems that one way to consolidate the two is to use (or at least look at) common interface files in order to share a high level understanding of the business logic in an organization. Java and .Net are different from a technical perspective, but by sharing interfaces they can focus on common business logic, while leveraging the advantages of OOP. Is it common in any sense for an organization to implement an architecture based on having interfaces that are applied to both .Net and Java code and would it be possible to create (or does one exist) a syntax converter for interface code, so they can be easily shared by both frameworks? Or are these two frameworks so completely different that it would be counterproductive to share interfaces?
has title: Are .Net and Java interfaces similar enough to consolidate somehow?

http://stackoverflow.com/comment/34380237
comment on: http://stackoverflow.com/q/22583308
has text: I have a list of the objects but it doesn't show me a source, like what's causing the problem or where they are being created
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22589087
type: UnansweredQuestion
has body: I have been exploring MySQL JDBC driver and understand that it is able to do load balancing with this url ("jdbc:mysql:loadbalance://"). I looked into the documentation and it seems that only random and best response time methods are used for load balancing (link: http://dev.mysql.com/doc/refman/5.0/es/connector-j-reference-configuration-properties.html syntax is loadBalanceStrategy). Questions Is there a way to configure roundrobin as the load balancing strategy for the JDBC driver? I understand that other load balancing methods may be better but I am trying to use the round-robin method for my experiments. Is it a good idea to implement load balancing (I am open to whichever load balancing strategy) for MySQL ndb cluster (Multimaster with synchronous replication)? By the way, I have only 2 machines acting as masters and both are able to receive writes and reads. Although MySQL mentioned the use of the JDBC driver with ndb cluster (refer to quote 1 below), I was wondering if using load balancing for a multimaster ndb cluster would actually worsen the performance (refer to quote 2)? Quoted from https://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-basics.html - "MySQL clients using a MySQL Cluster as a data source can be modified to take advantage of the ability to connect with multiple MySQL servers to achieve load balancing and failover. For example, Java clients using Connector/J 5.0.6 and later can use jdbc:mysql:loadbalance:// URLs (improved in Connector/J 5.1.7) to achieve load balancing transparently; for more information about using Connector/J with MySQL Cluster, see Using Connector/J with MySQL Cluster." Quoted from https://dba.stackexchange.com/questions/11789/load-balanced-mysql-cluster-without-load-balancer - "replication delay on production servers might be up to a full second - I have tested this in a remote colocation and in our datacenter and for like 99% of the time it's 0, but sometimes mysql shows 1s. On massive traffic I had many collisions due …
tagged with: jdbc
favorite count: 0
type: Question
has title: Load balancing via MySQL JDBC driver (Connector/J)
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22589359
tagged with: mysql-cluster
has comment: http://stackoverflow.com/comment/34391544
upvote count: 3
tagged with: java
tagged with: mysql-connector
score: 2
tagged with: load-balancing

http://stackoverflow.com/comment/34332581
type: Comment
type: QuestionComment
has text: java -cp /usr/home/Dir1/2014Dir MAINCLASSNAME
comment on: http://stackoverflow.com/q/22557546
score: 0

http://stackoverflow.com/comment/34513649
score: 0
has text: @Alex Poole I am not really sure, but it never prompted me to enter anything, I deleted ibm, set java_home to java 7 and also set sqldeveloper.conf to java7 and it worked
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22541060

http://stackoverflow.com/comment/34287776
has text: Make sure that your interceptor is in `interceptor` package and it is compiled and deployed to server correctly. Check logs for errors.
comment on: http://stackoverflow.com/q/22525398
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22631110
has comment: http://stackoverflow.com/comment/34509447
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34544988
answers question: http://stackoverflow.com/q/22631015
type: Answer
score: 2
has body: change this part of code public String getRadio() { if(rdValue == null || rdValue.trim().isEmpty()) { return "YOUR_DEFAULT_VALUE"; } return rdValue; }
accepted answer of: http://stackoverflow.com/q/22631015
upvote count: 2
has comment: http://stackoverflow.com/comment/34498845
has comment: http://stackoverflow.com/comment/34497895
has comment: http://stackoverflow.com/comment/34553016

http://stackoverflow.com/a/22596651
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/34445533
upvote count: 1
has body: Asides from the previous answers, a common design for UI is one of model-view-controller (MVC). Some UML tools actually have stereotypes to help you with representing these elements. The model is the data that you want to show, the view is how it is displayed, and the controller links the two, taking the input to the UI and processing it to change the display with the new data from the model. It is also easy and useful to create sequence diagrams for a MVC system to show the actions and their effects.
has comment: http://stackoverflow.com/comment/34441659
answers question: http://stackoverflow.com/q/22573599

http://stackoverflow.com/a/22579838
answers question: http://stackoverflow.com/q/22579661
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22579661
score: 1
has comment: http://stackoverflow.com/comment/34396025
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: According to the answer at Does dx conversion to dex include verification of original class files?, some but not much optimization takes place, but I agree with the recommendation to check out the dx source for more information about the actual conversion. If you find the conversion is mostly one-to-one, then your current strategy of counting Java bytecode instructions may give a decent estimate of Dalvik instruction count, but keep in mind there are many other factors beyond simply instruction count that affect performance (including, but definitely not limited to, values determined at run-time e.g. user input, cache performance, instruction execution time, pipeline characteristics, use of non-CPU resources, etc.) and this won't really give you a reasonable estimate of how "resource intensive" the code is (consider the simple example of a tight infinite while loop vs. a higher-instruction-count loop that contains a 1 second sleep on each iteration).

http://stackoverflow.com/comment/34359121
has text: @NiklasB., I'll definitely give it to you that saying it was the "fastest sort" was incorrect. I recently read an article about it and it performed better in many circumstances than quicksort or mergesort thus, "fastest" seemed inapproriately appropriate. I believe that you probably have a better understanding of the topic of asymptotic complexities than myself but I know that my comments would make sense to any non-PhD software engineer and are correct according to what Java's docs say.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22571611

http://stackoverflow.com/comment/34269901
type: AnswerComment
has text: you use the Scanner class or an input stream linking it to System.in()
comment on: http://stackoverflow.com/a/22521555
type: Comment
score: 0

http://stackoverflow.com/q/22635945
favorite count: 0
has title: Adding up BigDecimals using Streams
answer count: 5
has answer: http://stackoverflow.com/a/22636538
tagged with: java-8
score: 234
possible better answer: http://stackoverflow.com/a/50582089
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/128642401
tagged with: java-stream
has answer: http://stackoverflow.com/a/41083704
tagged with: java
accepted answer: http://stackoverflow.com/a/22636014
upvote count: 235
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22636014
tagged with: bigdecimal
has answer: http://stackoverflow.com/a/50070727
has answer: http://stackoverflow.com/a/50582089
has body: I have a collection of BigDecimals (in this example, a LinkedList) that I would like to add together. Is it possible to use streams to calculate their sum? I noticed the Stream class has several methods Stream::mapToInt Stream::mapToDouble Stream::mapToLong Each of which has a convenient sum() method. But, as we know, float and double floating-point types make trade-offs in accuracy for speed. So, is there a convenient way to sum up BigDecimals? This is the code I have so far. public static void main(String[] args) { LinkedList<BigDecimal> values = new LinkedList<>(); values.add(BigDecimal.valueOf(.1)); values.add(BigDecimal.valueOf(1.1)); values.add(BigDecimal.valueOf(2.1)); values.add(BigDecimal.valueOf(.1)); // Classical Java approach BigDecimal sum = BigDecimal.ZERO; for(BigDecimal value : values) { System.out.println(value); sum = sum.add(value); } System.out.println("Sum = " + sum); // Java 8 approach values.forEach((value) -> System.out.println(value)); System.out.println("Sum = " + values.stream().mapToDouble(BigDecimal::doubleValue).sum()); System.out.println(values.stream().mapToDouble(BigDecimal::doubleValue).summaryStatistics().toString()); } As you can see, I am summing up the BigDecimals using BigDecimal::doubleValue(), but this is (as expected) not precise. Post-answer edit for posterity: Both answers were extremely helpful. I wanted to add a little: my real-life scenario does not involve a collection of raw BigDecimals, they are wrapped in an invoice. But, I was able to modify Aman Agnihotri's answer to account for this by using the map() function for stream: public static void main(String[] args) { LinkedList<Invoice> invoices = new LinkedList<>(); invoices.add(new Invoice("C1", "I-001", BigDecimal.valueOf(.1), BigDecimal.valueOf(10))); invoices.add(new Invoice("C2", "I-002", BigDecimal.valueOf(.7), BigDecimal.valueOf(13))); invoices.add(new Invoice("C3", "I-003", BigDecimal.valueOf(2.3), BigDecimal.valueOf(8))); invoices.add(new Invoice("C4", "I-00…

http://stackoverflow.com/a/22689846
accepted answer of: http://stackoverflow.com/q/22518594
answers question: http://stackoverflow.com/q/22518594
score: 0
type: AcceptedAnswer
has body: After discussing this idea with a few people, it seems that what i want is not possible. The way of input is too simple to allow something like this. My only possible solutions involve not running this from my IDE. I can either elect to use my application, or change the application into a GUI based applet. Running from the console will open up the "Press up" option, as suggested by rchirino, and using a GUI would let the value entered sit there for editing later. If anyone is looking to do what i posted above, the answer is "Java cant do it!". Sorry. :)
type: Answer

http://stackoverflow.com/q/22524728
has title: App Crash SildingMenu On Many Clicks
has comment: http://stackoverflow.com/comment/34275274
answer count: 1
downvote count: 0
has body: Basically using this library sliding menu jfeinstein_slidingMenu and on a button click posted this code : SlidingMenu menu = new SlidingMenu(this); menu.setMode(SlidingMenu.RIGHT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE); menu.setShadowWidthRes(R.dimen.shadow_width); menu.setShadowDrawable(R.drawable.shadow); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); menu.setFadeDegree(0.35f); menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW); View imgPanView = getLayoutInflater().inflate(R.layout.dropdown, null); menu.setMenu(imgPanView); menu.showMenu(true); This is working fine code but on many times u click on and off slidemenu then it make app crash with following logcat . Instead i thought i using nested view inflating layout so when i tried single image in layout as well it is crashing on many clicks so not the issue of nested views but somehow different one may be !!! Logcat E/.UnCaughtException(23025): Phone Model: HTC One X E/.UnCaughtException(23025): Android Version: 4.2.2 E/.UnCaughtException(23025): Board: unknown E/.UnCaughtException(23025): Brand: htc E/.UnCaughtException(23025): Device: endeavoru E/.UnCaughtException(23025): Host: abm035 E/.UnCaughtException(23025): ID: JDQ39 E/.UnCaughtException(23025): Model: HTC One X E/.UnCaughtException(23025): Product: htc_asia_india E/.UnCaughtException(23025): Type: user E/.UnCaughtException(23025): Total Internal memory: 2266497024 E/.UnCaughtException(23025): Available Internal memory: 283291648 E/.UnCaughtException(23025): Stack: E/.UnCaughtException(23025): java.lang.StackOverflowError E/.UnCaughtException(23025): at android.text.Layout.draw(Layout.java:205) E/.UnCaughtException(23025): at android.text.BoringLayout.draw(BoringLayout.java:400) E/.UnCaughtException(23025): at android.widget.TextView.onDraw(TextView.java:5272) E/.UnCaughtException(23025): at android.view.View.draw(View.java:13877) E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761) E/.UnCaughtException(23025):…
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
tagged with: view
has answer: http://stackoverflow.com/a/22524778
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9946368
tagged with: crash
tagged with: slidingmenu

http://stackoverflow.com/a/22634690
has comment: http://stackoverflow.com/comment/34471100
has comment: http://stackoverflow.com/comment/34471018
has comment: http://stackoverflow.com/comment/34470899
has comment: http://stackoverflow.com/comment/34470832
score: 0
has comment: http://stackoverflow.com/comment/34471084
has body: Try this... public void createDirectory(String sDirectoryName) { File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), sDirectoryName); if (!file.exists()) { file.mkdirs(); } }
type: Answer
has comment: http://stackoverflow.com/comment/34471206
answers question: http://stackoverflow.com/q/22634567

http://stackoverflow.com/comment/34436919
type: AnswerComment
comment on: http://stackoverflow.com/a/22613598
type: Comment
has text: That makes alot of sense. I didn't think about it like that. Thank you so much!
score: 0

http://stackoverflow.com/comment/34468571
type: Comment
type: QuestionComment
has text: there is not need to create a thread inside an AsyncTask. The doInBackground method does everything asynchronously.
comment on: http://stackoverflow.com/q/22633470
score: 1

http://stackoverflow.com/a/22562657
type: Answer
has comment: http://stackoverflow.com/comment/34343049
has comment: http://stackoverflow.com/comment/34343705
upvote count: 1
has comment: http://stackoverflow.com/comment/34344153
score: 1
accepted answer of: http://stackoverflow.com/q/22562227
has body: You need an instance of WorkerClass first Workerclass worker = new WorkerClass(); WorkerClass.ExampleSwingWorker1 trying = worker.new ExampleSwingWorker1(); trying.execute(); Read more: Inner classes|Nested classes Note: If it doesn't use WorkerClass instance method's think it to make it static then you don't need an instance of WorkerClass to create a ExampleSwingWorker1 instance. Note2: It's recommended that you add @Override annotation. Reasons? Read here
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34342837
answers question: http://stackoverflow.com/q/22562227

http://stackoverflow.com/comment/34438046
comment on: http://stackoverflow.com/a/22615889
type: Comment
has text: hey chris this seems like exactly what i'm looking for but i'm getting an error with the line JSONObject data = results1.get(i); I'm quite new to JSON hence why I changed the responsebody to a string straight away
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34411790
comment on: http://stackoverflow.com/q/22601098
score: 0
type: Comment
type: QuestionComment
has text: In draw(), it looks like you're calling a function ellipse(). Is that defined for you? Where does it come from? Then there is a variable called ellipse, in the if statement. Where is that declared?

http://stackoverflow.com/a/22612857
downvote count: 0
type: Answer
has body: Implementing a MessageBodyReader/Writer would be what you need to do in order to do the following: @GET @Path("details/") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) public List&lt;Machine&gt; details() { return manager.details(); } It's not very much code to write, and if you are able to write it generic enough you will be able to get some re-use out of it.
answers question: http://stackoverflow.com/q/22611105
has comment: http://stackoverflow.com/comment/34436654
accepted answer of: http://stackoverflow.com/q/22611105
has comment: http://stackoverflow.com/comment/34436788
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/34432456
type: AcceptedAnswer

http://stackoverflow.com/comment/34390299
comment on: http://stackoverflow.com/q/22589350
has text: `int` added to a `null` `Integer` => NPE (as already stated below)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22719644
type: Answer
accepted answer of: http://stackoverflow.com/q/22493702
has body: There were two main questions that I was asking. First, why are types different, and second, how do I make them play nicely with each other. I managed to solve both. First, the types were different because of one line that was missing in the header file included by the .i files. Putting "using namespace std;" in all of the included .hh files allowed the following block to work. namespace std { %template(vector_complex_float) vector&lt;complex&lt;float&gt; &gt;; } The second part of the question was answered above, although I used a slightly different method. I created one .i file that included all of the packages that I was interested in. That resulted in the following code: /* turn this module into java using SWIG */ %module er_java %{ #include &lt;vector&gt; #include &lt;complex&gt; #include "read_data.hh" #include "do_something_with_data.hh" %} /* Let's just grab the original header file here */ %include "std_vector.i" %include "std_string.i" namespace std { %template(vector_complex_float) vector&lt;complex&lt;float&gt; &gt;; %template(vector_float) vector&lt;float&gt;; } /* boilerplate code */ %pragma(java) jniclasscode=%{ static { try { java.lang.System.loadLibrary("read_data"); java.lang.System.loadLibrary("do_something_with_data"); } catch (UnsatisfiedLinkError e) { java.lang.System.err.println("Native code library failed to import"); java.lang.System.exit(1); } } %} %include "read_data/read_data.hh" %include "do_something_with_data/do_something_with_data.hh" and built everything with the following line swig -c++ -java -package er_java -outdir src/er_java -o jni/project/er_java_wrap.cc jni/swig_libs.i Just don't forget to compile the resulting wrap.cc file in your project's Android.mk
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22493702

http://stackoverflow.com/comment/80329231
type: Comment
comment on: http://stackoverflow.com/a/22508483
type: AnswerComment
has text: my problem was with java version. I had 1.8.101 and had to update to 1.8.144, then maven could recognize sources files at src/main/java
score: 0

http://stackoverflow.com/q/22550223
has body: I am trying to run this program. After the user inputs the values, the program will output the values. my question is that the program is supposed to ask the user to enter any number to run the program again or -1 to quit, but I couldn't figure where to place the while loop in the code. I need to know where to place the while loop exactly. Should it be at the beginning of the java code or at the end. The code is below. import java.util.Scanner; public class Program4 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System. in ); //Declare variables double numb; double absolute, meanNum = 0, medianNum = 0; double num1, num2, num3; double m; double me; double ab; System.out.println("Enter a number"); //prompting the user to enter information numb = input.nextDouble(); while (numb != -1) { ab = absolute(numb); System.out.printf("The absolute number is %f\n", ab); //prompting the user to enter information System.out.println("Enter three numbers"); //prompting the user to enter information num1 = input.nextDouble(); num2 = input.nextDouble(); num3 = input.nextDouble(); m = meanNum(num1, num2, num3); // Calling the method Mean Number System.out.printf("The Mean Number is: %f\n", m); me = medianNum(num1, num2, num3); // Calling the method Median Number System.out.printf("The median Number is %f\n", me); } } //// Creating another method for finding Mean Number public static double meanNum(double num1, double num2, double num3) { double meanNumb = 0; meanNumb = (num1 + num2 + num3) / 3; // Calculating the mean number by summing the numbers entered divided by three return (meanNumb); } // Creating another method for finding Median Number public static double medianNum(double num1, double num2, double num3) { //Using the IF Statement to find the median value of three numbers entered double medianNum = 0; if (num1 &lt; (num3) &amp;&amp; (num1 &gt; num2)) medianNum = num1; if ((num2 &lt; num1) &amp;&amp; (num2 &gt; num3)) m…
possible better answer: http://stackoverflow.com/a/22550260
has answer: http://stackoverflow.com/a/22550263
tagged with: while-loop
upvote count: 1
accepted answer: http://stackoverflow.com/a/22550246
favorite count: 0
has answer: http://stackoverflow.com/a/22550269
has title: Asking the user to run the program again using a simple while loop
has answer: http://stackoverflow.com/a/22550246
answer count: 4
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22550260
tagged with: loops
type: Question

http://stackoverflow.com/a/22609115
has comment: http://stackoverflow.com/comment/34425677
type: Answer
has comment: http://stackoverflow.com/comment/34425487
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22608634
has body: You may try something like this (which is just an example, outline how it could look like): Session session = HibernateUtil.getSessionFactory().openSession(); Criteria criteria = session.createCriteria(Employee.class); if (userChoice.femalesOnly()) { criteria.add(Restrictions.eq("gender", Gender.FEMALE)); } List&lt;Employee&gt; employees = criteria.list(); Here you create a criteria first, which has no restrictions. This means all records will be fetched. Then you check the user data, and dependent on the information given, augment the criteria. And last, call list() to fetch the result.
downvote count: 0

http://stackoverflow.com/a/22633908
answers question: http://stackoverflow.com/q/22633538
type: Answer
score: 0
has body: You have two methods home(String) and external_page(String) in HomeController mapped to the same url http://localhost:8080/Woodcutter/. You can map only one method mapped to a particular URL with HTTP method (GET / POST), That's the ambiguity. Please change the URL for one of the method or remove one. How can a request be delegated to two methods matching the URL and HTTP method? Think.

http://stackoverflow.com/comment/34402917
comment on: http://stackoverflow.com/q/22586233
score: 0
has text: Please provide some example queries, such as `year:1983`, including examples of year ranges and combinations of attributes (such as year+artist name, or whatever).
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/60354619
has text: Hey, do you have specs about this DLL? I need some help with a .NET project. Thanks in advance.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22647905

http://stackoverflow.com/q/22514778
has answer: http://stackoverflow.com/a/22514958
tagged with: swing
has comment: http://stackoverflow.com/comment/34257457
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22514958
downvote count: 0
has body: I'm trying to see if my window listener is working. I was hoping to print out a message in the console before I call dispose in the windowClosed method but it doesn't print anything. I'm not really sure if I'm doing something wrong - is there a way to check? public class MyClass extends JFrame { . . . this.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { System.out.println("I'm in the listener"); dispose(); } }); . . . }
tagged with: window
has answer: http://stackoverflow.com/a/22515184
favorite count: 0
tagged with: listener
possible better answer: http://stackoverflow.com/a/22515184
has title: Checking if my window listener is working

http://stackoverflow.com/comment/34431657
score: 1
type: QuestionComment
has text: In fact we have used Hibernate to deal with 40 M records. But we don't load 40 M at once, its all lazy loaded when needed. Also check this http://stackoverflow.com/questions/3827081/loading-million-rows-in-hibernate
type: Comment
comment on: http://stackoverflow.com/q/22612320

http://stackoverflow.com/a/22611537
type: Answer
has body: Try This : Run This example import javax.swing.*; import java.lang.*; class TestThread extends JFrame implements Runnable{ JLabel RectangleLabel,locationLabel; int x,y=0; TestThread() { setVisible(true); setLayout(null); RectangleLabel=new JLabel("Rectangle"); RectangleLabel.setBounds(10,10,100,100); locationLabel=new JLabel(); locationLabel.setBounds(200,200,100,100); add(RectangleLabel); add(locationLabel); setSize(1000,1000); Thread t=new Thread(this); t.run(); } public void run() { while (y &lt; 450) { RectangleLabel.setLocation(x, y); //reset location of the rectangle y += 10; locationLabel.setText(""+y); try { Thread.sleep(100); } catch (InterruptedException e) { } if(y==440) { y=0; } } } public static void main(String args[]) { TestThread t=new TestThread(); } }
answers question: http://stackoverflow.com/q/22611414
has comment: http://stackoverflow.com/comment/34429785
score: 0

http://stackoverflow.com/q/22641777
has answer: http://stackoverflow.com/a/22642729
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34499231
tagged with: android
has comment: http://stackoverflow.com/comment/34483994
score: 0
tagged with: java
has title: Android: String that should be empty has strange content
upvote count: 1
answer count: 1
downvote count: 1
has body: I have a very strange bug here. I set a string empty: String s = ""; But sometimes when I later use it, it contains: "java.util.concurrent.locks.ReentrantLock$NonfairSync@2105f068[State = 0, empty queue]" This happens in a background thread. Any ideas how this is possible? Update: I was asked to provide more code. The full code would be too much, but here is more information: The problem occurs in a background task started with AsyncTask. I am doing nothing more than this: String s = ""; String t = ""; ... ... Here happens some other stuff, that does not use s or t ... s += "x"; t += "y" + s + "z"; Log.d("TEST", t); Output most of the time: "yxz" Output sometimes: "yjava.util.concurrent.locks.ReentrantLock$NonfairSync@2105f068[State = 0, empty queue]xz" I am using Java version 7 update 51
type: UnansweredQuestion

http://stackoverflow.com/comment/34444352
comment on: http://stackoverflow.com/a/22617515
score: 0
type: Comment
has text: I've tried playing around with onCreateView(), but I just get an exception. I have run out of ideas. I do not understand how the onCreateOptionsMenu is called once, but the listView doesn't appear.
type: AnswerComment

http://stackoverflow.com/a/22568616
accepted answer of: http://stackoverflow.com/q/22568484
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22568484
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Something like this should work as the inner most loop boolean found = false; for(int i = 0; i &lt; students.size() &amp;&amp; !found; i++){ if(students.get(i).askName().equals(readContent[0])){ //something i do when Student exists found = true; } } if(!found){ Student student = new Student(readContent[0],adress.toString()); for(int i = 1; i &lt; readContent.length; i++){ student.addGrade(readContent[i]); } students.add(student); }

http://stackoverflow.com/comment/34478924
type: Comment
has text: actually, there isn't much of a difference - except that the button get's "unpressed" before blocking the ui ;-) Repeating: whatever you do in invokeLater will happen **on** the EDT, and that's **not** the thread for doing heavy lifting.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22631539

http://stackoverflow.com/comment/34407868
type: Comment
type: QuestionComment
has text: Where should I put the file so that it can be accessed?
score: 0
comment on: http://stackoverflow.com/q/22598424

xml-parsing
tags question: http://stackoverflow.com/q/22595804
tags question: http://stackoverflow.com/q/22497563
tags question: http://stackoverflow.com/q/22630810
tag name: xml-parsing
tags question: http://stackoverflow.com/q/22631474
type: Tag
tags question: http://stackoverflow.com/q/22512746
tags question: http://stackoverflow.com/q/22581810
tags question: http://stackoverflow.com/q/22647709

http://stackoverflow.com/comment/34407283
type: Comment
comment on: http://stackoverflow.com/a/22598531
score: 0
type: AnswerComment
has text: Updated my original answer.

http://stackoverflow.com/comment/34473244
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22631242
has text: I did as you suggested. But the Annotation is still not be printed
score: 0

http://stackoverflow.com/comment/34290156
type: QuestionComment
type: Comment
has text: @Rat-a-tat-a-tatRatatouille You should take a look at [this](http://stackoverflow.com/questions/40480/is-java-pass-by-reference).
score: 0
comment on: http://stackoverflow.com/q/22532882

http://stackoverflow.com/comment/34460869
type: Comment
comment on: http://stackoverflow.com/q/22628246
type: QuestionComment
has text: You don't use JNI here. This is just one C function calling another. If you use JNI, e.g. calling a C function from Java, you need a method declaration on the Java side and an appropriate implementation on the C side.
score: 0

http://stackoverflow.com/comment/34353621
has text: @Pedantic Edited the question to include more details.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22568898
type: QuestionComment

http://stackoverflow.com/a/38291448
type: Answer
score: 11
downvote count: 0
answers question: http://stackoverflow.com/q/22489398
upvote count: 11
has body: I solved my problem by removing old versions of JRE and installing JRE 8.

http://stackoverflow.com/comment/34312552
score: 0
type: Comment
type: QuestionComment
has text: So what's your actual issue? You want to resize the JFrame with the panel automatically?
comment on: http://stackoverflow.com/q/22545566

m2e
type: Tag
tags question: http://stackoverflow.com/q/22640406
tag name: m2e

http://stackoverflow.com/comment/34687688
type: Comment
comment on: http://stackoverflow.com/a/22642624
score: 0
type: AnswerComment
has text: Thanks for your answer. Sure it is not the same, but JIRA is. On the other hand scm:svn:http://svn.company.com/phoenix/svn/phoenix/projects/feature/control-java7/trunk and JIRA are clearly not the same...

http://stackoverflow.com/comment/34389622
has text: I don't see how you could compile the above code. You'll have to have either Bar v1 or Bar v2 in the classpath, and one of the two calls will thus not compile.Unless you create your own Bar class containing both methods only for compilation.
comment on: http://stackoverflow.com/a/22588980
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/34247518
type: QuestionComment
comment on: http://stackoverflow.com/q/22504373
score: 0
has text: `priceList.get(string keyname)` in your example it will be `priceList.get("child");`
type: Comment

http://stackoverflow.com/comment/70434491
type: Comment
comment on: http://stackoverflow.com/a/41495881
has text: I still don't get what value this unneeded more explicit code should add to my question. Of course one can add the generic type from a static method explicitly, but this is not needed if the type is obvious from content. And the idea of the question is to not need this line at all, i.e. it is _not_ an answer to extend this line with unneeded syntax sugar.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22494315
has comment: http://stackoverflow.com/comment/34270168
has comment: http://stackoverflow.com/comment/34269373
upvote count: 2
type: Answer
has body: Don't use AsyncTask for this. You seem to want to hold your connection open for an extended period of time. AsyncTask is only supposed to be used for tasks that last at most a few seconds. You might consider using a Service instead.
accepted answer of: http://stackoverflow.com/q/22493701
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22493701

http://stackoverflow.com/comment/34468995
type: QuestionComment
score: 1
has text: Exceptions that propagate out of a `finalize` method are ignored. In essence the `finalize` method is run, and regardless of whether it ends "normally" or with an exception the object is marked for no further attempts at finalization. On the next GC cycle the finalizer is ignored and the object is collected, if it's no longer referenced. (The finalizer could have made it referenced again.)
comment on: http://stackoverflow.com/q/22632914
type: Comment

http://stackoverflow.com/q/22625363
type: UnansweredQuestion
upvote count: 1
has title: Reading input data using Scanner class
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22625412
has body: I have a doubt on reading input using scanner class. Usually it goes this way.If I use the print instead of println I can get the input in the same line public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter loan amount: "); double loanAmount = sc.nextDouble(); } } Now I want to extend the use of scanner in some other way but I am unable to do so. public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String input = ""; double val = 0.0; System.out.println(""Enter a command push n,add"); Calculator xyz = new Calculator(); while(true) { input = sc.next(); if(input.equals("push")+val) { val = sc.nextDouble(); xyz.push(val); abc.getValues(); } if(input.equals("add")) xyz.add(); } } } In the above I want to read the value in the same line after I type "push" Eg., When I run the above code I will get o/p as follows Enter a command push 4 4.0 But I want the o/p as: Enter a command push 4 4.0
has answer: http://stackoverflow.com/a/22625597
score: 1
favorite count: 0

http://stackoverflow.com/comment/34292279
type: QuestionComment
has text: But what about for game development where the key and mouse events are just constantly created. Wouldn't a object pool reduce the GC in java and javascript especially for devices like a android phone
score: 0
comment on: http://stackoverflow.com/q/22534294
type: Comment

io
tags question: http://stackoverflow.com/q/22492184
tags question: http://stackoverflow.com/q/22546742
tags question: http://stackoverflow.com/q/22549342
tag name: io
tags question: http://stackoverflow.com/q/22524780
tags question: http://stackoverflow.com/q/22617947
tags question: http://stackoverflow.com/q/22583672
tags question: http://stackoverflow.com/q/22596418
tags question: http://stackoverflow.com/q/22607163
tags question: http://stackoverflow.com/q/22630999
type: Tag
tags question: http://stackoverflow.com/q/22589528
tags question: http://stackoverflow.com/q/22490625
tags question: http://stackoverflow.com/q/22548977
tags question: http://stackoverflow.com/q/22528155
tags question: http://stackoverflow.com/q/22531383

http://stackoverflow.com/q/22645787
upvote count: 2
has title: Returning time in minutes
downvote count: 2
has answer: http://stackoverflow.com/a/22645963
has body: I am trying to find difference between 2 times in minutes with following code.not providing complete code: String dateStart = "03/25/2014 18:03:00"; String dateStop = "03/25/2014 19:45:00"; SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); Date d1 = null; Date d2 = null; d1 = format.parse(dateStart); d2 = format.parse(dateStop); long diff = endDate.getTime()-startDate.getTime(); long minutes = diff/(60*1000) % 60; not sure why it is returnung 14 minutes. instead 102 minutes. Regards, chaitu
has comment: http://stackoverflow.com/comment/34491561
answer count: 4
has comment: http://stackoverflow.com/comment/34491017
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34491190
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34491010
has comment: http://stackoverflow.com/comment/34491161
type: Question
linked to: http://stackoverflow.com/q/7501311
has answer: http://stackoverflow.com/a/22647361
has comment: http://stackoverflow.com/comment/34491124
linked to: http://stackoverflow.com/q/17940200
has answer: http://stackoverflow.com/a/22646058
accepted answer: http://stackoverflow.com/a/22645963
has answer: http://stackoverflow.com/a/22645958
has comment: http://stackoverflow.com/comment/34491254
possible better answer: http://stackoverflow.com/a/22647361
has comment: http://stackoverflow.com/comment/34491062
has comment: http://stackoverflow.com/comment/34491165
has comment: http://stackoverflow.com/comment/34491182
favorite count: 0
has comment: http://stackoverflow.com/comment/34491178
has comment: http://stackoverflow.com/comment/34491292

http://stackoverflow.com/q/22527080
tagged with: servlet-filters
has answer: http://stackoverflow.com/a/22527309
tagged with: java
tagged with: servlets
type: Question
has body: How to forward request from Filter to another URL and get the result back? I'm using Filter and HttpClient.execute() method to forward the request. Is that way is the right way? Here is the code: public void doFilter(ServletRequest req, ServletResponse response, FilterChain chain) ... HttpRequestBase method = null; URI uri = null; if (isPost) { method = new HttpPost(); } else { method = new HttpGet(); } uri = new URI(newUrl); Enumeration&lt;String&gt; headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String header = headerNames.nextElement(); method.setHeader(header, request.getHeader(header)); } method.setURI(uri); HttpResponse downstreamResponse = httpClient.execute(method); ByteArrayOutputStream baos = new ByteArrayOutputStream(2048); downstreamResponse.getEntity().writeTo(baos); OutputStream responseStream = response.getOutputStream(); responseStream.write(responseBytes);
score: 0
answer count: 1
tagged with: httpresponse
type: UnansweredQuestion
tagged with: http-redirect
has title: How to redirect to another host from Filter?

http://stackoverflow.com/q/22626933
type: Question
has body: I was just trying to create a html page to get a string and display it again in the same page. My index.html , Insert title here Create a Map When I point my browser to localhost:8080, I get these errors Firefox can't establish a connection to the server at ws://localhost:8080/eventbus/069/yp3vm_fs/websocket. that.ws = new Constructor(that.url); The connection to ws://localhost:8080/eventbus/069/yp3vm_fs/websocket was interrupted while the page was loading. that.ws = new Constructor(that.url); Both these errors occur in sockjs-0.3.js. My client.js: var eb = null; function openConn() { if (!eb) { eb = new vertx.EventBus("http://localhost:8080/eventbus"); } } $(document).ready(function() { openConn(); $('.create-form').submit(function() { var value = $("#name").val(); console.log('name = '+value); }); }); My java verticle , public class Mymap extends Verticle{ public void start() { final Logger logger = container.logger(); logger.info("Starting mymap"); JsonObject config = new JsonObject(); config.putNumber("port", 8080); config.putString("host", "localhost"); config.putBoolean("bridge", true); JsonArray inboundPermitted = new JsonArray(); JsonObject addrss1 = new JsonObject().putString("address", "saveMyMap"); inboundPermitted.add(addrss1); JsonObject addrss2 = new JsonObject().putString("address", "myMaps"); inboundPermitted.add(addrss2); JsonObject addrss3 = new JsonObject().putString("address", "delMyMap"); inboundPermitted.add(addrss3); config.putArray("inbound_permitted", inboundPermitted); container.deployModule("io.vertx~mod-web-server~2.0.0-final", config); HttpServer server = vertx.createHttpServer(); server.requestHandler(new Handler<HttpServerRequest>() { public void handle(HttpServerRequest request) { if (request.path().equals("/")) { request.response().sendFile("./web/index.html"); } if (request.path().endsWith("sockjs-0.3.js")) { request.response().sendFile("./web/js/sockjs-0.3.js"); } if (request.path().endsWith("vertxbus-2.1.js")) { request.response()…
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24649859
tagged with: vert.x
has title: Vertx Event bus bridge with 'io.vertx~mod-web-server~2.0.0', not getting the data
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/34264276
comment on: http://stackoverflow.com/q/22518369
has text: What's _after_ the code you show? A "normal" move? You realize it must be in an `else` block too, right?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34457301
comment on: http://stackoverflow.com/q/22626713
score: 0
type: Comment
type: QuestionComment
has text: Nope.. I don't think that would contribute to such a huge margin.

http://stackoverflow.com/q/22502130
score: 0
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23421029
type: AnsweredQuestion
tagged with: ntlm
has comment: http://stackoverflow.com/comment/35884160
has body: I'm trying to use wink-client v1.4 to communicate with a Sharepoint RESTful web service. I have created a simple Java SE Maven project that can do this task on Windows using a BasicAuthSecurityHandler. However, this same project doesn't work on Mac OS X. I receive a 401 HTTP status code on the Mac. Wink is somehow using my NTLM credentials when being run from Windows. I'm using JDK 7 for both platforms. How can I use NTLM authentication with Apache Wink client? public String getSharepointInfo() { spUser = "user"; spPassword = "password"; spUri = "https://someSharepointURL/"; ClientConfig clientConfig = new ClientConfig(); Application app = new Application() { public Set&lt;Class&lt;?&gt;&gt; getClasses() { Set&lt;Class&lt;?&gt;&gt; classes = new HashSet&lt;Class&lt;?&gt;&gt;(); classes.add(WinkMOXyJsonProvider.class); return classes; } }; clientConfig.applications(app); BasicAuthSecurityHandler basicAuthSecurityHandler = new BasicAuthSecurityHandler(); basicAuthSecurityHandler.setUserName(spUser); basicAuthSecurityHandler.setPassword(spPassword); clientConfig.handlers(basicAuthSecurityHandler); RestClient client = new RestClient(clientConfig); Resource resource = client.resource(spUri); ClientResponse response = resource.accept("*/*").get(); String blah = response.getEntity(String.class); System.out.println("The response is " + blah); return blah.toString(); }
tagged with: sharepoint
tagged with: apache-wink
type: Question
has title: How to use NTLM authentication with Apache Wink client
has answer: http://stackoverflow.com/a/23421029

http://stackoverflow.com/a/22550689
has comment: http://stackoverflow.com/comment/34321470
has comment: http://stackoverflow.com/comment/34321377
has comment: http://stackoverflow.com/comment/34321409
has comment: http://stackoverflow.com/comment/34321427
answers question: http://stackoverflow.com/q/22550537
type: Answer
has comment: http://stackoverflow.com/comment/34321565
score: 0
has body: you just replace the map fragment with the following code like that &lt;fragment android:id="@+id/map" class="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent"/&gt;

ieee-754
tags question: http://stackoverflow.com/q/22591003
type: Tag
tag name: ieee-754

http://stackoverflow.com/a/22585158
upvote count: 1
has body: I recommend you put Client myClient = new Client(s); clients.add(myClient); Thread t = new Thread(myClient);
has comment: http://stackoverflow.com/comment/34383193
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22585108
type: Answer

http://stackoverflow.com/comment/34476962
type: AnswerComment
has text: I have added a check if(entriesForTs != null) System.out.println("value"+entriesForTs.size()); But then the value is not printed. It is not entering inside the if condition.
type: Comment
comment on: http://stackoverflow.com/a/22637688
score: 0

http://stackoverflow.com/q/22527872
tagged with: dst
has body: If I take the time at the end of the autumn day light time shift (2014-10-26 02:00:00 CET in Denmark) and subtract one hour (so I would expect to go back to 02:00 CEST) and then set the minutes to zero, I get some strange results: Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("CET")); cal.set(Calendar.YEAR, 2014); cal.set(Calendar.MONTH, Calendar.OCTOBER); cal.set(Calendar.DAY_OF_MONTH, 26); cal.set(Calendar.HOUR_OF_DAY, 2); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); System.out.println(cal.getTimeInMillis()); // 1414285200000 : 01:00:00 UTC cal.add(Calendar.HOUR_OF_DAY, -1); System.out.println(cal.getTimeInMillis()); // 1414281600000 : 00:00:00 UTC (as expected) cal.set(Calendar.MINUTE, 0); // or: cal.set(Calendar.MINUTE, cal.get(Calendar.MINUTE)); // both should be NOPs. System.out.println(cal.getTimeInMillis()); // 1414285200000 : 01:00:00 UTC (Why?!) Is this a bug? I know that Java Calendar has some strange conventions, but I cannot see how this could be correct. What is the correct way to subtract an hour and set the minutes to 0 using the Calendar class?
has comment: http://stackoverflow.com/comment/34282059
accepted answer: http://stackoverflow.com/a/22613210
has title: GregorianCalendar DST problems
has comment: http://stackoverflow.com/comment/34426041
tagged with: calendar
type: AnsweredQuestion
tagged with: java
tagged with: gregorian-calendar
possible better answer: http://stackoverflow.com/a/22613197
score: 15
type: Question
has answer: http://stackoverflow.com/a/22613197
upvote count: 15
has answer: http://stackoverflow.com/a/22612500
downvote count: 0
has comment: http://stackoverflow.com/comment/34425215
favorite count: 0
has answer: http://stackoverflow.com/a/22613210
answer count: 3

http://stackoverflow.com/comment/34352082
score: 1
has text: Well, lets see.. We should let the OP decide. :)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22568312

http://stackoverflow.com/comment/35447168
has text: Funny Enough I implemented blocks and items before anything else, though I cannot say It is fully Implemented until I can physically hold the item.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22517023
type: Comment

http://stackoverflow.com/comment/34238189
type: QuestionComment
has text: **An `enum` should never be mutable.** You should never have a `setXXX` method on an `enum` and an `enum` should **never** have non-`final` variables. Having a mutable `enum` violates many of the guarantees provided by `enum`.
score: 4
comment on: http://stackoverflow.com/q/22504097
type: Comment

http://stackoverflow.com/comment/34430035
score: 0
type: Comment
type: QuestionComment
has text: You probably need to repaint the background other wise the previous position is still visible. Uncommenting the paintcomponent call may do it. Also I would move the reading of files and images out of your draw method. Read them in your init and store them.
comment on: http://stackoverflow.com/q/22611747

http://stackoverflow.com/q/22515540
tagged with: regex
has comment: http://stackoverflow.com/comment/34258936
has answer: http://stackoverflow.com/a/22516263
accepted answer: http://stackoverflow.com/a/22516263
type: AnsweredQuestion
has body: I am trying to extract numbers of length 3 to 5 from a long string of text. Let me explain Say there is a string like this 123456 and I want to extract all the number that are between length 3 and 5 output would be 123 234 345 456 1234 2345 3456 12345 23456 I can run multiple regex that individually find the lengths but there might be a better way to do that than what I am doing. import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexTestHarness { public static void main(String[] args) throws IOException { String data = "123456"; Matcher m = Pattern.compile("\\d{3}").matcher(data); // m = Pattern.compile("\\d{4}").matcher(data); // m = Pattern.compile("\\d{5}").matcher(data); int position = 0; while (m.find(position++)) { System.out.println(m.group()); } } } Premature Optimization Idea - I can match everything to 5 and then run smaller length matchers on the result of those. That way I cut down on reading the data over and over which in my case is an external source.
downvote count: 0
possible better answer: http://stackoverflow.com/a/22515872
has title: Regex extract numbers of all lengths
has comment: http://stackoverflow.com/comment/34259323
has comment: http://stackoverflow.com/comment/34259524
has answer: http://stackoverflow.com/a/22515921
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34259405
has comment: http://stackoverflow.com/comment/34258987
has answer: http://stackoverflow.com/a/22515872
upvote count: 1
has comment: http://stackoverflow.com/comment/34258856
has comment: http://stackoverflow.com/comment/34259101
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34258880
has comment: http://stackoverflow.com/comment/34258979

http://stackoverflow.com/comment/34258416
comment on: http://stackoverflow.com/q/22514965
type: Comment
has text: How can you say that `hoveredSeat` has not changed? You are not using the variable anywhere after changing! Also I could not find the declaration of `JButton[][] buttons;`
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35776759
comment on: http://stackoverflow.com/a/22581379
type: AnswerComment
score: 0
type: Comment
has text: @royB does that mean you're getting a different error now? If so, could you update the question to reflect this?

http://stackoverflow.com/comment/34453140
type: Comment
has text: Got it! Thanks. +1 for concise answer and thorough explanation.
comment on: http://stackoverflow.com/a/22624198
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34419190
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22605559
has text: yes. Since, It is generated by `Netbeans` so each entity class has `@Entity` annotations

http://stackoverflow.com/a/22609365
answers question: http://stackoverflow.com/q/22608835
downvote count: 0
has body: You can use exception mapping feature of Struts2 to map exception to specific result. In struts.xlm file put &lt;exception-mapping&gt; definition inside &lt;global-exception-mappings&gt; and create result, with defined name, global or in specific action(s). &lt;global-exception-mappings&gt; &lt;exception-mapping exception="java.lang.NullPointerException" result="npe"/&gt; &lt;/global-exception-mappings&gt; Note that your interceptor stack must include exception interceptor. Also it is recommended that exception interceptor would be the first interceptor on the stack, ensuring that it has full access to catch any exception, even those caused by other interceptors.
score: 1
has comment: http://stackoverflow.com/comment/34428205
has comment: http://stackoverflow.com/comment/34427349
has comment: http://stackoverflow.com/comment/34427167
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22608835
type: Answer

http://stackoverflow.com/a/22575041
score: -2
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22556701
has comment: http://stackoverflow.com/comment/34364527
upvote count: 0
has body: You are both partly correct, I forgot to export JDK_HOME :)

http://stackoverflow.com/comment/34488900
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22644537
type: AnswerComment
has text: @Recontroop: Right, it says "An actual parameter is a value and so it can be specified in an expression...". `x + 2` is an expression (which matches the formal parameter `int`).. `y - 3.5` is an expression (which matches the formal parameter `double`).. `S` is an actual parameter matching to the formal parameter `char`

http://stackoverflow.com/q/22562373
has title: GWT : how to compile multiple module result into single nocache.js file
score: 1
tagged with: java
answer count: 1
downvote count: 0
tagged with: gwt-compiler
has body: Let's say I have 2 module in my gwt project and it was structured like this src - main - java module1.gwt.xml module2.gwt.xml - client - module1 - stuff - module2 - stuff and on each module xml file &lt;module rename-to='module1'&gt; ... their own entry point and stuff.. &lt;/module&gt; &lt;module rename-to='module2'&gt; ... their own entry point and stuff.. &lt;/module&gt; So, from this, when compile, I'll get 2 nocache.js file which is "module1.nocache.js" and "module2.nocache.js". Which is perfectly works fine by including 2 of them into HTML page. My question are follow, is there any way I can compile multiple module and get a single nocache.js file which contains both modules inside ? Thanks ! :-D
favorite count: 0
has answer: http://stackoverflow.com/a/22562666
type: AnsweredQuestion
upvote count: 1
accepted answer: http://stackoverflow.com/a/22562666
type: Question
tagged with: gwt

http://stackoverflow.com/comment/34375405
has text: @JasonC "The return value may be null if the component is not displayable." I understand that, but why is img null? I don't know how to correct it.
score: 0
comment on: http://stackoverflow.com/q/22581201
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34424918
comment on: http://stackoverflow.com/q/22609012
type: QuestionComment
type: Comment
has text: You will need getters and or setters if you want to be able to access and or modify your variable from any place that is not inside your class code. If you are only going to be using the variable inside your class, you don't need them.
score: 0

http://stackoverflow.com/comment/34316220
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22547446
has text: and can maven/ant be used to create a more standardized installer rather than just downloading a jar file? I know in Ubuntu jar files normally open in the archive manager by default and I assume that there might be some similar issues with WIN/MAC. I'd love to be able to just export the project and make it as easily accessible to users as possible ...

http://stackoverflow.com/comment/34425487
comment on: http://stackoverflow.com/a/22609115
score: 0
type: AnswerComment
type: Comment
has text: How could it possible to pass the parameter for my example.

http://stackoverflow.com/q/22541986
has title: Is there a proper way to keep a dialog with a custom list of objects displayed after screen rotation in Android?
linked to: http://stackoverflow.com/q/12739909
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/22546857
tagged with: android-fragments
tagged with: dialog
score: 1
tagged with: java
type: Question
has body: I would like to ask a simple but misleading question according to my point of view. I have a dialog, or better, a custom dialog: public class MyCustomDialog extends Dialog { public MyCustomDialog(Context context, int layoutResourceId) { super(context); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(layoutResourceId); LayoutParams params = getWindow().getAttributes(); params.width = LayoutParams.MATCH_PARENT; getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); } } This dialog takes a layuoutResourceId (R.layout.some_custom_layout.xml) as argument when it is instantiated. I need to use this dialog to display a custom List of some Master and details data which is dinamically created. In order to do this kind of operation I am using a custom Adapter class , called MasterDetailArrayAdapter: public class MasterDetailArrayAdapter extends ArrayAdapter&lt;Item&gt; { private LayoutInflater mdInflater; public enum EntryType { DETAIL, MASTER } public MasterDetailArrayAdapter(Context context, List&lt;Item&gt; items) { super(context, 0, items); mdInflater = LayoutInflater.from(context); } @Override public int getViewTypeCount() { return EntryType.values().length; } @Override public int getItemViewType(int position) { return getItem(position).getViewType(); } @Override public View getView(int position, View convertView, ViewGroup parent) { return getItem(position).getView(mdInflater, convertView); } } This adapter extends an ArrayAdapter of Item, where Item is an interface I have created: public interface Item { public int getViewType(); public View getView(LayoutInflater inflater, View convertView); } So The MasterDetailArrayAdapter takes a List as parameter when it is constructed. The Item interface is implemented by a MasterWithValue class (or better by a Master class which MasterWithValue extends): public class MasterWithValue extends Master { private String value; private List&lt;Detail&gt; detailList; public MasterWithValue(String mast…

http://stackoverflow.com/q/22499779
upvote count: 1
has answer: http://stackoverflow.com/a/22499796
downvote count: 1
has body: I was working with web services and when i compile my util.Random was not found by the compiler why? This is my code fragment import javax.jws.WebService; import javax.jws.WebMethod; import java.util.Random.*; // annotation; a j2se 5 feature @WebService public class Card { Random r = new Random(); @WebMethod public int getCard(){ int random = new r.nextInt(10) + 1; return random; } }
type: Question
has comment: http://stackoverflow.com/comment/34231136
score: 0
answer count: 1
favorite count: 0
has title: util.Random symbol not found
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/34399748
has text: You said the class in question extends a class that extends a swing component. Do you need this? You can make a separate class without subclassing any swing component.
score: 0
comment on: http://stackoverflow.com/q/22594773
type: Comment
type: QuestionComment

http://stackoverflow.com/a/47170269
score: 11
downvote count: 0
has body: I was able to get mine working using the following Client Credentials: Authorized JavaScript origins http://localhost Authorized redirect URIs http://localhost:8090/oauth2callback Note: I used port 8090 instead of 8080, but that doesn't matter as long as your python script uses the same port as your client_secret.json file. Reference: Python Quickstart
has comment: http://stackoverflow.com/comment/91267074
answers question: http://stackoverflow.com/q/22595174
upvote count: 11
type: Answer

http://stackoverflow.com/q/22574212
upvote count: 1
tagged with: user-interface
downvote count: 0
answer count: 1
has body: I'm learning Java and I'm trying to load some numbers that are inside a .txt file. These numbers need to appear in Text Fields inside my GUI. I've done a lot of research in google but I cant get it to work. Any hints? //TEXT FIELDS this.Vx = new JTextField(); this.Vx.setBounds(120, 20, 100, 30); this.add(Vx); JLabel etiVx = new JLabel("Vx"); etiVx.setBounds(90, 20, 90, 40); this.add(etiVx); this.Vy = new JTextField(); this.Vy.setBounds(120, 60, 100, 30); this.add(Vy); JLabel etiVy = new JLabel("Vy"); etiVy.setBounds(90,60,100,30); this.add(etiVy); //BOTTON TO OPEN .TXT @Override public void actionPerformed(ActionEvent e) { JFileChooser abrir = new JFileChooser(); if(e.getSource()==this.abrir){ int returnVal = abrir.showOpenDialog(PanelControl.this); if(returnVal == JFileChooser.APPROVE_OPTION); File file = abrir.getSelectedFile(); JOptionPane.showMessageDialog(null,"Abierto"); try{ BufferedReader eleccion = new BufferedReader(new FileReader(file)); String linea = eleccion.readLine(); while((linea=eleccion.readLine())!=null){ Vx.setText(file); linea = eleccion.readLine(); } } catch(IOException f){ System.out.println(f); } }
favorite count: 0
has answer: http://stackoverflow.com/a/22574244
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: jtextfield
tagged with: jfilechooser
type: Question
has title: Using JFileChooser to set values JTextField

http://stackoverflow.com/comment/34282666
has text: Its not finished, it won't compile.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22528976
type: AnswerComment

http://stackoverflow.com/a/22497839
has comment: http://stackoverflow.com/comment/34228169
has comment: http://stackoverflow.com/comment/34228073
downvote count: 0
has comment: http://stackoverflow.com/comment/34228270
has comment: http://stackoverflow.com/comment/34228193
answers question: http://stackoverflow.com/q/22497785
has comment: http://stackoverflow.com/comment/34228106
has comment: http://stackoverflow.com/comment/34228159
score: 3
has comment: http://stackoverflow.com/comment/34228165
has comment: http://stackoverflow.com/comment/34228216
upvote count: 3
has body: Oops sorry, I got it now just like in the comments 2.8 is 2.80 > 2.11
has comment: http://stackoverflow.com/comment/34228078
has comment: http://stackoverflow.com/comment/34228148
type: Answer

http://stackoverflow.com/a/22574941
answers question: http://stackoverflow.com/q/22574764
type: Answer
has body: I have used different approach but I received same output like you. Is not there problem on server side of this URL? CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpGet = new HttpGet("http://www.fetagracollege.org"); CloseableHttpResponse response1 = httpclient.execute(httpGet); try { System.out.println(response1.getStatusLine()); HttpEntity entity1 = response1.getEntity(); String content = EntityUtils.toString(entity1); System.out.println(content); } finally { response1.close(); } It finishes with: &lt;/table&gt; &lt;p&gt;&lt;br&gt; UPDATE: This Faculty of Engineering and Technology does not have well formed home page. This content is complete, your code works well. But commentators have right, you shall use try/catch/finally block.
score: 0

http://stackoverflow.com/comment/34238502
score: 0
type: AnswerComment
has text: I edited my post. The function call to SwingUtilities.updateComponentTreeUI(..) does not fix my problem. The hover effect on the JMenuItem still exists. If I got rid of my problem I try to replace my function with the API function.
type: Comment
comment on: http://stackoverflow.com/a/22495450

http://stackoverflow.com/a/22623340
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34452618
answers question: http://stackoverflow.com/q/22622642
has comment: http://stackoverflow.com/comment/34451863
has body: Your equals method is problematic as it doesn't compare the two hash tables with all items in the buckets. Also it doesn't exclude some cases. An example override of equals method in your CSHash class looks like the following to satisfy the general guideline of equals method: @Override public boolean equals(Object o) { if (o == null) return false; if (this == o) return true; if (!(o instanceof CSHash)) return false; CSHash other = (CSHash) o; return this.entrySet().equals(other.entrySet()); } Here it assumes that you have defined entrySet() method in your CSHash class to return the set of your hash table. You can define your own entrySet() method similar to the one in Java's HashMap class.

http://stackoverflow.com/comment/34277722
type: QuestionComment
type: Comment
has text: Thank you Bart, It worked after changing the action attribute to WebAppl/login. But isn't it tedious to give the full url all the time. Do we have any alternative for this.
comment on: http://stackoverflow.com/q/22526020
score: 0

http://stackoverflow.com/comment/34505488
comment on: http://stackoverflow.com/a/22650991
type: Comment
has text: I am repeating that, If i am using <String> and in pipeline if I am using StringEncoder/Decoder I am able to get the response, but instead of using String Encoder/Decoder, I want to use Rtsp for that only i am getting problem
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34387373
type: Comment
has text: Well, it should be working if you set it outside the `for`-loop. Maybe changing `n=n+1` to `n++` would do the trick. But if it works now everything is fine anyway. Glad I could help. :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22587369

http://stackoverflow.com/comment/34482339
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22639161
has text: And the result is typed out as an integer in the first place, I edited the question with the new field in
score: 0

http://stackoverflow.com/comment/34309252
type: AnswerComment
type: Comment
has text: yep, because you have 4 idled threads in this case. please, read the javadoc, especially keep alive section: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html
comment on: http://stackoverflow.com/a/22542614
score: 0

epub
type: Tag
tags question: http://stackoverflow.com/q/22600402
tags question: http://stackoverflow.com/q/22493692
tag name: epub
tags question: http://stackoverflow.com/q/22525194

http://stackoverflow.com/a/22684193
answers question: http://stackoverflow.com/q/22642596
score: 0
type: Answer
has body: The problem was indeed due to libraries, as an empty classpath solves the problem. Update: Just so you know, the library was not on the network but was making requests to the network. This library was JR.

http://stackoverflow.com/q/22563935
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/34344313
has body: I was trying out a tutorial on http://developer.android.com/ and got stuck with an error on the AndroidManifest.xml file. What happened was, I made an error when creating the activity(made an error when keying in the "Hierachical Parent") and being new to this and all, couldn't find out how to change it. So being the newbie that I am, I deleted the Display_activiy_main.xml, Display_fragment_main and the respective .java file. I've tried some solutions here, such as commenting off the extra manifest tags, cleaning the project and CTRL+SHIFT+F. But i still get this: [2014-03-21 23:54:47 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Amos\workspace\MyFirstApp2\AndroidManifest.xml: The markup in the document preceding the root element must be well-formed. [2014-03-21 23:54:50 - MyFirstApp2] Parser exception for /MyFirstApp2/AndroidManifest.xml: The markup in the document preceding the root element must be well-formed. [2014-03-21 23:54:50 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Amos\workspace\MyFirstApp2\AndroidManifest.xml: The markup in the document preceding the root element must be well-formed. This is my AndroidManifest.xml <<<<<<< Original <<<<<<< Original <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <!-- <!-- android:parentActivityName="com.example.myfirstapp2.MainActivity"> --> <!-- <meta-data android:name="android.support.PARENT_ACTIVITY" --> <!-- android:value="com.example.myfirstapp2.MainActivity" /> --> <!-- >>>>>>> Added --> <!-- <!-- android:parentActivityName="com.example.myfirstapp2.MainActivity"> --> <!-- <meta-data android:name="android.support.PARENT_ACTIVITY" --> <!-- android:value="com.example.myfirstapp2.MainActivity" /> --> <!-- >>>>>>> Added --> I know it's a tu…
tagged with: android-manifest
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22564017
tagged with: java
accepted answer: http://stackoverflow.com/a/22564017
has title: AndroidManifest.xml is trolling me ): (AndroidManifest.xml: The markup in the document preceding the root element must be well-formed.)
type: Question
has comment: http://stackoverflow.com/comment/34344955
linked to: http://stackoverflow.com/q/22374891
score: 0

http://stackoverflow.com/comment/44821465
type: AnswerComment
score: 0
type: Comment
has text: @JohnStrickler I also thought this cannot be safely done. I Haven't check the implementation of ResolvableType yet, but is it means we can safely get generic type now?
comment on: http://stackoverflow.com/a/22603321

http://stackoverflow.com/comment/34254641
comment on: http://stackoverflow.com/a/22512986
type: Comment
has text: I tired these but I get again same error. And as I said in the question, I also tried these on my pc using sudo. So, I think, error should be at somewhere esle
score: 0
type: AnswerComment

http://stackoverflow.com/q/22594049
type: Question
downvote count: 0
has title: How to get mouse postion without a window
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34398715
tagged with: mouse
score: 2
has body: I want to get the mouse postion but I don't want anyone to see the program. The problem is i don't know to get mouse postion without a JFrame I mean evryone can see that.
linked to: http://stackoverflow.com/q/1439022
tagged with: java

http://stackoverflow.com/comment/34228365
has text: ok i will leave you alone i understand im babbling
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22497656

http://stackoverflow.com/comment/35000290
score: 0
type: AnswerComment
has text: NSSM is good but i must edit windows registry to edit aprameters. It's not comfortable to grand admin rights every time when changing parameters required.
type: Comment
comment on: http://stackoverflow.com/a/22529522

http://stackoverflow.com/a/22671337
answers question: http://stackoverflow.com/q/22609375
score: 0
type: Answer
has body: public class tablet extends JFrame { /** * */ private static final long serialVersionUID = 1L; public tablet() { JTable table = new JTable(); DefaultTableModel model = new DefaultTableModel(new Object[][] { { "item1", "item2" } }, new Object[] { "A", "B" }); table.setModel(model); table.setPreferredScrollableViewportSize(new Dimension(400, 250)); table.setRowHeight(25); JScrollPane scrollPane = new JScrollPane(table); // These are the combobox values String[] values = new String[] { "item1", "item2", "item3" }; // Set the combobox editor on the 1st visible column //combo editor JComboBox box = new JComboBox(values); TableColumn column1 = table.getColumnModel().getColumn(0); column1.setCellEditor(new DefaultCellEditor(box)); //combo renderer column1.setCellRenderer(new MyComboBoxRenderer(values)); getContentPane().add(scrollPane); } class MyComboBoxRenderer extends JComboBox implements TableCellRenderer { /** * */ private static final long serialVersionUID = 1L; public MyComboBoxRenderer(String[] items) { super(items); } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if(hasFocus) { setForeground(table.getSelectionForeground()); super.setBackground(table.getSelectionBackground()); } else { setForeground(table.getForeground()); setBackground(table.getBackground()); } // Select the current value setSelectedItem(value); return this; } } public static void main(String args[]) { tablet aTable = new tablet(); aTable.pack(); aTable.setVisible(true); } }

http://stackoverflow.com/comment/34453862
has text: your question is not clear.. maybe you mean voice recognition and text to speech..? you may begin from googling and reading some tutorials..
comment on: http://stackoverflow.com/q/22624695
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22509008
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/22508328
type: Answer
downvote count: 1
has body: I think this is what you're looking for: file.add(new JSeparator(SwingConstants.VERTICAL));

http://stackoverflow.com/comment/34418767
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22604218
has text: Possibly related to https://stackoverflow.com/questions/4007512/how-can-i-change-my-java-swing-application-title-in-mac-os-x-title-bar

http://stackoverflow.com/q/22613770
answer count: 2
linked to: http://stackoverflow.com/q/8383377
downvote count: 0
possible better answer: http://stackoverflow.com/a/22613952
accepted answer: http://stackoverflow.com/a/22613878
favorite count: 0
tagged with: android-asynctask
tagged with: android
has body: What I'm trying do to is using a custom CursorAdapter, in order to choose which layout to show and also to populate View items such as TextViews and also ImageView. Now not in all the listview items there gonna be an image. My CursorAdapter code is - private static class ViewHolder { TextView mesg; TextView mesg2; TextView send; ImageView myImage; } public class ChatCursorAdapter extends CursorAdapter implements OnClickListener { public ChatCursorAdapter(Context context, Cursor c) { super(context, c, 0); } @Override public int getCount() { return getCursor() == null ? 0 : super.getCount(); } @Override public int getViewTypeCount() { return 2; } @Override public int getItemViewType(int _position) { Cursor cursor = (Cursor) getItem(_position); return getItemViewType(cursor); } private int getItemViewType(Cursor cursor) { String sender = cursor.getString(2); String saveUser = user; if (saveUser.equalsIgnoreCase(sender)){ return 0; }else{ return 1; } } @Override public void bindView(View view, Context context, Cursor cursor) { ViewHolder holder = (ViewHolder) view.getTag(); String msg = cursor.getString(3); String msg2 = cursor.getString(4); String sender = cursor.getString(2); holder.mesg.setText(getSmiledText(Main.this,msg)); holder.mesg2.setText(getSmiledText(Main.this,msg2)); holder.send.setText(sender); picPath = cursor.getString(8); if(picPath == null || picPath.isEmpty()){ holder.myImage.setVisibility(View.GONE); }else{ File file = new File(picPath); if(file.exists()){ new AsyncImageSetter(holder.myImage, picPath).execute(); holder.myImage.setOnClickListener(this); } } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { ViewHolder holder = new ViewHolder(); View itemLayout = null; switch(getItemViewType(cursor)){ case 0: itemLayout = getLayoutInflater().inflate(R.layout.msg_item1,parent, false); break; case 1: itemLayout = getLayoutInflater().inflate(R.layout.msg_item13, parent,false); break; } itemLayout.setTag(holder); holder.mesg …
has comment: http://stackoverflow.com/comment/34434527
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22613878
tagged with: listview
has title: Android - Listview with custom CursorAdapter, which running asynctask crashes
has answer: http://stackoverflow.com/a/22613952

http://stackoverflow.com/q/22623827
has comment: http://stackoverflow.com/comment/34453225
has comment: http://stackoverflow.com/comment/34452325
has comment: http://stackoverflow.com/comment/34452348
has comment: http://stackoverflow.com/comment/34453144
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34453070
has comment: http://stackoverflow.com/comment/34453351
has answer: http://stackoverflow.com/a/22625510
favorite count: 0
has comment: http://stackoverflow.com/comment/34452278
has body: How to add button to splash screen Hi i have to create java splashscreen and during splash it will halt/pause and display ok button. I have made splash screen run every time i compile netbean. public class Main { static SplashScreen mySplash; // instantiated by JVM we use it to // get graphics static Graphics2D splashGraphics; // graphics context for overlay of the // splash image static Rectangle2D.Double splashTextArea; // area where we draw the text static Rectangle2D.Double splashProgressArea; // area where we draw the progress bar static Font font; // used to draw our text public static void main(String[] args) { splashInit(); // initialize splash overlay drawing parameters } //create button here private static void splashInit() { //do coding here for mannipulating splash screen //put ok button here } } How can we possibly put button to splashscreen? Usually I can only put JButton at JFrame or JPanel. Is it possible to put button on images like splash screen? reference : Splashscreen beginner netbean
tagged with: splash-screen
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/22625510
tagged with: swing
has title: how to display jbutton on the splashscreen
tagged with: jbutton
type: Question

http://stackoverflow.com/q/22537646
tagged with: http://stackoverflow.com/tag/zip
tagged with: encryption
type: AnsweredQuestion
downvote count: 0
has body: According to the .ZIP File Format Specification (dated September 1, 2012), the overall .ZIP file format is as follows: [local file header 1] [encryption header 1] [file data 1] [data descriptor 1] . . . [local file header n] [encryption header n] [file data n] [data descriptor n] [archive decryption header] [archive extra data record] [central directory header 1] . . . [central directory header n] [zip64 end of central directory record] [zip64 end of central directory locator] [end of central directory record] I'm able to determine the presence/position of local file headers, central directory headers and the end of central directory record by means of the respective signatures. How can I determine the existence or not of the encryption headers? Specifically, I want to know, for any given file with my zip, whether the file data immediately follows the local file header or not...
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22537925
tagged with: unzip
answer count: 1
has answer: http://stackoverflow.com/a/22537925
has title: How to determine the existence of encryption headers?
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/22643120
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34491955
has comment: http://stackoverflow.com/comment/34520949
has answer: http://stackoverflow.com/a/28277082
score: 2
downvote count: 0
has title: Generating wlfullclient.jar error (WebLogic 12c)
has answer: http://stackoverflow.com/a/23497956
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34532631
has comment: http://stackoverflow.com/comment/34528192
has body: I've installed WebLogic 12c developer zip. The server is up and running. But when I try to generate wlfullclient.jar from the wljarbuilder.jar the following error occurs: C:\weblogic\wls\wls12120\wlserver\server\lib&gt;java -jar wljarbuilder.jar java.io.FileNotFoundException: C:\weblogic\wls\wls12120\wlserver\server\lib\webl ogic-classes.jar at com.bea.jarbuilder.internal.CompositeJar.&lt;init&gt;(CompositeJar.java:69) at com.bea.jarbuilder.JarBuilder.createJar(JarBuilder.java:165) at com.bea.jarbuilder.JarBuilder.main(JarBuilder.java:53) Error creating target jar It's missing the weblogic-classes.jar from the lib folder. But I've reinstalled the server and this jar isn't there. How can I solve this problem to generate the client full jar?
has answer: http://stackoverflow.com/a/47191638
tagged with: java
type: Question
upvote count: 2
tagged with: weblogic
has comment: http://stackoverflow.com/comment/34534958
tagged with: jar

http://stackoverflow.com/comment/34353487
has text: Agreed - The MovieData Object must be null. There should be more checks before you call UnsortedMoveList. Your kitchen sink MovieListNode call with all the arguments passed as method calls as well is not too smart.
comment on: http://stackoverflow.com/q/22568993
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22529932
has answer: http://stackoverflow.com/a/22537765
tagged with: spring-webflow
tagged with: maven
tagged with: appfuse
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has body: I have wasted a 4 hours on finding a reason for not adding of webflow jars tp the reference library of my my modular maven project which is generated from appfuse.I want to add a webflow to this project. But when I do the registering as below, I get an error (I have still not run the project). error is Multiple annotations found at this line: - Class 'org.springframework.webflow.mvc.servlet.FlowHandlerAdapter' not found But I have included the webflow dependencies in my pom in my web module project. But when I go the the reference library I can not find the webflow jars as well. I think this is the reason for this, But I can not wind a way to get the jars in to the reference library. The generated pom is very lengthy. I will add it if it is needed. org.springframework.webflow spring-webflow 2.3.2.RELEASE Is there a compatibility issue with the spring versions. I am currently using 4.0.0.RELEASE I have changed it to 4.0.2.RELEASE as well. But no luck. I can not find a meaningful solution for this. I really appreciate some help on this. Thanks
accepted answer: http://stackoverflow.com/a/22537765
type: Question
has title: spring-webflow jars not available
score: 0
answer count: 1

http://stackoverflow.com/q/22620807
upvote count: 0
has comment: http://stackoverflow.com/comment/34448170
has answer: http://stackoverflow.com/a/22621909
has comment: http://stackoverflow.com/comment/34447273
has answer: http://stackoverflow.com/a/22621767
has title: Java keeps adding buttons! - JFrames -
favorite count: 0
has comment: http://stackoverflow.com/comment/34447740
has comment: http://stackoverflow.com/comment/34447993
has comment: http://stackoverflow.com/comment/34447603
has comment: http://stackoverflow.com/comment/34448350
has comment: http://stackoverflow.com/comment/34447342
has comment: http://stackoverflow.com/comment/34447850
has comment: http://stackoverflow.com/comment/34447367
has comment: http://stackoverflow.com/comment/34447156
has comment: http://stackoverflow.com/comment/34447269
has comment: http://stackoverflow.com/comment/34448059
has comment: http://stackoverflow.com/comment/34448254
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34448020
has body: Alright, so, I am trying to make a game using a JFrame that, when you click a button, adds money, and show update some text(a JLabel). You see, it should just update the Windows.Money variable and display ONLY the new variable on the screen, but, it adds more buttons. Please note: The money part works fine. It's just that Java doesn't want to replace, only add. Code: package dev.bobdabiulder.classic.main; import javax.swing.JLabel; public class Bucket extends Window{ private static final long serialVersionUID = 1L; public Bucket() throws InterruptedException { for(int i = 0; !Window.Paused; ) { Window.Money += 2; this.wait(1000); } Window.Buckets++; Window.BucketCounter = new JLabel("You have: " + Window.Buckets + " buckets!"); } } In the Windows class... package dev.bobdabiulder.classic.main; import java.awt.Button; import java.awt.Component; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Window extends JFrame{ public static long Money = 0; private static final long serialVersionUID = 1L; private static Thread t1 = new Thread(); private static Thread t2 = new Thread(); private static Thread t3 = new Thread(); private static Thread t4 = new Thread(); private static Thread t5 = new Thread(); public JButton bucket = new JButton("Buy a Bucket!"); public JButton add$ = new JButton("Add Money!"); public JLabel money = new JLabel(Money + ""); public static long Buckets = 0; public static JLabel BucketCounter = new JLabel("You have: " + Buckets + " buckets!"); public static JPanel buck = new JPanel(); public static boolean Paused = false; static JFrame jf = new JFrame("Lol!"); //Window Method public Window() { jf.setVisible(true); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); buck.add(bucket); buck.add(money); buck.add(add$); buck.add(BucketCounter); jf.setSize(500, 5…
has comment: http://stackoverflow.com/comment/34447400
tagged with: swing
has comment: http://stackoverflow.com/comment/34447405
has comment: http://stackoverflow.com/comment/34447489
downvote count: 1
tagged with: jbutton
type: Question
has comment: http://stackoverflow.com/comment/34446896
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/34447803
has comment: http://stackoverflow.com/comment/34448300
has comment: http://stackoverflow.com/comment/34447570
has comment: http://stackoverflow.com/comment/34447209
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/34447660
has comment: http://stackoverflow.com/comment/34448123
answer count: 2

http://stackoverflow.com/comment/62048033
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/35141694
type: Comment
has text: For this scenario: I need to parcel a list of Cat, Dog, etc (subclasses of Animal) as an array list with type "Animal." In this case, Animal's CREATOR will be used with the data from the writeToParcel, and in.readString() is used to determine the type so that the correct subclass can be instantiated using its parcel constructor, which should call to Animal's parcel constructor using super(in). If you read in the type in the Animal constructor, you've then got a broken implementation -- the type has already been read in order to create the Dog object instead of the Cat object.

http://stackoverflow.com/comment/34254465
has text: Do you want to create a new, shorter array, lacking the word you want to exclude? This would all be a little easier with a list instead of an array.
comment on: http://stackoverflow.com/q/22512865
type: Comment
score: 1
type: QuestionComment

spdy
tag name: spdy
tags question: http://stackoverflow.com/q/22608892
type: Tag

http://stackoverflow.com/comment/34548684
type: Comment
comment on: http://stackoverflow.com/a/22633756
score: 0
has text: @MAK, ha ha, thanks for your advice. but i am just learning all these practically, that is all, i am trying to develop and simple web scrapping application for one of the clients. and i am at the end of the development and i wanted to be sure, so came up here. what i feel is the best way is to dive into the pool straight away and then the art of swimming will automatically catch up when i struggle. :) :) anyways!! thanks a lot for all the help
type: AnswerComment

http://stackoverflow.com/comment/34483991
comment on: http://stackoverflow.com/q/22641901
score: 0
has text: It's beyond me and beyond my control. But is my syntax not correct.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34453674
score: 0
comment on: http://stackoverflow.com/a/22624462
type: Comment
has text: Ok, what is the solution?
type: AnswerComment

http://stackoverflow.com/comment/34388815
type: Comment
type: QuestionComment
has text: Does `demo` class has any package statement?
comment on: http://stackoverflow.com/q/22588293
score: 0

http://stackoverflow.com/a/22688121
score: 0
accepted answer of: http://stackoverflow.com/q/22642173
type: Answer
has body: Add after for (int i = 0; i &lt; output.length();){ rooms[i] = output.split(","); i++; } results.setModel(new DefaultTableModel(rooms,columnNames )
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22642173

http://stackoverflow.com/q/22639067
answer count: 0
has comment: http://stackoverflow.com/comment/34568582
score: 1
tagged with: java
tagged with: eclipse
type: Question
has title: Eclipse empty parameter string
upvote count: 1
has comment: http://stackoverflow.com/comment/34568699
downvote count: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/34504209
favorite count: 0
has body: In the menu Run->Run Configurations of a Java Applet under the tab Parameters, you can't add a parameter whose value is empty. How can I use an empty string as parameter for a Java Applet in Eclipse? The parameters are retrieved in the Applet with getParameter(name); Here's a screenshot of the parameter tab:
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34598019
tagged with: parameters

http://stackoverflow.com/comment/34443903
type: QuestionComment
score: 1
has text: I believe they're equally irregular on Windows. But Windows tends to time things in 15ms chunks, rather than in milliseconds.
comment on: http://stackoverflow.com/q/22618743
type: Comment

http://stackoverflow.com/comment/34460663
comment on: http://stackoverflow.com/a/22628383
type: Comment
has text: I've changed your link title, w3schools is not in any way associated with the W3C.
score: 0
type: AnswerComment

foreach
tags question: http://stackoverflow.com/q/22551420
type: Tag
tag name: foreach
tags question: http://stackoverflow.com/q/22547374

http://stackoverflow.com/comment/34225463
score: 0
type: AnswerComment
has text: Not the code,the question means a file which has multiple lines.You just gave solution to one string.
comment on: http://stackoverflow.com/a/22496077
type: Comment

http://stackoverflow.com/q/22508241
upvote count: 1
type: Question
has body: Today i'm working with microphones and recording.So i found "tutorial"(or actually Oracle javadoc),and i did get Mixer with Line supporting of Microphone.And now i need to get line from mixer. All is ok,beside AudioFormat.How to get line from Mixer? that is just Mixer.getLine(DataLine.Info).How to get DataLine.Info? Ohh,that is harder.You need Class, and AudioFormat.Class is simple, but how to get AudioFormat? I did try to just create new instance,but i'm getting error.My code: //Sorting Mixers into Mic,and speaker list. Info[] MixerList = AudioSystem.getMixerInfo(); for (int i = 0;i&lt;MixerList.length;i++) { Mixer m = AudioSystem.getMixer(MixerList[i]); if (m.isLineSupported(Port.Info.MICROPHONE)) MicList.add(m); else ColList.add(m); } //Trying to get Line from mixer...And open TDL for recording. try { DataLine.Info DLI = new DataLine.Info(TargetDataLine.class, getAudioFormat()); Mixer m = (Mixer)MicList.toArray()[0]; Line s = m.getLine(DLI); MicRec = (TargetDataLine)s; MicRec.open(); } catch (LineUnavailableException ex) {} Now,i'm creating audio format with 8K hz,16bit,and 2 streams.But i'm getting error: java.lang.IllegalArgumentException: Line unsupported: interface TargetDataLine supporting format PCM_SIGNED 8000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian Soo,how to get AudioFormat? Or did i make a mistace in my "sorting code"? edit1:Did someting "intresting" with "sorting code".Now i'm writing m.toString() and is it mic,or no.Soo,that was actually good idea,beacos now i see what wrong. com.sun.media.sound.DirectAudioDevice@56b65e2b Is someting else! com.sun.media.sound.PortMixer@5ee08586 Is someting else! com.sun.media.sound.PortMixer@4081bfd8 Is mic edit2: Googled,and did find what that is fine.isLineSupporter with port mic mean what mic is ENABLED,not what that mixer is microphone.
has title: Java get AudioFormat type for Mic recording
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: microphone
answer count: 0
tagged with: recording
score: 1
tagged with: java

mouselistener
tags question: http://stackoverflow.com/q/22533362
tags question: http://stackoverflow.com/q/22580243
tags question: http://stackoverflow.com/q/22533307
tags question: http://stackoverflow.com/q/22638926
tags question: http://stackoverflow.com/q/22637528
tags question: http://stackoverflow.com/q/22510890
tags question: http://stackoverflow.com/q/22535299
tags question: http://stackoverflow.com/q/22595445
type: Tag
tag name: mouselistener
tags question: http://stackoverflow.com/q/22639410

twitter4j
tags question: http://stackoverflow.com/q/22529926
tags question: http://stackoverflow.com/q/22580955
type: Tag
tag name: twitter4j
tags question: http://stackoverflow.com/q/22621841

http://stackoverflow.com/q/22501612
answer count: 1
score: 0
tagged with: oracle-database
has answer: http://stackoverflow.com/a/22502489
type: UnansweredQuestion
has title: Oracle data pump using java
tagged with: java
tagged with: database
tagged with: datapump
has body: I'am trying to use Oracle data pump using java. How can I export data from Oracle using java and retrieve a dump file of the same.
type: Question

http://stackoverflow.com/comment/34221578
score: 0
has text: Are you passing the date as a string?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22493680

http://stackoverflow.com/a/29816357
has body: I am not sure if this will answer your question but I used a tool in past as Fortify to run code review rules on the project, that precisely points to the unused imports, dead code, unused classes etc. It is a paid software but I am sure there will be some free plugins/software will be available for same.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22522013
score: 1

http://stackoverflow.com/comment/34474979
has text: If users manually clear the data or app force closed means what will have to do....
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22635597
score: 0

http://stackoverflow.com/q/22562139
has answer: http://stackoverflow.com/a/22564130
type: AnsweredQuestion
tagged with: java
has title: Tomcat, Logon denied for Oracle Database 11gR2
tagged with: persistence.xml
type: Question
accepted answer: http://stackoverflow.com/a/22564130
has body: I am using JPA by connecting TOMCAT deployed webapp to a Oracle Database 11gR2. I am getting the following error. javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20131113-a7346c6): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: ORA-01017: invalid username/password; logon denied My persistence.xml is <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider mil.osd.dmdc.diss.tdoc.model.AbstractModelObject mil.osd.dmdc.diss.tdoc.model.GeneratedFile mil.osd.dmdc.diss.tdoc.model.Template mil.osd.dmdc.diss.tdoc.model.TemplateFile <property name="eclipselink.jdbc.bind-parameters" value="false"/> <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/> <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:localhost:1521:tdoc"/> <property name="javax.persistence.jdbc.user" value="test"/> <property name="javax.persistence.jdbc.password" value="TEST"/> <property name="eclipselink.target-server" value="None"/> <property name="eclipselink.logging.level.sql" value="FINE"/> <property name="eclipselink.logging.parameters" value="true"/> The credentials I'm providing are definitely right since I can use them to connect to SQL Developer and SQL Plus. PLEASE HELP! I've been stuck on this for hours. Also I tried turning off Case sensitivity and it doesn't seem to work either. EDIT I forgot to mention I am also using maven to build the project, it looks like this just in case my dependency for eclipselinks is wrong ` 4.0.0 testdata testdata 1.0 war testdata org.eclipse.persistence org.eclipse.persistence.jpa 2.5.2-M1 com.oracle ojdbc6 11.2.0 org.apache.directory.studio org.apache.commons.io 2.4 org.glassfish javax.faces 2.1.13 javax.servlet servlet-api 2.5 provided ${project.artifactId} maven-compiler-plugin 3.1 1.7 1.7 maven-war-plugin 2.3 src/main/webapp true `
score: 0
answer count: 1
tagged with: jpa
tagged with: tomcat
tagged with: oracle-database

http://stackoverflow.com/comment/34447755
has text: Exception seems to be in decrypt. Are u using the same key used for encrypt ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22620403
type: AnswerComment

http://stackoverflow.com/q/22576208
type: Question
has answer: http://stackoverflow.com/a/22576656
has title: Mapping ORACLE Data Type to JAVA Data Type
answer count: 1
tagged with: type-conversion
tagged with: oracle-database
upvote count: 1
has body: according to following code and table : ResultSetMetaData rsmd = rs.getMetaData(); int numberOfColumns = rsmd.getColumnCount(); for( int i=1; i &lt;= numberOfColumns; i++ ) { // label if defined else name of column String columnLabel = rsmd.getColumnLabel( i ); // data type in database String columnType = rsmd.getColumnTypeName( i ); // java equivalent class name String columnClassName = rsmd.getColumnClassName( i ); System.out.println( "Column Name : " + columnLabel ); System.out.println( "Column Type : " + columnType ); System.out.println( "Column Class: " + columnClassName ); System.out.println(); } // for count of columns //--------------------- Table ---------------------------------- CREATE TABLE "TEST123" ( "ID" NUMBER NOT NULL ENABLE, "NAME" VARCHAR2(20), "AGE" NUMBER(2,0), "AVERAGE" NUMBER(2,2) ) ; //-------------------------------------------------------------- Why output of numeric field, at table above, show java.math.BigDecimal ? we want the program shows integer, double, short and ... as result. -------------output------------------ Column Name : ID Column Type : NUMBER Column Class: java.math.BigDecimal Column Name : NAME Column Type : VARCHAR2 Column Class: java.lang.String Column Name : AGE Column Type : NUMBER Column Class: java.math.BigDecimal Column Name : AVERAGE Column Type : NUMBER Column Class: java.math.BigDecimal
favorite count: 0
has comment: http://stackoverflow.com/comment/34366679
has comment: http://stackoverflow.com/comment/34366543
type: UnansweredQuestion
tagged with: metadata
downvote count: 0
score: 1
tagged with: java
tagged with: orm

http://stackoverflow.com/q/22580756
has body: So I want to create a button which always flash if my boolean is set to true or with a timer. My first idea was to use the "on click" animation but I don't know if it would work fine. If you got an idea of how to make a flash animation please tell me.
tagged with: java
has comment: http://stackoverflow.com/comment/34374798
type: Question
has comment: http://stackoverflow.com/comment/34375032
tagged with: button
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34374509
answer count: 0
has title: Button flash animation android java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34375193
tagged with: onclick

http://stackoverflow.com/a/52605512
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/92145287
has body: That code generate numbers from 6 to 0 and save in ArrayList. If generated number was duplicated the program generate numbers again. If generated number is different that number is added. Code: private ArrayList&lt;Integer&gt; arraylist = new ArrayList&lt;Integer&gt;(); private Random rand = new Random(); public void insertNumber() { while (true) { int i = generateNumber(); if(!isGenerateNumberExists(i)){ addNumber(i); break; } } } //Generate numbers private int generateNumber() { return rand.nextInt(6); } //Confirm if that number exists private boolean isGenerateNumberExists(int y) { for (int num : arraylist) { if (num == y) { return true; } } return false; } //Add number to arrayList private void addNumber(int x) { arraylist.add(x); }
answers question: http://stackoverflow.com/q/22584244

http://stackoverflow.com/comment/34388542
comment on: http://stackoverflow.com/q/22588319
type: Comment
has text: How many of these "compound words" do you have in your dictionary, and do you know what they all are ahead of time? Also, is it OK if "macbookpro" doesn't match in a sentence like "I love my Macbo OK Pro"?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34215319
comment on: http://stackoverflow.com/q/22490001
type: Comment
type: QuestionComment
has text: You can transform your infix expression into a postfix expression (RPN) (e.g by the recommended Shunting-yard algorithm), then evaluate it.
score: 1

http://stackoverflow.com/comment/34270892
score: 4
has text: It's likely as good as you'll get. But really don't worry about efficiency on this level: computers are fast for simple operations. Worry about efficiency of your algorithms, about not allocating too much memory, etc.
comment on: http://stackoverflow.com/q/22522157
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34274104
type: QuestionComment
comment on: http://stackoverflow.com/q/22523717
has text: A HashMap is not guaranteed to hold the sort order. If you want to maintain the order in which they were inserted into the arraylist. I would recommend LinkedHashMap over TreeMap. Reference : http://stackoverflow.com/a/2889800/919858
score: 0
type: Comment

http://stackoverflow.com/a/22557117
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22557028
type: Answer
answers question: http://stackoverflow.com/q/22557028
has comment: http://stackoverflow.com/comment/34331580
has comment: http://stackoverflow.com/comment/34372595
score: 7
upvote count: 7
has body: Threads in thread pool will keep running when main is finished. That's why JVM won't shut down. You need to either use daemon-threads, or shutdown the pool explicitly. Here's an example: ExecutorService ex = Executors.newCachedThreadPool(); // do all your submission work here ex.shutdown();
type: AcceptedAnswer

http://stackoverflow.com/a/22537936
type: Answer
has body: Like fge said, there exist a class called "Class". That sound a little bit confusing, but just take it as it is for the moment. It's a class with name "Class". The notation [] refers to an array. An array is something like a list (to make it simple). So Class[] means an array of objects of the type Class. Here's a simpler example: public Person&lt;&gt;[] getListOfPersons() { ... } This method would return an array ([]) of Person objects. Person is the class/type of the objects in the array. Just replace Person with Class.
accepted answer of: http://stackoverflow.com/q/22537420
answers question: http://stackoverflow.com/q/22537420
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/34403769
comment on: http://stackoverflow.com/q/22596330
type: QuestionComment
has text: That really doesn't look right at all. There is something fundamentally wrong with this approach, you should explain your problem more.
type: Comment
score: 1

http://stackoverflow.com/a/22559780
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34343191
answers question: http://stackoverflow.com/q/22558185
upvote count: 2
score: 2
has body: Hibernate's HQL does not support intervals (and generally has extremely poor date maths support). You'll need to use native SQL, or express the query without interval by doing the date calculations locally on the Java side. Or you can register a user-defined SQL function and create a PostgreSQL function that does the date maths you want. See: Performing Date/Time Math In HQL? how to use date() in hibernate criteria Hibernate Criteria: NOW() &lt; date + 1 day Date operations in HQL and many more.

http://stackoverflow.com/comment/34485840
comment on: http://stackoverflow.com/q/22642870
type: Comment
has text: Like i said execution time went up to 27 seconds after adding List<DataMS> listOfCLI =new ArrayList<DataMS>();in place of List listOfCLI =new ArrayList(); iam running it right now... As we speak
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34351071
type: Comment
type: QuestionComment
has text: The algorithm is incorrect either way. Consider `5, 1, 1, 1, 2, 0` and starting at `index = 1`. It will return false because when you get to the `2`, you jump back to a field you've been on. If you moved to the left in the beginning rather than right, it would be solvable, though.
comment on: http://stackoverflow.com/q/22567471
score: 0

http://stackoverflow.com/comment/34348041
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22565730
type: Comment
has text: hi gabriel, i edited my code, i think this should work for you. you can use it like CopiedTree cp = BST.copyTree(rootNodeInput);

http://stackoverflow.com/comment/34414847
has text: If every method of the unknown manager class opens a session and closes it, the entity becomes unmanaged as soon as the method returns. Why the hell don't you show your code?
score: 0
comment on: http://stackoverflow.com/q/22602923
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34447273
type: QuestionComment
comment on: http://stackoverflow.com/q/22620807
score: 0
has text: You mean buck and Bucket? buck is the JPanel, and bucket is the button, finally, Bucket() refers to the first code block(a different class)
type: Comment

http://stackoverflow.com/a/22537709
has comment: http://stackoverflow.com/comment/34298372
has comment: http://stackoverflow.com/comment/34298466
score: 3
has body: Just connecting via Java and fetching the image will not load the ads, which are almost certainly loaded by JavaScript. Doing a GET on the page source will probably not even fetch the JavaScript files, let alone execute them.
answers question: http://stackoverflow.com/q/22537615
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34298746
downvote count: 0
has comment: http://stackoverflow.com/comment/34298452
has comment: http://stackoverflow.com/comment/34298304
has comment: http://stackoverflow.com/comment/34298639
has comment: http://stackoverflow.com/comment/34298751
accepted answer of: http://stackoverflow.com/q/22537615
type: Answer
upvote count: 3

http://stackoverflow.com/q/22621490
upvote count: 0
has comment: http://stackoverflow.com/comment/34448939
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22624486
tagged with: filter
type: AnsweredQuestion
tagged with: jsf
accepted answer: http://stackoverflow.com/a/22624486
downvote count: 1
type: Question
has title: primefaces + java + mysql
tagged with: primefaces
tagged with: java
has body: I have a problem. Here it is my code (EDITED): <?xml version="1.0" encoding="UTF-8"?> <h:head> Osszesito </h:head> <ui:debug /> <h:form> <p:fieldset legend="Osszesito:"> <p:dataTable id="dataTable" value="#{OsszesitoBean.values}" var="c" paginator="true" rows="25" editable="true" filteredValue="#{OsszesitoBean.filteredOsszesito}> <p:ajax event="rowEdit" listener="#{OsszesitoBean.update(event)}"/> <p:column> <f:facet name="header">ID:</f:facet> <h:outputText value="#{c.id}"/> </p:column> <p:column filterBy="#{c.kod}" filterMatchMode="contains> <f:facet name="header">kod:</f:facet> <h:outputText value="#{c.okod}"/> </p:column> <p:column headerText="Edit"> <p:rowEditor/> </p:column> <p:column filterBy="#{c.name}" filterMatchMode="contains> <f:facet name="header">Name:</f:facet> <h:outputText value="#{c.name}"/> </p:column> . . . . </p:dataTable> </p:fieldset> </h:form> Here it is my java set and get class: import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.Row; public class OsszesitoSetGet { private int id; private String kod; private String name; . . . . public int getId() { return id; } public void setId(int id) { this.id = id; } public String getKod() { return kod; } public void setKod(String kod) { this.kod = kod; } public String getName() { return name; } public void setName(String name) { this.name = name; } . . . . public void postProcessXLS(Object document) { HSSFWorkbook wb = (HSSFWorkbook) document; HSSFSheet sheet = wb.getSheetAt(0); CellStyle style = wb.createCellStyle(); style.setFillBackgroundColor(IndexedColors.AQUA.getIndex()); for (Row row : sheet) { for (Cell cell : row) { cell.setCellValue(cell.getStringCellValue().toUpperCase()); cell.setCellStyle(style); } } } } Here it is bean class (EDITED): import java.sql.Connection; import java…
score: -1

http://stackoverflow.com/comment/34433029
comment on: http://stackoverflow.com/a/22609869
type: AnswerComment
type: Comment
score: 0
has text: @AKHolland IMHO using Yoda notation to avoid accidental assignment is obsolete with a modern compiler. As I said, this probably comes from a time where the compiler did **not** warn you.

http://stackoverflow.com/a/22511570
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22490786
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22490786
type: Answer
has body: Solved the problem by rewriting my complete GUI and Timeline. Don't know why it didn't work before, but now it is working.
score: -2
downvote count: 3

instantiation
type: Tag
tags question: http://stackoverflow.com/q/22613444
tags question: http://stackoverflow.com/q/22554332
tag name: instantiation

http://stackoverflow.com/comment/34493984
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22647463
has text: "while not using an array". In fact you are using an array.

http://stackoverflow.com/q/22531996
accepted answer: http://stackoverflow.com/a/22534865
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22534865
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34288255
has title: Spring AOP: Trying to use for logging but getting IllegalArgumentException
has comment: http://stackoverflow.com/comment/34287891
has body: I've seen similar problems posted on stack overflow and on the spring forums but cannot find a solution. When I try to go to the homepage - so this is before I've tried to click on login - I get the following exception: java.lang.IllegalArgumentException: warning no match for this type name: enteredPassword [Xlint:invalidAbsoluteTypeName] Here is my XML: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" 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 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"&gt; &lt;bean class="com.company.controller.UserValidation" id="userValidation"/&gt; &lt;bean class="com.company.model.ActivityLogging" id="activityLogging"/&gt; &lt;aop:config&gt; &lt;aop:aspect ref="activityLogging"&gt; &lt;aop:pointcut id="validateUser" expression="execution(* com.company.controller.UserValidation.validateUser(java.lang.String,java.lang.String)) and args(username, enteredPassword)"/&gt; &lt;aop:before pointcut-ref="validateUser" method="logLoginAttempt" arg-names="username"&gt;&lt;/aop:before&gt; &lt;/aop:aspect&gt; &lt;/aop:config&gt; &lt;/beans&gt; Here is the validateUser() method: public User validateUser(String username, String enteredPassword) throws NoResultException, PasswordIncorrectException{ User user = dal.searchForUser(username); if(user.getPassword().equals(enteredPassword)){ return user; }else{ throw new PasswordInc…
has comment: http://stackoverflow.com/comment/34292563
tagged with: aop
score: 0
tagged with: spring-aop
has comment: http://stackoverflow.com/comment/34287968
answer count: 1

http://stackoverflow.com/comment/34345288
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22564428
has text: try the link i have added lastly. NewLink.
score: 0

http://stackoverflow.com/q/22591648
tagged with: youtube-api
type: Question
tagged with: android-youtube-api
downvote count: 0
has body: While trying to grab a simple json feed of a playlist I encountered this error. I didn't want to include the Youtube library for such a small snippet, so I opted to grab the json manually using: https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&amp;key=&lt;API_KEY&gt;&amp;playlistId=&lt;PLAYLIST_ID&gt; But I kept receiving: { "error": { "errors": [ { "domain": "usageLimits", "reason": "accessNotConfigured", "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project." } ], "code": 403, "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project." } } I had enabled the API via the console I had gotten the key using both my debug.keystore and my release.keystore The package name was correct, as were the SHA1's
answer count: 1
has title: Android Youtube V3 Simple API 403 Error: accessNotConfigured
favorite count: 0
accepted answer: http://stackoverflow.com/a/22591649
upvote count: 2
tagged with: android
tagged with: youtube
has answer: http://stackoverflow.com/a/22591649
type: AnsweredQuestion
score: 2
tagged with: java

http://stackoverflow.com/q/22562960
has body: I have a previously archived Eclipse project that I need to rebuild and publish because of a program error. Unfortunately, all of the french characters in my Java files (not ideal, I know) are shown as question marks. This was not an issue when I was using Eclipse 2.x, but I recently upgraded to Eclipse 3.x. All of the file encodings appear to be correct, and there is no problem with xml files, just .java source files. I'm using MacOS and the 64-bit version of eclipse. An image describing the problem is here. Thanks!
tagged with: encoding
has title: Encoding issue in Eclipse incorrectly displays UTF-8 characters that have no issue in other editors
answer count: 1
has answer: http://stackoverflow.com/a/22563077
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34342304
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/q/22584693
tagged with: java
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22657361
type: UnansweredQuestion
has body: I am looking fo a way to set a border color for the slices of the pie chart made with the AChartEngine Android library. Does anyone have an idea on how to achieve that?
tagged with: android
tagged with: achartengine
has title: How to set the pie chart slices' border color in achartengine?

android-screen-support
tag name: android-screen-support
tags question: http://stackoverflow.com/q/22545396
type: Tag

http://stackoverflow.com/comment/34375032
type: QuestionComment
type: Comment
has text: You made the tutorial? http://developer.android.com/guide/topics/graphics/view-animation.html
comment on: http://stackoverflow.com/q/22580756
score: 0

http://stackoverflow.com/q/22582387
tagged with: java
upvote count: 1
has body: I am facing a strange problem on my production server which is having nearly half a million request per day. In the peak time it gets around 150 tps hardly. My problem is every thing works fine but some of request which have hit to our servlet as it is showing in the logs but not processing further. We are getting no error/exceptions in our application?server logs. Not able to figure out what actually is happening. These dead request count around 4-5 out around half a million request per day as I said earlier. These dead request showing up any time of the day (sometime on peak time and sometime when traffic is low). I wont be able to help with logs, because there aren't any. Below code is the only proof that those dead requests have hit over application. log.info("Remote host"+request.getRemoteHost()); log.info("Request URL :" + request.getRequestURL()+ "?" + request.getQueryString()); These two line is the only trace we got. Below which there are a number logs we are printing but request is not going further. Server: AIX Java: IBM 6 Server: WAS7 Node:2 "I don't know how to tag this question so I am tagging with all possible tag." Please help. Thanks.
has comment: http://stackoverflow.com/comment/34378229
has comment: http://stackoverflow.com/comment/34377798
has comment: http://stackoverflow.com/comment/34378355
type: UnansweredQuestion
tagged with: servlets
tagged with: websphere-7
has comment: http://stackoverflow.com/comment/34377562
has comment: http://stackoverflow.com/comment/34378305
answer count: 0
downvote count: 0
has title: Request lost in Servlet
has comment: http://stackoverflow.com/comment/34377967
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34378600
type: Question
tagged with: aix
has comment: http://stackoverflow.com/comment/34377953

http://stackoverflow.com/comment/34308322
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22535299
has text: I think I got it thanks! The example was very useful.

http://stackoverflow.com/comment/34456761
comment on: http://stackoverflow.com/q/22625783
has text: Yes i Commit the changes.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34402826
score: 0
type: Comment
type: QuestionComment
has text: Please show us the entire class (or at least an outline of it). Is `toCSVString()` actually a member of `Course`?
comment on: http://stackoverflow.com/q/22596418

http://stackoverflow.com/comment/34381092
has text: Are you able to get the value of clicked cell data?
comment on: http://stackoverflow.com/q/22583589
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34496676
type: AnswerComment
type: Comment
has text: haha no worries and i thank you! also on the part where its new jframe"testing" etc how would i make the new JFrame basically transparent but still visible if you get what i mean lol
comment on: http://stackoverflow.com/a/22645343
score: 0

http://stackoverflow.com/comment/34296797
has text: Thanks for the tip. I've updated my question with details. Unfortunately using `OracleLobHandler` (and even `DefaultLobHandler`) didn't work. I also tried just getting the connection and then doing things "manually" to the same effect. Could this be misconfiguration in the database rather than an issue with my code? I'm starting to run out of ideas here...
comment on: http://stackoverflow.com/a/22522083
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/22603077
has body: Rather than store in two distinct bytes and implement your own custom encoding and decoding, it would be easiest to store these values in a short. This is a 16 bit signed integer with sufficient range for your values.
accepted answer of: http://stackoverflow.com/q/22602916
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22602916
type: Answer
has comment: http://stackoverflow.com/comment/34420723
has comment: http://stackoverflow.com/comment/34420485
upvote count: 3
score: 3

http://stackoverflow.com/comment/34390165
comment on: http://stackoverflow.com/a/22570488
type: Comment
has text: Oh right, I didn't actually realise that if I do put with the same key then it would replace it with the new value. That solves my problem then. Thanks a lot!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34421951
has text: The user obviously does not want a for loop but a forEach method on a collection
score: 1
type: Comment
comment on: http://stackoverflow.com/a/22607409
type: AnswerComment

http://stackoverflow.com/a/22576651
score: 18
has comment: http://stackoverflow.com/comment/66237442
has comment: http://stackoverflow.com/comment/34373152
has body: I got the answer for this question stage.setOnHiding(new EventHandler&lt;WindowEvent&gt;() { @Override public void handle(WindowEvent event) { Platform.runLater(new Runnable() { @Override public void run() { System.out.println("Application Closed by click to Close Button(X)"); System.exit(0); } }); } });
type: Answer
answers question: http://stackoverflow.com/q/22576261
downvote count: 2
has comment: http://stackoverflow.com/comment/101962388
has comment: http://stackoverflow.com/comment/83410610
upvote count: 20

http://stackoverflow.com/comment/34380346
comment on: http://stackoverflow.com/q/22583785
has text: So, the compiler can be found and works fine. But you ask it to compile a .java file that doesn't exist.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/22500765
type: Question
upvote count: 3
has answer: http://stackoverflow.com/a/27022564
tagged with: java
has title: Java- Retrieving permissions from LDAP for shiro
answer count: 1
type: UnansweredQuestion
has body: im trying to get the User Permissions (read, write, browse,...) for LDAP objects using a java application with shiro. I dont have much experience with LDAP. I set up a server with Apache Directory Studio for testing purpose. Then i created a domain (dc=testdomain) and added a subentry with the "accessControlSubentry" objectclass and added the "prescriptiveACI" attribute. Everthing works the way it should if i browse the server with Apache DS and i can connect to the server in my java app. In order to get the permissions i subclassed the ActiveDirectoryRealm from shiro. But i cant manage to make the query get the subentrys. private Set&lt;String&gt; getPermissionsForUser(String username, LdapContext ldapContext) throws NamingException{ Set&lt;String&gt; permissions; permissions = new LinkedHashSet&lt;String&gt;(); SearchControls searchCtls = new SearchControls(); searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE); searchCtls.setReturningAttributes(new String[]{"prescriptiveACI"}); String searchFilter = "(objectClass=subentry)"; String searchBase = "dc=testdomain"; NamingEnumeration answer = ldapContext.search(searchBase, searchFilter, searchCtls); while (answer.hasMoreElements()) { SearchResult sr = (SearchResult) answer.next(); if (log.isDebugEnabled()) { log.debug("Retrieving permissions for user [" + sr.getName() + "]"); } Attributes attrs = sr.getAttributes(); if (attrs != null) { NamingEnumeration ae = attrs.getAll(); while (ae.hasMore()) { Attribute attr = (Attribute) ae.next(); if (attr.getID().equals("prescriptiveACI")) { if (log.isDebugEnabled()) { log.debug("Permissions found"); } } } } } return permissions; } When I change the searchFilter to "(objectClass=*)" i get all the OrganisationUnits in the domain. But i just cant seem to find the subentry objects that i need for the prescriptiveACI attribute. Here is the content of my Shiro.ini file activeDirectoryRealm = org.apache.shiro.realm.activedirectory.ActiveDirectoryRealmPermissions activeDirectoryRe…
tagged with: shiro
score: 3
downvote count: 0
favorite count: 0
tagged with: ldap

http://stackoverflow.com/comment/34321367
has text: possible duplicate of [java.lang.noclassdeffounderror: com.google.android.gms.R$styleable](http://stackoverflow.com/questions/14372391/java-lang-noclassdeffounderror-com-google-android-gms-rstyleable)
score: 1
comment on: http://stackoverflow.com/q/22550537
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34488727
type: Comment
has text: Am sorry guys but i dont understand anything about the ant and command line version of the compiler. Sorry, I just press RUN in eclipse and it compiles the code and stuff. Thanks for the answers, I'll try to learn about ant and stuff then I'll do what you guys say
comment on: http://stackoverflow.com/a/22644583
type: AnswerComment
score: 0

http://stackoverflow.com/q/22592168
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5645468
has answer: http://stackoverflow.com/a/22592507
tagged with: java
duplicate of: http://stackoverflow.com/q/5645468
has comment: http://stackoverflow.com/comment/34395641
type: Question
has comment: http://stackoverflow.com/comment/34396138
has title: XML and Android Java Mobile
score: 0
accepted answer: http://stackoverflow.com/a/22592507
answer count: 1
has comment: http://stackoverflow.com/comment/34395897
tagged with: android
has body: I am currently using Android SDK with Eclipse to make some Android App.. I found that anyone could use XML instead Visual programming in Eclipse so my question is : Why XML is used in Android Java Programming From my checking about XML .. it is a language used to transfer data over internet .. is that true and what is the relation with Android JAVA Programming Thanks

http://stackoverflow.com/comment/34260769
has text: That's unexpected because it apparently goes against what's written in the documentation. What JDK version are you on?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22516273
score: 0

http://stackoverflow.com/comment/34485155
type: AnswerComment
comment on: http://stackoverflow.com/a/22640453
score: 0
type: Comment
has text: I was wondering about this for a few minutes then i figured out a way to implement your answer with the Classification class. I really need to have that class. It's a required method. Thank you for the help!

http://stackoverflow.com/comment/34440174
comment on: http://stackoverflow.com/q/22616043
score: 0
type: Comment
type: QuestionComment
has text: @ArunM I did added hibernate jar to my project build path, please check the modification I made to my post

http://stackoverflow.com/a/22566830
accepted answer of: http://stackoverflow.com/q/22559007
has comment: http://stackoverflow.com/comment/34351716
type: AcceptedAnswer
downvote count: 0
has body: I don't like or support this code. If you want to have menus come sliding in from the left, I would use Screen transitions, with a 'transparent' screen on the right and menus on the left. Alternatively, since there is actually no sliding involved in this processing, you could display a popup screen on the left hand side. But this code seems to be making the BB try to look like some other phone. Why not use the supplied BB menu processing that the users are familiar with? Finally, I suspect this code will be a nightmare to use on a trackpad only device. Below is not nice code, but at least it works better than your current code. Please review and note the changes and implement as you see fit. Note that this is dubious: super.sublayout(maxWidth+300, maxHeight); // A setExtent(maxWidth, maxHeight); // B What you are saying in each line is as follows A - you can layout this Field to take 300 more pixels than I can actually give to this Field, so you can make it 300 pixels wider than I can actually display. B - despite the space that the layout takes, I will use the maximum I am allowed to for this Field. Anyway, here is my code, it seems to work, use it as you see fit, but I don't support it and would never use anything like this in a production program.... public final class MyScreen extends MainScreen { boolean val=false; private BrowserField contentField; public MyScreen() { final ButtonField l=new ButtonField("menu"); final HorizontalFieldManager hfm_main=new HorizontalFieldManager(); final VerticalFieldManager vfm_l=new VerticalFieldManager(){ protected void sublayout(int maxWidth, int maxHeight) { super.sublayout(280, maxHeight); setExtent(280, maxHeight); } protected void paint(Graphics g){ g.setBackgroundColor(Color.RED); g.clear(); super.paint(g); } }; final VerticalFieldManager vfm_r=new VerticalFieldManager(){ protected void sublayout(int maxWidth, int maxHeight) { int ourRequiredWidth = Display.getWidth(); super.sublayout(ourRequiredWidth, maxHeight); setExt…
answers question: http://stackoverflow.com/q/22559007
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/22509476
type: AnsweredQuestion
tagged with: java
has body: I have the following regex ^.*?((\yo\b.*?(cut me:)[\s\S]*))$ - with ms flags regex101 example As you can see it matched the first instance of "yo". I want it to match the very last instance of "yo" that is closest to "cut me". I need this to be multiline-dotall. How can I mod the regex so that I get the following matched output? Output (currently matches in red): yo keep this here Keep this here yo blah, blah, blah cut me: Allof this here should be deleted Exptected Output (what I want to match in red): yo blah, blah, blah cut me: Allof this here should be deleted
type: Question
has answer: http://stackoverflow.com/a/22509650
score: 0
answer count: 1
tagged with: pattern-matching
accepted answer: http://stackoverflow.com/a/22509650
has title: How to match last instance of token in pattern regex?
tagged with: regex

http://stackoverflow.com/q/22565819
has comment: http://stackoverflow.com/comment/34347777
has comment: http://stackoverflow.com/comment/34347556
answer count: 0
has comment: http://stackoverflow.com/comment/34348278
type: UnansweredQuestion
tagged with: swing
tagged with: java
tagged with: indexoutofboundsexception
type: Question
has comment: http://stackoverflow.com/comment/34348020
has comment: http://stackoverflow.com/comment/34348441
has title: IndexOutOfBoundsException when trying to show data in JTableB relating to JTable A when selecting a record from JTableA
score: 0
tagged with: sql
has body: I am trying to pass in a JTable object which has columns DiscountID and Name. I am basically trying to get a row of the first column which is selected in JTable A (a DiscountID) and upon this set data relating to this selected record in JTable B which is JTable5 in the rs.next() loop. The problem is I get the following error: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Vector.elementData(Vector.java:730) at java.util.Vector.elementAt(Vector.java:473) at javax.swing.table.DefaultTableModel.getValueAt(DefaultTableModel.java:649) at javax.swing.JTable.getValueAt(JTable.java:2717) at airvia.Model.setFlexiBands(Model.java:688) which is referring to this line: stmt.setObject(1, table.getValueAt(row, 0)); Here is the code to the relevant methods: public static void setFlexiBands(JTable table) { try { DiscountGUIView dgv = new DiscountGUIView(); Connection con = null; PreparedStatement stmt = null; ResultSet rs = null; con = DriverManager.getConnection("jdbc:mysql://localhost:3306/abpp034?user=abpp034&amp;password=120001772"); stmt = con.prepareStatement("SELECT UpperBound, PercentageRate FROM FlexiBand WHERE DiscountID = ?"); int row = table.getSelectedRow(); stmt.setObject(1, table.getValueAt(row, 0)); rs = stmt.executeQuery(); try { int i = 0; while (rs.next()) { dgv.getjTable5().setValueAt(rs.getInt("UpperBound"), i, 0); dgv.getjTable5().setValueAt(rs.getInt("PercentageRate"), i, 1); i++; } } finally { if (rs != null) { try { rs.close(); } catch (SQLException se) { System.out.println(se.getErrorCode()); } } if (stmt != null) { try { stmt.close(); } catch (SQLException se) { System.out.println(se.getErrorCode()); } } if (con != null) { try { con.close(); } catch (SQLException se) { System.out.println(se.getErrorCode()); } } } } catch (SQLException ex) { Logger.getLogger(Model.class.getName()).log(Level.SEVERE, null, ex); } } I am confused on how to solve this since I've called a JTable object elsewhere the same as this…

http://stackoverflow.com/comment/34464423
type: Comment
type: QuestionComment
has text: Why? I said that I think not managing the output stream, isn't it?
comment on: http://stackoverflow.com/q/22611099
score: 0

http://stackoverflow.com/a/22567036
has body: You should hold a reference to each node's parent. That way you can traverse back up the Graph when you find your destination. public class Node { String id; Node parent; ArrayList&lt;Node&gt; children; } When you start at your from destination set from.parent = null. When you find your destination, traverse back via StringBuffer path = new StringBuffer(destination.id); Node current = destination; while (current.parent != null) { path.append(current.id); current = current.parent; } This will give you the reverse path of the shortest distance between two cities. This is, of course, assuming that all of your edges have uniform costs.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22564962

http://stackoverflow.com/comment/34429708
type: Comment
comment on: http://stackoverflow.com/a/22611444
has text: Are you sure about the connection to SMTP host in your network. Telnet to the port. Refer http://www.simplescripts.de/smtp-check-port-25-telnet-command.htm and http://support.microsoft.com/kb/153119 Also check with your network administrator or mail service provider for the connection details
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34408629
has text: Sure, because an array is not a `LinearList`. Do you have a suitable constructor in your `ArrayLinearList` class that you can use for this?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22599222

http://stackoverflow.com/q/22517047
has body: I am trying to @Override a method in a class that might look like having a complex inheritance structure, but it should actually be quite simple, however I cannot get it to work. public interface Action { } public interface Result { } public interface Player&lt;A extends Action, R extends Result&gt; { default public &lt;P extends Player&lt;A, R&gt;&gt; void onPostAction(final P target, final A action, final R result) { } } abstract public class GesturePlayer&lt;A extends Action, R extends Result&gt; implements Player&lt;A, R&gt; { } abstract public class RPSPlayer extends GesturePlayer&lt;RPSGesture, RPSResult&gt; { } public class RPSHumanPlayer extends RPSPlayer { @Override public void onPostAction(final RPSPlayer target, final RPSGesture gesture, final RPSResult result) { } } I get the error on the @Override of the onPostAction, why can it not find the correct method to override? This is for a Rock-Paper-Scissors implementation for people wondering where the name comes from. The exact error message: method does not override or implement a method from a supertype My goal is to still use the current class, so for RPSHumanPlayer I would actually want to have this signature: public void onPostAction(final RPSHumanPlayer target, final RPSGesture gesture, final RPSResult result) { }
has answer: http://stackoverflow.com/a/22517188
upvote count: 6
type: UnansweredQuestion
score: 6
type: Question
tagged with: java
tagged with: overriding
has title: Overriding method with generics not working (no method found)
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34261712
tagged with: inheritance
favorite count: 0
has comment: http://stackoverflow.com/comment/34261661

http://stackoverflow.com/comment/34262254
type: AnswerComment
type: Comment
has text: I believe that's an error in the documentation. Maybe @Brice or Szczepan could confirm this.
comment on: http://stackoverflow.com/a/22517394
score: 0

http://stackoverflow.com/comment/34342374
has text: @Pshemo Fair enough. : )
comment on: http://stackoverflow.com/q/22562949
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22568255
type: Question
answer count: 1
has body: I am using http://commons.apache.org/proper/commons-fileupload/ to parse multipart form and extract an uploaded file. I am following this manual http://www.oreillynet.com/onjava/blog/2006/06/parsing_formdata_multiparts.html and fresh new documentation from inside that package. The request.getContentLength() is saying 700K and that is the code InputStream input = request.getInputStream(); MultipartStream mStream = new MultipartStream(input, boundArray, 94096 /*random number*/, null); boolean part = mStream.skipPreamble(); And the part is always false. Could anybody tell me why? Thank you!
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22569349
tagged with: apache-commons-fileupload
has title: Why the skipPreamble() return false?
tagged with: java
tagged with: servlets

http://stackoverflow.com/comment/34270325
type: QuestionComment
score: 0
has text: @stuntmania my objective is to pass something like this `Customer customer = new customer ("SampleFirstName","SampleLastName","0000","address@web.com");`
comment on: http://stackoverflow.com/q/22521784
type: Comment

http://stackoverflow.com/q/22602495
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/34413715
has answer: http://stackoverflow.com/a/22602771
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/34413877
score: -2
has answer: http://stackoverflow.com/a/22602609
tagged with: arrays
has comment: http://stackoverflow.com/comment/34413805
has answer: http://stackoverflow.com/a/22602619
has body: In the following code binchar is a char array having 98 elements and nv22 is an integer variable which has a different random value every time the program runs. The problem is it always gives me java.lang.ArrayIndexOutOfBoundsException :98 at the line ar[nv22-17]=binchar[l]; the while loop states l System.out.println("Enter a message"); Scanner ss= new Scanner(System.in); String s=ss.nextLine(); char[] ar=s.toCharArray(); len=ar.length; int l=0; while(l&lt;len) { for(int y=0; y&lt;25; y++) { for (int x=0;x&lt;20; x++) { ar[nv22-17]=binchar[l]; l++; } }
answer count: 3
has comment: http://stackoverflow.com/comment/34413831
has comment: http://stackoverflow.com/comment/34413863
favorite count: 0
has title: Array out of bounds exception despite loop condition being correct
type: UnansweredQuestion
downvote count: 2
tagged with: java

http://stackoverflow.com/comment/34349291
has text: Sorry.. my answer probably should have been a comment. :) What database are you using with Glassfish and Websphere? Oracle, presumably?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22566764
score: 0

http://stackoverflow.com/comment/34331962
type: Comment
has text: where is toHexString ?
comment on: http://stackoverflow.com/a/22557300
type: AnswerComment
score: 0

apache-camel
tags question: http://stackoverflow.com/q/22606597
tags question: http://stackoverflow.com/q/22542707
tags question: http://stackoverflow.com/q/22597227
tag name: apache-camel
tags question: http://stackoverflow.com/q/22561717
tags question: http://stackoverflow.com/q/22564666
tags question: http://stackoverflow.com/q/22523637
tags question: http://stackoverflow.com/q/22597123
tags question: http://stackoverflow.com/q/22516904
tags question: http://stackoverflow.com/q/22636143
type: Tag

http://stackoverflow.com/comment/34484229
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22640893
score: 0
has text: I think you are right although I'd prefer all the feature related code remain in the core game project. I'll post whatever I come up with.

http://stackoverflow.com/comment/34405711
has text: Now that you know how to post a question as well as you do, consider posting it anew, with an emphasis on more short-term speed fixes and the incorrect output issue as well. State it's a followup to this one, with a link. I've addressed the longer-term issues, which, unfortunately aren't much help given your situation, and I'm afraid I'm going out soon, so I'm not going to be much more help tonight. I apologize for the misunderstanding. It's great you've worked as you have to make this question as clear as it is. Just tweak its details to get some fresh help. Good luck.
type: Comment
comment on: http://stackoverflow.com/a/22596995
score: 0
type: AnswerComment

http://stackoverflow.com/q/22538160
score: 0
answer count: 1
tagged with: extjs
type: UnansweredQuestion
has title: ExtJs and Java: Updating combobox
has body: I have a VehicleType combobox created using ExtJs that is currently being populated by using a method called within Java using the following code VehicleType = this.VehicleType ; Ext.apply(VehicleType , { valueProvider: { getValues: VehicleTypeService.getVehicleTypes }, getDisplayValue: function(option) { return option.value; }, getServerValue: function(option) { return option; }, getInitValueParameters: function() { return [region, manufactuerTypeId, vehicleType]; } }, new Ext.controls.BaseSelectableMixin()); VehicleType.init(); The Java method being called is VehicleTypeService.getVehicleTypes and the parameters being passed into the Java method are the function getInitValueParameters. It is working fine when i load the page but if i change the combobox above this on the page (ManufactuerType: exact same as VehicleType only with different values) i want to refresh the VehicleType combobox based on what is selected What would be the best way of going about this? I have tried extending the ComboSelectable to add a handler but could not get this working Ext.controls.VehicleTypeComboSelectable = Ext.extend(Ext.controls.ComboSelectable, { initComponent: function() { Ext.controls.VehicleTypeComboSelectable.superclass.initComponent.call(this); this.on("render", this.init.createDelegate(this)); } ,init : function() { } ,handler : function() { } }); Ext.reg('ownershiptypecomboselectable', Extador.controls.OwnershipTypeComboSelectable);
has answer: http://stackoverflow.com/a/22551769
tagged with: java
type: Question
tagged with: javascript

http://stackoverflow.com/a/22522638
score: 0
answers question: http://stackoverflow.com/q/22522582
type: Answer
has body: Try using the add method instead. c.add(Calendar.DAY_OF_YEAR, -1);

http://stackoverflow.com/comment/34505572
comment on: http://stackoverflow.com/q/22627632
type: Comment
type: QuestionComment
has text: @nablex: if there are button clicks or links to be clicked for each file downloads, then it is definitely a problem isn't it?
score: 0

http://stackoverflow.com/a/22599222
answers question: http://stackoverflow.com/q/22599161
has comment: http://stackoverflow.com/comment/34409334
has body: The declaration should be or public boolean compare(LinearList&lt;? extends T&gt; other), so that the compiler knows that the objects that it's retrieving from other will be of type T or a subtype thereof.
has comment: http://stackoverflow.com/comment/34408769
has comment: http://stackoverflow.com/comment/34410624
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34409634
has comment: http://stackoverflow.com/comment/34410311
has comment: http://stackoverflow.com/comment/34409994
type: Answer
has comment: http://stackoverflow.com/comment/34408629
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22599161
score: 1
has comment: http://stackoverflow.com/comment/34408588
has comment: http://stackoverflow.com/comment/34409862

http://stackoverflow.com/a/22587470
score: 1
type: Answer
upvote count: 1
has body: Based on your updated code, `Holiday isn't comparable, so you can't use int index = Collections.binarySearch(Holidays.getAllHolidays(), new Holidays.Holiday(2014, 12, 25, null)); Instead, you changed your HolidayComparator to use DateTime's inbuilt comparability, for example... class HolidayComparator implements Comparator&lt;Holiday&gt; { public int compare(Holiday h1, Holiday h2) { return h1.getDate().compareTo(h2.getDate()); } }; You should be able to use Collections.binarySearch(List&lt;? extends T&gt; list, T key, Comparator&lt;? super T&gt; c)
answers question: http://stackoverflow.com/q/22587244
downvote count: 0

http://stackoverflow.com/comment/34359439
score: 0
type: Comment
type: QuestionComment
has text: What are you expecting from `System.in.read()`?
comment on: http://stackoverflow.com/q/22572024

http://stackoverflow.com/q/22603963
has body: I am working on my first android application. I need to display an image from a url in my app. I tried in the following way: Mainactivity file: public class MainViewActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_view); int loader = R.drawable.loader; // Imageview to show ImageView image = (ImageView) findViewById(R.id.image); // Image url String image_url = "http://..../landing.png"; // ImageLoader class instance ImageLoader imgLoader = new ImageLoader(getApplicationContext()); imgLoader.DisplayImage(image_url, loader, image); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main_view, menu); return true; } } Here i am getting an error in the line int loader = R.drawable.loader; The class file are: FileCache.java public class FileCache { private File cacheDir; public FileCache(Context context){ //Find the dir to save cached images if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) cacheDir=new File(android.os.Environment.getExternalStorageDirectory(),"TempImages"); else cacheDir=context.getCacheDir(); if(!cacheDir.exists()) cacheDir.mkdirs(); } public File getFile(String url){ String filename=String.valueOf(url.hashCode()); File f = new File(cacheDir, filename); return f; } public void clear(){ File[] files=cacheDir.listFiles(); if(files==null) return; for(File f:files) f.delete(); } } ImageLoader.java public class ImageLoader { MemoryCache memoryCache=new MemoryCache(); FileCache fileCache; private Map&lt;ImageView, String&gt; imageViews=Collections.synchronizedMap(new WeakHashMap&lt;ImageView, String&gt;()); ExecutorService executorService; public ImageLoader(Context context){ fileCache=new FileCache(context); executorService=Executors.newFixedThreadPool(5); } int stub_id = R.d…
tagged with: android
has answer: http://stackoverflow.com/a/22604101
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34416513
tagged with: java
has comment: http://stackoverflow.com/comment/34416599
has comment: http://stackoverflow.com/comment/34416122
has answer: http://stackoverflow.com/a/22604148
upvote count: 1
has comment: http://stackoverflow.com/comment/34416104
downvote count: 1
type: Question
tagged with: imageview
accepted answer: http://stackoverflow.com/a/22604101
has comment: http://stackoverflow.com/comment/34416622
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34416331
favorite count: 0
possible better answer: http://stackoverflow.com/a/22604699
has comment: http://stackoverflow.com/comment/34416038
has title: How to display an image from a url in android
has comment: http://stackoverflow.com/comment/34416057
has answer: http://stackoverflow.com/a/22604699

http://stackoverflow.com/comment/34310918
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22542874
has text: so what does your result look like?

http://stackoverflow.com/comment/34505824
type: AnswerComment
score: 0
type: Comment
has text: so how exactly would i test this locally on my own computer?
comment on: http://stackoverflow.com/a/22634624

http://stackoverflow.com/q/22566590
tagged with: bufferedimage
type: Question
has comment: http://stackoverflow.com/comment/34348901
has title: Disable dithering on a TYPE_BYTE_INDEXED BufferedImage
accepted answer: http://stackoverflow.com/a/22612739
score: 0
tagged with: dithering
has comment: http://stackoverflow.com/comment/34369031
answer count: 1
has comment: http://stackoverflow.com/comment/34431677
has comment: http://stackoverflow.com/comment/34348825
has answer: http://stackoverflow.com/a/22612739
type: AnsweredQuestion
has body: I have a 256-color BufferedImage on which I want to draw another BufferedImage (> 256 colors). Java's default behaviour is to dither colors which cannot be representeed in the low-color model. I want to disable this (thus choosing the next best color available in the low-color model), so i tried to use RenderingHints to specify a new rendering behaviour but it does not work: public BufferedImage filter(BufferedImage src) { BufferedImage convertedImage = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_BYTE_INDEXED); Graphics2D g2d = (Graphics2D) convertedImage.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE); g2d.drawImage(src, 0, 0, null); return convertedImage; } Ideas? UPDATE: I solved the problem by drawing the new image pixel-by-pixel which may not be very fast, but it works. See my answer for details.
tagged with: java
tagged with: image-processing

http://stackoverflow.com/a/22568844
answers question: http://stackoverflow.com/q/22568641
upvote count: 3
has comment: http://stackoverflow.com/comment/34353379
has body: Your crash occurs at this line: os=socket.getOutputStream(); My guess is that you need to close the Socket object as well. You can either do it in a finally block try { // .. your code here .. } catch (Exception e) { // handle exception } finally { if (socket != null) { socket.close() } } or in the onDestroy() method, for example @Override protected void onDestroy() { if (socket != null) { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } if (serversocket != null) { try { serversocket.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // call the super method **after** you have closed your objects! super.onDestroy(); }
has comment: http://stackoverflow.com/comment/34353335
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/34353088
downvote count: 0
has comment: http://stackoverflow.com/comment/34353120

http://stackoverflow.com/comment/34538855
type: Comment
comment on: http://stackoverflow.com/a/22642420
score: 0
type: AnswerComment
has text: Maybe I was mistaken about the parameter, but check this question which addresses that problem, it might help: http://stackoverflow.com/q/12929197/1085483

http://stackoverflow.com/comment/34222717
comment on: http://stackoverflow.com/a/22494322
type: AnswerComment
has text: You could write `next = null;` but you don't need to. Instance variables of object type always default to null.
type: Comment
score: 1

http://stackoverflow.com/q/22505414
accepted answer: http://stackoverflow.com/a/22505699
has comment: http://stackoverflow.com/comment/34240947
answer count: 3
has comment: http://stackoverflow.com/comment/34240806
has comment: http://stackoverflow.com/comment/34240853
has title: Counting the vowels included between two consonants
downvote count: 0
has answer: http://stackoverflow.com/a/22505630
tagged with: string
favorite count: 0
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/22505805
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34240462
has answer: http://stackoverflow.com/a/22505805
type: Question
has comment: http://stackoverflow.com/comment/34240348
has answer: http://stackoverflow.com/a/22505699
has body: I'm trying to find, from a sentence, the words that contains two vowels between two r using java. So I read in the sentence and then I have to find the words that match the criteria described above. For instance if I have a string such as: "roar soccer roster reader" the method matches should return true for the words "roar" and "roster" This is the method I come up with, which is doing the job public boolean matches(String singleWord) { // set count to -1. it will increase to 2 if a 'r' is found, it decreases for each vowel int count = -1; // loop through a single word for (int i=0; i&lt;singleWord.length(); i++){ // if a 'r' is found set the count to two if(singleWord.charAt(i) == 'r'){ // when count it's 0 exit loop if (count == 0) return true; count = 2;} // if I find a vowel count decreases else if(isVowel(singleWord.charAt(i))){ count--;} } return false; } but it seems a bit clumsy... any suggestion on how to improve it or make it simpler? thanx!!! just in case, this is the isVowel method private boolean isVowel(char c) { String s = c + ""; return "aeiou".contains(s); }

http://stackoverflow.com/comment/34366313
has text: @deviantfan And what? You can change my code leaving `println("a")` alone. This will never print neither "B" nor "C" ever. And what? Certainly, the two different pieces of code can be changed independently and, thus, loose the coherence. How does it make that two alternative implementatins, which have the same semantics are "different". How do you define equality? I can always define it the way that you have nothing identical.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22576231

http://stackoverflow.com/q/22611559
score: 0
has answer: http://stackoverflow.com/a/22612006
has answer: http://stackoverflow.com/a/22635069
answer count: 4
has title: Unable to create managed bean, Property for managed bean aircraftMB does not exist
linked to: http://stackoverflow.com/q/14766345
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22625598
has body: I found a lot of solutions about this matter, but no one solved my issue. Here's my managed bean: import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.RequestScoped; import com.bombardier.domain.Aircraft; import com.bombardier.domain.WorkPackage; import com.bombardier.services.DBDataManipulatorService; @ManagedBean(name = "aircraftMB") @RequestScoped public class AircraftManagedBean implements Serializable{ private static final long serialVersionUID = 1L; //Spring User Service is injected... @ManagedProperty(value="#{DBDataManipulatorServiceImpl}") DBDataManipulatorService dbDataManipulatorService; List&lt;Aircraft&gt; aircrafts; private int aircraftId; private String type; private String model; private Map&lt;String, WorkPackage&gt; workPackagesMap; public List&lt;Aircraft&gt; getAircrafts() { aircrafts = new ArrayList&lt;Aircraft&gt;(); aircrafts = dbDataManipulatorService.findAllAircrafts(); return aircrafts; } public DBDataManipulatorService getDBDataManipulatorServiceImpl() { return dbDataManipulatorService; } public void setDBDataManipulatorServiceImpl(DBDataManipulatorService dbDataManipulatorService) { this.dbDataManipulatorService = dbDataManipulatorService; } public void setAircrafts(List&lt;Aircraft&gt; aircrafts) { this.aircrafts = aircrafts; } public int getAircraftId() { return aircraftId; } public void setAircraftId(int aircraftId) { this.aircraftId = aircraftId; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public Map&lt;String, WorkPackage&gt; getWorkPackagesMap() { return workPackagesMap; } public void setWorkPackagesMap(Map&lt;String, WorkPackage&gt; workPackagesMap) { this.workPackagesMap = workPackagesMap; } } and my service is as follow: @Servic…
has answer: http://stackoverflow.com/a/22612710
tagged with: spring
tagged with: jsf
tagged with: primefaces
tagged with: java
type: Question

http://stackoverflow.com/comment/34343534
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22546857
has text: Sure you can. Look this: http://stackoverflow.com/questions/12739909/send-data-from-activity-to-fragment-in-android Use bundle.putInt. http://developer.android.com/reference/android/os/Bundle.html#putInt(java.lang.String, int)
type: Comment

http://stackoverflow.com/a/22625961
score: 0
has body: Generally float uses 4 bytes and double uses 8 bytes to store the value in a floating point (mantissa + exponent) format/representation. See this wikepedia write-up for an intro to these concepts if you are interested: http://en.wikipedia.org/wiki/Floating_point
answers question: http://stackoverflow.com/q/22625924
type: Answer

http://stackoverflow.com/q/22521080
tagged with: object
type: AnsweredQuestion
tagged with: oop
upvote count: 9
tagged with: java
has title: Do java objects share method location in memory?
tagged with: memory
score: 9
type: Question
has body: Consider this class: public class Test { private int bar = 5; public void foo () { System.out.println("hi"); } } Now imagine we have the following section of code executing: Test obj1 = new Test(); Test obj2 = new Test(); Test obj3 = new Test(); All three objects exist in the same scope. Because bar is not static, there will be three separate instances of bar in memory. Are there three instances of the method foo in memory? Does the JVM do some magic so that each object can use one method declaration in memory? Is there a name for this situation so that I can see if other languages do it?
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/19323060
has answer: http://stackoverflow.com/a/22521246
answer count: 3
possible better answer: http://stackoverflow.com/a/22521100
has answer: http://stackoverflow.com/a/22521100
has answer: http://stackoverflow.com/a/22521196
accepted answer: http://stackoverflow.com/a/22521246

http://stackoverflow.com/comment/34453626
type: Comment
score: 1
type: AnswerComment
has text: @Arkant0r: I think it is not possible to specify the stack size from the java source code because it would be a security risk.
comment on: http://stackoverflow.com/a/22624047

http://stackoverflow.com/comment/34416185
type: Comment
has text: Could you post your full Spring-Security configuration?
comment on: http://stackoverflow.com/q/22604064
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34413904
type: Comment
type: QuestionComment
score: 0
has text: This may be off topic, I'm not sure because I don't claim to fully follow your requirement from your description. But, given the rapid trend away from client-side Java and other browser plugins, including the multiple dire security warnings most browsers will open when encountering applets, would you be better off implementing your logic as server-side Java, computing your reduced page with a Servlet? Is your supervisor insisting on client-side Java specifically, or is server-side Java allowed?
comment on: http://stackoverflow.com/q/22602366

izpack
tag name: izpack
tags question: http://stackoverflow.com/q/22549727
type: Tag

http://stackoverflow.com/comment/34310188
has text: 'I tried a few regex but nothing came close'. Could we see the one which appeared the closest to you?
comment on: http://stackoverflow.com/q/22544217
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34325741
comment on: http://stackoverflow.com/q/22553549
type: Comment
type: QuestionComment
score: 0
has text: `{true, true, true, true}` is not valid Java syntax, except for in `new something[] {true, true, true, true}` or `something[] something = {true, true, true, true}`

http://stackoverflow.com/comment/34421962
type: Comment
comment on: http://stackoverflow.com/a/22607133
score: 0
type: AnswerComment
has text: Thanx :) I have read about Apache POI but is it possible to do same with jxl library ?

http://stackoverflow.com/a/22516366
upvote count: 1
has body: To go a little down the rabbit hole. Solving Sudoko seems like an application of Constraint-Satisfaction in a context similar to the N-Queens Problem A MIN-CONFLICTS algorithm can be used in combination with Simulated Annealing to find the optimal solution. Consider this pseudocode from Peter Norvig's Artificial Intelligence a Modern Approach function MIN-CONFLICTS(csp, max_steps) returns a solution or failure inputs: csp, a constraint satisfaction problem max_steps, the number of steps allowed before giving up current &lt;- an initial complete assignment for csp for I = 1 to max_steps do if current is a solution for csp then return current var &lt;- a randomly chosen conflicted variable from csp.VARIABLES value &lt;- the value v for var that minimizes CONFLICTS(var, v, current, csp) set var = value in current return failure The CONFLICTS function counts the number of constraints violated by a particular value, given the rest of the current assignment.
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22515368

http://stackoverflow.com/a/22491546
type: Answer
has body: you can get the local variable's from your thread, because if a local variable is a currently a live, then that means the only reference for that variable is its own thread. So first you need to list your current threads, and you can do that by: Click on the objects options button from the actions bar . Select Java Basics -> Threads Overview and Stacks. Then to list the object for a specific Thread: Right Click -> List Object -> OutGoing references Then Search for your local variable with in a tag &lt;Java Local&gt;
score: 18
upvote count: 18
answers question: http://stackoverflow.com/q/22491527
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34217706
accepted answer of: http://stackoverflow.com/q/22491527
downvote count: 0

http://stackoverflow.com/comment/34330406
has text: I understood it it now.One last one, so subclass object itself has all the functionalities of itself and superclass. The size of subclass object should be larger than superclass then? Because it includes superclass as well.Is it so?
type: Comment
comment on: http://stackoverflow.com/a/22556288
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34341403
type: QuestionComment
type: Comment
score: 0
has text: IndexWriter is created with using IndexWriterConfig and using the StandardAnalyzer. Basically when I used the multiFieldParser I'm only seem to be getting results when 2 fields match. I would like to return hits when there is a match one 1 or more fields.
comment on: http://stackoverflow.com/q/22562277

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/22570385

http://stackoverflow.com/comment/34377423
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22582313
type: QuestionComment
has text: Sorry I accidentally deleted my comment "Is this Hibernate?", to which the OP responded "Yes". I have updated tag accordingly.

http://stackoverflow.com/a/23859682
upvote count: 3
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/36722861
accepted answer of: http://stackoverflow.com/q/22625457
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22625457
has body: I guess you will have to use JSONObject and JSONArray to get it work. Use this uri to get the tweets: http://api.tweeter.com/1/statuses/user_timeline.json?screen_name= Also tweets can be obtained from using following code: new Read().execute("text") where text has the actual tweet. You can then use StringBuilder and append the username to the URI as mentioned above.

http://stackoverflow.com/comment/34304326
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22540634
has text: thanks for you help, this could help, but my problem is to define the query with differents kind of terms as describe above

http://stackoverflow.com/comment/34403176
has text: @NiklasB.Nice catch! If the input array is [0,32,64] the code bombs! Any idea how to tackle this?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22594212

http://stackoverflow.com/comment/34450352
has text: What happens when you run the code? How does it "not work"?
type: QuestionComment
comment on: http://stackoverflow.com/q/22622761
type: Comment
score: 0

http://stackoverflow.com/a/22621356
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34457711
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22619924
has body: You can't pass it as an ArrayList, but you can read it as a String[] if you give all the inputs you want in the array the same name. &lt;input name='test' /&gt; &lt;input name='test' /&gt; &lt;input name='test' /&gt; In your servlet, use request.getParameterValues(name) (which returns a String[]) rather than request.getParameter(name) which only returns one value. String[] testValues = request.getParameterValues("test");

http://stackoverflow.com/comment/34308013
has text: not really..may be I was confused .I just wanted confirmation that whenever I will pull my data from data.txt it will be in byte array format I think I got my answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22540780
type: AnswerComment

http://stackoverflow.com/comment/34289984
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22533152
has text: "That case" means "no exception" and "the other return" is the one after the finally block, right? (Just to make that clear)
type: AnswerComment

http://stackoverflow.com/comment/34249417
has text: golden (or master, or reference) screenshot is one which you expect your application to produce. Thus comparing current screenshot with golden one you can find out if application works correctly.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22509772

http://stackoverflow.com/q/22600606
score: -3
has comment: http://stackoverflow.com/comment/34410383
has comment: http://stackoverflow.com/comment/34410520
has title: Error while attempting null check
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/34410406
tagged with: collections
linked to: http://stackoverflow.com/q/19511616
has body: I am checking for null before doing a certain operation but I have run into some issues. Following is the code: if (c != null &amp;&amp; c.size() != null) { if (c.size() &gt; 0) { return (Application) c.toArray()[0]; } I am getting a 'The operator != is undefined for the argument type(s)int, null' at the point c.size() != null. I understand the return type for the size method is an integer, is that why I am getting this error? Hope someone can advise. Thank you.
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/22600675
tagged with: int
has answer: http://stackoverflow.com/a/22600679
has comment: http://stackoverflow.com/comment/34410405
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22600876
type: Question
has title: How do I know when a session is first created in Vaadin 7.x?
tagged with: session
has answer: http://stackoverflow.com/a/22604739
has body: I'd like to know the first time a session is created in Vaadin so I can write various data that'll be kept from request to request. Some kind of application-level listener for when a session is created/destroyed. Is this possible? -- Shane
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
tagged with: vaadin7
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22604739

http://stackoverflow.com/q/22607995
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/22518300
tagged with: libgdx
has comment: http://stackoverflow.com/comment/34423344
has answer: http://stackoverflow.com/a/22608311
has body: I'm creating a quiz in Libgdx and am trying to find the best solution for storing the questions and answers since they don't support sqlite. I've never coded in json before so trying that out was pretty hard. I also tried it out with the shared preferences which worked good with a few questions but unsure on say 500 questions. I also tried XML storage which worked out too. My question is for an app that will have say 500 questions/answers what would be the best choice here?
score: 0
answer count: 1
has title: Libgdx Quiz Storage
accepted answer: http://stackoverflow.com/a/22608311
tagged with: android
duplicate of: http://stackoverflow.com/q/22518300
type: AnsweredQuestion

http://stackoverflow.com/comment/34249390
score: 0
comment on: http://stackoverflow.com/q/22510477
type: Comment
has text: When you double *n*, does the number of times your loop runs double? Or does it add a constant?
type: QuestionComment

http://stackoverflow.com/comment/34317860
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22547864
score: 0
has text: @user3067497 could you expand upon the requirements a little clearer?

http://stackoverflow.com/a/22621277
answers question: http://stackoverflow.com/q/22621194
has comment: http://stackoverflow.com/comment/34448387
score: 0
type: Answer
has body: dateCreated is only an attribute / variable of SimpleGeometricObject. So the dateCreated is of type Date, and you technically call the constructor of this using: dateCreated = new java.util.Date();

http://stackoverflow.com/a/22508455
has comment: http://stackoverflow.com/comment/34245844
has body: You have to read the whole stream for that. Streams are probably not even complete when you start reading from them, so the size may not be known at that time.
has comment: http://stackoverflow.com/comment/34245771
has comment: http://stackoverflow.com/comment/34245710
downvote count: 0
has comment: http://stackoverflow.com/comment/34246409
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22508428
upvote count: 2
has comment: http://stackoverflow.com/comment/34245805

http://stackoverflow.com/comment/34468586
type: QuestionComment
has text: Well this will help and it helps me :) http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-06
score: 0
comment on: http://stackoverflow.com/q/22631746
type: Comment

http://stackoverflow.com/comment/34274695
score: 0
has text: All applications that rely on the C++ redistribution or .Net libraries or DirectX or OpenGL install them as part of there installation process...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22524337

http://stackoverflow.com/q/22639080
upvote count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22639620
downvote count: 1
tagged with: arrays
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34479449
has title: Android JAVA how to check if some index of char array is empty
has answer: http://stackoverflow.com/a/22639616
has body: I m working with an array of characters in java. The array can have some missing entries in the middle and I need to know the leftmost index that is empty My code for that is private int checkMissingEntry(){ int p = 0; for(int i = characterArray.length - 1; i &gt;= 0; i--){ if (characterArray[i] == ' '){ p = i; } else{ } } return p; } However, characterArray[i] == ' ' does not detect empty character, the code always returns whatever p was originally assigned to, in this case 0. the if statement never gets executed. I tried '\0' and '\u0000' but none seems to work. What is the solution?
has comment: http://stackoverflow.com/comment/34479037
favorite count: 0
type: Question
answer count: 2

http://stackoverflow.com/q/22490321
type: Question
upvote count: 1
tagged with: sikuli
answer count: 1
has answer: http://stackoverflow.com/a/22490710
favorite count: 0
type: UnansweredQuestion
has title: sikuli 1.0.2 documentation and ScreenRegion
has body: I'm writing program in Java, using Sikuli. I'm using sikuli-standalone***.jar, and ScreenRegion class inside of it. The problem is in documentation: http://doc.sikuli.org/ I can't find class ScreenRegion there, but I can find Screen, and Region, which have better methods (concluding by their names) than ScreenRegion. But unfortunately I don't have these classes in my library. Acctually this does not result in compiler error: Screen screen = screenRegion1.getScreen(); But this does: Screen screen2 = new Screen(); Error is: "Cannot instantiate type Screen" ScreenRegions seems OK, but because there is no documentation I don't know how to move/create new ScreenRegion that is moved 50px to the right on global screen. What should I do? What I'm doing wrong? Is there Java documentation for Sikuli?
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/34434847
comment on: http://stackoverflow.com/q/22614290
score: 0
type: Comment
type: QuestionComment
has text: There's no assertion in your test, so you need to use `import static org.junit.Assert.*;` and add `assertTrue("Incorrect user/pwd combination", valueFound);`. Also in the catch clause you should probably have a `fail(e.getMessage)` or just make the test throw wxceptions.

http://stackoverflow.com/comment/34443629
type: Comment
comment on: http://stackoverflow.com/a/22618896
has text: Luiggi Mendoza, what is CDI?
score: 0
type: AnswerComment

http://stackoverflow.com/q/22560998
has answer: http://stackoverflow.com/a/22571423
has title: RSA algorithm PKCS #1.5 padding (not OEAP) password encryption with client certificate public key in Java
tagged with: encryption
tagged with: cryptography
type: UnansweredQuestion
score: 1
tagged with: verisign
tagged with: java
upvote count: 1
type: Question
tagged with: rsa
has body: I am new to RSA algorithm and cryptography in Java. I have a client certificate provided by the 3rd party organization which is in .cer format. Now I need to encrypt my password with the public portion of the password key certificate, using the RSA algorithm and PKCS #1.5 padding - so not OAEP - in Java. Could you check if the following does perform the above? Security.addProvider(neworg.bouncycastle.jce.provider.BouncyCastleProvider()); byte[] input = "Abc123".getBytes(); Cipher cipher = Cipher.getInstance("RSA/None/PKCS1Padding", "BC"); FileInputStream fin = new FileInputStream(new File("/test.cer")); CertificateFactory f = CertificateFactory.getInstance("X.509"); X509Certificate certificate = (X509Certificate)f.generateCertificate(fin); PublicKey pk = certificate.getPublicKey(); cipher.init(Cipher.ENCRYPT_MODE, pk, new SecureRandom()); byte[] cipherText = cipher.doFinal(input);
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/22637502
answers question: http://stackoverflow.com/q/22637410
score: 0
has body: The algorithms themselves don't take files. The code probably takes the file and reads it in as a series of Strings, which are fed to the algorithm. You just need to look at the part of the code that reads the Strings in from the file, and pass the Strings in yourself in a similar way.
type: Answer

http://stackoverflow.com/comment/34375875
has text: I used that to get and set a list of all my cart. Is that the one that causes the problem ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22581324

http://stackoverflow.com/q/22596041
has answer: http://stackoverflow.com/a/22596070
has answer: http://stackoverflow.com/a/22596392
has title: Calling method from one class to another
type: AnsweredQuestion
has body: Starting to learn about UML diagrams, and how to interact between classes. Stuck on how to call this method from the Player class to the main method class. (MY instructions say I'm not allowed to use constructors) Player class = public String askForGuess() { System.out.println("Enter your guess: "); String userGuess = keyboard.nextLine(); return userGuess; } Bagel class(includes main method, trying to call the askForGuess method Player.askForGuess(); //Java is saying I need to change it to static, is that true?
score: 0
has answer: http://stackoverflow.com/a/22596127
tagged with: java
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/22596127
answer count: 3
possible better answer: http://stackoverflow.com/a/22596070

http://stackoverflow.com/q/22538132
tagged with: java
has comment: http://stackoverflow.com/comment/34299052
has comment: http://stackoverflow.com/comment/34303754
has comment: http://stackoverflow.com/comment/34300366
type: Question
has title: Chain of Responsibility: remainder algorithm?
tagged with: algorithm
has body: In the following method I am trying to do the following: If you have at least £20: Work out the number of £20 notes Work out what’s left (remainder) – pass it on to the next handler If you have less that £20 – call the next handler Note: The program is for an ATM dispenser, that dispenses notes (20, 10, 5) dependent on the what (amount) the user needs. Below is my solution so far, I need help to correct the algorithm @Override public void issueNotes(int amount) { //work out amount of twenties needed if(amount &gt;= 20) { int dispenseTwenty; int remainder; dispenseTwenty = amount%20; remainder = amount = //call next handler? } else { //call next handler (as amount is under 20) } }
has answer: http://stackoverflow.com/a/22548592
score: 0
has comment: http://stackoverflow.com/comment/34299461
answer count: 2
tagged with: handler
has comment: http://stackoverflow.com/comment/34319549
has comment: http://stackoverflow.com/comment/34300136
has comment: http://stackoverflow.com/comment/34299973
has comment: http://stackoverflow.com/comment/34334357
has answer: http://stackoverflow.com/a/22562956
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34299170
has comment: http://stackoverflow.com/comment/34300271
tagged with: chain-of-responsibility
has comment: http://stackoverflow.com/comment/34299352

http://stackoverflow.com/comment/34320500
has text: It is java...but no method with the name fieldname.
type: Comment
comment on: http://stackoverflow.com/a/22514799
score: 0
type: AnswerComment

http://stackoverflow.com/q/22600964
type: UnansweredQuestion
tagged with: android
answer count: 0
has comment: http://stackoverflow.com/comment/34411190
has comment: http://stackoverflow.com/comment/34411151
type: Question
has comment: http://stackoverflow.com/comment/34423119
tagged with: java
has comment: http://stackoverflow.com/comment/34411585
has body: The following is a method from my android program and when called it is being sent into an infinite loop. Any help would be greatly appreciated. If you need the stacktrace to solve this, it might not being possible because it is around 30,000 lines long once this infinite loop starts. AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Enter a Title:"); final EditText input = new EditText(this); input.setInputType(InputType.TYPE_CLASS_TEXT); builder.setView(input); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { inputtext = input.getText().toString(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); try { Thread.sleep(100); } catch (InterruptedException e1) { e1.printStackTrace(); } ShoppingList list = new ShoppingList(this.getFilesDir() + inputtext); while(stop == 0) { AlertDialog.Builder builder2 = new AlertDialog.Builder(this); builder.setTitle("Enter an item:"); final EditText input2 = new EditText(this); input2.setInputType(InputType.TYPE_CLASS_TEXT); builder.setView(input2); builder.setPositiveButton("Add", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { inputtext = input.getText().toString(); } }); builder.setNegativeButton("Stop", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); stop = 1; } }); builder2.show(); try { list.addItem(inputtext); } catch (IOException e) { e.printStackTrace(); } }
score: 0
has comment: http://stackoverflow.com/comment/34411149
has title: Android DialogInterface Infinite loop

http://stackoverflow.com/comment/34232248
score: 0
type: QuestionComment
type: Comment
has text: What would the JavaBean empower you to do, that the `HttpServletRequest` doesn't?
comment on: http://stackoverflow.com/q/22500447

http://stackoverflow.com/q/22539973
has comment: http://stackoverflow.com/comment/34414042
has comment: http://stackoverflow.com/comment/34473533
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22636574
upvote count: 2
downvote count: 2
has title: making process wait
type: Question
has body: I am using the following code to run terminal commands through my command prompt String[] command = { "zsh" }; Process p = Runtime.getRuntime().exec(command); new Thread(new SyncPipe(p.getErrorStream(), b)).start(); new Thread(new SyncPipe(p.getInputStream(), b)).start(); PrintWriter stdin = new PrintWriter(p.getOutputStream()); stdin.println("source ./taxenv/bin/activate"); stdin.println("python runner.py"); stdin.close(); int returnCode = 0; try { returnCode = p.waitFor(); String path2 = b + "/logs.txt"; // I am getting b value passed in from gc.jsp if(new File(path2).exists()) { BufferedReader reader = new BufferedReader(new FileReader(path2)); while ((line1 = reader.readLine()) != null) { content= content + line1 +"&lt;br&gt;"; } reader.close(); request.setAttribute("logs", content); RequestDispatcher rd = request.getRequestDispatcher("gc.jsp"); rd.forward(request, response); } } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Return code = " + returnCode +b); } class SyncPipe implements Runnable { public SyncPipe(InputStream istrm, String c) { istrm_ = istrm; b_ = c; } @SuppressWarnings("unused") public void run() { try { final byte[] buffer = new byte[1024]; for(int length = 0; (length = istrm_.read(buffer)) != -1; ) { str = str + IOUtils.toString(istrm_, "UTF-8") + b_; } System.out.println(str); String location = b_ + "/" + "logs.txt"; File file = new File(location); if(!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(str); bw.close(); } catch (Exception e) { e.printStackTrace(); } } private final InputStream istrm_; private final String b_; When I run this code I expect it to be re directed to gc.jsp, but it displays as follows Now, When I refresh the above page I am getting output as expected, shown below. Why is this happening and how do I solve this? =============================EDIT========================== I've added bw.clos…
has comment: http://stackoverflow.com/comment/34321201
has comment: http://stackoverflow.com/comment/34473516
tagged with: java
has comment: http://stackoverflow.com/comment/34412205
has comment: http://stackoverflow.com/comment/34321187
linked to: http://stackoverflow.com/q/5483830
has comment: http://stackoverflow.com/comment/34413416
accepted answer: http://stackoverflow.com/a/22636574
has comment: http://stackoverflow.com/comment/34412045
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34321151
favorite count: 0
has comment: http://stackoverflow.com/comment/34413725

http://stackoverflow.com/comment/34284191
score: 1
comment on: http://stackoverflow.com/q/22529945
type: Comment
type: QuestionComment
has text: Which line does the exception happen on?

http://stackoverflow.com/comment/34423078
score: 0
comment on: http://stackoverflow.com/q/22608069
type: Comment
type: QuestionComment
has text: right click > New > package

http://stackoverflow.com/q/22494917
downvote count: 2
has comment: http://stackoverflow.com/comment/34223776
upvote count: 1
tagged with: depth-first-search
has answer: http://stackoverflow.com/a/22495107
has title: DFS isn't working on 2d array
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34223863
score: -1
type: Question
has comment: http://stackoverflow.com/comment/34223675
accepted answer: http://stackoverflow.com/a/22495107
tagged with: arrays
answer count: 1
tagged with: neighbours
has comment: http://stackoverflow.com/comment/34224019
favorite count: 0
has body: So I have a a 2darray of colors. The colors are represented by numbers. I have made a dfs that currently only checks for the number 1, which is red. I don;t think I hav the code right. I have a get neighbors that does get the neighbors around the node it is at and adds them to a list. The boards is the array of ints and the visited is an array of true or false if the node has been visited. Here is my dfs: private int dfs(int startRow, int startCol, int[][]boards, boolean[][] visitedd){ int f; int t; visitedd[startRow][startCol] = true; for(; startRow &lt; q; startRow++){ for(; startCol &lt; q; startCol++){ if(boards[startRow][startCol] == 1 &amp;&amp; visitedd[startRow][startCol] == false){ g+=1; f = startRow; t = startCol; dfs(f, t, boards, visitedd); } } } return g; I'm not sure how to use the get neighbors to properly traverse to the next red.

http://stackoverflow.com/a/22602075
accepted answer of: http://stackoverflow.com/q/22601406
score: 0
answers question: http://stackoverflow.com/q/22601406
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34468394
type: Answer
has body: Any .java file that extends Activity class has associated Layout.xml file most probably. And any of this class who has layout.xml should be defined in Androidmanifest.xml file's Activity tag under intent Filter. Now coming to your question when you have created your Android Application using eclipse, you have selected a blank activity so automatically eclipse generated Android layout file and corresponding Main Activity java class then in Android manifest it says Main launcher path like below: &lt;activity android:name="com.yourpackage.urclassname" 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; &lt;/activity&gt; Now, you want java file sync up for your developed Layout files, Its Quite simple to do. Just create a . java file in you package and extend its with Activity. Now you will have to override default super class function i.e onCreate(Bundle savedInstanceState) and simply add setContentView(R.layout.activity_calculator); where activity_calculator is xml file in my case and you are done... I hope this answer your question ?

listview
tags question: http://stackoverflow.com/q/22522875
tags question: http://stackoverflow.com/q/22493734
tags question: http://stackoverflow.com/q/22539015
tags question: http://stackoverflow.com/q/22489947
tags question: http://stackoverflow.com/q/22514015
tags question: http://stackoverflow.com/q/22607567
tags question: http://stackoverflow.com/q/22557414
tags question: http://stackoverflow.com/q/22505580
tags question: http://stackoverflow.com/q/22603275
tags question: http://stackoverflow.com/q/22587383
tag name: listview
tags question: http://stackoverflow.com/q/22618698
tags question: http://stackoverflow.com/q/22616782
tags question: http://stackoverflow.com/q/22602457
tags question: http://stackoverflow.com/q/22583935
tags question: http://stackoverflow.com/q/22607246
tags question: http://stackoverflow.com/q/22509629
tags question: http://stackoverflow.com/q/22613479
tags question: http://stackoverflow.com/q/22640457
tags question: http://stackoverflow.com/q/22592208
tags question: http://stackoverflow.com/q/22500113
tags question: http://stackoverflow.com/q/22556415
tags question: http://stackoverflow.com/q/22613770
tags question: http://stackoverflow.com/q/22508747
tags question: http://stackoverflow.com/q/22603410
tags question: http://stackoverflow.com/q/22500126
type: Tag
tags question: http://stackoverflow.com/q/22591793
tags question: http://stackoverflow.com/q/22581360

http://stackoverflow.com/q/22502864
type: Question
tagged with: jsoup
downvote count: 0
has comment: http://stackoverflow.com/comment/34236769
answer count: 1
has answer: http://stackoverflow.com/a/22503375
favorite count: 0
has body: I tried to obtain text from those div tags but they all return nothing: HTML : التعليقات (23) 1 *محمد * 17 جمادى الأولى 1435 | 12:46 AM 5 - 0 هؤلاء أشخاص لم يجدوا سبيلاً لطلب الرزق إلا بهذه الطريقة فكفاكم تضييقاً وخناقاً عليهم حتى في مصادر رزقهم .... I wanna get the div class "message" and the text inside h4 tag and span "date-time" I tried to: document.select("div.message"); And: document.select("div.comments").select("div.message"); But they didn't work.
has comment: http://stackoverflow.com/comment/34237675
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34237019
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22503375
has title: Parsing HTML div tag using Jsoup
upvote count: 1

http://stackoverflow.com/a/22532356
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34289318
score: 3
has body: Create a canvas object and the draw text on the canvas. Then save the canvas as bitmap Bitmap toDisk = Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_8888); canvas.setBitmap(toDisk); canvas.drawText(message, x , y, paint); toDisk.compress(Bitmap.CompressFormat.JPEG, 100, new FileOutputStream(new File("/mnt/sdcard/viral.jpg")));
answers question: http://stackoverflow.com/q/22532136
upvote count: 3
has comment: http://stackoverflow.com/comment/34288779

http://stackoverflow.com/a/22542289
upvote count: 1
has body: This could also be done by having JCodeModel print raw strings instead of declaring the JCode objects. For this particular problem, there are no java-imports that need to be generated – so that this can be done with directStatement(). StringBuilder expression = new StringBuilder(); expression.append (“objects = new ArrayList&lt;Object&gt;()”); if ((methodsToInvoke != null) &amp;&amp; (methodsToInvoke.length &gt; 0)) { for(String methodName : methodsToInvoke) { expression.append(“.add(new Object())”); } } expression.append(“;”); methodBoby.directStatement(expression.toString());
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22541640

http://stackoverflow.com/a/22518567
has comment: http://stackoverflow.com/comment/34265039
type: Answer
has body: Start by reporting any errors that are encountered catch(Exception ex) { } a catch block that silently consumes errors is usually a bad idea. Second, use a debugger, step through the code and see what's going on. Attempting to solve a problem like this by desk-checking, ie. just reading the code is usually very inefficient. Here we don't have key information, such as whether we have confidence that rs.moveToInsertRow(); can be expected to work - we can't see how rs gets its value. Many database problems only occur at runtime, there's a misconfiguration of the database connection or an attempted insert collides with existing data. Hence it's only by understanding what your code is doing in your test run that the problem can be solved. Here I'd guess that printing out some diagnistics in your catch will be really helpful, and otherwise stepping in a debugger (or adding trace statements) will get you there.
has comment: http://stackoverflow.com/comment/34264962
has comment: http://stackoverflow.com/comment/34264631
accepted answer of: http://stackoverflow.com/q/22518449
answers question: http://stackoverflow.com/q/22518449
has comment: http://stackoverflow.com/comment/34265337
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34265243
score: 0

http://stackoverflow.com/comment/34488011
has text: @Zeus I am using transaction manager. Please see the update.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22641196

http://stackoverflow.com/q/22597101
linked to: http://stackoverflow.com/q/3762763
has comment: http://stackoverflow.com/comment/34404089
tagged with: eclipse
has title: Clear recent apps(when long click home button)
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34404723
tagged with: android
linked to: http://stackoverflow.com/q/12890415
has comment: http://stackoverflow.com/comment/34404349
tagged with: android-activity
has answer: http://stackoverflow.com/a/22597591
linked to: http://stackoverflow.com/q/19349958
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6258980
has body: Is there a way that I can clear the recent apps? to simply clear the list. I have tried looking for some answer and I found one but it didn't work.
has comment: http://stackoverflow.com/comment/34404312
accepted answer: http://stackoverflow.com/a/22597591
type: Question
tagged with: java

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/22515634
type: Tag

http://stackoverflow.com/q/22520825
tagged with: output
upvote count: 1
has comment: http://stackoverflow.com/comment/34268917
type: Question
tagged with: object
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: input
has body: I am a new java student currently working on File I/O. My professor has asked us to create a very simple "DC universe" game using interfaces and classes and has asked us in the current lab I am working on, to create an instance of an object and then save the file to a directory in our C drive. My problem, is that even after all my constant 2 hours of digging through past topics I still cannot find a proper explanation as to how I create a directory and THEN create a file and write to a file in that directory because it appears whenever I run my code to not be able to do both tasks simultaneously. The code below also contains an error at the "Print Writer" line and asks to add a throw clause for "file not found exception" Any and all help is vastly appreciated package runtime; import java.io.*; import java.util.*; import model.hero.*; public class Gameplay { public static void main(String[] args) { File x = new File("C://prog24178//dcheroes.dat"); if(!x.exists()){ x.mkdir(); } PrintWriter output = new PrintWriter(x); // 1. Create a save file called dcheroes.dat in {$root}\prog24178 // 2. Create a hero // 3. Save hero to file } }
has answer: http://stackoverflow.com/a/22520933
score: 1
tagged with: java
tagged with: file
has title: Creating an empty file in a directory

http://stackoverflow.com/a/22583683
answers question: http://stackoverflow.com/q/22583479
has body: Ok. You are getting Cannot convert from Double from Integer because -num2-Math.sqrt(del)/2*num1; is producing a double which you are trying to set to an integer. Integer first = You can do one of these 2 things: Manually cast RHS to integer to remove the error: Integer first= (Integer) num2-Math.sqrt(del)/2*num1 ; Integer second= (Integer) num2+Math.sqrt(del)/2*num1 ; you will loose the precision though - NOT Recommended. change first and second to Double type. Double first= num2-Math.sqrt(del)/2*num1 ; Double second= num2+Math.sqrt(del)/2*num1 ; Always make sure when you are doing divisions or sqrt where float values are possible to either use double/float or manually cast.
score: 0
has comment: http://stackoverflow.com/comment/34380198
type: Answer
has comment: http://stackoverflow.com/comment/34384564

http://stackoverflow.com/a/22642962
has body: While typing the example to ask the question, I found the answer: Stream::reduce() returns an Optional which has a method: orElse(). So, System.out.println("Sum = " + values.stream().reduce((x, y) -&gt; x.add(y)).get()); becomes System.out.println("Sum = " + values.stream().reduce((x, y) -&gt; x.add(y)).orElse(BigDecimal.ZERO)); So I decided to post a Q-and-A. Lambdas are great. +1 Java.
accepted answer of: http://stackoverflow.com/q/22642961
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/34486032
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35719951
answers question: http://stackoverflow.com/q/22642961

http://stackoverflow.com/q/22592399
answer count: 3
tagged with: user-interface
has answer: http://stackoverflow.com/a/22592421
favorite count: 0
has comment: http://stackoverflow.com/comment/34395404
tagged with: swing
has comment: http://stackoverflow.com/comment/34395287
has body: I keep getting this error every time I create a new object with the class name: "Cannot instantiate the Type Main" This is the code: import javax.swing.*; import java.util.Scanner; import java.applet.Applet; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.geom.Ellipse2D; public abstract class Main extends JPanel implements ActionListener, KeyListener{ Timer t = new Timer(5, this); double x = 0, y = 0, velX = 0, velY = 0; public Main() { t.start(); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.fill(new Ellipse2D.Double(x, y, 40, 40)); } public void actionPerformed(ActionEvent e) { repaint(); x += velX; y += velY; } public void up() { velY = -1.5; velX = 0; } public void down() { velY = -1.5; velX = 0; } public void left() { velX = -1.5; velY = 0; } public void right() { velX = -1.5; velY = 0; } public void keyPressed(KeyEvent e) { int code = e.getKeyCode(); if (code == KeyEvent.VK_UP) { up(); } if (code == KeyEvent.VK_DOWN) { down(); } if (code == KeyEvent.VK_LEFT) { left(); } if (code == KeyEvent.VK_RIGHT) { right(); } Main m = new Main(); JFrame f = new JFrame(); f.add(m); f.setVisible(true);; f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(800,600); } public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) {} } And this is the object that keeps getting this "error": Main m = new Main(); (I am very very new to making UI's, infact, this is my 3rd, so I have no idea why I cannot instantiate the Type)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22592411
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22592682
has comment: http://stackoverflow.com/comment/34395299
type: Question
accepted answer: http://stackoverflow.com/a/22592421
downvote count: 0
has title: "Cannot instantiate the Type Main"
possible better answer: http://stackoverflow.com/a/22592411

http://stackoverflow.com/comment/34366187
type: AnswerComment
comment on: http://stackoverflow.com/a/22576231
has text: @deviantfan How not the same? What changed? Why changed? Why not the same?
score: 0
type: Comment

http://stackoverflow.com/comment/39760872
type: Comment
has text: `ECParameterSpec` does not seem to be serializable in itself.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22652372

annotations
tags question: http://stackoverflow.com/q/22525939
type: Tag
tags question: http://stackoverflow.com/q/22583451
tags question: http://stackoverflow.com/q/22522870
tags question: http://stackoverflow.com/q/22638117
tags question: http://stackoverflow.com/q/22565230
tags question: http://stackoverflow.com/q/22575608
tags question: http://stackoverflow.com/q/22508604
tags question: http://stackoverflow.com/q/22631229
tags question: http://stackoverflow.com/q/22516428
tags question: http://stackoverflow.com/q/22599362
tags question: http://stackoverflow.com/q/22508424
tags question: http://stackoverflow.com/q/22566054
tags question: http://stackoverflow.com/q/22505624
tags question: http://stackoverflow.com/q/22559506
tag name: annotations

http://stackoverflow.com/comment/34321497
has text: *"have any clue on what's causing the issue?"* Sure. Maybe it is that the browser does not understand that HTML. To fix that, follow the advice I put in the first comment. **Tip** I'll devout no more time to this until you tell me I can visit the page that is now using the script.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22548335

http://stackoverflow.com/a/76880719
has body: Before Document d = (Document) o; You can use o = session.getObject(o.getId()); to reload the cmisObject. After the reloading, the aspects/secondaryTypes can be retrieved. It works for me. I am using Chemistry 1.0.0, CMIS version 1.1, and browser binding. There is a similar question: session.queryObjects does not support secondary types
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22518396

http://stackoverflow.com/q/22645809
upvote count: 1
possible better answer: http://stackoverflow.com/a/22647177
type: Question
has answer: http://stackoverflow.com/a/22647177
downvote count: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22675011
tagged with: dart
tagged with: string
favorite count: 0
has body: My server side Dart application receives a JSON String from a socket. The string is generated by Java code. When the string is sent to the socket in the Java code it is encoded to UTF8 and two bytes, a short int, are prepended to the string. The value of this short is the number of bytes in the string + 2. I need to extract that value as an int in order to handle the string but nothing I've tried has worked. It dies at JSON.decode (below) because it encounters the start of another JSON string. The first byte of the second string is the start short with the length of the second JSON string. The two strings are each less then 40 characters long. (I will need to append the length to strings sent from Dart to Java as well.) Java line out.writeUTF(json); // converts and writes to the socket stream. Dart server side code method handleJavaSocket(Socket javasocket){ javasocket.transform(UTF8.decoder).listen((String socketString){ var truncated = socketString.substring(2); String message = JSON.decode(truncated); // dies here // more code }, onError: (error) { print('Bad JavaSocket request'); }); } One of the JSON strings before encoding {"target":"DOOR","command":"OPEN"}
tagged with: sockets
type: AnsweredQuestion
score: 1
has title: Dart How to parse bytes from a String
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22675011

http://stackoverflow.com/q/22598550
accepted answer: http://stackoverflow.com/a/22599667
upvote count: 2
score: 2
type: AnsweredQuestion
has title: Best way to avoid EAV model, but still allow for flexibility
tagged with: java
has answer: http://stackoverflow.com/a/22599168
has answer: http://stackoverflow.com/a/22599667
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22599168
downvote count: 0
favorite count: 0
tagged with: groovy
has body: I have a requirement to store CSV data in an Oracle database for later retrieval by dynamic query scripts. The data needs to be stored such that any column of the CSV data can be queried using SQL and performance is key (some CSV files are 100k+ lines). The content of the CSV files (number of columns, headings, data types) is not known ahead of time and the system needs to be able to handle multiple file structures (which are added to a config file so the system knows how to read them, by people who don't know SQL). My current solution, in order to avoid an EAV model, is to have my code create new tables every time a new CSV structure is added to the config file. I'm curious to know if there is a better way to achieve what I'm trying to do. I'm not particularly fond of having my code create new tables in production at run-time. The system is written in groovy, in case it matters.
tagged with: oracle-database
tagged with: http://stackoverflow.com/tag/csv
tagged with: sql

http://stackoverflow.com/a/44492544
type: Answer
has body: public class CharacterCount { public static void main(String[] args) { String s = "aaabbbcccddd"; String t=""; int count = 0; //Loop to find unique characters in a string and add it to new string called t //if a character is not found in a string indexOf returns -1 for (int i = 0; i &lt; s.length(); i++) { if (t.indexOf(s.charAt(i))==-1) t+=s.charAt(i); } //For every character new string t , loop though s find the count and display for (int i = 0; i &lt; t.length(); i++) { count = 0; for (int j = 0; j &lt; s.length(); j++) { if (t.charAt(i) == s.charAt(j)) count++; } System.out.println(t.charAt(i) + " " + count); } } }
answers question: http://stackoverflow.com/q/22646218
score: 0

http://stackoverflow.com/q/22610603
has body: Its one thing I don't get about concurrency - threads and atomic-actions. According to docs.oracle these actions are specified as atomic: Reads and writes are atomic for reference variables and for most primitive variables (all types except long and double). Reads and writes are atomic for all variables declared volatile (including long and double variables). But at the same time docs.oracle asserts that incrementing a variable is not an atomic action. I thought that this was a write: private int number; number++; Obviously I do not understand what is meant with "reads" and "writes". Could someone explain this and give an example of "reads" and "writes"? Edit: When doing this without synchronization the programs suffers from ´thread interference. SO I understand that its not atomic. But when I change another variable that belongs to an object that these threads share - there are NO interference whatsoever. The shared variable from this object is changed via a mutator.
tagged with: java
has comment: http://stackoverflow.com/comment/34428176
type: Question
upvote count: 4
answer count: 3
downvote count: 0
has title: Atomic actions - what is meant by reads and writes?
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/22610772
has comment: http://stackoverflow.com/comment/34428483
has answer: http://stackoverflow.com/a/22610751
has comment: http://stackoverflow.com/comment/136075588
tagged with: atomic
has answer: http://stackoverflow.com/a/22610674
type: UnansweredQuestion

http://stackoverflow.com/comment/34302391
type: Comment
type: QuestionComment
score: 0
has text: Martin, I have seen mentions of this method. Problem is that I can attach a picture to one row... - and, well, I don't think you can call something like "getAttachmentList" for a bean property ;-)
comment on: http://stackoverflow.com/q/22507055

http://stackoverflow.com/a/22565415
type: AcceptedAnswer
upvote count: 2
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/22565290
score: 1
has comment: http://stackoverflow.com/comment/34346508
has comment: http://stackoverflow.com/comment/34346952
has body: You can't declare your Pair variables (or the class itself) to have a variable number of type parameters. But what you could do is have Pair extend PairMultipleType, but define its only type parameter to be both parameters of PairMultipleType. public class Pair&lt;T&gt; extends PairMultipleType&lt;T, T&gt; { public Pair(T p_First, T p_Second) { super(p_First, p_Second); } } Be careful with this design, because it's easy to mix up your generic type parameters. But you can do this: Pair&lt;String&gt; pair = new Pair&lt;String&gt;("one", "two"); PairMultipleType&lt;String, String&gt; pair2 = new Pair&lt;String&gt;("one", "two"); PairMultipleType&lt;Integer, String&gt; pair3 = new PairMultipleType&lt;Integer, String&gt;(1, "one");
has comment: http://stackoverflow.com/comment/34346652
accepted answer of: http://stackoverflow.com/q/22565290
has comment: http://stackoverflow.com/comment/34347210

http://stackoverflow.com/q/22646148
possible better answer: http://stackoverflow.com/a/22646216
has body: I need some advice. I created three classes Om(Human), Parinte(Father) and Copil(Child). I have created constructors of this classes. In main class i have created one instance for every class. Now i stored my objects in a ArrayList. After this i will create some methods to treat my objects like sorting them A to Z by name. My question is, how to print these objects into a clear String format after i will call my sort methods cause i'm getting every time stuff like @... when i try simply to print a value stored in my collection? My code: Om(Human) class: public class Om { String nume; String prenume; String cnp; Om(String nume,String prenume,String cnp){ this.nume=nume; this.prenume=prenume; this.cnp=cnp; } } My Parinte(Father) class: public class Parinte extends Om{ String domiciliu; Parinte(String nume, String prenume, String cnp, String domiciliu){ super(nume,prenume,cnp); this.domiciliu=domiciliu; } } My Copil(Child) class: public class Copil extends Parinte { int varsta; Copil(String nume, String prenume, String cnp, String domiciliu, int varsta){ super(nume,prenume,cnp,domiciliu); this.varsta=varsta; } } And finally my main class: import java.util.ArrayList; import java.util.Arrays; public class main { public static void main(String[] args) { Om om1=new Om("Dubolari", "Dragos", "2006004034120"); Parinte p1=new Parinte("Enache","Andrei","2006004034120","Al. Cel Bun 13"); Copil c1 = new Copil("Enache","Valeriu","2006004034120","Al. Cel Bun 13",15); ArrayList&lt;Om&gt; colectie = new ArrayList&lt;Om&gt;(); colectie.add(om1); colectie.add(p1); colectie.add(c1); } }
has answer: http://stackoverflow.com/a/22646216
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/10734106
has answer: http://stackoverflow.com/a/22651859
has comment: http://stackoverflow.com/comment/34491666
accepted answer: http://stackoverflow.com/a/22646263
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22646211
has title: Java operations on collections
has comment: http://stackoverflow.com/comment/34491781
upvote count: 4
has comment: http://stackoverflow.com/comment/34491671
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/22646263

restlet
tags question: http://stackoverflow.com/q/22530513
type: Tag
tags question: http://stackoverflow.com/q/22631517
tag name: restlet

http://stackoverflow.com/a/74457337
score: 0
has body: I have the same question and solved it. I attached 2 different java agents: Skywalking-java-agent \ JVMSandbox-java-agent to the same JVM process, when the JVM started， the error occurs. I solved this question by modifying the Skywalking-java-agent's config file agent.config located in skywalking-agent/config: agent.is_cache_enhanced_class=${SW_AGENT_CACHE_CLASS:false} change this default value to true and restart the JVM process, then resolve it. I hope this could be helpful.
type: Answer
answers question: http://stackoverflow.com/q/22491797

http://stackoverflow.com/comment/34264872
has text: Because the developers of whatever email client you are trying wrote support for that, presumably replacing it with newlines. Nobody is forcing them to do that (or to honor tags that they do not), and not all email clients will necessarily pay attention to ` ` either.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22517142

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/22572214
tags question: http://stackoverflow.com/q/22493171
tags question: http://stackoverflow.com/q/22547678
tags question: http://stackoverflow.com/q/22512345
type: Tag
tags question: http://stackoverflow.com/q/22582607

http://stackoverflow.com/a/22523940
answers question: http://stackoverflow.com/q/22523067
type: Answer
has body: Class loaders and their classes can be garbage-collected just like any other Java objects. Once an application being undeployed is stopped and all of its objects are garbage collected, the container throws away the class loader, and all the class information becomes eligible.
score: 0

http://stackoverflow.com/q/22632774
has comment: http://stackoverflow.com/comment/34467753
has answer: http://stackoverflow.com/a/29566784
type: Question
has answer: http://stackoverflow.com/a/22634013
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22633262
has answer: http://stackoverflow.com/a/22633178
answer count: 4
has body: In my application i have dynamic data in JavaScript function i need to send that dynamic data through a variable to another jsp page how to solve this ?
tagged with: javascript
type: UnansweredQuestion
has title: How to pass a variable from javascript to another jsp page?

http://stackoverflow.com/comment/34396998
type: QuestionComment
has text: you do it by creating a custom View with your onDraw method, then add that custom View as a child to a ScrollView
score: 0
comment on: http://stackoverflow.com/q/22593021
type: Comment

http://stackoverflow.com/a/22524450
has comment: http://stackoverflow.com/comment/34274998
type: Answer
has body: Whenever you install any game/ software, it will also install redistributable C++ /DirectX etc (usually). During installation itself it will ask whether you want to "upgrade" your version of C++ or DirectX if you have another older version installed, otherwise it will install C++/DirectX. This version of DirectX/C++ will be used by the program. You can go to your Control Panel --> Ad/Remove programs and see various versions of redistributable C++ installed (if you had/have installed many games/ software) Without a JVM, nothing in java runs. The JRE might also be installed by a program but will be locally linked i.e, you can't see it in your path and it will be uninstalled when the program is uninstalled.
answers question: http://stackoverflow.com/q/22524337
has comment: http://stackoverflow.com/comment/34275948
has comment: http://stackoverflow.com/comment/34275099
score: 0

http://stackoverflow.com/comment/34414759
type: Comment
comment on: http://stackoverflow.com/a/22601486
has text: parser.parse(is, contenthandler, metadata);its showing error in this line as, The method parse(InputStream, ContentHandler, Metadata, ParseContext) in the type Parser is not applicable for the arguments (FileInputStream, BodyContentHandler, Metadata).
type: AnswerComment
score: 0

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/22540437
tags question: http://stackoverflow.com/q/22570126

datasource
tags question: http://stackoverflow.com/q/22533311
tags question: http://stackoverflow.com/q/22550373
type: Tag
tag name: datasource
tags question: http://stackoverflow.com/q/22563591
tags question: http://stackoverflow.com/q/22591348

http://stackoverflow.com/comment/34407249
type: AnswerComment
type: Comment
has text: How do I call things from within the EDT?
comment on: http://stackoverflow.com/a/22598355
score: 0

http://stackoverflow.com/comment/34390200
score: 0
type: Comment
has text: No problem. Feel free to comment again if you need help with the code.
comment on: http://stackoverflow.com/a/22570488
type: AnswerComment

http://stackoverflow.com/comment/34267240
has text: It didnt work but the command is very useful, thank you for the help
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22518405
score: 0

http://stackoverflow.com/comment/34436025
comment on: http://stackoverflow.com/a/22614931
has text: That `instanceof` code wouldn't compile. Second operand of `instanceof` cannot be parameterized type or bounded wildcard type.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22546743
score: 1
has comment: http://stackoverflow.com/comment/34407174
has comment: http://stackoverflow.com/comment/34407597
has comment: http://stackoverflow.com/comment/34407545
answers question: http://stackoverflow.com/q/22545083
has comment: http://stackoverflow.com/comment/34406843
downvote count: 0
has comment: http://stackoverflow.com/comment/34407441
has body: Start by declaring a JList and ListModel instance variables... private JList studentList; private DefaultListModel model; This is what will be used to display your information and allow the user to interact with. Create some methods to update the model... public void addStudent(String student) { model.addElement(student); } public void deleteStudent(String student) { model.removeElement(student); } Create methods to read and write the student information from and to disk... public List&lt;String&gt; loadStudents() throws IOException { List&lt;String&gt; students = new ArrayList&lt;&gt;(25); try (BufferedReader br = new BufferedReader(new FileReader("Students.txt"))) { String student = null; while ((student = br.readLine()) != null) { students.add(student); } } finally { } return students; } public void saveStudents(List&lt;String&gt; students) throws IOException { try (BufferedWriter bw = new BufferedWriter(new FileWriter("Students.txt"))) { for (String student : students) { bw.write(student); bw.newLine(); } bw.flush(); } finally { } } Then load the student information from the file into the model... protected void save() { try { List&lt;String&gt; students = loadStudents(); model = new DefaultListModel(); for (String student : students) { model.addElement(student); } } catch (IOException ex) { JOptionPane.showMessageDialog(this, "Could not read students.txt: " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } studentList.setModel(model); } And write a method to save the information from the model to disk... protected void save() { List&lt;String&gt; students = new ArrayList&lt;&gt;(model.getSize()); for (int index = 0; index &lt; model.getSize(); index++) { students.add((String)model.get(index)); } try { saveStudents(students); } catch (IOException ex) { JOptionPane.showMessageDialog(this, "Could not write students.txt: " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } Now, obviously, you need to create the JList and add it your UI, but I'll le…
has comment: http://stackoverflow.com/comment/34406944
has comment: http://stackoverflow.com/comment/34407654
type: Answer
has comment: http://stackoverflow.com/comment/34407566
has comment: http://stackoverflow.com/comment/34406957
has comment: http://stackoverflow.com/comment/34406974
has comment: http://stackoverflow.com/comment/34407063
upvote count: 1
has comment: http://stackoverflow.com/comment/34406904
has comment: http://stackoverflow.com/comment/34406802
has comment: http://stackoverflow.com/comment/34407274

http://stackoverflow.com/comment/34460926
comment on: http://stackoverflow.com/a/22628433
score: 0
type: AnswerComment
type: Comment
has text: Using memcpy instead of direct assignment, doesn't change anything here. If the memory pointer is not initialized or not accessible, it will give a segmentation fault nevertheless.

http://stackoverflow.com/comment/34439445
comment on: http://stackoverflow.com/a/22616906
type: Comment
has text: This structure is not a `do-while`
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34228731
type: QuestionComment
comment on: http://stackoverflow.com/q/22498021
has text: that was just for confirming the actual path. the program runs fine without the line too
score: 0
type: Comment

http://stackoverflow.com/comment/34267336
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22520011
has text: Run my example above see what happens. Put in your image paths.
score: 0

http://stackoverflow.com/a/22587286
has comment: http://stackoverflow.com/comment/34387039
has comment: http://stackoverflow.com/comment/34386709
has body: The JodaTime DateTime class implements the Comparable interface itself, so you don't need to implement a Comparator. Rather, use Collections.binarySearch with just 2 arguments: list and key. There may be a mistake in your implementation of the Comparator, and if you post it, we may be able to identify it. However your question was whether it is possible to use DateTime in a binary search, and the answer is: yes. Let the built-in DateTime.compareTo function (implemented in superclass AbstractInstant) do its work. Addendum As your code shows, you're not directly comparing DateTime objects, but you're comparing Holiday objects using your HolidayComparator. The Javadoc of the class Comparator describes what the compare method should return: Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. Your method only returns 0 if the objects are equal and -1 if they are not. That's incorrect and it confuses the Collections.binarySearch method. Try this instead: class HolidayComparator implements Comparator&lt;Holiday&gt; { public int compare(Holiday h1, Holiday h2) { return h1.getDate().compareTo(h2.getDate()); } } That is the best way to do it, because it re-uses existing code in JodaTime and it doesn't make you depend on its internals. To make it nicer, you should add checks for null though, if you can ever have a null value in your list of Holidays, or if you ever have a null date in one of the Holiday objects. If you want to look more to the internals: the compareTo method in DateTime (superclass AbstractInstant) actually compares the result of the method getMillis(), so an alternative way of writing this is: public int compare(Holiday h1, Holiday h2) { long millis1 = h1.getDate().getMillis(); long millis2 = h2.getDate().getMillis(); return Long.compare(millis1, millis2); } And Long.compare is implemented as: Long.compare: public static int compare(long x, long…
accepted answer of: http://stackoverflow.com/q/22587244
score: 3
answers question: http://stackoverflow.com/q/22587244
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34387002
has comment: http://stackoverflow.com/comment/34386884
type: Answer
has comment: http://stackoverflow.com/comment/34387540
upvote count: 3

http://stackoverflow.com/q/22528225
has comment: http://stackoverflow.com/comment/34281142
score: 0
has answer: http://stackoverflow.com/a/22528503
type: Question
has answer: http://stackoverflow.com/a/22528384
tagged with: numbers
tagged with: java
has answer: http://stackoverflow.com/a/22528351
tagged with: arrays
accepted answer: http://stackoverflow.com/a/22528384
has body: I am trying to create method that creates new array only from the even numbers from another array. However, I do not understand why I have the right length (only with the number of the even numbers) of my output array, but I have 0s instead of the actual numbers. I know that the problem is simple, but right now I am stuck with it. import java.util.*; public class test{ public static int [] myMethod(int []arr){ int [] temp; int howManyEven = 0; for(int i=0;i&lt;arr.length;i++){ if(arr[i]%2==0){ howManyEven++; } } temp = new int [howManyEven]; int evenNum = 0; for(int i=0;i&lt;temp.length;i++){ boolean even = false; for(int j=0;j&lt;arr.length;j++){ if(arr[j]%2==0){ even = true; evenNum = arr[j]; } } if(!even){ temp[i]=evenNum; } } return temp; } public static void main (String[]args){ int [] myArray = {5,5,8,9,7,4,4,2,3}; System.out.println(Arrays.toString(myMethod(myArray))); } }
possible better answer: http://stackoverflow.com/a/22528344
has answer: http://stackoverflow.com/a/22528344
answer count: 4
type: AnsweredQuestion
has title: Method that creates new array only from the even numbers in Java

http://stackoverflow.com/comment/34273422
has text: No, but I suppose that's one way of doing it.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22523579

http://stackoverflow.com/a/22540634
has comment: http://stackoverflow.com/comment/34304326
upvote count: 1
has comment: http://stackoverflow.com/comment/34335280
score: 1
has comment: http://stackoverflow.com/comment/34336803
downvote count: 0
has comment: http://stackoverflow.com/comment/34430204
type: Answer
answers question: http://stackoverflow.com/q/22540518
has body: You can use a regex but it will be quite complicated; in this case you need an alternation. Here it is assumed that you only have letters in your search term: ("[a-z]+(?:\s+[a-z]+)+"|[a-z]+)(?:\s+|$) (note that the alternation order is important here!) Example: public final class Bar { private static final Pattern PATTERN = Pattern .compile("(\"[a-z]+(?:\\s+[a-z]+)+\"|[a-z]+)(?:\\s+|$)", Pattern.CASE_INSENSITIVE); public static void main(final String... args) throws IOException { tryAndMatch("\"Harlan Coben\""); tryAndMatch("shakespeare harlan coben"); tryAndMatch("shakespeare \"harlan coben\" coben"); } private static void tryAndMatch(final String input) { final Matcher m = PATTERN.matcher(input); System.out.printf("INPUT: --&gt;%s&lt;--\n", input); while (m.find()) System.out.printf("Term --&gt;%s&lt;--\n", m.group(1)); System.out.println("END INPUT"); } } Now, as to substitution into URLs, be aware that URLEncoder is not made to encode URL components, it is made to encode application/x-www-form-urlencoded data, in which a space becomes + and which does not have the same escape chararcter sets than neither a URI path or fragment. The most accurate solution would be to use URI templates. This allows you to write templates such as: http://my.site/?q={query} where query is any Unicode string and this will encode it for you (self promotion: if you are interested I have a library to do that). The second is to use Guava 15.0+, it has a set of escapers especially made for URLs.

http://stackoverflow.com/comment/34274061
has text: I go export-java-Runnable Jar File-Extract Required Libraries into generated JAR-
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22523877
type: Comment

http://stackoverflow.com/comment/34532631
type: QuestionComment
has text: It's seems to have worked! I'll test the wlfullclient.jar in my app now and return with a feedback. Do you think the "weblogic-classes.jar" is the same as "weblogic.jar"?
score: 1
comment on: http://stackoverflow.com/q/22643120
type: Comment

http://stackoverflow.com/a/22579780
type: Answer
has comment: http://stackoverflow.com/comment/34372775
accepted answer of: http://stackoverflow.com/q/22579125
has comment: http://stackoverflow.com/comment/34373533
has body: you are trying to start an activity on the constructor of html, thats your problem. What you can do is to pass the service context to the html class. Try this: public html(Context externalContext) { Intent i2 = new Intent("android.intent.action.MAIN"); i2.setComponent(ComponentName.unflattenFromString("com.android.chrome/com.android.chrome.Main")); i2.addCategory("android.intent.category.LAUNCHER"); i2.setData(Uri.parse("https://wwww.google.com")); i2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); System.out.println("hello1"); externalContext.startActivity(i2); --&gt; START WITH EXTERNAL CONTEXT!!! System.out.println("hello2"); } And... injects the notification service context like this: @Override public void onNotificationPosted(StatusBarNotification sbn) { new Thread(new Runnable() { public void run(){ Looper.prepare(); int cangethtml = 1; try{ if(cangethtml==1){ cangethtml = 0; //only runs once new html(NLService.this); --&gt; !!!! inject CONTEXT !!!! } }finally{Looper.loop();} }; }).start(); } Actually... your html doesn't need to extends Activity at all (actually for me html() should be a method of your notification service not a class).
answers question: http://stackoverflow.com/q/22579125
has comment: http://stackoverflow.com/comment/34372840
has comment: http://stackoverflow.com/comment/34373797
has comment: http://stackoverflow.com/comment/34372915
has comment: http://stackoverflow.com/comment/34373767
has comment: http://stackoverflow.com/comment/34373094
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34373827
has comment: http://stackoverflow.com/comment/34373562

http://stackoverflow.com/q/22563248
has answer: http://stackoverflow.com/a/22580614
score: 0
answer count: 2
tagged with: nullpointerexception
tagged with: android
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/34343321
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34343279
has comment: http://stackoverflow.com/comment/34343785
has comment: http://stackoverflow.com/comment/34342825
has title: Android Development nullpointerexception fatal error doinbackground
tagged with: fatal-error
has comment: http://stackoverflow.com/comment/34345682
has answer: http://stackoverflow.com/a/22566052
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34342785
has body: I need your help, there is an Fatal Error in my code. I don't know how to solve this problem... please help me out :) my code public class MainActivity extends Activity { // button to show progress dialog Button btnShowProgress; // Progress Dialog private ProgressDialog pDialog; ImageView my_image; // Progress dialog type (0 - for Horizontal progress bar) public static final int progress_bar_type = 0; // File url to download private static String file_url = "https://example.pdf"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // show progress bar button btnShowProgress = (Button) findViewById(R.id.btnProgressBar); // Image view to show image after downloading my_image = (ImageView) findViewById(R.id.my_image); /** * Show Progress bar click event * */ btnShowProgress.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // starting new Async Task new DownloadFileFromURL().execute(file_url); } }); } /** * Showing Dialog * */ @Override protected Dialog onCreateDialog(int id) { switch (id) { case progress_bar_type: // we set this to 0 pDialog = new ProgressDialog(this); pDialog.setMessage("Downloading file. Please wait..."); pDialog.setIndeterminate(false); pDialog.setMax(100); pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); pDialog.setCancelable(true); pDialog.show(); return pDialog; default: return null; } } /** * Background Async Task to download file * */ class DownloadFileFromURL extends AsyncTask&lt;String, String, String&gt; { private SSLContext context; /** * Before starting background thread * Show Progress Bar Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); showDialog(progress_bar_type); } /** * Downloading file in background thread * */ @Override protected String doInBackground(String... f_url) { int count; try { This line is the error in: URL url = new URL(f_url[0]); HttpsURLConnection connection = …

http://stackoverflow.com/comment/34394079
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22591637
has text: My strategy would be to first split by backslashes, then split the pieces in even indices (0, 2, 4...) by space, and then collect the results in a single array.

http://stackoverflow.com/q/22592180
tagged with: animation
has title: animated background java game
tagged with: 2d-games
has answer: http://stackoverflow.com/a/22592450
linked to: http://stackoverflow.com/q/21868170
has comment: http://stackoverflow.com/comment/34395835
has body: I was programming a game similar to asteroid, but I do not understand how to spawn the asteroids in the background. now i spawn an asteroid in the main class but i want create a class for the asteroid ho i do it? MAIN CLASS public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; if(flag_img) { background(g2d); logo(g2d); menu(g2d); spaceship(g2d); crediti(g2d); } } background function(now) private void background(Graphics2D g2d) { asteroidi_g_x+=r.nextInt(4); asteroidi_g_y+=r.nextInt(1); g2d.drawImage(asteroidi_g[0], asteroidi_g_x,asteroidi_g_y,this); } background function(what i want) private void background(Graphics2D g2d) { asteroid asteroid = new asteroid[10]; } and class asteroid public class asteroid extends JPanel implements ActionListener { private BufferedImage images_asteroid; private boolean flag_img; private JPanel jp; private int x,y; public asteroide_grande(JPanel jp) { flag_img = true; x = (jp.getWidth()/2); y = (jp.getHeight()/2); this.jp = jp; try { images_asterod = ImageIO.read(this.getClass().getResource("images/asteroid/a1.png")); } catch(IOException e){flag = false;} } @Override public void paintComponent(Graphics g) { super.paintComponent(g); if(flag_img) { g.drawImage(images_asteroid, 100, 100,this); } } @Override public void actionPerformed(ActionEvent e) { x=x-1; y=y+1; repaint(); } method paintcomponent in class doesn't work
score: 0
linked to: http://stackoverflow.com/q/21800466
tagged with: java
tagged with: swing
answer count: 1
linked to: http://stackoverflow.com/q/21532761
tagged with: graphics
linked to: http://stackoverflow.com/q/22123266
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34396468
linked to: http://stackoverflow.com/q/21587972
has comment: http://stackoverflow.com/comment/34396385
has comment: http://stackoverflow.com/comment/34396274
type: Question

http://stackoverflow.com/q/22622697
accepted answer: http://stackoverflow.com/a/22623100
type: AnsweredQuestion
tagged with: string
tagged with: parsing
tagged with: javacc
type: Question
has body: i wrote a parser with JavaCC, which i can successfully test in eclipse reading the stream from standard input (keyboard). now i want to call this class with the parser from another class. the data to parse are available in a string. currently i didn't find a way to pass the string as argument. it's only possible to parse from stdin or from a file. writing the string to a file and than parsing the file is in my opinion not a solution. any idea how to solve this issue ? i can't believe that i am the only one who want's to analyze only a string and not a complete file. kind regards hans --
answer count: 1
has answer: http://stackoverflow.com/a/22623100
has title: JavaCC: parsing a string and not reading from stdin or from a file
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/5720524
has comment: http://stackoverflow.com/comment/34450114
has comment: http://stackoverflow.com/comment/34450378

http://stackoverflow.com/q/22641472
type: Question
has comment: http://stackoverflow.com/comment/34483375
downvote count: 0
has title: Issue with Maven Site plugin
tagged with: maven-site-plugin
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34484344
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/24103900
has comment: http://stackoverflow.com/comment/34511854
score: 1
tagged with: java
has body: I downloaded Jetty source and tried to run the following maven command: mvn clean compile site -DskipTests -e But the problem is that the maven-site-plugin doesn't work. I use Maven 3.0.5 (tried also with latest) and maven-site-plugin 3.3. The error looks like this: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project jetty-project: failed to get report for org.apache.maven.plugins:maven-javadoc-plugin: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:copy-dependencies (copy-lib-deps) on project jetty-ant: Error copying artifact from /jetty/jetty-io/target/classes to /jetty/jetty-ant/target/test-lib/jetty-io-9.1.3-SNAPSHOT.jar: /jetty/jetty-io/target/classes (Is a directory) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project jetty-project: failed to get report for org.apache.maven.plugins:maven-javadoc-plugin at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.…

http://stackoverflow.com/q/22548508
has body: Ours is a Spring MVC based REST application. I am trying to use ExceptionHandler annotation to handle all errors and exceptions. I have @ExceptionHandler(Throwable.class) public @ResponseBody String handleErrors() { return "error"; } This works whenever there is an exception thrown and it doesn't work for any errors. I am using Spring 4.0. Is there any work-around?
has answer: http://stackoverflow.com/a/29622039
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34317940
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/34318032
has comment: http://stackoverflow.com/comment/34318094
has comment: http://stackoverflow.com/comment/38185926
tagged with: rest
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5153132
score: 6
upvote count: 6
tagged with: spring-mvc
tagged with: web-applications
has answer: http://stackoverflow.com/a/22548572
type: Question
has title: ExceptionHandler doesn't work with Throwable
has comment: http://stackoverflow.com/comment/60291317
tagged with: java

http://stackoverflow.com/comment/34422596
comment on: http://stackoverflow.com/a/22607216
type: AnswerComment
score: 0
has text: No, but I want my button to send POST.
type: Comment

http://stackoverflow.com/q/22567174
has title: Not getting absolute file path from resources
has body: I have a template file under /src/main/resources and i want to get the absolute path of it, the problem is that I'm getting a relative path and not a absolute path. I need to get the absolute path of the file in my computer after loading the template inside the project. What I'm doing now is this: URL location = this.getClass().getResource("/template/template2.vm"); String fullPath = location.getPath(); This returns: (java.lang.String) vfs:/content/MyProyect-1.0.0-SNAPSHOT.war/WEB-INF/classes/templates/template2.vm If you do it in Eclipse it gives the full path, but deploying in Netbeans and without an IDE returns this result. I'm using jboss for deploying. I've also tried doing String fullPath = location.getAbsolutePath(); and i keep getting this result.
has comment: http://stackoverflow.com/comment/99261771
score: 2
tagged with: java
tagged with: jboss
has answer: http://stackoverflow.com/a/42373938
has answer: http://stackoverflow.com/a/22785850
type: Question
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22567232
tagged with: deployment
favorite count: 0
tagged with: netbeans
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17351043
tagged with: war

http://stackoverflow.com/comment/34358694
type: QuestionComment
has text: http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem
score: 0
comment on: http://stackoverflow.com/q/22570995
type: Comment

http://stackoverflow.com/q/22641781
answer count: 1
linked to: http://stackoverflow.com/q/12793069
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34484309
has title: onSaveInstanceState does not get called on emulator
has answer: http://stackoverflow.com/a/22643617
tagged with: java
has body: I created a new project and entered the following code: @Override protected void onSaveInstanceState(Bundle outState) { // TODO Auto-generated method stub super.onSaveInstanceState(outState); System.out.println("onSaveInstanceState " ); } press cntrl F11 and cntrl F12 to rotate my emulator... and this method never got called. am i missing something ?
has comment: http://stackoverflow.com/comment/34484061
type: Question
score: 0
tagged with: android

http://stackoverflow.com/q/22543575
has body: How to convert hexadecimal to decimal from file reader in Java? Like : 12345abcd Java application should be able to read and write to it. Filereader. 1234ABCD 9876FEDC 12345678 ABCDEF12 5678AB01
has comment: http://stackoverflow.com/comment/34317190
has title: Read and write hexa-decimal to decimal?
tagged with: java
has comment: http://stackoverflow.com/comment/34309256
type: Question
score: 0
has answer: http://stackoverflow.com/a/22543939
answer count: 1
tagged with: bufferedreader
tagged with: java.util.scanner
type: UnansweredQuestion

http://stackoverflow.com/q/22583785
has comment: http://stackoverflow.com/comment/34380718
has comment: http://stackoverflow.com/comment/34380585
has answer: http://stackoverflow.com/a/22584055
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34380346
has comment: http://stackoverflow.com/comment/34380358
has body: I am using windows 8. I have set environment as path having value C:\Program Files\Java\jdk1.8.0\bin. But still i am getting error while compiling java file as javac: file Not found: fileName.java Usage: javac &lt;options&gt; &lt;source files&gt;
favorite count: 0
has comment: http://stackoverflow.com/comment/34380344
tagged with: javac
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34418105
has title: How to set path for JDK?
has answer: http://stackoverflow.com/a/22584169
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34380395
type: Question

http://stackoverflow.com/comment/34455656
comment on: http://stackoverflow.com/a/22499559
score: 0
type: Comment
type: AnswerComment
has text: Sorry, had been away for a few days. Anyway - ok, I _can_ find a workaround, without a doubt, but that still doesn't solve the original issue - why can't a pure TreeSet-extending-class be serialized normally, like all other collections?

http://stackoverflow.com/comment/34397933
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22592682
type: Comment
has text: Yes I know it. But it will solve the problem as mentioned by OP.

http://stackoverflow.com/q/22513032
has comment: http://stackoverflow.com/comment/34254583
possible better answer: http://stackoverflow.com/a/35540717
tagged with: java
linked to: http://stackoverflow.com/q/9706682
tagged with: jpanel
score: 9
linked to: http://stackoverflow.com/q/1097366
answer count: 2
tagged with: jscrollpane
has body: I am adding lots of components (JPanels, JLabels etc.) into a JScrollPane programagically at the start of my program based on some stuff from a database. It seems that this procedure is too fast for the GUI(?), so the JScrollPane does not always update correctly, i.e the scroll bars are not visible even though the inner JPanel is bigger than the visible area. Resizing the Window (JFrame) fixes the problem, as I assume Java is re-printing the components when they are resized. As a test, I have added a debug-button that I can click after the startup of the program has finished. I am trying to force the JScrollPane to "refresh" itself. I have tried doing: scrollpane.repaint(); scrollpane.validate(); scrollpane.revalidate(); None of them seems to work. However, if I change the border (or any other layout related to the JScrollPane), it refreshes correctly. scrollpane.setBorder(new LineBorder(Color.RED)); So I basically have 2 questions. What is the command for forcing the scrollpane to "refresh"? Obviously it is doing some kind of "repaint" thing when I am adding the border. How can I run that only? Is there a way of "pausing" the printing of components as they are added and resume it again after I added all the wanted components? As it is now, I basically "see" the components being added on the screen (even though it is really fast). It would be better if I can add all the components I want and THEN tell the program to print it to the screen/JFrame.
upvote count: 9
has comment: http://stackoverflow.com/comment/34254297
has comment: http://stackoverflow.com/comment/34254778
has comment: http://stackoverflow.com/comment/34254368
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34254836
has answer: http://stackoverflow.com/a/22514524
accepted answer: http://stackoverflow.com/a/22514524
has answer: http://stackoverflow.com/a/35540717
favorite count: 0
tagged with: swing
has title: How to force-refresh/repaint a JScrollPane?
type: Question

http://stackoverflow.com/comment/34440933
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22617464
has text: @skiwi ++ I'm not allowed to use Java 7 yet, so I forget about the sugar.
type: AnswerComment

http://stackoverflow.com/comment/34278412
comment on: http://stackoverflow.com/a/22520479
type: AnswerComment
has text: Yes, it looks much better now.
score: 0
type: Comment

http://stackoverflow.com/comment/34491034
type: Comment
has text: Do you really need all that you are looking for? You might avoid unnecessary waste of time by following the [KISS principle](http://en.wikipedia.org/wiki/KISS_principle).
score: 0
comment on: http://stackoverflow.com/q/22645674
type: QuestionComment

http://stackoverflow.com/comment/34479922
has text: So you would need to have some sort of event that fires whenever you get an updated value for `HRate`. That event would contain this code. How and when does the `HRate` value change?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22638229
score: 0

http://stackoverflow.com/comment/34484896
comment on: http://stackoverflow.com/q/22642401
type: Comment
has text: @Braj this is the order from fastest to slowst: `pressed typed released`.
type: QuestionComment
score: 0

http://stackoverflow.com/a/22586000
has body: Use a JPassword Field. The syntax is this: JPasswordField password = new JPasswordField("Default Text");
downvote count: 1
answers question: http://stackoverflow.com/q/22583928
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/a/22581510
score: 0
type: Answer
has body: If your thread runs to its end, it stops. It will remain there for you to collect its return status until the thread is cleaned up. To restart within the same thread, you need an extra control flow. For instance: while (restarted) { while (isRunning) { } // Wait for a restart or end click } That is what so called worker threads in a thread pool do, which are intended for maximum performance. But logically, you will probably simply want to create a new thread object and start that one. new Thread(p).start();
accepted answer of: http://stackoverflow.com/q/22581077
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22581077

http://stackoverflow.com/q/22589954
tagged with: tomcat
has title: java - Can't deploy exploded artifact
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22590939
accepted answer: http://stackoverflow.com/a/22590939
type: Question
tagged with: intellij-idea
tagged with: servlets
score: 0
tagged with: artifact
answer count: 1
has body: I can't deploy exploded artefact on TomCat 7, however non-exploded artefact deploys perfectly fine. Can anyone help what am I doing wrong? SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 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.manageApp(HostConfig.java:1544) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:835) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:771) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:622) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:569) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:835) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:771) at javax.management.remote.rmi.RMIConnectionIm…

http://stackoverflow.com/q/22512193
favorite count: 0
has body: I would like to take an array from one class and use it again in other class with the same values first class: package Interface; import java.util.Collection; import petriNet.Arc; import petriNet.Node; public class SMVCode { public String catas[][]=new String[100][100]; public int type[][]=new int[100][100]; Node noeud[][]=new Node[100][100]; /* // fiew line codes */ public int createInitBlocr1 (StringBuffer sb, int k1, int y, Object[] a,int incp,int inct,int f) { Collection cd=((Node)a[k1]).getLeavings().values(); Object[] ab=cd.toArray(); int p=0; int t=0; for(int j=0;j&lt;ab.length;j++) { Node trn= ((Arc)ab[j]).getDestination(); catas[y][f]=trn.getName(); type[y][f]=trn.getType(); noeud[y][f]=trn; f++; f=createInitBlocr2 (sb,y, a,trn,incp,inct,p,t,f); } return f; } public int createInitBlocr2 (StringBuffer sb, int y, Object[] a, Node trn1,int incp,int inct,int p,int t,int f){ // return y; } public String[][] getCatas(){ return catas; } } Second class: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Interface; import java.awt.*; import java.io.Serializable; import javax.swing.*; import Model_Checking.SMVCode; public class Composite extends JFrame implements Serializable{ JFrame frame = new JFrame("Web Service Composit"); public SMVCode c; JInternalFrame disignInternalFrame=new JInternalFrame("Workflow Process Designer"); public Composite() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { frame.setSize(new Dimension(800, 600)); frame.setVisible(true); disignInternalFrame.setSize(new Dimension(750,550)); disignInternalFrame.setIconifiable(false); disignInternalFrame.setMaximizable(true); disignInternalFrame.setClosable(false); disignInternalFrame.setAutoscrolls(true); disignInternalFrame.setResizable(true); disignInternalFrame.setVisible(true); disignInternalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHI…
upvote count: 0
has title: Using again ana array in a different class
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22512297
type: Question
tagged with: java
score: -1
tagged with: class
downvote count: 1
tagged with: arrays
answer count: 1

http://stackoverflow.com/comment/118725506
score: 0
comment on: http://stackoverflow.com/a/22590508
type: AnswerComment
has text: Note that in some date/time libraries, `D`/`DD` is day-of-year while `d`/`dd` is day-of month.
type: Comment

http://stackoverflow.com/comment/34401751
score: 0
has text: See also this [Q&A](http://stackoverflow.com/q/22217428/230513).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22592946

http://stackoverflow.com/comment/34425677
type: AnswerComment
comment on: http://stackoverflow.com/a/22609115
score: 0
type: Comment
has text: Your example is incomplete. The source code is missing important types and variables. Make it complete and perhaps I am able to give you a proper answer. As for now I had to guess a lot, sorry.

http://stackoverflow.com/q/22618680
has comment: http://stackoverflow.com/comment/34443388
tagged with: sqlite
linked to: http://stackoverflow.com/q/21881992
answer count: 1
has body: this is my database, can you please help me with it? i think there is nothing wrong i tried reinstalling the app to update the database initially but still doesnt work. it says that there is no such column _url. This is my class that creates the database: MySQLiteHelper.java public class MySQLiteHelper extends SQLiteOpenHelper { /** * table for locations * | _id | _latitude | _longitude | _time | _provider */ public static final String TABLE_LOCATION = "location"; public static final String COLUMN_LOCID = "_id"; public static final String COLUMN_LATITUDE = "_latitude"; public static final String COLUMN_LONGITUDE = "_longitude"; public static final String COLUMN_TIME = "_time"; public static final String COLUMN_ACCURACY = "_accuracy"; public static final String COLUMN_PROVIDER = "_provider"; /** * table for pictures * | _id | _url | _latitude | _longitude | _time */ public static final String TABLE_PICTURE = "picture"; public static final String COLUMN_PIC_ID = "_id"; public static final String COLUMN_PIC_URL = "_url"; public static final String COLUMN_PIC_LATITUDE = "_latitude"; public static final String COLUMN_PIC_LONGITUDE = "_longitude"; public static final String COLUMN_PIC_TIME = "_time"; public static final String COLUMN_PIC_ACCURACY = "_accuracy"; /** * table for Accelerometer * | _id | _x | _y | _z | _time */ public static final String TABLE_ACCELEROMETER = "accelerometer"; public static final String COLUMN_ACCELEROMETER_ID = "_id"; public static final String COLUMN_ACCELEROMETER_X = "_x"; public static final String COLUMN_ACCELEROMETER_Y = "_y"; public static final String COLUMN_ACCELEROMETER_Z = "_z"; public static final String COLUMN_ACCELEROMETER_TIME = "_time"; /** * table for Sound * | _id | _amplitude | _time */ public static final String TABLE_AMPLITUDE = "sound"; public static final String COLUMN_AMPLITUDE_ID = "_id"; public static final String COLUMN_AMPLITUDE_AMPLITUDE = "_amplitude"; public static final String COLUMN_AMPLITUDE_TIME = "_time"; pr…
favorite count: 0
has comment: http://stackoverflow.com/comment/34443203
tagged with: android
accepted answer: http://stackoverflow.com/a/22619369
type: AnsweredQuestion
has title: Getting SQLite no such column
has comment: http://stackoverflow.com/comment/34443700
has comment: http://stackoverflow.com/comment/34443321
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34443745
tagged with: java
score: -1
tagged with: mysql
has comment: http://stackoverflow.com/comment/34443720
has answer: http://stackoverflow.com/a/22619369
tagged with: sql
upvote count: 0

http://stackoverflow.com/comment/34415784
has text: Okay..If i cannot call cross domain Rest service from my js file, then can i do it in the spring controller?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22603447

http://stackoverflow.com/comment/34419230
score: 0
type: Comment
type: QuestionComment
has text: @Hazim stacktraces tend to be long and messy, but very useful. :)
comment on: http://stackoverflow.com/q/22605621

http://stackoverflow.com/q/22570346
favorite count: 0
has answer: http://stackoverflow.com/a/22571500
has title: android can't establish URL connection
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25851573
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34358101
has answer: http://stackoverflow.com/a/22572085
answer count: 3
upvote count: 1
has body: i've an application that was act properly when i run it with android 2.3.6(Ginger Bread), but when i run it on 4.2 it did'nt work with the URL connection, it can't establish the connection here is the snip of the code that performs the URL connection : try { Add.setEnabled(true); movieContent.setText(""); String TITLE =searchET.getText().toString(); TITLE = TITLE.replaceAll(" ", "%20"); Log.d("title after parsing:", TITLE); URL url = new URL("http://www.omdbapi.com/?i=&amp;t=" + TITLE); String URL2="http://www.omdbapi.com/?i=&amp;t=saw"; Log.d("URL content", url.toString()); HttpURLConnection urlConnection = (HttpURLConnection) url .openConnection(); Log.d("URL content", "register URL"); urlConnection.connect(); Log.d("URL connection", "establish connection"); the log cat shows that the flow reach "register URL" log print it then raise a warning in green labeled as QCNEA: 03-21 23:53:56.596: D/title after parsing:(16623): saw 03-21 23:53:56.596: D/URL content(16623): http://www.omdbapi.com/?i=&amp;t=saw 03-21 23:53:56.596: D/URL content(16623): register URL 03-21 23:53:56.596: I/QCNEA(16623): |NIMS| getaddrinfo: hostname www.omdbapi.com servname NULL numeric 4 appname 03-21 23:53:56.616: I/MediaPlayer(16623): Don't send intent. msg.arg1 = 0, msg.arg2 = 0 03-21 23:53:57.207: V/MediaPlayer(16623): message received msg=2, ext1=0, ext2=0 03-21 23:53:57.207: V/MediaPlayer(16623): playback complete 03-21 23:53:57.207: V/MediaPlayer(16623): callback application 03-21 23:53:57.207: V/MediaPlayer(16623): back from callback knowing that all permission regarding connection are added. the weird thing that there is no error , just can't establish the connection. hope you guys help me with this thanks in advance
tagged with: httpurlconnection

http://stackoverflow.com/a/22645206
accepted answer of: http://stackoverflow.com/q/22643364
has body: argThat certainly works for more than one parameter, and there's nothing obviously wrong with what you're trying to do. I have a nagging hunch that it's selecting the wrong overload: getForEntity(String url, Class&lt;T&gt; responseType, Map&lt;String,?&gt; urlVariables) getForEntity(String url, Class&lt;T&gt; responseType, Object... urlVariables) If the generics don't exactly match, Java may assume that your hasEntry best matches the Object... method where your anyMap matched the Map&lt;String, ?&gt;. In that case, you would be stubbing an overload you're not calling (Object...), and Mockito would revert to default return values for the one you're actually calling in your system under test (Map&lt;String, ?&gt;). Hovering over the method call in your IDE may shed light on which overload the compiler is matching. To give Java a better hint, try a cast, which would look like this (warning, not tested or verified): given(restTemplate.getForEntity( anyString(), any(Class.class), (Map&lt;String, ?&gt;) argThat(hasEntry("myKey", "myValue")))) .willReturn(responseEntityA);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34505524
answers question: http://stackoverflow.com/q/22643364
type: Answer
has comment: http://stackoverflow.com/comment/34602193
score: 3
upvote count: 3

http://stackoverflow.com/comment/34254222
has text: Can you please elaborate your answer so that I can understand your point correctly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22512268
score: 0

http://stackoverflow.com/comment/34309322
type: QuestionComment
has text: Looks like a classpath issue. I'd start by ensuring all required JARs are there and are the right version needed. Also, make sure you don't have duplicate JARs of different verisons.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22536811

http://stackoverflow.com/comment/34488481
type: Comment
type: QuestionComment
has text: Add your hibernate.cfg.xml. Only adding a `HibernateTransactionManager` isn't going to do much, you must also have a proper transaction setup. Also you state that your update is rolled back, but have you actually committed that update statement!
score: 0
comment on: http://stackoverflow.com/q/22641196

http://stackoverflow.com/comment/34290216
type: QuestionComment
score: 1
has text: Basically, there is no requirement for crypto providers to be signed in the crypto API or any related specification or JSR. Each implementation is therefore free to choose any approach. For example, OpenJDK 6 did not require signature while the Oracle JDK 6 did require it. And Android, strictly speaking, is not even "Java" implementation, so it can choose whatever approach it wants. In addition, even if your Android application depends on a signed jars, it will be repacked into a single DEX and signatures of all individual dependencies will be lost.
comment on: http://stackoverflow.com/q/22531906
type: Comment

http://stackoverflow.com/comment/34304410
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22540851
score: 1
has text: What error reason is given in your error callback? What errors are appearing in the javascript console? (F12)

http://stackoverflow.com/comment/34456030
type: Comment
has text: no i solved my problem...actually the problem was with form tag which was wrongly closed ie; form tag was closed before table tag.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22621268

http://stackoverflow.com/comment/34278306
score: 0
has text: Added example of existing use and where to set up a model listener.
type: Comment
comment on: http://stackoverflow.com/a/22514250
type: AnswerComment

http://stackoverflow.com/q/22545999
has comment: http://stackoverflow.com/comment/34313305
has comment: http://stackoverflow.com/comment/34313254
favorite count: 0
has answer: http://stackoverflow.com/a/22546027
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4709175
has body: What is the advantage of using enums over ints? I'm trying to represent the suits in a card game, and I thought 1,2,3,4 would be good enough. But my boss says I need to do it with enums. Why?
score: 2
duplicate of: http://stackoverflow.com/q/4709175
upvote count: 3
downvote count: 1
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/22546071
tagged with: java
has comment: http://stackoverflow.com/comment/34313397
has title: What are enums for in Java?
answer count: 3
has answer: http://stackoverflow.com/a/22546023

http://stackoverflow.com/a/22639617
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34480210
has body: Look at these lines in your example: new Arithmetic(s); boolean balanced = Arithmetic.isBalanced(); The first line creates an object. It uses the class Arithmetic and invokes the constructor that takes a string. Then, since no variable gets assigned the result, the new object gets thrown away. The second line tries to call isBalanced. But (because it isn't declared with static) isBalanced is an instance method, that means it needs to be called on an instance of Arithmetic. You made an object that you could call isBalanced on in the previous line, you just need to keep a reference to it, and use that reference. Assign the new object to a variable: Arithmetic a = new Arithmetic(s); boolean balanced = a.isBalanced();
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/34479702
accepted answer of: http://stackoverflow.com/q/22639458
answers question: http://stackoverflow.com/q/22639458
upvote count: 4
has comment: http://stackoverflow.com/comment/34479989

libsvm
tags question: http://stackoverflow.com/q/22595859
tag name: libsvm
tags question: http://stackoverflow.com/q/22489022
type: Tag
tags question: http://stackoverflow.com/q/22508869

http://stackoverflow.com/a/22497778
answers question: http://stackoverflow.com/q/22497443
score: 0
has body: public Class Restaurant{ private Employee Manager; // private Employee Server; // public Restaurant(){ //I DON"T UNDERSTAND THIS Manager = new Manager(); Server = new Server(); } } class Manager extends Employee{ } class Server extends Employee{ } Now, since Employee is the super class of Manager and server, we can say that "Every Employee is a Manager, every Server is a Manager". Employee e = new Manager(); // is like "Pointing to a manager and saying that he is an employee. Which is correct. The actual object is determined at runtime. Remember, Not all methods/attributes of the "Service/manager" class can be accessed using an Employee reference.
type: Answer

http://stackoverflow.com/comment/34279041
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22512236
has text: Thank you very much! I don't know how I've missed that
score: 0

http://stackoverflow.com/comment/34376810
comment on: http://stackoverflow.com/q/22582027
score: 0
has text: ok, so you have the variables and the code needs to be written?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22624819
upvote count: 1
answers question: http://stackoverflow.com/q/22624535
has body: There is going to be easier/faster ways. I am just giving a thought which should be good in learning purpose. First, do whatever you have now, which reverse words, and leave those consecutive space untouched. then write another method to do consecutive space removing. have 2 pointer, start at the first position where it is not space. A and B keep on moving on together. if (A != B), then we do s[A] = s[B]; s[B] = ' '; If s[A] and s[A-1] is space, then A stop (A is now at the 2nd space), and only B continue moving forward. By such way, A stay the same position and will continue to copy from B, until B gives a non-space character. and it ends when B hit the end. in psuedo code, it is something like int a = first position of non-space; int b = a; while b &lt; s.size() { if (a != b) { s[a] = s[b] s[b] = ' ' } if (both s[a] and s[a-1] are space) { increment b; // leave a untouched } else { increment a; increment b; } } Constant space, O(n) time Another way, which can handle the removal of consecutive space in place when reversing words: The hint is, include those extra spaces when doing reverse. e.g. Given a string abc def ghi L (left) first reverse is trivial so I am skipping it. The hint is, for second word, you are going to stop the L at the position right after the first space: cba def ghi L the "right" side of the reverse is going to be the first right boundary of word: cba def ghi L R Then do the reverse in place cba fed ghi L R Then keep on finding the next position of L to start reverse again: cba fed ghi L Take similar logic cba fed ghi L R then cba fed ihg L R
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22624535
score: 1

http://stackoverflow.com/comment/34249851
has text: The goal is, like in the example, to make methods do nothing. A usecase would be logging where your class has a single logger which can be either a TraceLogger or an ErrorLogger, etc. All loggers implement the full set of methods (trace, debug, info, warn, error) and only TraceLogger implements all of them. All implementations one level up will override the relevant method(s) from the 1-level-less logger, replacing them with a do-nothing method. Since there are only as much actual Loggers as there are loglevels, I would like to put them in an enum.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22506573
type: QuestionComment

http://stackoverflow.com/comment/34246603
comment on: http://stackoverflow.com/q/22508912
score: 1
type: Comment
has text: use `sb.append(line);` instead of `sb.append(line + "\n");` also log json before converting to JSONObject for check getting valid json string from server or not
type: QuestionComment

http://stackoverflow.com/q/22542558
has title: (Student) Employing a while loop to catch and reprompt for invalid user entries
has body: I am working to finish a program that uses a substitution cipher to encode and decode txt files. After quite a bit of work, my program is all but finished. The program functions by first asking the user if he/she wants to encode or decode a file. After answering this question, the program prompts the user to enter the name of the file that is being inputted (for en/decoding), and also the name of the output file that the program will send the new en/decoded text to. It looks a little something like this: (double spaced for line breaks) start of program Do you wish to encode or decode: (user enters on console...let's use encode for example) Enter name of input file: (user enters name of file here) Enter name of output file: (user enters name of output file to be created by program) end of program Everything works fine. I have created various methods that do the encoding and decoding, but am having trouble with a part that should be quite easy considering the rest of this. Among the methods that I wrote within the larger program, I have one that prompts a user to input the name of the output file (pasted below). However, I would like to write is so that if the user enters a name of a file that already exists, instead of overwriting it, I want to prompt the user and ask if he/she is sure they want to override the file by clicking "y" or "n" (will use the toLowerCase() method to ensure case value is okay. I know that I want to use a while loop for this, but am having lots of trouble figuring out where (the try/catch portion seems to be giving me trouble). Can anyone offer me guidance on the best way to implement my while loop so that the user has indefinite number of options for inputting the name of the output file? Much thanks. (I can always paste the entire code as well...just seemed as if not needed). public static PrintStream getOutputPrintStream(Scanner console){ PrintStream output = null; while (output == null) { System.out.print("Enter output file: "); String fi…
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/22542842
accepted answer: http://stackoverflow.com/a/22542842
favorite count: 0
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/34355522
score: 0
type: Comment
has text: This is recursive.. the function is in its closed form.
comment on: http://stackoverflow.com/a/22570002
type: AnswerComment

http://stackoverflow.com/q/22623001
type: Question
tagged with: graphics
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/34451071
score: 0
has comment: http://stackoverflow.com/comment/34450770
has body: I have to fill in the code for a project. I have typed out what i think is right for the first section of code, but I am still confused as it is not popping up the right graphics. NestedLayoutPractice class /* Practice using layouts Anderson, Franceschi */ import javax.swing.*; import java.awt.*; import java.awt.event.*; public class NestedLayoutPractice extends JFrame { private Container contents; private Game game; private BorderLayout bl; private JLabel bottom; // ***** Task 1: declare a JPanel named top // also declare three JButton instance variables // that will be added to the JPanel top // these buttons will determine the grid size of the game: // 3-by-3, 4-by-4, or 5-by-5 private JPanel top; private JButton [] topButtons; private String [] topGridSize = {"3-by-3", "4-by-4", "5-by-5", }; private JButton reset; // task 1 ends here public NestedLayoutPractice( ) { super( "Practicing layout managers" ); contents = getContentPane( ); // ***** Task 2: student code starts here // instantiate the BorderLayout manager bl // set the layout manager of the content pane contents to bl game = new Game( 3 ); // instantiating the GamePanel object // add panel to the center of the content pane // task 2 ends here bottom = new JLabel( "Have fun playing this Tile Puzzle game", SwingConstants.CENTER ); // ***** Task 3: Student code restarts here // instantiate the JPanel component named top // set the layout of top to a 1-by-3 grid // instantiate the JButtons that determine the grid size // add the buttons to JPanel top // add JPanel top to the content pane as its north component // task 3 ends here // ***** Task 5: Student code restarts here // Note: search for and complete Task 4 before performing this task // declare and instantiate an ActionListener // register the listener on the 3 buttons // that you declared in Task 1 // task 5 ends here contents.add( bottom, BorderLayout.SOUTH ); setSize( 325, 325 ); setVisible( true ); } // ***** Task 4: Student code restarts here // …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34450732
has title: Setting up a grid with JButtons
answer count: 0
has comment: http://stackoverflow.com/comment/34450894
tagged with: swing

http://stackoverflow.com/a/22604880
has body: Yeah having a build server (like Bamboo, Cruise Control er TeamCity) and a build tool like Maven (along with surefire-plugin for TestNg/Junit and Failsafe-plugin for integration testing maybe using something like Selenium 2) is quite popular, because it's relatively trivial to setup (works almost out-of-the-box). :)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22503558

http://stackoverflow.com/comment/34351319
type: QuestionComment
comment on: http://stackoverflow.com/q/22567831
has text: How can I debug it? I'm running from the command line. If you're right there must be a Gradle option to not send to the console EOF.
score: 0
type: Comment

http://stackoverflow.com/comment/34423141
type: QuestionComment
comment on: http://stackoverflow.com/q/22606627
has text: I would say it has nothing to do with converters, and more to do with the names of your model attributes. In your Controller, you set `partsAttribute`, `servisTypesAttribute`, and `servisAttribute` in your model, but in your view you are looping over something called `parts`.
score: 0
type: Comment

http://stackoverflow.com/a/22646199
downvote count: 1
has body: You should register a new OnClickListener object instead of a ClickListener. Also, you have to provide an implementation for the onClick method like this: new OnClickListener() { public void onClick(View v) { // do something when the button is clicked } };
score: -1
accepted answer of: http://stackoverflow.com/q/22645937
upvote count: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34491772
answers question: http://stackoverflow.com/q/22645937

http://stackoverflow.com/a/22573328
upvote count: 6
accepted answer of: http://stackoverflow.com/q/22573299
has body: Try this.. You can't change string resource at the run time public void printStarter(View view) { ((TextView)findViewById(R.id.fullscreen_content)).setText("Your Text"); }
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6
answers question: http://stackoverflow.com/q/22573299

http://stackoverflow.com/q/22628785
tagged with: soap
accepted answer: http://stackoverflow.com/a/22666495
tagged with: soapui
tagged with: web-services
has body: At work i have to implement an EDI thing. I have to create an XML message, sign it with a certificate, encode it with Base64, pack it in an XML structure and send it to a server. To send the message to the soap service i use HTTPSOAPConnection. The problem i ran into is, that i always get a 503 service unavailable error. I thought okay the service is not started, but for curiosity i tryed to reach it with SoapUi. Sending the same message to the same service endpoint i get a HTTP 200 Ok, with a response message. Analyzing this response i have found, that there is a Base64 encoed xml inside, like the service documentation said. Decoding this i found out, that the server sent me an error code, saying that the service is unavailable. But how can it be, that with my java generated request i get a 503 and with SoapUi i get a service specific response, containing the service specific error code for 503? The only thing i can think about is, that something is wrong with my request. But what other reasons can a Http 503 have? How can i analyze the error (for example comparing the MimeHeader of SoapUi with mine...)? One more information i can give you is the block in which the error occures: Starting at line 245 of HTTPSOAPConnection responseCode = httpConnection.getResponseCode(); // let HTTP_INTERNAL_ERROR (500) through because it is used for SOAP faults if (responseCode == HttpURLConnection.HTTP_INTERNAL_ERROR) { isFailure = true; } //else if (responseCode != HttpURLConnection.HTTP_OK) //else if (!(responseCode &gt;= HttpURLConnection.HTTP_OK &amp;&amp; responseCode &lt; 207)) else if ((responseCode / 100) != 2) { log.log(Level.SEVERE, "SAAJ0008.p2p.bad.response", new String[] {httpConnection.getResponseMessage()}); throw new SOAPExceptionImpl( "Bad response: (" + responseCode + httpConnection.getResponseMessage() ); } I am getting this "Bad response", with a 503 response code and no response message. I hope this informations are enough to, at least, get some guesses.
answer count: 1
tagged with: http
has title: Reasons for a HTTP 503 Service unavailable Error
score: 0
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22666495
type: Question

http://stackoverflow.com/comment/34222650
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22489506
has text: What version of Primefaces?
score: 0

http://stackoverflow.com/comment/34471718
score: 4
type: Comment
type: QuestionComment
has text: How you used an object before it is no longer referenced makes no difference to how long it takes to clean up.
comment on: http://stackoverflow.com/q/22635188

http://stackoverflow.com/comment/34232675
type: QuestionComment
has text: i have set my classpath to C:\app\raju\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6_g.jar this path but still iam getting the error
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22500451

http://stackoverflow.com/a/22552516
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22552208
answers question: http://stackoverflow.com/q/22552208
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Yes, constructing a String from bytes decodes the bytes according to the current default character encoding (if one is not explicitly specified). Also String.getBytes() does the same in reverse (and may not necessarily produce the same sequence of bytes that was used to create it). A String holds text. If your data is raw binary data and is intended to be treated as such, you should not be storing it in a String, you should be storing it in a byte[]. There is no need to have String data at all in that first bit, just write the byte[] to the file: byte[] responseBody = outstream.toByteArray(); String data = new String(responseBody); ... out.write(data.getBytes()); Can just be: byte[] responseBody = outstream.toByteArray(); ... out.write(responseBody);
score: 2

http://stackoverflow.com/comment/34368324
type: AnswerComment
type: Comment
has text: @JoopEggen Yo ushould post this as an answer.Seriously
comment on: http://stackoverflow.com/a/22577209
score: 0

http://stackoverflow.com/q/22617927
tagged with: bitmapfactory
has comment: http://stackoverflow.com/comment/34441877
has comment: http://stackoverflow.com/comment/34441450
linked to: http://stackoverflow.com/q/4956876
has body: Any ideas why this code won't accept bitmapfactory? All required imports are present. String datatypes can be retrieved in the same query with no issue. Code in DatabaseConnection.java: Blob blob = result.getBlob(5); int blobLength = (int) blob.length(); byte[] blobAsBytes = blob.getBytes(1, blobLength); Bitmap image = BitmapFactory.decodeByteArray(blobAsBytes,0,blobAsBytes.length); Error: Exception in thread "main" java.lang.NoClassDefFoundError: android/graphics/BitmapFactory at com.example.wildtrail.DatabaseConnection.main(DatabaseConnection.java:153) Caused by: java.lang.ClassNotFoundException: android.graphics.BitmapFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
type: UnansweredQuestion
upvote count: 1
tagged with: bitmap
has title: NoClassDefFoundError on android/graphics/bitmapfactory
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22618255
type: Question
has comment: http://stackoverflow.com/comment/34441875
downvote count: 0
favorite count: 0
tagged with: classnotfoundexception
tagged with: android
answer count: 1

http://stackoverflow.com/q/22634058
has body: I would like to create applications forming charts based on data from parse.com. I have read some examples and tutorials but still have problem with displaying charts. Below is my code: import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.util.Log; import com.parse.GetCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import org.achartengine.ChartFactory; import org.achartengine.GraphicalView; import org.achartengine.chart.PointStyle; import org.achartengine.model.XYMultipleSeriesDataset; import org.achartengine.model.XYSeries; import org.achartengine.renderer.XYMultipleSeriesRenderer; import org.achartengine.renderer.XYSeriesRenderer; import java.util.ArrayList; public class LineGraph { public ArrayList&lt;Integer&gt; dataArray; XYMultipleSeriesDataset dataset; XYMultipleSeriesRenderer renderer; public static boolean ClickEnabled = true; public Intent getIntent(Context context) { ArrayList&lt;Integer&gt; y = this.dataArray; XYSeries seriesY = new XYSeries("Y"); for (int i = 0; i &lt; y.size(); i++) { seriesY.add(i, y.get(i)); } dataset = new XYMultipleSeriesDataset(); dataset.addSeries(seriesY); renderer.setPanEnabled(true, false); renderer.setClickEnabled(ClickEnabled); renderer.setBackgroundColor(Color.WHITE); renderer.setApplyBackgroundColor(true); renderer.setChartTitle("Simple data"); renderer.setAxesColor(Color.BLACK); XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer(); XYSeriesRenderer renderer = new XYSeriesRenderer(); renderer.setColor(Color.RED); renderer.setPointStyle(PointStyle.DIAMOND); mRenderer.addSeriesRenderer(renderer); Intent intent = ChartFactory.getLineChartIntent(context, dataset, mRenderer, "Line Graph Title"); return intent; } public void getData() { ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("Counters_data"); query.getInBackground("lxFzCTeOcl", new GetCallback&lt;ParseObject&gt;() { public void done(Pars…
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22657577
favorite count: 0
has comment: http://stackoverflow.com/comment/34503326
type: Question
tagged with: android
tagged with: parse-platform
upvote count: 1
tagged with: achartengine
answer count: 1
tagged with: java
type: UnansweredQuestion
has title: AChartEngine - Charts with data from parse.com won't display

http://stackoverflow.com/a/22528905
upvote count: 1
downvote count: 0
type: Answer
has body: You are checking whether the String checkQuery is null, but you are assigning a value to it two lines above. So the ode in the if block will never be executed. if (checkQuery == null) {
score: 1
answers question: http://stackoverflow.com/q/22528831

http://stackoverflow.com/q/22607530
type: Question
linked to: http://stackoverflow.com/q/9413656
linked to: http://stackoverflow.com/q/5621338
has answer: http://stackoverflow.com/a/22607718
has comment: http://stackoverflow.com/comment/34422542
score: 0
answer count: 3
has body: JButton btnNewButton = new JButton("CLICK ME!"); btnNewButton.setBounds(134, 142, 274, 77); btnNewButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { clicked++; String x=Integer.toString(clicked); textArea.setText(x); } }); I'm stuck here I want to create a program in GUI that counts the number of button click in specific time for example the timer start then count the number of clicks when the loop stop the button click is not working or stop counting the clicks
has answer: http://stackoverflow.com/a/22607898
type: UnansweredQuestion
tagged with: swing
tagged with: jbutton
has title: Count number of button clicks in given time
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/34422406
tagged with: java
has answer: http://stackoverflow.com/a/22608119

http://stackoverflow.com/comment/91794437
comment on: http://stackoverflow.com/a/52425521
has text: `incompatible types: java.util.Comparator<java.lang.String> cannot be converted to MyComparable` and `MyComparable` is not generic (no type) so `(MyComparable<String>)` would not work either
score: 3
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34484987
type: Comment
type: QuestionComment
has text: @Braj KeyReleased would work, but it's not what I want in my context. KeyTyped doesn't work.
score: 0
comment on: http://stackoverflow.com/q/22642401

http://stackoverflow.com/comment/34287468
type: Comment
has text: @skiwi and Ray: There is no parameter type declared here with method signature. It is just using the one declared with class.
comment on: http://stackoverflow.com/a/22531366
score: 0
type: AnswerComment

http://stackoverflow.com/q/22631258
tagged with: android
has comment: http://stackoverflow.com/comment/34464694
tagged with: swipe
has body: I'm new to android and I am making a calendar application to practice. It's almost done but there's 1 thing I can't get to work. I would like to swipe horizontal from left to right to browse months. I've been trying it with this piece of code: public boolean onTouchEvent(MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: x1 = event.getX(); break; case MotionEvent.ACTION_UP: x2 = event.getX(); float deltaX = x2 - x1; if (Math.abs(deltaX) &gt; MIN_DISTANCE) { month++; Log.v("test", "test"); theCursor = dbh.getDiaries(month); adapter = new MyCursorAdapter(this, theCursor); this.setListAdapter(adapter); } else { month--; Log.v("test", "test"); theCursor = dbh.getDiaries(month); adapter = new MyCursorAdapter(this, theCursor); this.setListAdapter(adapter); } break; } return super.onTouchEvent(event); } This only swipes from top to bottom and not back, can someone help me fix this code so I can swipe from left to right and back? Thanks!
has answer: http://stackoverflow.com/a/22631589
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34464863
score: 0
answer count: 2
has title: How can I swipe horizontal left and right with android
has answer: http://stackoverflow.com/a/74826779
type: UnansweredQuestion

http://stackoverflow.com/comment/34360019
type: Comment
type: QuestionComment
has text: `jLabel1MouseClicked(java.awt.event.MouseEvent evt)` use an undecorated button with an `ActionListener` instead. It will look like a `JLabel` but be focusable, allow mnemonics and also respond to keyboard input.
comment on: http://stackoverflow.com/q/22565132
score: 0

http://stackoverflow.com/comment/34493938
type: Comment
has text: Not True though, becuase it outputs chars, strings and ints [1]: ["we"]-> [2]: ["we"]-> ["d"]-> [1]: ["d"]-> [2]: ["d"]-> ["15"]-> [3]: ["d"]-> ["15"]-> ["3"]-> [2]: ["15"]-> ["3"]-> [3]: ["15"]-> ["3"]-> ["7"]-> [2]: ["3"]-> ["7"]-> [3]: ["3"]-> ["7"]-> ["20"]->
comment on: http://stackoverflow.com/a/22647287
score: 0
type: AnswerComment

http://stackoverflow.com/q/22554373
accepted answer: http://stackoverflow.com/a/22554459
has comment: http://stackoverflow.com/comment/34327069
has answer: http://stackoverflow.com/a/22554620
has answer: http://stackoverflow.com/a/36053040
has body: So I have written this code, and I am proud of it since I have not been coding for a long time. What it does, it asks for a number and then prints all the Prime numbers there are from 1 to that number. import java.util.Scanner; class PrimeNumberExample { public static void main(String args[]) { //get input till which prime number to be printed System.out.println("Enter the number till which prime number to be printed: "); int limit = new Scanner(System.in).nextInt(); //printing primer numbers till the limit ( 1 to 100) System.out.println("Printing prime number from 1 to " + limit); for(int number = 2; number&lt;=limit; number++){ //print prime numbers only if(isPrime(number)){ System.out.println(number); } } } /* * Prime number is not divisible by any number other than 1 and itself * @return true if number is prime */ public static boolean isPrime(int number){ for(int i=2; i&lt;number; i++){ if(number%i == 0){ return false; //number is divisible so its not prime } } return true; //number is prime now } } But, what I would like it to do is ask for a number, let us take 10 and then print the first 10 prime numbers, I have tried to see if I could find a way, but I do not know how to since I have not used java that much. I hope that you can and will help me.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34327373
possible better answer: http://stackoverflow.com/a/22554500
has answer: http://stackoverflow.com/a/22554500
tagged with: primes
has answer: http://stackoverflow.com/a/22554514
type: Question
has title: Java:Counting prime numbers
upvote count: 9
has answer: http://stackoverflow.com/a/22554459
tagged with: java
has answer: http://stackoverflow.com/a/22554613
score: 9
has comment: http://stackoverflow.com/comment/34327613
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/33425906
favorite count: 0

http://stackoverflow.com/comment/34357356
type: AnswerComment
score: 0
has text: haha - stupid me... import java.awt.event.*; was missing. All set now !!!!!!!!!!!!!!
comment on: http://stackoverflow.com/a/22570830
type: Comment

http://stackoverflow.com/q/22619453
has answer: http://stackoverflow.com/a/22619499
has comment: http://stackoverflow.com/comment/34444788
has comment: http://stackoverflow.com/comment/34444365
has answer: http://stackoverflow.com/a/22619515
favorite count: 0
downvote count: 12
duplicate of: http://stackoverflow.com/q/3481828
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22619499
has comment: http://stackoverflow.com/comment/34444339
has answer: http://stackoverflow.com/a/22619708
tagged with: java
has comment: http://stackoverflow.com/comment/34444371
has comment: http://stackoverflow.com/comment/34444850
has comment: http://stackoverflow.com/comment/34444475
has answer: http://stackoverflow.com/a/22620117
has body: I need to split a text (String), the text is just like this: [title],[description blablablablablabla] Is there a way to do this? I need to store in a String[] the 2 texts between brackets, separated by a ",".
type: Question
accepted answer: http://stackoverflow.com/a/22620117
score: -9
has comment: http://stackoverflow.com/comment/34444482
tagged with: brackets
linked to: http://stackoverflow.com/q/3481828
has title: Java: split text
upvote count: 3
has comment: http://stackoverflow.com/comment/34486238

http://stackoverflow.com/a/22610772
upvote count: 1
answers question: http://stackoverflow.com/q/22610603
has comment: http://stackoverflow.com/comment/34428835
downvote count: 0
has comment: http://stackoverflow.com/comment/34429356
score: 1
has comment: http://stackoverflow.com/comment/34429748
has body: You are correct that number++ involves a write, but it also involves a read. An atomic operation is, by definition, a single operation that either succeeds completely or fails completely. Since number++ performs multiple independent operations, it is not atomic. There are, however, APIs to increment a value atomically as a single operation. At runtime, those APIs make use of specialized CPU instructions which are able to perform both a read and a write as a single unit of work. A single read or write to a word-aligned, word-sized (or smaller) value is atomic, e.g.: int x; x = 5 // write 'x' 5 + x // read 'x' So you probably do understand what a read or write is; you probably didn't consider that the ++ operator performs both discretely. When doing this without synchronization the programs suffers from ´thread interference. SO I understand that its not atomic. But when I change another variable that belongs to an object that these threads share - there are NO interference whatsoever. The shared variable from this object is changed via a mutator. If you are manipulating shared data without a synchronization mechanism or atomic operations, and you are not seeing data races, then you simply got lucky, or data races are occurring, and you aren't noticing. It is difficult to say without seeing your actual code.
type: Answer

http://stackoverflow.com/comment/34323769
comment on: http://stackoverflow.com/q/22548222
score: 0
type: Comment
has text: You might need to post your security configuration. Is the page you are looking at protected by the filter chain?
type: QuestionComment

hql
tag name: hql
tags question: http://stackoverflow.com/q/22504703
tags question: http://stackoverflow.com/q/22605546
tags question: http://stackoverflow.com/q/22490610
tags question: http://stackoverflow.com/q/22551270
type: Tag
tags question: http://stackoverflow.com/q/22624985

http://stackoverflow.com/comment/34301783
type: Comment
has text: I assume `(long) interval` would cast `interval` to long, `(long) 0.5 == 0`, hence your period is 0. you need to `(long) (interval * 1000)`
type: QuestionComment
comment on: http://stackoverflow.com/q/22539100
score: 0

http://stackoverflow.com/a/22611925
downvote count: 0
answers question: http://stackoverflow.com/q/22611919
type: Answer
has comment: http://stackoverflow.com/comment/64180472
upvote count: 17
score: 17
has comment: http://stackoverflow.com/comment/64175678
has body: This behaviour is documented, albeit it is not very visible. You have to delve into the java.nio.file package description to see, right at the end, that: Unless otherwise noted, invoking a method of any class or interface in this package created by one provider with a parameter that is an object created by another provider, will throw ProviderMismatchException. The reasons for this behaviour may not be obvious, but consider for instance that two filesystems can define a different separator. There is no method in the JDK which will help you there. If your filesystems use the same separator then you can work around this using: path1.resolve(path2.toString()) Otherwise this utility method can help: public static Path pathTransform(final FileSystem fs, final Path path) { Path ret = fs.getPath(path.isAbsolute() ? fs.getSeparator() : ""); for (final Path component: path) ret = ret.resolve(component.getFileName().toString()); return ret; } Then the above can be written as: final Path localPath = pathTransform(localDir.getFileSystem(), zipPath); Files.exists(localDir.resolve(localPath));
has comment: http://stackoverflow.com/comment/64182202

http://stackoverflow.com/comment/34403923
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22596707
has text: @Ingo Actually its with other languages too. Take Python for example. When I started learning it, it seem to me like there were a set of rules that every Python programmer is expected to follow. It was in fact strange for me. Talking about this one, I guess introduction of `EnumSet` in Java was clear indication that, we as a Java programmer can avoid using bit fields, as there is a better alternative. The above post in the thread is only talking about the situation where people might follow from the source code that we should prefer bitfields over `EnumSet`.

http://stackoverflow.com/comment/34440032
score: 0
comment on: http://stackoverflow.com/q/22617104
has text: Have you tried overriding paintComponent() instead of paint()? see [link](http://stackoverflow.com/questions/9389187/difference-between-paint-paintcomponent-and-paintcomponents-in-swing)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22544834
has answer: http://stackoverflow.com/a/22545288
tagged with: android
has answer: http://stackoverflow.com/a/22545317
tagged with: playlist
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34311394
tagged with: java
has title: Adding items to an array list by clicking on an item from an arraylist in another activity
type: Question
answer count: 2
tagged with: onitemclicklistener
has body: I know I am Probably making a bigger deal out of this but here is my problem: I basically want to be able to make a playlist from a list of songs. As each song/item is clicked it adds it to another arraylist in another activity. Please help it so frustrating: here is my code.. public class SDLTlist extends ListActivity { // Songs list public ArrayList&lt;HashMap&lt;String, String&gt;&gt; songsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ltsdlist); ArrayList&lt;HashMap&lt;String, String&gt;&gt; songsListData = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); ImportSD plm = new ImportSD(); // get all songs from sdcard this.songsList = plm.getPlayList(); // looping through playlist for (int i = 0; i &lt; songsList.size(); i++) { // creating new HashMap HashMap&lt;String, String&gt; song = songsList.get(i); // adding HashList to ArrayList songsListData.add(song); } // Adding menuItems to ListView ListAdapter adapter = new SimpleAdapter(this, songsListData, R.layout.playlist_item, new String[] { "songTitle" }, new int[] { R.id.songTitle }); setListAdapter(adapter); }; }); } } The above class imports songs using MEDIA_PATH with file extensions .MP3 (which is called in another class called importSD) and lists them in an array, as I select an item from that list I want it to be added to another list in a different activity. Should I use the onItemClickListners function? If so how would I do it?
tagged with: arraylist
score: 0

http://stackoverflow.com/q/22564895
tagged with: vaadin7
has body: So I have a Vaadin 7 Application that I have been working on but now there is a requirement to integrate JAAS and eventually OpenAM for authentication and authorization. I noticed that alot of folks were using Spring to get it to work, so I went that route. I used the VaadinSpringIntegration addon and I think it is setup correctly, but when I launch my app, my autowired bean is null. I have never used Spring before so its very possible I'm overlooking something. So here is a part of my web.xml <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> Hoplite Tool org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/applicationContext.xml Hoplite org.hoplite.servlet.HopliteServlet UI org.hoplite.dashboard.DashboardUI widgetset org.hoplite.dashboard.DashboardWidgetSet UIProvider org.hoplite.dashboard.DashboardUIProvider true BAT3 /* Here is my 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:lang="http://www.springframework.org/schema/lang" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:annotation-config /> <context:component-scan base-package="org.hoplite.dashboard" /> </beans> I had to include some javascript for the webapp so I extended SpringVaadinServlet public class HopliteServlet extends SpringVaadinServlet { /** * Attempt to load extra javascript * * @throws Serv…
tagged with: spring
has comment: http://stackoverflow.com/comment/34428646
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34432083
accepted answer: http://stackoverflow.com/a/22613465
tagged with: java
has comment: http://stackoverflow.com/comment/34346695
type: Question
tagged with: ejb
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34428237
tagged with: jaas
has answer: http://stackoverflow.com/a/22613465
has title: Vaadin 7 + Spring + VaadinSpringIntegration Add-on - Autowired bean is null
upvote count: 2

http://stackoverflow.com/a/22626071
score: 0
has comment: http://stackoverflow.com/comment/34467050
type: Answer
has body: The only difference I know of is the precision, where float data type is a single precision 32-bit IEEE 754 floating point and double data type is a double precision 64-bit IEEE 754 floating point. Hope this helped you get a better understanding of the difference.
answers question: http://stackoverflow.com/q/22625924

http://stackoverflow.com/a/22596413
has comment: http://stackoverflow.com/comment/34403364
type: Answer
upvote count: 11
answers question: http://stackoverflow.com/q/22595560
score: 11
has comment: http://stackoverflow.com/comment/34405400
type: AcceptedAnswer
downvote count: 0
has body: Privileges on the database are not enough. You also need at least the USAGE privilege for relevant schema and the SELECT privilege for the table. More details in this closely related answer: How to grant all privileges on views to arbitrary user
accepted answer of: http://stackoverflow.com/q/22595560

http://stackoverflow.com/comment/34737461
type: QuestionComment
comment on: http://stackoverflow.com/q/22497563
has text: @Braj as you said _"You can use a POJO class to store the attributes rather than using string. In that case you don't need to split the string every time while retrieving the attribute value"_ I am taking input xml , converting it to `DOM document(inpDoc)` and then calling `getXmlValues` where i am making object of `PojoClass` class and passing all attributes. Then I store this object in a hashmap with "LineNo" as key. Is **[this](http://shrib.com/xmlJava)** what you were suggesting ? Posting code snippet in other link as its loosing its format in comments here
score: 0
type: Comment

http://stackoverflow.com/q/22511775
answer count: 5
has comment: http://stackoverflow.com/comment/34252297
has comment: http://stackoverflow.com/comment/34252540
linked to: http://stackoverflow.com/q/1301276
has answer: http://stackoverflow.com/a/22513705
has answer: http://stackoverflow.com/a/22511880
has comment: http://stackoverflow.com/comment/34252218
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22511889
has answer: http://stackoverflow.com/a/22512207
tagged with: java
downvote count: 3
has title: Why does array-size declaration use "1" as the first index?
has comment: http://stackoverflow.com/comment/34251884
has body: Something that I noticed about C#/Java is this seemingly (to me at the moment) inconsistent issue with array size declaration and the default first-index of array sizes. When working with arrays, say you want to create a new integer array size 3, it would look like this: int[] newArray = new int[3] {1, 2, 3}; Totally find and readable... Right? The standard with programming languages seem to dictate that the "first" index is 0. Using that logic, if I am interested in creating an array the size 3, I should really be writing this: int[] newArray = new int[2] {1, 2, 3}; Wait a minute.. VS is throwing an error, saying an array initialize of length 2 is expected. So there's an inconsistency with the first index in looping through an array and the array-size declaration? The former uses a 0-th based index, and the second a 1-th index. It's not game-breaking/changing in any form or way, but I'm genuinely curious why there's a discrepancy here, or hell, if this is even an issue at all (like I say, it's not game-breaking in any way, but I'm curious as to why it's done this way). I can at the moment think of reasons why 1-th based index would be used: In a for-loop you would use &lt; newArray.Length as opposed to &lt; newArray.Length - 1 or &lt; newArray.Length. Working with Lists for awhile and then coming back to size-needs-to-be-declared-arrays caught me a bit off-guard.
upvote count: 7
type: Question
tagged with: c#
possible better answer: http://stackoverflow.com/a/22511814
has comment: http://stackoverflow.com/comment/34252426
has answer: http://stackoverflow.com/a/22511814
score: 4
has comment: http://stackoverflow.com/comment/34252152
accepted answer: http://stackoverflow.com/a/22512207
tagged with: arrays
has comment: http://stackoverflow.com/comment/34252226
favorite count: 0

http://stackoverflow.com/comment/34259186
type: QuestionComment
comment on: http://stackoverflow.com/q/22515524
type: Comment
has text: If the keys are equal then it won't do anything with the value, except put it in the bucket. It won't call any methods on the value.
score: 0

http://stackoverflow.com/a/22596025
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/34402209
has body: You're creating an array but not filling it with objects. Think of an array of reference type like an egg crate. Until you fill it with eggs, you can't use any of the eggs in the crate. So change to: // note that class names should begin with an uppercase letter public class Exercise{ public static void main(String []args){ Person[] people = new Person [20]; for (int i = 0; i &lt; people.length; i++) { people[i] = new Person(); } people[0].setName("zgur"); System.out.printf("" + people[0].getName()); } } If this were my code, I'd consider using an ArrayList&lt;Person&gt; and only add a Person if and when needed. For example public static void main(String[] args) { List&lt;Person&gt; personList = new ArrayList&lt;Person&gt;(); personList.add(new Person("Stan")); // assuming that a String constructor exists personList.add(new Person("Bill")); }
answers question: http://stackoverflow.com/q/22596005
has comment: http://stackoverflow.com/comment/34402258
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34402036
has comment: http://stackoverflow.com/comment/34402032

http://stackoverflow.com/a/22582715
has comment: http://stackoverflow.com/comment/34390084
has comment: http://stackoverflow.com/comment/34380456
score: 0
has body: After you ran your main class in eclipse just go to File &gt; Export &gt; Runnable JAR. Select the matching configuration to your file. You should get that : If you need to load swt dynamically: public static String getArchFilename(String prefix) { return prefix + "_" + getOSName() + "_" + getArchName() + ".jar"; } private static String getOSName() { String osNameProperty = System.getProperty("os.name"); if (osNameProperty == null) { throw new RuntimeException("os.name property is not set"); } else { osNameProperty = osNameProperty.toLowerCase(); } if (osNameProperty.contains("win")) { return "win"; } else if (osNameProperty.contains("mac")) { return "osx"; } else if (osNameProperty.contains("linux") || osNameProperty.contains("nix")) { return "linux"; } else { throw new RuntimeException("Unknown OS name: " + osNameProperty); } } private static String getArchName() { String osArch = System.getProperty("os.arch"); if (osArch != null &amp;&amp; osArch.contains("64")) { return "64"; } else { return "32"; } } public static void addJarToClasspath(File jarFile) { try { URL url = jarFile.toURI().toURL(); URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); Class&lt;?&gt; urlClass = URLClassLoader.class; Method method = urlClass.getDeclaredMethod("addURL", new Class&lt;?&gt;[] { URL.class }); method.setAccessible(true); method.invoke(urlClassLoader, new Object[] { url }); } catch (Throwable t) { t.printStackTrace(); } } Then : File swtJar = new File(getArchFilename("lib/swt")); addJarToClasspath(swtJar); assuming te structure outside the jar is : lib/swt_win_32.jar lib/swt_win_64.jar lib/swt_linux_32.jar lib/swt_linux_64.jar From http://www.chrisnewland.com/select-correct-swt-jar-for-your-os-and-jvm-at-runtime-191
type: Answer
has comment: http://stackoverflow.com/comment/34380273
has comment: http://stackoverflow.com/comment/34378209
has comment: http://stackoverflow.com/comment/34380418
has comment: http://stackoverflow.com/comment/34380978
answers question: http://stackoverflow.com/q/22582607

http://stackoverflow.com/a/22644667
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22644563
answers question: http://stackoverflow.com/q/22644563
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34522364
has comment: http://stackoverflow.com/comment/34516523
score: 1
has comment: http://stackoverflow.com/comment/34516413
has comment: http://stackoverflow.com/comment/34515128
has body: The problem is that you never initialize your HttpSession s variable: @WebServlet(urlPatterns = {"/ShowPersonServlet"}) public class ShowPersonServlet extends HttpServlet { HttpSession s; //null by default //... protected void processRequest(...) { //... //since never initialized, s is null user.add((Person) s.getAttribute("person")); } @Override protected void doGet(...) { //... //since never initialized, s is null s.setAttribute("person",person); } } Make-it-work solution: Set the value of s s = request.getSession(); Real world solution: Remove all the fields from the Servlet, NEVER try to handle state in your servlet unless they are resources managed by the container like EJBs. Change the scope of your HttpSession s to be local per method. Also, change its name from s to session or something more useful. Move your HTML code to a component that deals with view details like a JSP, then perform a forward to the view. So, your code would look like this: @WebServlet(urlPatterns = {"/ShowPersonServlet"}) public class ShowPersonServlet extends HttpServlet { /* HttpSession s ; //moved as local variable Person person = new Person(); //moved as local variable private List&lt;Person&gt; user = new ArrayList&lt;Person&gt;(); //not sure where you want to store this */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); HttpSession session = request.getSession(); List&lt;Person&gt; personList = (List&lt;Person&gt;) session.getAttribute("personList"); if (personList == null) { personList = new ArrayList&lt;&gt;(); session.setAttribute("personList", personList); } personList.add((Person) session.getAttribute("person")); /* try (PrintWriter out = response.getWriter()) { //removed to shorten this answer } */ request.getRequestDispatcher("/showPerson.jsp").forward(request, response); } @Override protected void doGet(HttpServletRequest request, HttpServletRe…

http://stackoverflow.com/q/22498820
tagged with: android-mediaplayer
tagged with: get
tagged with: proxy
upvote count: 1
downvote count: 0
favorite count: 0
has body: I am developing an application for extracting id3 tags from HLS live streams on Android. For this purpose, I have developed a proxy server which intercepts the data requested by the media player and performs id3 extraction. The media player requests are intercepted by the proxy server, the server relays the request to the remote server(the actual server hosting the media files), gets the response and sends it(as it is ) to the media player for playback. The problem I am facing currently is with two types of get requests from the media player: GET /hls/live/segm14.ts HTTP/1.1 Host: arbitrarydomain.net Connection: keep-alive User-Agent: stagefright/1.2 (Linux;Android 4.1.2) This request is for an m3u8 file with absolute urls and is not being intercepted by the proxy GET /live/fSequence0.ts HTTP/1.1 User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.1.2; GT-I8552 Build/JZO54K) Host: arbitrarydomain.net Connection: Keep-Alive Accept-Encoding: gzip The above request is for an m3u8 file with relative urls and is intercepted by the proxy server As you can see, both the GET requests are for .ts files. Only the user agent is different. So my questions are: Does the user agent difference have any impact on the request? Why does the first request come from stagefright(Android Native Media Framework) and the second one from Dalvik(VM)? Is there a workaround for this(like forcing the media player for making a request from dalvik instead from stagefright)?
type: UnansweredQuestion
tagged with: android
has title: Difference between two get requests from Android Mediaplayer
answer count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/34255875
has text: OMG! you are right thats why it worked on my pc. Thanks for the answer but actually I need to build it from the source code to be able to use jvmti agent. By the way, the instructions are the same. Same readme.txt files... How am I suppose to know what to do now? why do they have same readme files
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22513554

http://stackoverflow.com/a/22606740
has body: n times 255 is the maximum difference possible. That is if all colors had a difference of 255. diff is the actual difference. To get percentage you have to divide actual with total and multiply with 100.0 By the way the following is true: diff / n / 255 = diff / (n * 255)
answers question: http://stackoverflow.com/q/22606635
score: 0
type: Answer

http://stackoverflow.com/comment/34904698
has text: I'm pretty sure you have to call setResult() in the activity you are finishing
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22624138

http://stackoverflow.com/comment/34372426
has text: I think the underlying problem is the type signature of `Comparator.compare`. It should return an `enum` of `{LessThan, GreaterThan, Equal}`, not an `int`. That way, the functional interface wouldn't actually match and you would get a compile error. IOW: the type signature of `Comparator.compare` doesn't adequately capture the semantics of what it means to compare two objects, and thus other interfaces which have absolutely nothing to do with comparing objects accidentally have the same type signature.
comment on: http://stackoverflow.com/a/22561690
score: 20
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34388917
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22588293
has text: How are you executing this `applet` via command prompt using `appletviewer` or via `HTML` file.?

http://stackoverflow.com/comment/34470037
type: QuestionComment
comment on: http://stackoverflow.com/q/22634360
score: 2
has text: try insertCampusian.executeQuery() or insertCampusian.executeUpdate()
type: Comment

http://stackoverflow.com/a/22578324
answers question: http://stackoverflow.com/q/22577986
score: 0
type: Answer
has body: First of all as it is onclicklistener for a button, v would always be button in your case. So ((CheckBox) v).isChecked() would give runtime error. Change that to checktime.isChecked() or any other checkbox you would like to check its checked status. As for checking the emptyness of editext it can be done by edittext.getText().toString().isEmpty()

http://stackoverflow.com/comment/34274567
score: 0
has text: you are right i fixed it, i mustve pressed ctrl+z and didnt notice, but i still dont get the desired output
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22524191

http://stackoverflow.com/comment/34577526
type: QuestionComment
has text: Solved! I had a @string\ referencing to a non existent in string.xml
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22646930

http://stackoverflow.com/comment/34405138
type: AnswerComment
score: 0
type: Comment
has text: @androidmaster Run that command from terminal or command line whichever you have.
comment on: http://stackoverflow.com/a/22597659

http://stackoverflow.com/comment/34278422
score: 0
has text: There is no need to initialize `ConDate` with a constructor. By the way why such a coding convention?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22526525

kinect
type: Tag
tags question: http://stackoverflow.com/q/22584114
tag name: kinect

http://stackoverflow.com/comment/34283281
comment on: http://stackoverflow.com/a/22528889
score: 0
type: AnswerComment
has text: i have executed rawQuery on checkQuery. how do i make it return a value if nothing found?
type: Comment

http://stackoverflow.com/a/22616245
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22612062
has body: The authentication part is handled by the TLS/SSL implementation, which is an intrensic part of the browser. There is no need to perform digital signature generation by the browser, so that is not included. Of course not all browsers implement smart card functionality, and the ones that do may do it differently (e.g. IE uses the latest Microsoft proprietary API available when that version of IE was developed, and Firefox uses PKCS#11 through NSS).
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34381307
score: 0
type: AnswerComment
type: Comment
has text: I'm currently looking into it but I don't think the time constraints will allow me to start over with something new. I'm already pretty far into what I have right now. I will +1 this answer if I see it would fit my situation regardless of if I'll use it or not though.
comment on: http://stackoverflow.com/a/22584025

http://stackoverflow.com/comment/34398903
comment on: http://stackoverflow.com/q/22593776
score: 0
has text: ISO 8601 http://en.m.wikipedia.org/wiki/ISO_8601
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27291609
upvote count: 7
has comment: http://stackoverflow.com/comment/66884011
score: 7
has body: /*create jsp page*/ &lt;form action="OpenPdfDemo" method="post" target="_blank"&gt; &lt;input type="submit" value="post"&gt; &lt;/form&gt; /* create servlet (servlet name = OpenPdfDemo)*/ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); ServletOutputStream outs = response.getOutputStream (); //--------------------------------------------------------------- // Set the output data's mime type //--------------------------------------------------------------- response.setContentType( "application/pdf" ); // MIME type for pdf doc //--------------------------------------------------------------- // create an input stream from fileURL //--------------------------------------------------------------- File file=new File("X://Books/struts book/sturts_Books/struts-tutorial.pdf"); //------------------------------------------------------------ // Content-disposition header - don't open in browser and // set the "Save As..." filename. // *There is reportedly a bug in IE4.0 which ignores this... //------------------------------------------------------------ response.setHeader("Content-disposition","inline; filename=" +"Example.pdf" ); BufferedInputStream bis = null; BufferedOutputStream bos = null; try { InputStream isr=new FileInputStream(file); bis = new BufferedInputStream(isr); bos = new BufferedOutputStream(outs); byte[] buff = new byte[2048]; int bytesRead; // Simple read/write loop. while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) { bos.write(buff, 0, bytesRead); } } catch(Exception e) { System.out.println("Exception ----- Message ---"+e); } finally { if (bis != null) bis.close(); if (bos != null) bos.close(); } }
downvote count: 0
answers question: http://stackoverflow.com/q/22602143
type: Answer

http://stackoverflow.com/q/22501563
type: Question
upvote count: 4
has body: Is there any way to detect changes made to spans in EditText (in Android)? A TextWatcher added to the EditText is notified only about text changes. No support in Editable/SpannableStringBuilder too. A workaround could be to have a fake InputFilter on the Editable, but obviously not ideal, and you never know if the change was actually applied. Thanks.
downvote count: 0
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
score: 4
tagged with: android-edittext
has title: How to detect span changes in EditText
tagged with: java

http://stackoverflow.com/comment/34419244
has text: AFAIU no (shrugs), but that is as far as I'm willing to speculate/guess short of seeing an SSCCE from the OP.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22595517

sql-like
tags question: http://stackoverflow.com/q/22629438
tag name: sql-like
tags question: http://stackoverflow.com/q/22558476
type: Tag

http://stackoverflow.com/a/22522557
has body: Change locap to locapp in the declaration of your activity in the manifest
answers question: http://stackoverflow.com/q/22522407
has comment: http://stackoverflow.com/comment/34271904
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/34273572
has comment: http://stackoverflow.com/comment/34272074

http://stackoverflow.com/q/22600217
has comment: http://stackoverflow.com/comment/34409767
has answer: http://stackoverflow.com/a/22600229
has comment: http://stackoverflow.com/comment/34409744
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34409838
has body: I'm reviewing for an exam and although we have an answer key, I don't understand the correct answer. if (score &gt;= 90) grade = 'A'; if (score &gt;= 80) grade = 'B'; if (score &gt;= 70) grade = 'C'; if (score &gt;= 60) grade = 'D'; else grade = ‘F’; The answer key says that "This code will work correctly only if grade &lt; 70". I know the else statement is linked with the last if-statement, but I'm still confused. Thanks for the help in advance.
has comment: http://stackoverflow.com/comment/34409674
has answer: http://stackoverflow.com/a/22600423
has comment: http://stackoverflow.com/comment/34409923
type: Question
tagged with: if-statement
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22600229
has title: Multiple if statements with single else statement
has comment: http://stackoverflow.com/comment/34409760
possible better answer: http://stackoverflow.com/a/22600423
has comment: http://stackoverflow.com/comment/34409663

http://stackoverflow.com/a/22639355
answers question: http://stackoverflow.com/q/22638926
type: Answer
downvote count: 1
upvote count: 5
has body: I once wrote a custom JButton which used to change its transparency level when the mouse was hovered over it through animation. Here's the code for that button: import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class HoverButton extends JButton { float alpha = 0.5f; public HoverButton(String text) { super(text); setFocusPainted(false); setBorderPainted(false); setContentAreaFilled(false); addMouseListener(new ML()); } public float getAlpha() { return alpha; } public void setAlpha(float alpha) { this.alpha = alpha; repaint(); } public void paintComponent(java.awt.Graphics g) { java.awt.Graphics2D g2 = (java.awt.Graphics2D) g; g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); super.paintComponent(g2); } public class ML extends MouseAdapter { public void mouseExited(MouseEvent me) { new Thread(new Runnable() { public void run() { for (float i = 1f; i &gt;= .5f; i -= .03f) { setAlpha(i); try { Thread.sleep(10); } catch (Exception e) { } } } }).start(); } public void mouseEntered(MouseEvent me) { new Thread(new Runnable() { public void run() { for (float i = .5f; i &lt;= 1f; i += .03f) { setAlpha(i); try { Thread.sleep(10); } catch (Exception e) { } } } }).start(); } public void mousePressed(MouseEvent me) { new Thread(new Runnable() { public void run() { for (float i = 1f; i &gt;= 0.6f; i -= .1f) { setAlpha(i); try { Thread.sleep(1); } catch (Exception e) { } } } }).start(); } } } And here's a quick demonstration of the HoverButton: import javax.swing.*; import java.awt.*; public class Demonstration { public Demonstration() { JFrame frame = new JFrame("Hover Button Demonstration"); frame.setLayout(new GridBagLayout()); frame.add(new HoverButton("Hover Button!!")); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Demonstration(); } });…
score: 4

http://stackoverflow.com/q/22557985
has comment: http://stackoverflow.com/comment/34340676
has answer: http://stackoverflow.com/a/22562308
type: UnansweredQuestion
has title: I am not able to get the view action in gmail when sending the email using Java's mail api
score: 1
tagged with: java
tagged with: google-schemas
type: Question
has body: Sample code snippet MimeBodyPart htmlpart = new MimeBodyPart(); htmlpart.setContent(" Sample This is a sample HTML part","text/html"); MimeBodyPart scriptcontent = new MimeBodyPart(); // scriptcontent.setHeader("Content-Type", "application/ld+json"); scriptcontent.setContent(" ","application/ld+json"); Multipart mp = new MimeMultipart(); mp.addBodyPart(htmlpart); mp.addBodyPart(scriptcontent); mail.setContent(mp); I have set the script type as json+ld , still i receive a normal email with no view action .
upvote count: 1
tagged with: email
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/22629455
tagged with: android
has answer: http://stackoverflow.com/a/22686620
score: 2
has comment: http://stackoverflow.com/comment/34484433
upvote count: 2
type: UnansweredQuestion
has title: RegisterActivity: cannot be resolved to a type, AppEngine
has comment: http://stackoverflow.com/comment/34463179
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22630280
downvote count: 0
has body: I have set up my computer with windows 8.1 completely new (formatted), to be sure to have a working system. I have installed Eclipse and the plugins the following way: download and unpack eclipse Kepler install JDK install android SDK install android SDK-plugins in eclipse in android sdk: install all extras, API 19, in tools: Android SDK Tools, Android SDK-Platform Tools, Android SDK Build Tools (only newest, 19.0.3) install all google plugins for kepler(Google App Engine Tools for Android, Google Plugin for eclipse, GWT Designer for GPE, SDKs) Now, is everything set up correctly, to use google app engine correctly? When I create a new app engine connected android project, google creates a bugged project. I have 50 errors, of which 49 can be resolved by changing the Java version from 1.4 to 1.7 in the app engine project (Properties: Java Compiler and Project Facet) However in the non-appengine project, in the MainActivity I get following error: RegisterActivity cannot be resolved to a type. How to solve this? I did not do anything by myself yet, I only created a project and I already have an error...
favorite count: 0
has comment: http://stackoverflow.com/comment/34470513
has comment: http://stackoverflow.com/comment/34470001
tagged with: google-app-engine

http://stackoverflow.com/a/57663115
type: Answer
has body: For programming languages in general, the scope of a block (also known as block scope) is just one kind of scope; see https://en.wikipedia.org/wiki/Scope_(computer_science)#Levels_of_scope. Some languages, like Python, do not have blocks nor block scopes (but instead have function scopes, global scopes, etc.).
answers question: http://stackoverflow.com/q/22575444
score: 0

http://stackoverflow.com/comment/75218686
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22640804
score: 0
has text: Did you manage to get the metrics on memory usage? Adding the `HotspotMemoryProfiler.class` nor the `GCProfiler.class` didn't help. The only metric I was getting is the `ops/sec`

http://stackoverflow.com/comment/54500579
has text: I find issue with the general attitude in the core Java team that the only correct way to parallelize is by loading everything into RAM. Arguments to the opposite are too obvious to even bother stating.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/33344378
type: AnswerComment

http://stackoverflow.com/q/22583866
tagged with: java
has comment: http://stackoverflow.com/comment/34381523
upvote count: 1
has title: AP Comp Sci print method
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22584171
tagged with: pointers
has answer: http://stackoverflow.com/a/22583993
answer count: 2
possible better answer: http://stackoverflow.com/a/22584171
has body: public void changeParams(int k, int[] A, String s){ k++; A[0]++; s += "X"; } public void print(){ int k = 0; int[] A = {10, 20}; String s = "aaa"; changeParams(k, A, s); System.out.println(k + " " + A[0] + " " + s); } The question is asking "What is output when method print is called?" I think the answer is 0 10 aaa but the answer key says 0 11 aaa Could someone explain why? Thanks
accepted answer: http://stackoverflow.com/a/22583993
linked to: http://stackoverflow.com/q/2535410
favorite count: 0
has comment: http://stackoverflow.com/comment/34380599
linked to: http://stackoverflow.com/q/373419
has comment: http://stackoverflow.com/comment/34380849
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/22553626
has comment: http://stackoverflow.com/comment/34326140
type: Answer
score: 13
upvote count: 13
accepted answer of: http://stackoverflow.com/q/22553549
answers question: http://stackoverflow.com/q/22553549
type: AcceptedAnswer
downvote count: 0
has body: Initialize Array like this: public Object[] settings = new Object[]{true, true, false, 1}; However, you cannot have arrays and values in the same dimension, because every element in a dimension must of the same type. (Strictly array '{}' OR Object in our case) new Object[]{true, true, false, 1, {true, false} }; //&lt;--- Illegal initializer Instead just use several dimensions and group values in arrays: public Object[][] settings = new Object[][]{{true, true}, {false, 1, 3}}; Either use ArrayList or LinkedList where it is possible to create any array you like. Update In fact it is possible to mix elements like this: new Object[]{true, false, 1, new Object[]{true, false} };

http://stackoverflow.com/comment/34470636
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22634636
score: 1
has text: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html

http://stackoverflow.com/a/22610551
has body: Yes there is: jsonschema2pojo. Have a look at the demo site. It has a mode to generate POJOs out of JSON Schemas, but also out of "plain" JSON Objects. Note: does JSON Schema draft v3 only, not v4.
accepted answer of: http://stackoverflow.com/q/22610392
type: Answer
has comment: http://stackoverflow.com/comment/34428077
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22610392

http://stackoverflow.com/a/22937826
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22490122
answers question: http://stackoverflow.com/q/22490122
type: AcceptedAnswer
has body: Answering my own question, the way to make this work is by using a JNDI data source to access the database. For authentication, Tomcat should be configured to use the DataSourceRealm. So both Tomcat security and Hibernate will use the same embedded instance of H2, which does not cause the conflict I was experiencing.
downvote count: 0
type: Answer

http://stackoverflow.com/a/22662288
answers question: http://stackoverflow.com/q/22633558
has body: I figured out the usage of 'MessageBodyReader' and 'MessageBodyWriter' and i found that need of implementing these two interfaces was just to put the parsing logic separate from the core business logic. Since i already had parser implemented for me, so i had to shift my parse code to take advantage of interfaces. So, i decided to return the String and set the response type as Json, since i had Json string already available after processing. So now my code looks like: @Produces(MediaType.APPLICATION_JSON) public String addEntity(@FormParam("entity") String jsonEntity, @FormParam("entityType") String jsonEntityType) { JsonObject jSonStatus = null; .... .... return JsonStatus.toString; } To checked the response in Advance Rest client, it showed correct Json with Content-Type: application/json Note: Please comment if i am not taking care of something important.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22633558
type: Answer

http://stackoverflow.com/a/22637367
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22636848
type: Answer
has body: A trivial DateUtils.formatElapsedTime: DateUtils.formatElapsedTime(timeInMillis); See documentation
upvote count: 3

http://stackoverflow.com/comment/34252464
has text: show the example code that you use. Are you sure you convert one bit into hexadecimal?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22512089
score: 0

finalize
type: Tag
tag name: finalize
tags question: http://stackoverflow.com/q/22632914
tags question: http://stackoverflow.com/q/22511194

http://stackoverflow.com/comment/34466564
type: Comment
type: QuestionComment
score: 0
has text: @DanTemple It didn't fix it indeed but still thanks
comment on: http://stackoverflow.com/q/22629884

http://stackoverflow.com/a/22515934
answers question: http://stackoverflow.com/q/22515915
has body: This solution involved 3 parts. I needed to: Add this property to the &lt;jmesa:htmlRow&gt; tag: uniqueProperty="id", Add a property called "id" to the Person class, which is a unique identifier for that class. Add the WorksheetServlet to my web.xml file, per the tutorial's instructions.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22515915

http://stackoverflow.com/a/22540303
downvote count: 1
type: Answer
has body: It's showing this error for win, junker and lose which have no value assigned to them yet. Either set them to zero or set them at the class level as static variables which automatically sets them to zero.
upvote count: 0
answers question: http://stackoverflow.com/q/22540216
score: -1

http://stackoverflow.com/a/22639046
type: Answer
score: 2
downvote count: 0
has body: Well, you should try with generic solution: Interface TestClass&lt;T&gt; { //Generic type T that you will provide when extending with actual class public abstract void setSomething(List&lt;T&gt; value); public abstract List&lt;T&gt; getSomething(); } class TestClassImplementation extends AbstractTestClass&lt;RealType&gt; { @Override public void setSomething(List&lt;RealType&gt; data) { someData = data; } } The thing that confuses you is that the wildcard sign ? does not mean it changes any type, it just denotes an unknown type.
answers question: http://stackoverflow.com/q/22638793
upvote count: 2
has comment: http://stackoverflow.com/comment/34479820

http://stackoverflow.com/q/22574959
has body: From Usage_in_Java &amp; Effective Java 2, I do understand I need to have volatile keyword, if the lazy initialization target is a single variable. However, what about I'm perform multiple lazy initialization, and store them in a ConcurrentHashMap? Does the Map need to be volatile too? Here's the code example. public class Utils { private static final Map&lt;Integer, RemoteViews&gt; remoteViewsMap = new ConcurrentHashMap&lt;Integer, RemoteViews&gt;(); public static RemoteViews getRemoteViews(int resourceId) { RemoteViews remoteViews = remoteViewsMap.get(resourceId); if (remoteViews == null) { synchronized(remoteViewsMap){ remoteViews = remoteViewsMap.get(resourceId); if (remoteViews == null) { remoteViews = new RemoteViews("org.yccheok.gui", resourceId); remoteViewsMap.put(resourceId, remoteViews); } } } return remoteViews; } } Is the above code correct and thread safe?
has title: Double checked locking lazy Initialization - Do I need to have volatile keyword for the Map
score: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34364168
has comment: http://stackoverflow.com/comment/34364359
has answer: http://stackoverflow.com/a/22575076
favorite count: 0
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34364317
accepted answer: http://stackoverflow.com/a/22575076
tagged with: java
type: Question

http://stackoverflow.com/q/22619992
has answer: http://stackoverflow.com/a/22620012
has answer: http://stackoverflow.com/a/22620013
score: 0
has title: output for System.out.println gives strange number
has answer: http://stackoverflow.com/a/22620020
has answer: http://stackoverflow.com/a/22620034
favorite count: 0
has answer: http://stackoverflow.com/a/22620247
answer count: 5
upvote count: 1
possible better answer: http://stackoverflow.com/a/22620013
downvote count: 1
has body: System.out.println("1 + 2 = " + 1 + 2); output: 12 can you explain why this is ? I tried to look through some documentation but did not find anything...
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22620012
type: Question

http://stackoverflow.com/comment/34346062
comment on: http://stackoverflow.com/q/22509501
score: 1
has text: My guess is something in the neo4j configuration is causing early instantiation of some factory beans (maybe it's trying to use a `MessageSource`?). If you could put some code on github that would probably make it easier to diagnose.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22517814
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34264708
accepted answer of: http://stackoverflow.com/q/22516161
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22516161
has body: You shouldn't use generated class on your @ViewById annotated field. But you still have to use generated one in your layout file : @EActivity(R.layout.start) public class MyActivity extends Activity { @ViewById MyView myView; } <my.package.MyView_ .../> Also, could you confirm you have these dependencies in your pom.xml and you're using Java 6 (as explained on the wiki) ? org.androidannotations androidannotations 3.0.1 provided org.androidannotations androidannotations-api 3.0.1
upvote count: 1
has comment: http://stackoverflow.com/comment/34283939
type: Answer

http://stackoverflow.com/q/22572403
has comment: http://stackoverflow.com/comment/34360080
tagged with: audio
answer count: 0
has title: Fatal runtime error at android.media.audiofx.Equalizer.<init>
score: 0
tagged with: java
has body: I am working on equalier app and no errors in code at all. when I run app on phone it force closes, I logcat and this is result 03-22 02:49:17.945: E/AndroidRuntime(4318): at android.media.audiofx.Equalizer.&lt;init&gt;(Equalizer.java:149) 03-22 02:50:34.796: E/AndroidRuntime(4423): at android.media.audiofx.Equalizer.&lt;init&gt;(Equalizer.java:149) I tried on android gingerbread kitkat and jellybean this is the main activity code: public class MainActivity extends Activity implements SeekBar.OnSeekBarChangeListener, CompoundButton.OnCheckedChangeListener, View.OnClickListener { //as usual "define variables" TextView bass_boost_label = null; SeekBar bass_boost = null; CheckBox enabled = null; Button flat = null; Button Button1; Equalizer eq = null; BassBoost bb = null; int min_level = 0; int max_level = 100; static final int MAX_SLIDERS = 8; // Must match the XML layout SeekBar sliders[] = new SeekBar[MAX_SLIDERS]; TextView slider_labels[] = new TextView[MAX_SLIDERS]; int num_sliders = 0; /*============================================================================= onCreate =============================================================================*/ @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return true; } /*============================================================================= onCreate =============================================================================*/ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //initalize layout setContentView(R.layout.activity_main); //initialize the checkbox enabled = (CheckBox)findViewById(R.id.enabled); enabled.setOnCheckedChangeListener (this); //initialize flat button flat = (Button)findViewById(R.id.flat); flat.setOnClickListener(this); Button1 = (Button)findViewById(R.id.button1); Button1.setOnClickListener(this); //the seekbars bass_boost = (SeekBar)findViewById(R.id.ba…
type: Question
tagged with: runtime
has comment: http://stackoverflow.com/comment/34371059
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/34337094
comment on: http://stackoverflow.com/q/22560134
type: Comment
type: QuestionComment
score: 3
has text: You have to show us the MCL class. The part you uploaded does not contain any race conditions

http://stackoverflow.com/comment/34453493
score: 0
type: Comment
type: QuestionComment
has text: Right. I thought your question said "String". My bad.
comment on: http://stackoverflow.com/q/22624535

http://stackoverflow.com/a/22560956
has body: Check this will solve your problem . package com.loknath.lab; public class HashTableDemo { public static void main(String args[]) { Hashtable htable = new Hashtable(3); boolean deleteStatus; ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); // populate the table htable.put("AId", 1); htable.put(" catalogId", 2); htable.put(" ItemId_1", 43); htable.put("ItemId_2", 43); htable.put("bid", 54.45); Set&lt;String&gt; keys = htable.keySet(); for (String key : keys) { System.out.println(key); deleteStatus = check(key); if (deleteStatus) { list.add(key); } } for (String string : list) { htable.remove(string); } } public static boolean check(String key) { boolean status = false; status = key.contains("_"); return status; } }
answers question: http://stackoverflow.com/q/22560049
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34385716

http://stackoverflow.com/q/22592162
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22595406
type: Question
tagged with: configuration
answer count: 1
tagged with: logback
has title: Logback log everything into file
has body: I have a logback configuration file like this: http://pastebin.com/yZGVWKEV My problem is that what I'm logging out gets logged into the files, but what other libraries (e.g. spring, and logback) is logging out it doesn't. They appear only on the console, but on that the format is not in my defined format: 15:07:25,226 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [.../logback-local-config.xml] at [file:.../logback-local-config.xml] 15:07:25,352 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 15:07:25,356 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE] 15:07:25,397 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 15:07:25,462 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 15:07:25,467 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [INFO_FILE] 15:07:25,495 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use gz compression 15:07:25,498 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern ./logs/%d{yyyy,aux}/%d{MM,aux}/service.%d{yyyyMMdd}.%d{HHmmssSSS,aux}-debug.log for the active file 15:07:25,504 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyyMMdd' from file name pattern './logs/%d{yyyy,aux}/%d{MM,aux}/service.%d{yyyyMMdd}.%d{HHmmssSSS,aux}-debug.log.gz'. 15:07:25,504 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight. 15:07:25,508 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Sun Mar 23 15:05:59 CET 2014 15:07:25,510 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPro…
downvote count: 0
has answer: http://stackoverflow.com/a/22595406
favorite count: 0
upvote count: 1

http://stackoverflow.com/comment/34220102
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22492852
has text: Because nothing outside the class should care about how this class does its logging. (Always use the most restrictive access you can; relaxing restrictions is easier than tightening them.)

http://stackoverflow.com/comment/34488996
type: Comment
type: AnswerComment
has text: @androidmaster As far as I know ProGuard is not run when you compile with eclipse, although I don't know the details of your Android Project setup so I couldn't say if you are working around that or not. My best guess would be to see if you have the GUI bundled with ProGuard and manually use it rather than rely on your IDE for it.
score: 0
comment on: http://stackoverflow.com/a/22644583

http://stackoverflow.com/comment/34616281
type: QuestionComment
comment on: http://stackoverflow.com/q/22540115
score: 0
has text: Still need help with this if anyone could help.
type: Comment

http://stackoverflow.com/comment/34468327
comment on: http://stackoverflow.com/q/22631089
score: 0
type: Comment
type: QuestionComment
has text: You just said you wanted *two* digits before the decimal point. `two integer digits and one decimal digit.` `1233e0` would turn into `1.2` if you use DecimalFormat. BTW its trivial to remove the exponent, it's getting a clear idea of what you want which is much harder, even harder is to understand the sanity of why. ;)

http://stackoverflow.com/a/22597988
has comment: http://stackoverflow.com/comment/34477130
has comment: http://stackoverflow.com/comment/34455179
type: Answer
accepted answer of: http://stackoverflow.com/q/22562770
has comment: http://stackoverflow.com/comment/34464412
answers question: http://stackoverflow.com/q/22562770
has comment: http://stackoverflow.com/comment/34499994
has comment: http://stackoverflow.com/comment/34491262
upvote count: 4
has body: This seems to be an open issue for eclipselink. I have posted a similar question lately. Chris posted an helpful answer with a link to a feature request. A workaround described there is the usage of multiple persistence units for the same tables with different multi tenancy settings. I am trying to use an alternative approach: Instead of @Multitenant I use @AdditionalCriteria. This annotations enables you to define your own request criteria added to any database operation (with few exceptions like native SQL). Example: @AdditionalCriteria(":ADMINACCESS = 1 or this.tenant=:TENANT") On creation of your entity manager you set the parameters. You could either provide a tenant of switch off multi tenancy. The drawback here is that you are responsible for the tenant attribute.
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/q/22576430
has title: Method read from file using java language
tagged with: arrays
linked to: http://stackoverflow.com/q/5368704
has comment: http://stackoverflow.com/comment/34637763
tagged with: readfile
has body: I will enhance an old algorithm which use java language and i want it to read the text from file to encrypt it SO I will make a method that reads the text line by line from file then store them in array. I made this method and it works BUT the variable "line2" reads the first line correctly but once the next line come it will erase the first line and put the second line so what can i do please?? // The CODES Private byte[] line2; public byte[] readFromFile (){ try (BufferedReader br = new BufferedReader(new FileReader ("C:\\Users\\just\\Desktop\\message.txt"))) { String sCurrentLine; while ((sCurrentLine = br.readLine()) != null) { line2 = sCurrentLine.getBytes(); } } catch (IOException e) { e.printStackTrace(); } return line2; }
has comment: http://stackoverflow.com/comment/34366499
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22576458
tagged with: file
tagged with: methods
type: Question
score: 0
has answer: http://stackoverflow.com/a/22727765
answer count: 3
has answer: http://stackoverflow.com/a/22576484

http://stackoverflow.com/comment/34261567
type: AnswerComment
has text: Could you post an example of how to use the second option?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22517052

http://stackoverflow.com/q/22609217
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22609430
has comment: http://stackoverflow.com/comment/139799287
has answer: http://stackoverflow.com/a/22609430
tagged with: java
upvote count: 83
accepted answer: http://stackoverflow.com/a/22610642
has answer: http://stackoverflow.com/a/22609378
type: Question
has comment: http://stackoverflow.com/comment/34426936
has comment: http://stackoverflow.com/comment/34425895
has body: I want a function to convert Bigdecimal 10.12 for 10.12345 and 10.13 for 10.12556. But no function is satisfying both conversion in same time.Please help to achieve this. Below is what I tried. With value 10.12345: BigDecimal a = new BigDecimal("10.12345"); a.setScale(2, BigDecimal.ROUND_UP) a.setScale(2, BigDecimal.ROUND_CEILING) a.setScale(2, BigDecimal.ROUND_DOWN) a.setScale(2, BigDecimal.ROUND_FLOOR) a.setScale(2, BigDecimal.ROUND_HALF_DOWN) a.setScale(2, BigDecimal.ROUND_HALF_EVEN) a.setScale(2, BigDecimal.ROUND_HALF_UP) Output : 10.12345::10.13 10.12345::10.13 10.12345::10.12 10.12345::10.12 10.12345::10.12 10.12345::10.12 10.12345::10.12 With value 10.12556: BigDecimal b = new BigDecimal("10.12556"); b.setScale(2, BigDecimal.ROUND_UP) b.setScale(2, BigDecimal.ROUND_CEILING) b.setScale(2, BigDecimal.ROUND_DOWN) b.setScale(2, BigDecimal.ROUND_FLOOR) b.setScale(2, BigDecimal.ROUND_HALF_DOWN) b.setScale(2, BigDecimal.ROUND_HALF_EVEN) b.setScale(2, BigDecimal.ROUND_HALF_UP) Output : 10.12556::10.13 10.12556::10.13 10.12556::10.12 10.12556::10.12 10.12556::10.12 10.12556::10.12 10.12556::10.12
tagged with: bigdecimal
has comment: http://stackoverflow.com/comment/34426472
favorite count: 0
has comment: http://stackoverflow.com/comment/34427833
has comment: http://stackoverflow.com/comment/34425572
has comment: http://stackoverflow.com/comment/34428440
has title: Rounding Bigdecimal values with 2 Decimal Places
answer count: 5
has comment: http://stackoverflow.com/comment/94980151
has comment: http://stackoverflow.com/comment/34425456
score: 81
has answer: http://stackoverflow.com/a/22610642
has answer: http://stackoverflow.com/a/22609809
has comment: http://stackoverflow.com/comment/34455921
has comment: http://stackoverflow.com/comment/34426170
downvote count: 2
has comment: http://stackoverflow.com/comment/34426274
has answer: http://stackoverflow.com/a/74435054
has comment: http://stackoverflow.com/comment/34425563

http://stackoverflow.com/q/22542487
has comment: http://stackoverflow.com/comment/34306997
has comment: http://stackoverflow.com/comment/34307033
type: Question
answer count: 2
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34307156
has answer: http://stackoverflow.com/a/22542640
score: 0
has comment: http://stackoverflow.com/comment/34307059
tagged with: generics
has answer: http://stackoverflow.com/a/22542546
has comment: http://stackoverflow.com/comment/34307010
has title: HashMap using Generics
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34307042
has body: I have: protected Map&lt;String, ? extends Transaction&gt; transactions = new HashMap&lt;String, ?&gt;(); However, I get a compilation error: Type mismatch: cannot convert from HashMap&lt;String,?&gt; to Map&lt;String,? extends Transaction&gt; I've tried some variations, including: protected Map&lt;String, ? extends Transaction&gt; transactions = new HashMap&lt;String, ? extends Transaction&gt;(); All yield the same compilation error. My goal is to have an instance of Report abstract class (extended by many different kinds of reports), accept multiple subclassess of the abstract class Transaction. The types going into a single instance of an extended Report will all be the same type, for example TRRReport extends Report will need to accept TRRTransaction extends Transaction into it's HashMap, however TDDReport extends Report will need to accept TDDTransaction extends Transaction into it's HashMap. How can I use a HashMap and Generics in this situation?
tagged with: java

http://stackoverflow.com/comment/34310091
comment on: http://stackoverflow.com/a/22543997
has text: Ahhhh I finally understand the problem: with a 2D array the 4 cases would be up, down, left, and right. You should probably edit that into your question. Edit: never mind you've already done that.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34509723
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22641561
has text: you can't reduce the scope of methods, so once a method in ExistingComponent is public it needs to be public in MyComponent as well (and comply to its contract!). So the answer is: don't waste your time on impossibilities :-)
score: 1

http://stackoverflow.com/q/22569710
accepted answer: http://stackoverflow.com/a/22570720
type: AnsweredQuestion
has body: How can I automatically deploy a war from Nexus to Tomcat? I have a maven web project which gets built and deployed (both SNAPSHOT and release versions) on Nexus successfully. I would like to know if there is feature/plugin in Nexus where it picks the released war and deploys on remote Tomcat automatically? I know that you can deploy the war to remote Tomcat using maven-tomcat-plugin but would like to know if there is an alternative solution. Please guide.
has answer: http://stackoverflow.com/a/33350520
tagged with: java
has title: How can I automatically deploy a war from Nexus to Tomcat?
has comment: http://stackoverflow.com/comment/34355024
has answer: http://stackoverflow.com/a/43019830
type: Question
has answer: http://stackoverflow.com/a/22570720
score: 4
tagged with: tomcat
favorite count: 0
possible better answer: http://stackoverflow.com/a/33350520
answer count: 3
upvote count: 4
downvote count: 0
tagged with: nexus
tagged with: maven
has comment: http://stackoverflow.com/comment/34356909

http://stackoverflow.com/a/22565220
score: 3
upvote count: 3
has body: Simple. Use groups and back-references, as such: String input = "ABC_AASD_AD_AA.xml"; // | using replaceAll to pass regex // | | group 1: one or more characters, greedy // | | | underscore // | | || one or more characters, reluctant // | | || | escaped dot and extension // | | || | | back-reference to group 1 System.out.println(input.replaceAll("(.+)_.+?\\.xml", "$1")); Output ABC_AASD_AD Note Any input not conforming to the Pattern will be returned as such.
downvote count: 0
answers question: http://stackoverflow.com/q/22565139
type: Answer

http://stackoverflow.com/a/22524082
has comment: http://stackoverflow.com/comment/34274396
has comment: http://stackoverflow.com/comment/34274754
upvote count: 5
has comment: http://stackoverflow.com/comment/34274406
has comment: http://stackoverflow.com/comment/34274465
has comment: http://stackoverflow.com/comment/34274394
type: Answer
has comment: http://stackoverflow.com/comment/34274251
has body: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.jsonapp/com.example.jsonapp.GetWeather}: java.lang.ClassCastException: com.example.jsonapp.GetWeather cannot be cast to android.app.Activity public class GetWeather { GetWeather is not a Activity class You have Intent nextScreen = new Intent(MainActivity.this, GetWeather.class); GetWeather gw = new GetWeather("CA","Anuradhapura"); startActivity(nextScreen); You only need GetWeather gw = new GetWeather("CA","Anuradhapura"); and remove the other 2 lines Edit: public class GetWeather { private static String WEATHER_URL = "http://api.wunderground.com/api/706d22f330042323/conditions/q/"; public String weather; public String temperature_string; public Bitmap weather_icon; public GetWeather() { } public GetWeather(String city, String state){ city = city.replaceAll(" ", "_"); //construct post URL final String GET_WEATHER_URL = WEATHER_URL + state + "/" + city + ".json"; new Thread(new Runnable() { public void run() { String request = GET_WEATHER_URL; HttpResponse rp = null; JSONObject jObject = null; try { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpGet request1 = new HttpGet("http://api.wunderground.com/api/706d22f330042323/conditions/q/CA/Anuradhapura.json"); HttpResponse response = httpclient.execute(request1); HttpEntity resEntity = response.getEntity(); String _response=EntityUtils.toString(resEntity); jObject = new JSONObject(_response); JSONObject current_observation = jObject.getJSONObject("current_observation"); weather = current_observation.getString("weather"); Log.i("..............",""+weather); temperature_string = current_observation.getString("temperature_string"); String icon_url = current_observation.getString("icon_url"); weather_icon = get_weather_icon(icon_url); }catch(Exception e) { e.printStackTrace(); } } }).start(); } public static Bitmap get_weather_icon(String u…
downvote count: 0
has comment: http://stackoverflow.com/comment/34274953
has comment: http://stackoverflow.com/comment/34274685
has comment: http://stackoverflow.com/comment/34274378
answers question: http://stackoverflow.com/q/22524066
has comment: http://stackoverflow.com/comment/34290678
has comment: http://stackoverflow.com/comment/34274487
accepted answer of: http://stackoverflow.com/q/22524066
has comment: http://stackoverflow.com/comment/34290753
has comment: http://stackoverflow.com/comment/34274602
has comment: http://stackoverflow.com/comment/34274267
has comment: http://stackoverflow.com/comment/34274168
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/34308420
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22543186
has text: @twntee Y is in another Activity
score: 0

jtabbedpane
tags question: http://stackoverflow.com/q/22592946
type: Tag
tag name: jtabbedpane
tags question: http://stackoverflow.com/q/22556815

http://stackoverflow.com/q/22537689
type: UnansweredQuestion
answer count: 0
tagged with: java
has body: I'm new in JavaAgent concept, so maybe this issue isn't complicated. But I hope some discussion and knowledge arrangement will be helpful (not only for me). So - what I want to do? I would like to load external jar library when I start my application. This external library is under development and versioned on ARM (Nexus) and contains functionalities which are essential in my_app. My attempt: Download wanted version of lib (no problem here - got proper func_version.jar in right place) I add in parent dir of downloaded jar class JavaAgent.java: import java.lang.instrument.*; public class JavaAgent { private static Instrumentation inst; public static Instrumentation getInstrumentation() { return inst; } public static void premain(String agentArgs, Instrumentation inst) { System.out.println(inst.getClass() + ": " + inst); System.out.println("JavaAgent LOADED!"); JavaAgent.inst = inst; } } Modify META-INF/MANIFEST.MF in lib (added line: Premain-Class: JavaAgent) Try to load JavaAgent by passing it as JVM parameter: java -javaagent:/home/func_1.0.1.jar /home/my_app/MyStartup MyStartup.java contains main method for my_app. I know this steps are not enough (can't see any result yet). But is it a right approach? And what else do I need to do to see wanted "JavaAgent LOADED!" on console output? Some work with Java ClassLoader is needed?
type: Question
has comment: http://stackoverflow.com/comment/34373301
tagged with: jar
has title: How to load JavaAgent and run method from it?
score: 2
downvote count: 0
tagged with: executable-jar
favorite count: 0
tagged with: javaagents
tagged with: classloader
upvote count: 2

http://stackoverflow.com/a/22635528
score: 2
accepted answer of: http://stackoverflow.com/q/22634978
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Try this code.it's working bondIDTextField.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { ((JTextField)e.getSource()).setText(""); } } } );
answers question: http://stackoverflow.com/q/22634978

http://stackoverflow.com/comment/128642401
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22635945
has text: The // Classical Java approach is the best one.
type: Comment

http://stackoverflow.com/q/22618186
score: 0
answer count: 2
tagged with: arrays
has body: I've been struggling with this for a while, I'm trying to build a program that makes use of the MVC pattern, that dynamically creates a grid of buttons (nxn) based on user input. I can't however get it right to attach listeners to them. EDIT: I meant that I wanted to handle the event inside of the Controller class to conform to the MVC pattern View public class AIGameView extends javax.swing.JFrame { private AIGameModel model; private JButton[][] btn_arr; public AIGameView(AIGameModel m) { model = m; initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() {...} private void startBtnActionPerformed(java.awt.event.ActionEvent evt) { options.setVisible(false); int size = Integer.parseInt(size_field.getText()); model.setSize(size); btn_arr = new JButton[size][size]; GameGUI.setLayout(new java.awt.GridLayout(size, size)); for(int y = 0; y &lt; size; y++) { for(int x = 0; x &lt; size; x++) { btn_arr[y][x] = new JButton(); btn_arr[y][x].setBackground(Color.white); GameGUI.add(btn_arr[y][x]); btn_arr[y][x].setVisible(true); } } GameGUI.setVisible(true); GameGUI.revalidate(); GameGUI.repaint(); } Controller public class AIGameController { private AIGameView view; private AIGameModel model; private JButton[][] buttons; public AIGameController(AIGameModel m, AIGameView v) { view = v; model = m; } I've tried several things, but nothing seems to work for this and I mostly just end up with a null pointer exception. Any advice on this ?
has comment: http://stackoverflow.com/comment/34442056
tagged with: model-view-controller
has answer: http://stackoverflow.com/a/22618377
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22618375
tagged with: swing
has answer: http://stackoverflow.com/a/22618375
has title: Event Listeners on Dynamic Buttons
tagged with: jbutton
type: Question
has comment: http://stackoverflow.com/comment/34442128
accepted answer: http://stackoverflow.com/a/22618377

http://stackoverflow.com/a/23880278
has comment: http://stackoverflow.com/comment/36795319
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22509488
score: 16
has comment: http://stackoverflow.com/comment/36901381
type: Answer
has body: This is not a javac bug, according to the current spec. I wrote an answer here is SO for a similar issue. Here the problem is more or less the same. On an assignment or invocation context reference conditional expressions are poly expressions. This means that the type of the expression is not the result of applying capture conversion to lub(T1, T2), see JSL-15.25.3 for a detailed definition of T1 and T2. Instead we have, also from this portion of the spec that: Where a poly reference conditional expression appears in a context of a particular kind with target type T, its second and third operand expressions similarly appear in a context of the same kind with target type T. The type of a poly reference conditional expression is the same as its target type. So this means that the target type is pushed down to both operands of the reference conditional expression, and both operands are attributed against that target type. So the compiler ends up gathering constraints from both operands, leading to an unsolvable constraint set and thus an error. OK, but why do we get equality bounds for T here? Let's see in detail, from the call: foo(true ? String.class : StringBuilder.class) where foo is: static &lt;T&gt; T foo(Class&lt;T&gt; clazz) throws Exception { return clazz.newInstance(); } We have that as we are invoking method foo() with the expression true ? String.class : StringBuilder.class. This reference conditional expression should be compatible in a loose invocation context with type Class&lt;T&gt;. This is represented as, see JLS-18.1.2: true ? String.class : StringBuilder.class → Class&lt;T&gt; As follows from JLS-18.2.1 we have that: A constraint formula of the form ‹Expression → T› is reduced as follows: ... If the expression is a conditional expression of the form e1 ? e2 : e3, the constraint reduces to two constraint formulas, ‹e2 → T› and ‹e3 → T›. This implies that we obtain the following constraint formulas: String.class → Class&lt;T&gt; StringBuilder.class → …
has comment: http://stackoverflow.com/comment/37105897
has comment: http://stackoverflow.com/comment/36762764
upvote count: 16
has comment: http://stackoverflow.com/comment/36795452
has comment: http://stackoverflow.com/comment/36881985
has comment: http://stackoverflow.com/comment/36822312
has comment: http://stackoverflow.com/comment/36775925
answers question: http://stackoverflow.com/q/22509488

http://stackoverflow.com/comment/34248191
comment on: http://stackoverflow.com/q/22508303
has text: Pretty sure "getQuestionnaireTemplate()" is the part that's null since you're only setting "responseToQuestionnaire" (unless it's built internally)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34370828
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22578773
has text: Have you checked this ? http://stackoverflow.com/questions/184710/what-is-the-difference-between-a-deep-copy-and-a-shallow-copy and http://stackoverflow.com/questions/64036/how-do-you-make-a-deep-copy-of-an-object-in-java
score: 0

http://stackoverflow.com/q/22584620
tagged with: android-intent
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22584676
accepted answer: http://stackoverflow.com/a/22584676
tagged with: eclipse
type: Question
score: 0
has title: intent is undefined tried a lot , nothing works
tagged with: android
answer count: 1
tagged with: undefined
has body: I get error with Intent. It says: intent is undefined. I've been searching a lot of other posts and it still doesn't work. Any ideas? for your knowledge, i develop my own app with the basic of android developpes. Because my own intent didn't work, i used and created the exact same class as in the example, class DisplayMessageActivity but the problem remains the same, Here some of my code. public class Main extends ActionBarActivity { public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { try{ super.onCreate(savedInstanceState); setContentView(R.layout.main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } catch(Exception e){ System.out.println("fout zit hier"); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } /** Called when the user clicks the Send button */ public void sendMessage(View view) { Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message = e…
has comment: http://stackoverflow.com/comment/34381898

http://stackoverflow.com/a/22515052
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34480058
has comment: http://stackoverflow.com/comment/34474498
upvote count: 2
type: Answer
score: 2
has body: Configure appropriate HttpMessageConverters and inject them using the message-converters attribute. See also the merge-with-default-converters attribute. See MappingJackson2HttpMessageConverter (jackson 2), MappingJacksonHttpMessageConverter (jackson 1.x) and MarshallingHttpMessageConverter. Also, JAXB and Json message converters are automatically used by default if they are on the classpath. You may be able to just set the request-payload-type on the gateway if conversion doesn't need anything special. See the reference documentation for more information.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22514238
has comment: http://stackoverflow.com/comment/34475542
has comment: http://stackoverflow.com/comment/34473317
answers question: http://stackoverflow.com/q/22514238

http://stackoverflow.com/q/22547864
has comment: http://stackoverflow.com/comment/34316882
has answer: http://stackoverflow.com/a/22549887
favorite count: 0
has comment: http://stackoverflow.com/comment/34317900
has comment: http://stackoverflow.com/comment/34316865
has comment: http://stackoverflow.com/comment/34316931
type: UnansweredQuestion
tagged with: interface
has comment: http://stackoverflow.com/comment/34317860
downvote count: 4
has body: I'm trying to make it so my program chooses a file reads the code one line at a time uses an interface to do three different things convert to uppercase count the number of characters save to a file ("copy.txt") I'm stuck with the formatting parts. For instance, I'm not sure where the println commands needs to be. Any help will definitely be appreciated. I'm a beginner and still learning basic things. Interface for Processing Individual Strings: public interface StringProcessor { void process(String s); } Processing Class: import java.util.Scanner; import java.io.FileNotFoundException; import java.io.File; import javax.swing.JFileChooser; class FileProcessor { private Scanner infile; public FileProcessor(File f) throws FileNotFoundException { Scanner infile = new Scanner(System.in); String line = infile.nextLine(); } public String go(StringProcessor a) { a.process(line); } } Driver Class: import java.util.Scanner; import java.io.FileNotFoundException; import java.io.File; import javax.swing.JFileChooser; public class Driver { public static void main(String[] args) throws FileNotFoundException { JFileChooser chooser = new JFileChooser(); File inputFile = null; if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { inputFile = chooser.getSelectedFile(); } FileProcessor infile = new FileProcessor(inputFile); int total=0; } } This Would Make Each Line Uppercase: public class Upper implements StringProcessor { public void process(String s) { while (infile.hasNextLine()) { System.out.println(infile.nextLine().toUpperCase()); } } } This Would Count Characters: public class Count implements StringProcessor { public void process(String s) { while (infile.hasNextLine()) { int charactercounter = infile.nextLine().length(); total = total+charactercounter; } } } This Would Print to a File: import java.io.PrintWriter; import java.io.FileNotFoundException; public class Print implements StringProcessor { public void process(String s) { PrintWriter out = new PrintWriter(…
tagged with: java
has comment: http://stackoverflow.com/comment/34316948
has title: I'm stuck building a line reader with interfaces in Java
has answer: http://stackoverflow.com/a/22548975
type: Question
has comment: http://stackoverflow.com/comment/34316958
has comment: http://stackoverflow.com/comment/34317000
has comment: http://stackoverflow.com/comment/34318120
answer count: 2
has comment: http://stackoverflow.com/comment/34318369
has comment: http://stackoverflow.com/comment/34318167
score: -1
has comment: http://stackoverflow.com/comment/34317088
has comment: http://stackoverflow.com/comment/34316928
upvote count: 3
has comment: http://stackoverflow.com/comment/34317902
has comment: http://stackoverflow.com/comment/34317952

http://stackoverflow.com/comment/34245926
has text: Which line no 159 is in your BasicQuestionActivity.java
type: QuestionComment
comment on: http://stackoverflow.com/q/22508303
type: Comment
score: 0

http://stackoverflow.com/comment/34440447
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22617265
has text: I was initially running a priorityqueue but did not know how to force a re-sort. Perhaps the best thing is to remove/add elements when they become "dirty"?
score: 0

http://stackoverflow.com/comment/34393272
score: 1
type: Comment
type: QuestionComment
has text: Cool, like you, I totally forgot about the .equals() method in Java, so don't beat yourself up about it :-)
comment on: http://stackoverflow.com/q/22591162

class-design
tags question: http://stackoverflow.com/q/22493851
tag name: class-design
type: Tag

http://stackoverflow.com/q/22544241
accepted answer: http://stackoverflow.com/a/22544473
tagged with: regex
has title: How can I match the first instance of a pattern?
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22544476
type: Question
has body: I have the following regex and input. http://regex101.com/r/rY5xD2: ^(.+)\byo\b.*?(cut me:) How can I just match the first instance of a pattern match? -- Desired group match (text that I keep) -- Hi yo keep this here Keep this here
possible better answer: http://stackoverflow.com/a/22544476
has answer: http://stackoverflow.com/a/22544473
has comment: http://stackoverflow.com/comment/34310541
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/22625065
upvote count: 72
has answer: http://stackoverflow.com/a/22628668
has answer: http://stackoverflow.com/a/26059307
tagged with: java-8
type: AnsweredQuestion
tagged with: hashmap
tagged with: collectors
tagged with: java
has answer: http://stackoverflow.com/a/22637721
has answer: http://stackoverflow.com/a/69026735
type: Question
answer count: 8
has title: Collectors.groupingBy doesn't accept null keys
score: 72
favorite count: 0
has answer: http://stackoverflow.com/a/22650233
accepted answer: http://stackoverflow.com/a/22650233
linked to: http://stackoverflow.com/q/24630963
has answer: http://stackoverflow.com/a/22625344
downvote count: 0
tagged with: java-stream
has comment: http://stackoverflow.com/comment/63061913
has answer: http://stackoverflow.com/a/32207664
has body: In Java 8, this works: Stream&lt;Class&gt; stream = Stream.of(ArrayList.class); HashMap&lt;Class, List&lt;Class&gt;&gt; map = (HashMap)stream.collect(Collectors.groupingBy(Class::getSuperclass)); But this doesn't: Stream&lt;Class&gt; stream = Stream.of(List.class); HashMap&lt;Class, List&lt;Class&gt;&gt; map = (HashMap)stream.collect(Collectors.groupingBy(Class::getSuperclass)); Maps allows a null key, and List.class.getSuperclass() returns null. But Collectors.groupingBy emits a NPE, at Collectors.java, line 907: K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key"); It works if I create my own collector, with this line changed to: K key = classifier.apply(t); My questions are: 1) The Javadoc of Collectors.groupingBy doesn't say it shouldn't map a null key. Is this behavior necessary for some reason? 2) Is there another, easier way, to accept a null key, without having to create my own collector?
has answer: http://stackoverflow.com/a/76729622
possible better answer: http://stackoverflow.com/a/26059307

http://stackoverflow.com/comment/34407730
score: 0
type: Comment
has text: Thanks everyone for the assistance but I am just not having any luck. I am going to scrap it and try again.
comment on: http://stackoverflow.com/a/22598803
type: AnswerComment

http://stackoverflow.com/comment/34397217
has text: maybe I'm confused about what you need your code does but according to my understanding if you change this line for (line = bufferedReader.readLine(); line != null; line = bufferedReader.readLine()) with for (line = bufferedReader.readLine(); line != null && !(line.equals("table_end")); line = bufferedReader.readLine()) it should do what you need let me know if it helps
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22593052

http://stackoverflow.com/comment/34278996
type: Comment
comment on: http://stackoverflow.com/a/22526847
score: 0
type: AnswerComment
has text: As the "==" operation is often referred to as _identity_ comparison, I though it's better not to say, they are identical. Btw: I know, what you meant. And you also clearly stated that sn1 and sn2 are different objects. So everything is ok with your answer. :-)

calendar
tags question: http://stackoverflow.com/q/22563119
tags question: http://stackoverflow.com/q/22611686
tags question: http://stackoverflow.com/q/22527872
tags question: http://stackoverflow.com/q/22538433
tags question: http://stackoverflow.com/q/22558214
tags question: http://stackoverflow.com/q/22522582
tags question: http://stackoverflow.com/q/22581307
tags question: http://stackoverflow.com/q/22624063
tags question: http://stackoverflow.com/q/22530834
tags question: http://stackoverflow.com/q/22502709
tags question: http://stackoverflow.com/q/22619552
tag name: calendar
tags question: http://stackoverflow.com/q/22516951
tags question: http://stackoverflow.com/q/22633195
tags question: http://stackoverflow.com/q/22525857
tags question: http://stackoverflow.com/q/22612205
tags question: http://stackoverflow.com/q/22630048
type: Tag

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/22506680
tags question: http://stackoverflow.com/q/22570249
tags question: http://stackoverflow.com/q/22625419
tags question: http://stackoverflow.com/q/22493213
tags question: http://stackoverflow.com/q/22557028
tags question: http://stackoverflow.com/q/22581349
tags question: http://stackoverflow.com/q/22584762
tags question: http://stackoverflow.com/q/22579230
tags question: http://stackoverflow.com/q/22561110
tags question: http://stackoverflow.com/q/22585828
tags question: http://stackoverflow.com/q/22636955
tags question: http://stackoverflow.com/q/22495652
tags question: http://stackoverflow.com/q/22600449
tags question: http://stackoverflow.com/q/22515973
tags question: http://stackoverflow.com/q/22593336
tags question: http://stackoverflow.com/q/22535067
tags question: http://stackoverflow.com/q/22560134
tags question: http://stackoverflow.com/q/22579820
tags question: http://stackoverflow.com/q/22551364
tags question: http://stackoverflow.com/q/22536035
tags question: http://stackoverflow.com/q/22596489
type: Tag
tags question: http://stackoverflow.com/q/22560163
tags question: http://stackoverflow.com/q/22614284

http://stackoverflow.com/q/22527389
has title: Hazelcast Serializable Map ClassNotFound Exception
has comment: http://stackoverflow.com/comment/34290518
tagged with: java
upvote count: 6
has comment: http://stackoverflow.com/comment/34333846
tagged with: classnotfoundexception
tagged with: hazelcast
has answer: http://stackoverflow.com/a/31560029
tagged with: serializable
favorite count: 0
has comment: http://stackoverflow.com/comment/42572510
answer count: 3
type: UnansweredQuestion
tagged with: dictionary
has answer: http://stackoverflow.com/a/29370409
has body: I am trying to implement Hazelcast in a simple web application. I am trying to store a custom object into my Hazelcast Map and have implemented Serializable in my Bid Object Class with the necessary imports. import java.io.Serializable; Here is a snippet of the class object. public class Bid implements Serializable{ private String bidId; private String stock; private int price; private String userId; private Date date; Here are the syntax as with the tutorial to store the Bid Object into the Map where newBid is a Bid Object. Config cfg = new Config(); HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg); Map&lt;String, Bid&gt; mapBids = instance.getMap("bids"); mapBids.put(newBid.getUserId(), newBid); My Hazelcast nodes are up and running but when I query the bids map, I get the following error. com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.Class NotFoundException: aa.Bid at com.hazelcast.nio.serialization.DefaultSerializers$ObjectSerializer.r ead(DefaultSerializers.java:190) at com.hazelcast.nio.serialization.StreamSerializerAdapter.read(StreamSe rializerAdapter.java:59) at com.hazelcast.nio.serialization.SerializationServiceImpl.toObject(Ser ializationServiceImpl.java:221) at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:15 6) at com.hazelcast.map.MapService.toObject(MapService.java:773) at com.hazelcast.map.proxy.MapProxyImpl.entrySet(MapProxyImpl.java:502) at com.hazelcast.examples.TestApp.handleMapEntries(TestApp.java:882) at com.hazelcast.examples.TestApp.handleCommand(TestApp.java:371) at com.hazelcast.examples.TestApp.start(TestApp.java:187) at com.hazelcast.examples.TestApp.main(TestApp.java:1641) Caused by: java.lang.ClassNotFoundException: aa.Bid at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unkn…
downvote count: 0
has comment: http://stackoverflow.com/comment/34321709
has comment: http://stackoverflow.com/comment/34335677
score: 6
has answer: http://stackoverflow.com/a/26992578
type: Question
has comment: http://stackoverflow.com/comment/34323205

http://stackoverflow.com/comment/34213857
comment on: http://stackoverflow.com/q/22489168
type: Comment
type: QuestionComment
has text: Welcome on stackoverflow! Can http://en.wikipedia.org/wiki/Tree_traversal help you out?
score: 0

http://stackoverflow.com/comment/34290737
type: QuestionComment
has text: Yes, either way they do the same job. I'm still not able to figure it out where it's going wrong
comment on: http://stackoverflow.com/q/22532680
score: 0
type: Comment

http://stackoverflow.com/comment/34307693
has text: @SLaks: of course given `SubQ extends Q`. Indeed `Foo` is not `Foo<SubQ>`, but sometimes you don't mind the exact type, you only need to know for sure it has certain functionality. In that case the generic parameter is useful when creating a collection.
comment on: http://stackoverflow.com/a/22542640
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34228118
has text: Question should be closed, I hope
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22497785
score: 0

http://stackoverflow.com/q/22514745
has comment: http://stackoverflow.com/comment/34259737
has body: I have been advised by my colleagues not to use StartsWith() method in java when comparing say against the enum values. Reason being if we add anything in Enum which starts with similar String &amp; want them to be handled differently, it might go off the radar with startsWith as it will be accepting the new value &amp; silently passing as well. Though i agree to this in principle , but its a case specific thing. Are there any General reservations against usage of StartsWith() in java.
type: Question
tagged with: enums
has title: What are the General reservations against using StartsWith() routine in Java (More details below)
has comment: http://stackoverflow.com/comment/34257331
tagged with: java
has comment: http://stackoverflow.com/comment/34260584
tagged with: startswith
has comment: http://stackoverflow.com/comment/34257278
has comment: http://stackoverflow.com/comment/34302531
score: 0
has comment: http://stackoverflow.com/comment/34302276
has comment: http://stackoverflow.com/comment/34257452
has comment: http://stackoverflow.com/comment/34303700
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34326714
has text: *Why* do you have a .scala file inside a JAR? JAR files are for object code and resources, not for source code.
type: QuestionComment
comment on: http://stackoverflow.com/q/22530657
type: Comment
score: 0

http://stackoverflow.com/q/22645028
tagged with: jooq
has body: I am a 'newbie' to JOOQ. I have had trouble finding in the tutorial or pdf documentation details on which of several classes to use when using the DSLContext's select statement. The syntax of the select is not right because, I believe, the where clause contains a reference to the ifd table which is not in the from and not in the join. I am not sure how to accomplish the right syntax. Any sources of docs would be appreaciated as well as pointers in what I am doing wrong. Descriptor d = DESCRIPTOR.as("d"); Desclink dl = DESCLINK.as("dl"); Ifdesc ifd = IFDESC.as("ifd"); // Result&lt;Record2&lt;Integer, Integer&gt;&gt; result = dslContext.select(d.NETWORKID, dl.PARENT) .from(d) .join(dl).on(dl.PARENT.equal(d.DESCID)) .where(ifd.DESCID.equal(dl.CHILD)) .fetch() ; for (Record2 r2 : result) { Integer n = r2.getValue( d.NETWORKID); Integer p = r2.getValue(dl.PARENT); logger.println("nwid : " + n + " p " + p ); }
possible better answer: http://stackoverflow.com/a/22650983
tagged with: sql
has answer: http://stackoverflow.com/a/22650983
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/22653199
type: AnsweredQuestion
tagged with: java
has title: Correct JOOQ class to use with DSLConext create and iterating the result
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22653199
favorite count: 0

http://stackoverflow.com/q/22502676
tagged with: gesture-recognition
tagged with: java
has comment: http://stackoverflow.com/comment/36896346
type: Question
has body: I want to know can we have some thing in android to recognize double tap action on SCREEN itself. I found lot of code related to double tap gesture but didn't find for SCREEN. Please let me know if it is there in API. It is like we click on screen of the mobile and it will start the action like in windows phone when we double click on phone screen it will come into on mode form steady mode. I am using this code for double tap gesture. package a.b.c; import android.app.Activity; import android.os.Bundle; import android.view.GestureDetector.OnDoubleTapListener; import android.view.GestureDetector.OnGestureListener; import android.view.MotionEvent; import android.widget.Toast; public class SampleActivity extends Activity implements OnDoubleTapListener,OnGestureListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override public boolean onDoubleTap(MotionEvent e) { if(e.getAction()==1) { Toast.makeText(getBaseContext(), "onDoubleTap", Toast.LENGTH_LONG).show(); } return true; } @Override public boolean onDoubleTapEvent(MotionEvent e) { if(e.getAction()==1) { Toast.makeText(getBaseContext(), "onDoubleTapEvent", Toast.LENGTH_LONG).show(); } return true; } @Override public boolean onSingleTapConfirmed(MotionEvent e) { if(e.getAction()==1) { Toast.makeText(getBaseContext(), "onSingleTapConfirmed", Toast.LENGTH_LONG).show(); } return true; }
has comment: http://stackoverflow.com/comment/36693839
has title: Double tap gesture on phone Screen
score: 0
has answer: http://stackoverflow.com/a/22504461
answer count: 1
type: UnansweredQuestion
tagged with: android

file-io
tags question: http://stackoverflow.com/q/22605581
tags question: http://stackoverflow.com/q/22562908
tags question: http://stackoverflow.com/q/22513457
tags question: http://stackoverflow.com/q/22571205
tags question: http://stackoverflow.com/q/22508303
type: Tag
tags question: http://stackoverflow.com/q/22594495
tags question: http://stackoverflow.com/q/22548980
tags question: http://stackoverflow.com/q/22578655
tags question: http://stackoverflow.com/q/22502667
tags question: http://stackoverflow.com/q/22570158
tags question: http://stackoverflow.com/q/22490625
tags question: http://stackoverflow.com/q/22559918
tags question: http://stackoverflow.com/q/22554866
tags question: http://stackoverflow.com/q/22574728
tags question: http://stackoverflow.com/q/22634988
tags question: http://stackoverflow.com/q/22501507
tag name: file-io
tags question: http://stackoverflow.com/q/22528582
tags question: http://stackoverflow.com/q/22647716
tags question: http://stackoverflow.com/q/22507998
tags question: http://stackoverflow.com/q/22578278

http://stackoverflow.com/q/22591596
linked to: http://stackoverflow.com/q/17275344
favorite count: 0
has title: Interface naming convention in Java?
type: UnansweredQuestion
tagged with: interface
linked to: http://stackoverflow.com/q/541912
has answer: http://stackoverflow.com/a/22591627
duplicate of: http://stackoverflow.com/q/541912
has comment: http://stackoverflow.com/comment/34393984
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/2814805
upvote count: 0
score: -1
has body: Is there any convention on how to name your interfaces? I do not mean the implementations, just the interface! What about the suffix '-able'? Like Runnable, Closeable, Serializable? When to use this?
answer count: 1

http://stackoverflow.com/comment/34441310
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22617390
type: AnswerComment
has text: If he has the POJO, no. If it is to manipulate JSON directly, yes. The `.get()` methods are defined on `JsonNode` after all (note also the `.path()` methods)

http://stackoverflow.com/comment/34409524
comment on: http://stackoverflow.com/q/22600064
score: 0
has text: If you had a box that fit 3 apples and another box that fit 6 apples, what size box would you need to fit 9 apples?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34483421
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22641604
has text: Could you elaborate your answer? What shall I do with the checkbox?
score: 0

http://stackoverflow.com/comment/34260259
comment on: http://stackoverflow.com/a/22513128
type: AnswerComment
type: Comment
has text: @Quincunx I guess since this would be the end of the sentence, it should be `"a cat jumped on the table" `
score: 0

http://stackoverflow.com/a/22575328
has body: The Date(long) constructor takes the number of milliseconds since the Unix epoch. I strongly suspect that you've been given the number of seconds since the Unix epoch - so just multiply that value by 1000L. Date date = new Date(timestamp * 1000L); Make sure you use 1000L rather than 1000, as otherwise if timestamp is an int, it will perform the arithmetic in 32 bits instead of 64, and you're very likely to get the wrong results.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34365126
accepted answer of: http://stackoverflow.com/q/22575310
answers question: http://stackoverflow.com/q/22575310
score: 6
upvote count: 6

http://stackoverflow.com/a/22650279
has comment: http://stackoverflow.com/comment/34498950
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22600040
answers question: http://stackoverflow.com/q/22600040
has body: I found a solution. As I already mentioned in my original question I encapsulated my Facebook custom sharing (by using Facebook SDK) into an Activity class ShareFacebook by following instructions on FB. Then I used this ShareFacebook Activity as Intent and replaced the original Intent (which is normally created by Intent.createChooser) like this: String myPackageName = getPackageName(); String[] blacklist = new String[]{"com.pinterest", "com.tunewiki.lyricplayer.android", "com.dropbox.android", "com.google.zxing.client.android", "com.adobe.reader", "com.google.android.apps.docs", "flipboard.app"}; Set&lt;Integer&gt; usedSharingApps = new HashSet&lt;Integer&gt;(); int facebookHash1 = "com.facebook.katana".hashCode(); int facebookHash2 = "com.facebook.wakizashi".hashCode(); // share result // By default intent only link is possible to share on facebook List&lt;Intent&gt; targetedShareIntents = new ArrayList&lt;Intent&gt;(); Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); List&lt;ResolveInfo&gt; resInfo = getPackageManager().queryIntentActivities(shareIntent, 0); if (!resInfo.isEmpty()){ for (ResolveInfo resolveInfo : resInfo) { String packageName = resolveInfo.activityInfo.packageName; Intent targetShareIntent; int appId = packageName.hashCode(); if (packageName.equals(myPackageName) || Arrays.asList(blacklist).contains(packageName) /* skip some other packages */ || usedSharingApps.contains(appId)) { continue; } else if (packageName.equals("com.facebook.katana") || packageName.equals("com.facebook.wakizashi")) { usedSharingApps.add(appId); Intent targetShareIntentTmp = new Intent(getApplicationContext(), ShareFacebook.class); targetShareIntentTmp.addCategory("android.intent.category.ALTERNATIVE"); targetShareIntentTmp.setAction(Intent.ACTION_SEND); targetShareIntentTmp.setType("text/plain"); targetShareIntentTmp.setPackage(myPackageName); targetShareIntentTmp.setComponent(new ComponentName(getPackageName(), Share…
score: 0

enums
tags question: http://stackoverflow.com/q/22500338
tags question: http://stackoverflow.com/q/22592219
tags question: http://stackoverflow.com/q/22613976
tags question: http://stackoverflow.com/q/22635702
tags question: http://stackoverflow.com/q/22644024
tags question: http://stackoverflow.com/q/22541955
tags question: http://stackoverflow.com/q/22506573
tags question: http://stackoverflow.com/q/22586883
tags question: http://stackoverflow.com/q/22541541
tags question: http://stackoverflow.com/q/22572923
tag name: enums
tags question: http://stackoverflow.com/q/22633053
tags question: http://stackoverflow.com/q/22581115
tags question: http://stackoverflow.com/q/22511634
tags question: http://stackoverflow.com/q/22587477
type: Tag
tags question: http://stackoverflow.com/q/22504097
tags question: http://stackoverflow.com/q/22545999
tags question: http://stackoverflow.com/q/22502154
tags question: http://stackoverflow.com/q/22578227
tags question: http://stackoverflow.com/q/22523681
tags question: http://stackoverflow.com/q/22514745

http://stackoverflow.com/q/22642670
duplicate of: http://stackoverflow.com/q/19723811
has title: /AndroidRuntime FATAL EXCEPTION: main 03-25 11:50:16.455
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22643117
tagged with: android-intent
tagged with: java
linked to: http://stackoverflow.com/q/19723811
type: Question
has comment: http://stackoverflow.com/comment/34485474
tagged with: google-maps
tagged with: api
has body: My Code private static final LatLng AMSTERDAM = new LatLng(52.37518, 4.895439); private static final LatLng PARIS = new LatLng(48.856132, 2.352448); private static final LatLng FRANKFURT = new LatLng(50.111772, 8.682632); private GoogleMap map; private LatLngBounds latlngBounds; private Button bNavigation; private Polyline newPolyline; private boolean isTravelingToParis = false; private int width, height; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_navigation); getSreenDimanstions(); map = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); bNavigation = (Button) findViewById(R.id.bNavigation); bNavigation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!isTravelingToParis) { isTravelingToParis = true; findDirections( AMSTERDAM.latitude, AMSTERDAM.longitude,PARIS.latitude, PARIS.longitude, GMapV2Direction.MODE_DRIVING ); } else { isTravelingToParis = false; findDirections( AMSTERDAM.latitude, AMSTERDAM.longitude, FRANKFURT.latitude, FRANKFURT.longitude, GMapV2Direction.MODE_DRIVING ); } } }); } @Override protected void onResume() { super.onResume(); latlngBounds = createLatLngBoundsObject(AMSTERDAM, PARIS); map.moveCamera(CameraUpdateFactory.newLatLngBounds(latlngBounds, width, height, 150)); } public void handleGetDirectionsResult(ArrayList&lt;LatLng&gt; directionPoints) { PolylineOptions rectLine = new PolylineOptions().width(5).color(Color.RED); for(int i = 0 ; i &lt; directionPoints.size() ; i++) { rectLine.add(directionPoints.get(i)); } if (newPolyline != null) { newPolyline.remove(); } newPolyline = map.addPolyline(rectLine); if (isTravelingToParis) { latlngBounds = createLatLngBoundsObject(AMSTERDAM, PARIS); map.animateCamera(CameraUpdateFactory.newLatLngBounds(latlngBounds, width, height, 150)); } else { latlngBounds = createLatLngBoundsObject(AMSTERDAM, FRANKFURT); map.animateCamera(CameraUp…
has comment: http://stackoverflow.com/comment/34485421
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22642891

glsl
tags question: http://stackoverflow.com/q/22592464
type: Tag
tag name: glsl

http://stackoverflow.com/comment/34518270
has text: yes, I need update the fields, thank you for your help, but the other answer was the solution to my problem.
type: AnswerComment
comment on: http://stackoverflow.com/a/22647513
type: Comment
score: 0

http://stackoverflow.com/q/22542746
type: Question
has body: I have an array named theDirectory, which holds a number of DirectoryEntry's, each of which contain a name, and a telno. The task I am struggling with is creating a method in a seperate ArrayPhoneDirectory file, called lookUpEntry, which takes the parameter (String name), and searches through the array, to find the DirectoryEntry that contains that name, and then returns the telno associated with it, using the getNumber method declared in DirectoryEntry.java. public class DirectoryEntry { String name; String telno; public DirectoryEntry(String name, String telno) { this.name = name; this.telno = telno; } public String getName() { return name; } public String getNumber() { return telno; } public void setNumber(String telno) { this.telno = telno; } public String toString() { return getClass().getName() + " Name: " + this.name + " Number: " + this.telno; } public String format() { return String.format("%-20s %-20s", name, telno); } } This is what I have so far, however I think I may be heading down the wrong route, so any help would be much appreciated. public String lookUpEntry(String name) { if (Arrays.asList(theDirectory).contains(name)) { return theDirectory.getNumber; } else { return null; } } thanks.
tagged with: arrays
has answer: http://stackoverflow.com/a/22543212
accepted answer: http://stackoverflow.com/a/22543212
tagged with: search
score: 0
has answer: http://stackoverflow.com/a/22542938
has title: Searching Arrays and returning elements within
has answer: http://stackoverflow.com/a/22542957
answer count: 4
possible better answer: http://stackoverflow.com/a/22542938
tagged with: interface
has answer: http://stackoverflow.com/a/22543024
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34308144

http://stackoverflow.com/a/22605023
score: 1
answers question: http://stackoverflow.com/q/22604763
has body: Use this: Intent finishIntent = new Intent( this, activity_that_you_want_to_return.class); finishIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(finishIntent);
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34417896

http://stackoverflow.com/comment/34269262
score: 0
comment on: http://stackoverflow.com/q/22521144
type: QuestionComment
type: Comment
has text: Lol thnx anyway, haha!

http://stackoverflow.com/comment/34382640
has text: Yeah I learned that but I only did that because there is no possible way to reach that part of the code. and It forced me to return something. It hasn't been causing me problems
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22585041

http://stackoverflow.com/q/22586762
has answer: http://stackoverflow.com/a/22586800
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34385761
has body: Hello I am having trouble with the logic of returning my linkedList in a try/catch block. I currently have: public static LinkedList&lt;String&gt; makeList(String textName) { try { BufferedReader in = new BufferedReader(new InputStreamReader( new FileInputStream(textName), "UTF8")); LinkedList&lt;String&gt; ll = new LinkedList&lt;String&gt;(); String line; while ((line = in.readLine()) != null) { ll.add(line); } return ll; in.close(); } catch (UnsupportedEncodingException e) { System.out.println(e.getMessage()); } catch (IOException e) { System.out.println(e.getMessage()); } catch (Exception e) { System.out.println(e.getMessage()); } } Obviously something is wrong with the return statement only being in the try block but when I also have "return null;" outside of the try and catch I still get an error. The help is appreciated.
tagged with: return
has title: returning in a method with a try/catch block
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22586793
tagged with: linked-list
tagged with: java
tagged with: methods
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/34385738

http://stackoverflow.com/comment/34446199
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22620407
type: Comment
has text: `\\.([^\\w])` matches a `.` followed by a single non-word character. All your examples have a word character following the `.` http://regexpal.com/ is your friend.

http://stackoverflow.com/comment/34261208
type: Comment
comment on: http://stackoverflow.com/q/22516572
score: 1
type: QuestionComment
has text: When you run Yummy21, the data is created then thrown out when the program ends. That program has nothing to do with the execution of Yummy22. If you need to keep the data generated by Yummy21, then you need to save it to some kind of long term storage, like a file, as Tyson Moncrief suggested.

http://stackoverflow.com/comment/34481138
score: 0
has text: Smells like homework with those restrictions.....
comment on: http://stackoverflow.com/q/22640106
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22529269
has body: As @MaciejWalkowiak said, and as the manual says, Make sure that you are not initializing multiple instances of the same @Scheduled annotation class at runtime, unless you do want to schedule callbacks to each such instance. Related to this, make sure that you do not use @Configurable on bean classes which are annotated with @Scheduled and registered as regular Spring beans with the container: You would get double initialization otherwise, once through the container and once through the @Configurable aspect, with the consequence of each @Scheduled method being invoked twice. Log this in your job. If it's the same instance, the scheduling is getting triggered incorrectly somehow. If not, you're instantiating the scheduled class three times. Update: I thought about this a bit more since you said it's environment-specific, and noticed that the thread pool names are different, but they're all thread 1 in their respective pools. That implies you have multiple ThreadPoolTaskExecutors. Are you creating multiple containers somehow?
has comment: http://stackoverflow.com/comment/34287920
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22528587
upvote count: 2

http://stackoverflow.com/comment/34423637
has text: Android Browser. 'obj' - apparently the view of browser.
comment on: http://stackoverflow.com/q/22608017
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34423966
type: Comment
has text: @KugathasanAbimaran Try what? There is no link.
comment on: http://stackoverflow.com/q/22608536
score: 0
type: QuestionComment

http://stackoverflow.com/q/22589631
has comment: http://stackoverflow.com/comment/34390688
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22589678
has body: I'm calling a method from the Superclass called getStringRepresentation which currently returns " ". Which is fine. My problem is I want to change the return statement in my Subclass to another symbol such as S or O for example. Currently my code looks like this: public EmptySpace(Position position) { super(position); super.getStringRepresentation() return "ES"; //this obviously doesn't work. } I understand with a string you can just override it with system.out, but the java tutorials don't explain or have an example for return statements. but the java tutorials don't explain or have an example for return statements. Main class public class Sector { private Position position; /** * Returns a String containing " " (Whitespace). * * @Return returns a String containg " " */ public String getStringRepresentation() { return " "; }
tagged with: return
tagged with: subclass
has answer: http://stackoverflow.com/a/22589730
has comment: http://stackoverflow.com/comment/34390713
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22589730
tagged with: super
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22589678
has title: Java calling method from Superclass and changing the return statement
answer count: 2

http://stackoverflow.com/comment/34250214
type: AnswerComment
comment on: http://stackoverflow.com/a/22492570
type: Comment
has text: @DSquare I added your code, but the issue is still there. I will keep your code to there for preventing some future issue. thanks.
score: 0

http://stackoverflow.com/a/22605243
has body: I think your problem is that your initially last element next attribute isn't being changed becuase of your condition if(next == null) return; Is at the beginning of your loop. I would move it right after tmp.next has been assigned: while(tmp != null){ tmp.next = before; if(next == null) return; before = tmp; tmp = next; next = next.next; }
score: 0
answers question: http://stackoverflow.com/q/22605050
type: Answer

http://stackoverflow.com/comment/34219716
type: QuestionComment
has text: Can you provide a runnable example which demonstrates your problem
comment on: http://stackoverflow.com/q/22492670
type: Comment
score: 0

http://stackoverflow.com/a/22619159
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34445789
has body: Not sure if it is just a typo in your post or not, but the ProGuard configuration file refers to com.myapp.android.JavaScriptInterface whereas your Java class indicates a different package package com.myclass.android; // myapp != myclass and, of course, they must be the same. EDIT: in addition to your existing configuration, try adding the following option: -keepclassmembers class com.myclass.android.JavaScriptInterface { public &lt;methods&gt;; }
answers question: http://stackoverflow.com/q/22618588
has comment: http://stackoverflow.com/comment/34446115

http://stackoverflow.com/q/22587427
has body: I am inserting a sorted object into a HashMap but its not getting sorted. Map&lt;Long, Object&gt; sortedObject = new HashMap(Long, Object&gt;(); for(Object sortedObject : sortedObjectList) { sortedMap.put(sortedObject.getId(), sortedObject); } syso(new Gson().toJson(sortedMap); In output I was expecting sorted map, but its random. Please help.
has title: Insertion in HashMap not working properly
has comment: http://stackoverflow.com/comment/34386847
has answer: http://stackoverflow.com/a/22587479
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34386828
tagged with: hashmap
tagged with: java
has comment: http://stackoverflow.com/comment/34386852
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34386794
has comment: http://stackoverflow.com/comment/34386814
tagged with: sorting
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22587471

java.util.scanner
tags question: http://stackoverflow.com/q/22495558
tags question: http://stackoverflow.com/q/22578396
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/22543575
tags question: http://stackoverflow.com/q/22566854
type: Tag
tags question: http://stackoverflow.com/q/22622464
tags question: http://stackoverflow.com/q/22518594
tags question: http://stackoverflow.com/q/22587089
tags question: http://stackoverflow.com/q/22580514
tags question: http://stackoverflow.com/q/22503520
tags question: http://stackoverflow.com/q/22579142
tags question: http://stackoverflow.com/q/22507957
tags question: http://stackoverflow.com/q/22542833
tags question: http://stackoverflow.com/q/22522564
tags question: http://stackoverflow.com/q/22647444

http://stackoverflow.com/a/22694664
has body: The problem is your use case: you want com.bundleB.tests to import com.bundleA.utils, but com.bundleA.utils is a fragment of com.bundleA. Creating fragments for unittests is ok, but not when parts of this fragments must be used by other unittests from other bundles. You should create a bundle with only the utils classes which must be shared (com.bundleC) which is only used by the unittest fragments and which contain the com.bundleA.utils package.
type: Answer
answers question: http://stackoverflow.com/q/22575872
has comment: http://stackoverflow.com/comment/34692584
upvote count: 1
downvote count: 1
score: 0

http://stackoverflow.com/a/22638950
score: 0
answers question: http://stackoverflow.com/q/22638440
has body: Try this one using regex. You can add and remove the characters you need from the expression to count what you need. public static int countUniqueCharacters(String text1) { String newText = text1.replaceAll("[^A-Za-z0-9()\\[\\]]", ""); Set&lt;Character&gt; tempSet = new HashSet&lt;&gt;(); for (char item : newText.toCharArray()) { tempSet.add(item); } return tempSet.size(); }
type: Answer
has comment: http://stackoverflow.com/comment/34479564

http://stackoverflow.com/a/54591588
score: 0
type: Answer
has body: Add this before adding request to request queue request.setRetryPolicy(new DefaultRetryPolicy( 0, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
answers question: http://stackoverflow.com/q/22500177

http://stackoverflow.com/q/22500451
has title: JDBC Driver class not found: oracle.jdbc.OracleDriver in oracle 11g
type: Question
has body: i wrote a program to connect to the database in java 1.7 and my database is oracle 11g express edition iam getting class not found error for the class OracleDriver?
tagged with: java
has comment: http://stackoverflow.com/comment/34232249
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22500476
linked to: http://stackoverflow.com/q/9272124
has comment: http://stackoverflow.com/comment/34232675
has comment: http://stackoverflow.com/comment/34232303
type: UnansweredQuestion

http://stackoverflow.com/q/22644334
type: Question
has comment: http://stackoverflow.com/comment/34488201
has title: Convert a json array to an hashmap<string,object>
downvote count: 0
has comment: http://stackoverflow.com/comment/34488390
tagged with: jackson
has comment: http://stackoverflow.com/comment/34488373
has answer: http://stackoverflow.com/a/22644538
has comment: http://stackoverflow.com/comment/34488392
answer count: 1
favorite count: 0
upvote count: 2
has body: I have an external parsed List type which is a json array, indeed this call list.toString() gives me this: [{name=prop1, content=&lt;something&gt;},{name=prop2, content=&lt;something&gt;}] The content could be anything, an array, a string, an int... So I'd like to map that json array to something like HashMap&lt;String,Object&gt; converted; This would allow me to do this: converted.get("prop1"); //this will give me the &lt;something&gt; how could I do that?
accepted answer: http://stackoverflow.com/a/22644538
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34488211
tagged with: java

http://stackoverflow.com/q/22564666
favorite count: 0
type: Question
tagged with: jetty
has comment: http://stackoverflow.com/comment/34599562
upvote count: 2
tagged with: activemq-classic
tagged with: java
tagged with: apache-camel
has answer: http://stackoverflow.com/a/30918746
answer count: 1
has title: camel jetty continuation exception
type: UnansweredQuestion
score: 2
has body: I'm triggering an inout exchange via activemq to a route which performs a slow SQL query. the jetty servlet is timing out: WARN org.apache.camel.component.jetty.CamelContinuationServlet - Continuation expired of exchangeId: ID-wsintc01-40254-1395419854072-0-3 I've tried all the variations I can think of for useContinuation and continuationTimout but i still get the 503 error. When the query completes I then get: QueueReplyManager[x]] WARN org.apache.camel.component.jetty.CamelContinuationServlet - Cannot resume expired continuation of exchangeId: ID-wsintc01-40254-1395419854072-0-3 This is the route in the integration route set: &lt;route&gt; &lt;from uri="jetty:http://0.0.0.0:{{jetty.port}}/fetch_schedules?continuationTimeout={{jetty.continuationTimeout}}"/&gt; &lt;setExchangePattern pattern="InOut"/&gt; &lt;to uri="activemq:scheduler:getTVA?disableTimeToLive=true&amp;amp;requestTimeout={{scheduler.timeout}}&amp;amp;replyTo={{me.replyQueue}}&amp;amp;replyToType=Exclusive"/&gt; &lt;to uri="velocity:view.vm"/&gt; &lt;setHeader headerName="Content-Type"&gt; &lt;constant&gt;text/html;&lt;/constant&gt; &lt;/setHeader&gt; &lt;/route&gt; The route in the scheduler just calls a java bean which does multiple sql queries of the database and builds an XML document.
downvote count: 0

http://stackoverflow.com/q/22598447
has comment: http://stackoverflow.com/comment/34406571
has comment: http://stackoverflow.com/comment/34406546
has comment: http://stackoverflow.com/comment/34406732
type: Question
linked to: http://stackoverflow.com/q/5621338
answer count: 1
tagged with: button
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/34406658
has answer: http://stackoverflow.com/a/22598988
score: 0
tagged with: user-interface
has title: JCheckboxes and JButton not showing randomly
accepted answer: http://stackoverflow.com/a/22598988
has comment: http://stackoverflow.com/comment/34406997
has body: I have a basic gui (it doesn't need to look pretty, it just needs to work. It's a gui to display several algorithms I'm implementing for my thesis.) but the checkboxes and button won't show up randomly. Sometimes they appear, sometimes they don't. I honestly have no clue why this could be happening and I'm pretty scrub at swing, so I'm lost. EDIT: Here's what i want my gui to look like: //import java.awt.*; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.*; import javax.swing.ButtonGroup; import javax.swing.*; //notice javax public class MapWindowController extends JFrame implements ActionListener, ItemListener { private static final int WIDTH = 600, HEIGHT = 800; private static final int SETTINGS_WIDTH = 600, SETTINGS_HEIGHT = 200; private static final int NUM_MAP_TYPE = 2; private static final int NUM_ALGORITHM_TYPE = 4; private static final int MAP_IMAGE_SIZE = 400, ACTUAL_MAP_SIZE = 10; private JButton run; private JCheckBox[] map_type; private JCheckBox[] algorithm_type; JPanel panel = new JPanel(); JPanel settings_panel = new JPanel(); MapView map_view = new MapView(MAP_IMAGE_SIZE); SettingsButtonsPanel settings = new SettingsButtonsPanel(); MapModel map_model = new MapModel(ACTUAL_MAP_SIZE, map_view); ButtonGroup bgMap; ButtonGroup bgAlgorithm; public MapWindowController() { setLocationRelativeTo(null); setTitle("HPA* Test"); setSize(WIDTH, HEIGHT); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); add(panel); panel.setBounds(0, 0, 600, 800); panel.setLayout(null); /*GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0;*/ instantiateSettingsPanel(); //panel.add(settings); /*c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1;*/ panel.add(map_view); map_view.setBounds(0,200,600,600); //button_panel.setBounds(0,0); map_view.repaint(); } public void instantiateSettingsPanel() { settings_panel.setLayout(new GridBag…
has comment: http://stackoverflow.com/comment/34407369
tagged with: swing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/34406636
tagged with: java
has comment: http://stackoverflow.com/comment/34407352

http://stackoverflow.com/q/22521807
answer count: 0
upvote count: 2
type: UnansweredQuestion
type: Question
has title: JavaFX TextField can't set Text from a ResultSet
tagged with: java
tagged with: jdbc-odbc
tagged with: sql
downvote count: 0
favorite count: 0
has body: I am developing a JavaFX Application which has access to a Database through JDBC/ODBC. When I click on a button, I want some TextFields to update their texts according to a ResultSet, showing the First Name and Last Name of a certain user. When I try to invoke the TEXTFIELD.setText(RESULTSET.getString(1)) of the TextFields, I get an SQLException: No data found. Here's the code: @FXML private TextField tf_matricula; @FXML TextField tf_apellido; @FXML TextField tf_apellidos; @FXML TextField tf_nombre; @FXML public void btn_ir_Action(ActionEvent event){ try(Connection con = JDBCHandler.getConnection()){ Statement st = con.createStatement(); ResultSet rs = st.executeQuery("SELECT Apellido, Apellidos, Nombre FROM Alumnos WHERE Matricula='" + tf_matricula.getText() + "'"); if(rs.next()){ tf_apellido.setText(rs.getString(1)); tf_apellidos.setText(rs.getString(2)); tf_nombre.setText(rs.getString(3)); } }catch(SQLException | ClassNotFoundException ex){ System.out.println(ex.getMessage()); ex.printStackTrace(); } } And the Error Message I get is the following: No data found java.sql.SQLException: No data found at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7137) at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3906) at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5697) at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:353) at pruebaingresos.SistemasAlumnosFXMLController.btn_ir_Action(SistemasAlumnosFXMLController.java:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) The weird thing is that when I save the ResultSet information into Strings and then pass them to the …
tagged with: jdbc
tagged with: javafx-2
score: 2
has comment: http://stackoverflow.com/comment/47882705

http://stackoverflow.com/comment/34465646
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22629294
has text: okay.. try calling http://localhost:8180/GisProject/CreateService and see what you get.
type: Comment

http://stackoverflow.com/q/22552148
linked to: http://stackoverflow.com/q/18505406
has comment: http://stackoverflow.com/comment/34324407
score: 0
has comment: http://stackoverflow.com/comment/34324706
has comment: http://stackoverflow.com/comment/34324322
has comment: http://stackoverflow.com/comment/34324919
has comment: http://stackoverflow.com/comment/34323509
has comment: http://stackoverflow.com/comment/34323644
has comment: http://stackoverflow.com/comment/34327658
has comment: http://stackoverflow.com/comment/34327576
has body: I am trying to transfer multiple gif images as BufferedImages from client to server. But once a single image starts to transfer ,the client socket closes. The code I have tried is as follows Server private void connect() { int noOfFiles, w, h; BufferedImage bi; try { ServerSocket ss = new ServerSocket(5223); Socket s = ss.accept(); InputStream is = s.getInputStream(); DataInputStream dis = new DataInputStream(is); noOfFiles = dis.readInt(); System.out.println("Total Files: " + noOfFiles); dis.close(); s.close(); ServerSocket ssa = new ServerSocket(5225); Socket sa = ssa.accept(); InputStream isa = sa.getInputStream(); for (int x = 0; x &lt; noOfFiles; x++) { File imgFile = new File("D:\\aa\\" + x); bi = ImageIO.read(isa); w = bi.getWidth(); System.out.println(w); h = bi.getHeight(); if (bi.getType() != BufferedImage.TYPE_INT_RGB) { BufferedImage bi1 = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics g = bi1.getGraphics(); g.drawImage(bi, 0, 0, null); } ImageIO.write(bi, "GIF", imgFile); } sa.close(); ssa.close(); } catch (IOException ex) { ex.printStackTrace(); } } Client private void connect() { Image i; BufferedImage bi = null; try { Socket s = new Socket("localhost", 5223); DataOutputStream dos = new DataOutputStream(s.getOutputStream()); File fol = new File("D:\\images\\red"); File[] files = fol.listFiles(); dos.writeInt(files.length); dos.flush(); dos.close(); Socket ss = new Socket("localhost", 5225); for (File f : files) { i = ImageIO.read(f); bi = (BufferedImage) i; ImageIO.write(bi, "GIF", ss.getOutputStream()); } ss.close(); } catch (IOException ex) { ex.printStackTrace(); } } And the exceptions I get are as follows: Server Exception in thread "main" java.lang.NullPointerException at PortScanNew.ImgTrnsfrSvr.connect(ImgTrnsfrSvr.java:54) at PortScanNew.ImgTrnsfrSvr.main(ImgTrnsfrSvr.java:33) Java Result: 1 Client java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at…
has comment: http://stackoverflow.com/comment/34324296
has comment: http://stackoverflow.com/comment/34324235
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34324481
tagged with: sockets
has title: Multiple BufferedImage transfer socket
has comment: http://stackoverflow.com/comment/34324509
has comment: http://stackoverflow.com/comment/34323584
has comment: http://stackoverflow.com/comment/34324611
has comment: http://stackoverflow.com/comment/34330215
answer count: 0
has comment: http://stackoverflow.com/comment/34323638
has comment: http://stackoverflow.com/comment/34324308
tagged with: bufferedimage
has comment: http://stackoverflow.com/comment/34324624
type: Question
has comment: http://stackoverflow.com/comment/34325381
has comment: http://stackoverflow.com/comment/34327293
has comment: http://stackoverflow.com/comment/34326681
tagged with: java
has comment: http://stackoverflow.com/comment/34323971

http://stackoverflow.com/q/22547086
has title: java PrintWriter cannot be resolved
answer count: 2
score: 5
accepted answer: http://stackoverflow.com/a/22547160
linked to: http://stackoverflow.com/q/22547365
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/22547160
has comment: http://stackoverflow.com/comment/34315355
has comment: http://stackoverflow.com/comment/34315845
has comment: http://stackoverflow.com/comment/34316037
has comment: http://stackoverflow.com/comment/34316058
downvote count: 0
tagged with: printwriter
possible better answer: http://stackoverflow.com/a/22547099
has answer: http://stackoverflow.com/a/22547099
has comment: http://stackoverflow.com/comment/34316045
type: Question
type: AnsweredQuestion
has body: I have no idea why I get the message "cannot be resolved" on out in eclipse on the 11th line import java.io.*; public class driver { public static void main(String[] args) { try { PrintWriter out = new PrintWriter("output.txt"); } catch (FileNotFoundException e) { System.out.print("file not found"); e.printStackTrace(); } out.print("hello"); out.close(); } } OK so now I have this import java.io.*; public class driver { public static void main(String[] args) { PrintWriter out = null; try { out = new PrintWriter("output.txt"); } catch (FileNotFoundException e) { System.out.print("file not found"); e.printStackTrace(); } out.print("hello"); out.close(); } } Why doesn't eclipse create a file once I close out?
tagged with: java

http://stackoverflow.com/comment/34337387
type: Comment
has text: This will throw a nullPointerException if you pass it a directory, since arr will be null. You only want to call listFiles() if you know the file is a directory.
comment on: http://stackoverflow.com/a/22558729
score: 0
type: AnswerComment

http://stackoverflow.com/a/22550928
downvote count: 0
score: 4
has body: You need to know the exact format of your string, for intance if your date is formatted as "2014-01-30", SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); java.util.Date date = df.parse(Dateimp); // if you really need java.sql.Date java.sql.Date sqlDate = new java.sql.Date(date.getTime()); Read how to build the date pattern here http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/22550796

http://stackoverflow.com/a/22590137
has body: Your Code will look like class Emp implements Comparable&lt;Emp&gt; { String n; int i; public Emp(String n,int i) { this.n=n; this.i=i; } public void display() { System.out.println("there are string "+n+" int"+i); } public boolean equals(Object o){ if(o instanceof Emp){ Emp d = (Emp)o; return ((d.n.equals(n)) &amp;&amp; (d.i==i)); } return false; } public int hashCode(){ return i/2 + 17; } public int compareTo(Emp d){ if(this.i&gt;d.i) return 1; else if(this.i&lt;d.i) return -1; return this.n.compareTo(d.n); } } Please Ignore if any syntax error and you can improve method implementations also.
type: Answer
score: 1
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22589955
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22589955

http://stackoverflow.com/comment/34307397
has text: That sounds very unlikely; what compiler version are you using?
type: Comment
comment on: http://stackoverflow.com/a/22542640
score: 0
type: AnswerComment

http://stackoverflow.com/q/22620391
has answer: http://stackoverflow.com/a/22620512
linked to: http://stackoverflow.com/q/218384
tagged with: runtime
has answer: http://stackoverflow.com/a/22621044
tagged with: eclipse
has body: Every time I run this code in Java Android: package com.example.basiccalculator; import android.os.Bundle; public class MainActivity extends Activity { LinearLayout layout1; TextView text1; EditText number1text; EditText number2text; Button multiplyButton; Button divideButton; Button subtractButton; Button addButton; TextView answerText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); layout1 = new LinearLayout(this); text1 = new TextView(this); number1text = new EditText(this); number2text = new EditText(this); multiplyButton = new Button(this); answerText = new TextView(this); divideButton = new Button(this); layout1.setOrientation(LinearLayout.VERTICAL); layout1.setGravity(Gravity.CENTER_HORIZONTAL); answerText.setWidth(150); answerText.setGravity(Gravity.CENTER_HORIZONTAL); answerText.setTextSize(TypedValue.COMPLEX_UNIT_SP,20); number1text.setInputType(InputType.TYPE_CLASS_NUMBER); number2text.setInputType(InputType.TYPE_CLASS_NUMBER); multiplyButton.setOnClickListener(multiplyClicked); divideButton.setOnClickListener(divideClicked); subtractButton.setOnClickListener(subtractClicked); addButton.setOnClickListener(addClicked); answerText.setText("0"); addButton.setText("+"); subtractButton.setText("-"); multiplyButton.setText("X"); divideButton.setText("/"); layout1.addView(number1text); layout1.addView(number2text); layout1.addView(multiplyButton); layout1.addView(answerText); layout1.addView(divideButton); layout1.addView(addButton); layout1.addView(subtractButton); setContentView(layout1); number1text.setLayoutParams(new LinearLayout.LayoutParams(550,200)); number2text.setLayoutParams(new LinearLayout.LayoutParams(550,200)); multiplyButton.setLayoutParams(new LinearLayout.LayoutParams(250,250)); divideButton.setLayoutParams(new LinearLayout.LayoutParams(250, 250)); addButton.setLayoutParams(new LinearLayout.LayoutParams(250,250)); subtractButton.setLayoutParams(new Linea…
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: android
tagged with: java
has title: Runtime Error with Java Android (Eclipse):
type: Question

http://stackoverflow.com/comment/34489472
type: QuestionComment
has text: @DavidWallace this is easily covered in stackoverflow servlet wiki and can be handled in a single lesson. I'm not against teachers because I also have suffered from learning this design at workplace rather than in classroom, but it's never too late to learn new things to teach to the students :).
comment on: http://stackoverflow.com/q/22644563
score: 0
type: Comment

http://stackoverflow.com/q/22615384
linked to: http://stackoverflow.com/q/9397203
score: 0
linked to: http://stackoverflow.com/q/13624442
has title: Is it the last day of the month?
has comment: http://stackoverflow.com/comment/34436814
possible better answer: http://stackoverflow.com/a/22615642
linked to: http://stackoverflow.com/q/8997228
linked to: http://stackoverflow.com/q/2937086
has answer: http://stackoverflow.com/a/22615642
has comment: http://stackoverflow.com/comment/34436684
has comment: http://stackoverflow.com/comment/34456941
accepted answer: http://stackoverflow.com/a/22615668
answer count: 4
type: AnsweredQuestion
has body: What I want to happen - if the date (that is given from the parameters) is equal to the last day of the month, I want the cost to be increased by 10%. I.e if dayOfTravel = last day of the month public static double ReturnJourneyCost(int journeyID, int dayOfTravel, int monthOfTravel, int yearOfTravel){ Cost = Double.parseDouble(XMLLoad.load(journeyID, 3)); return Cost; }
has comment: http://stackoverflow.com/comment/34436887
linked to: http://stackoverflow.com/q/4786169
tagged with: java
has answer: http://stackoverflow.com/a/22615729
linked to: http://stackoverflow.com/q/19488658
has answer: http://stackoverflow.com/a/22615668
has comment: http://stackoverflow.com/comment/34436883
type: Question
has comment: http://stackoverflow.com/comment/34436795
has comment: http://stackoverflow.com/comment/34437188
has answer: http://stackoverflow.com/a/22615733
tagged with: date

http://stackoverflow.com/comment/34261587
comment on: http://stackoverflow.com/q/22517059
type: Comment
type: QuestionComment
has text: possible duplicate of [Converting ArrayList of Characters to a String?](http://stackoverflow.com/questions/6324826/converting-arraylist-of-characters-to-a-string)
score: 0

jcomponent
tags question: http://stackoverflow.com/q/22519757
tags question: http://stackoverflow.com/q/22537335
tags question: http://stackoverflow.com/q/22643142
tag name: jcomponent
tags question: http://stackoverflow.com/q/22584813
type: Tag
tags question: http://stackoverflow.com/q/22639410
tags question: http://stackoverflow.com/q/22609655

http://stackoverflow.com/comment/34472459
has text: @Duncan the scope should be "runtime" not "provided" in this case I think.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22635075
type: QuestionComment

http://stackoverflow.com/comment/34393021
comment on: http://stackoverflow.com/q/22590965
type: Comment
has text: You can't. As I said, you can check that all the files exist and throw an error if they do not. But you cannot recreate deleted data. You should use [JPA](http://en.wikipedia.org/wiki/Java_Persistence_API) and an embedded database, such as [HSQLDB](http://hsqldb.org/), for better control but you simply **cannot prevent** the user for breaking things if they want. Unless of course you store the data externally - send it down the wire or some such.
type: QuestionComment
score: 2

http://stackoverflow.com/q/22595531
linked to: http://stackoverflow.com/q/15961412
has comment: http://stackoverflow.com/comment/34402331
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34434978
tagged with: jpanel
has comment: http://stackoverflow.com/comment/34401566
has comment: http://stackoverflow.com/comment/34434553
has comment: http://stackoverflow.com/comment/34402566
has comment: http://stackoverflow.com/comment/34402128
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34402374
has comment: http://stackoverflow.com/comment/34407270
linked to: http://stackoverflow.com/q/10861852
has title: Java JPanel Gets Too Big For The Frame/ScrollBar
has body: I dont intend to throw code at you and ask you to complete it. Unless the following makes no sense in which case code may be a lot of help. I have a JFrame set that has a scrollbar and 12 buttons on it in a GridLayout(12x1). Each button has a panel which displays different things. The last button/panel changes size when an image is chosen from filechooser and displayed. But that last panel becomes too big and I cant scroll down to see the rest of it. I am left with just half the last panel. I have tried resize() and setPreferredSize() to the frame, scrollbar and jpanel but I dont think any are working :( Can anyone offer some insight through personal experience or do you just know what I could do to fix this problem? I could not upload pictures here so I used tinypic. This shows my problem example with before and after. Notice how the scrollbar is at maximum in both images. SOLVED: I have been able to view the whole panel now by increasing the size of the scrollbar panel. However this also makes all other panels increase in size. If anyone knows how I can increase the scrollbar so that only that one panel increases that would be nice.
type: Question
has comment: http://stackoverflow.com/comment/34407318
tagged with: frame
tagged with: scroll
tagged with: swing
linked to: http://stackoverflow.com/q/12226198

http://stackoverflow.com/comment/34441877
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22617927
has text: I think this link is useful already answer http://stackoverflow.com/questions/4956876/noclassdeffounderror-android-graphics-yuvimage-compiles-but-doesnt-run

http://stackoverflow.com/q/22524752
has comment: http://stackoverflow.com/comment/34275837
has comment: http://stackoverflow.com/comment/34276109
has body: I am trying to write a daemon thread for polling which will poll every "3" seconds. I've seen 3 approaches. I am not sure which one to go for ? I want to know the performance considerations. Which one could be consistant and will take smaller memory chunk ? Approach 1 : Using the TimerTask ( Not planning to use this ) new Timer().scheduleAtFixedRate(task, firstTime, period) Approach 2 : Using ScheduledExecutorService Approach 3 : Using Thread.sleep() .... If I boil down to code its something like this : Approach #2 public class Test { static TimerTask timerTask = new TimerTask() { @Override public void run() { // Do polling &amp; Other business logic System.out.println("=="+new Date()); } }; public static void main(String[] args) { ScheduledExecutorService scheduler = Executors .newSingleThreadScheduledExecutor(); scheduler.scheduleWithFixedDelay(timerTask, 0, 3, TimeUnit.SECONDS); } } For the Approach #3 public class Test { static Runnable task = new Runnable() { @Override public void run() { while (true) { try { // Do polling &amp; Other business logic System.out.println("**"+new Date()); Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } } } }; public static void main(String[] args) { new Thread(task).start(); } } According to my understanding threadpools are kind of heavy objects compared to normal threads. I want to know what are the pros and cons of using either of these approaches ? Thanks in advance. Regards, JE
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22525786
favorite count: 0
tagged with: scheduledexecutorservice
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34276224
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/34275806
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22525786
type: Question
has comment: http://stackoverflow.com/comment/34276071
has title: Performance considerations for Thread.sleep() and schedulerExecutorService.scheduleWithFixedDelay
tagged with: threadpool

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/22560921

http://stackoverflow.com/comment/34468605
comment on: http://stackoverflow.com/q/22633333
type: Comment
type: QuestionComment
has text: Most likely you are trying to use a class which you haven't imported, possibly because you don't have a class or instance you are trying to use.
score: 0

http://stackoverflow.com/comment/34472378
type: QuestionComment
has text: I wrote up the conclusion I came to at http://baddotrobot.com/blog/2014/02/18/method-references-in-java8/.
score: 2
comment on: http://stackoverflow.com/q/22516331
type: Comment

http://stackoverflow.com/comment/34449688
has text: Yep, I just tested this, the `-Xlint` flag is providing warnings about a lack of generics. This means that the compiler can not guarantee that the data the `JList` is expecting is actually the data you are providing. That is, the way you have it set up, `JList` is expecting elements of type `Object`, but you are providing `Memeber`. This is not an issue, so long as you've ensured that your renderers can actually handle this. It's just the compiler telling you, that it has no way to be sure that this is correct behaviour or not...
score: 0
comment on: http://stackoverflow.com/q/22621248
type: Comment
type: QuestionComment

http://stackoverflow.com/a/34247173
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22634644
has body: I got similar message when running command line mvn (version 3.3.3) on Linux with Java 8. By opening maven script /$MAVEN-HOME/bin/mvn, found the following line MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" Where $MAVEN_PROJECTBASEDIR by default is your home directory. So two places you can take a look, first is file $MAVEN_PROJECTBASEDIR/.mvn/jvm.config if it exists. Secondly look at files possibly set up the environment variable MAVEN_OPTS. Candidate files are .bashrc, .bash_profile, .profile and those files included by them such as /etc/profile, /etc/bash.bashrc I located export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m" in .bashrc in my system, change it to export MAVEN_OPTS="-Xmx512m" issue resolved
has comment: http://stackoverflow.com/comment/133214216

jstack
tags question: http://stackoverflow.com/q/22490061
type: Tag
tag name: jstack

http://stackoverflow.com/a/22627098
score: 2
downvote count: 0
has body: I would recommend using Modules.override here, which has documentation about its use for functional testing. Use it sparingly, as things can get very messy and hard-to-follow otherwise, but it would look like this: @Before public void createInjector() { this.injector = Guice.createInjector( Modules.override(new YourZABCDModule()).with(new AbstractModule() { @Override public void configure() { bind(B.class).to(FakeB.class); } })); } Or, as in the Modules.override documentation, just use smaller modules for more-granular combinations: @Before public void createInjector() { this.injector = Guice.createInjector( new ZAModule(), new FakeBModule(), new CModule(), new DModule()); }
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34458246
accepted answer of: http://stackoverflow.com/q/22625754
type: Answer
has comment: http://stackoverflow.com/comment/34458590
answers question: http://stackoverflow.com/q/22625754

http://stackoverflow.com/a/22551302
type: Answer
answers question: http://stackoverflow.com/q/22551236
score: 0
has body: just put jar file into the libs folder and abb to build path thats it. Updated eclipse not getting jar or configure file from the lib they get jar file from the libs folder.

http://stackoverflow.com/comment/34373534
comment on: http://stackoverflow.com/a/22578225
type: AnswerComment
has text: Thank you, I am gonna use K-means clustering.
score: 0
type: Comment

http://stackoverflow.com/a/22606391
score: 4
answers question: http://stackoverflow.com/q/22606222
type: Answer
has body: The answers: There's no difference for compiler: a good optimizer will generate the same code. But there's difference for human beings (developers, testers, supporters etc): it's readability. The 3d option is far more natural and that's why easier to read. So the expected code (least surprise principle) is if (testCheck.getValue()) { ... //Respective Code }
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/22590056
has title: Image filter - Convolution
has body: I am trying to implement image filter ( using convulution). I've spent all day trying to figure out what's going on and I cannot find a mistake. The filter works only when I use it to blur the image. In other cases it doesn't work properly: For example this is the original picture(before filtering): And this is the picture after filtering with this matrix: I use Marvin Image Processing Framework and jblas library in my code: public class FiltrySploty extends MarvinAbstractImagePlugin { @Override public void load() { } @Override public MarvinAttributesPanel getAttributesPanel() { return null; } @Override public void process( MarvinImage imageIn, MarvinImage imageOut, MarvinAttributes attributesOut, MarvinImageMask mask, boolean previewMode) { double norm=0; DoubleMatrix filter = (DoubleMatrix)getAttribute("filter"); for ( int i = 0; i &lt; filter.getRows();i++) { for ( int j = 0; j &lt; filter.getColumns();j++) { norm=norm+filter.get(i, j); } } int marginx = ((filter.getRows()-1)/2); int marginy = ((filter.getColumns()-1)/2); for (int x = marginx; x &lt; imageIn.getWidth()-marginx; x++) { for (int y = marginy; y &lt; imageIn.getHeight()-marginy; y++) { double SumRed=0; double SumGreen=0; double SumBlue=0; for ( int i = x-marginx,k=0 ; k &lt; filter.getRows();i++,k++) { for ( int j = y-marginy, l=0 ; l &lt;filter.getColumns();j++,l++) { SumRed= SumRed+(filter.get(k, l)*imageIn.getIntComponent0(i, j)); SumGreen= SumGreen+(filter.get(k, l)*imageIn.getIntComponent1(i, j)); SumBlue= SumBlue+(filter.get(k, l)*imageIn.getIntComponent2(i, j)); } } SumRed = SumRed/norm; SumGreen = SumGreen/norm; SumBlue = SumBlue/norm; // normalization if(SumRed&gt;255.0) SumRed=255.0; else if(SumRed&lt;0.0) SumRed=0.0; if(SumGreen&gt;255.0) SumGreen=255.0; else if(SumGreen&lt;0.0) SumGreen=0.0; if(SumBlue&gt;255.0) SumBlue=255.0; else if(SumBlue&lt;0.0) SumBlue=0.0; imageOut.setIntColor(x, y, (int)(SumRed), (int)(SumGreen), (int)(SumBlue)); } } } } Seeing the effect of filtering I suppose th…
tagged with: java
tagged with: image-processing
has comment: http://stackoverflow.com/comment/34391588
tagged with: marvin-framework
has comment: http://stackoverflow.com/comment/34391466
type: Question
has comment: http://stackoverflow.com/comment/34391868
has comment: http://stackoverflow.com/comment/34391551
has comment: http://stackoverflow.com/comment/34392015
has comment: http://stackoverflow.com/comment/34391794
has comment: http://stackoverflow.com/comment/34391619
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34393886
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/22542201
has comment: http://stackoverflow.com/comment/34309888
score: 1
upvote count: 1
downvote count: 0
has body: "I already have it fully functioning as a BufferedImage, but as expected it shows only the first frame" This will happen when trying to read the image with ImageIO.read(...). If you read it with new ImageIcon(...).getImage(), you'll get the gif animation. See here. "I also cannot figure out if there is a viable ImageObserver that would animate the .gif in the drawImage() call." The ImageObserver is the component you are painting on. So instead of using drawImage(..., null), you should be using drawImage(..., this) "I am willing to try anything, but I am most interested in the possibility of making the draw call work with an ImageObserver as that would be only a small change." Combine the two points above and you got your answer. Give this code a test run. gif image taken from this answer import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.net.MalformedURLException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class TestGif { public TestGif() { JFrame frame = new JFrame(); frame.add(new GifPanel()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public class GifPanel extends JPanel { Image image; { try { image = new ImageIcon(new URL("https://i.sstatic.net/lKfdp.gif")).getImage(); } catch (MalformedURLException ex) { Logger.getLogger(TestGif.class.getName()).log(Level.SEVERE, null, ex); } } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, 0, 0, this); } @Override public Dimension getPreferredSize() { return image == null ? new Dimension(200, 200) : new Dimension(image.getWidth(this), image.getHeight(this)); } } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new TestGif(); } }); } }
accepted answer of: http://stackoverflow.com/q/22542097
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22542097
type: Answer

http://stackoverflow.com/comment/34512093
comment on: http://stackoverflow.com/q/22641561
score: 1
type: QuestionComment
type: Comment
has text: I think either @Charlie's answer,@trahsgod's example [shown here](http://stackoverflow.com/questions/6035834/composing-swing-components-how-do-i-add-the-ability-to-add-actionlisteners/6036048#6036048) and my own example cover exactly what you're looking for.

http://stackoverflow.com/q/22604956
tagged with: jcombobox
has answer: http://stackoverflow.com/a/22605170
has comment: http://stackoverflow.com/comment/34420365
tagged with: swing
accepted answer: http://stackoverflow.com/a/22605170
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
tagged with: java
has body: in my project, i have a empty combobox which i want to populate after clicking on it. comboCurrent = new JComboBox&lt;String&gt;(); comboCurrent.setBounds(265, 181, 80, 20); add(comboCurrent); comboCurrent.setEditable(true); comboCurrent.setSelectedItem(null); comboCurrent.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO populate here System.out.println(e); } }); but somehow the action listener does not work here. is there a way to listen to the first click on the combobox while it is still empty?
type: Question
linked to: http://stackoverflow.com/q/5621338
answer count: 1
has title: how to focus empty combobox
score: 0
tagged with: focus

http://stackoverflow.com/comment/34449202
type: Comment
comment on: http://stackoverflow.com/a/22622144
has text: Which entity are you saying does not have the `at_Entity` annotation? When I look at the links in the code in my original posting above, I see `at_Entity` at the top of each entity's code.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22630810
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: xml-parsing
answer count: 1
has body: i have an xml file and i am using XPATH to parse it. But i am having problem while getting contents out of it here is the xml <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> abc def ahjkhjkghjkhjk <Picture>/mnt/sdcard/download/1357670177a386a-big-1.jpg Mar 12, 2014 10:32:09 AM xy zabc asdasdasdasd <Picture>/mnt/sdcard/download/1357670177a386a-big-1.jpg Mar 12, 2014 10:32:09 AM and here is my code for parsing it DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(file); XPath xPath = XPathFactory.newInstance().newXPath(); String expression = "/reg/user/Name"; System.out.println(expression); NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET); for (int i = 0; i < nodeList.getLength(); i++) { System.out.println(nodeList.item(i).getFirstChild().getNodeValue()); Users_List.add(nodeList.item(i).getFirstChild().getNodeValue()); } for this expression "reg/user" it return nothing and for "reg/user/Name" or "reg/user/Email" it returns correct result. i have tested expression with online tester there it gives correct result. is there ant problem with my parsing code..?
score: 0
has answer: http://stackoverflow.com/a/22631001
tagged with: xpath
has title: Xpath not giving correct result

http://stackoverflow.com/a/39504606
downvote count: 0
score: 126
type: Answer
upvote count: 126
has body: Add Content-Type: application/json and Accept: application/json
has comment: http://stackoverflow.com/comment/102844997
answers question: http://stackoverflow.com/q/22566433

http://stackoverflow.com/q/22612662
has title: Java Bound Mismatch Error - LinkedList
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22612730
has body: Ok this is the interface I'm using. /* instance of classes that realize this interface can be compared */ public interface Comparable&lt;E&gt; { /* Method to compare this object to the argument object * @param obj - the argument object * @return - returns a negative integer if this object &lt; obj */ int compareTo(E obj); } then the ordered list class. import java.util.*; /* a class to represent an ordered List. the data is stored * in a linked list data field */ public class OrderedList&lt;E extends Comparable&lt;E&gt;&gt; implements Iterable&lt;E&gt; { /* a linked list to contain data */ private LinkedList&lt;E&gt; theList = new LinkedList&lt;E&gt;(); /* Insert Obj into the list preserving the lists order * @param pre - the items in the list ordered * @param post - obj has been inserted into the list such * that the items are still in order */ public void add(E obj) { ListIterator&lt;E&gt; iter = theList.listIterator(); // find the insertion position and insert while(iter.hasNext()) { if(obj.compareTo(iter.next()) &lt; 0) { // Iterator has stepped over the first element that // is greater than the element to be inserted // move the iterator back one iter.previous(); // insert the element iter.add(obj); //exit the loop and return return; } } /* assert - all items were examined and no item is larger than * the element to be inserted * add the new item to the end of the list */ iter.add(obj); } /* returns the element at the specified position */ public E get(int index) { return theList.get(index); } /* returns an iterator to this ordered List */ public Iterator&lt;E&gt; iterator() { return theList.iterator(); } /* returns the size of the list */ public int size() { return theList.size(); } } and the test class where the problems are. import java.util.*; public class TestOrderedList { /* Traverses ordered list and displays each element * displays and error message if an element is out of order * @param testList - an ordered list of integers */ public static void trave…
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/22612773
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22612773
has answer: http://stackoverflow.com/a/22612730

http://stackoverflow.com/q/22493736
answer count: 3
tagged with: javac
upvote count: 10
favorite count: 0
has answer: http://stackoverflow.com/a/25214278
linked to: http://stackoverflow.com/q/17099379
has title: javac: invalid target release: 1.7
has answer: http://stackoverflow.com/a/22494957
type: AnsweredQuestion
downvote count: 0
tagged with: osx-mavericks
tagged with: java
score: 10
has body: Using OS X Mavericks, and after upgrading my JDK, I can no longer compile with ant. I've done the usual googling and the vast majority of answers point to JAVA_HOME not being set. Help me stackoverflow, you're my only hope! Information which may be useful $ tail -n1 /etc/profile export JAVA_HOME=$(/usr/libexec/java_home -v 1.7) $ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home $ which javac /usr/bin/javac $ ls -lah /usr/bin/javac lrwxr-xr-x 1 root wheel 75B 8 Jan 11:23 /usr/bin/javac -&gt; /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac $ ls -lah /System/Library/Frameworks/JavaVM.framework/Versions/ total 80 drwxr-xr-x 13 root wheel 442B 19 Mar 10:10 . drwxr-xr-x 12 root wheel 408B 19 Mar 09:59 .. lrwxr-xr-x 1 root wheel 10B 8 Jan 11:23 1.4 -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B 8 Jan 11:23 1.4.2 -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B 8 Jan 11:23 1.5 -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B 8 Jan 11:23 1.5.0 -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B 8 Jan 11:23 1.6 -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B 8 Jan 11:23 1.6.0 -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B 19 Mar 10:10 1.7 -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B 19 Mar 10:10 1.7.0 -&gt; CurrentJDK drwxr-xr-x 8 root wheel 272B 8 Jan 11:23 A lrwxr-xr-x 1 root wheel 1B 8 Jan 11:23 Current -&gt; A lrwxr-xr-x 1 root wheel 58B 19 Mar 10:10 CurrentJDK -&gt; /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents $ javac -version -source 1.7 -target 1.7 -fork true javac 1.7.0_51 javac: invalid source release: 1.7 Usage: javac &lt;options&gt; &lt;source files&gt;
type: Question
possible better answer: http://stackoverflow.com/a/25214278
tagged with: ant
tagged with: compilation
has comment: http://stackoverflow.com/comment/34221772
has answer: http://stackoverflow.com/a/22525228
accepted answer: http://stackoverflow.com/a/22525228

http://stackoverflow.com/a/22488254
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22488193
has body: -25 mod 2 is -1, so your if() test succeeds: the value is NOT greater than 0. You should be testing for != 0 instead.
type: Answer
answers question: http://stackoverflow.com/q/22488193
downvote count: 0
score: 3

http://stackoverflow.com/a/22496927
score: 1
has comment: http://stackoverflow.com/comment/34228926
has comment: http://stackoverflow.com/comment/34227163
upvote count: 1
has comment: http://stackoverflow.com/comment/34227855
has comment: http://stackoverflow.com/comment/34230403
has comment: http://stackoverflow.com/comment/34326844
has comment: http://stackoverflow.com/comment/34228630
has comment: http://stackoverflow.com/comment/34234887
has comment: http://stackoverflow.com/comment/34232282
downvote count: 0
has body: When submitted from JSP to action class, the list will always be blank unless you have named the elements on JSP like itmList[0].itemNo, itmList[0].purDmys etc. You can assign these names while iterating the list.
has comment: http://stackoverflow.com/comment/34232561
type: Answer
answers question: http://stackoverflow.com/q/22496867

http://stackoverflow.com/comment/34275314
comment on: http://stackoverflow.com/q/22517529
has text: check `ctrl+shift+T` type `CustomPassword` see what you getting?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22489761
has comment: http://stackoverflow.com/comment/34214694
linked to: http://stackoverflow.com/q/3106452
tagged with: session
type: UnansweredQuestion
tagged with: servlets
answer count: 0
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34233482
type: Question
has title: How HTTPSession is maintained in cluster of servers
has body: I am trying to understand how the session details are maintained for a JavaEE based web application that is deployed in a cluster of servers. I am new to clustering concepts so I am not clear on how it actually works. I have gone through this SO post "How do servlets work? Instantiation, session variables and multithreading", where it says that the session details are maintained by the server where my web application is running and client is provided with JSESSIONID. Now suppose if I have a load balancer and my application is deployed to a cluster of servers say 3 servers, now if my first request is handled by Server1 and the Server1 has stored the session details on its RAM, then what happens to my subsequent request? Will load balancer still direct the request to Server1 or will it be handled by Server2/Server3?
tagged with: java
upvote count: 1

http://stackoverflow.com/a/46251749
has body: On Ubuntu with OpenJDK, it installed in /usr/lib/jvm/default-java/jre/lib/ext/jfxrt.jar (technically its a symlink to /usr/share/java/openjfx/jre/lib/ext/jfxrt.jar, but it is probably better to use the default-java link)
score: 6
answers question: http://stackoverflow.com/q/22514310
upvote count: 6
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34270380
type: AnswerComment
comment on: http://stackoverflow.com/a/22521705
type: Comment
has text: `AuxilaryClass` has [*package-private*](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html) access.
score: 1

http://stackoverflow.com/q/22640385
has answer: http://stackoverflow.com/a/22640621
score: 0
has title: How to read or download an entire folder/directory from WEB in java
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: java
has body: I already know how to download a single file, but I want to download an entire folder/directory form a website using java from private static String file_url = "http://umsurvey.comlu.com/admin/question/"; to OutputStream output = new FileOutputStream(Environment.getExternalStorageDirectory()+"/Question/");
has comment: http://stackoverflow.com/comment/34481965
type: Question

http://stackoverflow.com/q/22613520
tagged with: palette
tagged with: bufferedimage
type: AnsweredQuestion
tagged with: java
has body: I need to convert a BufferedImage to a BufferedImage indexed type to extract the indices of the colors data and the 256 color palette. i think that i am doing right the conversion of a BufferedImage to indexed mode and then extracting the color indices with the next code: BufferedImage paletteBufferedImage=new BufferedImage(textureInfoSubFile.getWidth(), textureInfoSubFile.getHeight(),BufferedImage.TYPE_BYTE_INDEXED); paletteBufferedImage.getGraphics().drawImage(originalBufferedImage, 0, 0, null); // puts the image pixeldata into the ByteBuffer byte[] pixels = ((DataBufferByte) paletteBufferedImage.getRaster().getDataBuffer()).getData(); My problem now is that i need to know the ARGB values of each color index( the palette) to put them into an array. i have been reading about ColorModel and ColorSpace but i don´t find some methods to do what i need.
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34433842
answer count: 2
has title: How to convert Bufferedimage to indexed type and then extract the argb color palette
favorite count: 0
tagged with: colors
accepted answer: http://stackoverflow.com/a/22666977
possible better answer: http://stackoverflow.com/a/22644966
tagged with: indices
has answer: http://stackoverflow.com/a/22644966
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22666977

http://stackoverflow.com/a/22581468
score: 0
answers question: http://stackoverflow.com/q/22581407
type: Answer
has body: What is this holidayList.date ? (This is List not an Holiday object) use an iterator and iterate into all the Holidays present in the List and check whether the date matches with inputted date.
has comment: http://stackoverflow.com/comment/34386901
has comment: http://stackoverflow.com/comment/34381899

http://stackoverflow.com/q/22546708
tagged with: jtable
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34317354
has comment: http://stackoverflow.com/comment/34318563
has comment: http://stackoverflow.com/comment/34318298
tagged with: nimbus
has answer: http://stackoverflow.com/a/22548846
type: AnsweredQuestion
tagged with: java
type: Question
has title: Java error after changing Look and Feel to Nimbus
has body: My application was working properly until I have changed look and feel to Nimbus. I have recieved below errors. It says something is wrong with my JTable. I have checked it, but there is nothing wrong with JTable. Edit I used threads to create multiply JPanels parallelly, I think this was causing the error. Once I removed threads it started working normally. But due to removing threads my application takes a bit longer on startup. How can I overcome this situation (using thread and Nimbus Look and feel)? Exception in thread "Thread-3" java.lang.ClassCastException: javax.swing.plaf.InputMapUIResource cannot be cast to java.awt.Font at javax.swing.plaf.nimbus.NimbusStyle.getFontForState(NimbusStyle.java:573) at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:933) at javax.swing.plaf.nimbus.NimbusStyle.installDefaults(NimbusStyle.java:231) at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:916) at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265) at javax.swing.plaf.synth.SynthButtonUI.updateStyle(SynthButtonUI.java:79) at javax.swing.plaf.synth.SynthButtonUI.installDefaults(SynthButtonUI.java:62) at javax.swing.plaf.basic.BasicButtonUI.installUI(BasicButtonUI.java:88) at javax.swing.JComponent.setUI(JComponent.java:664) at javax.swing.AbstractButton.setUI(AbstractButton.java:1807) at javax.swing.JCheckBox.updateUI(JCheckBox.java:228) at javax.swing.AbstractButton.init(AbstractButton.java:2172) at javax.swing.JToggleButton.&lt;init&gt;(JToggleButton.java:176) at javax.swing.JCheckBox.&lt;init&gt;(JCheckBox.java:174) at javax.swing.JCheckBox.&lt;init&gt;(JCheckBox.java:96) at javax.swing.plaf.synth.SynthTableUI$SynthBooleanTableCellRenderer.&lt;init&gt; (SynthTableUI.java:713) at javax.swing.plaf.synth.SynthTableUI.installDefaults(SynthTableUI.java:116) at javax.swing.plaf.basic.BasicTableUI.installUI(BasicTableUI.java:1388) at javax.swing.JComponent.setUI(JComponent.java:664) at javax.swing.JTable.setUI(J…
accepted answer: http://stackoverflow.com/a/22548846

http://stackoverflow.com/q/22511613
has comment: http://stackoverflow.com/comment/34257028
tagged with: swing
tagged with: combobox
has body: The scrollPane table isn't refreshing for every time I selected something from the combo. Initially it has data but after I selected something, the data is removed successfully but new data isn't populating in public void ConsultFrame(String id, String name, String ic){ GenerateMed("dp-000"); // to begin the scrollpane filled with Fever's medicine JButton proc = new JButton("Proceed"); JButton addmed = new JButton(">>"); selected = new JTable(data, columnNames){ @Override public boolean isCellEditable(int row,int column){ switch(column){ case 0: return false; case 1: return false; default: return true; } }}; selectedPane = new JScrollPane(selected); //Dispensary's category combobox related disp = dbDisp.getDispensary(); final JComboBox cBox = new JComboBox(); for(int count=0; count<disp.size(); count++) cBox.addItem(disp.get(count).getDSP_desc()); cBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent event) { for(int count=0; count<disp.size(); count++){ if(cBox.getSelectedItem().equals(disp.get(count).getDSP_desc())){ System.out.println(disp.get(count).getDSP_ID()); GenerateMed(disp.get(count).getDSP_ID()); break; } } } }); JTextArea tArea = new JTextArea(5, 30); JScrollPane desc = new JScrollPane(tArea); tArea.setLineWrap(true); desc.setVerticalScrollBarPolicy ( ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS ); JPanel info = new JPanel(); info.setLayout(new FlowLayout(FlowLayout.LEFT)); info.add(new JLabel(" Patient's ID : " + id + " Patient's Name: " + name + " Patient's IC : " + ic + " Medical Description : ")); info.add(desc); JPanel medSelect = new JPanel(); medSelect.setLayout(new GridLayout(1,2)); medSelect.add(scrollPane); medSelect.add(selectedPane); JPanel medic = new JPanel(); medic.setLayout(new BorderLayout()); medic.add(cBox, BorderLayout.NORTH); medic.add(medSelect, BorderLayout.CENTER); medic.add(proc, BorderLayout.SOUTH); JPanel all = new JPanel(); String timeStamp = new SimpleDateFormat("yyyy/MM/dd HH:mm").forma…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22514624
tagged with: java
has title: JTable aren't refreshing when selecting from Combobox
type: Question
tagged with: defaulttablemodel
tagged with: jtable
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22514624

http://stackoverflow.com/a/22639313
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22639259
answers question: http://stackoverflow.com/q/22639259
downvote count: 0
score: 1
has body: Just use: String s = data.replaceAll("\\s", "");
upvote count: 1

http://stackoverflow.com/a/22618384
type: Answer
has comment: http://stackoverflow.com/comment/79531632
has comment: http://stackoverflow.com/comment/35656036
answers question: http://stackoverflow.com/q/22618323
score: 10
upvote count: 10
has body: On this line hm.get(new Coordinates(x, y - 32)).equalsIgnoreCase("gray")), it is not possible that hm contains newly created Coordinates. When you create new object, for example Coordinates c = new Coordinates(x, y - 32);, in memory is created that object and the variable c holds reference to that memory, not object itself. Because of it, look at this code : Coordinates c1 = new Coordinates(x, y - 32); //c1 holds reference to memory, something like "a8wgge8h" Coordinates c2 = new Coordinates(x, y - 32); //c2 holds also reference to memory, someting like "a8w12238h" if (c1 != c2){ System.out.println("Yes, it is true, c1 is not c2, there are two objects with same properties, but they are not same, like human twins - they look same, but two people actually exists"); } Therefore you cant find anything in hm.get(new Coordinates(x, y - 32)), because it does not look for coordinate which has same x,y, it looks for coordinate with same reference to the memory. And it cannot exists, because you just create new object, java associated it new memory address, something like abnbn147 and then your list/set looks for object with address abnbn147, which cannot be stored there, because you just have just created it. This hm.get(new Coordinates(x, y - 32)) always return null. If you call method on null, it ends with NullPointerException, which happens with calling method equalsIgnoreCase on null object I was talking about.
has comment: http://stackoverflow.com/comment/35655536
downvote count: 0

http://stackoverflow.com/q/22527204
tagged with: netbeans
type: UnansweredQuestion
upvote count: 3
tagged with: java
has body: Consider the following Java method: Paths.get(String first, String... more) It is nice that you have access to the varargs when needed, however Netbeans 8, and earlier versions, insist that you will use at least one varargs element. So assume you have the following: String a = ""; String b = ""; Then you start typing Paths.g, you select the option, and it suddenly pops up with: Paths.get(a, b), while in reality you wanted to type Paths.get(a). Is there any way to tell Netbeans that when it encounters a varargs argument method, that I do not want to use the varargs in autocomplete?
type: Question
score: 3
has answer: http://stackoverflow.com/a/28458068
tagged with: autocomplete
answer count: 1
downvote count: 0
tagged with: variadic-functions
favorite count: 0
tagged with: netbeans-8
has title: How to remove varargs suggested variables in Netbeans 8?

http://stackoverflow.com/q/22528767
has comment: http://stackoverflow.com/comment/50104680
has comment: http://stackoverflow.com/comment/53896238
has body: You'll quickly realize that JDK8 is a lot more strict (by default) when it comes to Javadoc. (link - see last bullet point) If you never generate any Javadoc then of course you'll not experience any problems but things like Maven release process and possibly your CI builds will suddenly fail where they worked just fine with JDK7. Anything that checks the exit value of the Javadoc tool will now fail. JDK8 Javadoc is probably also more verbose in terms of warnings compared to JDK7 but that's not the scope here. We are talking about errors! This question exist to collect proposals on what to do about it. What is the best approach ? Should these errors be fixed once and for all in the source code files? If you have a huge code base this might be a lot of work. What other options exist ? You are also welcome to comment with stories of what now fails that would previously pass. Horror stories of what now fails wsimport tools wsimport tool is a code generator for creating web service consumers. It is included in the JDK. Even if you use the wsimport tool from JDK8 it will nevertheless produce source code that cannot be compiled with the javadoc compiler from JDK8. @author tag I'm opening up source code files 3-4 years old and see this: /** * My very best class * @author John <john.doe@mine.com> */ This now fails because of the < character. Strictly speaking this is justified, but not very forgiving. HTML tables HTML Tables in your Javadoc? Consider this valid HTML: /** * * * * Col1 Col2 Col3 * * */ This now fails with error message no summary or caption for table. One quick fix is to do like this: /** * * * * Col1 Col2 Col3 * * */ but why this has to be a stop-the-world error from Javadoc tool beats me?? Things that now fail for more obvious reasons Invalid links, e.g. {@link notexist} Malformed HTML, e.g. always returns true if ... UPDATE Links: Excellent blog on the subject by Stephen Colebourne.
type: Question
has answer: http://stackoverflow.com/a/22529222
has comment: http://stackoverflow.com/comment/69447194
accepted answer: http://stackoverflow.com/a/34808603
has answer: http://stackoverflow.com/a/46334320
has comment: http://stackoverflow.com/comment/57360681
has comment: http://stackoverflow.com/comment/68440953
has comment: http://stackoverflow.com/comment/34282508
score: 142
linked to: http://stackoverflow.com/q/24495579
downvote count: 0
has comment: http://stackoverflow.com/comment/57360560
upvote count: 142
has title: How to work around the stricter Java 8 Javadoc when using Maven
favorite count: 0
has comment: http://stackoverflow.com/comment/77796395
has answer: http://stackoverflow.com/a/54684795
has answer: http://stackoverflow.com/a/47769700
linked to: http://stackoverflow.com/q/15886209
answer count: 5
has comment: http://stackoverflow.com/comment/34284093
has answer: http://stackoverflow.com/a/34808603
tagged with: maven
has comment: http://stackoverflow.com/comment/34282307
has comment: http://stackoverflow.com/comment/68390797
tagged with: java-8
has comment: http://stackoverflow.com/comment/57360483
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/132795230
linked to: http://stackoverflow.com/q/2290757
tagged with: java
possible better answer: http://stackoverflow.com/a/22529222

http://stackoverflow.com/q/22549175
answer count: 1
has comment: http://stackoverflow.com/comment/34319134
has body: Right now I create all of my swing components in the same class that has my method "main", this class keeps growing and looking more unorganized with each component created. Should I create another class to create the components and pass a the frame by reference? Or should I let my current class keep growing? Is there a best practice or industry standard? Thank you for any input.
tagged with: components
has title: What is the best way to add components to a java application
tagged with: java
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22549477
score: 0
tagged with: swing

http://stackoverflow.com/comment/94753351
score: 0
type: AnswerComment
type: Comment
has text: Works like a charm. BTW, if you want to use 512-byte digest, just change "PBKDF2WithHmacSHA256" to "PBKDF2WithHmacSHA512".
comment on: http://stackoverflow.com/a/27928435

http://stackoverflow.com/comment/34369869
type: Comment
type: QuestionComment
has text: Where is the code? What processor are you using (nof cores)? Without this information we will not be able to help you.
comment on: http://stackoverflow.com/q/22578290
score: 0

http://stackoverflow.com/q/22534200
score: 1
tagged with: java
upvote count: 1
type: Question
has title: How set `activeWhen/enabledWhen` command in eclipse RCP application according to project nature
tagged with: eclipse-rcp
downvote count: 0
answer count: 1
favorite count: 0
has body: I have eclipse RCP with Project nature RCPProjectNature_1 and RCPProjectNature_2. I want to make some toolbar menu active only if project with nature RCPProjectNature_1 is open and once the project with RCPProjectNature_1 is closed toolbar menu should get disabled. For Example I have eclipse projects RCPProject1 of project nature type RCPProjectNature_1 RCPProject2 of project nature type RCPProjectNature_2 The application has toolbar menu which is valid and should be enabled only if any project with RCPProjectNature_1 is open. Or else it should be grayed out How would I write expression in plugin.xml for the same?
type: UnansweredQuestion
tagged with: swt
tagged with: jface
has answer: http://stackoverflow.com/a/22534838

http://stackoverflow.com/a/22552320
score: 1
type: Answer
upvote count: 1
has body: You can try this one also: Label label1=new Label(); label1.getElement().setInnerHTML("&amp;copy; " + "2014" + " MyCorp");
answers question: http://stackoverflow.com/q/22552131
downvote count: 0

http://stackoverflow.com/comment/34438013
comment on: http://stackoverflow.com/q/22616123
has text: Just use Maps and Lists. Jackson is something of an abomination in how it pretty much forces you to create elaborate "POJOs" to represent data that is clearly and efficiently represented as Maps and Lists.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34249979
type: Comment
comment on: http://stackoverflow.com/a/22493121
score: 0
type: AnswerComment
has text: You are not modifying the original jar, you are building on top of it leaving everything intact and untouched. In your implementation you will be calling your custom classes instead of the original ones that inherit all original functionality while having access to any additions you make or enhance. Perhaps you need to better clarify your restrictions, involved jars or apps and where/how you use them.

http://stackoverflow.com/comment/34428246
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22605979
has text: And in your code, you should add `Scanner scanner = new Scanner(System.in);` out of your loop
type: AnswerComment

http://stackoverflow.com/comment/34322935
type: QuestionComment
has text: It si better to use List<computer>=new ArrayList<computer>
comment on: http://stackoverflow.com/q/22551333
score: 0
type: Comment

http://stackoverflow.com/comment/34277537
score: 0
comment on: http://stackoverflow.com/q/22525857
type: Comment
type: QuestionComment
has text: @k3v1n4ud3 raises a good point; you should consider your application when thinking about using third-party libraries. That said, Joda is kind of the de facto alternative to Java's built in date/time API when you need more than what the JDK provides; and conversions to/from `Calendar` are generally straightforward via Joda object constructors and/or intermediate conversion to epoch time integers.

http://stackoverflow.com/comment/34414674
type: Comment
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
score: 3
comment on: http://stackoverflow.com/q/22603095

http://stackoverflow.com/comment/34419989
type: QuestionComment
comment on: http://stackoverflow.com/q/22574607
score: 0
type: Comment
has text: I have tried that, I appreciate your code though. I wanted to fix my code 'cause I have the JoinVid part. One thing I'd like to ask is why does your code take so long to split?

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/22543708
type: Tag

http://stackoverflow.com/comment/34283556
type: Comment
type: QuestionComment
has text: You need not restart PC to overcome this. Just kill the server. if 'adb kill-server' is also not working, kill the process (adb.exe) through task manager. There you go!!
score: 0
comment on: http://stackoverflow.com/q/22529286

http://stackoverflow.com/comment/34408159
type: Comment
type: QuestionComment
has text: Good practice is to localize your variable as much as possible. If I were you, I would declare it only in else part.
comment on: http://stackoverflow.com/q/22599240
score: 0

http://stackoverflow.com/comment/34427198
type: QuestionComment
has text: And how do you treat duplicates in the list?
comment on: http://stackoverflow.com/q/22610263
score: 0
type: Comment

http://stackoverflow.com/q/22604547
type: Question
has body: i use the following Code to get an InputDialog: String c = JOptionPane.showInputDialog("Select number",JOptionPane.OK_OPTION); I also want that the User only uses IntegerValues between 0 and 100. I handle this by the following code: while(notAllowed){ try{ int t =Integer.parseInt(c); if(t==JOptionPane.CANCEL_OPTION) { notAllowed=false; cancel=true; } if(t&lt;=100 &amp;&amp; t&gt;0 &amp;&amp;notAllowed) notAllowed=false; } catch( Exception err) {} if(notAllowed) c = JOptionPane.showInputDialog("Only Numbers between 1 and 100 are allowed"); } Now if the uses types the number 2 its like clicking the Cancel Button because the Value of JOptionPane.CANCEL_OPTION is also 2. So how can i find out if Cancel is clicked or the input Value is 2.
score: 0
answer count: 1
has title: JOptionPane Input Dialog how to decide if the value is 2 or JOptionPane.CANCEL_OPTION
tagged with: parsing
tagged with: joptionpane
has answer: http://stackoverflow.com/a/22604722
tagged with: input
tagged with: swing
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22604722

http://stackoverflow.com/a/22639250
has body: Your Lucene syntax is correct. If you provide the query as a parameter, you'll have to do it without the "'" characters though. So use expr = "name:" + expr + "~"; instead of expr = "'name:" + expr + "~'"; You could also provide a fuzziness factor as follows: expr = "name:" + expr + "~0.8";
upvote count: 2
has comment: http://stackoverflow.com/comment/34483652
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22637914
downvote count: 0
has comment: http://stackoverflow.com/comment/34507354

http://stackoverflow.com/comment/34440954
comment on: http://stackoverflow.com/q/22617023
type: Comment
type: QuestionComment
has text: why do u call mImageView.invalidate();?
score: 0

http://stackoverflow.com/q/22608536
has comment: http://stackoverflow.com/comment/34424039
has title: Is it possible to lose precision while calulating 1/val twice?
has comment: http://stackoverflow.com/comment/34424044
favorite count: 0
has comment: http://stackoverflow.com/comment/34424027
tagged with: double
has answer: http://stackoverflow.com/a/22609019
has comment: http://stackoverflow.com/comment/34424183
has answer: http://stackoverflow.com/a/22608640
has comment: http://stackoverflow.com/comment/34423941
has comment: http://stackoverflow.com/comment/34423989
has comment: http://stackoverflow.com/comment/34424475
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34423966
tagged with: java
score: -1
has body: If I have a double d; if I do: d = 1/d; d = 1/d; Is this possible that I lose precision? In what case for example?
type: Question
has answer: http://stackoverflow.com/a/22608723
accepted answer: http://stackoverflow.com/a/22608723
possible better answer: http://stackoverflow.com/a/22609019
has comment: http://stackoverflow.com/comment/34424096
has comment: http://stackoverflow.com/comment/34424151
downvote count: 2
answer count: 3
upvote count: 1

sparql
tags question: http://stackoverflow.com/q/22542348
type: Tag
tag name: sparql
tags question: http://stackoverflow.com/q/22536775
tags question: http://stackoverflow.com/q/22512903

http://stackoverflow.com/comment/34412892
type: Comment
has text: Sure. It's right! Because it's running when use grails command. But I find out the solution, that I need to cope database driver library to lib folder of web server ex: tomcat. Thanks
comment on: http://stackoverflow.com/a/22556890
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34231924
type: Comment
type: QuestionComment
score: 0
has text: I'm kinda new to eclipse. I just downloaded it and began learning java programming. I just set a breakpoint and click on the debug button. After I click on the resume, it shows the error I mentioned in the debug window and doesn't let me resume again or see the values of the variables. The resume button etc become grey and can't be clicked anymore. I never configured it to use the so-called remote debugger. I just click on the debug button.
comment on: http://stackoverflow.com/q/22499763

http://stackoverflow.com/q/22620323
has answer: http://stackoverflow.com/a/22622144
has comment: http://stackoverflow.com/comment/34448506
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34448914
tagged with: spring
tagged with: spring-mvc
score: 2
has body: In a Spring MVC application using Hibernate and jpa, the following jpa query is throwing a no result error, even when I have confirmed that there is a result in the DrugWords table and a set of rxcui values for the chosen DrugWord in the rxnconsojunction table: @SuppressWarnings("unchecked") public DrugWord findDrugWord(String wrd) { System.out.println("..... wrd is: "+wrd);//prints a value with valid records in database Query query = this.em.createQuery("SELECT word FROM DrugWord word left join fetch word.concepts WHERE word.name =:wrd"); query.setParameter("wrd", wrd); // try{ return (DrugWord) query.getSingleResult(); // } // catch(Exception e){} // return new DrugWord(); } Here is the complete stack trace: Hibernate: select drugword0_.name as name1_12_0_, drugconcep2_.rxcui as rxcui1_10_1_, concepts1_.word as word1_12_0__, concepts1_.rxcui as rxcui2_13_0__ from drugwords drugword0_ left outer join drugwordsconsoJunction concepts1_ on drugword0_.name=concepts1_.word left outer join drugconcepts drugconcep2_ on concepts1_.rxcui=drugconcep2_.rxcui where drugword0_.name=? WARN warn - Handler execution resulted in exception org.springframework.dao.EmptyResultDataAccessException: No entity found for query; nested exception is javax.persistence.NoResultException: No entity found for query at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:304) ~[spring-orm-3.2.5.RELEASE.jar:3.2.5.RELEASE] at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:108) ~[spring-orm-3.2.5.RELEASE.jar:3.2.5.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:403) ~[spring-orm-3.2.5.RELEASE.jar:3.2.5.RELEASE] at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58) ~[spring-tx-3.2.5.RELEAS…
has comment: http://stackoverflow.com/comment/34452202
has comment: http://stackoverflow.com/comment/34447246
has comment: http://stackoverflow.com/comment/34446536
upvote count: 2
tagged with: java
tagged with: hibernate
has title: Query not returning a result though data is in database
has comment: http://stackoverflow.com/comment/34453472
has comment: http://stackoverflow.com/comment/34446296
type: Question
has comment: http://stackoverflow.com/comment/34447046
has comment: http://stackoverflow.com/comment/34448129
linked to: http://stackoverflow.com/q/2002993
has comment: http://stackoverflow.com/comment/34446449
has comment: http://stackoverflow.com/comment/34446336
has comment: http://stackoverflow.com/comment/34449125
has comment: http://stackoverflow.com/comment/34448290
answer count: 1
has comment: http://stackoverflow.com/comment/34446368
tagged with: jpa
has comment: http://stackoverflow.com/comment/34446091
has comment: http://stackoverflow.com/comment/34446684
downvote count: 0
has comment: http://stackoverflow.com/comment/34448219
has comment: http://stackoverflow.com/comment/34446901
linked to: http://stackoverflow.com/q/8138458
favorite count: 0

http://stackoverflow.com/q/22600528
tagged with: button
has answer: http://stackoverflow.com/a/22600862
tagged with: http://stackoverflow.com/tag/xml
tagged with: android
has title: Android studio- Adding style to buttons
tagged with: styles
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22600862
type: Question
has body: I want to add a shadow and have rounded edges on my button, like box-shadow and border radius in CSS how can I do this in XML? XML code: &lt;Button android:id="@+id/dummy_button" style="?metaButtonBarButtonStyle" android:layout_width="198dp" android:layout_height="69dp" android:layout_weight="1" android:text="@string/dummy_button" android:fontFamily="trebuchet ms" android:clickable="true" android:onClick="printStarter" android:background="#8c96ff" android:layout_gravity="center_horizontal|bottom" /&gt;
answer count: 2
linked to: http://stackoverflow.com/q/15333529
possible better answer: http://stackoverflow.com/a/22600633
score: 0
has answer: http://stackoverflow.com/a/22600633

http://stackoverflow.com/q/22602113
linked to: http://stackoverflow.com/q/454908
tagged with: java
has answer: http://stackoverflow.com/a/22602242
has comment: http://stackoverflow.com/comment/34413038
type: Question
answer count: 3
downvote count: 0
tagged with: string
favorite count: 0
has title: How to Split string in java using "\n"
has comment: http://stackoverflow.com/comment/34413221
has body: I am taking a command line input string like this: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); I want to split this string which is: String line = "int t; //variable t t-&gt;a = 0; //t-&gt;a does something return 0;" like this: String[] arr = line.split("\n"); arr[0] = "int t; //variable t"; arr[1] = "t-&gt;a=0; //t-&gt;a does something"; arr[2] = "return 0"; but when i run my java program that split function only returns this: arr[0] = "int t; //variable t"; it didn't returns other two strings that i mentioned above,why this is happening please explain.
has comment: http://stackoverflow.com/comment/34413133
has comment: http://stackoverflow.com/comment/34413191
has comment: http://stackoverflow.com/comment/34413118
has answer: http://stackoverflow.com/a/22602196
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/34413040
upvote count: 1
has answer: http://stackoverflow.com/a/22602229
has comment: http://stackoverflow.com/comment/34413041
has comment: http://stackoverflow.com/comment/34413206
has comment: http://stackoverflow.com/comment/34413072

http://stackoverflow.com/q/22639122
type: Question
accepted answer: http://stackoverflow.com/a/22646776
possible better answer: http://stackoverflow.com/a/29035020
type: AnsweredQuestion
has title: WildFly 8 on Eclipse - Necessary install all JBoss tools plugins?
has answer: http://stackoverflow.com/a/29035020
upvote count: 5
tagged with: java
tagged with: eclipse
answer count: 2
score: 5
downvote count: 0
favorite count: 0
has body: I have recently moved to JDK 8 and want to start developing applications and have a server, wildfly. In NetBeans you just have to import the WildFly plugin, but in eclipse you have to import all JBoss Tools plugins. You need to install ~ 450MB (JBoss Tools) only for use WildFly 8? WildFly 8 has depends on all these plugins? Greetings.
has answer: http://stackoverflow.com/a/22646776
tagged with: wildfly

http://stackoverflow.com/q/22500753
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am trying to fetch data from db using Json but not getting my mistake.After clicking on the "Show Table" button only the Alert appears and No Table is displayed: MyJsp.jsp AJAX Retrieve Data from Database in Servlet and JSP using JSONArray ID Name Salary Here i am getting the "alert as hhh" that means that it is executing without any error. Servlet: 'EmpServlet' contains protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ArrayList<Employee> al=new ArrayList<Employee>(); EmployeeDetails obj=new EmployeeDetails(); al=obj.getDetails(); System.out.println("-----------hiii-----"); Gson gson=new Gson(); JsonElement element=gson.toJsonTree(al,new TypeToken<List<Employee>>() {}.getType()); JsonArray jsonArray = element.getAsJsonArray(); response.setContentType("application/json"); response.getWriter().print(jsonArray); } I am able to see "hii" on console and values are fetched from db.Please help !! Also,please explain me meaning of below code : $("#emptable").find("tr:gt(0)").remove(); AND rowNew.children().eq(0).text(value['eid']); rowNew.children().eq(1).text(value['ename']); rowNew.children().eq(2).text(value['esal']); Is this "eid" the same as the pojo class of Employee where i have decleared : String eid; String ename; String esal; public Employee(String eid, String ename, String esal) { super(); this.eid = eid; this.ename = ename; this.esal = esal; } public String getEid() { return eid; } public String getEname() { return ename; } public String getEsal() { return esal; }
answer count: 1
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/22500994
score: 0
has title: Not able to update table on jsp using Json
type: UnansweredQuestion

http://stackoverflow.com/comment/34312309
type: Comment
comment on: http://stackoverflow.com/q/22545083
score: 0
type: QuestionComment
has text: The problem is mate, I have no idea how to do that. How do i save it back? I know it's a hassle to explain, but I'm in terrible need of help haha.

http://stackoverflow.com/q/22552270
has title: How to take a screenshot with Selenium WebDriver
downvote count: 1
has body: I am currently working on Selenium WebDriver, Java and the TestNG framework. The code I had written in Java. If my Java code is in Boolean, how I can take a screenshot? Example: public boolean test() throws Exception { // Some implementation } I tried this step, but it is showing an error: WebDriver driver = new FirefoxDriver(); driver.get("http://www.google.com/"); File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); // Now you can do whatever you need to do with it, for example copy somewhere FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png")); The error is showing in this line for the copyFile as The method copyFile(File, File) is undefined for the type FileUtils: FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png"));
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/114408290
tagged with: java
has answer: http://stackoverflow.com/a/22561972
has answer: http://stackoverflow.com/a/22552491
type: Question
has answer: http://stackoverflow.com/a/60669265
has comment: http://stackoverflow.com/comment/34323771
answer count: 7
linked to: http://stackoverflow.com/q/3422262
score: 1
has comment: http://stackoverflow.com/comment/114408116
favorite count: 0
has comment: http://stackoverflow.com/comment/34329758
has answer: http://stackoverflow.com/a/29085067
duplicate of: http://stackoverflow.com/q/3422262
has answer: http://stackoverflow.com/a/57968618
has answer: http://stackoverflow.com/a/49466691
accepted answer: http://stackoverflow.com/a/22552491
tagged with: selenium-webdriver
possible better answer: http://stackoverflow.com/a/22552667
upvote count: 2
has answer: http://stackoverflow.com/a/22552667
tagged with: selenium

http://stackoverflow.com/q/22498476
upvote count: 1
has body: I have two JSF pages search.jsf and details.jsf . In the search.jsf I have an ADF search form. I just drag and drop the View Criteria as ADF Query Panel with Table. The result of user search will be shown in an ADF table. One of the column is a link that will direct the user to the details.jsf to show the details of the selected row. Every things works fine for the first time in the search.jsf . Problem is when the user go back from details.jsf to search.jsf , The Search form is not working and only showing the previous selected row and after pressing default search button multiple times this error message is coming: Definition name 1 of type Attribute is invalid. I search in the internet. Some have similar problem says that there is problem in the attributes naming. I Checked nothing wrong, I even create new view object and still facing the same error. Also, I checked the page definition, DataBindings and DataControl files, no problems there. I am using Jdeveloper 11.1.2.3 with ADF Technology
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-adf
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22588406
tagged with: oracle11g
type: Question
has title: ADF Query Panel with Table is not working
has comment: http://stackoverflow.com/comment/34235849
tagged with: search

http://stackoverflow.com/comment/34358858
type: Comment
score: 1
has text: I'm glad to have helped, but please note that as Matt pointed out, `instanceof` is a kind of a last resort. Usually there's a more elegant way of approaching the "problem" such as generics, abstractions or other OOP concepts
comment on: http://stackoverflow.com/a/22571730
type: AnswerComment

http://stackoverflow.com/comment/34311900
type: Comment
type: QuestionComment
has text: what is the datatype of the 1st and last column?
comment on: http://stackoverflow.com/q/22545125
score: 0

http://stackoverflow.com/comment/34401522
has text: @user3109490 You can force the loading of the `PrintWriter` class by instantiating it in code that runs before the shutdown hook. But instead of this trickery I'd probably just switch to a different solution, like [OneJar](https://code.google.com/p/onejar-maven-plugin/).
type: Comment
comment on: http://stackoverflow.com/a/22583115
score: 0
type: AnswerComment

http://stackoverflow.com/q/22608482
tagged with: spring-mvc
score: 1
tagged with: java
has title: database connection to different database in Spring
upvote count: 1
has body: I have three environments i.e. DEV, TEST and PROD. so three databases I want to update data from any environment to any enviroment only in a particular table. e.g. suppose I want to update TABLE1 data in PROD database, I have to select the enviroment from a drop down and click "save" in DEV or TEST. To implement it I need new datasource object and then I need to fire a query to update/insert the data in that perticular enviroment. Here I have two ways to do it: 1. Explicity fetch my database.properties and get all the configurations and create datasource and fire the query using simple JDBC connection. 2. Use Spring framework, configure it's application context and get it from there and run the configured query. My application is in Spring2 and for database mapping, i am using iBatis. I want to know the best way to implement it and tutorial which can help me in implementing it. I searched for it but got confused.
type: Question
has answer: http://stackoverflow.com/a/22609049
tagged with: database
downvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/14330668
tagged with: ibatis
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/22600556
has comment: http://stackoverflow.com/comment/34483516
has comment: http://stackoverflow.com/comment/34410790
has comment: http://stackoverflow.com/comment/34410848
has comment: http://stackoverflow.com/comment/34410512
has comment: http://stackoverflow.com/comment/34410724
score: 0
answers question: http://stackoverflow.com/q/22599968
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22599968
has body: Your problem is here: new DownloadFile().execute(); new ReadFile().execute(); As these are Asynchronous Tasks, they're running at the same time, and ReadFile is attempting to open your image file before DownloadFile has finished. You merely need to move the new ReadFile().execute(); to the onPostExecute() method of DownloadFile. Then also add the following to ReadFile, to get the ImageView to refresh: @Override protected void onPostExecute(Drawable nada) { fileImageView.invalidate(); } I tested to make sure that's all that was needed, and got a picture of Putin with a dog.
type: Answer
has comment: http://stackoverflow.com/comment/34410763

http://stackoverflow.com/q/22645836
answer count: 2
has title: JAX-RS: map method entity based on method annotation
tagged with: jax-rs
possible better answer: http://stackoverflow.com/a/22646027
has body: I am using JAX-RS 2.0 with Jersey 2.6. I was wondering if it was possible to have something like this: @GET @Path("/get/{id}") @MapTo(type = MyObjectDTO.class) public MyObject getMyObject(@PathParam("id") String id){ MyObject o = ... return o; } In the method above I am returning an instance of MyObject. However, I have defined the MapTo annotation to indicate that I want to map this object to MyObjectDTO. The way I was thinking this could work is to process the response early in a ContainerResponseFilter, detect the annotation MapTo and, assuming no error occurred, replace the entity in the response with an instance of MyObjectDTO created appropriately from the existing entity (of type MyObject). However, I couldn't find a way to get the Method in the resource that was just called after the request came in, i.e., the getMyObject method, so that I can scan for the MapTo annotation. Is there a way to achieve this in a JAX-RS-y kind of way?
has answer: http://stackoverflow.com/a/22646027
tagged with: rest
has answer: http://stackoverflow.com/a/22669827
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22669827
score: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/20946815
tagged with: jersey

http://stackoverflow.com/q/22579016
tagged with: netbeans6.8
score: 0
has comment: http://stackoverflow.com/comment/34423450
has comment: http://stackoverflow.com/comment/34380834
answer count: 0
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/34415056
has comment: http://stackoverflow.com/comment/34413057
linked to: http://stackoverflow.com/q/21374006
tagged with: java
has body: How can we watermark dynamically created pdf's in google app engine using Java/Netbeans? GAE does not support FileOutputStream. I tried PdfStamper but it doesn't support FileOutputStream. servlet code is below protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, Exception { String fileName="abc.pdf"; response.setContentType("application/pdf"); response.setHeader("Content-Disposition","inline;filename=\"" + fileName + "\""); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, response.getOutputStream()); document.open(); try { Paragraph title1 = new Paragraph("Chapter 1", FontFactory.getFont(FontFactory.COURIER_OBLIQUE, 18, Font.BOLDITALIC, new CMYKColor(0, 255, 255,17))); document.add(title1); document.add(new Paragraph("Hi Namita, welcome to pdf generation")); document.add(new Paragraph("Here we are creating pdf of records")); document.add(new Paragraph("Please save records")); } catch (Exception e) { e.printStackTrace(); } document.close(); }
has title: Watermarking dynamically created pdf's in google app engine
type: Question

http://stackoverflow.com/q/22491650
answer count: 1
has title: Encoder and canonicalize in ESAPI
favorite count: 0
tagged with: esapi
upvote count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22491737
tagged with: java
accepted answer: http://stackoverflow.com/a/22491737
type: Question
has body: I understand what ESAPI is used for, but I see these two lines repeated in a lot of ESAPI examples. Can someone please explain what exactly this does? ESAPI.encoder().canonicalize(inputUrl,false,false);
score: 4

http://stackoverflow.com/a/22544696
has comment: http://stackoverflow.com/comment/34315931
has comment: http://stackoverflow.com/comment/34311919
score: 0
answers question: http://stackoverflow.com/q/22542592
type: Answer
has body: You have defined an abstract entity that you call "Location", which can be a continent, a country, a city or a POI. The simplest way to model this is to create an interface Location, and 4 classes that implement this interface: Continent, Country, City and PointOfInterest. For the fields you mention, you should think to which of these class(es) they apply. Population and area (could) apply to Continent, Country and City, so you could add them to all three. But to avoid duplication, you could introduce an abstract super class for these 3 (e.g. Area), and put these fields there. But then, this makes Continent, Country and City empty; they don't have any fields themselves. This means they are identical, and should not be implemented in three separate classes. You should come up with more properties for each of the classes to distinguish themselves. The PointOfInterest is different from Continent, Country and City, as it typically won't have the properties you mention. It is sufficient to only implement the Location interface. Again, you should come up with properties to make it useful.
has comment: http://stackoverflow.com/comment/34313620

http://stackoverflow.com/a/22595517
upvote count: 4
has comment: http://stackoverflow.com/comment/34419244
answers question: http://stackoverflow.com/q/22595306
downvote count: 0
has comment: http://stackoverflow.com/comment/34417219
has comment: http://stackoverflow.com/comment/34415029
has comment: http://stackoverflow.com/comment/34415249
type: Answer
has comment: http://stackoverflow.com/comment/34407951
score: 4
has body: JFrame isn't focusable for KeyEvents, then by default never to react to KeyEvents setVisible(true); should be last code line, after all JComponents are added to JFrame, for why reason is there public void actionPerformed( ActionEvent e ), must generating excpetion form compilier create a JFrame as local variable put JPanel into JFrame override getPreferredSize for JPanel, instesad of setSize for JFrame then call pack() and setVisble(true) put images to the Java package put Images to JLabel set NullLayout to JPanel (otherwise animations isn't possible) add KeyBindings to JPanel, override desired/required KeyEvents there is another way by using Custom painting, by override paintComponent for JPanel, for KeyEvents stays here KeyBindings as better listener in compare with KeyListener

http://stackoverflow.com/comment/34255115
type: Comment
type: QuestionComment
has text: Instead of posting all of your code or none of your code, post an [MCVE](http://stackoverflow.com/help/mcve) of your code.
comment on: http://stackoverflow.com/q/22513447
score: 3

http://stackoverflow.com/comment/34491347
score: 0
has text: The argument passed to my static methods (in static class, say A) is a reference to the calling class instance (say B) and the static methods of A use this reference to get information from B and perform operations in B.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22645621

http://stackoverflow.com/comment/34231073
comment on: http://stackoverflow.com/q/22499716
has text: Please give more information we cant help you then you say." i have no idea what i am doing pls help"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22584954
upvote count: 2
has comment: http://stackoverflow.com/comment/34382984
score: 2
has body: You might want to read remarks to SetWindowsHookEx documentation. Specifically it says that the thread that installed a global hook should continue to process Windows messages in order to allow both 32-bit and 64-bit applications to run the hook code in the context of the hooking application. So, I suggest you create a separate thread from DllMain. The thread will install a hook and then run into GetMessage/ProcessMessage loop: http://pastebin.com/JmMvMX78 #include <windows.h> #include <stdio.h> HHOOK MouseHook = {0}; HHOOK KeyboardHook = {0}; LRESULT WINAPI MouseHookProc(int Code, WPARAM wParam, LPARAM lParam) { if (Code == HC_ACTION) { printf("Mouse\n"); } return CallNextHookEx(MouseHook, Code, wParam, lParam); } LRESULT WINAPI KeyboardHookProc(int Code, WPARAM wParam, LPARAM lParam) { if (Code == HC_ACTION) { printf("Keyboard\n"); } return CallNextHookEx(KeyboardHook, Code, wParam, lParam); } DWORD WINAPI ThreadProc(LPVOID param) { HINSTANCE hInstance = (HINSTANCE)param; MouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProc, hInstance, 0); KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProc, hInstance, 0); MSG message; while (GetMessage(&message, (HWND)-1, 0, 0) > 0) { TranslateMessage(&message); DispatchMessage(&message); } UnhookWindowsHookEx(KeyboardHook); UnhookWindowsHookEx(MouseHook); return 0; } extern "C" __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_ATTACH) { CloseHandle(CreateThread(NULL, 0, ThreadProc, hinstDLL, 0, NULL)); } return TRUE; }
accepted answer of: http://stackoverflow.com/q/22583426
answers question: http://stackoverflow.com/q/22583426
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/22579100
has body: I'm using Bison with %define parse.error verbose option to provide more informative error messages. Bison generates parser in Java language. Currently parser prints messages such as syntax error, unexpected IDENTIFIER, expecting RPAREN or COMMA I wanted to use %printer declarations to replace default token names, but I have found in bison docs that they are not supported in Java: Java parsers do not support %printer, as toString() can be used to print the semantic values. This however may change (in a backwards-compatible way) in future versions of Bison. Each token has declared sematic value's type, e.g. %token &lt;Symbol&gt; IDENTIFIER where Symbol has custom toString() method. But still I do not know how to tell parser to call toSting() method instead of printing default token's name. Do you have any suggestions? Thanks in advance! Grzegorz
has title: Printer declaration in Java
accepted answer: http://stackoverflow.com/a/22581296
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22581296
score: 0
tagged with: bison

http://stackoverflow.com/q/22513006
accepted answer: http://stackoverflow.com/a/22604548
score: 0
answer count: 1
has title: Stanford nlp java
has answer: http://stackoverflow.com/a/22604548
tagged with: nlp
type: AnsweredQuestion
tagged with: java
type: Question
has body: How can I extract these labels from a Tree? http://s9.postimg.org/uvbjudgi7/Immagine.png Should I extract the Syntactic Categories for each token, could you help me? I tried with: Tree tree = sentence.get(TreeAnnotation.class); tree.pennPrint(); for(int i = 0; i &lt; tree.children().length; i++) { for(Tree r : tree.children()[i].localTrees()){ System.out.println(r.nodeString()); } } but I do not know how to extract the Syntactic Categories of a token!
tagged with: stanford-nlp

http://stackoverflow.com/comment/34448976
type: Comment
comment on: http://stackoverflow.com/a/22621494
score: 0
type: AnswerComment
has text: I am reading tutorials but user interface is not real problem in my case. I need to get the values he selected on each jPanel I added.

http://stackoverflow.com/q/22592710
has title: IntelliJ Idea marks red web.xml that works well
has comment: http://stackoverflow.com/comment/34396693
tagged with: glassfish
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34396347
has body: The problem is that section mapping my footer.jsp and header.jsp is red in IntelliJ Idea, though everything works well. also I understand that I should have for both mentioned files extension *.jspf, not jsp, but I have no idea how to make them in Idea. My web.xml is below, the strings between < jsp-config > and < /jsp-config > are all red and commented: "element is not allowed here" <?xml version="1.0" encoding="UTF-8"?> 30 header and footer settings /WEB-INF/views/* /index.jsp /WEB-INF/jspf/header.jsp /WEB-INF/jspf/footer.jsp
score: 1
has answer: http://stackoverflow.com/a/36677967
favorite count: 0
has comment: http://stackoverflow.com/comment/34396162
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/13186448
type: Question
has answer: http://stackoverflow.com/a/22766352
has comment: http://stackoverflow.com/comment/34396257
has answer: http://stackoverflow.com/a/22593342
linked to: http://stackoverflow.com/q/7619480
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/29842052
has comment: http://stackoverflow.com/comment/83051030
upvote count: 4
has answer: http://stackoverflow.com/a/29842052
linked to: http://stackoverflow.com/q/2081005
accepted answer: http://stackoverflow.com/a/22766352
answer count: 4
tagged with: intellij-idea

smartcard
tags question: http://stackoverflow.com/q/22619595
type: Tag
tag name: smartcard
tags question: http://stackoverflow.com/q/22612062

http://stackoverflow.com/q/22630649
has comment: http://stackoverflow.com/comment/34463821
has answer: http://stackoverflow.com/a/22630898
has answer: http://stackoverflow.com/a/22630799
type: Question
has answer: http://stackoverflow.com/a/22630867
has comment: http://stackoverflow.com/comment/34463705
has title: Why do they call it pass by value in Java?
has answer: http://stackoverflow.com/a/22630911
accepted answer: http://stackoverflow.com/a/22630911
has answer: http://stackoverflow.com/a/22630827
upvote count: 4
has comment: http://stackoverflow.com/comment/34463860
has answer: http://stackoverflow.com/a/22630805
answer count: 10
has answer: http://stackoverflow.com/a/22630843
linked to: http://stackoverflow.com/q/22605760
has answer: http://stackoverflow.com/a/22630870
favorite count: 0
possible better answer: http://stackoverflow.com/a/22630799
duplicate of: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/34463707
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/22630878
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34463732
score: 1
tagged with: java
has body: Ok, so I am a relatively new programmer. I have read over and over about passing variables. From what I have read here is what I've come to understand: In Java, when you pass a variable to a method (be it primitive or Object) you are ALWAYS passing by value. But what you are REALLY doing is passing a copy of the reference to an object or variable in memory. So why do they call it pass by value? It seems to me you are passing by reference. Also, in C when you pass a pointer to a function, aren't you passing the address of a variable in memory? Yet it is called pass by value. What am I overlooking? Can someone please explain and clarify why I this? I know how to pass variables and such and I have read several SO posts on this but I am not fully satisfied yet. Consider an example: static void setNameStatic(Dog d, String name) { d.name = name; } public static void main (String args[]) { Dog d = new Dog("dog1"); System.out.println( d.getName() ); setNameStatic( d, "dog2" ); System.out.println( d.getName() ); } Won't this output: dog1 and dog2. So aren't you going to where the reference is referring to and changing data around? What exactly does the value have to do with here? Any helpful comments are appreciated. And yes, I know it is pass by value, but why isn't it called "pass by sending copy of reference" lol? Update: Thanks to everyone that gave a helpful answer. I know this was marked duplicate, and sorry about that. I am satisfied with the answers now.
downvote count: 3
has comment: http://stackoverflow.com/comment/34463952
has answer: http://stackoverflow.com/a/22631107

http://stackoverflow.com/comment/34302697
type: QuestionComment
has text: Have you looked at the [examples](http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html)?
score: 0
comment on: http://stackoverflow.com/q/22540108
type: Comment

http://stackoverflow.com/comment/34486925
type: Comment
has text: The important part here (should be emphasized in bold of something) is `the next number is given by the previous number`
comment on: http://stackoverflow.com/a/22643276
type: AnswerComment
score: 0

http://stackoverflow.com/a/47164056
has body: The TBGROUP table doesn't have a column called OWNEREMAIL
answers question: http://stackoverflow.com/q/22592689
score: 0
type: Answer

http://stackoverflow.com/comment/34319981
type: Comment
has text: i edited post to clarify
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22549690

http://stackoverflow.com/q/22534025
has comment: http://stackoverflow.com/comment/34292305
has comment: http://stackoverflow.com/comment/34291945
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/22534514
has comment: http://stackoverflow.com/comment/34292010
possible better answer: http://stackoverflow.com/a/22534291
accepted answer: http://stackoverflow.com/a/22534781
score: -1
has answer: http://stackoverflow.com/a/22534291
favorite count: 0
has title: Unable to work around thrown exception?
has comment: http://stackoverflow.com/comment/34292001
has body: This is the code that defines the needed variables public void ProcessInput(View v) { Button btn = (Button) v; String text = btn.getText().toString(); String currentInput = inputText.getText().toString(); int currentInputLen = currentInput.length(); String evalResult = null; double userInputValue = Double.NaN; This is the code i am unable to work around else if (btn.getText().equals("sqrt")) { double LeftVal = Double.parseDouble(currentInput); double result = 0; if (currentInputLen &gt; 0 &amp;&amp; currentInput != "0") { result = Math.sqrt(LeftVal); } inputText.setText(result + ""); else if (btn.getText().equals("sqr")) { if(currentInput.equals(Double.NaN+"") || currentInput.equals(Double.NEGATIVE_INFINITY+"")) currentInput = BigDecimal.ZERO+""; BigDecimal LeftVal = new BigDecimal(currentInput); BigDecimal result = null; if (currentInputLen &gt; 0 &amp;&amp; LeftVal.compareTo(BigDecimal.ZERO) &gt; 0) { result = LeftVal.pow(2); } inputText.setText(result + ""); } I calculated 6!, then calculated sininverse(6!) which gave NaN after that when i pressed square button, application crashed. i wanted to check if current input was invalid by converting double.Nan and double.negative_infinity to string and setting it to zero but it did not work out.What is wrong here. 03-20 18:46:34.951: E/AndroidRuntime(11491): FATAL EXCEPTION: main 03-20 18:46:34.951: E/AndroidRuntime(11491): java.lang.IllegalStateException: Could not execute method of the activity 03-20 18:46:34.951: E/AndroidRuntime(11491): at android.view.View$1.onClick(View.java:3607) 03-20 18:46:34.951: E/AndroidRuntime(11491): at android.view.View.performClick(View.java:4212) 03-20 18:46:34.951: E/AndroidRuntime(11491): at android.view.View$PerformClick.run(View.java:17476) 03-20 18:46:34.951: E/AndroidRuntime(11491): at android.os.Handler.handleCallback(Handler.java:800) 03-20 18:46:34.951: E/AndroidRuntime(11491): at android.os.Handler.dispatchMessage(Handler.java:100) 03-20 18:46:34.951: E/AndroidRuntime(11491): …
downvote count: 1
has comment: http://stackoverflow.com/comment/34292438
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34291861
type: Question
has comment: http://stackoverflow.com/comment/34291758
has answer: http://stackoverflow.com/a/22534781
has comment: http://stackoverflow.com/comment/34292192
upvote count: 0
has comment: http://stackoverflow.com/comment/34292138
has comment: http://stackoverflow.com/comment/34291994

http://stackoverflow.com/comment/34335771
type: Comment
type: QuestionComment
has text: Have you considered using TestNG instead of Junit? Using TestNG you'll be able to store parameters in xml and pass them to the tests and launch browsers in @BeforeSuite annotated method.
score: 0
comment on: http://stackoverflow.com/q/22532339

http://stackoverflow.com/comment/34614997
type: QuestionComment
has text: Why don't you make your service a Stateless EJB and inject the EntityManager directly? The application server will take care of creating and managing the EMF for you.
comment on: http://stackoverflow.com/q/22638377
type: Comment
score: 0

http://stackoverflow.com/a/22625619
has comment: http://stackoverflow.com/comment/34455883
downvote count: 0
has comment: http://stackoverflow.com/comment/34455704
answers question: http://stackoverflow.com/q/22625575
type: Answer
score: 1
upvote count: 1
has body: The problem is you need to pass a Class&lt;LinkedHashSet&lt;String&gt;&gt; as second argument. That you can't create directly. You need to do some cast. This will work fine: @SuppressWarnings("unchecked") MultiValueMap&lt;String, String&gt; orderedMap = MultiValueMap.multiValueMap( new LinkedHashMap&lt;String, Collection&lt;String&gt;&gt;(), (Class&lt;LinkedHashSet&lt;String&gt;&gt;)(Class&lt;?&gt;)LinkedHashSet.class );

http://stackoverflow.com/q/22532051
upvote count: 6
has answer: http://stackoverflow.com/a/22532328
has answer: http://stackoverflow.com/a/22532613
answer count: 3
downvote count: 0
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34288704
type: UnansweredQuestion
has title: Is it possible to debug Lambdas in Java 8
score: 6
has answer: http://stackoverflow.com/a/22532633
tagged with: lambda
has body: I just started playing with Java 8 Lambdas and I noticed that I can't debug them in the NetBeans IDE. If I try to attach a breakpoint to the following code I get a variable breakpoint which is definately not what I wanted: private EventListener myListener (Event event) -&gt; { command1; command2; // Set Breakpoint here command3; }; NetBeans attaches the debugger at the "myListener" variable but I can't step into the EventListener itself so I can't see what is happening inside it. Is there debugging information missing, is this a missing feature in NetBeans or is it not at all possible to debug Lambdas in Java?
tagged with: java-8
tagged with: java
has comment: http://stackoverflow.com/comment/34289722
type: Question
tagged with: debugging

http://stackoverflow.com/comment/34465314
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22626046
has text: @jackpeton Under Linux, I just use `hexdump -C`, as you can see in the answer. If you are under Windows or Mac, you can search on google "hexadecimal editor", they should all give a good result.
type: AnswerComment

http://stackoverflow.com/a/22528826
score: 2
downvote count: 2
has body: Projects in Eclipse are Modules in IntelliJ. I do not recommend using them the same way - ie importing unrelated projects as modules into one IntelliJ project. Importing for example database project and application project into one is ok, or when working on one project means working on another. But when you import too many projects into one, you will have a problem with searching and "Go To File/Class" actions, and you will use too much heap space. Generally, when you have a lot of opened projects, there are three problems too much used heap -> GC pauses. switching between them is hard closing and reopening a lot of projects is hard To solve this, I have made Frame Switcher plugin for easier switching between projects, and reopening closed ones. Also, when you have 32 bit Windows and have too many projects, then you need to start new IntelliJ instance, and Frame Switcher can integrate them. There is also Missing Functionality plugin which lets you "Close All Other Projects".
upvote count: 4
type: Answer
answers question: http://stackoverflow.com/q/22527842

http://stackoverflow.com/q/22549234
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34319237
has comment: http://stackoverflow.com/comment/34594379
tagged with: android-listfragment
tagged with: notifydatasetchanged
has title: How to use .notifyDataSetChanged() to update SimpleCursorAdapter in Listfragment?
has comment: http://stackoverflow.com/comment/34319844
has answer: http://stackoverflow.com/a/22549285
score: 0
has answer: http://stackoverflow.com/a/22549277
has comment: http://stackoverflow.com/comment/34413568
type: UnansweredQuestion
tagged with: simplecursoradapter
tagged with: android
has body: I want to insert a new view data row to ListView(ListFragment), I already declare array in setAdapter() in method, but it has error with NullPointerException how should I use adapter.notifyDataSetChanged(); in new method? I tried declare Cursor in new method again, or declare SimpleCursorAdapter in class, but they have some error logCat: 03-21 02:41:30.099: W/dalvikvm(4130): threadid=1: thread exiting with uncaught exception (group=0xa4b60648) 03-21 02:41:30.103: E/AndroidRuntime(4130): FATAL EXCEPTION: main 03-21 02:41:30.103: E/AndroidRuntime(4130): java.lang.NullPointerException 03-21 02:41:30.103: E/AndroidRuntime(4130): at com.example.mycalc.NoteFragment.updateView(NoteFragment.java:80) 03-21 02:41:30.103: E/AndroidRuntime(4130): at com.example.mycalc.MainActivity.updateResult(MainActivity.java:34) 03-21 02:41:30.103: E/AndroidRuntime(4130): at com.example.mycalc.CalcFragment$1.onClick(CalcFragment.java:95) 03-21 02:41:30.103: E/AndroidRuntime(4130): at android.view.View.performClick(View.java:4240) 03-21 02:41:30.103: E/AndroidRuntime(4130): at android.view.View$PerformClick.run(View.java:17721) 03-21 02:41:30.103: E/AndroidRuntime(4130): at android.os.Handler.handleCallback(Handler.java:730) 03-21 02:41:30.103: E/AndroidRuntime(4130): at android.os.Handler.dispatchMessage(Handler.java:92) 03-21 02:41:30.103: E/AndroidRuntime(4130): at android.os.Looper.loop(Looper.java:137) 03-21 02:41:30.103: E/AndroidRuntime(4130): at android.app.ActivityThread.main(ActivityThread.java:5103) 03-21 02:41:30.103: E/AndroidRuntime(4130): at java.lang.reflect.Method.invokeNative(Native Method) 03-21 02:41:30.103: E/AndroidRuntime(4130): at java.lang.reflect.Method.invoke(Method.java:525) 03-21 02:41:30.103: E/AndroidRuntime(4130): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 03-21 02:41:30.103: E/AndroidRuntime(4130): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 03-21 02:41:30.103: E/AndroidRuntime(4130): at dalvik.system…
tagged with: java
has comment: http://stackoverflow.com/comment/34373472

http://stackoverflow.com/a/22522159
type: Answer
has body: Start substituting the calls to f with the actual code in f. Try it in Notepad or whatever program that has copy-paste. Fill in x and y with their appropriate values. When the if-statement is false, you can leave out its contents, otherwise you can keep substituting forever. You'll see why we call it a recursion tree once you've done two or three of these substitutions. How to draw this recursion tree is up to you. Usually we write the name of the method that is called in every node of the tree, together with the arguments to the call.
answers question: http://stackoverflow.com/q/22521953
score: 0

http://stackoverflow.com/comment/34407886
type: QuestionComment
score: 0
has text: @JasonC I obtained it from another source, however I believe the original source is http://www.learningwithrobots.com/
comment on: http://stackoverflow.com/q/22599116
type: Comment

http://stackoverflow.com/comment/34477328
type: Comment
type: QuestionComment
has text: for a sake of curiosity, why you want to read partition in that way, why don't you get the list of files and read it.
score: 0
comment on: http://stackoverflow.com/q/22637164

http://stackoverflow.com/a/22528123
has comment: http://stackoverflow.com/comment/34308074
has body: You can use projections (e.g. sqlProjection) and add them to your hibernate criteria to retrieve desired results. For example the code from here HibernateTemplate ht = new HibernateTemplate(sessionFactory); DetachedCriteria criteria = DetachedCriteria .forClass(Departments.class); ProjectionList pl = Projections.projectionList(); pl.add(Projections.groupProperty("yearStarted")); pl.add(Projections.sqlProjection("count(*) AS countOne, year_started AS ys", new String[] { "countOne", "ys" }, new Type[] { Hibernate.INTEGER, Hibernate.INTEGER })); criteria.setProjection(pl); List results = ht.findByCriteria(criteria); System.out.println("Count : " + results.size()); System.out.println("First Value : " + results.get(0));
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22528027
downvote count: 0

http://stackoverflow.com/q/22495557
has comment: http://stackoverflow.com/comment/34225108
has comment: http://stackoverflow.com/comment/34225124
tagged with: bitmapdrawable
tagged with: static
score: 0
has body: Please help! I have a problem with creating a BitmapDrawable in a static context. I am creating an android app for a student contest and since the MainActivity class starts to look "dirty" (having lots of code in it) I decided to make MainActivityLayout class that extends the MainActivity. Basicly I moved some methods (the ones for setting layouts) from MainActivity to MainActivityLayout class. The problem is with resize() method where I use BitmapDrawable constructor wich is "bugging me slowly" because needs a reference to resources in order to resize properly the bitmap. The MainActivity class : public class MainActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getLayoutOne(); MainActivityLayouts.setLayoutOne(); getLayoutTwo(); MainActivityLayouts.setLayoutTwo(); } private void getLayoutOne(){ //here I get the layouts id using findViewById() method } private void getLayoutTwo(){ //here I get the layout 2 id using findViewById() method } protected static Drawable resize(Drawable image,int xSize,int ySize) { Bitmap b = ((BitmapDrawable)image).getBitmap(); Bitmap bitmapResized = Bitmap.createScaledBitmap(b, xSize, ySize, false); return new BitmapDrawable(getResources(),bitmapResized); } } The MainActivityLayout class: public class MainActivityLayouts extends MainActivity{ public MainActivityLayouts(){ // ... } protected final static void setLayoutOne(){ Drawable drawableOne = ImageViewOne.getDrawable(); //here is the problem...cannot make a static refference... //getResources() from resize method from MainActivity to be more specific drawableOne = resize(drawableOne,100,100); ImageViewOne.setImageDrawable(drawableOne); } protected final static void setLayoutTwo(){ Drawable drawableTwo = ImageViewTwo.getDrawable(); //here is the problem...cannot make a static refference... //getResources() from resize method from MainActivity to be more specific drawable…
tagged with: android
has comment: http://stackoverflow.com/comment/34259959
answer count: 0
has title: Creating a BitmapDrawable in a static context
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3035692
tagged with: bitmap
type: Question
tagged with: java

http://stackoverflow.com/comment/34316412
type: QuestionComment
comment on: http://stackoverflow.com/q/22547514
score: 0
has text: By the way, the term you're looking for is "escaping", not "negation".
type: Comment

http://stackoverflow.com/comment/34488289
has text: Have you read [this](http://docs.oracle.com/javase/tutorial/essential/exceptions/try.html)?
comment on: http://stackoverflow.com/q/22644397
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/22577553
has comment: http://stackoverflow.com/comment/34368602
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22577473
type: Answer
accepted answer of: http://stackoverflow.com/q/22577473
has body: As mentioned in the comments, you should be using a HTML parser to get rid of the tags before removing everything except the letters and the marks. Should you insist upon using regex to remove the tags, you could instead say: String str1 = str.replaceall("&lt;[^&gt;]*&gt;", "").replaceAll("[^\\p{L}\\p{M}]", " "); i.e. remove the tags before ...
upvote count: 4

http://stackoverflow.com/q/22621963
accepted answer: http://stackoverflow.com/a/22642420
tagged with: threshold
tagged with: contour
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/22642420
tagged with: opencv
score: 2
linked to: http://stackoverflow.com/q/12929197
type: AnsweredQuestion
has body: How to make findContours robust to make it work even the the contour might not be closed due to noisy data and/or week edges/gradients in the image? For the first case (not closed) I'm running into the following problem: The algorithm runs quite well when using it on a thresholded picture like this: But when I take a closer picture, then there is no closed contour, see here: How to make it work for this case also? I thought of maybe always drawing a horizontal line at the top and at the bottom of my picture which will then always "cross" the papernote (when the note is captured from too close) making it a full contour. But this wouldn't probably work too well when the note is a bit rotated as I would then NOT get the correct contour, do I!? Do you have any better ideas? Thanks a lot in advance!
tagged with: java
has title: OpenCV findContours: make it robust
type: Question

http://stackoverflow.com/a/22577436
has comment: http://stackoverflow.com/comment/34368719
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22577370
has body: To split on a colon, except when the colon is preceded by "spend": line.split("(?&lt;!spend)\\s*:\\s*")
has comment: http://stackoverflow.com/comment/34368431
accepted answer of: http://stackoverflow.com/q/22577370
has comment: http://stackoverflow.com/comment/34368492
upvote count: 2
has comment: http://stackoverflow.com/comment/34368635
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34368698
has comment: http://stackoverflow.com/comment/34368742
has comment: http://stackoverflow.com/comment/34368761
type: Answer

http://stackoverflow.com/q/22512306
favorite count: 0
has answer: http://stackoverflow.com/a/22512455
has answer: http://stackoverflow.com/a/22512419
has answer: http://stackoverflow.com/a/22512508
type: Question
has body: I have a JSON document like this: [ {"type":"IC","v":88}, {"type":"SC","v":"XXX"}, {"type":"IC","v":33}, {"type":"IC","v":99999} ] and I want to replace the value of "v" in each object so the resulted JSON document is like this: [ {"type":"IC","v":111}, {"type":"SC","v":"YYYYYY"}, {"type":"IC","v":222}, {"type":"IC","v":333} ] I'm wondering if there are some APIs to call to do so? Thanks!
answer count: 6
upvote count: 2
has answer: http://stackoverflow.com/a/22512443
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
has title: How to update a list of objects in a JSON document
has comment: http://stackoverflow.com/comment/34252929
score: 2
has answer: http://stackoverflow.com/a/22512495
has answer: http://stackoverflow.com/a/22512959
has comment: http://stackoverflow.com/comment/34253512
downvote count: 0

http://stackoverflow.com/a/22523686
answers question: http://stackoverflow.com/q/22523545
type: Answer
has body: Your servlet class should get called on the Submit Action. why are you doing this. form action="hello.html" method="GET" Change it to form action="/servletclass" method="POST" From inside the Servlet use the RequestDispatcher to forward control to hello.html
has comment: http://stackoverflow.com/comment/34273534
has comment: http://stackoverflow.com/comment/34326836
has comment: http://stackoverflow.com/comment/34320496
has comment: http://stackoverflow.com/comment/34326953
has comment: http://stackoverflow.com/comment/34273649
score: 0
has comment: http://stackoverflow.com/comment/34273708

wikipedia-api
tag name: wikipedia-api
tags question: http://stackoverflow.com/q/22541443
type: Tag

http://stackoverflow.com/a/22496077
has comment: http://stackoverflow.com/comment/34225406
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34225564
answers question: http://stackoverflow.com/q/22495997
has comment: http://stackoverflow.com/comment/34225529
has comment: http://stackoverflow.com/comment/34225541
has comment: http://stackoverflow.com/comment/34225463
has body: my Yoda-like suggestion public static void main(String[] args) { String s = "I want cake today."; String[] ss = s.split(" "); Stack&lt;String&gt; sss = new Stack&lt;&gt;(); for(String ssss:ss){ sss.push(ssss); } while(!sss.isEmpty()){ System.out.print(sss.pop()); System.out.print(" "); } } gives today. cake want I for lines, do the same with another Stack. Or, if you don't want to use Stacks, store tokens and lines into some ArrayList and use Collections.reverse(list)
has comment: http://stackoverflow.com/comment/34225941
has comment: http://stackoverflow.com/comment/34225635
downvote count: 0

http://stackoverflow.com/comment/34378662
type: Comment
comment on: http://stackoverflow.com/a/22579331
score: 0
type: AnswerComment
has text: @vaxquis: Third, the increment and decrement operators are frequently abused, as illustrated by this very question. I avoid them whenever possible, and it is *always* possible.

http://stackoverflow.com/comment/34412901
type: Comment
has text: Can you please tell me how to iterate.Since I m a beginner so I have no idea??
type: AnswerComment
comment on: http://stackoverflow.com/a/22593316
score: 0

http://stackoverflow.com/a/22548744
accepted answer of: http://stackoverflow.com/q/22548704
answers question: http://stackoverflow.com/q/22548704
has body: You could use a method you create: String CapsFirst(String str) { String[] words = str.split(" "); StringBuilder ret = new StringBuilder(); for(int i = 0; i &lt; words.length; i++) { ret.append(Character.toUpperCase(words[i].charAt(0))); ret.append(words[i].substring(1)); if(i &lt; words.length - 1) { ret.append(' '); } } return ret.toString(); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34318654
score: 8
type: Answer
downvote count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/34318811

http://stackoverflow.com/a/25660600
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22582509
has body: getStringExtra() returns null if the value passed to putExtra() was not a String object. Judging by the comments to the question, this is not the answer in this specific case. However, it is worth mentioning because this is a very common cause for the problem "putExtra(), getStringExtra() - why it does not work?"

http://stackoverflow.com/comment/34225422
type: Comment
score: 0
type: QuestionComment
has text: but it automaticaly create when i get new frame file in netbean. all require type of inheritence automaticaly defined when we get new file in netbean ide.
comment on: http://stackoverflow.com/q/22488945

http://stackoverflow.com/comment/34272074
type: AnswerComment
type: Comment
has text: Manifest fixed and logcat updated. The app is still not working.
comment on: http://stackoverflow.com/a/22522557
score: 0

http://stackoverflow.com/comment/34364740
type: QuestionComment
has text: `View myView = (View)findViewById(R.id.view1);` before setting the layout to the activity
comment on: http://stackoverflow.com/q/22575340
score: 0
type: Comment

http://stackoverflow.com/comment/34485146
comment on: http://stackoverflow.com/a/22641588
type: AnswerComment
has text: thank you, it test this code, but i can not success, the type of login form is JinternalFrame.
type: Comment
score: 0

http://stackoverflow.com/comment/34349562
score: 0
has text: pretty broad question ... did a reedit so check it out if I did not broke the meaning of what you want also you should add to the question what kind of circuits you want to use (AC,DC,analog,digital,passive,active,NF,VF,VVN ...).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22566813

http://stackoverflow.com/a/22637721
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22625065
downvote count: 0
has body: I figured I would take a moment and try to digest this issue you have. I put together a SSCE for what I would expect if I did it manually, and what the groupingBy implementation actually does. I don't think this is an answer, but it is a 'wonder why it is a problem' thing. Also, if you want, feel free to hack this code to have a null-friendly collector. Edit: A generic-friendly implementation: /** groupingByNF - NullFriendly - allows you to specify your own Map and List supplier. */ private static final &lt;T,K&gt; Collector&lt;T,?,Map&lt;K,List&lt;T&gt;&gt;&gt; groupingByNF ( final Supplier&lt;Map&lt;K,List&lt;T&gt;&gt;&gt; mapsupplier, final Supplier&lt;List&lt;T&gt;&gt; listsupplier, final Function&lt;? super T,? extends K&gt; classifier) { BiConsumer&lt;Map&lt;K,List&lt;T&gt;&gt;, T&gt; combiner = (m, v) -&gt; { K key = classifier.apply(v); List&lt;T&gt; store = m.get(key); if (store == null) { store = listsupplier.get(); m.put(key, store); } store.add(v); }; BinaryOperator&lt;Map&lt;K, List&lt;T&gt;&gt;&gt; finalizer = (left, right) -&gt; { for (Map.Entry&lt;K, List&lt;T&gt;&gt; me : right.entrySet()) { List&lt;T&gt; target = left.get(me.getKey()); if (target == null) { left.put(me.getKey(), me.getValue()); } else { target.addAll(me.getValue()); } } return left; }; return Collector.of(mapsupplier, combiner, finalizer); } /** groupingByNF - NullFriendly - otherwise similar to Java8 Collections.groupingBy */ private static final &lt;T,K&gt; Collector&lt;T,?,Map&lt;K,List&lt;T&gt;&gt;&gt; groupingByNF (Function&lt;? super T,? extends K&gt; classifier) { return groupingByNF(HashMap::new, ArrayList::new, classifier); } Consider this code (the code groups String values based on the String.length(), (or null if the input String is null)): public static void main(String[] args) { String[] input = {"a", "a", "", null, "b", "ab"}; // How we group the Strings final Function&lt;String, Integer&gt; classifier = (a) -&gt; {return a != null ? Integer.valueOf(a.length()) : nul…
type: Answer

http://stackoverflow.com/comment/34304040
comment on: http://stackoverflow.com/q/22540823
type: Comment
type: QuestionComment
has text: rgettman has fixed your syntax error. But if you really want to get more than one value from your `Scanner`, you'll have to write your own loop. `Scanner` doesn't have a method that returns a whole array like that.
score: 1

http://stackoverflow.com/comment/34968140
type: Comment
has text: @user838204 You can issue pull requests for chronicle. Make sure you fork the OpenHFT version. Chronicle is GC-less, allows queuing up to your free disk space, and frees your producer from your consumer. i.e. it doesn't matter if your consumer is slow, or even running.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22629384

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/22572815
tags question: http://stackoverflow.com/q/22569050
tags question: http://stackoverflow.com/q/22547135
tags question: http://stackoverflow.com/q/22523304
type: Tag
tags question: http://stackoverflow.com/q/22628157

http://stackoverflow.com/comment/34431704
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22612689
has text: Perhaps component scanning is not picking up MyCustomService because it's missing the correct package.
score: 0

http://stackoverflow.com/q/22611406
score: 3
upvote count: 3
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22615604
linked to: http://stackoverflow.com/q/29518216
accepted answer: http://stackoverflow.com/a/22615604
tagged with: google-app-engine
tagged with: android
has title: Gradle failed: unsupported Gradle DSL method found: 'exclude()'
favorite count: 0
tagged with: google-cloud-endpoints
has body: I'm trying to include into my Android project (Android Studio - latest, Gradle) the classes from the Google Endpoints (Python) that I recently coded. The server side is all tested and working. I'm not used to Gradle, therefore I'm following the documentation at Google Developers. After changing the build.gradle file under src (as instructed by the doc) to: build.gradle: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' repositories { maven { url 'http://google-api-client-libraries.appspot.com/mavenrepo' } mavenCentral() mavenLocal() } android { compileSdkVersion 19 buildToolsVersion "19.0.2" defaultConfig { minSdkVersion 17 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-v4:+' compile 'com.google.android.gms:play-services:4.+' compile('com.google.api-client:google-api-client:1.17.0-rc') { // Exclude artifacts that the Android SDK/Runtime provides. exclude('xpp3:xpp3') exclude('org.apache.httpcomponents:httpclient') exclude('junit:junit') exclude('com.google.android:android') } compile('com.google.api-client:google-api-client-android:1.17.0-rc') { // Exclude play services, since we're not using this yet. exclude('com.google.android.google-play-services:google-play-services') } compile('com.google.http-client:google-http-client-android:1.17.0-rc') { exclude('com.google.android:android') } // This is used by the Google HTTP client library. compile('com.google.guava:guava:14.0.+') } Android Studio returns the following error: Gradle 'Project' project refresh failed: Build script error, unsupported Gradle DSL method found: 'exclude()'! Possible causes could be: - you are using Gradle version where the method is absent - you didn't apply Gradle plugin which provides the method - or there is a mistake …
type: AnsweredQuestion

http://stackoverflow.com/comment/34540358
type: Comment
comment on: http://stackoverflow.com/a/22646020
has text: @user819774 I'm glad you sorted it out :) However, my idea was different, it relied on API provided by `JDesktopPane`. There is no need to maintain a separate list of internal frames as `JDesktopPane` already has one which is accessible through `getAllFrames()`. I am not sure what is your scenario, but maintaining that list can get complicated as internal frames come and go.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22581039
has comment: http://stackoverflow.com/comment/34377372
has comment: http://stackoverflow.com/comment/34375270
has comment: http://stackoverflow.com/comment/34378090
accepted answer of: http://stackoverflow.com/q/22580933
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22580933
has body: Here is code based on your last comments: // Set of currently pressed keys private final Set&lt;Integer&gt; pressed = new TreeSet&lt;Integer&gt;(); @Override public void keyPressed(KeyEvent arg0) { int c = arg0.getKeyCode(); pressed.add(c); if (pressed.size() &gt; 1) { Integer[] array = pressed.toArray(new Integer[] {}); if (array[0] == KeyEvent.VK_LEFT &amp;&amp; array[1] == KeyEvent.VK_UP) { velx = -4; vely = -4; } else if (array[0] == KeyEvent.VK_UP &amp;&amp; array[1] == KeyEvent.VK_RIGHT) { velx = 4; vely = 4; } else if (array[0] == KeyEvent.VK_RIGHT &amp;&amp; array[1] == KeyEvent.VK_DOWN) { velx = 4; vely = -4; } else if (array[0] == KeyEvent.VK_LEFT &amp;&amp; array[1] == KeyEvent.VK_DOWN) { velx = -4; vely = 4; } } else { if (c == KeyEvent.VK_LEFT) { velx = -4; vely = 0; } else if (c == KeyEvent.VK_RIGHT) { velx = 4; vely = 0; } else if (c == KeyEvent.VK_UP) { velx = 0; vely = -4; } else if (c == KeyEvent.VK_DOWN) { velx = 0; vely = 4; } } } @Override public void keyReleased(KeyEvent arg0) { velx = 0; vely = 0; pressed.remove(Integer.valueOf(arg0.getKeyCode())); }
score: 0
has comment: http://stackoverflow.com/comment/34375128
type: Answer
has comment: http://stackoverflow.com/comment/34375148
has comment: http://stackoverflow.com/comment/34375014

http://stackoverflow.com/q/22612509
answer count: 2
has body: i am getting error when i am using SyntheticaBlackMoonLookAndFeel in my java swing code. below is my code :: i don't know why am i getting error ? try { UIManager.setLookAndFeel(new SyntheticaBlackMoonLookAndFeel()); }catch(Exception e) { e.printStackTrace(); } it is showing me this type of error :
downvote count: 0
has answer: http://stackoverflow.com/a/22612782
has title: Error while setting LookAndFeel
has answer: http://stackoverflow.com/a/22613416
favorite count: 0
has comment: http://stackoverflow.com/comment/34431377
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/34431505
score: 1
tagged with: java
tagged with: look-and-feel
type: Question

http://stackoverflow.com/comment/34415011
comment on: http://stackoverflow.com/q/22603062
score: 0
has text: I think the behaviour here is undefined. It's all about which flushes first, out of standard out and standard error. This is just about guaranteed to be platform-dependent.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34465458
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22626046
type: AnswerComment
has text: @jackpeton Just saw your edit, you have a BOM at the beginning of the file ("EF BB BF").

http://stackoverflow.com/comment/34233358
comment on: http://stackoverflow.com/q/22500979
has text: @RafaEl Not neccessarily since Java 8.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34264372
type: QuestionComment
has text: If fileManager.getAllFilesByPath(requestedFileName) return empty list, then I would have seen page with nothing data, but I'm seeing the old page with old data
score: 0
comment on: http://stackoverflow.com/q/22518154
type: Comment

http://stackoverflow.com/a/22520208
has body: You could just use a formatter from Joda Time instead, for example... public static final PeriodFormatter PERIOD_FORMATTER = new PeriodFormatterBuilder().printZeroAlways(). appendHours().appendSeparator(":"). appendMinutes().appendSeparator(":"). appendSeconds().appendSeparator("."). appendMillis().toFormatter(); public static String toString(Duration duration) { return duration == null ? "[invalid duration]" : duration.toPeriod().toString(PERIOD_FORMATTER); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22517044

http://stackoverflow.com/comment/34303273
comment on: http://stackoverflow.com/a/22540164
score: 0
type: AnswerComment
has text: Nikhil, I changed the dialect and the driver_class, take a look at the update please.
type: Comment

http://stackoverflow.com/q/22578554
downvote count: 0
has comment: http://stackoverflow.com/comment/34370519
has comment: http://stackoverflow.com/comment/34370408
favorite count: 0
has title: Debugging an Interface with Eclipse
has comment: http://stackoverflow.com/comment/34370323
tagged with: breakpoints
type: UnansweredQuestion
tagged with: interface
has body: I do have a problem and I searched for a solution for a very long time now, but did not find anything. Problem is: I do have a java-program, and I want to debug it. I have set a couple of break points in one of the methods i need to debug, but eclipse seems to just skip them when i run the debugger. I am sorry that i cannot provide any code here, because I do not have the permission to share it on the internet. But I can describe it's structure: The method where i put my break points is inherited from an interface. Is this the reason why the debugger does not see the break points? Does it stop at the declaration of the method in the interface, and not look into the implementation itself? Really guys I am frustrated about this. I am sure there is an easy solution for this, but I can't figure it out. And I have checked that the program really reaches the code in the method ;) Thank you a lot in advance! UPDATE: I have put a try-catch-block into the code where my breakpoints seem to fail, and print the stack trace to the console: It catches an error in a line where I do have a breakpoint. I have no idea what is wrong here.
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/34370337
upvote count: 2
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34370332
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34370445

http://stackoverflow.com/q/22612652
tagged with: selenium
has answer: http://stackoverflow.com/a/22612850
has body: It's pretty straight forward. I have a String which contains an href value. I want to find the web element on the page that contains that specific href. I am using: String href = "http://www.bing.com/images?FORM=Z9LH"; driver.findElement(By.cssSelector("a[href*='" + href + "']")).click() If you inspect www.bing.com you can see that the first link "images" on the top left has the href value that I set here. When I run, it says that there is no such element on the page. I feel like I am not using the correct "find by" option.
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22612839
tagged with: http://stackoverflow.com/tag/html
tagged with: selenium-webdriver
has title: How to find a web element using an href attribute
tagged with: xpath
type: UnansweredQuestion
score: 0

http://stackoverflow.com/a/22547454
score: 2
downvote count: 0
upvote count: 2
has body: You have to add an event listener to your button, more pricesly an ActionListener if you want to go more far, you can use Action interface that behaves like a controller of the button with useful constants&amp;methods. Example with ActionListener: myButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent evt){ // make validations here, if validation not passed // show the dialog you can use --&gt; // JOptionPane.showMessageDialog(null,"Error happen!"); //else you have to switch to another view } }) More information with better examples: How to use buttons. The next is completely personal, when i have to validate a form when a button is pressed i want to separate validation logic in another class. I make my custom interface that defines a validate() method public interface FieldValidator{ final String MY_VALIDATOR = "myValidator"; void validate() throws ValidationException //Note: ValidationException is a custom exception } And in the JComponent i want to validate for example a textfield i define my custom validator. textfield.putClientProperty(FieldValidator.VALIDATOR, new FieldValidator(){ @Override public void validate() throws ValidationException{ if(textfield.getText().isEmpty()) throw new ValidationException("text is empty"); } }); A concrete-class that holds all the JComponents in the form. public MyValidator implements FieldValidator{ private final JComponent[] components; public MyValidator(JComponent ... components){ this.components=components; } @Override public void validate() throws ValidationException{ for(JComponent component : components){ ((FieldValidator)component.getClientProperty(VALIDATOR)).validate(); } } } And then in client code FieldValidator fieldsValidator = new MyValidator(checkbox1,checkbox2,textfield); button.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent evt){ try{ fieldsValidator.validate(); //all it's ok change the view }catch(ValidationException ex){ …
has comment: http://stackoverflow.com/comment/34316114
answers question: http://stackoverflow.com/q/22547244
has comment: http://stackoverflow.com/comment/34316464
type: Answer

http://stackoverflow.com/q/22618624
tagged with: java
has comment: http://stackoverflow.com/comment/34444196
type: Question
has answer: http://stackoverflow.com/a/22619473
possible better answer: http://stackoverflow.com/a/22619666
has body: Hi I'm currently working on a Server/ Client program in Java, where a client connects to the server and sends a number to the server, the server then adds this number to a global variable and returns the global variable. The problem I am having is when I have multiple clients one client doesn't work while the other does, the client that was created at a later stage works. I have created separate threads for each client , and works to a certain degree. This is the snippet of my server class that creates the new thread public static Integer globalSum = 0; public static void main(String[] args) throws IOException { ServerSocket server = new ServerSocket(8888); Socket s; System.out.println("Server running. Waiting for a client to connect..."); while(true) { s = server.accept(); ThreadHandler th=new ThreadHandler(s); Thread t=new Thread(th); t.start(); System.out.println("Client is now connected"); } } Here is my client class public class Client2 { public static void main(String[] args) throws IOException { Socket s = new Socket("localhost", 8888); InputStream instream = s.getInputStream(); OutputStream outstream = s.getOutputStream(); Scanner in = new Scanner(instream); Scanner input= new Scanner(System.in); PrintWriter out = new PrintWriter(outstream); for(int i=0;i&lt;5;i++){ System.out.println("Please enter a value "+(i+1)); String response=input.nextLine(); String request="SUBMIT"+" "+response+"\n"; out.print(request); out.flush(); System.out.println(in.nextLine()); } out.print("QUIT\n"); out.flush(); s.close(); } } And here is my ThreadHandler class import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; import java.util.Scanner; public class ThreadHandler implements Runnable { private Socket s; private Scanner in; private static PrintWriter out; ServerMultipleClients serverInstance; public ThreadHandler(Socket s) { //th…
score: 0
has answer: http://stackoverflow.com/a/22619666
answer count: 3
accepted answer: http://stackoverflow.com/a/22619473
has comment: http://stackoverflow.com/comment/34443344
has answer: http://stackoverflow.com/a/22621630
tagged with: multithreading
has title: MultiThreading, Java Server/Client Project
type: AnsweredQuestion

http://stackoverflow.com/a/22517605
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22514015
has body: Why don't you use: expListView.setOnGroupExpandListener(new OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { for (int i = 0; i &lt; listDataHeader.size(); i++) { if (i != groupPosition) { expListView.collapseGroup(i); } } } }); I have tested it it seems to work fine.

http://stackoverflow.com/a/22509001
has body: You have to store the values, for example like this : import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class PrimeTest { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter the number till which the prime numbers are to be calculated: "); int input = scanner.nextInt(); List&lt;Integer&gt; primes = new ArrayList&lt;&gt;(); // loop through the numbers one by one for (int i = 2; i &lt; input; i++) { boolean isPrimeNumber = true; // check to see if the number is prime for (int j = 2; j &lt; i; j++) { if (i % j == 0) { isPrimeNumber = false; break; // exit the inner for loop } } // print the number if prime if (isPrimeNumber) { primes.add(i); } } System.out.println("The number of prime is: " + primes.size() + ", and they are: " + primes.toString()); } }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34246714
type: Answer
answers question: http://stackoverflow.com/q/22508874
accepted answer of: http://stackoverflow.com/q/22508874
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/34270106
score: 1
has text: @DavidWallace While what you are saying is 100% true, OP is going to round it anyway!
type: AnswerComment
comment on: http://stackoverflow.com/a/22521555
type: Comment

http://stackoverflow.com/comment/60529047
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22534503
type: AnswerComment
has text: can you share some sample to start java method from cron. I have no backend exp and need to code my GCE update method.

http://stackoverflow.com/q/22578460
tagged with: openfire
type: Question
tagged with: bonecp
answer count: 1
score: 0
has body: Trying to insert into a table present in openfire db: .. .. Connection con = new Connection(); Statment stmt = null; try{ stmt.executeUpdate("insert into utable values ('a','a');"); } catch(Exception e){ e.printStackTrace(); } ... .. I'm getting the following error : java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1017) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:655) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:566) at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:202) at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:45) at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:933) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1075) at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1640) at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1603) at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:308) at com.jolbox.bonecp.StatementHandle.executeUpdate(StatementHandle.java:497) I tried to insert manually to db using that query and I could insert successfully. I'm using BoneCP connection pooling. I've no problem reading from the dbs.
has answer: http://stackoverflow.com/a/22578479
has title: executeUpdate throws error when writing to openfire db
tagged with: oracle-database
accepted answer: http://stackoverflow.com/a/22578479
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22535736
has body: I am doing a method involving BufferedReader and I to have use it as an input argument, can someone tell me how to use it as an input argument but initialize it outside the method? Other thing is, how do I get the buffer to read special characterS? (eg: ´, ~) public static List&lt;Pacote&lt;Pair&lt;String, Double&gt;&gt;&gt; create( BufferedReader fileReader, int capacidadePacotes) throws IOException { List retorno = new ArrayList &lt;&gt; (6); String s; while ((s=fileReader.readLine())!=null){ retorno.add(parseItem(s)); } return retorno; } It basically reads a file and sends it to another function that treats the text and creates objects based on that, I'm just not clear on the whole using BufferedReader as an input argument, have just used it inside the method before so I'm unclear on how to initialize it properly, probably a dumb question but I would like to know how to do it properly
possible better answer: http://stackoverflow.com/a/22536635
has title: Using BufferedReader
has comment: http://stackoverflow.com/comment/34295765
linked to: http://stackoverflow.com/q/9281629
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34294836
tagged with: java
has answer: http://stackoverflow.com/a/22536635
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22536593
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/34295850
score: 0
has answer: http://stackoverflow.com/a/22536593

http://stackoverflow.com/comment/34223390
type: AnswerComment
has text: I have replaced with .getConstructor(float.class, float.class) because the constructor requires two floats arguments but still raises the same error
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22494236

http://stackoverflow.com/comment/34442383
comment on: http://stackoverflow.com/q/22618312
score: 0
type: Comment
type: QuestionComment
has text: What problem? Post at least the error or unexpected behaviour you get.

http://stackoverflow.com/comment/34316844
score: 0
type: AnswerComment
has text: @jdersen Also commmit add close your resultset,statements and connection.
type: Comment
comment on: http://stackoverflow.com/a/22547752

access-control
tag name: access-control
tags question: http://stackoverflow.com/q/22587997
type: Tag

http://stackoverflow.com/comment/34378127
type: AnswerComment
has text: Is your IDE set up with the latest version of Java (1.7) and did you use its autoimport functionality?
type: Comment
comment on: http://stackoverflow.com/a/22582002
score: 0

http://stackoverflow.com/q/22615608
has title: Weblogic 12c: Unable to add security token for identity, but works standalone
type: AnsweredQuestion
score: 2
downvote count: 0
has body: I've generated client ws-client for this wsdl: &lt;wsdl:definitions name="ArkivServiceBasis" targetNamespace="http://acos.no/websak/appservices/contracts/interface/arkivservicebasis/2011/08" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:i0="http://tempuri.org/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://acos.no/websak/appservices/contracts/interface/arkivservicebasis/2011/08" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"&gt; &lt;wsp:Policy wsu:Id="ArkivServiceBasisEP_policy"&gt; &lt;wsp:ExactlyOne&gt; &lt;wsp:All&gt; &lt;sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt; &lt;wsp:Policy&gt; &lt;sp:TransportToken&gt; &lt;wsp:Policy&gt; &lt;sp:HttpsToken RequireClientCertificate="false"/&gt; &lt;/wsp:Policy&gt; &lt;/sp:TransportToken&gt; &lt;sp:AlgorithmSuite&gt; &lt;wsp:Policy&gt; &lt;sp:Basic256/&gt; &lt;/wsp:Policy&gt; &lt;/sp:AlgorithmSuite&gt; &lt;sp:Layout&gt; &lt;wsp:Policy&gt; &lt;sp:Strict/&gt; &lt;/wsp:Policy&gt; &lt;/sp:Layout&gt; &lt;sp:IncludeTimestamp/&gt; &lt;/wsp:Policy&gt; &lt;/sp:TransportBinding&gt; &lt;sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt; &lt;wsp:Policy&gt; &lt;sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/…
tagged with: java
tagged with: jax-ws
type: Question
has comment: http://stackoverflow.com/comment/34446324
tagged with: weblogic
tagged with: weblogic12c
upvote count: 2
tagged with: ws-security
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22656007
accepted answer: http://stackoverflow.com/a/22656007

http://stackoverflow.com/a/22526200
score: 1
answers question: http://stackoverflow.com/q/22526129
has comment: http://stackoverflow.com/comment/34278119
has comment: http://stackoverflow.com/comment/34278037
has comment: http://stackoverflow.com/comment/34278373
has comment: http://stackoverflow.com/comment/34278581
upvote count: 1
type: Answer
has body: As HttpURLConnection.getContentLength() returns the value of the content-length header field, this may return -1 if it has not been set. So unless you can write something on the server which reads the files size, then you may have to read the entire inputstream.
downvote count: 0

gps
tags question: http://stackoverflow.com/q/22532504
tags question: http://stackoverflow.com/q/22575433
tag name: gps
type: Tag

http://stackoverflow.com/q/22597421
has comment: http://stackoverflow.com/comment/34404651
accepted answer: http://stackoverflow.com/a/22598094
type: AnsweredQuestion
has body: I have made a button By default invisible by customizing code. But now my problem is I cant make the button visible! The thing I want is,that when user LOG IN means the LOG OUT button should be visible. How can i do it using netbeans? can any1 help me? I m new in JAVA GUI. What condition should i add here? JLabel j1; public NewJFrame() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jButton4 = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jButton1 = new javax.swing.JButton(); jTextField3 = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jPasswordField1 = new javax.swing.JPasswordField(); jButton3 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); jComboBox2 = new javax.swing.JComboBox(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jComboBox3 = new javax.swing.JComboBox(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jButton6 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N jLabel2.setForeground(new java.awt.Color(102, 255, 0)); jLabel2.setText("EMAIL"); jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N jLabel3.setForeground(new java.awt.Color(102, 255, 0)); jLabel3.setText("PASSWORD"); jTextField1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 0, 153), 2, true)); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jButton4.…
has comment: http://stackoverflow.com/comment/34404672
score: 0
tagged with: java
has title: How to make button visible?
type: Question
has comment: http://stackoverflow.com/comment/34404744
answer count: 1
has comment: http://stackoverflow.com/comment/34405543
has comment: http://stackoverflow.com/comment/34404624
favorite count: 0
has comment: http://stackoverflow.com/comment/34405651
has answer: http://stackoverflow.com/a/22598094
has comment: http://stackoverflow.com/comment/34405492
has comment: http://stackoverflow.com/comment/34405467
has comment: http://stackoverflow.com/comment/34405569
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34404736

http://stackoverflow.com/comment/34477340
score: 0
comment on: http://stackoverflow.com/q/22637715
has text: Is this the problem with XML configuration only? I have successfully implemented the same example using annotations.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34424571
comment on: http://stackoverflow.com/a/22607920
score: 0
type: AnswerComment
type: Comment
has text: Hmm, what do you call "standard Java"? Android uses its own VM, for one

tokenize
tags question: http://stackoverflow.com/q/22641893
tags question: http://stackoverflow.com/q/22639259
tag name: tokenize
tags question: http://stackoverflow.com/q/22599419
type: Tag
tags question: http://stackoverflow.com/q/22566189

http://stackoverflow.com/q/22494233
tagged with: eclipse-plugin
favorite count: 0
has answer: http://stackoverflow.com/a/22494520
tagged with: font-size
type: AnsweredQuestion
has title: I want to change fontsize in textflow or label
score: 1
tagged with: java
has body: I'm implementing multiline Label Figure. I have a question. How can i change font size of textflow ? I tried with the method [textflow.setFont] before I had changed height value of fontdata. use this code,Font tFont = m_Textflow.getFont(); FontData[] tFontDataList = tFont.getFontData(); tFontDataList[0].setHeight(aSize); m_Textflow.setFont(new Font(null, tFontDataList[0])); But that didn’t work correctly and made any space on head. Help me please T^T
upvote count: 1
accepted answer: http://stackoverflow.com/a/22494520
type: Question
tagged with: draw2d
tagged with: textflow
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/1449968

http://stackoverflow.com/q/22578257
has body: String sql = "Insert Into borrower (bid,bname,bbooknum,btitle,bcounts,dateb,dater) values (?,?,?,?,?,?,?)"; try { pst = cn.prepareStatement(sql); pst.setString(1, txtid.getText()); pst.setString(2, txtname.getText()); pst.setString(3, txtbooknum.getText()); pst.setString(4, txttitle.getText()); pst.setString(5, txtcounts.getText()); pst.setString(6, txtdateb.getText()); pst.setString(7, ((JTextField)jDateChooser1.getDateEditor().getUiComponent()).getText()); pst.execute(); JOptionPane.showMessageDialog(null, "Book Successfully Borrowed!"); } catch (Exception e) { } My problem is that I want to reduce the txtcounts by 1 before the system submit the data to my database(sql) just like when your are borrowing a book on a library the copies are reduced by 1, hope someone can help me, thank you in advance...
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34369951
accepted answer: http://stackoverflow.com/a/22578544
score: 0
has comment: http://stackoverflow.com/comment/34369881
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22578582
possible better answer: http://stackoverflow.com/a/22578496
answer count: 3
has answer: http://stackoverflow.com/a/22578496
has answer: http://stackoverflow.com/a/22578544
has comment: http://stackoverflow.com/comment/34369931
has title: How can I decrease the value of a textfield before forwarding it to database
has comment: http://stackoverflow.com/comment/34370191

http://stackoverflow.com/a/22550033
has body: While I'm still looking for a "better" solution I used this to solve my problem. private void exportChartCsv() { mDatabaseHelper = new DatabaseHelper(this); try { mWriter = new CSVWriter(new FileWriter(Environment.getExternalStorageDirectory().getAbsolutePath() + "/charts.csv")); mChartList = mDatabaseHelper.getChartsList(); String[] mExportChartHeaders = { "Chart ID", "User ID", "Patient ID", "First Name", "Last Name", "Date of Birth", "Telephone Number", "Photo Path", "TimeStamp", "Questions Completed" }; mWriter.writeNext(mExportChartHeaders); for (ChartTable chartTable : mChartList) { mId = String.valueOf(chartTable.getId()); mUserId = chartTable.getUserId(); mPatientId = chartTable.getPatientId(); mFirstName = chartTable.getFirstName(); mLastName = chartTable.getLastName(); mDateOfBirth = chartTable.getDob(); mTelephoneNumber = chartTable.getPhone(); mPhotoPath = chartTable.getPhoto(); mTimeStamp = chartTable.getTimeStamp(); mQuestionsCompleted = String.valueOf(chartTable.getQuestionsCompleted()); String[] mExportChart = {mId, mUserId, mPatientId, mFirstName, mLastName, mDateOfBirth, mTelephoneNumber, mPhotoPath, mTimeStamp, mQuestionsCompleted}; mWriter.writeNext(mExportChart); } mWriter.close(); } catch (IOException e) { e.printStackTrace(); } mDatabaseHelper.close(); } While I don't think this is the best solution it's very straight forward and easy to understand. If someone comes up with a better solution I will gladly accept their answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22549555
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22549555

http://stackoverflow.com/q/22495997
accepted answer: http://stackoverflow.com/a/22496240
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/34225262
has answer: http://stackoverflow.com/a/22496809
has comment: http://stackoverflow.com/comment/34225672
has answer: http://stackoverflow.com/a/22496077
type: Question
tagged with: java
has title: Reverse sentences, lines and words of a file
possible better answer: http://stackoverflow.com/a/22496077
has comment: http://stackoverflow.com/comment/34225601
answer count: 3
downvote count: 0
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/22496240
tagged with: reverse
has body: I'm trying to reverse words and lines from a file, but my code only reverses the words without keeping the formatting of each sentence and printing a new line. This is an example of the file and how the output should look. reverse.txt (Actual) : He looked for a book. He picked up the book. He read the book. He liked the book. Expected result: book. the liked He book. the read He book. the up picked He book. a for looked He Here is the JAVA code I have so far import java.io.*; import java.util.*; public class ReverseOrder { public static void main (String[] args) throws FileNotFoundException { ArrayList&lt;String&gt; revFile = new ArrayList&lt;String&gt;(); Scanner input = new Scanner(new File("reverse.txt")); while (input.hasNext()){ revFile.add(input.next()); for(int i = revFile.size()-1; i &gt;= 0; i--){ System.out.println(revFile.get(i) + " "); } } } }

http://stackoverflow.com/comment/34384250
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22585720
has text: Can you explain why the code above doesn't cause an Stack-overflow error? Much appreciated!

http://stackoverflow.com/comment/34407808
has text: I believe that is your problem. getString() needs to always be given 0 since there is only one column returned, yet resultCount is growing so you are going to get an out of bounds exception. http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html#getString(int)
comment on: http://stackoverflow.com/a/22599071
type: AnswerComment
score: 0
type: Comment

android-studio
tags question: http://stackoverflow.com/q/22578903
tags question: http://stackoverflow.com/q/22646235
tags question: http://stackoverflow.com/q/22509638
tags question: http://stackoverflow.com/q/22550761
tags question: http://stackoverflow.com/q/22555967
tags question: http://stackoverflow.com/q/22588671
tags question: http://stackoverflow.com/q/22552993
tags question: http://stackoverflow.com/q/22593971
tags question: http://stackoverflow.com/q/22534050
type: Tag
tags question: http://stackoverflow.com/q/22573299
tags question: http://stackoverflow.com/q/22516291
tag name: android-studio

http://stackoverflow.com/comment/34415156
comment on: http://stackoverflow.com/q/22603314
score: 0
type: Comment
type: QuestionComment
has text: Where should i set the headers? Because i am using REStful services exposed by third party.

http://stackoverflow.com/q/22582917
tagged with: java
type: Question
tagged with: jstl
has title: How do I iterate through a map that has value, Map<String,Integer> declared as Map<String,Map<String,Integer>>using Expression Language ?
has body: I'm new to this and am not sure how to proceed. I need to populate the String-Integer map's key in select once I figure how to display it. So far I tried the following code but failed. &lt;c:forEach var="entry" items="${perCat}"&gt; &lt;c:out value="${entry.key}"&gt;&lt;/c:out&gt; &lt;/c:forEach&gt; The above code displays the String key of the Map- However, I don't know how to display the key-values of the second Map Tried this:/ &lt;c:forEach var="entry" items="${myMap}"&gt; &lt;c:out value="${(entry.value).key}"/&gt; &lt;/c:forEach&gt;
answer count: 1
tagged with: jsp
upvote count: 1
has answer: http://stackoverflow.com/a/22582936
accepted answer: http://stackoverflow.com/a/22582936
favorite count: 0
tagged with: el
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/22562391
type: Question
tagged with: java
tagged with: memory
upvote count: 2
has comment: http://stackoverflow.com/comment/34363913
has body: I need Hazelcast to store a relatively large size of data (16GB x 3 nodes). I carried out a few tests within JVM heap memory and was more than satisfied with the results. However, when I set the map to be stored in off-heap memory; I don't see any changes in memory usage. Shouldn't I see lower heap memory values when I use off-heap than in default BINARY in-memory-format? (I'm using a trial license and hazelcast-3.2-RC-ee JAR) Here's the configuration file part: OFFHEAP 0 0 false OFFHEAP 1 0 0 0 NONE 0 25 com.hazelcast.map.merge.PassThroughMergePolicy And this is the related code : String instanceName = wrapper.getHazelcastInstance().getName(); int port = wrapper.getHazelcastInstance().getCluster().getLocalMember().getInetSocketAddress().getPort(); logger.info("Hazelcast instance " + instanceName + " is running at port " + port); while (true) { System.out.print("Enter number of data to insert :"); String s = null; while (s == null) { s = System.console().readLine(); } Long dataCount = null; try { dataCount = Long.valueOf(s.trim()); } catch (NumberFormatException e) { System.out.println("That won't do :)"); continue; } if (dataCount < 0) { break; } int dataSize = wrapper.getHazelcastInstance().getMap("data").entrySet().size(); try { for (long l = dataSize; l < dataSize + dataCount; l++) { RoundRobinConsolidatedUtilizationData datum = createData(); wrapper.getHazelcastInstance().getMap("data").put(l, datum); } } catch (Exception e) { logger.severe("Exception occurred : " + e.getMessage()); } catch (Throwable throwable) { logger.severe("Error occurred; terminating instance : " + throwable.getMessage()); break; } logger.info("Total data count in cluster: " + wrapper.getHazelcastInstance().getMap("data").entrySet().size()); } Finally, here's the command-line that I use when running my HazelcastWrapper class java -XX:MaxDirectMemorySize=512M -Dhazelcast.elastic.memory.enabled=true -Dhazelcast.elastic.memory.total.size=500M -Dhazelcast.elastic.memory.chunk.size=12K -cp haz…
downvote count: 0
tagged with: hazelcast
has comment: http://stackoverflow.com/comment/34363954
favorite count: 0
tagged with: heap-memory
type: UnansweredQuestion
tagged with: dictionary
score: 2
answer count: 0
has title: Hazelcast OFFHEAP Map Taking Up Space in Heap
has comment: http://stackoverflow.com/comment/34382433

http://stackoverflow.com/a/22638988
score: 0
accepted answer of: http://stackoverflow.com/q/22604089
has comment: http://stackoverflow.com/comment/43814567
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22604089
type: Answer
has body: Trying setting proxy prior to request execution Executor executor = Executor.newInstance().auth(proxy, userName, passWord); System.out.println(executor .viaProxy(proxy) .execute(Request.Get(uri)) .returnResponse().getStatusLine());

http://stackoverflow.com/a/22634885
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22628572
type: Answer
has body: well seems to be an error in NamedParameterdJd.. so I change to jdbcTemplate original. this is the final code working: sql.append("SELECT VGPT_EXE.* FROM ") .append(Constants.T_VW_GPT_E_BASIC) .append(" AS VGPT_EXE ") .append("WHERE VGPT_EXE.") .append(Constants.ID_SUBJECTE + " IN ("); for (int i = 0; i &lt; ids.size(); i++) { if (i &gt; 0) { sql.append(","); } sql.append("?");**for every dinamic id add an ?** parametres.add(ids.get(i)); tipusParametres.add(new SqlParameter(Types.INTEGER)); } sql.append(")"); sql.append(" AND VGPT_EXE." + Constants.ID_ENS_EXP + " = ? "); parametres.add(idEns); tipusParametres.add(new SqlParameter(Types.INTEGER)); if (tipusDeute != null) { if (tipusDeute.equals(ETipusDeute.HISTORIC)) { sql.append(" AND " + Constants.DATA_FI_VOL + " &lt; TODAY "); } if (tipusDeute.equals(ETipusDeute.VIGENT)) { sql.append(" AND " + Constants.DATA_FI_VOL + " &gt;= TODAY "); } } // ordenació per la clau sql.append(ORDER_BY_E); try { pscf = new PreparedStatementCreatorFactory(sql.toString()); // El resultset HA DE SER DEL TIPUS TYPE_SCROLL_INSENSITIVE pscf.setResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE); for (SqlParameter sp : tipusParametres) { pscf.addParameter(sp); } resultat.setResultats((List&lt;IDeute&gt;) template.getJdbcOperations().query(pscf.newPreparedStatementCreator(parametres.toArray()), new ResultSetPaginatExtractor(new MapperDeute(), resultat.getFiles(), resultat.getInici()))); I hope it helps sone.
score: 0
accepted answer of: http://stackoverflow.com/q/22628572

http://stackoverflow.com/comment/34453878
type: QuestionComment
has text: @Silas I am unable to get access to the matlab. I can now parse the header data, but not the actual transducer data. I assume the enumeration points to an address, but the data that I want should be more than just a single memory address.
comment on: http://stackoverflow.com/q/22572923
score: 0
type: Comment

http://stackoverflow.com/comment/34324998
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22542300
score: 0
has text: are you certain youre reading from the process' stout as well as stderr ?

http://stackoverflow.com/comment/34317098
comment on: http://stackoverflow.com/q/22547975
score: 0
type: Comment
type: QuestionComment
has text: No, I was not even aware of java debuggers. Could you perhaps provide a link?

http://stackoverflow.com/comment/34256121
comment on: http://stackoverflow.com/a/22513253
type: Comment
has text: Maybe I don't get it, let met know. But all I see is a wrapper around mockito methods. How does that allow me to check a mock has been called last without verifying every other mock call ?
score: 0
type: AnswerComment

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/22542668

http://stackoverflow.com/comment/34370921
type: QuestionComment
has text: @fge That defeats some purpose of the `Collector`, I would not do that for a normal sequential collector either.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22578888

http://stackoverflow.com/comment/34442250
type: QuestionComment
type: Comment
has text: Please be clear with your question.
score: 0
comment on: http://stackoverflow.com/q/22618323

http://stackoverflow.com/q/22525617
has answer: http://stackoverflow.com/a/22525781
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/22525781
tagged with: jsp
has body: Hello i am developing a web Application.. Where on login the user will be redirected to his respected login page with a welcome text as WElCOME Username.. But when the user navigates to some other page and comes back it is displaying welcome msg as null... How to keep the username constant on the homepage even after navigation to different pages?? I use this code on JSp to display Welcome msg: String un = request.getParameter("txtUsername"); out.println("Welcome " + un); An d my LoginServlet is this: String username = request.getParameter("txtUsername"); String category = (request.getParameter("txtCategory")); Login login = new Login(); login.setUserName(username); login.setPassWord(request.getParameter("txtPassword")); login.setCategory(category); LoginService ls = new LoginService(); ls.loginValidate(login); Boolean check = ls.loginValidate(login); if (check == true) { HttpSession session = request.getSession(); // setting attribute on session session.setAttribute("user", username); if (category != null) { if (category.equalsIgnoreCase("Admin")) { RequestDispatcher rd = request .getRequestDispatcher("WEB-INF/WebPages/Admin.jsp"); rd.forward(request, response); } else if (category.equalsIgnoreCase("Affiliate")) { RequestDispatcher rd = request .getRequestDispatcher("WEB-INF/WebPages/Affiliate.jsp"); rd.forward(request, response); } else { RequestDispatcher rd = request .getRequestDispatcher("WEB-INF/WebPages/Client.jsp"); rd.forward(request, response); } } } else { RequestDispatcher rd = request .getRequestDispatcher("WEB-INF/WebPages/Error.jsp"); rd.forward(request, response); } } Please help me fix this.. Thanks in advance....
score: 0
has title: In Home Page when we navigate to another page and come back to home there is an error returning the username
tagged with: java-ee-6
answer count: 1
linked to: http://stackoverflow.com/q/2047122
tagged with: java-ee-7
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22565329
has title: PHP equivalent for Java's toCharArray()
type: Question
has comment: http://stackoverflow.com/comment/34346580
has body: In Java, I use toCharArray() to convert a string to an array of chars like follows: String s1= "\nX\\nT_$\u0061\"\'"; char[] c1 = s1.toCharArray(); System.out.println((Arrays.toString(c1) )); The result will be: [ , X, \, n, T, _, $, a, ", '] if you notices the first item is a new line, while the second \n was not considered a new line because the double back slashes is considered as one. Also, it takes care of unicode representations like \u0061 Is there any equivalent function for PHP?
has answer: http://stackoverflow.com/a/22565388
has answer: http://stackoverflow.com/a/22565365
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: php
has answer: http://stackoverflow.com/a/22565398
answer count: 4
has answer: http://stackoverflow.com/a/22565977
downvote count: 0
score: 1
tagged with: java

variables
tag name: variables
tags question: http://stackoverflow.com/q/22492668
tags question: http://stackoverflow.com/q/22531024
tags question: http://stackoverflow.com/q/22618312
type: Tag
tags question: http://stackoverflow.com/q/22626695
tags question: http://stackoverflow.com/q/22622238
tags question: http://stackoverflow.com/q/22494343
tags question: http://stackoverflow.com/q/22643243

http://stackoverflow.com/comment/34420861
comment on: http://stackoverflow.com/q/22606572
has text: @Dhaval i dont have an access to server side, im parsing it remotely
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34398098
type: Comment
type: QuestionComment
has text: The error is pretty clear: you can't compare a String with a char, same as you can't compare a car with a potato.
comment on: http://stackoverflow.com/q/22593801
score: 0

http://stackoverflow.com/q/22616764
type: Question
has comment: http://stackoverflow.com/comment/34439157
answer count: 1
score: 0
tagged with: nullpointerexception
has body: My intention is to create a login page using a Jframe. I have created the database connection class in a separate file as below and when I run the login Jframe, I get an error saying nullpointer exception. Please assist me :) dbConnection class ---------------------------------------------- package vehicle_renting; import java.sql.*; import javax.swing.JOptionPane; public class dbConnection { Connection con; Statement stmt; ResultSet rs; public dbConnection() {} public void connect() { try { Class.forName("com.jdbc.mysql.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/vehicle_renting_1","root","qwer1234"); } catch (Exception e) { e.printStackTrace(); } } } And the below code is placed in the jframe source. package vehicle_renting; import java.sql.* ; import javax.swing.* ; public class Login extends javax.swing.JFrame { Connection conn ; ResultSet rs; PreparedStatement pst; /** * Creates new form Login */ public Login() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); txt_username = new javax.swing.JTextField(); txt_password = new javax.swing.JPasswordField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText("Username"); jLabel2.setText("Password"); jButton1.setText("Ok"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swin…
has comment: http://stackoverflow.com/comment/34439600
has answer: http://stackoverflow.com/a/22620650
tagged with: jform
has comment: http://stackoverflow.com/comment/34439790
type: UnansweredQuestion
tagged with: swing
has title: How to get rid of the nullpointerexception in jframe?
tagged with: java
tagged with: mysql

http://stackoverflow.com/q/22494948
has comment: http://stackoverflow.com/comment/34223588
has body: I have a byte array which looks like this: [0, 0, 0, 0, 0, 0, 0, 0, 122, 98, 117, 54, 46, 0, 0, 115, 122, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 116, 121, 116, 117, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 107, 111, 98, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 42, 109, 111, 119, 40, 0, 0, 0, 0, 0, 0, 107, 111, 98, 0, 0, 0, 0, 0, 98, 111, 40] I wanted to print it as a string, so I wrote the following code: System.out.println(new String(byteArray)); but there is no output. Next, I tried the following code: for (byte b : byteArray) { System.out.print((char) b); } but again there is no output. But when I tried the following code: for (byte b : byteArray) { System.out.println((char) b); } I was able to see the values. My question is, why can't I create a string or why did the first printing of values from byteArray fail?
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/34223660
has answer: http://stackoverflow.com/a/22495076
tagged with: arrays
has comment: http://stackoverflow.com/comment/92552297
has answer: http://stackoverflow.com/a/22494996
score: 4
has comment: http://stackoverflow.com/comment/34223691
downvote count: 0
tagged with: string
tagged with: system.out
favorite count: 0
has answer: http://stackoverflow.com/a/22494998
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/65371994
linked to: http://stackoverflow.com/q/8635425
answer count: 4
has title: System.out.print of string without 'ln'
tagged with: java

http://stackoverflow.com/comment/57501402
has text: Actually this is longer than `Stream.of(objects).filter(o->o instanceof Client).map(o -> (Client)o)` or even `Stream.of(objects).filter(Client.class::isInstance).map(Client.class::cast)`.
comment on: http://stackoverflow.com/a/23473558
type: AnswerComment
score: 5
type: Comment

http://stackoverflow.com/comment/34455733
comment on: http://stackoverflow.com/q/22625681
has text: @Reddy This is about drivers, the only code here is XML. The [help center](http://stackoverflow.com/help/on-topic) says that questions should be about: a specific **programming** problem (no), a software algorithm (no), software tools commonly used by programmers (sorta, but this is a driver error), or practical, answerable problems that are unique to **software** development (no). [Super users's help center](http://superuser.com/help/on-topic) says questions should be about: computer hardware, computer software (applies here), or personal and home computer networking.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22589911
score: 1
tagged with: java
upvote count: 1
has body: I am really confused on dealing with repeated letters in my java hangman game e.g. there are multiple 'a's in the word 'banana', but my program only deals with the first 'a' and leaves the other 'a's out. Other than that, the program works fine with word with no repeating letters e.g. 'brush'. This there any solutions to deal with repeated letters? I appreciate any help, thanks! Here is my code so far: import java.util.Scanner; import java.util.Arrays; public class Hangman{ public static void main(String []args){ Scanner Input = new Scanner(System.in); String[] CollectionOfWords = {"","gravity","banana","gate","processor","momentum","earth","star","light","television","pan","cupboard"}; int radmNumber = (int) Math.ceil (Math.random() * CollectionOfWords.length); int counter = 10; String radmWord = CollectionOfWords[radmNumber]; char[] genRadmLetter = radmWord.toCharArray(); char[] genRadmLetter2 = radmWord.toCharArray(); for (int x = 0; x&lt;genRadmLetter.length; x++){ genRadmLetter[x]='?'; } System.out.println(String.valueOf(genRadmLetter)); System.out.println("Hello. Guess a letter."); char guessedLetter = Input.next().charAt(0); int RW = radmWord.indexOf(guessedLetter); if (RW &gt;= 0 ){ genRadmLetter[RW] = guessedLetter; System.out.println(genRadmLetter); } if (RW == -1){ System.out.println("Wrong letter, try again."); counter = counter - 1; System.out.println("Lives left: " + counter); } while (counter != 0) { System.out.println("Guess a letter."); guessedLetter = Input.next().charAt(0); RW = radmWord.indexOf(guessedLetter); if (RW &gt;= 0 ){ genRadmLetter[RW] = guessedLetter; System.out.println(genRadmLetter); } if (RW == -1){ System.out.println("Wrong letter, try again."); counter = counter - 1; System.out.println("Lives left: " + counter); } boolean result = Arrays.equals(genRadmLetter, genRadmLetter2); if (result == true){ break; } if (counter == 0){ break; } } if (counter == 0){ System.out.println("You lose. The word was: " + radmWord); } else { System.out…
type: Question
has comment: http://stackoverflow.com/comment/34391235
has comment: http://stackoverflow.com/comment/34391230
has comment: http://stackoverflow.com/comment/34391155
answer count: 1
downvote count: 0
favorite count: 0
has title: How to deal with repeated letters in a java hangman game?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34391416
has answer: http://stackoverflow.com/a/22590179

http://stackoverflow.com/comment/34481702
score: 0
comment on: http://stackoverflow.com/q/22640653
type: Comment
type: QuestionComment
has text: there are lots of error in logcat

http://stackoverflow.com/comment/34262460
comment on: http://stackoverflow.com/q/22517466
score: 0
type: Comment
has text: Have you tried: message.setContent(msg, "text/html; charset=utf-8");
type: QuestionComment

http://stackoverflow.com/comment/56400732
has text: @jlmcdonald I am facing similar problem, can you help me http://stackoverflow.com/questions/34316162/installed-application-redirect-uri-mismatch-when-site-is-online
comment on: http://stackoverflow.com/a/22829362
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/39695242
upvote count: 4
answers question: http://stackoverflow.com/q/22605050
downvote count: 0
type: Answer
has body: We can have three nodes previous,current and next. public void reverseLinkedlist() { /* * Have three nodes i.e previousNode,currentNode and nextNode When currentNode is starting node, then previousNode will be null Assign currentNode.next to previousNode to reverse the link. In each iteration move currentNode and previousNode by 1 node. */ Node previousNode = null; Node currentNode = head; while (currentNode != null) { Node nextNode = currentNode.next; currentNode.next = previousNode; previousNode = currentNode; currentNode = nextNode; } head = previousNode; }
score: 4

http://stackoverflow.com/a/22572361
accepted answer of: http://stackoverflow.com/q/22561527
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22561527
score: 30
upvote count: 30
type: Answer
has comment: http://stackoverflow.com/comment/75803223
has comment: http://stackoverflow.com/comment/34437232
has comment: http://stackoverflow.com/comment/34428074
has comment: http://stackoverflow.com/comment/34433051
has body: I believe you want to do something like this: Response response = builder.get( Response.class ); if ( response.getStatusCode() != Response.Status.OK.getStatusCode() ) { System.out.println( response.getStatusType() ); return null; } return response.readEntity( MyEntity.class ); Another thing you can try (since I don't know where this API puts stuff -- i.e. in the header or entity or what) is: Response response = builder.get( Response.class ); if ( response.getStatusCode() != Response.Status.OK.getStatusCode() ) { // if they put the custom error stuff in the entity System.out.println( response.readEntity( String.class ) ); return null; } return response.readEntity( MyEntity.class ); If you would like to generally map REST response codes to Java exception you can add a client filter to do that: class ClientResponseLoggingFilter implements ClientResponseFilter { @Override public void filter(final ClientRequestContext reqCtx, final ClientResponseContext resCtx) throws IOException { if ( resCtx.getStatus() == Response.Status.BAD_REQUEST.getStatusCode() ) { throw new MyClientException( resCtx.getStatusInfo() ); } ... In the above filter you can create specific exceptions for each code or create one generic exception type that wraps the Response code and entity.

http://stackoverflow.com/a/22539447
has body: I suppose that flushing the entityManager between the two operations (clearing the set and adding new elements) will do the trick but I would have expected JPA to trigger the persistence update in the right order. Is the dataClass entity still attached to the persistence context when you update its state ?
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22539196
answers question: http://stackoverflow.com/q/22539196
score: 0

http://stackoverflow.com/comment/34436993
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22599194
has text: @dashhund, if you are saying you want empty space before/after the first/last label then add "glue" at the beginning/end of the panel. The BoxLayout tutorial explains what glue is.
type: Comment

http://stackoverflow.com/q/22502391
answer count: 0
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: handler
upvote count: 1
has title: Handler does not stop on Destroy or on Pause of activity
tagged with: android-activity
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I am having problem with chatting app , I am trying to run chat receiver functionality using handler such that as soon as messages are received they are taken care of and displayed on screen . But it fails when I try to go back and resume the chatting, since Handler keeps on running so is the message object associated with it , and it fails to reinitialize it. Following is the code : public class hotListener extends ListActivity { private HotspotService service; private XMPPConnection connection; private IBinder binder; private Handler mHandler = new Handler(); private ArrayList&lt;String&gt; messages = new ArrayList&lt;String&gt;(); ArrayList&lt;ChatMessage&gt; messagex= new ArrayList&lt;ChatMessage&gt;(); ChattingAdapter adaptex= new ChattingAdapter(hotListener.this, messagex);; HotspotService.MyBinder binderx; Intent mIntent ; private ListView listview; EditText sender_message ; String msg; Thread t; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listener); setListAdapter(adaptex); System.out.println("inside on create"); Button send_button = (Button) findViewById(R.id.chat_send_message); sender_message = (EditText) findViewById(R.id.chat_input); send_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { msg = sender_message.getText().toString(); sender_message.setText(""); if(!(msg.length()==0)){ messagex.add(new ChatMessage(msg, true)); //addNewMessage(new ChatMessage(msg, true)); adaptex.notifyDataSetChanged(); getListView().setSelection(messagex.size()-1); } } }); if(!isMyServiceRunning()){ System.out.println("seems like service not running"); startService(new Intent(this,HotspotService.class)); System.out.print(" now started "); } } @Override protected void onStart(){ super.onStart(); System.out.println("in onstart"); } private void receivespots(XMPPConnection connection2, final ChattingAdapter adaptex2) { connection2.getChatManager().addChatLi…

http://stackoverflow.com/q/22541029
tagged with: gwt-bootstrap
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22558453
accepted answer: http://stackoverflow.com/a/22558453
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/34331349
has comment: http://stackoverflow.com/comment/34304846
score: 0
has title: How put a mask in a TextInputCell?
answer count: 1
has body: I have a TextInputCell in a Column, like this: TextInputCell textCell = new TextInputCell(); Column&lt;EffortCost, String&gt; hourColumn = new Column&lt;EffortCost, String&gt;(textCell) { public String getValue(EffortCost object) { String formatted = NumberFormat.getFormat("0.00").format(object.getHours()); return formatted; } }; My string returned: "1.00" if I wrote "1". I want the same result, but I don't wanna formated the string, I want my widget doing this in a moment I put the text in the TextInputCell, in other words, I want format the string automatically while I write the text in my TextInputCell. This would be like a "MaskedTextInputCell". How can I do this? Can I see some examples? Thanks for attention.

http://stackoverflow.com/a/22512986
score: 0
answers question: http://stackoverflow.com/q/22512840
has comment: http://stackoverflow.com/comment/34254641
type: Answer
has body: In the cassandra.yaml configuration file, change the commitlog_directory data_file_directories saved_caches_directory properties to the path you have specified as they are no longer /var/lib... You will need to set them to point to wherever the directories actually are.
has comment: http://stackoverflow.com/comment/34255070

slidingmenu
tag name: slidingmenu
tags question: http://stackoverflow.com/q/22500800
type: Tag
tags question: http://stackoverflow.com/q/22524728

http://stackoverflow.com/q/22628163
upvote count: 1
accepted answer: http://stackoverflow.com/a/22628452
tagged with: escaping
type: AnsweredQuestion
has title: Decode an escaped string from VBScript in Java
tagged with: java
tagged with: character-encoding
tagged with: vbscript
type: Question
has answer: http://stackoverflow.com/a/22628452
answer count: 2
has comment: http://stackoverflow.com/comment/34459839
possible better answer: http://stackoverflow.com/a/22628383
downvote count: 0
has answer: http://stackoverflow.com/a/22628383
score: 1
has comment: http://stackoverflow.com/comment/34459787
favorite count: 0
has body: I tried to decode the following string, String str = "AT%26amp%3BT%20Network%20Client%20%u2013%20IBM"; System.out.println(StringEscapeUtils.unescapeHtml(str)); try { System.out.println("res:"+java.net.URLDecoder.decode(str, "UTF-8")); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } Both methods fail as below, AT%26amp%3BT%20Network%20Client%20%u2013%20IBM Exception in thread "main" java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "u2" at java.net.URLDecoder.decode(URLDecoder.java:173) at decrypt.DecryptHtml.main(DecryptHtml.java:19) The source of the string is a VBS script that uses the Escape function. How can I decode this string?
has comment: http://stackoverflow.com/comment/34459724
has comment: http://stackoverflow.com/comment/34459771
tagged with: decoding

http://stackoverflow.com/comment/34321494
type: Comment
comment on: http://stackoverflow.com/a/22550246
score: 0
has text: @user3444913 Okay, is it doing what you wanted it to do? If there's a problem with it or you don't understand something, leave a comment here and I'll help you out with it.
type: AnswerComment

http://stackoverflow.com/comment/34404418
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22592877
has text: Thanks for the idea. Unfortunately I already add a dependency to my custom config which classpath is later passed to the library as a parameter, but unlike your JacocoPlugin I [call](http://goo.gl/pqoIqw) `main()` from the library directly instead of using Ant (maybe I would help me). Because of that I would need to add a dependency to `buildscript.classpath` (to affect my call from a plugin). Unfortunately construction `project.buildscript.configurations.classpath.incoming.beforeResolve {}` as well as `project.beforeEvaluate {}` isn't triggered and later this configuration is already RESOLVED

http://stackoverflow.com/q/22511279
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34251364
has comment: http://stackoverflow.com/comment/34252518
has comment: http://stackoverflow.com/comment/34251191
has comment: http://stackoverflow.com/comment/34251090
has comment: http://stackoverflow.com/comment/34295604
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34250864
has body: I have ORMLite db object and it has a field: @ForeignCollectionField(eager = true) public ForeignCollection&lt;BlockMod&gt; blocks; Now when I want to get all collection of blocks for current object I call: public BlockMod[] getBlocks(){ return blocks.toArray((BlockMod[])java.lang.reflect.Array.newInstance(BlockMod.class, blocks.size())); } My question is how to get this collection with custom sorting? I know I could iterate this data and order it as I want, but is that the best solution? Is ORMLite doing db request when I ask for ForeignCollection, or is it collected when I initialized main Object?
has comment: http://stackoverflow.com/comment/34251773
score: 0
has answer: http://stackoverflow.com/a/26479396
answer count: 1
has title: ORMLite foreign collection order
tagged with: ormlite

http://stackoverflow.com/comment/34505524
score: 0
type: AnswerComment
has text: this indeed helped, thanks! the matching is now working as expected.
type: Comment
comment on: http://stackoverflow.com/a/22645206

http://stackoverflow.com/comment/34353282
comment on: http://stackoverflow.com/a/22568852
score: 0
type: AnswerComment
type: Comment
has text: The OP can't change the instantiation of enemyFighter, only the code of the Fighter class. The no-arg ctor should probably set some default values. Also, the `attack` method still needs to be fixed to take a `Fighter` parameter.

http://stackoverflow.com/comment/34364637
has text: Hint: what does this code do? `public static int[] array2() {int[] ar = {0, 1}; changeArr2(arr); return arr;}` `public static void changeArr2(int[] arr) {arr = new int[] {3, 4};}`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22575287
score: 0

http://stackoverflow.com/q/22588879
has title: Retrieve values stored in an array to display on a java swing jFrame
has comment: http://stackoverflow.com/comment/34389753
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/34389446
has comment: http://stackoverflow.com/comment/34389471
has comment: http://stackoverflow.com/comment/34389503
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/22589207
tagged with: initialization
accepted answer: http://stackoverflow.com/a/22589207
has comment: http://stackoverflow.com/comment/34389828
type: AnsweredQuestion
tagged with: jform
has comment: http://stackoverflow.com/comment/34389630
has comment: http://stackoverflow.com/comment/34389574
tagged with: swing
has body: I am having trouble displaying values stored in an array on a Java swing jFrame, I am trying to display the values as jLabels within the jFrame. I want the details of the first car to display when the form loads, other cars in the array to display when you click a 'next' (record) button. The Car class: package abc; import java.io.*; import java.util.*; public class Car { private String carReg, carModel, carMake; private double carValue; public void setCarReg(String carReg){ this.carReg = carReg; } public String getCarReg(){ return this.carReg; } public void setCarModel(String carModel){ this.carModel = carModel; } public String getCarModel(){ return this.carModel; } public void setCarMake(String carMake){ this.carMake = carMake; } public String getCarMake(){ return this.carMake; } public void setCarValue(double carValue){ this.carValue = carValue; } public double getCarValue(){ return this.carValue; } public static ArrayList&lt;Car&gt; CarArray = new ArrayList&lt;Car&gt;(); Iterator I = CarArray.iterator(); public static void exportCar(){ String fileLoc = "C:\\abc\\exportCar.txt"; int i = 0; try { FileOutputStream uh = new FileOutputStream(fileLoc); ObjectOutputStream st = new ObjectOutputStream(uh); for (i=0; i&lt;CarArray.size(); i++) { st.writeObject(CarArray.get(i)); } } catch(IOException e) { System.out.println(e); } } public static void importCar(){ String fileLoc = "C:\\abc\\exportCar.txt"; int i = 0; try { FileInputStream uh = new FileInputStream(fileLoc); ObjectInputStream st = new ObjectInputStream(uh); try { while(uh!=null) { CarArray.add((Car)st.readObject()); } } catch(Exception e){} } catch(IOException e) { System.out.println(e); } } } The Login jForm: package abc; import java.util.*; public class Login extends javax.swing.JFrame { // Bidder bidder1 = new Bidder("cm", "w", 3, "FN", "LN", 1, "Street", "City", "BA99AE", //"1234567890", "EMail", "Card Make", "123456", "1122", 123); public static int userLevelFound = 0; /** Creates new form Login */ public…
has comment: http://stackoverflow.com/comment/34389894
type: Question

http://stackoverflow.com/comment/34258674
has text: just figured out that using windows-1251 works with latin and cyrillic letters, but ignores German characters like ö ü ä.. Can you suggest any workaround to read/write any language text?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22505220

http://stackoverflow.com/comment/34434608
type: QuestionComment
comment on: http://stackoverflow.com/q/22614076
has text: How do you know it's not working? It looks like you are using Processing. You don't actually appear to have implemented anything you stated in your requirements. For example, I see no `mouseClicked()`, I see no usage of `plateCount`, etc. You'll have to make at least some effort. Your code is doing precisely as you commanded it to do.
score: 1
type: Comment

http://stackoverflow.com/q/22513263
type: Question
has title: Android Touch conditional within a while loop?
answer count: 1
has body: Okay let's say I have 40 imageViews on the screen at once and I want to check to see if any of them are being touched, is there any way to condense my code and write a loop to do it for me? Right now my code looks like what is below only much longer because I have a giant conditional for each imageview. It makes for endless and gross looking code. The only thing different about each conditional is the index value. public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_MOVE: float x = event.getRawX(); float y = event.getRawY(); if (x &gt; imageViewArray[0].getX() &amp;&amp; x &lt; imageViewArray[0].getX() + imageViewArray[0].getWidth() &amp;&amp; y &gt; imageViewArray[0].getY() &amp;&amp; y &lt; imageViewArray[0].getY() + imageViewArray[0].getHeight()) { System.out.println("imageView0 was touched"); } if (x &gt; imageViewArray[1].getX() &amp;&amp; x &lt; imageViewArray[1].getX() + imageViewArray[1].getWidth() &amp;&amp; y &gt; imageViewArray[1].getY() &amp;&amp; y &lt; imageViewArray[1].getY() + imageViewArray[1].getHeight()) { System.out.println("imageView1 was touched"); } if (x &gt; imageViewArray[2].getX() &amp;&amp; x &lt; imageViewArray[2].getX() + imageViewArray[2].getWidth() &amp;&amp; y &gt; imageViewArray[2].getY() &amp;&amp; y &lt; imageViewArray[2].getY() + imageViewArray[2].getHeight()) { System.out.println("imageView2 was touched"); } break; } return true; }
score: 0
has answer: http://stackoverflow.com/a/22514067
has comment: http://stackoverflow.com/comment/34255198
has comment: http://stackoverflow.com/comment/34254756
type: UnansweredQuestion
tagged with: android
tagged with: java

http://stackoverflow.com/a/22577743
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: It is not possible at the moment to do this in a "clean" way. We want to change it in netty 5. See also https://github.com/netty/netty/issues/1230
score: 3
answers question: http://stackoverflow.com/q/22559272
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22559272

http://stackoverflow.com/q/22525175
type: Question
has body: I am new to spring Mvc. While getting a response from spring mvc to ajax I am getting an IllegalStateException. Please help me out to solve the below issue. //Controller(.java) @RequestMapping(value = "/getAllActors", method = RequestMethod.GET) public @ResponseBody List&lt;Person&gt; getAllActors( HttpServletRequest request, HttpServletResponse response) { LOGGER.info("get all actors inside"); try { List&lt;Person&gt; allActorsList=null; allActorsList = contentService.getAllActorsList(); System.out.println(allActorsList); for(Person li:allActorsList) { System.out.println(li.getFirstname()); } return allActorsList; } catch(IllegalStateException e) { System.out.println("inside of exception"); } return null; } //Viewlayer(.jsp) $.ajax({ type: "GET", url: "/content/getAllActors", dataType:"json", success: function(data) { //alert(data.length); var html = '&lt;option value=""&gt;-------Select Person------&lt;/option&gt;'; for ( var i = 0; i &lt; data.length; i++) { html += '&lt;option value="' + data[i].id + '"&gt;' + data[i].firstname +" "+ data[i].lastname +'&lt;/option&gt;'; // alert(data[i].firstname); } html += '&lt;/option&gt;'; $('.actorsList').show(); $('.actorsList').append(html); /* var json_x = $.parseJSON(data.firstname); alert(json_x); $("#subViewDiv").html( data ); */ }, error: function(data) { } }); //Tiles Configuration file(.java) @Configuration @EnableWebMvc @ComponentScan(basePackages = "com.apalya.myplex.web.controller.portal") public class TilesConfig extends WebMvcConfigurerAdapter { private static final Map&lt;String, Definition&gt; tiles = new HashMap&lt;String, Definition&gt;(); private static final Attribute TEMPLATE = new Attribute("/WEB-INF/views/layout/layout.jsp"); private static final Attribute TEMPLATE_LOGGED = new Attribute("/WEB-INF/views/layout/layoutLogged.jsp"); @Bean public TilesConfigurer tilesConfigurer() { TilesConfigurer tilesConfigurer = new TilesConfigurer(); tilesConfigurer.setDefinitionsFactoryClass(JavaDefinitionsFactory.cl…
has title: IllegalStateException while getting response from Spring MVC
tagged with: java
has comment: http://stackoverflow.com/comment/34277223
has comment: http://stackoverflow.com/comment/34281167
upvote count: 1
has comment: http://stackoverflow.com/comment/34280846
downvote count: 0
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34276195
tagged with: spring
has comment: http://stackoverflow.com/comment/34276335
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34276217
has comment: http://stackoverflow.com/comment/34277957
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/34276597
has comment: http://stackoverflow.com/comment/34277328

http://stackoverflow.com/comment/34385244
type: AnswerComment
has text: This won't work. The table rows and columns may be rearranged from their original order in the model. That's why I suggested using `JXTable` in my answer, because it solves this problem.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22584467

http://stackoverflow.com/q/22510516
tagged with: switch-statement
type: Question
has answer: http://stackoverflow.com/a/22510643
has answer: http://stackoverflow.com/a/22510638
score: 0
has answer: http://stackoverflow.com/a/22510704
has title: Is the default case necessary
has answer: http://stackoverflow.com/a/22510604
has comment: http://stackoverflow.com/comment/34249517
has body: I have a statement that goes like this: public $type function_name($enum e){ if(e != null) switch(e){ case A: return x1; case B: return x2; case C: return x3; //default: do some operations } // default or e = null do the exact same operations } My question is: given that the default case is treated in the rest of the method, is it necessary (in terms of good coding style) to add it to the switch statement (basically, duplicate the code for "if anything else happens" - in this case, default for switch, e = null, etc.)?
answer count: 4
tagged with: coding-style
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/22569907
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/22605689
has title: difference between c3p0 dataSourceName vs RegistryName?
answer count: 1
tagged with: c3p0
has body: I've got a jetty application using c3p0 connection pooling. I have a c3p0.properties file under WEB-INF/classes of my webapp As seen in the C3P0 configuration manual there are two different ways to name a C3P0 connection pool in JMX: - c3p0.dataSourceName=oneWayOfNamingThePool - com.mchange.v2.c3p0.management.RegistryName=anotherWayOfNamingThePool So my question is: what is the difference between these two properties?
tagged with: jetty
accepted answer: http://stackoverflow.com/a/22605689

http://stackoverflow.com/comment/40162856
score: 1
comment on: http://stackoverflow.com/q/22613423
has text: Late answer... extend RuntimeException ... Not Exception..
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22596489
type: Question
tagged with: hashmap
tagged with: concurrency
has comment: http://stackoverflow.com/comment/34403057
has comment: http://stackoverflow.com/comment/34403277
has body: CocncurrentHashMap provides a method to atomically check and add an element if it is not present via putIfAbsent method as shown in the example below xmlObject = new XMLObejct(xmlId); mapOfXMLs.putIfAbsent(xmlId, xmlObject); However my dilemma is that , I have to create that xmlObject in advance. Is there a way to postpone the object creation after the key present check. I want all three things below to happen atomically Check if the key present Create object if key is not present. Add the object to map. I know I can achieve this using synchronized block , If I am using a synchronized block , why use a CocurrentHashMap?
upvote count: 2
has comment: http://stackoverflow.com/comment/34405507
answer count: 3
has title: ConcurrentHashMap dilemma in Java
has answer: http://stackoverflow.com/a/22596713
has comment: http://stackoverflow.com/comment/34403539
favorite count: 0
has comment: http://stackoverflow.com/comment/34402929
has answer: http://stackoverflow.com/a/22596688
accepted answer: http://stackoverflow.com/a/22596688
has answer: http://stackoverflow.com/a/22645668
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34403514
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/22596713
has comment: http://stackoverflow.com/comment/34403242

http://stackoverflow.com/a/22528095
has comment: http://stackoverflow.com/comment/34281557
has body: In Access database the index starts from one, not zero. Identify the index of webservice first, it mary be two, try out the following statement System.out.println(rs.getString(2));
score: 0
answers question: http://stackoverflow.com/q/22527927
type: Answer
has comment: http://stackoverflow.com/comment/34280981
has comment: http://stackoverflow.com/comment/34280883

http://stackoverflow.com/comment/34437660
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22609633
score: 0
has text: I just verified it and the number of unique words is 13.190, so that's my vocabulary size

http://stackoverflow.com/a/22647788
type: Answer
answers question: http://stackoverflow.com/q/22647718
has body: If you use following : List&lt;String&gt; list = new LinkedList&lt;&gt;(); Then everywhere, in your code, you just using List&lt;String&gt; list. It means, that if you want use ArrayList, the only thing you have to do is to change one line : List&lt;String&gt; list = new ArrayList&lt;&gt;(); and it will work perfectly in all other code, no matter how complex it is. If you are using LinkedList, you can have huge problems with switching to something else.
score: 0

http://stackoverflow.com/comment/34283997
has text: @user2525364: Your Question makes no sense. If you do not know the range (starting and ending point), how do you want to know which numbers are inside this unknown range to get them all??
comment on: http://stackoverflow.com/a/22528974
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22530400
answer count: 3
has answer: http://stackoverflow.com/a/22530812
accepted answer: http://stackoverflow.com/a/22530812
has body: I'm trying to build a GUI which has a lot of buttons(JButton)/dropdown items (JMenuItem) and when each button containing letters is pressed the associated letter is being added to a label. I'm having trouble identifying which button was pressed.Can you please give me a tip on how to do this? Code: private void dodajCrko(java.awt.event.ActionEvent evt) { jlStatus.setText(jlStatus.getText() + evt.getSource()/* what to add here?*/); }
type: AnsweredQuestion
tagged with: user-interface
has answer: http://stackoverflow.com/a/22531138
type: Question
possible better answer: http://stackoverflow.com/a/22530571
has answer: http://stackoverflow.com/a/22530571
has title: Identifying which button was pressed
score: 0
tagged with: java

http://stackoverflow.com/comment/34223872
has text: Does the class that contains this code extend another class? If so, does that class have a `show()` method?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22495005

applet
tags question: http://stackoverflow.com/q/22575088
tags question: http://stackoverflow.com/q/22609487
tags question: http://stackoverflow.com/q/22639067
type: Tag
tags question: http://stackoverflow.com/q/22602366
tags question: http://stackoverflow.com/q/22565458
tag name: applet
tags question: http://stackoverflow.com/q/22512698
tags question: http://stackoverflow.com/q/22626553
tags question: http://stackoverflow.com/q/22604038
tags question: http://stackoverflow.com/q/22514136
tags question: http://stackoverflow.com/q/22494472
tags question: http://stackoverflow.com/q/22615577
tags question: http://stackoverflow.com/q/22548335
tags question: http://stackoverflow.com/q/22509626
tags question: http://stackoverflow.com/q/22548169
tags question: http://stackoverflow.com/q/22542297
tags question: http://stackoverflow.com/q/22539651
tags question: http://stackoverflow.com/q/22491017
tags question: http://stackoverflow.com/q/22568744
tags question: http://stackoverflow.com/q/22581100
tags question: http://stackoverflow.com/q/22527595
tags question: http://stackoverflow.com/q/22549261
tags question: http://stackoverflow.com/q/22628605
tags question: http://stackoverflow.com/q/22510424
tags question: http://stackoverflow.com/q/22496592
tags question: http://stackoverflow.com/q/22566642
tags question: http://stackoverflow.com/q/22491978
tags question: http://stackoverflow.com/q/22588293
tags question: http://stackoverflow.com/q/22619856
tags question: http://stackoverflow.com/q/22623542
tags question: http://stackoverflow.com/q/22594933
tags question: http://stackoverflow.com/q/22489398
tags question: http://stackoverflow.com/q/22514439
tags question: http://stackoverflow.com/q/22631685
tags question: http://stackoverflow.com/q/22500755

http://stackoverflow.com/q/22502624
has title: How to exclude class in TestNG
tagged with: http://stackoverflow.com/tag/xml
tagged with: testng
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I have a test suite called Test.XML. If I want to exclude any one class, how can I do that? Here is the Test.XML: <?xml version="1.0" encoding="UTF-8"?> <class name="test.LoginOneReports" /> <class name="test.OEPR_DefaultTab" /> <class name="test.OEPR_InternalvsExternalTab" />
has comment: http://stackoverflow.com/comment/34264095
has answer: http://stackoverflow.com/a/72014975
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/12157846
favorite count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/12157846
has answer: http://stackoverflow.com/a/22518362

http://stackoverflow.com/q/22563204
has answer: http://stackoverflow.com/a/22563397
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22563397
type: Question
tagged with: java
has title: Hadoop: Secondary sort does not work
tagged with: mapreduce
tagged with: hadoop
score: 0
answer count: 1
has body: I have implemented an algorithm in Hadoop 1.2.1, where reducer code relies on the secondary sorting. However, when I run the algorithm one reducer receives sorted tuples, but the other does not. I've spent a lot of time trying to figure out why, but without any success. Does anyone know what might be the problem? I assume it has to do with the secondary sort code. Here is the code that implements the secondary sorting: Composite key public class CompositeKey implements WritableComparable&lt;CompositeKey&gt;{ public String key; public Integer position; @Override public void readFields(DataInput arg0) throws IOException { key = WritableUtils.readString(arg0); position = arg0.readInt(); } @Override public void write(DataOutput arg0) throws IOException { WritableUtils.writeString(arg0, key); arg0.writeLong(position); } @Override public int compareTo(CompositeKey o) { int result = key.compareTo(o.key); if(0 == result) { result = position.compareTo(o.position); } return result; } } KeyComparator public class CompositeKeyComparator extends WritableComparator { protected CompositeKeyComparator() { super(CompositeKey.class, true); } @SuppressWarnings("rawtypes") @Override public int compare(WritableComparable w1, WritableComparable w2) { CompositeKey k1 = (CompositeKey)w1; CompositeKey k2 = (CompositeKey)w2; int result = k1.key.compareTo(k2.key); if(0 == result) { result = -1* k1.position.compareTo(k2.position); } return result; } } Grouping Comparator public class NaturalKeyGroupingComparator extends WritableComparator { protected NaturalKeyGroupingComparator() { super(CompositeKey.class, true); } @SuppressWarnings("rawtypes") @Override public int compare(WritableComparable w1, WritableComparable w2) { CompositeKey k1 = (CompositeKey)w1; CompositeKey k2 = (CompositeKey)w2; return k1.key.compareTo(k2.key); } } Partitioner public class NaturalKeyPartitioner extends Partitioner&lt;CompositeKey, ReduceValue&gt; { @Override public int getPartition(CompositeKey key, ReduceValue v…
tagged with: sorting

http://stackoverflow.com/comment/34302737
type: Comment
has text: If you have more than multiple constructors, can you post the getDeclaredConstructors() code? It seems to be returning only one constructor from your description.
type: AnswerComment
comment on: http://stackoverflow.com/a/22539877
score: 0

http://stackoverflow.com/comment/34296039
has text: when pause is set to false, your loop is equivalent to while(true){}. So if you call this in the main thread your application will freeze and nothing more could happen in your app
comment on: http://stackoverflow.com/q/22536338
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/22507998
linked to: http://stackoverflow.com/q/21817816
type: Question
has comment: http://stackoverflow.com/comment/34246576
has comment: http://stackoverflow.com/comment/34245756
tagged with: nio
tagged with: file-io
has comment: http://stackoverflow.com/comment/34245377
has comment: http://stackoverflow.com/comment/34357188
downvote count: 0
favorite count: 0
has title: Java NIO, FileLocks, and Readers
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34361850
has comment: http://stackoverflow.com/comment/34245231
has body: I want to read a text file but also acquire a file lock on the file. It seems the only way to get a file lock is by calling a method on the file channel. Now, I've seen BufferedReader, FileReader, and RandomAccessFile and only RandomAccessFile has a .getChannel() I was originally using that but I was told somewhere else I should try using the NIO stuff (and that RandomAccessFile wasn't NIO). So I switched to just using FileChannel and reading bytes in manually and this isn't working. Is using BufferedReader, FileReader, and RandomAccessFile still using the NIO things? Is there any way to acquire a lock on BufferedReader and FileReader? (And if it's not too much to ask, how does a Scanner fit in with these three? There seems like there's just so many ways to read a file and I'm not comprehending the differences)
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34245641
upvote count: 1

http://stackoverflow.com/a/22542546
has comment: http://stackoverflow.com/comment/34307159
has body: Instead of initializing it with new HashMap&lt;String, ?&gt;(); You can use diamond inference: protected Map&lt;String, ? extends Transaction&gt; transactions = new HashMap&lt;&gt;(); In that case the javacompiler will find out what to write at the constructor side itself.
has comment: http://stackoverflow.com/comment/34307139
score: 0
has comment: http://stackoverflow.com/comment/34307733
has comment: http://stackoverflow.com/comment/34307407
has comment: http://stackoverflow.com/comment/34307217
has comment: http://stackoverflow.com/comment/34307538
type: Answer
has comment: http://stackoverflow.com/comment/34307215
has comment: http://stackoverflow.com/comment/34307369
has comment: http://stackoverflow.com/comment/34307507
has comment: http://stackoverflow.com/comment/34308254
has comment: http://stackoverflow.com/comment/34307166
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22542487
has comment: http://stackoverflow.com/comment/34307334
has comment: http://stackoverflow.com/comment/34308133

http://stackoverflow.com/q/22531780
has comment: http://stackoverflow.com/comment/34287590
has comment: http://stackoverflow.com/comment/34287988
has comment: http://stackoverflow.com/comment/34287541
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/34288020
type: Question
has comment: http://stackoverflow.com/comment/34288166
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22532054
score: 2
has comment: http://stackoverflow.com/comment/34287852
has body: So eclipse cannot find the JVM. I have tried to change the eclipse.ini to include the jvm.dll and the javaw.exe where I am absolutely sure it included the right path. I have tried to change the environment variables to include the java.exe and the javaw.exe path but neither worked. I have also tried to reinstall eclipse and furthermore I have ensured I have a 64-bit installation of eclipse (and of course my computer is 64-bit) and the jre and the jdk are both 64-bit. What am I to do? EDIT: Path environment variable C:\WinAVR-20100110\bin;C:\WinAVR-20100110\utils\bin;C:\Program Files\Java\jre7\bin\java.exe;C:\Program Files\Java\jre7\bin\javaw.exe Eclipse.ini -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140116-2212 -product org.eclipse.epp.package.standard.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m -vm C:\Program Files\Java\jre7\bin\javaw.exe
answer count: 1
downvote count: 0
has title: Eclipse cannot find JVM
has comment: http://stackoverflow.com/comment/34287565
favorite count: 0
accepted answer: http://stackoverflow.com/a/22532054

http://stackoverflow.com/comment/34398977
type: Comment
comment on: http://stackoverflow.com/a/22594176
score: 0
type: AnswerComment
has text: how about two classes implement the same inteface which in turn makes the method concrete in a different way??doesn't it add to ambiguity??

http://stackoverflow.com/q/22516524
type: Question
accepted answer: http://stackoverflow.com/a/22517559
tagged with: ejb
score: 1
tagged with: java
has title: Execute manual Rollback in JTA environment in Stateless EJB
tagged with: jta
tagged with: jpa
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22517559
type: AnsweredQuestion
upvote count: 1
has body: I develope a registration function. A new user account will be created in the database, and after that a welcome email will be sent. The email sending function can execute a exeption. If a exception will be thrown the created user account has to be deleted. The problems is that my stateless bean rollbacks only if an unchecked exception will be thrown. My exception is a checked exception. Either I have to wrap in a unchecked exception, then I cant response with a proper http status code (using jax rs) or I have to execute a manual rollback. Can someone help and offer a better solution for my scenario? Thanks!

http://stackoverflow.com/q/22601655
has title: Creating generic scripts by importing test data
score: 0
has comment: http://stackoverflow.com/comment/34417470
has comment: http://stackoverflow.com/comment/34424717
tagged with: testng
type: UnansweredQuestion
has body: My supervisor wants me to import test data in test script. I don't understand what he exactly wants me to do. He said, I was creating scripts for a particular client's website, so next time I would need to replace many values in test script when I'm testing website of other client. I don't know how I can create .csv or excel file to import test data. :( I know nothing about it. I'm using TestNG, eclipse and webdriver. Thanks.
answer count: 0
tagged with: java
tagged with: selenium
tagged with: webdriver
type: Question

http://stackoverflow.com/comment/34401299
has text: Of course you can add any subtype of `Set<Notifiable>` to this data structure as I've said in my answer. Edited it to clarify the issue.
comment on: http://stackoverflow.com/a/22595485
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22495315
tagged with: java
has comment: http://stackoverflow.com/comment/34224139
has answer: http://stackoverflow.com/a/22495388
has comment: http://stackoverflow.com/comment/34224252
type: Question
tagged with: contains
tagged with: arrays
has comment: http://stackoverflow.com/comment/34224243
has answer: http://stackoverflow.com/a/22495436
score: 0
possible better answer: http://stackoverflow.com/a/22495392
has answer: http://stackoverflow.com/a/22495392
accepted answer: http://stackoverflow.com/a/22495388
has body: I know that arrays are only equal to each other if they share the same reference, but also that a deepEquals can check for the actual values' equality. If i have a list of arrays, such as List&lt;int[]&gt; visited, how can i use something similar to deepEquals to check to see if visited contains an array that i specify? ex: List&lt;int[]&gt; visited = new ArrayList&lt;int[]&gt;(); int[] myArray = {2, 1}; visited.add(myArray); int[] checkFor = {2, 1}; System.out.println(visited.contains(checkFor)); should print out true.
answer count: 4
tagged with: equals
has answer: http://stackoverflow.com/a/22495456
has comment: http://stackoverflow.com/comment/34224221
has title: java .contains() to look for an array
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8777257

http://stackoverflow.com/comment/34417767
type: QuestionComment
has text: Can you check the answers [here](http://stackoverflow.com/questions/11957673/scheduled-processes-running-twice-simultaneously-in-openbravo-using-quartz) and [here](http://stackoverflow.com/questions/7223108/quartz-job-runs-twice-when-deployed-on-tomcat-6-ubuntu-10-04lts)
comment on: http://stackoverflow.com/q/22604779
score: 0
type: Comment

http://stackoverflow.com/a/22613835
score: 0
has body: Add a . to your CLASSPATH environment value, that tells jvm to look current directory for the class. like: CLASSPATH=%CATALINA_HOME%\lib\servlet-api.jar;C:\Program Files\Java\jdk1.6.0_45\bin;.; or else follow @JB Nizet answer
type: Answer
answers question: http://stackoverflow.com/q/22612333

http://stackoverflow.com/q/22559148
has comment: http://stackoverflow.com/comment/34335363
type: UnansweredQuestion
has body: There is String.toLowerCase(Locale) method in java. There are some difficulties (some of them described here) that make result of this method not so obvious in case of languages like Greek and Turkish. The question is: are there any "specification" that would tell me the result of toLowerCase if I give it input string and Locale to be used? Are there tables like upper->lower digits, some rule to find it out or something else? Please don't advice just to compile/run code with some string. This is the question is about specification details (how must it work, not how does it work)
tagged with: java
has title: What must be toLowerCase(Locale) output?
type: Question
has comment: http://stackoverflow.com/comment/34369190
has answer: http://stackoverflow.com/a/22559689
score: 0
has comment: http://stackoverflow.com/comment/34375047
answer count: 1
tagged with: unicode

http://stackoverflow.com/a/22571319
accepted answer of: http://stackoverflow.com/q/22571278
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34358653
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34358389
has comment: http://stackoverflow.com/comment/34358094
has comment: http://stackoverflow.com/comment/34358289
has comment: http://stackoverflow.com/comment/34358917
has body: Your problem looks like it is here: public void attack(Fighter f) { this.health = this.health - power; health = health - this.power; } This should be public void attack(Fighter f) { this.health = this.health - f.power; f.health = f.health - this.power; }
score: 2
answers question: http://stackoverflow.com/q/22571278
downvote count: 0

http://stackoverflow.com/a/22624981
score: 0
has body: I use this for my InvalidateController: @Controller @RequestMapping("/invalidate") public class InvalidateController { @RequestMapping(method = RequestMethod.GET) public void showIndex(HttpServletResponse response) throws IOException { response.setStatus(299); response.getWriter().write("&lt;script&gt; window.location.href = '/login.jsp'&lt;/script&gt;"); } } and all my javascript ajax (jQuery) calls check for status 299, then redirects to the login page if the session has timed out. From my understanding 299 still is in the range of a successful call (200-299), but is unused, so it is safe to use as you see fit.
has comment: http://stackoverflow.com/comment/34454416
has comment: http://stackoverflow.com/comment/34455073
answers question: http://stackoverflow.com/q/22624931
type: Answer
has comment: http://stackoverflow.com/comment/34454660
has comment: http://stackoverflow.com/comment/34721887
has comment: http://stackoverflow.com/comment/34476177

http://stackoverflow.com/a/22493696
has comment: http://stackoverflow.com/comment/34222427
accepted answer of: http://stackoverflow.com/q/22493247
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22493247
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34222005
has body: This is the old generic invariance rearing its head again. For each call to Create, the types are inferred as: &lt;String, Class&lt;Type1&gt;&gt; &lt;String, Class&lt;Type2&gt;&gt; &lt;String, Class&lt;Type3&gt;&gt; As you may know, a List&lt;Dog&gt; is not a List&lt;Animal&gt; and the same concept applies here. A Tuple2&lt;String, Class&lt;Type1&gt;&gt; is not a Tuple2&lt;String, Class&lt;?&gt;&gt; but it is a Tuple2&lt;String, ? extends Class&lt;?&gt;&gt;. So for the three inferred Tuple2 types: Tuple2&lt;String, Class&lt;Type1&gt;&gt; Tuple2&lt;String, Class&lt;Type2&gt;&gt; Tuple2&lt;String, Class&lt;Type3&gt;&gt; The type they have in common is Tuple2&lt;String, ? extends Class&lt;? extends Type1&gt;&gt;. As far as I know the only way around this is to supply a type witness for each call: final List&lt;Tuple2&lt;String, Class&lt;?&gt;&gt;&gt; list = Arrays.asList( Tuple2.&lt;String, Class&lt;?&gt;&gt;Create("1", Type1.class), Tuple2.&lt;String, Class&lt;?&gt;&gt;Create("2", Type2.class), Tuple2.&lt;String, Class&lt;?&gt;&gt;Create("3", Type3.class) ); That should work. It seems like this should work: final List&lt;Tuple2&lt;String, Class&lt;?&gt;&gt;&gt; list = Arrays.asList( Tuple2.Create("1", (Class&lt;?&gt;)Type1.class), Tuple2.Create("2", (Class&lt;?&gt;)Type2.class), Tuple2.Create("3", (Class&lt;?&gt;)Type3.class) ); But it doesn't compile. The compiler does capture conversion and infers the Class&lt;?&gt; as Class&lt;capture of ?&gt;. So the inferred types you end up with are something like: &lt;String, Class&lt;capture #1 of ?&gt;&gt; &lt;String, Class&lt;capture #2 of ?&gt;&gt; &lt;String, Class&lt;capture #3 of ?&gt;&gt; And still three distinct types from each other. I will be honest: I have no idea why it works that way, just that it does. I have been unable to find a definitive answer to that. The spec says this: If Ti is a wildcard type argument [...] of the form ?, then Si is a fresh type variable [...]. Which seems to imply that capture of ? is c…
score: 1

http://stackoverflow.com/q/22512108
upvote count: 3
tagged with: spring
has answer: http://stackoverflow.com/a/22513767
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34253416
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22513789
tagged with: session
downvote count: 0
possible better answer: http://stackoverflow.com/a/22513767
tagged with: spring-security
favorite count: 0
answer count: 3
has body: Hi i need to intercept the expire of a session in my web-application. I would intercept it because I want get a session attribute, and store it before destroy the session. It is possible?? Can you give me any suggest about it?? Thank you!
has title: How intercept end of session and get attribute?
has answer: http://stackoverflow.com/a/22514019
accepted answer: http://stackoverflow.com/a/22514019

http://stackoverflow.com/comment/34387850
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22587990
has text: Yes this exactly where I made mistakes! This is a rather complicated application and it got many interfaces. I just forgot that there was an interface for `User` too. Thank you so much!
type: AnswerComment

http://stackoverflow.com/a/22778580
type: Answer
upvote count: 1
downvote count: 1
score: 0
has body: First you have to check your XML files are valid or not. Step1 If you are using NetBeans IDE just right click on XML file in your project and select validate Step2 If xml files don't have any error the open your project location and delete the build.xml file and redeploy the application again. It may be helpful to you. All the best
answers question: http://stackoverflow.com/q/22573787

http://stackoverflow.com/a/22556734
type: Answer
answers question: http://stackoverflow.com/q/22556420
has body: You should provide argument in your function. It seems that you have added emailID element as many times as you call sendEmail() function. Every time you call the function, you should clean your emailIDs or you just need to send email to the last element. Here I send only one recipient: public void sendEmail(String emailID){ System.out.println("called "+j+" time"); emailIDs.add(emailID); to = emailID; MimeMessage message = new MimeMessage(session1); // Set From: header field of the header. try{ message.setFrom(new InternetAddress(from)); // Set To: header field of the header. message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); // Set Subject: header field message.setSubject(notifyName[j]+" "+"Document Alert Mail!"); // Send the actual HTML message, as big as you like message.setContent(" document created on "+createdOn+" is coming to expire ", "text/html" ); // Send message Transport.send(message); System.out.println("Message Sent Successfully...."); } catch(Exception e){ e.printStackTrace(); } }
score: 0

http://stackoverflow.com/comment/34410444
type: QuestionComment
comment on: http://stackoverflow.com/q/22600250
has text: How about uninstall your app and re-install again when your table change? (instead of changing DATABASE_VERSION)..I think that may work too..
score: 0
type: Comment

http://stackoverflow.com/a/22631617
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22582904
answers question: http://stackoverflow.com/q/22582904
type: Answer
upvote count: 3
score: 3
has body: The approach you're taking is absolutely fine. However it looks to me like the original graphic is already fuzzy - I daresay it has been a JPG at some point in its life. Note in particular that the edges to the black borders are anti-aliased - they should be black pixels and white pixels but no grey ones. I believe the rotation algorithm uses sampling to produce the output - this sampling algorithm is interacting with the fuzzy edge producing the undesirable visual artefacts. I bet it will be great if you try again with a sharp original. There is one more thing to consider: Using a small bitmap and upscaling with rotation. This might go against the advice of other responders, but bear with me for a minute. The typical scaling algorithm used is typically bi-linear interpolation - it's great for photos but pixelated images look horribly soft. However there are a few other algorithms - go to Wiki: Image Scaling and look at the hqx. This is an example of bi-linear vs. HQX in the game space: If this is acceptable, then we have to go to OpenGL, because the Android Canvas and Bitmap functions don't support these algorithms. Potentially a lot of work, but maybe worth your while.

http://stackoverflow.com/comment/34224349
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22494957
has text: Solved by "sudo cp $JAVA_HOME/lib/tools.jar /Library/Java/Extensions/" - I'll answer the question and thank you formally once 8hrs has passed

http://stackoverflow.com/comment/34492354
comment on: http://stackoverflow.com/a/22646454
type: AnswerComment
has text: I cannot code it like this because I do not know how many elemnts are in p[], so I wouldnt know how many else(if) brackets I need. what I know is that I have n elements and their probability add up to 100%. I also know their individual probability
type: Comment
score: 0

http://stackoverflow.com/q/22513525
linked to: http://stackoverflow.com/q/5202927
has title: .hgignore 'target' folder with some exceptions
linked to: http://stackoverflow.com/q/1512058
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34263516
tagged with: java
type: Question
answer count: 1
tagged with: hgignore
favorite count: 0
upvote count: 3
has body: I use Mercurial and have standard Maven layout for my project with several submodules, e.g.: submodule1/src/main/java/xyz/.../ submodule1/src/main/java/xyz/.../target/Target.java submodule1/src/test/java/xyz/.../target/TargetTest.java submodule1/target/classes/xyz/.../target/Target.class submodule1/target/something_else... submodule2/... etc... To exclude all target folders from SCM, except when target is under src, e.g., submodule1/src/main/java/xyz/.../target/Target.java, I tried the following .hgignores: syntax: regexp ^(?!(/src/).)/target$ (don't match if any folder is named src, but match if there is target folder) and syntax: regexp ^[^/]*/(?!(/src/).)*[^/]*/target$ (some folders, don't match if any folder is named src, then some other folders, then target folder). But both of these .hgignores don't work, the submodule1/src/main/java/xyz/.../target folder is still excluded, along with the other target folders. Previously, I solved this with ignoring only the target located directly in the submodule folder, e.g. syntax: regexp ^submodule1/target$ but there are too many submodules, and this requires editing .hgignore each time a submodule is added. I got the ideas for regexp syntax from .hgignore file is not ignoring the maven target/site directory and hgignore: help ignoring all files but certain ones. P.S. I know that I can hg add the files excluded by .hgignore, and I've done just that. But this is a temporary measure.
tagged with: mercurial
tagged with: regex
has answer: http://stackoverflow.com/a/22514544
accepted answer: http://stackoverflow.com/a/22514544
downvote count: 0

http://stackoverflow.com/comment/34492549
comment on: http://stackoverflow.com/q/22646371
has text: @JasonC I did what you said using JOption and what happens is that it pops up as soon as someone wins, however, after I press okay, the same message continues to pop up until the end of the loop.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22629168
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34466540
score: 3
has body: The best approach is to define JDBC datastore in tomcat and then look it up in your web application. Following samples are shamelessly copied from tomcat documentation. This way you do not have any passwords in your applicaion. The configuration is done by tomcat administrator, not by web application developer. Context: <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="javauser" password="javadude" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/javatest"/> web.xml DB Connection jdbc/TestDB javax.sql.DataSource Container test.jsp <sql:query var="rs" dataSource="jdbc/TestDB"> select id, foo, bar from testdata </sql:query> servlet Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/TestDB"); Connection conn = ds.getConnection(); Regarding your security requirements: this is harder, because the password is plaintext there as well. You can limit access rights so only web container can read it. Encrypting password will not work with symmetrical ciphers because attacker can get them as well. And asymmetrical ciphers - he can get decode key too. So you must set up the environment that attacker will not see content of the configuration files. If he is root, everything is lost anyway.
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22627515
answers question: http://stackoverflow.com/q/22627515

http://stackoverflow.com/comment/34399846
score: 1
comment on: http://stackoverflow.com/q/22594826
has text: You need to tell us specifically what isn't working and what you're expecting instead.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34315903
has text: Swing is event-driven, when do you want this? When a button is pressed?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22547244
score: 0

http://stackoverflow.com/comment/34230261
score: 1
has text: Show a minimal example replicating the situation that you are trying to describe, highlighting the creation of all involved objects, and the situations where you do or do not want mutability.
comment on: http://stackoverflow.com/q/22499200
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34252891
type: Comment
has text: thanks.. tried that and the length of the argument is 0... dont know why.. that's where I'm stuck at
comment on: http://stackoverflow.com/a/22512092
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34382706
type: Comment
comment on: http://stackoverflow.com/a/22584454
has text: What is your test trying to assert?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34404337
comment on: http://stackoverflow.com/q/22595234
score: 0
type: Comment
type: QuestionComment
has text: @radiodef, I mean is the difference between a variable which is declared with the wildcard and the one without?

http://stackoverflow.com/a/22611427
has comment: http://stackoverflow.com/comment/34429361
has comment: http://stackoverflow.com/comment/34430873
has comment: http://stackoverflow.com/comment/34430757
has body: Just store the indexes instead of the values: if (rainfall[i] &gt; rainfall[max]) max = i; else if (rainfall[i] &lt; rainfall[min]) min = i; System.out.println("Max quarter rainfall = " + max + 1); System.out.println("Min quarter rainfall = " + min + 1);
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22611283
has comment: http://stackoverflow.com/comment/34429529

http://stackoverflow.com/comment/34314956
type: QuestionComment
has text: why classes? i want to place the compiled files in bin and not in classes.
score: 0
comment on: http://stackoverflow.com/q/22546579
type: Comment

http://stackoverflow.com/q/22528099
has title: "The command line is too long" -- when running maven test
has comment: http://stackoverflow.com/comment/34281494
has comment: http://stackoverflow.com/comment/34280859
tagged with: maven
has comment: http://stackoverflow.com/comment/34285741
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22531303
tagged with: java
linked to: http://stackoverflow.com/q/8181098
type: Question
tagged with: gwt
score: 4
upvote count: 4
accepted answer: http://stackoverflow.com/a/22531303
has body: Running $mvn test on a 64-bit Windows gives me the following error, even if I do $mvn test -Dgwt.genParam=false: The command line is too long
answer count: 1
downvote count: 0
favorite count: 0
tagged with: windows64

http://stackoverflow.com/comment/34286887
type: Comment
comment on: http://stackoverflow.com/a/22530525
type: AnswerComment
has text: @user3145373ツ: A separate method, which takes a collection of `DateFormat` items and tries each one in turn, returning the `Date` from the first successful parse.
score: 0

wamp
tag name: wamp
tags question: http://stackoverflow.com/q/22572597
type: Tag

http://stackoverflow.com/comment/34218130
comment on: http://stackoverflow.com/q/22490988
type: Comment
type: QuestionComment
has text: Sure, Look at the main method class: I'd it to sort where Employee objects have the parameters (String, integer, "Accounting") and sort the Employee objects that have the parameters (String,integer,"Information Systems"). I do not want to sort the other objects that have "Marketing" or "Human Resources" as the last parameter.
score: 0

http://stackoverflow.com/a/22595555
answers question: http://stackoverflow.com/q/22595306
type: Answer
has comment: http://stackoverflow.com/comment/34402297
has comment: http://stackoverflow.com/comment/34401240
score: 0
has body: Well, there's a lot you should change here: Graphics in games is seldom done using components. Remember that components carry a lot of weight with them (e.g. UI delegate, listeners, peer, etc.). What you should do is to create a single custom component which will act as a game board. This component's paint methods will paint to images of spaceships. This will also get rid of the flickering (invoke setDoubleBuffered(true) on that component) The location of the ships should be changed independently of the painting, i.e. the location should be calculated and kept in member variables, and the painting should happen according to swing's painting manager's will. However, you can still enforce more rigorous painting by using paintImmediately(...) to paint the images of the ships whenever they move There's no way (at least not that I'm aware of) to handle two keyboards or anything of the kind. If you want 2 users playing at once, they should use the same keyboard, and you should have 2 separate (and hopefully distant) sets of keys, one for each player. Just like in the old days :-)

http://stackoverflow.com/comment/34410632
score: 0
comment on: http://stackoverflow.com/q/22600736
type: Comment
type: QuestionComment
has text: `indexOf()` doesn't throw a `NullPointerException`.

http://stackoverflow.com/a/22566536
has comment: http://stackoverflow.com/comment/34348619
score: 0
has comment: http://stackoverflow.com/comment/34348880
answers question: http://stackoverflow.com/q/22566503
type: Answer
has body: Once you find the term you need to remove it from String under process so that it won't resolve the same again, use indexOf() and substring() , you don't need to do contains check length times

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/22605414
tags question: http://stackoverflow.com/q/22550456
tags question: http://stackoverflow.com/q/22611807
tag name: csv
tags question: http://stackoverflow.com/q/22526679
tags question: http://stackoverflow.com/q/22598550
tags question: http://stackoverflow.com/q/22535694
tags question: http://stackoverflow.com/q/22509242
tags question: http://stackoverflow.com/q/22627625
tags question: http://stackoverflow.com/q/22627415
tags question: http://stackoverflow.com/q/22549555
tags question: http://stackoverflow.com/q/22639175
tags question: http://stackoverflow.com/q/22503391

http://stackoverflow.com/comment/34327864
type: QuestionComment
comment on: http://stackoverflow.com/q/22535299
score: 0
has text: How do you do that if it has been answered in the comments? there appears to be no tick next to these things!
type: Comment

http://stackoverflow.com/comment/34278991
type: AnswerComment
comment on: http://stackoverflow.com/a/22526693
score: 0
type: Comment
has text: use chrome inspector or firebug, to see if your actually going a POST or partial POST back to the server under network section - this will tell you if you're even doing anything and awaiting a response. It may be bean name related etc..

http://stackoverflow.com/a/22531134
has comment: http://stackoverflow.com/comment/34286599
has comment: http://stackoverflow.com/comment/34286498
has comment: http://stackoverflow.com/comment/34286879
has body: Do it manually. public byte[] intToBytes(int i) { return new byte[] { (byte)(i &gt;&gt; 24), (byte)(i &gt;&gt; 16), (byte)(i &gt;&gt; 8), (byte)i, }; } Edit: In the Java language, endianness does not exist. It only matters when you try to convert an int to a byte, and in that case, it's just how your conversion function works - not part of Java itself. Some of the standard library classes use such conversion functions, and therefore have endianness, though - like NIO buffers and DataOutputStream.
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/34286807
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/22531064

http://stackoverflow.com/comment/34327576
type: QuestionComment
has text: @Parthe That's exactly what he told you two hours ago in the very first comment here.
score: 0
comment on: http://stackoverflow.com/q/22552148
type: Comment

http://stackoverflow.com/comment/34261119
type: AnswerComment
score: 0
type: Comment
has text: I respect everyones opinion about regex (good or bad), as it is at the very least dificult thing to do right at times. Cheers.
comment on: http://stackoverflow.com/a/22515872

http://stackoverflow.com/a/50323812
score: 1
has body: I use a JSR223 sampler with Groovy to register new parameters. Make sure to put the JSR223 sampler in a Only Once Controller, so it is ran only once (per thread). I have in the test plan all variables registered for all environments like this: TEST.user = 123 TEST.url = test.mysite.com LOAD.user = 435 LOAD.url = load.mysite.com Then I specify which environment I want to select with a command line parameter at startup like: -Denvironment=TEST My JSR223 script will add new variables to the test, without the TEST. prefix. In my scripts I just reference ${user} This is the script to use: JMeterVariables jmv = new JMeterVariables(); for (Map.Entry item : vars.entrySet()) { if (item.getKey().startsWith(env)) { String keyname = item.getKey().substring(env.length()+1); String origval = vars.get(keyname); if (origval==null || (origval.equals("") &amp;&amp; !item.getValue().equals(""))) { jmv.put(keyname, item.getValue()); } } } if (!jmv.entrySet().isEmpty()) { vars.putAll(jmv); }
upvote count: 1
answers question: http://stackoverflow.com/q/22509990
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34350485
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22567058
has text: can you show your entire xml spring configuration and some of the code you're referring to?

http://stackoverflow.com/q/22564085
tagged with: mnemonics
tagged with: disassembly
favorite count: 0
has answer: http://stackoverflow.com/a/22564461
accepted answer: http://stackoverflow.com/a/22564459
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22564459
type: Question
has title: Missing instruction numbers in javap output
answer count: 2
tagged with: bytecode
possible better answer: http://stackoverflow.com/a/22564461
score: 4
tagged with: javap
has body: Every time I try to understand disassembled code of a compiled Java file, I wondered why some instruction numbers are missing. A small example: I disassembled ($ javap -c HelloWorld) a simple HelloWorld class. Here is the output: Compiled from "HelloWorld.java" public class HelloWorld { public HelloWorld(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."&lt;init&gt;":()V 4: return public static void main(java.lang.String[]); Code: 0: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #3 // String Hello World! 5: invokevirtual #4 // Method java/io/PrintStream.println:(Ljava/lang/String;)V 8: return } As you can see, instructions 3 and 4 in the constructor and some in the main method are missing. Does someone know why these instruction numbers are missing? Are there some bytecode instructions that are hidden for some reason?

http://stackoverflow.com/comment/34364287
has text: I think i got it now.. ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22574828

http://stackoverflow.com/comment/34275581
type: Comment
type: QuestionComment
has text: @WhoAmI: I'll have to try that!
score: 0
comment on: http://stackoverflow.com/q/22524687

http://stackoverflow.com/a/22622303
accepted answer of: http://stackoverflow.com/q/22621981
has comment: http://stackoverflow.com/comment/34457567
answers question: http://stackoverflow.com/q/22621981
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34481491
has comment: http://stackoverflow.com/comment/34503318
has body: I don't see why you'd want more than two threads here. If you want to process request one by one, you might spawn just one thread that just listens the requests and immediately responds to it by sending a "processing" or a "check back later" message. (call this a listener thread) if a client is sent a "processing" response the connection is kept alive and another thread is spawned that responds to the client with the actual processed result of request. (call this a processing thread). You could make the listener thread send a keep alive message to the client in queue or you could ask it to check back after a set period of time with a request. You could make the listener thread more sophisticated by setting up queues to decide when to subsequently respond to clients who were sent "check back later" message From implementation POV, your main thread could be your listener thread and it could spawn a processing thread when it's time to process a request.
upvote count: 1
type: AcceptedAnswer

exception
tags question: http://stackoverflow.com/q/22500807
tags question: http://stackoverflow.com/q/22584087
tags question: http://stackoverflow.com/q/22610768
tags question: http://stackoverflow.com/q/22620271
tags question: http://stackoverflow.com/q/22488856
tags question: http://stackoverflow.com/q/22496259
tags question: http://stackoverflow.com/q/22603228
tags question: http://stackoverflow.com/q/22583672
tags question: http://stackoverflow.com/q/22606401
tags question: http://stackoverflow.com/q/22598754
tags question: http://stackoverflow.com/q/22576134
tags question: http://stackoverflow.com/q/22543676
tags question: http://stackoverflow.com/q/22556344
tags question: http://stackoverflow.com/q/22539763
tags question: http://stackoverflow.com/q/22510851
tags question: http://stackoverflow.com/q/22553688
tags question: http://stackoverflow.com/q/22613423
tags question: http://stackoverflow.com/q/22576068
tags question: http://stackoverflow.com/q/22609779
tags question: http://stackoverflow.com/q/22488197
tags question: http://stackoverflow.com/q/22506320
tags question: http://stackoverflow.com/q/22498065
type: Tag
tags question: http://stackoverflow.com/q/22606597
tags question: http://stackoverflow.com/q/22631431
tags question: http://stackoverflow.com/q/22503275
tags question: http://stackoverflow.com/q/22555855
tags question: http://stackoverflow.com/q/22578556
tags question: http://stackoverflow.com/q/22590148
tags question: http://stackoverflow.com/q/22492159
tags question: http://stackoverflow.com/q/22525162
tags question: http://stackoverflow.com/q/22539525
tags question: http://stackoverflow.com/q/22494255
tags question: http://stackoverflow.com/q/22614515
tags question: http://stackoverflow.com/q/22584574
tags question: http://stackoverflow.com/q/22576409
tags question: http://stackoverflow.com/q/22560343
tags question: http://stackoverflow.com/q/22564308
tags question: http://stackoverflow.com/q/22594777
tags question: http://stackoverflow.com/q/22608835
tags question: http://stackoverflow.com/q/22504212
tags question: http://stackoverflow.com/q/22490854
tags question: http://stackoverflow.com/q/22538713
tags question: http://stackoverflow.com/q/22646156
tag name: exception
tags question: http://stackoverflow.com/q/22540954
tags question: http://stackoverflow.com/q/22628448
tags question: http://stackoverflow.com/q/22545427
tags question: http://stackoverflow.com/q/22509890
tags question: http://stackoverflow.com/q/22497349
tags question: http://stackoverflow.com/q/22513697
tags question: http://stackoverflow.com/q/22646930
tags question: http://stackoverflow.com/q/22566891

http://stackoverflow.com/comment/34451547
type: Comment
type: QuestionComment
has text: Hmmm, then either the JSON is out of order, or their implementation of `readValue` has the side effect of not always remaining in order. Clearly you do need them to remain in order, but aside from writing a custom deserializer, I don't think there's a way to overcome this. I used the GSON library for my deserialization and it was pretty easy to write deserializers. Not really sure if you have the option of trying a different library (it depends how much code you've written)
score: 1
comment on: http://stackoverflow.com/q/22623126

http://stackoverflow.com/comment/34401667
has text: @nachokk I'll re-edit it. All done!
score: 0
comment on: http://stackoverflow.com/q/22595761
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34490776
type: Comment
comment on: http://stackoverflow.com/q/22645651
score: 9
type: QuestionComment
has text: Why are you using `String` for image data? Why not a byte array?

http://stackoverflow.com/comment/74021433
type: Comment
score: 0
type: AnswerComment
has text: This is very nearly jibberish. Try re-writing your answer.
comment on: http://stackoverflow.com/a/43482342

http://stackoverflow.com/a/22519977
has comment: http://stackoverflow.com/comment/34295515
has comment: http://stackoverflow.com/comment/34267176
answers question: http://stackoverflow.com/q/22519757
has comment: http://stackoverflow.com/comment/34267507
has comment: http://stackoverflow.com/comment/34267217
has comment: http://stackoverflow.com/comment/34267308
score: 0
has body: Close. It looks like your get/setBackground(selected) should be referencing the colorBar component JComponent colorBar = new ColorComponent(Color.BLACK); colorBar.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { Color defaultColor = colorBar.getBackground(); Color selected = JColorChooser.showDialog(DessinFrame.this, "Set background", defaultColor); if (selected != null) colorBar.setBackground(selected); } });
has comment: http://stackoverflow.com/comment/34267450
type: Answer

http://stackoverflow.com/a/31342320
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22491177
has body: You can try to use the following in your context.xml: &lt;Manager className="org.apache.catalina.session.PersistentManager" maxIdleBackup="10"&gt; &lt;Store className="org.apache.catalina.session.JDBCStore" connectionURL="jdbc:oracle:thin:USERNAME/PASSWORD@//HOSTNAME/SID" driverName="oracle.jdbc.driver.OracleDriver" sessionAppCol="app_name" sessionDataCol="session_data" sessionIdCol="session_id" sessionLastAccessedCol="last_access" sessionMaxInactiveCol="max_inactive" sessionTable="tomcat_sessions" sessionValidCol="valid_session" /&gt; &lt;/Manager&gt; Make sure to replace the values in the connectionURL attribute, and to add the Oracle JDBC driver (ojdbc6.jar) to your tomcat's lib directory.

http://stackoverflow.com/comment/34244246
type: QuestionComment
has text: Almost (but not quite) a duplicate of http://stackoverflow.com/questions/10092926/verifying-sequence-of-private-method-calls-in-unit-testing
score: 0
comment on: http://stackoverflow.com/q/22507447
type: Comment

http://stackoverflow.com/comment/34212406
comment on: http://stackoverflow.com/q/22488402
has text: @user2494817 could you elaborate
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22571085
has answer: http://stackoverflow.com/a/22571111
tagged with: compareto
score: 0
tagged with: java
has title: Cannot find symbol error (calling a method)
accepted answer: http://stackoverflow.com/a/22571111
type: Question
type: AnsweredQuestion
tagged with: compiler-errors
has body: The error i have is Error:cannot find symbol symbol: variable compareTo location:variable tim of type Time The code where the error happens is public String difference(Time tim) { if(tim.compareTo==1) { tim.minute = 0; } //other code } and my compareTo is public int compareTo(Object other) { if (((Time)other).getHour()&lt;hour) { return 1; } //and other code that repeat for return -1 and 0 }
answer count: 1

http://stackoverflow.com/q/22601660
has title: Java 8 Lambda specify map type and make it unmodifiable
has answer: http://stackoverflow.com/a/22601682
answer count: 1
favorite count: 0
tagged with: lambda
tagged with: java-8
accepted answer: http://stackoverflow.com/a/22601682
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
downvote count: 0
score: 4
has body: I have the following code, which produces months using lambdas. Map&lt;Integer, String&gt; tempMap = new LinkedHashMap&lt;&gt;(); EnumSet.allOf(Month.class).forEach(m -&gt; { String formattedMonth = DateTimeFormatter.ofPattern("MMM").format(m); tempMap.put(m.getValue(), formattedMonth); }); MONTHS_MAP = Collections.unmodifiableMap(tempMap); I was wondering if this can be improved to perform all of these at one shot using lambdas? return EnumSet.allOf(Month.class).stream() .collect(Collectors.collectingAndThen(Collectors.toMap( Month::getValue, m -&gt; DateTimeFormatter.ofPattern("MMM").format(m) ), Collections::unmodifiableMap)); This doesn't work. Where do I specify that I would like to use a LinkedHashMap?

http://stackoverflow.com/comment/34312274
comment on: http://stackoverflow.com/a/22545103
score: 0
type: AnswerComment
has text: yes. i did that. then i tried with both checked & unchecked in order n export. no LUCK yet.
type: Comment

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/22602432
type: Tag

http://stackoverflow.com/q/22535939
has answer: http://stackoverflow.com/a/22588185
possible better answer: http://stackoverflow.com/a/22536261
has answer: http://stackoverflow.com/a/22536261
tagged with: cdi
tagged with: maven
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22588185
has comment: http://stackoverflow.com/comment/34295174
tagged with: java
tagged with: jboss
type: Question
tagged with: jakarta-ee
has body: I'm trying to add maven filtering to a project i'm working on, but after I build the project with filtering on, all of the injected beans are null. Here is the addition to the pom: ... ${basedir}/build.properties ${basedir}/misc/jboss true ${basedir}/filtered manager.properties ${basedir}/misc/jboss false ${basedir}/filtered *.jar *.keystore *.xml ... I notice that the beans.xml file is missing from the .war file. I don't understand why the beans.xml is missing, since I'm only applying the filering on a specific directory ${basedir}/misc/jboss ... When I remove the above from the pom everything is working again. Any ideas?
has title: cdi not working when using maven filters
has comment: http://stackoverflow.com/comment/34295513
score: 0
answer count: 2

http://stackoverflow.com/q/22545427
tagged with: exception
has body: Code: public class ProductsActivity extends Activity { DbHelper db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_products); db = new DbHelper(getApplicationContext()); Intent intent = getIntent(); String listName = intent.getExtras().getString("position"); List&lt;Products&gt; listOfProducts = db.getAllProductsByList(listName); List&lt;String&gt; stringListOfProducts = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; listOfProducts.size(); i++) stringListOfProducts.add(listOfProducts.get(i).getProductName()); ArrayAdapter&lt;String&gt; myArrayAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, stringListOfProducts); ListView lv = (ListView) findViewById(R.id.listView2); lv.setAdapter(myArrayAdapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.products, menu); return true; } } Error: I'm getting an error on line 37 lv.setAdapter(myArrayAdapter); I have another project which does everything exactly the same and that works fine!
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34312336
answer count: 0
tagged with: java
has title: NullPointerExceptions, can't figure this one out
has comment: http://stackoverflow.com/comment/34312410
has comment: http://stackoverflow.com/comment/34312427
type: Question
score: 0

http://stackoverflow.com/a/22600252
type: Answer
has body: The value of MYKEY is "hi".So you'd better use "hi" to get session param in the next page .
score: 0
answers question: http://stackoverflow.com/q/22599868

http://stackoverflow.com/q/22559224
tagged with: comparator
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22559789
favorite count: 0
has comment: http://stackoverflow.com/comment/34336335
has comment: http://stackoverflow.com/comment/34336047
has comment: http://stackoverflow.com/comment/34336872
has comment: http://stackoverflow.com/comment/34341321
tagged with: dictionary
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34335318
score: 1
has comment: http://stackoverflow.com/comment/34335944
has comment: http://stackoverflow.com/comment/34335494
tagged with: java
has comment: http://stackoverflow.com/comment/34336019
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22559789
has title: Parsing a text file, based on words count
has comment: http://stackoverflow.com/comment/34335350
has comment: http://stackoverflow.com/comment/34338843
has comment: http://stackoverflow.com/comment/34335603
has body: I'm having trouble parsing a given text file based on words count frequency. Everything is happening accordingly except ordering, based on words count. My Approach Parsing the text file Splitting &amp; Storing every words in a String Array passed array will have the count for every unique word and passed to Map and Map will sort this based on Value Here is the code: public class TestApp { public static void main(String[] args) throws IOException { String Line = null; Map&lt;String, Integer&gt; finalMap = new HashMap&lt;String, Integer&gt;(); FileParser parser = new FileParser(); Reader fileReader = new FileReader("E:\\21350.txt"); BufferedReader bufferReader = new BufferedReader(fileReader); while ((Line = bufferReader.readLine()) != null) { String[] str = Line.split("\\s"); finalMap = parser.parseFile(str); } // new TestApp().showEntry(finalMap); // Before parser.sortByValue(finalMap); new TestApp().showEntry(finalMap); // After bufferReader.close(); } public void showEntry(Map&lt;String, Integer&gt; map) { for (Map.Entry&lt;String, Integer&gt; entry : map.entrySet()) { System.out.println(entry.getKey() + " --&gt; " + entry.getValue()); } } } public class FileParser { Map&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;(); public Map&lt;String, Integer&gt; parseFile(String[] strArray) { for (String key : strArray) { int counter = 1; if (map.containsKey(key)) map.put(key, map.get(key) + 1); else map.put(key, counter); } return map; } public Map&lt;String, Integer&gt; sortByValue(Map&lt;String, Integer&gt; map) { List list = new LinkedList(map.entrySet()); Collections.sort(list, new Comparator() { public int compare(Object o1, Object o2) { int x = (Integer) ((Map.Entry) o1).getValue(); int y = (Integer) ((Map.Entry) o2).getValue(); if (x &gt; y) return -1; else if (x &lt; y) return 1; else return 0; } }); Map&lt;String, Integer&gt; result = new LinkedHashMap&lt;String, Integer&gt;(); Iterator it = list.iterator(); while (it.hasNext()) { Map.Entry&lt;St…
tagged with: sorting

http://stackoverflow.com/comment/38667553
type: Comment
type: QuestionComment
has text: @Jatin I have no idea if this was the problem but when running this, I only added `capture = true` and some output statements and it seems to work now. [Here is the class](http://pastebin.com/2fLuf9tc) because it shows the main method too. I am not sure if I was just being stupid and not setting captured to true or if it was something else because the main class has expired on hastebin.
comment on: http://stackoverflow.com/q/22579601
score: 0

http://stackoverflow.com/comment/34321317
comment on: http://stackoverflow.com/a/22539095
score: 0
type: AnswerComment
has text: thanx for reply..but before logout when session is alive, then before every action it should go and check user inside intercepter class,whether its null or not,its not going inside my intercepter class.
type: Comment

http://stackoverflow.com/q/22559349
tagged with: key
tagged with: keystore
has answer: http://stackoverflow.com/a/22559996
score: 0
tagged with: java
has title: Get all aliases from KeyManagers without knowing the key type
type: AnsweredQuestion
tagged with: ssl
accepted answer: http://stackoverflow.com/a/22559996
has comment: http://stackoverflow.com/comment/34336748
type: Question
has body: I've a KeyManager array and I need to get all aliases from it. So I was going to call the method String[] getClientAliases(String keyType, Principal[] issuers) of X509KeyManager interface where I put null for issuers but I don't know what I should put as keyType, since I've any information about that. Just for information, I'm doing that to build a KeyStore object from KeyManager[] array. After getting all aliases, for each alias I call getCertificateChain and getPrivateKey, before put both results as en entry in the keyStore. Maybe you know other ways to do that.
answer count: 1

http://stackoverflow.com/comment/34367847
type: Comment
comment on: http://stackoverflow.com/a/22569900
score: 0
type: AnswerComment
has text: @skiwi Since I have identified the precise cause of the problem, the proper fix would be to employ a spliterator with user-specified batch size. Now I find it quite a prominent missing feature that there is no `lines(batchSize)` method and similar for other cases.

http://stackoverflow.com/a/22579980
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34373419
has body: Assuming you have a string that represents epoch time in seconds (as you have not told us what your Object actually is), first convert it to a long: long epoch = Long.parseLong("1395500668"); You'll then need to convert it to milliseconds: epoch *= 1000; Then you can convert it to a java.util.Date using the Date constructor that takes millisecond epoch time: Date date = new Date(epoch); And finally you can format that Date as a string using standard formatting techniques.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34373209
has comment: http://stackoverflow.com/comment/34376341
has comment: http://stackoverflow.com/comment/34373579
score: 1
accepted answer of: http://stackoverflow.com/q/22579903
answers question: http://stackoverflow.com/q/22579903

http://stackoverflow.com/comment/34387025
comment on: http://stackoverflow.com/a/22587517
has text: I understand the benefits, I just wanted to understand things in much depth, so trying to learn. I even tried reading the generated class file, but it showed nothing, just enum and the code.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22582313
has comment: http://stackoverflow.com/comment/34377409
downvote count: 0
has answer: http://stackoverflow.com/a/22582380
has comment: http://stackoverflow.com/comment/34377423
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: list
has body: here is my code,here i am taking elements into my list. but actually i have to process on my list . so necessary to know the type of list public class FetchNameService { public static Infobean fetchId() { Infobean infobean = new Infobean(); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); String query="SELECT ifnull(max(CONVERT(substring(id,4),SIGNED) ),0) as maxId FROM infotable"; Query name = session.createSQLQuery(query); List&lt;?&gt; list = name.list(); System.out.println(list.get(0)); return infobean; } }
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/22582380
has title: how to know the data type of list
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/22582410
has comment: http://stackoverflow.com/comment/34377459
has comment: http://stackoverflow.com/comment/34377410
possible better answer: http://stackoverflow.com/a/22582410
has comment: http://stackoverflow.com/comment/34377489
answer count: 2

http://stackoverflow.com/comment/34313423
type: Comment
comment on: http://stackoverflow.com/a/22545677
has text: This is a simple matter of doing some calculations with `int`s; creating `Date` and `DateFormat` objects for it just seems horribly wrong to me.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22633826
tagged with: performance
has comment: http://stackoverflow.com/comment/34469190
has body: I have different reasons for asking this question. What was the decision for switching to micro-seconds in JSR 310: Date and Time API based on. If I measure time with System.currentTimeMillis() how can I interpret 1ms? How many method-calls, how many sysouts, how many HashMap#pushs. I'm absolutely aware of the low scientific standard of this question, but I'd like to have some default values for java operations. Edit: I was talking about: long t1 = System.currentTimeMillis(); //do random stuff System.out.println(System.currentTimeMillis()-t1);
has comment: http://stackoverflow.com/comment/34469578
tagged with: java
has answer: http://stackoverflow.com/a/22634305
upvote count: 1
accepted answer: http://stackoverflow.com/a/22634305
has comment: http://stackoverflow.com/comment/34469414
type: Question
has comment: http://stackoverflow.com/comment/34469090
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34469257
favorite count: 0
has comment: http://stackoverflow.com/comment/34469228
has answer: http://stackoverflow.com/a/22640365
possible better answer: http://stackoverflow.com/a/22633959
tagged with: time
has title: How long is one millisecond in the Java world?
has comment: http://stackoverflow.com/comment/34469280
downvote count: 1
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22633959
has comment: http://stackoverflow.com/comment/34469404

http://stackoverflow.com/q/22585041
has body: I have a text based game that I am making. It is a RPG style where the user is given options linked to numbers and they have to choose a number. Now my problem is that when running the program. A certain method, Decision(), only works certain times. The method is in a superClass while it is being called in the subclass. in the subclass, It works the first time, but not necessarily the second. Also, when I copy the decision method from the superclass into the subclass its starts working, but the next time it is called, it stops. Here is what I've tried and the results. I've included the decision method and where it is being called. Decision Method: public int decision(String question, int length, String[] choices){ int[] numbers = new int[length]; int iterator = 1; for(int i = 0; i &lt; length; i++){ numbers[i] = iterator; iterator++; } boolean done = false; while(!done){ //print("Test"); print(""); print(question); String options = ""; for(int i = 0; i &lt; numbers.length; i++){ options = (options + numbers[i] + " - " + choices[i] + " "); } print(options); boolean univSet = true; int entry = 1; while(univSet){ if(univInt != 0){ univSet = false; entry = univInt; univInt = 0; //print("testing"); } } if(entry == 23){ help(); }else{ for(int i = 0; i &lt; numbers.length; i++){ if(entry == numbers[i]){ done = true; univInt = 0; return entry; } } print("Invalid Number, Try again"); print(""); univInt = 0; } } return (Integer) null; } Chapter1 Class (Where it's being called: public class Chapter1 extends Story implements Serializable { Player player; public Chapter1(Player player){ this.player = player; } public void engage() { // TODO Auto-generated method stub player.chapter = 1; save(player.name); sPrint("Welcome to Chapter 1"); print("You wake up in a lighted room with white walls.\nA fresh breeze is coming through the window yet the air smells rotten."); print("You jolt up suddenly. You don't remember anything about how you got here. You've even forgotten who you are."…
tagged with: java
score: -1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/22585120
tagged with: inheritance
has comment: http://stackoverflow.com/comment/34382640
accepted answer: http://stackoverflow.com/a/22585120
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34382690
has title: Java Method not working constantly
downvote count: 1
has comment: http://stackoverflow.com/comment/34382591
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34382796

http://stackoverflow.com/q/22509890
has comment: http://stackoverflow.com/comment/34249321
possible better answer: http://stackoverflow.com/a/22607391
answer count: 6
has comment: http://stackoverflow.com/comment/34248532
has title: Is it good programming to have a return type of Exception?
has comment: http://stackoverflow.com/comment/34248358
tagged with: exception
has answer: http://stackoverflow.com/a/22541235
accepted answer: http://stackoverflow.com/a/22541235
has comment: http://stackoverflow.com/comment/34248337
favorite count: 0
has comment: http://stackoverflow.com/comment/34249903
upvote count: 11
has answer: http://stackoverflow.com/a/22510336
tagged with: extended-sql
has answer: http://stackoverflow.com/a/22607391
has comment: http://stackoverflow.com/comment/34248314
has answer: http://stackoverflow.com/a/22531395
tagged with: error-handling
has answer: http://stackoverflow.com/a/22531623
downvote count: 1
has body: I ran into an odd situation during a use case on a project: ESQL is calling a java method, sending it a String input parameter which the method will unmarshal, apply some logic, and then store useful info from the unmarshalled object. So, the method must either throw a JAXBException, or use a try catch in order to handle the possible exceptions. The problem with this is, that ESQL cannot invoke a java method which includes a throws in the signature. BUT, we want any errors to fall through back to the previously calling MBNode so it can be handled appropriately there, so then trycatch is out of the picture. It struck me that hey, is it not possible to return a type of Exception when we encounter an issue, and null if not? So I wrote a simple method doing so, and though I didn't get any warnings or errors, it seemed just wrong to me in the sense of good programming. For example: public Exception doStuffAndCheckForErorrs(String inString) { if(inString.equals(null)) { return new Exception("Your string is null"); } else return null; } But I just get a terrible feeling about doing anything this way. I'm open to any thoughts or different solutions to this, especially if there's a way around the ESQL signature issue. UPDATE: Adding reference as to why the ESQL procedure cannot call a java method with a throws clause in the signature. Excerpt from This link under the CREATE PROCEDURE statement section: "Any Java method that you want to invoke must have the following basic signature: public static (&lt; 0 - N parameters>) where must be in the list of Java IN data types in the table in ESQL to Java data type mapping (excluding the REFERENCE type, which is not permitted as a return value), or the Java void data type. The parameter data types must also be in the ESQL to Java data type mapping table. In addition, the Java method is not allowed to have an exception throws clause in its signature."
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34248333
tagged with: java
tagged with: ibm-integration-bus
score: 10
type: Question
has answer: http://stackoverflow.com/a/22510491

http://stackoverflow.com/q/22564741
tagged with: variable-assignment
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22564818
accepted answer: http://stackoverflow.com/a/22564818
possible better answer: http://stackoverflow.com/a/22564779
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/22564801
answer count: 3
has title: java.lang.StackOverflowError in assignment
has answer: http://stackoverflow.com/a/22564779
has body: When I run my code I get java.lang.StackOverflowError I would be more than appreciative if someone can tell me what's wrong. This is my code: My assignment is to make a Sudoku. The strange thing is when I debug it everything is going well but I cant debug it forever.. Need help u all :( public static void main(String[] args) { System.out.println("Welcome to java Sudoku to start the game press enter"); Scanner scanner = new Scanner(System.in); scanner.nextLine(); int AllNum=1000; TestRow=0; TestColumn=0; TheNumUPut=0; finish=false; while(AllNum&gt;99){ AllNum =GivenANum(); if(AllNum&gt;99)NumInPlace(AllNum);}//end while SolveSudoku(); }// end main public static void SolveSudoku() { if (TestRow==9&amp;&amp;TestColumn==0)PrintSudoku(); if(finish==false){ if (SolveOneCell()==true){ TestColumn++; if(TestColumn==9) {TestColumn=0; TestRow++;}} else ReturnToLast(); SolveSudoku(); } }// end Solve Sudoku public static boolean SolveOneCell( ){// הפונקציה פותרת את הסודוקו לאחר שהמשתמש הכניס את המספרים שלו if(IsGiven()==true) return true; IncreaseNum(); while (TheNumUPut&lt;11){ if(TheNumUPut&gt;9){PutZero(); return false;} if(UCanPut()==true){Put();return true;} else TheNumUPut++;} return true; }// end solve public static boolean ReturnToLast() { while(1&gt;0){ if(TestColumn==0) { TestColumn=8; TestRow=TestRow-1; } else TestColumn=TestColumn-1; if(IsGiven()==false) break; } return true; }// end return to NON last given public static int GivenANum(){// הפונקציה קולטת מספר מהמשתמש int PutANum; System.out.println("Please enter a given number and its location ?"); PutANum = reader.nextInt(); return PutANum; }// end givens public static void NumInPlace(int TheNum){// הפונקציה שמה את המספר שנקלט במקום הנכון על הלוח Row = (TheNum/10)%10; Column= TheNum%10; TheGivenNumber= (TheNum/100)%10; TheBoard [Row][Column]=TheGivenNumber; TheGivenBoard[Row][Column]=TheGivenNumber; }// end NumInPlace public static void Put(){// שם בתא את המספר if(TestRow&gt;(-1)&amp;&amp;TestColumn&gt;(-1)){ TheBo…

http://stackoverflow.com/comment/34466202
comment on: http://stackoverflow.com/q/22500727
score: 0
type: Comment
type: QuestionComment
has text: @TimB I think, questions about UML diagrams are almost always opinion based, because many important elements in UML are left undefined strictly. And because on that stage of project developing there are always several different possibilities.

http://stackoverflow.com/comment/34303258
score: 1
has text: I think your url should be fine.. Just try to change the driver name
comment on: http://stackoverflow.com/a/22540164
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22641736
answers question: http://stackoverflow.com/q/22641489
upvote count: 1
has comment: http://stackoverflow.com/comment/34483720
has comment: http://stackoverflow.com/comment/34483636
score: 1
has comment: http://stackoverflow.com/comment/34483849
has body: In the general case, if you see a very common pattern repeated in your code, there is often an opportunity to reduce duplication. The first step is to look at your code and identify the actual differences. You have: public List&lt;Book&gt; getAvailableBooks() { List&lt;Book&gt; result = new ArrayList&lt;Book&gt;(); for (int i = 0; i &lt; this.getBooks().size(); i++) { if (this.getBooks().get(i).getPerson() == null) { result.add(this.getBooks().get(i)); } } return result; } public List&lt;Book&gt; getUnavailableBooks() { List&lt;Book&gt; result = new ArrayList&lt;Book&gt;(); for (int i = 0; i &lt; this.getBooks().size(); i++) { if (this.getBooks().get(i).getPerson() != null) { result.add(this.getBooks().get(i)); } } return result; } Ignoring the method names, let's do a line-by-line comparison. Doing this, we can spot the difference: if (this.getBooks().get(i).getPerson() == null) { // vs: if (this.getBooks().get(i).getPerson() != null) { The only difference there is == vs. !=; the condition is inverted. After identifying the differences, the next step is to see if you can parameterize the behavior, so that the logic itself is exactly the same and depends only on the value of a few outside variables. In this case, we can see a transformation like this: a == x =&gt; (a == x) == true a != x =&gt; (a == x) == false both: =&gt; (a == x) == &lt;variable&gt; So we can make those two lines equivalent: boolean available = true; if ((this.getBooks().get(i).getPerson() == null) == available) { // vs: boolean available = false; if ((this.getBooks().get(i).getPerson() == null) == available) { Now the logic is equivalent, and we can select between the two by simply changing available. Make that a method parameter and, voila! public List&lt;Book&gt; getBooksByAvailability (bool available) { List&lt;Book&gt; result = new ArrayList&lt;Book&gt;(); for (int i = 0; i &lt; this.getBooks().size(); i++) { if ((this.getBooks().get(i).getPerson() == null) == available) { result.add(this.get…
downvote count: 0
has comment: http://stackoverflow.com/comment/34483583
has comment: http://stackoverflow.com/comment/34483894
has comment: http://stackoverflow.com/comment/34483475
type: Answer

http://stackoverflow.com/comment/34456997
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22625136
has text: @Aditya: In the future, please put such information in comments. Thanks!
type: Comment

http://stackoverflow.com/comment/112849425
score: 0
type: Comment
has text: @MaartenBodewes It's using `UTF8.encode` to transform the `char[]` into a `ByteBuffer`. I.e. anything beyond 7-bit ASCII is going to generate multibyte sequences, which will give you unexpected results if you compare with a UTF-16 byte sequence, but that's because the encoding is unexpected, not because Java is ignoring something.
comment on: http://stackoverflow.com/a/27928435
type: AnswerComment

http://stackoverflow.com/a/22547461
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22547293
has body: Here are two solutions (Collections and System.arraycopy()): Collections: List&lt;String&gt; allAsList = new ArrayList&lt;&gt;(); allAsList.addAll(Arrays.asList(DESEASE)); allAsList.addAll(Arrays.asList(GENE)); allAsList.addAll(Arrays.asList(GEO)); System.out.println(allAsList); ArrayCopy: String[] allAsArray = new String[DESEASE.length + GENE.length + GEO.length]; System.arraycopy(DESEASE, 0, allAsArray, 0, DESEASE.length); System.arraycopy(GENE, 0, allAsArray, DESEASE.length, GENE.length); System.arraycopy(GEO, 0, allAsArray, DESEASE.length + GENE.length, GEO.length); System.out.println(Arrays.asList(allAsArray));
type: Answer

http://stackoverflow.com/q/22607701
favorite count: 0
accepted answer: http://stackoverflow.com/a/22608234
has body: I need to print a pdf file for my printer. With this code I have converted my pdf to bytearray, but I am stuck and not know how to send it to the printer. Someone can help me? File file = new File("java.pdf"); FileInputStream fis = new FileInputStream(file); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; try { for (int readNum; (readNum = fis.read(buf)) != -1;) { bos.write(buf, 0, readNum); //no doubt here is 0 //Writes len bytes from the specified byte array starting at offset off to this byte array output stream. System.out.println("read " + readNum + " bytes,"); } } catch (IOException ex) { System.out.println("ERROR!"); } byte[] bytes = bos.toByteArray(); Thank you in advance.
upvote count: 1
has title: Print PDF as byte array in JAVA
linked to: http://stackoverflow.com/q/6184163
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22609591
tagged with: zebra-printers
has comment: http://stackoverflow.com/comment/34422615
tagged with: java
has answer: http://stackoverflow.com/a/50141811
possible better answer: http://stackoverflow.com/a/22609591
type: Question
has comment: http://stackoverflow.com/comment/34422945
downvote count: 0
has answer: http://stackoverflow.com/a/22608234
answer count: 3
tagged with: android
tagged with: http://stackoverflow.com/tag/pdf
score: 1

http://stackoverflow.com/a/22513558
upvote count: 1
answers question: http://stackoverflow.com/q/22512431
has comment: http://stackoverflow.com/comment/34256749
has comment: http://stackoverflow.com/comment/34255525
has comment: http://stackoverflow.com/comment/34255773
downvote count: 0
has body: First add data source Control panel-&gt; Administrative Tools-&gt;Data Sources-&gt;Add-&gt;Microsoft Access Drivers(*mdb,*accdb) Write connection URL like this. String URL="jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb,*.accdb)};DBQ="+yourdbfile+".accdb;"; yourdbfile is path+name of your database file.
type: Answer
score: 1

http://stackoverflow.com/a/22575076
has comment: http://stackoverflow.com/comment/34364338
has comment: http://stackoverflow.com/comment/34364297
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22574959
type: Answer
has comment: http://stackoverflow.com/comment/34364424
has comment: http://stackoverflow.com/comment/34364453
score: 3
accepted answer of: http://stackoverflow.com/q/22574959
has body: There's no need for volatile keyword since ConcurrentHashMap being an implementation of ConcurrentMap provides the following memory consistency effect: actions in a thread prior to placing an object into a ConcurrentMap as a key or value happen-before actions subsequent to the access or removal of that object from the ConcurrentMap in another thread However, that's not how you usually want to work with concurrent map. General pattern is as follows: Object existing = concurrentMap.get(key); // check if this key is already present if (existing == null) { Object newObject = new Object(); existing = concurrentMap.putIfAbsent(key, newObject); // atomic operation // another thread might have already stored mapping for key if (existing == null) { return newObject; } } return existing; Note, it doesn't protect you from two threads simultaneously calling new Object() (which can be an issue if creation of new object is expensive), but it allows you to avoid explicit synchronization alltogether. Update: as for double-checked locking, in your case, it should look as follows: Object value = concurrentMap.get(key); if (value == null) { synchronized (lock) { value = concurrentMap.get(key); if (value == null) { value = new Object(); concurrentMap.put(key, value); } } } return value;
upvote count: 3
has comment: http://stackoverflow.com/comment/34364479

http://stackoverflow.com/q/22494833
has comment: http://stackoverflow.com/comment/34223498
answer count: 0
score: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/14544013
has title: JAVA: Whats the best way Build a Table from a ResultSet and insert it to Ms Word
has comment: http://stackoverflow.com/comment/34223325
tagged with: ms-word
tagged with: resultset
type: UnansweredQuestion
has body: i need to save my table to ms word so i can print it and see what's left using java. any help would be highly appreciated. thanks, i tried using the Aspose.word for java but i don't seem to get it. im quite new here
linked to: http://stackoverflow.com/q/12665089

http://stackoverflow.com/comment/34338264
comment on: http://stackoverflow.com/a/22560838
score: 0
type: Comment
has text: @user3300593: it's explained in the doc: http://docs.spring.io/spring/docs/4.0.x/javadoc-api/org/springframework/jdbc/core/JdbcTemplate.html#queryForList-java.lang.String-java.lang.Class-
type: AnswerComment

http://stackoverflow.com/comment/34326758
type: Comment
type: QuestionComment
has text: @Keppil No there is nothing like that. will edit it...
score: 0
comment on: http://stackoverflow.com/q/22553911

http://stackoverflow.com/a/22501583
type: Answer
answers question: http://stackoverflow.com/q/22501443
score: 0
has body: That's because you're using wrong syntax for creating a table. There's no such thing as CREATE_TABELLOGIN Refer to this page for an example

http://stackoverflow.com/q/22628866
tagged with: libgdx
has comment: http://stackoverflow.com/comment/34466814
has comment: http://stackoverflow.com/comment/34462651
has comment: http://stackoverflow.com/comment/34472874
answer count: 0
type: UnansweredQuestion
tagged with: android
has body: I'm using the AssetManager in libgdx with an Atlas file, to load all textures. This works just fine, however I want to modify the code I have to incorporate using different textures. For example when fully zoomed out, I don't need a nice hi-res texture. A small pixelated dot will suffice. When zoomed in, I want to use the proper hi-res texture. Currently I have this: main render() method: batch.draw(Assets.instance.ballsmall.ballsmall, this.x, this.y); (you can ignore the double ballsmall.ballsmall for the time being. That's just a smaller semantic issue with my asset object structure.) AssetManager section: public class Assets implements Disposable { private AssetManager _assetManager; public BallSmall ballsmall; public static final Assets instance = new Assets(); private Assets() {} public void init(AssetManager assetManager) { _assetManager = assetManager; _assetManager.load("output/Game.atlas", TextureAtlas.class); _assetManager.finishLoading(); TextureAtlas atlas = _assetManager.get("output/Game.atlas"); for (Texture t : atlas.getTextures()) { t.setFilter(TextureFilter.Linear, TextureFilter.Linear); } ballsmall = new BallSmall(atlas); } @Override public void dispose() { _assetManager.dispose(); } public class BallSmall { public final AtlasRegion ballsmall; public BallSmall(TextureAtlas atlas) { ballsmall = atlas.findRegion("ballsmall"); } } } I want to keep the main render() method to be simple like that, calling for an Assets.instance and possibly passing in the global zoom level as a parameter. However the AssetManager must then use this zoom level to determine which texture to swap. Many thanks.
tagged with: textures
has comment: http://stackoverflow.com/comment/34469536
has title: Libgdx Using AssetManager with High and Low resolution textures
score: 0
tagged with: java
tagged with: android-assets
type: Question

http://stackoverflow.com/comment/34425170
type: AnswerComment
type: Comment
has text: Here we call it's by common layer. In this layer you can concentrate your Repository, BO even Facade layer. I did not understand when U'll have circular dependency ? In my opnion this layer always will be a module that never will depend of for example an Facade
comment on: http://stackoverflow.com/a/22578839
score: 0

static-methods
tags question: http://stackoverflow.com/q/22606709
tags question: http://stackoverflow.com/q/22584841
tags question: http://stackoverflow.com/q/22569262
tags question: http://stackoverflow.com/q/22624350
tag name: static-methods
type: Tag

http://stackoverflow.com/a/22612698
answers question: http://stackoverflow.com/q/22612599
type: Answer
has body: Create a java.util.Date instance (not to be confused with java.sql.Date) and pass its time in milliseconds as argument to the Timestamp. Here's an example: Timestamp now = new Timestamp(new java.util.Date().getTime()); There are other ways to create a java.util.Date object instance: Using Calendar: Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); Date today = calendar.getTime(); Timestamp now = new Timestamp(today.getTime()); Using DateFormat or it's child class SimpleDateFormat. SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); Date date = sdf.parse("2014/3/24"); Timestamp today = new Timestamp(date.getTime());
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/34228042
comment on: http://stackoverflow.com/a/22496972
type: Comment
has text: the array elements are not in the same order as each other.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34307687
type: QuestionComment
comment on: http://stackoverflow.com/q/22542642
score: 0
has text: You could check for an static variable for null on your activities within your service, so if the variable is null the activity already finished
type: Comment

http://stackoverflow.com/q/22589267
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/46045963
tagged with: nlp
has comment: http://stackoverflow.com/comment/34390409
type: UnansweredQuestion
has title: How to get Plural form from Singular form?
tagged with: java
has body: I want to get plural of the given noun. I have tried JAVA INFLECTOR. But it has very poor accuracy for nouns not following the regular rules. Examples from JAVA INFLECTOR: paparazzo -> paparazzos criterion -> criterions tooth -> tooths thief -> thiefs loaf -> loafs Stanford coreNLP lemmatizer is very good at plural to singular conversion. It takes care of many exceptional cases. As stated below: Plural to singular from STANFORD LEMMATIZER: vertices -> vertex spectra -> spectrum alumni -> alumnus criteria -> criterion thieves -> thief geese -> goose fungi -> fungus loaves -> loaf. But the problem is I don't know how to get plural from given singular using Stanford CoreNLP. The lemmatizer gives singular from plural. So, basically I want to get plural from singular nouns using STANFORD NLP. How can this be achieved?
has comment: http://stackoverflow.com/comment/34390247
type: Question
upvote count: 4
tagged with: lemmatization
tagged with: stanford-nlp
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34390318
tagged with: inflector

http://stackoverflow.com/a/22571561
has body: My question is how to use EmployeeDetail.jsp read bean object passed from EmployeeRegistrationServlet? You need to set the Object in request / session attribute to be available to forwarded jsp how to Find an employee by searching the employee ID? depends on your data store, for example if you are using mysql you need to use jdbc and query to get record by id See example on jsp wiki servlet wiki
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/22571508
answers question: http://stackoverflow.com/q/22571508
upvote count: 1

http://stackoverflow.com/q/22514156
tagged with: java
has answer: http://stackoverflow.com/a/22514422
has title: Java: Why does try-catch block within a loop executes only once?
has comment: http://stackoverflow.com/comment/34256705
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22514393
has answer: http://stackoverflow.com/a/22514446
type: AnsweredQuestion
has body: The below program simply reads integers from the console and prints it back. When one enters a non-int (like char or String), the Scanner throws an exception. I tried to handle the exception in the 'try-catch' block and move on to read the next input. After the first non-int input from console, the programs runs into infinite loop. Can someone please help? public class ScannerTest { static int i=1; static Scanner sc; public static void main (String args[]){ sc = new Scanner(System.in); while (i!=0){ System.out.println("Enter something"); go(); } } private static void go(){ try{ i = sc.nextInt(); System.out.println(i); }catch (Exception e){ System.out.println("Wrong input, try again"); } } }
tagged with: loops
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/34256397
has comment: http://stackoverflow.com/comment/34257564
linked to: http://stackoverflow.com/q/6612806
possible better answer: http://stackoverflow.com/a/22514422
accepted answer: http://stackoverflow.com/a/22514446

http://stackoverflow.com/a/22591402
downvote count: 0
score: 16
has body: Yes, if you are using Spring security 3.2 and above, it will be something like this : @Configuration @EnableWebSecurity public class MyWebSecurityConfiguration extends WebSecurityConfigurerAdapter { @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/resources/**"); } @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/").permitAll() .antMatchers("/dashboard/home/**").hasAnyRole("USER", "ADMIN") .antMatchers("/dashboard/users/**").hasRole("ADMIN") .antMatchers("/rest/users/**").hasRole("ADMIN") .anyRequest().authenticated() .and() .formLogin() .loginPage("/") .permitAll(); } // Possibly more overridden methods ... }
accepted answer of: http://stackoverflow.com/q/22591028
answers question: http://stackoverflow.com/q/22591028
type: AcceptedAnswer
upvote count: 16
has comment: http://stackoverflow.com/comment/50991953
type: Answer

http://stackoverflow.com/a/22644524
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34488778
has body: You can declare a method to throw an exception if you can't (or it's not convinient) to handle the exception inside the method. In your case, you are calling the method setRadius inside the constructor. If you think that is convinient to handle the exception (that is thrown by setRadius) inside the constructor, you can use a try-catch clause: public CircleWithException(double newRadius) throws InvalidRadiusException { try { setRadius(newRadius); numberOfObjects++; } catch (InvalidRadiusException e) { setRadius(0); // for example } } The catch block contains what you want to do if an exception were thrown. In this case, I'm setting the radius to 0, but you can change this. Remember that it depends in your classes implementation and how you want them to work. If you don't want the constructor to handle this exception, you can throw it (as you are already doing) and handle it in other methods.
answers question: http://stackoverflow.com/q/22644397
has comment: http://stackoverflow.com/comment/34488719
downvote count: 0

http://stackoverflow.com/a/22582919
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22582885
has body: Saw this thread which will solve the problem https://groups.google.com/forum/#!msg/dropwizard-user/R_CvQX179MY/Oe__pm_K6yQJ

http://stackoverflow.com/comment/34385174
comment on: http://stackoverflow.com/a/22586438
type: Comment
has text: Reading what you posted above, I still have a lot to go before I really understand everything you stated. I really need to know about Java, that's why I am going get tutored over the summer by friend who is fluent with java, but thnx for pointing out the flaws of the code. :)
type: AnswerComment
score: 0

http://stackoverflow.com/a/22626710
type: Answer
has comment: http://stackoverflow.com/comment/34457208
has body: SharedPreferences newcount = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); Editor newedit = newcount.edit(); edit.putLong("myrowcount", count); newedit.commit(); In the above code change edit.putLong("myrowcount", count); to newedit.putLong("myrowcount", count);
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34457404
has comment: http://stackoverflow.com/comment/34457298
accepted answer of: http://stackoverflow.com/q/22626438
has comment: http://stackoverflow.com/comment/34458713
has comment: http://stackoverflow.com/comment/34457943
has comment: http://stackoverflow.com/comment/34492602
answers question: http://stackoverflow.com/q/22626438
has comment: http://stackoverflow.com/comment/34475084
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34478525
has comment: http://stackoverflow.com/comment/34480017
has comment: http://stackoverflow.com/comment/34457559

http://stackoverflow.com/a/22577956
accepted answer of: http://stackoverflow.com/q/22577924
has comment: http://stackoverflow.com/comment/34369455
answers question: http://stackoverflow.com/q/22577924
upvote count: 6
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34383614
has body: It's because you are calling setVisible before you add components. Call setVisible after you add components on your JFrame. Basically: //Frame method private void frame() { //Tab-panel JTabbedPane tabbedPane = new JTabbedPane(); //Tabs tabbedPane.addTab("Login", new LoginTab(window)); tabbedPane.addTab("MySQL Verbindung", new MySQLConnectionTab()); //TODO Strings einfügen //Add tab-panel to frame window.add(tabbedPane, BorderLayout.CENTER); //window.setSize(400,250); window.pack(); window.setLocationRelativeTo(null); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setVisible(true); } Also, call pack instead of setSize. Size of your JFrame will be based on preferred sizes of components within of JFrame and gaps between those components.
has comment: http://stackoverflow.com/comment/34383584
type: Answer
has comment: http://stackoverflow.com/comment/34383654
downvote count: 0
score: 6

http://stackoverflow.com/a/22588672
has body: The problem was that I was trying to export it to a jar and then manually adding the main class in manifest.MD and the jars it was using. All I had to do was export it to an 'executable' jar and check the extract all jars option while exporting :)
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22525492
answers question: http://stackoverflow.com/q/22525492
type: Answer

http://stackoverflow.com/comment/34293675
score: 0
comment on: http://stackoverflow.com/q/22534985
type: Comment
type: QuestionComment
has text: @JoakimPalmkvist, this is the link to the JSON http://pastebin.com/87DCfxvN

http://stackoverflow.com/comment/34396928
has text: It's like having `"Hello C:\Users\Adam Miszczak\Desktop \Wo rld\Hello"` actually.
type: AnswerComment
comment on: http://stackoverflow.com/a/22591818
score: 0
type: Comment

http://stackoverflow.com/a/22625244
accepted answer of: http://stackoverflow.com/q/22624914
has body: You are creating the iterator as a field rather than just before its use. Because of this, the iterator notices that the values have changed since it was created and throws a concurrent modification exception. Initialize your iterator just before your while loop like: itX = x.iterator(); itY = y.iterator(); while(itX.hasNext()){ Integer xx = (Integer) itX.next(); Integer yy = (Integer) itY.next(); g2d.fillOval(xx, yy, 30, 30); } Also, out of context I may be wrong (I haven't gone through all of your code), but you shouldn't need to cast for an Integer object as you can just set an Integer object to the primitive int type: Integer varName = 12; will create an Integer object of value 12, so the unnecessary casting just leaves room for the compiler to miss fatal errors.
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22624914

http://stackoverflow.com/comment/34493165
comment on: http://stackoverflow.com/q/22646612
has text: @NoniA. : I didn't personally downvote but a piece of advice here on SO is not to post a sizeable chunk of code which is mostly Android-specific and then stick a "Java" tag on the question. Not all Java programmers program for Android and, in my experience, very many don't understand the fundamentals. In this case you could have simply posted the Java code and explained you just wan't to round a number represented by a string of text to 2 decimal places.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34531431
type: QuestionComment
has text: At the first one, if i comment that one out, then at the second one, and so on... How do I initiate the table columns?
comment on: http://stackoverflow.com/q/22644995
score: 0
type: Comment

http://stackoverflow.com/a/22540674
has comment: http://stackoverflow.com/comment/34305112
has comment: http://stackoverflow.com/comment/34304805
has body: You can either simply call setVisible() on your various JPanels, or you can look into CardLayout. How to Use CardLayout If you're confused about how to take an action when the user clicks a button, you need to look into ActionListeners. How to Write an Action Listener
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34304405
has comment: http://stackoverflow.com/comment/34305639
has comment: http://stackoverflow.com/comment/34303872
has comment: http://stackoverflow.com/comment/34305857
upvote count: 2
has comment: http://stackoverflow.com/comment/34303802
answers question: http://stackoverflow.com/q/22540579
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34304081
accepted answer of: http://stackoverflow.com/q/22540579
has comment: http://stackoverflow.com/comment/34303969
type: Answer

http://stackoverflow.com/a/22610341
has comment: http://stackoverflow.com/comment/34467246
has comment: http://stackoverflow.com/comment/41338375
answers question: http://stackoverflow.com/q/22607791
has comment: http://stackoverflow.com/comment/34455580
accepted answer of: http://stackoverflow.com/q/22607791
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34456695
type: Answer
has comment: http://stackoverflow.com/comment/41297409
upvote count: 19
has body: Your Java code uses the 128-bit AES key while your JavaScript code uses the 256-bit AES key. Your Java code uses the "Abcdefghijklmnop".getBytes() as the actual key value, while your JavaScript code uses the "Abcdefghijklmnop" as the passphrase from which the actual key is derived. The default transformation for Java AES is AES/ECB/PKCS5Padding, while default transformation for CryptoJS is AES/CBC/PKCS7Padding. One way to fix your example is to fix the JavaScript side: // this is Base64 representation of the Java counterpart // byte[] keyValue = new byte[] { 'A', 'b', 'c', 'd', 'e', 'f', 'g', // 'h', 'i', 'j', 'k','l', 'm', 'n', 'o', 'p'}; // String keyForJS = new BASE64Encoder().encode(keyValue); var base64Key = "QWJjZGVmZ2hpamtsbW5vcA=="; console.log( "base64Key = " + base64Key ); // this is the actual key as a sequence of bytes var key = CryptoJS.enc.Base64.parse(base64Key); console.log( "key = " + key ); // this is the plain text var plaintText = "Hello, World!"; console.log( "plaintText = " + plaintText ); // this is Base64-encoded encrypted data var encryptedData = CryptoJS.AES.encrypt(plaintText, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }); console.log( "encryptedData = " + encryptedData ); // this is the decrypted data as a sequence of bytes var decryptedData = CryptoJS.AES.decrypt( encryptedData, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 } ); console.log( "decryptedData = " + decryptedData ); // this is the decrypted data as a string var decryptedText = decryptedData.toString( CryptoJS.enc.Utf8 ); console.log( "decryptedText = " + decryptedText );
has comment: http://stackoverflow.com/comment/34458422
score: 19
has comment: http://stackoverflow.com/comment/34456840

http://stackoverflow.com/q/22536086
has answer: http://stackoverflow.com/a/22537040
upvote count: 1
type: AnsweredQuestion
tagged with: java
has title: $set and positional operator doesn't work in Java?
type: Question
tagged with: mongodb
accepted answer: http://stackoverflow.com/a/22537040
answer count: 2
tagged with: mongodb-java
possible better answer: http://stackoverflow.com/a/23379521
downvote count: 0
has answer: http://stackoverflow.com/a/23379521
score: 1
has body: I have the following document in MongoDb collection called hosts { "_id" : ObjectId("532aeec040a83df82181ff3c"), "os" : "WINDOWS", "name" : "Host 1", "bas" : [ { "wwn" : "EE:00:11:FF", "id" : "1" }, { "wwn" : "AA:00:11:BB", "id" : "2" } ] } Now I want to update ba of id=1 in Host of name=Host 1 to { "wwn" : "AA:BB:CC:DD", "id" : "11" }. After the update the result will be { "_id" : ObjectId("532aeec040a83df82181ff3c"), "os" : "WINDOWS", "name" : "Host 1", "bas" : [ { "wwn" : "AA:BB:CC:DD", "id" : "11" }, { "wwn" : "AA:00:11:BB", "id" : "2" } ] } For this I used the mongo shell command db.hosts.update( { name : "Host 1", "bas.id" : "1" }, { "$set" : { "bas.$" : { wwn : "AA:BB:CC:DD", id : "11"} }} ); which worked great. Now I wanted to do the same using Java drivers and here is my code BasicDBObject example = new BasicDBObject("name", "Host 1").append("bas\uff0eid", "1"); BasicDBObject newValue = new BasicDBObject("\u0024set", new BasicDBObject("bas\uff0e\u0024", new BasicDBObject().append("wwn", "AA:BB:CC:DD).append("id","11")) ; collection.update(example, newValue); In the above code I had to replace . with \uff0 and $ with \u0024 to avoid exception being thrown. This update call is not updating the collection. When I inspected the BasicDBObject.toString() the JSON were same as what I had typed on console. Please help me.
favorite count: 0

http://stackoverflow.com/comment/34307059
comment on: http://stackoverflow.com/q/22542487
type: Comment
type: QuestionComment
has text: @Rohit depending on how I try.. sometimes i get `Cannot instantiate the type HashMap<String,?>`.
score: 0

http://stackoverflow.com/q/22506750
downvote count: 0
has body: What is the most optimal way to find unique pairs of all numbers in a list in Java? I have a solution where I convert the list into an array and then basically pair the first element with 2nd , then first with 3rd and so on.. However, this turns out to be O(n^2). Here is my basic pseudo code: int arr[] = convertListToArray(arrList) for i=1;i&lt; arr.length; i++ for j =1+1; j&lt;arr.length; j++ print arr[i] , arr[j] This is clearly o(n^2). Can this be done in a better way?
answer count: 3
has answer: http://stackoverflow.com/a/22506960
favorite count: 0
has answer: http://stackoverflow.com/a/22507543
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34242707
score: 2
tagged with: java
has title: Pairs in a list
type: Question
tagged with: algorithm
has answer: http://stackoverflow.com/a/22506847

http://stackoverflow.com/comment/34409836
comment on: http://stackoverflow.com/a/22600159
has text: this is fantastic!! I had .lastIndexOf to determine the last occurrence of "\" but did not know what to do after that. Thanks for going the extra mile and sharing some info with doublebackslashes. I hope I could upvote, but I cannot yet..
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34526106
type: AnswerComment
type: Comment
has text: Hi Cataclysm: about the bounty. There really is no detailed, canonical answer to a question like yours. You're asking for design advice, and design is all about trade-offs: what do you gain versus what do you lose. Trying to gain more than you give up, of course. So your choice will depend on what's easiest to read / maintain, what the rest of your program looks like, whether your organization asks you to conform to a particular coding style, and even what coding style you simply prefer. One "canonical" thought, though: don't use HashMap to pass parameters. Good luck!
score: 1
comment on: http://stackoverflow.com/a/22601071

http://stackoverflow.com/q/22515368
has comment: http://stackoverflow.com/comment/34258777
has comment: http://stackoverflow.com/comment/34259446
has answer: http://stackoverflow.com/a/22516366
score: 0
answer count: 1
has title: Solving sudoku by recursion
type: UnansweredQuestion
tagged with: sudoku
has comment: http://stackoverflow.com/comment/34259064
tagged with: recursion
tagged with: java
has body: I tried writing recursion to solve sudoku, and I'm having a problem with the recursion. If it's unsolvable its ok, but if it is solvable it is getting to infinite loop. public static boolean recursion (int sodukuMatrix[][],int posRow, int posCol ,int i){ if (posRow==0 &amp;&amp; posCol==0 &amp;&amp; i==10) return false; if(there is existing number){ if (posCol==8 &amp;&amp; posRow==8) return true; call recursion with next square } else { i=sodukuMatrix[posRow][posCol]+1; while (i&lt;10){ if (function: if I put i at the current location it is ok){ sodukuMatrix[posRow][posCol]=i; if (posCol==8 &amp;&amp; posRow==8) return true; call recursion with next square } else i++; } sodukuMatrix[posRow][posCol]=0; return false; } return false; } }
type: Question

http://stackoverflow.com/q/22555568
accepted answer: http://stackoverflow.com/a/22662317
score: 5
upvote count: 5
tagged with: adt
tagged with: sdk
answer count: 3
has title: how can I create a new project without appcompat_v7
has body: I am unable to get why appcompat_v7 is created automatically... finding it very irritating.. please someone help to get rid off this problem. I tried to create new project and found like this for every newly created project.
has comment: http://stackoverflow.com/comment/34328955
has comment: http://stackoverflow.com/comment/34336271
downvote count: 0
has answer: http://stackoverflow.com/a/24910291
favorite count: 0
linked to: http://stackoverflow.com/q/22261288
has answer: http://stackoverflow.com/a/23561143
has answer: http://stackoverflow.com/a/22662317
tagged with: android
possible better answer: http://stackoverflow.com/a/23561143
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/q/22518816
has body: I have an ArrayList defined as: ArrayList&lt;String[]&gt; params=new ArrayList&lt;String[]&gt;(); It contains parameters ("name", value) in String Arrays. I would like to insert elements in the ArrayList: params.add({"param1", param1}); But when I try that I get an error. What is the simplest way to add String Arrays in ArrayList. Do I have to declare a new array each time?
has comment: http://stackoverflow.com/comment/34265059
has comment: http://stackoverflow.com/comment/34264980
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34265029
has answer: http://stackoverflow.com/a/22518897
type: Question
tagged with: arrays
tagged with: arraylist
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/22518968
tagged with: string
has title: Add String Arrays in ArrayList
has answer: http://stackoverflow.com/a/22518866
accepted answer: http://stackoverflow.com/a/22518866
has answer: http://stackoverflow.com/a/22518968

http://stackoverflow.com/a/22570190
has body: In the Using Swing Components tutorial the Loading Images Using getResource section shows seven scenarios in which the following code should works: java.net.URL imageURL = myDemo.class.getResource("images/myImage.gif"); ... if (imageURL != null) { ImageIcon icon = new ImageIcon(imageURL); }
accepted answer of: http://stackoverflow.com/q/22494419
answers question: http://stackoverflow.com/q/22494419
type: Answer
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34355921
score: 0

http://stackoverflow.com/a/22603361
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22603262
has comment: http://stackoverflow.com/comment/34416815
upvote count: 2
answers question: http://stackoverflow.com/q/22603262
type: AcceptedAnswer
downvote count: 0
has body: If the object itself is thread-safe, you can have 100 places in the code where you access this object, and it will be thread-safe every time. If the object isn't thread-safe, you'll have to make sure that every one of the 100 places where you access the bean does it in a common way that guarantees the thread-safety. I'd make the object thread-safe.

http://stackoverflow.com/a/22512092
has comment: http://stackoverflow.com/comment/34252891
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34253033
has comment: http://stackoverflow.com/comment/34354363
type: Answer
accepted answer of: http://stackoverflow.com/q/22511634
score: 1
has comment: http://stackoverflow.com/comment/34253427
has comment: http://stackoverflow.com/comment/34253696
has comment: http://stackoverflow.com/comment/34253359
answers question: http://stackoverflow.com/q/22511634
upvote count: 1
has body: Do some debugging. Print the length of you command line arguments as well as each argument something like: System.out.println(args.length); for(String arg: args) { System.out.println(arg); } This way you will see what you are passing to your program as arguments.
has comment: http://stackoverflow.com/comment/34254205

http://stackoverflow.com/a/24191705
type: Answer
score: 19
has body: Along the lines of ggovan's answer, I do this as follows: /** * Provides various high-order functions. */ public final class F { /** * When the returned {@code Function} is passed as an argument to * {@link Stream#flatMap}, the result is a stream of instances of * {@code cls}. */ public static &lt;E&gt; Function&lt;Object, Stream&lt;E&gt;&gt; instancesOf(Class&lt;E&gt; cls) { return o -&gt; cls.isInstance(o) ? Stream.of(cls.cast(o)) : Stream.empty(); } } Using this helper function: Stream.of(objects).flatMap(F.instancesOf(Client.class)) .map(Client::getId) .forEach(System.out::println);
upvote count: 19
answers question: http://stackoverflow.com/q/22511750
downvote count: 0

http://stackoverflow.com/a/22591701
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22591640
score: 2
has body: In the javadoc you can see that Double.NaN is a Constant of the type Double, so you can cast! Double.Nan is a valid number. http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html

http://stackoverflow.com/q/22609974
tagged with: java
has answer: http://stackoverflow.com/a/22610085
upvote count: 1
type: Question
has body: Follow up to this question, but I'll try to make it self-contained. Suppose I have an interface called Animal, which for various reasons has a generic type parameter representing the implementing class: public interface Animal&lt;A extends Animal&lt;A&gt;&gt; I also have a sub-interface, Dinosaur, which behaves in the same way: public interface Dinosaur&lt;D extends Dinosaur&lt;D&gt;&gt; extends Animal&lt;D&gt; Now I have a class Lizard which implements Animal: public class Lizard implements Animal&lt;Lizard&gt; and a subclass, Trex, which implements Dinosaur: public class Trex extends Lizard implements Dinosaur&lt;Trex&gt; These four declarations now produce an error. This is because the class Trex implements the interface Animal twice, but with different type parameters: since it extends Lizard, it implements the interface Animal&lt;Lizard&gt;, and since it implements Dinosaur&lt;Trex&gt;, it implements Animal&lt;Trex&gt;. Animal&lt;Trex&gt; is not a subinterface of Animal&lt;Lizard&gt;, even though Trex is a subclass of Lizard, so we get a compiler error. I'm sure there's some way around this using wildcards, but I can't work out what it is. Here's something you can compile to get the same error: public class InterfaceTest { private interface Animal&lt;A extends Animal&lt;A&gt;&gt; {} private interface Dinosaur&lt;D extends Dinosaur&lt;D&gt;&gt; extends Animal&lt;D&gt; {} private class Lizard implements Animal&lt;Lizard&gt; {} private class Trex extends Lizard implements Dinosaur&lt;Trex&gt; {} }
answer count: 1
downvote count: 0
tagged with: generics
has title: How can I make extensions of interfaces compatible with generic parameters?
favorite count: 0
tagged with: subtyping
tagged with: interface
linked to: http://stackoverflow.com/q/22539945
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/22606422
has body: I'd like to write a generic service that should work with an object of a specific type. When I write custom implementation of that service, I'd like to object to be variable. Therefore I wanted to override the method that creates that object. But it won't work. Is it impossible in java to achieve the following? class MyService&lt;T extends Foo&gt; { //Type mismatch: cannot convert from Foo to T public T createObject() { return new Foo(); } public void run() { T t = createObject(); //work with the object } } class Bar extends Foo; class CustomService&lt;Bar&gt; { @Override public Bar createObject() { return new Bar(); } }
has answer: http://stackoverflow.com/a/22607305
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: generics
favorite count: 0
has title: How to return the generic type of an object inside generic class?
type: Question
accepted answer: http://stackoverflow.com/a/22607305
possible better answer: http://stackoverflow.com/a/22606772
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/22606772
has answer: http://stackoverflow.com/a/22606801
upvote count: 1

http://stackoverflow.com/a/22518341
downvote count: 0
has comment: http://stackoverflow.com/comment/34311347
score: 1
has body: Yes. This is possible and the implementation should be a trivial exercise.
answers question: http://stackoverflow.com/q/22517972
has comment: http://stackoverflow.com/comment/34265314
upvote count: 1
has comment: http://stackoverflow.com/comment/34313129
has comment: http://stackoverflow.com/comment/34326311
has comment: http://stackoverflow.com/comment/34264442
has comment: http://stackoverflow.com/comment/34309156
type: Answer

http://stackoverflow.com/q/22504923
type: Question
answer count: 2
tagged with: java-ee-7
tagged with: maven
has title: Dependency jar containing ejb 3.1 and jsf pages
score: 0
tagged with: java
tagged with: ejb-3.1
tagged with: jsf-2
possible better answer: http://stackoverflow.com/a/22506480
has answer: http://stackoverflow.com/a/22520066
has answer: http://stackoverflow.com/a/22506480
has body: I have a web app project which is now growing in to separate web submodules containing their own ejbs and jsf webpages. The project structure is going to look like something following. parent-project common-module creditcard-module bankpayment-module some-more-payment-modules ... war-module Each module except common module has its own ejbs and jsf pages. If possible I need each module to be a standalone war and build a big war with the war module. EDIT Current structure of the project war module -- --| persistenceunit | --| entities | --| ejbs | --| cdi managed beans | --| controllers | --| jsf-pages | --| resources | The different business units are just separated by packages. Now it is required to be able to version the different business units separately i.e. different mvn projects for each. Structure to achieve: Common module -- --| persistenceunit | --| dao helpers | --| common ejb services | --| common managed beans | --| jsf-templates | --| common resources | Creditcard module -- --| related entities | --| ejb services | --| related managed beans | --| jsf-pages | --| specific resources | And the same for other business modules, moreover one master war / ear module to contain all the wars. Important: is it possible to share persistence unit ? Will cdi work across the modules (at the end it is a single ear/war) ? In essence the idea is to modulerise the project according to business needs and not purely technical layers. How should I achieve this with maven ?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22520066

http://stackoverflow.com/comment/34251090
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22511279
has text: I really don't know much about it. I presume it is making separate request to get ForeignCollection, if so I should be able to modify it. I always need it sorted by one specific field. There has to be more elegant solution then just sorting array.

http://stackoverflow.com/q/22549245
has comment: http://stackoverflow.com/comment/34319261
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34340059
favorite count: 0
has answer: http://stackoverflow.com/a/22549286
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34319683
has title: Finding Palindrome and its Binary
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22549286
has body: i try to find palindrome and its binary,right now i getting palindrome number correctly but its binary not print correctly kindly help me what mistake i have done. package Palindrome public class PalindromeNnumber { public static void main(String[] args) { for (int i = 11; i &lt; 100; i++) { isPalindrome(i); } } private static void isPalindrome(int i) { int reverse = 0; int input = i; while (i &gt; 0) { int remainder = i % 10; reverse = reverse * 10 + remainder; i = i / 10; } int rnumber = reverse; if (input == reverse) { System.out.println("Palindrome Number " + reverse); isBinary(rnumber); } } private static void isBinary(int rnumber) { int reversebinary = 0; //Finding Binary Number for the input number while (rnumber &gt; 0) { int remainderb = rnumber % 2; reversebinary = reversebinary * 10 + remainderb; rnumber = rnumber / 10; } System.out.println("Binary Numbers are :"+reversebinary); } } My Output: Palindrome Number 11 Binary Numbers are :1101 Palindrome Number 22 Binary Numbers are :1101 Palindrome Number 33 Binary Numbers are :100001 Palindrome Number 44 Binary Numbers are :1101 Palindrome Number 55 Binary Numbers are :111011 Palindrome Number 66 Binary Numbers are :100001 Palindrome Number 77 Binary Numbers are :1011001 Palindrome Number 88 Binary Numbers are :1101 Palindrome Number 99 Binary Numbers are :1100011

http://stackoverflow.com/comment/34328202
comment on: http://stackoverflow.com/q/22549517
score: 3
type: Comment
has text: Yeah, of course, I could end up doing that, but... It should be obvious from the documentation and it's not.
type: QuestionComment

http://stackoverflow.com/comment/34274619
score: 0
comment on: http://stackoverflow.com/q/22523959
has text: @JonathonReinhart : In this case the Java tag is appropriate but that isn't always the case for Android questions.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34291154
type: AnswerComment
comment on: http://stackoverflow.com/a/22531849
score: 0
type: Comment
has text: see my edit it will let you know, how exactly to go with touch listener.

http://stackoverflow.com/comment/34371601
has text: I think the confusion arises from the name `close()` of the `Connection` interface (http://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html). In your mind, _closing_ a connection could —legitimately— imply 'breaking' the connection to the database. However, here's what the Javadoc says about `close()`: _Releases this Connection object's database and JDBC resources immediately instead of waiting for them to be automatically released._ See the difference?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22579077
type: Comment

http://stackoverflow.com/q/22585743
type: AnsweredQuestion
tagged with: numbers
accepted answer: http://stackoverflow.com/a/22585813
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34383831
has comment: http://stackoverflow.com/comment/34383877
has comment: http://stackoverflow.com/comment/34383815
type: Question
answer count: 1
downvote count: 0
tagged with: javascript
favorite count: 0
tagged with: double
has answer: http://stackoverflow.com/a/22585813
has body: Here is outputs from Google Chrome Javascript Console. Here is outputs from DrJava Java Console. My Javascript code is (baseCPUCyclesPerIteration - CPUCyclesTotalRoundoff) | 0 Seems to compile fine in Java if both variables are integers but apparently they are doubles in javascript. Even though typeof baseCPUCyclesPerIteration reveals "number" The results make it pretty obvious it's a double datatype. I don't understand why bitwise OR 0 works on a double in Javascript but doesn't work on Java double's. Seems the purpose of the | 0 is just to trim of the decimal points in double datatype. I'm guessing in Java the equivalent will be (int) or (long) cast is this correct? or the bitwise | 0 does more then just trim of the decimal point in javascript? Edit: ya | 0 doesn't just trim in javascript just ran this. 8899811111.111113453456754645 | 0 got back 309876519. (Although I passed the double limit lol still tries to compute it in javascript, I'm guessing this is where the overflows happen).
tagged with: bitwise-or
has comment: http://stackoverflow.com/comment/34383834
upvote count: 1
has comment: http://stackoverflow.com/comment/34383893
has title: Bitwise operation OR on (double) in Java not possible, possible in JavaScript

http://stackoverflow.com/comment/34425252
type: Comment
has text: -1 for asking one of the most often asked questions again .... (too lazy to look up a duplicate)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22606227

http://stackoverflow.com/comment/34555003
has text: but its considering as java.awt.List
comment on: http://stackoverflow.com/a/22603155
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34324235
type: QuestionComment
has text: @MadProgrammer I understand your program but I have 3 doubts. 1) You used byte[] buffer = new byte[1024]. Does this mean you have assumed that the image you are going to receive can be only around 1 MB or does this mean something else? Don't mistake me but I don't get that line. 2)You convert everything to byte[] and send it to server, isn't there any other alternative? 3) Won't converting objects to byte[] and transferring them take more time?
comment on: http://stackoverflow.com/q/22552148
score: 0
type: Comment

http://stackoverflow.com/comment/34232875
comment on: http://stackoverflow.com/q/22498245
has text: Interfaces extending interfaces is similar to classes implementing interfaces, only the word is different.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34342318
has text: Note also that you can perfectly make it 2 projects
type: Comment
comment on: http://stackoverflow.com/a/22562666
score: 0
type: AnswerComment

http://stackoverflow.com/q/22499968
has title: Recognizing File Extension , Printing with different color to JTextArea
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/34231547
has body: I can recognize file extensions but still cant give different color for different extensions when I am printing to TextArea , is it because TextArea and all the font changes after running the program to *"serif", Font.ROMAN_BASELINE, 5* public void setScanResult(ArrayList&lt;String&gt; x) { for (int i = 0; i &lt; x.size(); i++) { if (x.get(i).endsWith(".txt")) { Font fono1 = new Font("sansserif", Font.BOLD, 50); textArea.setFont(fono1); textArea.append((String) x.get(i)); } else if (x.get(i).endsWith(".xls")) { Font fono2 = new Font("Monospaced", Font.ITALIC, 10); textArea.setFont(fono2); textArea.append((String) x.get(i)); } else { Font fono3 = new Font("serif", Font.ROMAN_BASELINE, 5); textArea.setFont(fono3); textArea.append((String) x.get(i)); } textArea.append("\n"); //textArea.append((String) x.get(i)); } x.clear();
has answer: http://stackoverflow.com/a/22500091
tagged with: swing
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: jtextarea
accepted answer: http://stackoverflow.com/a/22500091

http://stackoverflow.com/comment/34366976
type: Comment
has text: and `View arg0` represents an instance of a `View` on which you clicked... such as `Button` and `ImageView`...
comment on: http://stackoverflow.com/a/22576725
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34465203
type: Comment
has text: But you log shows this one: android.widget.TextView cannot be cast to android.widget.EditText
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22631540

http://stackoverflow.com/comment/34317183
comment on: http://stackoverflow.com/q/22547879
type: QuestionComment
score: 0
has text: It's `-d "D:\Developing Java\classes\"`
type: Comment

http://stackoverflow.com/comment/34547855
type: AnswerComment
comment on: http://stackoverflow.com/a/22650991
type: Comment
score: 0
has text: That's not really expected. Would you mind if I ask you to file an issue? - https://github.com/netty/netty/issues

http://stackoverflow.com/a/22493174
has comment: http://stackoverflow.com/comment/34220624
has comment: http://stackoverflow.com/comment/34220765
type: Answer
has body: The ActionListener for the income JTextField relys on the user pressing ENTER to set the income. If this doesnt happen then assignment tax = income * 0.10; will produce a value tax equal to 0. Ensure that the assignment for income occurs at the start of the ItemListener income = Integer.parseInt(jtfIncome.getText()); before the tax calculation is made.
accepted answer of: http://stackoverflow.com/q/22493102
score: 0
answers question: http://stackoverflow.com/q/22493102
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34220723

gui-testing
type: Tag
tags question: http://stackoverflow.com/q/22509323
tag name: gui-testing

http://stackoverflow.com/a/56481774
type: Answer
score: -1
downvote count: 1
has body: List item while(True): statement if(condition): break This is only work in python In java you can write like that for same purpose while(1==1) { Ststements... }
answers question: http://stackoverflow.com/q/22512830
has comment: http://stackoverflow.com/comment/99554271
upvote count: 0

http://stackoverflow.com/q/22628581
favorite count: 0
has answer: http://stackoverflow.com/a/22629384
tagged with: serialization
linked to: http://stackoverflow.com/q/22859618
has title: Performance cost of serialization and compress a Object in Java
has body: The application keeps receiving objects named Report and put the objects into Disruptor for three different consumers. With the help of Eclipse Memory Analysis, the Retained Heap Size of each Report object is 20KB on average. The application starts with -Xmx2048, indicating the heap size of the application is 2GB. However, the number of the objects is around 100,000 at a time, which means that the total size of all the object is roughly 2GB. The requirement is that all 100,000 objects should be loaded into Disruptor so that the consumers would consume the data asynchronously. But it's not possible if the size of each object is as large as 20KB. So I'd like to serialize the object to String and compress it: private static byte[] toBytes(Serializable o) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(o); oos.close(); return baos.toByteArray(); } private static String compress(byte[] str) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(out); gzip.write(str); gzip.close(); return new String(Base64Coder.encode(out.toByteArray())); } After compress(toBytes(Report)), the object size is smaller: Before compression After compression Right now the String of object is around 6KB. It's better now. Here's my question: Is there any other data format whose size is less than String? Calling serialization and compression each time will create objects like ByteArrayOutputStream, ObjectOutputStream and so on. I don't want to create to many objects like ByteArrayOutputStream, ObjectOutputStream because I need to iterate 100,000 times.How to design the codes so that objects like ByteArrayOutputStream, ObjectOutputStream only create once and use it for each iteration? Consumers need to deserialize and decompress the String from Disruptor. If I have three consumers so I need to deserialize and decompress three time…
tagged with: compression
tagged with: disruptor-pattern
has comment: http://stackoverflow.com/comment/34461314
has comment: http://stackoverflow.com/comment/34460466
accepted answer: http://stackoverflow.com/a/22629384
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34461532
tagged with: java
has comment: http://stackoverflow.com/comment/34460858
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/34460289
answer count: 1
has comment: http://stackoverflow.com/comment/34460415
score: 4

http://stackoverflow.com/comment/34541869
has text: Thanks a lot for your help, I'll try read up on it, I just thought I had done something wrong.
comment on: http://stackoverflow.com/a/22647097
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22547168
upvote count: 1
possible better answer: http://stackoverflow.com/a/22547286
has answer: http://stackoverflow.com/a/22547286
favorite count: 0
has answer: http://stackoverflow.com/a/22547276
has title: From jFreeChart Millisecond to java.util.Date
accepted answer: http://stackoverflow.com/a/22547276
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: jfreechart
type: Question
has answer: http://stackoverflow.com/a/22547277
tagged with: milliseconds
tagged with: date
answer count: 3
has body: Regarding jFreeChart's Millisecond, How can I get a java.util.Date object from a Millisecond instance? From the docs, it only seems possible to subtract the milliseconds within Millisecond. Since a Millisecond object is constructed like so: Millisecond ms = new Millisecond( millisec, second, minute, hour, day, month, year); I should be able to extract a valid Date object as well. Edit I need a Date object that gives back the exact time up to the millisecond accurate. Does .getStart() provide this? [ANSWER]: YES

http://stackoverflow.com/comment/34329190
type: Comment
comment on: http://stackoverflow.com/a/22554986
has text: Node.getParentNode() is taking me to subchildA but i want subchildA-childA for dataA
score: 0
type: AnswerComment

http://stackoverflow.com/a/22586918
answers question: http://stackoverflow.com/q/22586896
score: 0
has comment: http://stackoverflow.com/comment/34386153
type: Answer
has comment: http://stackoverflow.com/comment/34386093
has body: This is the "starting logic" for an empty LinkedList When you instantiate an object of type List, it is initially empty, so there is no firstNode and no lastNode, so they are both null

http://stackoverflow.com/a/22562086
upvote count: 1
score: 1
has body: You're correct that you cannot delete them in any kind of automatic way - they will never be orphans. I think the best you can do is just write yourself a helper method. e.g. if you have a ServiceDao class, you would just add a helper as: public void deleteServiceAndSettings(Service service) { for (UserServiceSettings setting : service.getUserServiceSettings()) { session.delete(setting); } session.delete(service); }
answers question: http://stackoverflow.com/q/22561384
downvote count: 0
type: Answer

http://stackoverflow.com/a/22508935
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22508874
type: Answer
has body: Store the primes in an array and display them at the end, outside the loop.

http://stackoverflow.com/a/22581461
score: 0
answers question: http://stackoverflow.com/q/22577071
has body: Thanks for the input guys much appreciated Best answer in my opinion : Even if it does, actually, throw a StringIndexOutOfBoundsException, you shouldn't rely on it because the documented contract of the method is to throw an IndexOutOfBoundsException. Oracle could decide, in Java 9, to throw a BrandNewException which extends IndexOutOfBoundsException, without breaking the documented contract. If you rely on StringIndexOutOfBoundsException being thrown, you rely on an implementation detail that might change in the future. Java OCA SE7 exam on wed !
type: Answer

http://stackoverflow.com/q/22624553
tagged with: java
type: Question
answer count: 1
score: 0
tagged with: android
has body: I am attempting to make a certain image a background image for an application. I know the syntax (android:src="*int*"), at least I think that's it. But I don't know what kind of a source I could use. A directory pointing to a file? A URL?
tagged with: http://stackoverflow.com/tag/xml
has title: Specifying Image Integer Android
has answer: http://stackoverflow.com/a/22624583
accepted answer: http://stackoverflow.com/a/22624583
type: AnsweredQuestion

http://stackoverflow.com/comment/34276854
type: Comment
has text: thanks balaji but to be precise i want to know about the syntax of this query in hibernate. can you help me with it?
type: AnswerComment
comment on: http://stackoverflow.com/a/22525575
score: 0

http://stackoverflow.com/a/22609340
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22609157
has comment: http://stackoverflow.com/comment/34426262
has body: Once you posted you can get the returned data like this: BufferedReader in = new BufferedReader( new InputStreamReader(conn.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close();

http://stackoverflow.com/comment/79598665
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22627581
has text: please use stringbuilder or stringbuffer if you are doing string concatenation

http://stackoverflow.com/a/22558302
answers question: http://stackoverflow.com/q/22558003
accepted answer of: http://stackoverflow.com/q/22558003
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: The function shouldn't be in your onCreate() edit your code like this public class Q1 extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.q1_screen); } public void q1b1 (View view1) { Toast.makeText(this, "Right", Toast.LENGTH_SHORT).show(); } public void q1b2 (View view2) { Toast.makeText(this, "Wrong! Try again", Toast.LENGTH_SHORT).show(); } public void q1b3 (View view3) { Toast.makeText(this, "Wrong! Try again", Toast.LENGTH_SHORT).show(); } public void q1b4 (View view4) { Toast.makeText(this, "Wrong! Try again", Toast.LENGTH_SHORT).show(); } }

http://stackoverflow.com/comment/34814790
type: Comment
has text: hi @jamesh, any other ideas?
comment on: http://stackoverflow.com/a/22677193
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34446902
comment on: http://stackoverflow.com/a/22580614
has text: hmm.. let me try this at home. what's in your `R.raw.keystore`?
type: AnswerComment
score: 0
type: Comment

byte
tags question: http://stackoverflow.com/q/22589528
tags question: http://stackoverflow.com/q/22642850
tag name: byte
tags question: http://stackoverflow.com/q/22548101
tags question: http://stackoverflow.com/q/22565560
tags question: http://stackoverflow.com/q/22596864
tags question: http://stackoverflow.com/q/22555745
tags question: http://stackoverflow.com/q/22602916
tags question: http://stackoverflow.com/q/22540678
tags question: http://stackoverflow.com/q/22498937
type: Tag

http://stackoverflow.com/q/22526146
has answer: http://stackoverflow.com/a/22709438
score: 25
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16296145
downvote count: 0
has title: How to enable CORS in apache tomcat
tagged with: java
has body: I am trying to consume some web services which are cross domain. When I disable chrome's web-security it is working fine. I want it to work without this so I have tried adding cross-domain.xml and still it didnt work. When i searched more, came to know about CORS enabling in tomcat. from http://www.w3.org/wiki/CORS_Enabled For Apache Apache can be configured to expose this header using mod_headers. This is enabled by default in Apache, however you may want to ensure it's enabled in your deployment by running the following command: a2enmod headers To expose the header, you can add the following line inside , , and sections, or within an .htaccess file. &lt;IfModule mod_headers.c&gt; Header set Access-Control-Allow-Origin "*" &lt;/IfModule&gt; Can anyone please let me know where to add these configurations in TOMCAT and in which files exactly. I am using tomcat from eclipse. Appreciate any help.
tagged with: eclipse
upvote count: 25
has answer: http://stackoverflow.com/a/28481422
type: Question
tagged with: cors
tagged with: apache
possible better answer: http://stackoverflow.com/a/22709438
accepted answer: http://stackoverflow.com/a/22528050
tagged with: tomcat
answer count: 3
duplicate of: http://stackoverflow.com/q/16296145
has answer: http://stackoverflow.com/a/22528050
favorite count: 0

http://stackoverflow.com/q/22510711
has comment: http://stackoverflow.com/comment/34289629
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34291137
has comment: http://stackoverflow.com/comment/34262195
has title: Struts2 - How to redirect to an action without using struts.xml?
has comment: http://stackoverflow.com/comment/34290791
tagged with: http-redirect
upvote count: 1
has comment: http://stackoverflow.com/comment/34256762
linked to: http://stackoverflow.com/q/16254934
type: Question
linked to: http://stackoverflow.com/q/20993574
has comment: http://stackoverflow.com/comment/34289706
tagged with: java
has comment: http://stackoverflow.com/comment/34295813
has comment: http://stackoverflow.com/comment/34304504
has comment: http://stackoverflow.com/comment/34289576
tagged with: struts2
has comment: http://stackoverflow.com/comment/34303064
has comment: http://stackoverflow.com/comment/34254140
has comment: http://stackoverflow.com/comment/34303665
tagged with: java-ee-6
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22533527
score: 1
linked to: http://stackoverflow.com/q/17449117
favorite count: 0
has body: My webserver prevents access to the system if the user is not logged in, but some users may have more than one profile and the system only allows users to log in choosing one of them, i.e., a user may be a regular user with some permissions and this same user may logout and login again with admin permissions and have access to everything. When this situation occurs I redirect the user to an action that forces the user to choose his/her profile, but the server no longer knows the action that the user tried to access. I'm able to retrieve this information through ActionInvocation like below: public String initFeature() { final ActionInvocation invocation = ServletActionContext.getActionContext(BaseAction.getRequest()) .getActionInvocation(); final Object action = invocation.getAction(); if (!this.isUserFullyLogged() &amp;&amp; !(action instanceof ProfileSelectionAction)) { final Boolean isPendingProfileSelection = (Boolean) this .retrieveSessionAttribute(Constants.PENDING_PROFILE_SELECTION); if (isPendingProfileSelection != null &amp;&amp; isPendingProfileSelection.booleanValue()) { this.saveSessionAttribute("action", action); this.saveSessionAttribute("namespace", invocation.getProxy().getNamespace()); return Constants.PROFILE_SELECTION; } return Action.LOGIN; } return Action.SUCCESS; } When the system reaches to the profile selection action I have the action and namespace that the user have tried to access and was forbid but I don't know what I have to do to redirect the system to this namespace and action because I only have done it using action result of the struts.xml file so far.

http://stackoverflow.com/a/22545439
score: 1
has body: The text of your question doesn't quite line up with your example - your question says that there must be t, then /, then a letter, then / again; but your example shows multiple letters between the slashes. Assuming that multiple letters are what you're after, you could use "t/[a-zA-Z]+/" - Note that the + sign is regular-expression-speak for "one or more".
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22544217

http://stackoverflow.com/q/22499488
type: UnansweredQuestion
has title: How to calculate web service client idle time
has answer: http://stackoverflow.com/a/22501271
tagged with: java
has answer: http://stackoverflow.com/a/22501064
type: Question
score: 0
answer count: 2
has body: A apache CXF based soap web service client consumes a web service which has a heart beat service as well. If the client did not send any request to the web service for 10 seconds, the client is supposed to send a heart beat request to the server. My question is how do we calculate this idle 10 seconds.
tagged with: cxf

http://stackoverflow.com/comment/34235361
score: 0
comment on: http://stackoverflow.com/q/22501975
type: Comment
type: QuestionComment
has text: Where have i to put it? in onCreate()? can you show me how? i never use this for check

http://stackoverflow.com/comment/34308780
type: QuestionComment
score: 2
has text: What is `IO` supposed to be? And why the `()` after month?
comment on: http://stackoverflow.com/q/22543416
type: Comment

http://stackoverflow.com/q/22615864
tagged with: if-statement
has answer: http://stackoverflow.com/a/22615917
has comment: http://stackoverflow.com/comment/34437533
has comment: http://stackoverflow.com/comment/34437858
has comment: http://stackoverflow.com/comment/34437783
has comment: http://stackoverflow.com/comment/34437790
has answer: http://stackoverflow.com/a/22615955
has answer: http://stackoverflow.com/a/22615937
upvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/22615916
favorite count: 0
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/34437724
has title: Do you need breaks in if statements?
has body: if (condition_1) do_1; else if (condition_2) do_2; else do_default; I understand this. What happens though if multiple conditions return true ? Does java stop after the first true condition or do I need a break ?
has comment: http://stackoverflow.com/comment/34437692
has comment: http://stackoverflow.com/comment/34437937
tagged with: java
has answer: http://stackoverflow.com/a/22615969
downvote count: 3
has comment: http://stackoverflow.com/comment/34437757
type: Question
has answer: http://stackoverflow.com/a/22615930
has answer: http://stackoverflow.com/a/22615940

http://stackoverflow.com/comment/34358716
comment on: http://stackoverflow.com/a/22547556
type: AnswerComment
score: 0
type: Comment
has text: I know Preferences class is the easy way .. That depends on how large is "large amount of questions" .. but you're rite about XML or txt file.. much simple and maintainable way..

http://stackoverflow.com/q/22626602
has body: My project is using some jars which are dependent on the external jar httpclient-4.2.3. In eclipse my project is running smoothly. But when I am creating a Jar of my project it is showing error. I found the error that it is picking httpclient from mahout jars which is an older version. I know we can control classpath ordering of external jars through order and export in eclipse but it is not working properly. Can someone tell me how I can force eclipse to prioritize some jars over another when I am creating jar of my projectc.
tagged with: java
tagged with: eclipse
score: 0
has title: External Jar Files issue Eclipse
tagged with: jar
has comment: http://stackoverflow.com/comment/34458207
has comment: http://stackoverflow.com/comment/34458177
has comment: http://stackoverflow.com/comment/34459534
tagged with: buildpath
answer count: 0
type: UnansweredQuestion
tagged with: classpath
type: Question

http://stackoverflow.com/comment/34394505
has text: In the onClick method i should set a text to the corresponding TextView. What are the differences between my and your code?
comment on: http://stackoverflow.com/a/22591868
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34308678
type: QuestionComment
comment on: http://stackoverflow.com/q/22543314
has text: This is a perfect use-case for regular expressions! I do not have an answer right now, but you should definitely look into that. The `matches` method uses regular expressions. Edit: I was too late, @mishadoff already got it :)
score: 0
type: Comment

http://stackoverflow.com/a/39834766
upvote count: 13
answers question: http://stackoverflow.com/q/22588733
has comment: http://stackoverflow.com/comment/102638550
downvote count: 0
has body: AWSCredentialsProvider credentialsProvider = new ProfileCredentialsProvider(); new AmazonEC2Client(credentialsProvider) .aws/credentials [default] aws_access_key_id = aws_secret_access_key =
type: Answer
score: 13

http://stackoverflow.com/a/50075264
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/88396239
downvote count: 1
answers question: http://stackoverflow.com/q/22579054
has comment: http://stackoverflow.com/comment/87167176
upvote count: 0
has body: public int solution(int[]A) { Arrays.sort(A); for(int i=0; i&lt;A.length;i++) { if (A[i]!=i+1) { System.out.println("0"); return 0; } } System.out.println("1"); return 1; }

http://stackoverflow.com/a/22621767
has comment: http://stackoverflow.com/comment/34449041
upvote count: 2
has comment: http://stackoverflow.com/comment/34448967
has comment: http://stackoverflow.com/comment/34448814
answers question: http://stackoverflow.com/q/22620807
has body: Brief example of MVC, well really Model-View. What this does is uses a Swing Timer and not Threads (not directly that is) to increment a JLabel held in a different class. It also uses PropertyChangeListener and support to notify the view (the GUI) of changes in the state of the model. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.text.NumberFormat; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.SwingPropertyChangeSupport; /** * http://stackoverflow.com/q/22620807/522444 * http://stackoverflow.com/a/22621767/522444 * @author Pete * */ @SuppressWarnings("serial") public class ShortMvc extends JPanel { private JTextField moneyField = new JTextField(10); private JTextField bucketField = new JTextField(10); private MoneyModel model = new MoneyModel(); private Timer timer = new Timer(model.getTimerDelay(), new TimerListener()); private JButton moneyButton = new JButton("Add Money"); private JButton bucketButton = new JButton("Add Bucket"); public ShortMvc() { moneyField.setEditable(false); moneyField.setFocusable(false); bucketField.setEditable(false); bucketField.setFocusable(false); bucketField.setText(String.valueOf(model.getBuckets())); add(new JLabel("Money:")); add(moneyField); add(moneyButton); add(new JLabel("Buckets:")); add(bucketField); add(bucketButton); moneyButton.getModel().addChangeListener(new MoneyBtnModelListener()); moneyButton.setMnemonic(KeyEvent.VK_M); bucketButton.addActionListener(new BucketButtonListener()); bucketButton.setMnemonic(KeyEvent.VK_B); model.addPropertyChangeListener(new ModelListener()); timer.setInitialDelay(0); } private class BucketButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { model.incrementBuckets(); } } private class MoneyBtnModelListener implements…
has comment: http://stackoverflow.com/comment/34449439
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34448823
downvote count: 0

http://stackoverflow.com/comment/34279291
type: QuestionComment
has text: There is indeed a pool with Integers in, just not all of them. Read http://stackoverflow.com/q/20877086/1081110
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22527163

http://stackoverflow.com/q/22564506
has comment: http://stackoverflow.com/comment/34376519
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22564709
has body: I want to pick up the RBG value of the color in the image when the mouse clicks the position of the color. Actually, I put the image on the top left corner in the jFrame. I try to get the mouse location, for example, x= 190, y=80, which is near the last pixel of the image. However, the image size is 200x24. Therefore, I cannot convert the mouse pointer position to the pixel of the image. Is there any method to do this? Thank you. Add more information: I create a jframe and put a jlabel which is the image at the top left corner of the jframe. What I want to do it is: when I use the mouse point and click the position on the image, I would get the color of this position. screen capture: https://i.sstatic.net/SjFhr.png [when i use the mouse point to the black position of the image, it shows r=240,g=240,b=240] frame.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { System.out.println(getPointerColor()); Thread.sleep(1000); } catch (AWTException awte) { System.out.println("Error while getting pointer's color!"); } catch (InterruptedException ie) { System.out.println("Error while sleeping!"); } } });
tagged with: java
accepted answer: http://stackoverflow.com/a/22564873
type: Question
has title: Pick the color in the image by coordinates
tagged with: image
has answer: http://stackoverflow.com/a/22564873
score: 0
possible better answer: http://stackoverflow.com/a/22564709
answer count: 2
tagged with: mouse-coordinates
linked to: http://stackoverflow.com/q/19757556

http://stackoverflow.com/a/22492852
answers question: http://stackoverflow.com/q/22492668
downvote count: 0
type: AcceptedAnswer
has body: Yes, that's fine. You should probably make it private static final though. In general there are issues with singletons; it's better for a class to accept the things it depends on as constructor parameters than for the class to depend on singletons. But lots of code treats logging specially, for better or worse.
has comment: http://stackoverflow.com/comment/34220650
has comment: http://stackoverflow.com/comment/34220385
has comment: http://stackoverflow.com/comment/34220475
has comment: http://stackoverflow.com/comment/34220030
type: Answer
has comment: http://stackoverflow.com/comment/34220102
accepted answer of: http://stackoverflow.com/q/22492668
has comment: http://stackoverflow.com/comment/35130640
score: 1
upvote count: 1

http://stackoverflow.com/comment/34278665
comment on: http://stackoverflow.com/q/22526170
has text: Are you using Eclipse by any chance?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22580969
upvote count: 1
has body: Change this: if(text.equals(null)) to: if(text == null)
answers question: http://stackoverflow.com/q/22580955
downvote count: 0
has comment: http://stackoverflow.com/comment/34374839
type: Answer
has comment: http://stackoverflow.com/comment/34374825
score: 1

http://stackoverflow.com/comment/34269572
score: 0
type: Comment
has text: Sorry, -99 to 99. It will never produce -100 or 100.
comment on: http://stackoverflow.com/a/22520395
type: AnswerComment

http://stackoverflow.com/comment/34286879
type: AnswerComment
type: Comment
has text: In case user3441604 is reading that and confused: `(0xFEDCBA98 >> 24) == 0xFFFFFFFE` because of how shifting works in Java, but `(byte)0xFFFFFFFE == (byte)0xFE` so it doesn't matter.
comment on: http://stackoverflow.com/a/22531134
score: 0

http://stackoverflow.com/q/22534171
score: 1
tagged with: java
has body: This is the instructions of my assigment: "Construct a program that lets the user create different words from random letters consequences. The words must be checked against a dictionary." This is the code so far: import java.util.Arrays; public class AngloTrainer { // ... public AngloTrainer(String dictionaryFile) throws IOException { // load dictionary? //what else? } private String sort(String s){ //Sort the letters in a string. char[] tecken = s.toCharArray(); String sorted = Arrays.sort(tecken); return sorted; } // use this to verify loadDictionary private void dumpDict() { // Print out the dictionary at the screen. // ... define! } private void loadDictionary( String fileName ) { // Read the dictionary into a suitable container. // The file is a simple text file. One word per line. FileReader flr = new Filereader(fileName); BufferedReader bfr = new BufferedReader(flr); String line; //collection/treeset?? maybe other?? while((line = bfr.readLine()) !=null ){ //save to a collention, but which? } } private String randomLetters( int length ) { // this makes vovels a little more likely String letters = "aabcdeefghiijklmnoopqrstuuvwxyyz"; StringBuffer buf = new StringBuffer(length); for ( int i = 0; i &lt; length; i++ ) buf.append( letters.charAt(randomGenerator.nextInt(letters.length()))); return buf.toString(); } /* Def. includes * Let #(x,s) = the number of occurrences of the charcter x in the string s. * includes(a,b) holds iff for every character x in b, #(x,b) &lt;= #(x,a) * * A neccessary precondition for includes is that both strings are sorted * in ascending order. */ private boolean includes( String a, String b ) { if ( b == null || b.length() == 0 ) return true; else if ( a == null || a.length() == 0 ) return false; //precondition: a.length() &gt; 0 &amp;&amp; b.length() &gt; 0 int i = 0, j = 0; while ( j &lt; b.length() ) { if (i &gt;= a.length() || b.charAt(j) &lt; a.charAt(i)) return false; else if (b.charAt(j) == a.charAt(i)) { i++; j++; } else if (b.c…
downvote count: 0
answer count: 1
tagged with: hashset
tagged with: sorting
has comment: http://stackoverflow.com/comment/34292073
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34291983
has answer: http://stackoverflow.com/a/22535785
has title: How to create words of random letters?
tagged with: treeset
has comment: http://stackoverflow.com/comment/34292065
upvote count: 1
type: Question
tagged with: algorithm

http://stackoverflow.com/comment/34494817
score: 1
has text: @COOLBEANS It complies, yes. But I'm saying that when the line `total += (int)myQueue2.dequeue();` executes and the thing you take out of the queue is not actually an integer, you'll get an exception. If you're saying that that's not true, I'd like to see the exact code that makes you think so.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22647287

http://stackoverflow.com/q/22536284
has comment: http://stackoverflow.com/comment/34295872
has comment: http://stackoverflow.com/comment/34296489
score: 0
has comment: http://stackoverflow.com/comment/34298448
has comment: http://stackoverflow.com/comment/34296098
has comment: http://stackoverflow.com/comment/34296984
answer count: 0
type: UnansweredQuestion
tagged with: spring
has title: Spring JPA JUnit test autowired failed
has body: I have the following files: ProjectRepository.java public interface ProjectRepository extends JpaRepository&lt;Project, Long&gt; { @Query("select p from Project p where p.projectName = ?1") Project findByProjectName(String projectName); } db-config.xml &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"&gt; &lt;jpa:repositories base-package="com.xxx.hcs.persistence.repository" /&gt; &lt;context:component-scan base-package="com.xxx.hcs.persistence"/&gt; &lt;!-- Working version of Oracle Database --&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" p:driverClassName="oracle.jdbc.OracleDriver" p:url="jdbc:oracle:thin:@hrsdev.xxx.net:1548:hrsdev" p:username="xxx" p:password="xxx" &gt; &lt;/bean&gt; &lt;bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;/bean&gt; &lt;bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt; &lt;/bean&gt; &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt; &lt;context:annotation-config /&gt; &lt;/beans&gt; ProjecRepositoryTest.java @ContextConfiguration(loc…
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/34296297
has comment: http://stackoverflow.com/comment/34297435
tagged with: jpa

http://stackoverflow.com/comment/34443685
has text: More questions and references to stuff that you only know! How is anyone supposed to answer questions about code you don't post?
comment on: http://stackoverflow.com/q/22619058
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/34252204
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22511930
has text: Of course, still, the Java code remains ugly in this case ;-)
score: 0

http://stackoverflow.com/a/22629328
score: 0
answers question: http://stackoverflow.com/q/22629232
has body: Try something like this: String s = ""; for (int n : myArray){ s += n + "*"; } Being myArray the array of int you have. In case myArray is {2,2,3,5,0,0,0,0} this will print out: 2*2*3*5*0*0*0*0* You have to take into account the checking for the last element of the array if you don't want to print * after the last element.
type: Answer

http://stackoverflow.com/q/22526257
tagged with: openjpa
has body: I'm using optimistic locking in my persistence context and trying to figure out a way to avoid write locking entity by updates to some entity fields. Here's an example: @Entity public class A { private String field1; private String field2; @Version private long version; } So what I need is to avoid write locks (i.e. increment of a version field at the end of transaction) to the entity when updating field2, but still to have the default behavior on updates of any other entity field. The solution I've figured out so far is to create my own versioning strategy (extend NumberVersionStrategy in case of example) to avoid incrementing entity's version if only specified fields were updated (only field2 in the example above). But this solution looks quite complex to me... Isn't there a special annotation for a field to exclude it from entity versioning or something? )
type: Question
has answer: http://stackoverflow.com/a/22533763
tagged with: java
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22533763
has title: OpenJPA: Exclude field update from an optimistic lock
type: AnsweredQuestion

http://stackoverflow.com/a/22614109
has comment: http://stackoverflow.com/comment/34435363
score: 4
has body: Add the enum values in an attribute of your request: // ProjectStatusEnum.values() return an array of ProjectStatusEnum request.setAttribute("enum", ProjectStatusEnum.values()); And finally, within your JSP: &lt;ul class="dropdownmenu"&gt; &lt;c:forEach items="${enum}" var="entry"&gt; &lt;li&gt;${entry.key} (${entry.value})&lt;/li&gt; &lt;!-- for example --&gt; &lt;/c:forEach&gt; &lt;/ul&gt;
type: Answer
accepted answer of: http://stackoverflow.com/q/22613976
upvote count: 4
answers question: http://stackoverflow.com/q/22613976
has comment: http://stackoverflow.com/comment/34434487
downvote count: 0
has comment: http://stackoverflow.com/comment/34435998
has comment: http://stackoverflow.com/comment/34434328
type: AcceptedAnswer

http://stackoverflow.com/q/22529255
has answer: http://stackoverflow.com/a/22529528
upvote count: 2
answer count: 2
has body: I need to just copy metadata from one json node and add it to another. My problem is ObjectNode.put("key":"value") overrides the existing data, but i need to add them. Example: {"metadata":{ "foo":1, "boo":2}} merged with {"metadata": {"ba":7}} should be {"metadata":{"foo":1, "boo":2,"ba":7}} Should be quite simple, but i don't get it :( So any help would be appreciated!
downvote count: 0
possible better answer: http://stackoverflow.com/a/22529462
tagged with: jackson
favorite count: 0
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22529528
has title: add key value pairs to jsonobject using jackson
has answer: http://stackoverflow.com/a/22529462
type: Question
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/22592453
has answer: http://stackoverflow.com/a/22592469
has title: Exception in thread "main" java.lang.Error: Unresolved compilation problems(String)
has comment: http://stackoverflow.com/comment/34395936
has comment: http://stackoverflow.com/comment/34396740
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34410020
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34395563
upvote count: 1
has answer: http://stackoverflow.com/a/22592506
type: Question
accepted answer: http://stackoverflow.com/a/22592493
has comment: http://stackoverflow.com/comment/34396233
has answer: http://stackoverflow.com/a/22609210
has body: The final code looks like this. Fixed the errors and understood the concepts of inheritance. Thanks to you guys who responded to my post. Your replies were helpful. Account Class public class Account { String name; String number; public double balance; public class Account { public String acctnum; public String accttitle; public Double acctbal; public String accttitle2; public Account() { } public void withdraw(Double amount) { acctbal=acctbal-amount; } public void deposit(Double amount) { acctbal=acctbal+amount; } public double zakat() /*In Islam Zakat is deducted every year from saving accounts in holy month of Ramadan */ { Double z=acctbal*0.025; return z; } public void showdetail() { System.out.println("The Account Number ="+acctnum); System.out.println("The Account Title ="+accttitle); System.out.println("The Account Balance ="+acctbal); } } Current Account Class public class CurrentAccount extends Account { public CurrentAccount(String Num,String Title,double Bal) { acctnum = Num; accttitle = Title; acctbal = Bal; } public double tax() { double t= acctbal*0.05; return t; } } Joint Account Class public class JointAccount extends Account { public String accttitle2; public JointAccount(String Num,String Title,String accttitle_1,double Bal) { acctnum = Num; accttitle=Title; accttitle2=accttitle_1; acctbal =Bal; } public void showdetail() //Overrding { System.out.println("The Account Number = " + acctnum); System.out.println("The Account Title = " + accttitle + " and " + accttitle2); System.out.println("The Account Balance = " + acctbal); } public double calculatetax() { double t= acctbal*0.09; return t; } } SavingAccount Class public class savingAccount extends Account { public savingAccount(String Num,String Title,Double Bal) { super.acctnum =Num; super.accttitle=Title; super.acctbal =Bal; } public double tax() { double t= acctbal*0.07; return t; } public void withdraw(double amount) { super.withdraw(amount); if(acctbal&lt;1000){ acctbal=acctbal-150; } } } Follow…
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/22592469
has answer: http://stackoverflow.com/a/22592493
has comment: http://stackoverflow.com/comment/34395676

http://stackoverflow.com/comment/34311682
has text: Does this approach with several persistance units also work with annotations? Do you have any hints for me?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22536079
type: Comment

http://stackoverflow.com/comment/34438680
has text: I get only one Boo, when I run the code.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22616518

http://stackoverflow.com/a/22511503
type: Answer
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22508328
answers question: http://stackoverflow.com/q/22508328
upvote count: 3
type: AcceptedAnswer
has body: Vertical separator in JMenuItem? The only thing which comes to my mind and which you can treat as a JSeparator is something like below: But this left "JSeparator" is not an extra added JSeparator, but depends on LookAndFeel. Below you see the same JFrame with the same JMenuBar but with different lookandfeel: The code for both screens is exactly the same, but executed with different look and feels: public class NewClass extends JFrame { public NewClass() throws HeadlessException { JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("File"); menuBar.add(menu); menu.add(new JMenuItem("Open...")); menu.add(new JMenuItem("Save")); menu.add(new JMenuItem("Save as...")); menu.addSeparator(); menu.add(new JMenuItem("Delete")); setJMenuBar(menuBar); setSize(new Dimension(500,500)); setVisible(true); } public static void main(String[] args) { try { //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); new NewClass(); } catch (ClassNotFoundException ex) { Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex); } } } Note, that menu.add(new JSeparator(JSeparator.VERTICAL)); will not generate any separator at all (you can try)

http://stackoverflow.com/a/22599244
has comment: http://stackoverflow.com/comment/34408181
has body: Line super(kształt) is trying to find the constructor which accept only String argument but it could not find any constructor with that signature. You are not providing the constructor which accept only String in your shape class. All the provided constructor are accepting different argument. Java Compiler is not able to find the constructor with only String as argument. Choice 1 - You can add the constructor in super class. public Shape(String kształt) { nazwaKształtu = kształt; } Choice 2 - if for some reason you are not able to add constructor in super class then you may need to call the corresponding constructor like super(w, ksztatt);
has comment: http://stackoverflow.com/comment/34408014
has comment: http://stackoverflow.com/comment/34408098
score: 1
has comment: http://stackoverflow.com/comment/34408155
upvote count: 1
answers question: http://stackoverflow.com/q/22599227
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34339590
has text: If that's the URL that you were sent in JSON - where do you get the PDF contents? The user shouldn't be passing bytes here. It's a GET request - they want you to send back the document they've requested. You either have it, create it, or tell them it's not available.
type: Comment
comment on: http://stackoverflow.com/a/22561437
score: 0
type: AnswerComment

http://stackoverflow.com/q/22567917
tagged with: c#
duplicate of: http://stackoverflow.com/q/355060
score: 0
linked to: http://stackoverflow.com/q/31693
answer count: 2
has title: Is Generic Types in C # like in Java?
has comment: http://stackoverflow.com/comment/34352012
has answer: http://stackoverflow.com/a/22567982
upvote count: 1
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/355060
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22567972
has body: I studied Java for a long time and am well acquainted with the operation of generic types in the language : I know there are only at compile time , suffering type erasure at the end of it ( so that at runtime this information is not available ) and have some notion of the difficulties when applying polymorphism on generic types . Now I am learning C # , and I noticed that although this language use similar notation ( Type ) semantics does not seem the same . For example , to see that question did the C # runtime stores the information of the generic types instead of discarding it , unlike Java, is that correct? Also, I have never seen an example in C # that utilizes " jokers " ( wildcards ) and type &lt; ? extends TipoGenerico > . This is possible ( or even necessary ) in that language ? Finally , C # supports individual methods ( not just classes ) generics ? If yes , what is the equivalent syntax of this construction in Java : public &lt;T&gt; void method (T parameter1 , parameter2 &lt;T&gt; List ) { If there are any additional details that deserves emphasis , or maybe some reference material to learn more , will also be welcome.
tagged with: java
type: Question

http://stackoverflow.com/comment/34402331
type: QuestionComment
has text: How do you suggest I fix my issue then with the GridLayout or JScrollbar in place?
comment on: http://stackoverflow.com/q/22595531
score: 0
type: Comment

http://stackoverflow.com/comment/34455752
type: QuestionComment
score: 0
has text: `Builder` pattern helps you to pass any number of arguments based upon the requirement. You can just pass only the arguments that are needed. Please checkout builder pattern whether it fits your requirement
type: Comment
comment on: http://stackoverflow.com/q/22625754

http://stackoverflow.com/comment/34366233
has text: You cannot do that. See here: http://stackoverflow.com/questions/6594461/add-keylistener-to-jlabel
type: QuestionComment
comment on: http://stackoverflow.com/q/22576251
score: 0
type: Comment

http://stackoverflow.com/a/22613878
type: Answer
has comment: http://stackoverflow.com/comment/34433897
has comment: http://stackoverflow.com/comment/34434705
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22613770
has comment: http://stackoverflow.com/comment/34435074
has body: It looks to me like the Bitmap you are trying to store in memory is too large to be stored in your tablet/emulator's memory. Here; bm = BitmapFactory.decodeFile(path); See if the code works with a much smaller file than the one that is coming from your current path (also see if it works with a smaller list). This could also be an instance of 'The straw that broke the camel's back'. If your current application is already very memory intensive you might have to go through your current code and optimise for memory management. Because your are creating an AsyncTask for each item in the ListView, your trying to hold that many images in memory at once. So you might need to find another way to do it. You might need to try loading the image's thumbnail into your ImageViews instead. An example of getting an images thumbnail. I hope this helps. An Example Implementation Just to run through a potential way to implement the above linked thumbnail example, what I might do to get the thumbnail is I could store the context passed to your ChatCursorAdapter by adding the following as a class variable (and instantiate it in the constructor); Context ourContext; public ChatCursorAdapter(Context context, Cursor c) { super(context, c, 0); ourContext = context; } @Override public void bindView(View view, Context context, Cursor cursor) { ... new AsyncImageSetter(holder.myImage, picPath, ourContext.getContentResolver()).execute(); ... } Then (as above) I might use the Context to get the ContentResolver instance and pass that instance into your AsyncTask via it's constructor. Then we could add the method in the example code to get the thumbnail into the custom AsyncTask, which might look something like this; ContentResolver cr; public AsyncImageSetter(ImageView img, String path, ContentResolver cr) { this.img = img; this.path = path; this.cr = cr; } ... @Override protected Void doInBackground(Void... params) { try{ bm = getThumbnail(cr, path); }catch(Exception e){} return null; } private B…
has comment: http://stackoverflow.com/comment/34437079
has comment: http://stackoverflow.com/comment/34436959
has comment: http://stackoverflow.com/comment/34436285
accepted answer of: http://stackoverflow.com/q/22613770
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34437286
has comment: http://stackoverflow.com/comment/34434359
has comment: http://stackoverflow.com/comment/34434410
has comment: http://stackoverflow.com/comment/34435980

http://stackoverflow.com/comment/34465780
has text: Thanks for the answer, this all works right, so I am able to build everything when I do it in the parent folder. But is there any possibility to build only one project, with the project resolving its dependencies in the same module? So I don't want to call install in every module, but I want to run test in the integration-test module, to only start the testing of the other modules. Is there any possibility to do so?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22616624

http://stackoverflow.com/q/22637900
possible better answer: http://stackoverflow.com/a/22637993
has comment: http://stackoverflow.com/comment/34478751
answer count: 10
favorite count: 0
has answer: http://stackoverflow.com/a/55862514
score: 128
tagged with: anonymous-class
has answer: http://stackoverflow.com/a/31982211
has answer: http://stackoverflow.com/a/46024789
has answer: http://stackoverflow.com/a/33874965
has comment: http://stackoverflow.com/comment/34476598
has comment: http://stackoverflow.com/comment/71687521
linked to: http://stackoverflow.com/q/22375891
has title: Java8 Lambdas vs Anonymous classes
has answer: http://stackoverflow.com/a/22640484
accepted answer: http://stackoverflow.com/a/22640484
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/22637993
type: AnsweredQuestion
tagged with: java
upvote count: 129
has answer: http://stackoverflow.com/a/64763885
has body: Since Java8 has been recently released and its brand new lambda expressions looks to be really cool, I was wondering if this means the demise of the Anonymous classes that we were so used to. I've been researching a bit about this and found some cool examples about how Lambda expressions will systematically replace those classes, such the Collection's sort method, which used to get an Anonymous instance of Comparator to perform the sort: Collections.sort(personList, new Comparator&lt;Person&gt;(){ public int compare(Person p1, Person p2){ return p1.firstName.compareTo(p2.firstName); } }); Now can be done using Lambdas: Collections.sort(personList, (Person p1, Person p2) -&gt; p1.firstName.compareTo(p2.firstName)); And looks surprisingly concise. So my question is, is there any reason to keep using those classes in Java8 instead of Lambdas? EDIT Same question but in the opposite direction, what are the benefits of using Lambdas instead of Anonymous classes, since Lambdas can only be used with single method interfaces, is this new feature only a shortcut only used in few cases or is it really useful?
has answer: http://stackoverflow.com/a/69337766
has comment: http://stackoverflow.com/comment/81454473
has comment: http://stackoverflow.com/comment/34478655
downvote count: 1
has comment: http://stackoverflow.com/comment/69772830
type: Question
has answer: http://stackoverflow.com/a/54651915
has answer: http://stackoverflow.com/a/78255477
linked to: http://stackoverflow.com/q/24764118
has comment: http://stackoverflow.com/comment/34477168

http://stackoverflow.com/a/22514124
score: 0
answers question: http://stackoverflow.com/q/22513607
has body: NumberFormat is an interface so there can be multiple implementations. public String getPattern(NumberFormat numberFormat) { if(numberFormat instanceof java.text.DecimalFormat) return ((java.text.DecimalFormat)numberFormat).toPattern(); if(numberFormat instanceof java.text.ChoiceFormat) return ((java.text.ChoiceFormat)numberFormat).toPattern(); throw new IllegalArgumentException("Unknown NumberFormat implementation"); } Please note that this will work today, but may break in the future when other implementations are added.
type: Answer

builder
tags question: http://stackoverflow.com/q/22645563
tag name: builder
type: Tag

http://stackoverflow.com/comment/34381802
type: Comment
comment on: http://stackoverflow.com/a/22584307
type: AnswerComment
has text: Maybe this? http://stackoverflow.com/questions/196017/unique-random-numbers-in-o1
score: 0

http://stackoverflow.com/comment/34262834
has text: yes, package name is correct as I am converting my exiting project into maven and it was working previously..is this something I need to put WEB-INF folder inside main? I have'nt change the WebContent folder structure
comment on: http://stackoverflow.com/q/22517529
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22545729
answers question: http://stackoverflow.com/q/22545685
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: You declared your references clone1 and clone2 to refer to the same object as v (and discarded the new Vector()s that were just created). Using the assignment operator = with an object doesn't clone the object; it just makes another reference to refer to the same object. v ----&gt; Vector object ^ clone1 --+ You can create copies of your Vector by saying Vector clone1 = new Vector(v); Visually... v ----&gt; Vector object clone1 ----&gt; Cloned Vector object
accepted answer of: http://stackoverflow.com/q/22545685

http://stackoverflow.com/comment/34804566
has text: @DarranL, you *must* file a bug with Oracle. This is the only way to have it fixed.
type: AnswerComment
comment on: http://stackoverflow.com/a/22682489
score: 0
type: Comment

http://stackoverflow.com/a/22613747
has body: I use HttpURLConnection instead of DefaultHttpClient. An example here: ... protected String doInBackground(String... args) { ... downloadPage("http://www.mysite.com"); ... } private void downloadPage (String url){ try{ URL obj = new URL(url); // Send post request HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); //wr.writeBytes("myurlParameters"); wr.flush(); wr.close(); InputStream is = con.getInputStream(); InputStreamReader isr = new InputStreamReader(is,"ISO-8859-1"); BufferedReader br = new BufferedReader(isr); for (String line = br.readLine(); line != null ; line = br.readLine()) { // the variable line contains the line of text. You can insert it in your database of file } con.disconnect(); } catch (Exception e){ // TODO error handling } } ...
has comment: http://stackoverflow.com/comment/34437578
type: Answer
answers question: http://stackoverflow.com/q/22613492
has comment: http://stackoverflow.com/comment/34435856
has comment: http://stackoverflow.com/comment/34434065
has comment: http://stackoverflow.com/comment/34435219
score: 0

http://stackoverflow.com/comment/36654027
has text: @user838204 Whether you have enough size is based on how much free disk space you have;. If you have only 1 TB free, you can queue up to 1 TB.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22629384
type: Comment

http://stackoverflow.com/comment/34400878
comment on: http://stackoverflow.com/q/22595349
has text: I am not aware about Junit requiring you to override equals. Can you post more context please ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34359600
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22572188
has text: I totally understand that "classes" can be loaded and instantiated- This part makes sense because you are essentially just pulling in packages from another bundle. The case I described is different. I'm talking about a service that BundleA holds. The service itself is exported and still lives in BundleA. When BundleB asks BundleA to cal the method "serviceMethod()" on and takes the object returned, how does that object make its way to BundleB?
type: AnswerComment

http://stackoverflow.com/q/22564342
accepted answer: http://stackoverflow.com/a/22564495
downvote count: 2
possible better answer: http://stackoverflow.com/a/22564489
has answer: http://stackoverflow.com/a/22564553
type: AnsweredQuestion
tagged with: android-fragments
score: -2
tagged with: java
type: Question
has body: I've got a method that resets a text field in a fragment to " ". This worked fine when everything was in MainActivity. The problem is, ((EditText)v.findViewById(R.id.edAreaxml)).setText("");. Fragment code is: public class DataEdit extends Fragment implements OnClickListener { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.dataedit, container, false); Button btnResetForm = (Button) v.findViewById(R.id.btnResetFormxml); btnResetForm.setOnClickListener(this); return v; } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btnResetFormxml: resetForm(v); break; } } public void resetForm(View v) { ((EditText) v.findViewById(R.id.edAreaxml)).setText(""); //THIS IS THE PROBLEM } XML: &lt;TableRow&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Area"&gt; &lt;/TextView&gt; &lt;EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/edAreaxml"&gt; &lt;/EditText&gt; &lt;/TableRow&gt; UPDATE: Per answers 1 and 3, the following adjustments have been made. There is still a problem. LogCat output is at bottom. public class DataEdit extends Fragment implements OnClickListener { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.dataedit, container, false); Button btnResetForm = (Button)v.findViewById(R.id.btnResetFormxml); btnResetForm.setOnClickListener(this); //EditText edArea=(EditText)v.findViewById(R.id.edAreaxml); return v; }@Override public void onClick(View v) { switch (v.getId()) { case R.id.btnResetFormxml: resetForm(v); break; } } public void resetForm(View v) { EditText edArea=(EditText)v.findViewById(R.id.edAreaxml); edArea.setText(" ");//PROBLEM IS HERE } } Logcat is: 03-21 09:35:20.735: E/Trace(1013): error opening trace file: No such file or directory (2) 03-21 09:35:21.795: D/grallo…
upvote count: 0
has answer: http://stackoverflow.com/a/22564489
favorite count: 0
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/34344856
has title: Setting text in a fragment in Android
has answer: http://stackoverflow.com/a/22564495

http://stackoverflow.com/comment/34233360
type: Comment
has text: That's great!.. Can you explain more about the *mapping*?
score: 0
comment on: http://stackoverflow.com/a/22501058
type: AnswerComment

http://stackoverflow.com/comment/34350023
type: Comment
type: QuestionComment
has text: Say, I want to add 2 hex numbers, but not add them as ints and print the result as hex.
score: 0
comment on: http://stackoverflow.com/q/22567272

http://stackoverflow.com/q/22594886
upvote count: 16
accepted answer: http://stackoverflow.com/a/22595182
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/77816608
has answer: http://stackoverflow.com/a/22602708
tagged with: java
has comment: http://stackoverflow.com/comment/102003562
type: Question
tagged with: thymeleaf
downvote count: 0
has body: I am a beginner with ThymeLeaf and have not used SpEL too much except for @PreAuthorize annotations, so please be so kind to help me out. I am using ThymeLeaf (version 2.1.2) together with Spring (4.0.2.RELEASE) and the thymeleaf-spring4 package which (as far as I understood it) replaces the default OGNL scripting with SpEL. What I want to achieve is simply that a localized string is capitalized via #strings.capitalize function. Here is what I tried so far: Text to be replaced Works perfectly and gives the expected result. Now when I tried this: Text to be replaced I got the following exception (root cause, rest omitted for clarity): org.springframework.expression.spel.SpelParseException: EL1043E:(pos 21): Unexpected token. Expected 'identifier' but was 'lcurly({)' Ok, fine. Just for fun, I omitted the curly brackets and got what I expected: the was empty. So now I thought that it might necessary to preprocess the retrieval of the message for retrievable.key so that it is already evaluated when #strings.capitalize is evaluated. Though this seemed bot either counterintuitive and illogical to me, as this would break all programming rules, I tried that approach. It did not work either: using ${#strings.capitalize(__#retrievable.key__)} lead to org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "#retrievable.key" and using ${#strings.capitalize(__#{retrievable.key}__)} led to (you guessed it) . I know that the actual problem can be solved with CSS or JavaScript, but it's not necessarily about uppercasing or capitalizing, but on processing of localized strings and this is an example. So what am I missing here? Solution provided by Thymeleaf Forum Zemi of the ThymeLeaf Forum provided the following, elegant solution: Text to be replaced Please notice the single quotes. Preprocessing seems to really mean preprocessing in Thymeleaf. I have accepted the first working answer, however.
favorite count: 0
has answer: http://stackoverflow.com/a/29040610
tagged with: spring-el
has answer: http://stackoverflow.com/a/22595182
has title: How can localized messages in Thymeleaf be processed using SpEL
answer count: 4
tagged with: localization
has answer: http://stackoverflow.com/a/77816608
score: 16
tagged with: spring

http://stackoverflow.com/comment/34308524
score: 2
comment on: http://stackoverflow.com/a/22543156
has text: @Abdul Yes, absolutely. Besides `main()` you might run a process in a background thread and then need to update your GUI. Again, you can't update it from the background thread, instead you would use the same technique to get back onto the EDT to notify your GUI.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22707666
answers question: http://stackoverflow.com/q/22637329
score: 0
type: AcceptedAnswer
has body: I have found this solution whith a different If statement: if(visite_current_patient.length &lt; 2) public void onTaskComplete(Object[] output) { super.onTaskComplete(output); Integer resultOperation = (Integer) output[0]; if (output != null &amp;&amp; resultOperation != 500) { String typeTask = (String) output[1]; if (typeTask.equals("SearchListVisite")) { switch (resultOperation) { case 200: Visita[] visite_current_patient = (Visita[]) output[2]; if(visite_current_patient.length &lt; 2) { visite_current_patient = createVisteListEmpty(); } fillVisiteList(visite_current_patient); break; case 204: Visita[] visitaEmpty = createVisteListEmpty(); fillVisiteList(visitaEmpty); break; } } else { CharSequence testo = "Errore!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(this, testo, duration); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); onBackPressed(); } } }
type: Answer
accepted answer of: http://stackoverflow.com/q/22637329

http://stackoverflow.com/comment/34403160
type: Comment
comment on: http://stackoverflow.com/a/22590955
score: 0
type: AnswerComment
has text: Thanks, I'm having a play around, almost there now! Your help was amazing, thank you again. I can't vote up as I don't have enough reputation :(

http://stackoverflow.com/comment/34339328
type: Comment
has text: android studio is funky. That's probably why it didn't give me the option to import it. This code definitely looks like it's very versatile but I think it might be too complicated for me. I've managed to figure out a solution to my problem just by tweaking the code I already have. I'll definitely be bookingmarking this page for future use. I'd like to thank you though for your troubles in trying to fix my stupidity lol
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22544333

http://stackoverflow.com/q/22590530
upvote count: 1
tagged with: java
has body: I'd like to ask if someone could help me out with regex which will match all \n except \n that is after ; Example: test test1 test2; test test1; test test1; will be changed to testtest1test2; testtest1; testtest1;
possible better answer: http://stackoverflow.com/a/22590581
has answer: http://stackoverflow.com/a/22590581
accepted answer: http://stackoverflow.com/a/22590590
type: AnsweredQuestion
has title: Regex for replacing all newlines that are not after ';'
downvote count: 0
has answer: http://stackoverflow.com/a/22590589
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34392154
has comment: http://stackoverflow.com/comment/34392144
has comment: http://stackoverflow.com/comment/34392184
tagged with: regex
has comment: http://stackoverflow.com/comment/34392162
has answer: http://stackoverflow.com/a/22590590
answer count: 3

http://stackoverflow.com/q/22587330
favorite count: 0
type: Question
tagged with: getter-setter
accepted answer: http://stackoverflow.com/a/22587389
score: 4
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/22587498
downvote count: 1
has answer: http://stackoverflow.com/a/22587498
has title: Explain this output
upvote count: 5
has body: class A { private int a = 10; public int getA() { return a; } public void setA(int a) { this.a = a; } } class B extends A { public int a = 20; } public class Demo { public static void main(String args[]) { B a = new B(); System.out.println(a.getA()); } } output: 10 since all the fields in parent class live in the Child object, there are two fields that shares the same name (a) and getter and setter in the Child object so how java resolve this getter and setter method for private field in parent class ?
tagged with: inheritance
has answer: http://stackoverflow.com/a/22587389
type: AnsweredQuestion

http://stackoverflow.com/comment/34461053
comment on: http://stackoverflow.com/q/22629084
type: Comment
has text: Why do we get so many Date/String conversion questions without searching on Google??? Search for `SimpleDateFormat`
score: 0
type: QuestionComment

http://stackoverflow.com/q/22637410
has comment: http://stackoverflow.com/comment/34475984
has answer: http://stackoverflow.com/a/22660396
type: Question
tagged with: algorithm
tagged with: porter-stemmer
tagged with: stemming
score: 0
answer count: 2
type: UnansweredQuestion
has body: I've been looking at word stemming algorithms such as the porter algorithm, but everything I've found so far has dealt with files as input. Are there any existing algorithms which would let me simply pass the stemmer a string, and have it return the stemmed string? Something like: String toBeStemmed = "The man worked tirelessly"; Stemmer s = new Stemmer(); String stemmed = s.stem(toBeStemmed);
has answer: http://stackoverflow.com/a/22637502
has title: A simple stemming algorithm with String for input
tagged with: java

http://stackoverflow.com/a/22628966
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22628762
type: Answer
has body: As commentators suggest, I'd use a JPA framework to do that, but if you prefer using raw JDBC, then you can use the method ResultSet.getMetaData() to obtain the number of columns and their names: ResultSetMetaData md=rslt.getMetaData(); List&lt;String&gt; columns= new ArrayList&lt;&gt;(); for (var i=0;i&lt;md.getColumnCount();i++) { columns.add(md.getColumnName(i+1)); //first one is in position 1, not 0 }
score: 0
accepted answer of: http://stackoverflow.com/q/22628762

http://stackoverflow.com/comment/34382885
has text: The comments are getting unwieldy... anyone want to continue this discussion on Java chat? http://chat.stackoverflow.com/rooms/139/java
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22584807
score: 0

http://stackoverflow.com/comment/34282530
score: 0
type: AnswerComment
has text: Doh, thanks guys until @BillShannon comment I was totally failing to see that I had the setText() method in there as well as setContent(), removing setText() fixed the issue.
type: Comment
comment on: http://stackoverflow.com/a/22517636

http://stackoverflow.com/a/22587517
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/34387099
has comment: http://stackoverflow.com/comment/34387071
has body: Why not use an enum? IMO Java is missing some key features, but one of the things it does right it is the way it uses enums. If you really want to avoid an enum, you could do this: class num1{ public static final num1 one= new num1("one"); private String name; private num1(String name) { this.name = name; } @Override //Be sure to add the override annotation here! public String toString(){ return name; } }
has comment: http://stackoverflow.com/comment/34387025
score: 3
accepted answer of: http://stackoverflow.com/q/22587477
answers question: http://stackoverflow.com/q/22587477
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34387017

http://stackoverflow.com/a/22601990
accepted answer of: http://stackoverflow.com/q/22601730
type: Answer
answers question: http://stackoverflow.com/q/22601730
has comment: http://stackoverflow.com/comment/34413151
has body: I was also facing the same problem, solution which worked for me is : If you don't wish to use AsyncTask in your activity, try adding below snippet in your onCreate of LoginActivity.java if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } So this will save your time and effort for solving this error. P.S. If you get error on these line after adding them to your activity, try cleaning your application. You can also try adding @SuppressLint("NewApi") before oncreate method. like this, @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { Hope this well help you too.
has comment: http://stackoverflow.com/comment/34412894
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/34413253

meta-inf
tag name: meta-inf
tags question: http://stackoverflow.com/q/22573787
type: Tag

http://stackoverflow.com/comment/34350808
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22566433
has text: Have you written the server part? If you do the same request with Postman (Chrome extensions, Google it), does it work? Perhaps the server does not accept the JSON content type for some reason?
score: 0

http://stackoverflow.com/comment/34268413
type: Comment
has text: Have you tried without `:3306`? Really though, you should not use root from a webserver. Unless you're itching to be hacked.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22520676

http://stackoverflow.com/q/22637108
has title: Hibernate setMaxResults() with H2 SqlGrammarException
score: 0
has answer: http://stackoverflow.com/a/22637511
accepted answer: http://stackoverflow.com/a/22637511
answer count: 1
type: AnsweredQuestion
has body: I'm attempting to get a certain number of rows from the database given a certain user and a max amount. Here is what the code looks like currently: @Override public Collection&lt;TestObject&gt; findMaxByUser(User _user, int _max) { if (_max &lt;= 0) { throw new IllegalArgumentException("max &lt;= 0: " + _max); } Long rowCount = (Long)createCriteria() .add(Restrictions.eq("m_queryUser", _user)) .setProjection(Projections.rowCount()) .uniqueResult(); Collection&lt;TestObject&gt; results = createCriteria() .add(Restrictions.eq("m_queryUser", _user)) .setFirstResult(1) .setMaxResults(_max) .list(); final int count = rowCount.intValue(); final int totalCount = count &gt; results.size() ? count : results.size(); return results; This results in a org.hibernate.SQLGrammarException: could not prepare statement error. The strange thing is, if I change DB implementations to Derby, the code works fine. But there's something goofy happening using H2 when I try to use .setMaxResults(). If I use .setFetchSize() instead it'll return all the results no problem, but going back to .setMaxResults() produced the above error. Any help/information would be great. Caused-by trace: Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT THIS_.ID AS ID1_0_5_, THIS_.CREATED_ON AS CREATED2_0_5_, THIS_.UPDATED_ON AS UPDATED3_0_5_, THIS_.VERSION AS VERSION4_0_5_, THIS_.FAVORITE_QUERY AS FAVORITE6_0_5_, THIS_.NAME AS NAME5_0_5_, THIS_.USER_KEY AS USER7_0_5_, USERQUERY2_.ID AS ID1_2_0_, USERQUERY2_.CREATED_ON AS CREATED2_2_0_, USERQUERY2_.UPDATED_ON AS UPDATED3_2_0_, USERQUERY2_.VERSION AS VERSION4_2_0_, USERQUERY2_.MAX_RESULTS AS MAX5_2_0_, USERQUERY2_.PROPERTIES AS PROPERTI6_2_0_, USERQUERY2_.QUERY_STRING AS QUERY7_2_0_, USERQUERY2_.USER_KEY AS USER9_2_0_, USERQUERY2_.TARGETS AS TARGETS8_2_0_, EXTUSER3_.EXT_USER AS EXT1_4_1_, EXTUSER3_.CREATED_ON AS CREATED2_4_1_, EXTUSER3_.UPDATED_ON AS UPDATED3_4_1_, EXTUSER3_.VERSION AS VERSION4_4_1_, M_SORTS4_.USER_QUERIES AS USER1_2_7…
tagged with: java
tagged with: hibernate
tagged with: h2
type: Question

http://stackoverflow.com/q/22604531
tagged with: java
type: UnansweredQuestion
has title: How to load Proxy Auto Config (PAC) file in Android with java
answer count: 0
downvote count: 0
score: 1
favorite count: 0
tagged with: proxy
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/52861718
tagged with: pac
has comment: http://stackoverflow.com/comment/52932488
upvote count: 1
has body: I want to create a proxy application only connectting specific web sites with proxy. I am thinking using pac file in this application, but i didn't find any source for this. How can i load pac file programmatically in android? If there isnt any way to do this, how can i set proxy rule in android with java?

http://stackoverflow.com/a/22540975
score: 2
accepted answer of: http://stackoverflow.com/q/22540823
has body: You already have a variable named array. int[] array = new int [10]; // &lt;-- right there. int count = 0; // &lt;-- add this. Scanner input=new Scanner (System.in); array[count++] = input.nextInt(); // &lt;-- parens for a method call, // square brackets for the array, and add one to the count.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22540823
upvote count: 2
type: Answer

http://stackoverflow.com/q/22557138
upvote count: 2
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/33009533
type: Question
has body: I have two entities, one of those have a composit primary key(id, version), version is a ManyToOne link to another entity(UchastokVersion) field id. @Entity @Table(name = "uchastok_versions",schema="tb") public class UchastokVersion { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Integer id; @Column(name = "date_activate", columnDefinition="date unique") @DateTimeFormat(pattern="dd.MM.yyyy") @Temporal(TemporalType.DATE) private Date dateActivate; @Transient private List<Uchastok> uchastki; @Entity @IdClass(UchastokId.class) @Table(name = "uchastki", schema = "tb") public class Uchastok implements Serializable{ /** * */ private static final long serialVersionUID = 1L; @Id @Column(name = "id", unique = false, nullable = false) private Integer id; @Column(name = "name") private String name; @Id @ManyToOne(targetEntity=UchastokVersion.class,fetch = FetchType.LAZY) @JoinColumn(name = "id_version", nullable = false,referencedColumnName="id") private UchastokVersion version; public class UchastokId implements Serializable { private static final long serialVersionUID = 343L; private int id; private UchastokVersion version; public UchastokId() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public UchastokVersion getVersion() { return version; } public void setVersion(UchastokVersion version) { this.version = version; } @Override public int hashCode() { return this.id + this.version.getId(); } @Override public boolean equals(Object obj) { if (obj instanceof UchastokId) { UchastokId PlaceId = (UchastokId) obj; return (PlaceId.id == this.id) && (PlaceId.version.getId() == this.version.getId()); } return false; } } public UchastokVersion create(UchastokVersion record) { try { repository.saveAndFlush(record); return saveUchastki(record); } catch (Exception e) { logger.error("Create UchastokVersion error ", e); return null; } } private UchastokVersion saveUchastki(UchastokVersion uchastokVersion){ for (Uchas…
has title: Spring MVC Failed to convert property value of type 'java.lang.Integer'
tagged with: jpa
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 2
has comment: http://stackoverflow.com/comment/43410946

http://stackoverflow.com/comment/34467763
type: Comment
has text: @Shwet 3 array -> 3 loop, 4 array -> 4 loop, ...... Do you want several arrays? If so, please wait a minute...
type: AnswerComment
comment on: http://stackoverflow.com/a/22632922
score: 0

http://stackoverflow.com/comment/34358331
type: QuestionComment
has text: So in other words, please post your own code that is calling randomUUID() because it is likely you are in a recursive or infinite loop in your own code.
comment on: http://stackoverflow.com/q/22571478
score: 0
type: Comment

http://stackoverflow.com/a/22568930
has body: @Salix-alba's answer is spot on to get you started. Basically, you need a way to figure out how much time has already been spent together by members of your golfing group. I'll assume for illustration that you have a method to determine how much time two golfers have spent together. The algorithm can then be summed up as: Compute total time spent together of every group of 4 golfers (see Salix-alba's answer), storing the results in an ordered fashion. Pick the group of 4 golfers with the least time together as your first group. Continue to pick groups from your ordered list of possible groups such that no member of the next group picked is a member of any prior group picked Halt when all golfers have a group, which will always happen before you run out of possible combinations. By way of quick, not promised to compile example (I wrote it in the answer window directly): Let's assume you have a method time(a,b) where a and b are the golfer identities, and the result is how much time the two golfers have spent together. Let's also that assume that we will use a TreeMap> to keep track of "weights" associated with groups, in a sorted manner. Now, let's construct the weights of our groups using the above assumptions: TreeMap&lt;Integer,Collection&lt;Integer&gt;&gt; options = new TreeMap&lt;Integer, Collection&lt;Integer&gt;&gt;(); for(int i=0;i&lt;17;++i) { for(int j=i+1;j&lt;18;++j) { for(int k=j+1;k&lt;19;++k) { for(int l=k+1;l&lt;20;++l) { Integer timeTogether = time(i,j) + time(i,k) + time(i,l) + time(j,k) + time(j,l)+time(k,l); Collection&lt;Integer&gt; group = new HashSet&lt;Integer&gt;(); group.add(i); group.add(j); group.add(k); group.add(l); options.put(timeTogether, group); } } } } Collection&lt;Integer&gt; golferLeft = new HashSet&lt;Integer&gt;(); // to quickly determine if we should consider a group. for(int a=0; a &lt; maxGolfers, a++) { golferLeft.add(a); } Collection&lt;Collection&lt;Integer&gt;&gt; finalPicks = new ArrayList&lt;Collection&lt;Integer&gt;&g…
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22567650
accepted answer of: http://stackoverflow.com/q/22567650
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34263540
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22517841
type: Comment
has text: @Jason C You are right, assuming he does not need unicode strings. But even then you get the same complications with fsa.

opencv
type: Tag
tags question: http://stackoverflow.com/q/22553890
tags question: http://stackoverflow.com/q/22516503
tags question: http://stackoverflow.com/q/22516291
tags question: http://stackoverflow.com/q/22591022
tags question: http://stackoverflow.com/q/22618446
tags question: http://stackoverflow.com/q/22555174
tag name: opencv
tags question: http://stackoverflow.com/q/22621963
tags question: http://stackoverflow.com/q/22554159
tags question: http://stackoverflow.com/q/22566755
tags question: http://stackoverflow.com/q/22639806
tags question: http://stackoverflow.com/q/22602796
tags question: http://stackoverflow.com/q/22559552

http://stackoverflow.com/comment/34364685
score: 2
type: AnswerComment
has text: Can't you add `1` to a char directly?
type: Comment
comment on: http://stackoverflow.com/a/22574975

http://stackoverflow.com/comment/34483959
score: 0
has text: You could mix-and-match the parts of these answers that you like since they are all independent libs.
comment on: http://stackoverflow.com/a/22639276
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22547034
has body: There are two possible explanations: You have a corrupted ZIP file - Compile error in maven2: "invalid CEN header (bad signature)" It is something to do with ZIP-64: java.util.zip.ZipException: invalid CEN header (bad signature) But also note that ZIP-64 support was only added in 1.7.0_b55; see https://bugs.openjdk.java.net/browse/JDK-4681995
downvote count: 0
type: Answer
score: 6
answers question: http://stackoverflow.com/q/22536279
upvote count: 6

http://stackoverflow.com/comment/34466230
score: 0
has text: Add your aspect to the configuration file or use `component-scan` to pick it up. Currently it isn't available so nothing is going to be applied.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22631229

http://stackoverflow.com/q/22542782
has comment: http://stackoverflow.com/comment/34312356
has title: Login a website with jsoup in Java application
has comment: http://stackoverflow.com/comment/34307927
tagged with: cookies
tagged with: java
accepted answer: http://stackoverflow.com/a/23987966
tagged with: post
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/34308089
score: 0
has body: I have read many post in this site and not only but nothing works for me. I want to create a java application to connect automaticaly at a website that need to post username, password and a cookie response to login. I give you the code I have tried and if someone could help me to correct it. Connection.Response res = Jsoup.connect(uni_url) .userAgent("Mozilla/5.0") .execute(); Map&lt;String, String&gt; cookies = res.cookies(); Document doc2 = Jsoup.connect(uni_url) .userAgent("Mozilla/5.0") .cookies(res.cookies()) .data("uname", username1) .data("pass", password1) .method(Connection.Method.POST) .get(); The result I take is the same login page. Thank you in advance!
answer count: 1
has answer: http://stackoverflow.com/a/23987966
has comment: http://stackoverflow.com/comment/36941483
has comment: http://stackoverflow.com/comment/34309229
tagged with: http
type: AnsweredQuestion

http://stackoverflow.com/q/22573696
has comment: http://stackoverflow.com/comment/34362170
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/34362283
has answer: http://stackoverflow.com/a/22573840
type: Question
tagged with: jtable
linked to: http://stackoverflow.com/q/5621338
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34362104
has body: I am developing an Java JFrame application in this I had JTextField JTable In that the data of text field stored in database and display it via table. It display the data successfully from database. But the issue is when I minimize the frame the table data is gone every time. Is there any option to display data even user minimize the frame? Or, is there any Other option to solve the issue? Code: public void insertTaskDetail(){ global.dbConnect(); String insertkeydetail = "{call sp_inserttaskdetail(?,?,?,?)}"; try{ CallableStatement callableStatement; callableStatement = global.con.prepareCall(insertkeydetail); System.out.println("Stored Procedure Insert Key Detail is Called"); String dt=global.getCurrentDateTime(); System.out.println(dt); callableStatement.setString("p1", jText_Task_Name.getText().toString()); callableStatement.setString("p2", dt); callableStatement.setString("p3", "0"); callableStatement.setString("p4", L_Id); callableStatement.executeUpdate(); System.out.println("Task Detail is successfully inserted in database"); global.con.commit(); showtask(); }catch (Exception e){ System.out.println("Sql Exception Add Task Changed:"+e.toString()); } } public void showtask(){ global.dbConnect(); String showtask = "{call sp_showtask(?,?)}"; try{ callableStatement = global.con.prepareCall(showtask, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); System.out.println("Stored Procedure Get Task Detail is Called"); callableStatement.setString("p1", L_Id); callableStatement.setString("p2", "false"); rs=callableStatement.executeQuery(); System.out.println(rs.toString()); //Task , Start Time , Finish Time , Completed String task, st; boolean cmp; int i=0; while(rs.next()){ i++; } data=new Object[i][]; int j=0; rs.first(); if(i>0){ do{ System.out.println(i); task=rs.getString("Task"); System.out.println(task); st=rs.getString("Start Time"); cmp=rs.getBoolean("Completed"); data[j] = new Object[]{task, st, cmp}; j++; }while(rs.next()); } }catch (SQLException…
has comment: http://stackoverflow.com/comment/34362201
has title: JFrame data is gone when the frame is minimized
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
tagged with: jtextfield
downvote count: 1
has comment: http://stackoverflow.com/comment/34362177
has comment: http://stackoverflow.com/comment/34362092
linked to: http://stackoverflow.com/q/17874717

http://stackoverflow.com/a/22640825
has body: add cb.uiCallback(true); before cb.async(mContext); Why For what I can tell you create instance of LocationHelper from a background Thread that doesn't have a Looper so you can't use it to get async callbacks. Basically if you want to call cb.async(mContext); without calling cb.uiCallback(true); you have to do it from the UI Thread* * or any other thread that has a Looper
upvote count: 1
answers question: http://stackoverflow.com/q/22518952
score: 1
has comment: http://stackoverflow.com/comment/34518607
downvote count: 0
type: Answer

http://stackoverflow.com/comment/86197659
type: Comment
comment on: http://stackoverflow.com/a/22565977
type: AnswerComment
has text: This should be accepted as valid answer since it gives further detail about how string is processed in PHP.
score: 0

http://stackoverflow.com/comment/34964870
score: 0
has text: I want to update some values (string,Integer and double) ,for this reason I pass those parameters into map<String,object> from action to jsp page. I show it in my jsp,I edit it, but when I want to save the result, all double values take a NAN !!
comment on: http://stackoverflow.com/a/22617693
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34223599
type: Comment
type: QuestionComment
has text: What do you mean by "I know Java support PEM encoded certificates because that's what a web server sends to a client"?
score: 0
comment on: http://stackoverflow.com/q/22493997

unit-testing
tags question: http://stackoverflow.com/q/22507299
tags question: http://stackoverflow.com/q/22625188
tags question: http://stackoverflow.com/q/22546013
tags question: http://stackoverflow.com/q/22605369
tags question: http://stackoverflow.com/q/22619716
tags question: http://stackoverflow.com/q/22612237
tags question: http://stackoverflow.com/q/22497146
tags question: http://stackoverflow.com/q/22581423
tags question: http://stackoverflow.com/q/22638064
tags question: http://stackoverflow.com/q/22643364
tags question: http://stackoverflow.com/q/22556344
tags question: http://stackoverflow.com/q/22626100
tags question: http://stackoverflow.com/q/22592812
tags question: http://stackoverflow.com/q/22642012
tags question: http://stackoverflow.com/q/22569420
type: Tag
tag name: unit-testing
tags question: http://stackoverflow.com/q/22526870
tags question: http://stackoverflow.com/q/22610503
tags question: http://stackoverflow.com/q/22497907
tags question: http://stackoverflow.com/q/22497513
tags question: http://stackoverflow.com/q/22555301
tags question: http://stackoverflow.com/q/22616450
tags question: http://stackoverflow.com/q/22549619

http://stackoverflow.com/comment/34484433
type: QuestionComment
comment on: http://stackoverflow.com/q/22629455
has text: yes, JAVA_HOME, even JRE_HOME and a path to jdk/bin
score: 0
type: Comment

http://stackoverflow.com/q/22570885
has answer: http://stackoverflow.com/a/24433300
tagged with: java
upvote count: 1
tagged with: machine-learning
has body: I am using the classifier FilteredClassifier in WEKA. The Filter of my classifier is a MultiFilter, doing first InfoGain, and then Standarization. After training the classifier, when trying to classify the test instances on the fly, I get the error: java.lang.Exception: Filter didn't mkae the test instance immediately available! Anyone knows how to fix this?
type: Question
type: AnsweredQuestion
has title: Exception: Filter didn't make the test instance immediately available
tagged with: feature-selection
accepted answer: http://stackoverflow.com/a/24433300
tagged with: weka
answer count: 1
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/22628383
score: -1
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34460943
upvote count: 0
answers question: http://stackoverflow.com/q/22628163
has comment: http://stackoverflow.com/comment/34460663
has body: String str = "AT%26amp%3BT%20Network%20Client%20%[here]u[here]2013%20IBM" I think this string is invalid. %u20 is not valid charecter. If you remove u from your string you can encode it. For reference: w3schools html url encodeing

http://stackoverflow.com/q/22501261
type: Question
tagged with: dependency-injection
tagged with: ejb
tagged with: jboss
has answer: http://stackoverflow.com/a/25288367
accepted answer: http://stackoverflow.com/a/25288367
tagged with: servlets
linked to: http://stackoverflow.com/q/1866953
score: 0
answer count: 2
has title: Inject EJB into Servlet
has body: Does anyone know why it's so difficult to inject an EJB into a Servlet? I'm using JBoss 6.2. My handler variable is null no matter what I try. @Local public interface RequestHandlerInterface { public String handleRequest(String authKey); } @Singleton public class RequestHandler implements RequestHandlerInterface { ... } public class Test extends HttpServlet { @EJB private RequestHandlerInterface handler; //Always null } In application context: <bean id="requestHandler" class="company.application.RequestHandler" /> In web.xml (v3.0): Test company.test.Test Test /Test RequestHandler Session company.application.RequestHandlerInterface I've tried so many combinations, with every @EJB(...) option... any idea? Note: It is all contained in a single WAR. Note: I've tried private RequestHandler handler; instead of the interface. Note: I've tried with (name="ejb/RequestHandler") and mappedName, beanName, lookup Note: I've tried with @Remote and @Local, with ejb-local-ref and ejb-ref Note: JNDI bindings for session bean named RequestHandler in deployment unit deployment "company.war" are as follows: java:global/company/RequestHandler!company.application.RequestHandlerInterface java:app/company/RequestHandler!company.application.RequestHandlerInterface java:module/RequestHandler!company.application.RequestHandlerInterface java:global/company/RequestHandler java:app/company/RequestHandler java:module/RequestHandler
possible better answer: http://stackoverflow.com/a/22501697
has answer: http://stackoverflow.com/a/22501697
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/75637860

http://stackoverflow.com/q/22559056
has comment: http://stackoverflow.com/comment/34334989
upvote count: 1
has body: I would like the output to be **c**d*c not to be * * c * * d * c knowing that each character from the previous is printed using System.out.println() in hangman game code
answer count: 1
has title: How to print multiple System.out.println() on one line
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34334990
type: Question
score: -5
tagged with: java
downvote count: 6
has answer: http://stackoverflow.com/a/22559078

http://stackoverflow.com/q/22550537
linked to: http://stackoverflow.com/q/14372391
linked to: http://stackoverflow.com/q/15760834
tagged with: google-maps
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/34321367
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/21480116
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34321395
linked to: http://stackoverflow.com/q/15894143
tagged with: service
has comment: http://stackoverflow.com/comment/34321386
score: 1
has comment: http://stackoverflow.com/comment/34321375
tagged with: java
has body: // MyActivity.class package com.example.maps; import android.app.Activity; import android.os.Bundle; public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } // main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.MapFragment"/&gt; // AndoidManifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.maps" android:versionCode="1" android:versionName="1.0"&gt; &lt;uses-sdk android:minSdkVersion="15"/&gt; &lt;application android:label="@string/app_name" android:icon="@drawable/ic_launcher"&gt; &lt;activity android:name="MyActivity" 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; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; Compilation - no error Runtime Error is there. Added google services jar to lib as well as modules using intellij idea Took this code from google website Also took reference from android developers Below is my error : java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source) at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source) at android.app.Activity.onCreateView(Activity.java:4247) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673) at android.view.LayoutInflater.inflate(LayoutInflater.java:466) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java:352) at com.android.inte…
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34321627
has title: Run Time Error : java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
has comment: http://stackoverflow.com/comment/34321404
has comment: http://stackoverflow.com/comment/34321267
has answer: http://stackoverflow.com/a/22550689

http://stackoverflow.com/a/22590955
has comment: http://stackoverflow.com/comment/34399326
has comment: http://stackoverflow.com/comment/36719933
has comment: http://stackoverflow.com/comment/34403160
has body: The catch is your friend is not clearing the screen, but adding a transparent rectangle to get a trails effect in the easyFade() function: void easyFade() { fill(bgColor,overlayAlpha); noStroke(); rect(0,0,width,height);//fade background } The same can be done with images, but slightly different: simply use the tint() function to add transparency to your background video. Just for testing purposes, say you have an image to test this with (test.png), you can try something like this: PImage bg; void setup(){ size(240,240);noStroke(); bg = loadImage("test.png"); } void draw(){ easyFade(); fill(255); ellipse(mouseX,mouseY,10,10); } void easyFade() { tint(255,10); image(bg,0,0); } In your case the video will either be a loaded Movie or a live Capture but the above would still work, since both extend PImage (and you render them to screen with the image() call). UPDATE One issue with this approach though is the fade will affect the background video as well. To keep things separated, you can use another 'layer' using PGraphics: import processing.video.*; PGraphics gfx; Capture video; int w = 640; int h = 480; void setup() { size(w, h); video = new Capture(this, w, h,30); video.start(); gfx = createGraphics(w, h); gfx.beginDraw(); gfx.background(0); gfx.endDraw(); // println(Capture.list()); } void draw(){ image(video,0,0); pushStyle(); tint(255,127);//tint just the rendered graphics as transparent to see the video beneath image(gfx,0,0); popStyle(); //draw your awesome optical flow graphics here gfx.beginDraw(); gfx.fill(0,10);//same as easyFade() draw transparent bg gfx.rect(0,0,width,height); gfx.fill(255); gfx.ellipse(mouseX,mouseY,10,10); gfx.endDraw(); } void captureEvent(Capture c) { c.read(); } Again, this would display the graphics faded. A variation of this would be blending the graphics layer, using the blend() function. Given that normally the graphics background is dark and you want to overlay the bright graphics, you can use a blend mode like ADD or SCREEN whic…
has comment: http://stackoverflow.com/comment/36716767
has comment: http://stackoverflow.com/comment/36718089
score: 0
has comment: http://stackoverflow.com/comment/36716872
has comment: http://stackoverflow.com/comment/36719905
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22584114
accepted answer of: http://stackoverflow.com/q/22584114
type: Answer
has comment: http://stackoverflow.com/comment/36713226
has comment: http://stackoverflow.com/comment/36720418
has comment: http://stackoverflow.com/comment/36722737
has comment: http://stackoverflow.com/comment/34400855
has comment: http://stackoverflow.com/comment/36722374

http://stackoverflow.com/q/22586030
tagged with: javax.imageio
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34384439
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34387330
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/34384603
tagged with: inputstream
has comment: http://stackoverflow.com/comment/34384450
type: Question
has title: Multiple image files on a TCP socket
has answer: http://stackoverflow.com/a/22586724
has comment: http://stackoverflow.com/comment/34384797
has comment: http://stackoverflow.com/comment/34384445
linked to: http://stackoverflow.com/q/18505406
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34486986
has comment: http://stackoverflow.com/comment/34386050
favorite count: 0
has body: I am trying to send multiple images on a TCP socket. The following code is running fine without a problem: the client and server exchange a greeting. Then the client is sending a single image file which the server receives. Client side: ... try { Socket clientSocket = new Socket(serverName, port); DataInputStream in=new DataInputStream(clientSocket.getInputStream()); System.out.println("Heard from server: "+in.readUTF()); DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream()); out.writeUTF("Hello from " + clientSocket.getLocalSocketAddress()); BufferedImage bimg; // for (int i=0; i&lt;3; i++) { bimg = ImageIO.read(new File("flowers.jpg")); ImageIO.write(bimg,"jpg",clientSocket.getOutputStream()); out.flush(); System.out.println("Image sent"); // } clientSocket.close(); } catch(Exception e) { ... } Server side: ... Socket socket=null; DataInputStream din=null; DataOutputStream dout=null; ... socket = serverSocket.accept(); din=new DataInputStream(socket.getInputStream()); dout=new DataOutputStream(socket.getOutputStream()); for (;;) { try { dout.writeUTF("ImageReceiver here at your service: "); System.out.println("from the client: "+din.readUTF()); BufferedImage img; //for (int i=0; i&lt;3; i++) { img=ImageIO.read(socket.getInputStream()); ImageIO.write(img, "png", new File(timeStamp+"img.png")); System.out.println("Image received..."); //} socket.close(); break; } catch(Exception e) { .... } } When I uncomment the 2*2 lines in the above and thus send&amp;receive images in a loop, I am getting an exception that the image is null: the server is receiving the 1st image fine without errors. However, after that, it is not seeing the input stream as an image. The call to ImageIO.read() at img=ImageIO.read(socket.getInputStream()); is returning null and ImageIO.write(img, "png", new File(timeStamp+"img.png")); is throwing the exception. The client process is running fine without any errors. Is this a matter of managing the I/O buffers? Where to look to…
has answer: http://stackoverflow.com/a/46522508
tagged with: sockets
has comment: http://stackoverflow.com/comment/34384500
has comment: http://stackoverflow.com/comment/34384422

http://stackoverflow.com/a/22534738
upvote count: 13
answers question: http://stackoverflow.com/q/22534356
has body: All supported platforms offer single-threaded graphics libraries. Swing is cross-platform. Therefore, Swing GUI objects should be constructed and manipulated only on the event dispatch thread. As an aside, SwingUtilities.invokeLater() is a cover for EventQueue.invokeLater() since version 1.3.
score: 13
downvote count: 0
type: Answer

http://stackoverflow.com/q/22529986
answer count: 2
downvote count: 1
tagged with: java
has body: I have a facebook page and want to open it through the Facebook App and not through the browser. How to do so ? For example the amazon page which is: https://www.facebook.com/Amazon I tried this: String uri = "facebook://facebook.com/amazon"; Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(intent); This opens the Facebook App but now the facebook page. Thanks!
upvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22530306
tagged with: android
score: -1
has answer: http://stackoverflow.com/a/22530348
has title: Open link through facebook app

http://stackoverflow.com/comment/34419103
comment on: http://stackoverflow.com/q/22605621
has text: it's too long and messy :)
score: 0
type: Comment
type: QuestionComment

code-navigation
tag name: code-navigation
type: Tag
tags question: http://stackoverflow.com/q/22558127

http://stackoverflow.com/comment/34295604
score: 0
type: Comment
type: QuestionComment
has text: the create view in database.
comment on: http://stackoverflow.com/q/22511279

http://stackoverflow.com/comment/34452602
has text: you're right I forgot to repopulate the list! Let me get back to you once i try that.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22623959

http://stackoverflow.com/comment/34394577
comment on: http://stackoverflow.com/q/22591157
score: 0
type: Comment
type: QuestionComment
has text: OK. The question has updated

http://stackoverflow.com/comment/34351573
type: AnswerComment
type: Comment
score: 1
has text: @fge `where T : IFirstInterface, ISecondInterface` - See the link I posted for details on constraint options.
comment on: http://stackoverflow.com/a/22567972

http://stackoverflow.com/a/59263706
has body: Maybe you should add componentscan annotation in the file where the main class is present. @ComponentScan("package where the interceptor is placed.") Worked for me.
score: 0
answers question: http://stackoverflow.com/q/22633800
type: Answer

http://stackoverflow.com/q/22591022
tagged with: opencv
tagged with: filtering
has title: OpenCV - Parameters in Laplacian Filter (Java)
score: 1
tagged with: java
tagged with: image-processing
upvote count: 1
has answer: http://stackoverflow.com/a/22591636
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has body: I'm kind of new with opencv. I'm using Java and I'd like to know how to apply a Laplacian filter with alpha = 0.2, I mean, using this matrix to convolve: 0.1667 0.6667 0.1667 0.6667 -3.3333 0.6667 0.1667 0.6667 0.1667 I'm using this code, but I don't know what to use as "ddepth" and "ksize": Imgproc.Laplacian(b, b_lapl, ddepth, ksize, 1, 0); Is there any quick form of getting the abs of the result?
type: UnansweredQuestion

http://stackoverflow.com/comment/34313539
type: Comment
type: QuestionComment
has text: @StefanBirkner It's a waste of time, really. Lets say you write a unit test to make sure you configure it correctly (which is valid, but so is adhoc testing). At that point, however, you might as well delete it. Any change that breaks this test would have been deliberate.
comment on: http://stackoverflow.com/q/22545116
score: 0

http://stackoverflow.com/q/22615723
has answer: http://stackoverflow.com/a/22615835
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/22615835
type: Question
tagged with: jackson
score: 0
answer count: 1
has title: Integer can not be cast to JsonNode
has body: i got a cast error and have no idea how to solve that. //get my json file as Map Map&lt;String, JsonNode&gt; cm = null; try { cm = mapper.readValue(new File(path), Map.class); } catch (JsonParseException e) {...} //add some key, value pairs to my map JsonNodeFactory factory = JsonNodeFactory.instance; ObjectNode node = factory.objectNode(); //add to a jsonNode node.putAll(cm); So I get an exception cause one of the key-value pairs looks like this: {"id":7} and it seems like there is no way of converting the Integer(7) back to json even if it was one before. Any Ideas? The exeption: Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to com.fasterxml.jackson.databind.JsonNode

http://stackoverflow.com/comment/34221427
comment on: http://stackoverflow.com/a/22492815
type: AnswerComment
has text: Use `charAt` to access each character. The easiest way is to keep a running sum. Look at the string from left to right. For each character that's a `'0'`, double the current sum; if it's a `'1'`, double the current sum and add 1. Anything else is an error. The same principle can be used for any base: multiply the current value by the base and add the value of each digit, going from left to right.
score: 0
type: Comment

http://stackoverflow.com/a/22547752
has body: Use executeUpdate instead of execute to run the update queries. Although execute API documentation states that it should work for udpates but it does not most of the time. Here is what you need to change from killerSQL.execute(); to killerSQL.executeUpdate(); similarly the other one. Also commmit add close your resultset,statements and connection.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34316809
type: Answer
has comment: http://stackoverflow.com/comment/34316844
answers question: http://stackoverflow.com/q/22547678
has comment: http://stackoverflow.com/comment/34320114
accepted answer of: http://stackoverflow.com/q/22547678

http://stackoverflow.com/comment/34327639
has text: *"should provide feedback"* How exactly? If the `JRadioButton` is the only focusable element, it will get focus if the panel is focused, but what exactly would change if the user clicks on a `JLabel`? *"things which are darn easy in WPF seem to be difficult in swing"* And things which are possible in Swing are impossible in WPF (e.g. creating a cross-platform GUI). More generally though, you do not encourage people to help by complaining about 'how things are hard in (the language of discussion) as opposed to (some other language)'..
comment on: http://stackoverflow.com/q/22554530
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22640526
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You need Intent openMainAct = new Intent(CurrentActivity.this, MainActivity.class); startActivity(openMainAct); instead of Intent openMainAct = new Intent("com.example.andava.MainActivity"); startActivity(openMainAct);
answers question: http://stackoverflow.com/q/22640441

http://stackoverflow.com/comment/34480306
comment on: http://stackoverflow.com/a/22639388
type: AnswerComment
score: 0
type: Comment
has text: Thanks for all three links! It's very helpful!

http://stackoverflow.com/comment/34268477
has text: That's one way of implementing a [Fluent interface](https://en.wikipedia.org/wiki/Fluent_interface).
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22520801

http://stackoverflow.com/a/22569394
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22569083
accepted answer of: http://stackoverflow.com/q/22569083
score: 1
type: AcceptedAnswer
has body: RW and rpCount are not updated inside the loop so you are always: Checking for the first occurrence. Replacing the first occurrence. If you want to do this using indexOf, you need to update the fromIndex parameter each time. (fromIndex is the index it begins the search from, so if it's always 0 it will always find the first occurrence.) Something like this: int last = 0; for(int y = 0; y &lt; genRadmLetter.length; y++) { int pos = radmWord.indexOf(guessedLetter, last); if(pos &gt; -1) { genRadmLetter[pos] = guessedLetter; // use found index to replace result = true; last = pos + 1; // skip to the next letter } if(pos == radmWord.length() - 1) { break; // it was the last letter } } A new break condition is also needed (or you will get an out of bounds exception if indexOf is called with the index of the last letter + 1). So if you are doing the replacement based on containment, you do not need the for(each index) idiom. You aren't really using the y variable and for(each index) results in redundant calls to indexOf. The loop can be shortened like this: int pos = 0; do { pos = radmWord.indexOf(guessedLetter, pos); if(pos &gt; -1) { genRadmLetter[pos] = guessedLetter; result = true; pos++; } } while(pos &gt; -1 &amp;&amp; pos &lt; radmWord.length()); But note that if the array is simply parallel, there is a simpler way to do this using charAt: for(int i = 0; i &lt; genRadmLetter.length; i++) { if(radmWord.charAt(i) == guessedLetter) { genRadmLetter[i] = guessedLetter; result = true; } }
upvote count: 1

http://stackoverflow.com/comment/34245731
type: Comment
has text: He wants to know the size of the encrypted stream.
type: QuestionComment
comment on: http://stackoverflow.com/q/22508428
score: 0

http://stackoverflow.com/a/38061710
has body: After surfing the internet for hours, and still unable to find the solution, I stumbled upon this command which solved my problem: zip -d yourjar.jar 'META-INF/.SF' 'META-INF/.RSA' 'META-INF/*SF' This command rips off the signature files for the previous jars, and then once you sign it you'l find no error.
answers question: http://stackoverflow.com/q/22566191
has comment: http://stackoverflow.com/comment/67780580
upvote count: 19
has comment: http://stackoverflow.com/comment/125016300
type: Answer
downvote count: 0
score: 19

http://stackoverflow.com/q/22605169
type: Question
tagged with: dependency-injection
tagged with: guice
has comment: http://stackoverflow.com/comment/34447199
has body: Is it possible for Guice throw an exception if I try to construct a new instance of a singleton? For example: public class MyModule extends AbstractModule { @Override protected void configure() { bind(MySingleton.class).in(Singleton.class); } } @Singleton public class MySingleton { MySingleton() { /* ... */ } } public class RightWay { public void withInjector() { Injector injector = Guice.createInjector(new MyModule()); MySingleton mySingleton = injector.getInstance(MySingleton.class); } } public class AnotherRightWay { private final MySingleton mySingleton; @Inject public AnotherRightWay(MySingleton mySingleton) { this.mySingleton = mySingleton; } } public class TheWrongWay { public void directInstantiation() { MySingleton mySingleton = new MySingleton(); // I want an exception here! } } By making MySingleton's constructor package private, I can limit the scope for mistakes, but of course classes in the same package can still throw a spanner into the works. The advantage here is that my unit tests for AnotherRightWay can easily pass mocks of MySingleton to its constructor. Or, I could make MySingleton's constructor protected, which Guice can handle, and I can still mock by making my mocks extend MySingleton. But then a MySingleton user could do the same without knowing the danger. If Guice can throw an exception, I can use reflection in my unit tests to construct mocks, but my users could not easily accidentally create a non-singleton version of MySingleton. Is this possible? Should I just use either the package-private or protected and learn to love the bomb?
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/22607470
favorite count: 0
has title: Can Guice assert that a singleton is not directly instantiated?
has answer: http://stackoverflow.com/a/22607470
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/34401468
score: 0
has text: I already have a people's class that has all the getters and setter but to add a new person's information to the array, do I have to add anything new to my people's class? do i need to add an update method? if so how do I do this? how will this method look?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22595539

http://stackoverflow.com/a/42769260
upvote count: 1
answers question: http://stackoverflow.com/q/22606572
has body: While Ahmad Dwaik 'Warlock' has provided a very good answer but there is a mistake in his code current code is -- try { String jsonString="";//your json string here JSONObject jObject= new JSONObject(jsonString).getJSONObject("categories"); Iterator&lt;String&gt; keys = jObject.keys(); while( keys.hasNext() ) { String key = keys.next(); Log.v("**********", "**********"); Log.v("category key", key); JSONObject innerJObject = jObject.getJSONObject(key); Iterator&lt;String&gt; innerKeys = innerJObject.keys(); while( innerKeys.hasNext() ) { String innerKkey = innerKeys.next(); //Here was the error String value = innerJObject.getString(innerKkey); Log.v("key = "+key, "value = "+value); } } } catch (JSONException e) { e.printStackTrace(); }
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/22626049
has answer: http://stackoverflow.com/a/22627063
score: 0
has comment: http://stackoverflow.com/comment/34456336
has comment: http://stackoverflow.com/comment/34456234
answer count: 1
linked to: http://stackoverflow.com/q/6411357
tagged with: opencsv
accepted answer: http://stackoverflow.com/a/22627063
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jersey
has body: i am trying to write a jersey service which consumes a CSV file. i want to serialize that csv file into an object. what can i do to achieve this? i am going to use opencsv as the parser library for csv file. my base structure of the service: @POST @Consumes(MediaType.TEXT_PLAIN){ public void addUsers(@FormDataParam("file") InputStream inputStream) throws UnsupportedEncodingException{ } is the @Consumes annotation which i am using the right way as well?
has comment: http://stackoverflow.com/comment/34457343
has title: serialize csv file into an object in jersey service
has comment: http://stackoverflow.com/comment/34457662

http://stackoverflow.com/a/22562216
accepted answer of: http://stackoverflow.com/q/22555044
answers question: http://stackoverflow.com/q/22555044
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34355068
has body: Do all Class entries in the constant pool table refer to a class that is used somewhere in the class file? No, you can always put in constant pool entries that aren't actually used. A class compiled with a standard compiler will only contain entries that are actually used though. Or are there other mechanisms how a Class entry may get into the constant pool? No, the constant pool is fixed. Though the file on your disk may not represent the actual class that is loaded, since it's always possible for a custom class loader or Java agent to manipulate things at runtime. Assuming I wold not like to implement some kind of "lazy class loading" on first use of a class, am I therefore loading the correct list of used classes by using the class entries in the constant pool table? For static analysis, that's the best you can do. Note that you will miss dependencies used through reflection, but there's not much you can do about that.
type: Answer
score: 2
upvote count: 2

web-services
type: Tag
tags question: http://stackoverflow.com/q/22635736
tags question: http://stackoverflow.com/q/22603601
tags question: http://stackoverflow.com/q/22542707
tags question: http://stackoverflow.com/q/22627632
tags question: http://stackoverflow.com/q/22509997
tags question: http://stackoverflow.com/q/22618729
tags question: http://stackoverflow.com/q/22524093
tags question: http://stackoverflow.com/q/22633558
tags question: http://stackoverflow.com/q/22636116
tags question: http://stackoverflow.com/q/22534472
tags question: http://stackoverflow.com/q/22546385
tags question: http://stackoverflow.com/q/22503042
tags question: http://stackoverflow.com/q/22609097
tags question: http://stackoverflow.com/q/22603490
tags question: http://stackoverflow.com/q/22630252
tags question: http://stackoverflow.com/q/22628363
tags question: http://stackoverflow.com/q/22590537
tags question: http://stackoverflow.com/q/22513359
tags question: http://stackoverflow.com/q/22559518
tags question: http://stackoverflow.com/q/22611105
tags question: http://stackoverflow.com/q/22632290
tags question: http://stackoverflow.com/q/22624917
tags question: http://stackoverflow.com/q/22623026
tags question: http://stackoverflow.com/q/22508912
tags question: http://stackoverflow.com/q/22641097
tags question: http://stackoverflow.com/q/22623387
tags question: http://stackoverflow.com/q/22498138
tags question: http://stackoverflow.com/q/22570321
tags question: http://stackoverflow.com/q/22533521
tags question: http://stackoverflow.com/q/22615305
tags question: http://stackoverflow.com/q/22603606
tags question: http://stackoverflow.com/q/22569866
tags question: http://stackoverflow.com/q/22625629
tags question: http://stackoverflow.com/q/22509921
tags question: http://stackoverflow.com/q/22507129
tags question: http://stackoverflow.com/q/22637329
tags question: http://stackoverflow.com/q/22569965
tags question: http://stackoverflow.com/q/22610258
tag name: web-services
tags question: http://stackoverflow.com/q/22603314
tags question: http://stackoverflow.com/q/22548992
tags question: http://stackoverflow.com/q/22604234
tags question: http://stackoverflow.com/q/22511732
tags question: http://stackoverflow.com/q/22594303
tags question: http://stackoverflow.com/q/22551984
tags question: http://stackoverflow.com/q/22636143
tags question: http://stackoverflow.com/q/22636183
tags question: http://stackoverflow.com/q/22593018
tags question: http://stackoverflow.com/q/22594249
tags question: http://stackoverflow.com/q/22628785
tags question: http://stackoverflow.com/q/22488190
tags question: http://stackoverflow.com/q/22609754
tags question: http://stackoverflow.com/q/22514490
tags question: http://stackoverflow.com/q/22591350

http://stackoverflow.com/comment/34407270
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22595531
has text: `There is no such thing as a complete AND minimal example.` - Yes there is. For example each of your current panels has about 7 components added to the. Are the components the problem? If not, then don't add them. The point of a [SSCCE](http://www.sscce.org/) is to demonstrate the problem with the least code possible. That is do some basic debugging and get rid of code an components to see if they are causing the problem. Eventually you will get to a point where you can demonstrate the problem in 20-30 lines of code, that is if you truly understand the code you are writing.
type: Comment

http://stackoverflow.com/a/22495592
downvote count: 0
has comment: http://stackoverflow.com/comment/34229906
answers question: http://stackoverflow.com/q/22495153
type: Answer
score: 1
upvote count: 1
has body: From the App Engine documentation: A backend instance can be targeted with HTTP requests to http://[instance]-dot-[backend_name]-dot-[your_app_id].appspot.com, or at your application's custom domain. So you can use whatever domain is configured for your app. _ah/start is a way to start the backend, i.e. a simple request sent to: backend1-dot-myapp.appspot.com/_ah/start will start the backend. You don't have to do it - you can send any request to a backend, and the App Engine will start it for you if no instances are running.

http://stackoverflow.com/a/22588288
has body: I've finally found out the reason why banner was overplayed by game scene. The mistake is actually silly. following methods must be updated: @Override public void onPause() { **if (adView != null) adView.pause();** super.onPause(); CCDirector.sharedDirector().pause(); } @Override public void onResume() { super.onResume(); CCDirector.sharedDirector().resume(); **if (adView != null) adView.resume();** }
score: 0
accepted answer of: http://stackoverflow.com/q/22565371
answers question: http://stackoverflow.com/q/22565371
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/a/22601944
accepted answer of: http://stackoverflow.com/q/22601611
has body: Assuming you're using a soft keyboard on a newer Android version, then the following blurb from the KeyEvent reference likely explains the reason you're not getting your expected key events. "As soft input methods can use multiple and inventive ways of inputting text, there is no guarantee that any key press on a soft keyboard will generate a key event: this is left to the IME's discretion, and in fact sending such events is discouraged. You should never rely on receiving KeyEvents for any key on a soft input method. In particular, the default software keyboard will never send any key event to any application targetting Jelly Bean or later, and will only send events for some presses of the delete and return keys to applications targetting Ice Cream Sandwich or earlier. Be aware that other software input methods may never send key events regardless of the version. Consider using editor actions like IME_ACTION_DONE if you need specific interaction with the software keyboard, as it gives more visibility to the user as to how your application will react to key presses."
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34412694
has comment: http://stackoverflow.com/comment/34412859
upvote count: 2
answers question: http://stackoverflow.com/q/22601611
type: AcceptedAnswer

http://stackoverflow.com/comment/34423202
has text: If you still decide to use it: you will need to build a set of values first and then set it in one go. But WHY?
comment on: http://stackoverflow.com/q/22607186
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22571246
upvote count: 2
type: AcceptedAnswer
has body: Start from Root Component and iterate all the the underlying components using recursive function to hide all JButton. Sample code to hide all JButton added in JFrame or JPanel or both. Note: Extend recursion function for other components also. Just single call to hide() method will take care of this stub. public void hide(Component parent) { if (parent instanceof JFrame) { JFrame frame = (JFrame) parent; for (int i = 0; i &lt; frame.getContentPane().getComponentCount(); i++) { Component comp = frame.getContentPane().getComponent(i); if (comp instanceof JButton) { comp.setVisible(false); } else { hide(comp); } } } else if (parent instanceof JPanel) { JPanel panel = (JPanel) parent; for (int i = 0; i &lt; panel.getComponentCount(); i++) { Component comp = panel.getComponent(i); if (comp instanceof JButton) { comp.setVisible(false); } else { hide(comp); } } } }
answers question: http://stackoverflow.com/q/22571110
accepted answer of: http://stackoverflow.com/q/22571110
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/34384321
score: 5
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22585999
has text: Sigh... post the log (or at least the stack trace), clearly identify the line in your code that causes the exception, and please be sure to read [What is a NullPointerException?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception) first.

http://stackoverflow.com/a/22636491
accepted answer of: http://stackoverflow.com/q/22636122
type: AcceptedAnswer
downvote count: 0
has body: Seems like you want to remote debug. The use this command to launch your jar: java -Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y -jar [JAR NAME HERE] It should state something like : Listening for transport dt_socket at address : 8001 And in eclipse, create a "Remote Java Application" debug configuration. The configuration is the only thing that matters as long as you have your project of interest open. Add the project[s] of interest that you would like to debug onto your source lookup path and set the port number to the configured address from the java launch command. When you connect to your debug-enabled jar launch, your jar will halt execution and await debugger input upon hitting breakpoints. Just make sure you have the same version of the code in your jar and your eclipse.
type: Answer
score: 16
upvote count: 16
answers question: http://stackoverflow.com/q/22636122

http://stackoverflow.com/a/22546387
score: 5
has body: when I download Eclipse or Netbeans IDEs (written in Java) there's a version for Windows and other versions for others OS's. If a java program "runs anywhere" there shouldn't be "versions" (at my first thought). Eclipse Eclipse uses SWT, which uses the native GUI libraries, therefore you need a Version for each OS / platform. NetBeans In contrast to Eclipse, NetBeans uses standard-java Swing for GUI, so no need for native GUI libraries. Here you are not correct: You can download a OS-specific version (eg. Windows / Linux / Mac OS), but you don't have to! For downloading just select "OS independed Zip" as Platform. You'll get a ZIP archive you can extract and run on every supported platform. However, on Windows you have to run the exe, on Linux the shellscript to start the IDE (check bin directory). The main feature of the os specific versions are their installers, the resulting NetBeans is mostly common to all. 1) Why use a library that takes off one of the strongest features in java? Is it faster/ prettier? Just search for SWT / Swing comparison (and discussion about pros / cons). 2) Are there other ways, except the use of that library, that makes a java program don't work cross-plataform? Yes, everything that depends on something platform specific. Examples: JNA / JNI (java native calls) Paths (C:/whatever won't work on Linux, while /home/whatever wont work on Windows) Env. variables etc. calling other programs Just look for something like "how to keep java cross-platform" and do the opposite of very recommendation. In general, java does a good job here, but with enough bad intentions you can kill any "cross-platform" development ;-)
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22545660
answers question: http://stackoverflow.com/q/22545660

http://stackoverflow.com/q/22633053
upvote count: 1
has comment: http://stackoverflow.com/comment/34483116
has comment: http://stackoverflow.com/comment/34474999
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
downvote count: 0
answer count: 0
type: UnansweredQuestion
tagged with: compile-time
has comment: http://stackoverflow.com/comment/34470982
type: Question
tagged with: enums
has body: That´s all, I need to create an Enum whose values or labels are stored in XML file. XML won´t be modified at runtime. I want to let the user specify the values for a given attribute (for example, available colors for the attribute Colour of the Car class). I am planning to use an Interface so I can code the rest of the application, and then generate Enums implementing that interface. Solution: I have decided to use a collection, implementing methods to avoid duplicated values.
score: 1
tagged with: java
has title: Create Enum from XML at compile time
has comment: http://stackoverflow.com/comment/34470181
has comment: http://stackoverflow.com/comment/34468438

http://stackoverflow.com/a/22551997
answers question: http://stackoverflow.com/q/22533399
type: Answer
score: 25
downvote count: 0
has body: The reason you see this working as it works is quite simple: JPA is defined to work that way. I am assuming you trigger an update query for updateCamelName(…). The JPA specification states the following for update and delete operations: The persistence context is not synchronized with the result of the bulk update or delete. Caution should be used when executing bulk update or delete operations because they may result in inconsistencies between the database and the entities in the active persistence context. In general, bulk update and delete operations should only be performed within a transaction in a new persistence con- text or before fetching or accessing entities whose state might be affected by such operations. This means, that if you need to see the changes of such an operation you need to do the following things: Clear the EntityManager after this operation. Spring Data JPA's @Modifying annotation has a clearAutomatically flag defaulting to false. If that is set to true, invoking the query method will clear the EntityManager automatically (as the name suggests. Use that with caution, as it will effectively drop all pending changes that have not been flushed to the database yet! Re-obtain a fresh instance of the entity from the EntityManager. Calling findOne(…) on the repository seems like a reasonable way to do this as this roughly translates into EntityManager.find(…). Be aware that this might still hit 2nd level caches configured on the persistence provider. The safest way to work around this is - as the spec suggests - to use update queries only for bulk operations and fall back to the "load entity, alter, merge" approach by default.
upvote count: 25

http://stackoverflow.com/a/28624981
has comment: http://stackoverflow.com/comment/45836399
has comment: http://stackoverflow.com/comment/119961360
has body: Try using fetch=FetchType.EAGER, it will work
upvote count: 8
downvote count: 8
score: 0
answers question: http://stackoverflow.com/q/22643098
type: Answer

http://stackoverflow.com/comment/34438539
comment on: http://stackoverflow.com/a/22615994
score: 0
type: Comment
has text: Hey RKC thanks for your reply, this seems to be working for the most part however if the score is say for instance -0.23553 it will still be added to occurrencesPositive, does this regex work for negative numbers i tried adding if(f<0.0){occurrencesNeg++} but to no avail
type: AnswerComment

http://stackoverflow.com/comment/34533777
comment on: http://stackoverflow.com/q/22623188
has text: @Paul Hicks Thanks for commenting to Max Dy (though I still feel a little like [this guy](https://xkcd.com/979/)). Tried explicitly calling `connect()`, `getOutputStream()`, and `getInputStream()`; result: same behavior on `getInputStream()` (in this case an Exception is thrown with a ReadTimedOut as I mentioned I have configured above).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/78041145
type: Comment
type: QuestionComment
has text: I had problem with Analytics and firebase First open / active user count. I created two test project( one with just firebase, one with firebase and analytics tracker) and run it on 4 phones. unfortunately only active users was 1 ( the only phone with google account on it) and in second app there is just two active user. I realy disappointed from google.
score: 0
comment on: http://stackoverflow.com/q/22601839

header
type: Tag
tag name: header
tags question: http://stackoverflow.com/q/22500807

http://stackoverflow.com/comment/34332525
score: 0
has text: Allright, thanks! Will read it through.
type: Comment
comment on: http://stackoverflow.com/q/22557452
type: QuestionComment

http://stackoverflow.com/comment/34300503
has text: @Danny your right! works perfectly!
score: 0
comment on: http://stackoverflow.com/q/22537869
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34425115
comment on: http://stackoverflow.com/q/22608330
score: 0
type: Comment
type: QuestionComment
has text: You know, you can use `java.io.renameTo` to *move* and rename a file. (Though there isn't a mechanism that I know of to simply copy a file, other than using `Runtime.exec`.)

http://stackoverflow.com/comment/34448466
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22621751
has text: Care to elaborate? You have a thread. You want it to stop. So you ask it to interrupt itself by calling interrupt(). That causes an InterrupedException to be thrown by the blocking method, which also clears the interrupt status. Now you want to signal the calling code that the thread has been interruped and should thus stop running. And you can't throw an InterruptedException. How would you do, except by setting the interrupt status.
type: AnswerComment

http://stackoverflow.com/q/22558161
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22559244
tagged with: android-emulator
type: Question
tagged with: eclipse
tagged with: caching
has title: When stopping an android emulator in eclipse, is all the cache cleared or does eclipse store it for the next emulator?
possible better answer: http://stackoverflow.com/a/22558827
answer count: 3
upvote count: 1
has body: When running an emulator in eclipse for android, when I close this emulator, make some changes in my code and launch another emulator to test it, is the cache from the first emulator deleted, or does eclipse store it and pass it to the new emulator? Thanks!
favorite count: 0
has answer: http://stackoverflow.com/a/22558277
accepted answer: http://stackoverflow.com/a/22558277
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22558827
downvote count: 0

http://stackoverflow.com/comment/34472573
type: AnswerComment
has text: @KishanSarsechaGajjar Special case. Honestly I don't always answer the same question three times! :) I just like the question and had three unique answers and wanted to see what people think.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22633534

http://stackoverflow.com/a/22593316
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34398143
type: Answer
answers question: http://stackoverflow.com/q/22593101
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22593101
score: 1
has comment: http://stackoverflow.com/comment/34412901
has comment: http://stackoverflow.com/comment/34411723
has body: The output that you are getting is like: 3 1 2 6 7 4 5 7 &lt;= Length of the list But the length of vector is 7 and sequence of element is =&gt; 1, 2, 6, 7, 4, 5, null. This is because you are moving to next element before adding it to Vector. Code: System.out.println(temp.data); temp=temp.next; v.addElement(temp); Correct way should be: System.out.println(temp.data); v.addElement(temp); temp=temp.next;
upvote count: 1

http://stackoverflow.com/q/22549302
score: -2
answer count: 1
has title: Exporting integers as an image in Java
has comment: http://stackoverflow.com/comment/34319849
favorite count: 0
upvote count: 0
has body: How can I export an array of three colour values (0-255), (0-255), (0-255) as an image in Java? I have a 3-D array where the first the first two dimensions define the pixel and the third dimension, containing three elements, has the three RGB values.
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/34319351
tagged with: java
has comment: http://stackoverflow.com/comment/34346445
type: Question
has answer: http://stackoverflow.com/a/22549397

http://stackoverflow.com/a/22493824
answers question: http://stackoverflow.com/q/22493512
has comment: http://stackoverflow.com/comment/34250202
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34263069
downvote count: 0
has comment: http://stackoverflow.com/comment/34224962
accepted answer of: http://stackoverflow.com/q/22493512
type: Answer
has comment: http://stackoverflow.com/comment/34224652
has comment: http://stackoverflow.com/comment/34224685
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34251006
has body: Here's a method pulled from one of my projects. It get's the folder that the jar file is located in as opposed to the directory if was run from if invoked on the command line. /** * Retrieve a File representation of the folder this application is * located in. * * @return */ private static File getApplicationRootFolder() { String path = FileGetter.class.getProtectionDomain().getCodeSource() .getLocation().getPath(); try { String decodedPath = URLDecoder.decode(path, "UTF-8"); File jarParentFolder = new File(decodedPath).getParentFile(); if (jarParentFolder.exists() &amp;&amp; jarParentFolder.canRead() { File shellScript = new File(jarParentFolder, "import.sh") } catch (UnsupportedEncodingException e) { Main.myLog.error(TAG, "Unencoding jar path failed on:\n\t" + path); e.printStackTrace(); return null; } } You can then use that directory to make a File object for your shell script File shellScript = new File(getApplicationRootFolder(), scriptFilename); EDIT: Follow up questions to try to help you out and a solution So you want to be able to access one file that has three locations depending on when/where you code is run. This is how I see those cases: Case 1: Running directly from Eclipse (unpackaged code): shell script: X:/Java/exampleProject/bin/import.sh class file: X:/Java/exampleProject/bin/gqqnbig/YourClass.class Case 2: Running the packaged jar (shell script inside): shell script: X:/Java/YourJar.jar/bin/import.sh class file: X:/Java/YourJar.jar/bin/gqqnbig/YourClass.class Case 3: Running the packaged jar (shell script external): shell script: X:/Java/import.sh class file: X:/Java/YourJar.jar/bin/gqqnbig/YourClass.class What I think you need to do is prioritise the order you look at these locations and fall back to the next one in line if the shell script isn't found. I'd guess you want: 1. external to jar 2. inside packaged jar 3. unpackaged So to access these you will need to write each separately and move through each until you get File.exists() == true. S…

http://stackoverflow.com/comment/34715549
type: Comment
has text: That's good advice thank you I will have to remember that! Thankfully it was just another debugging issue on my part that was just difficult to find but I found it and it works great now!
score: 0
comment on: http://stackoverflow.com/a/22572239
type: AnswerComment

http://stackoverflow.com/comment/34513541
type: AnswerComment
type: Comment
has text: But LecturerFragment must be a fragment. I have my reason to do it.
comment on: http://stackoverflow.com/a/22646380
score: 0

http://stackoverflow.com/q/22597848
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22597910
has answer: http://stackoverflow.com/a/22597976
tagged with: command-line-arguments
has comment: http://stackoverflow.com/comment/34405474
score: 0
answer count: 2
has title: What is the directory if I am typing in an argument for a java program within a command line?
tagged with: directory
type: UnansweredQuestion
tagged with: command-line
has body: Basically, I have a program which takes arguments through the command line in these parameters: (I AM USING PUTTY) ./program.jar directory/file1.txt directory/file2.txt But it returns saying that the directory is wrong, I would like to know what is the default directory that the argument searches from and how to locate these items through the command line

http://stackoverflow.com/comment/34324588
has text: ow, and please edit comments like about running the command to your question, it belongs there as necessary information. I'll add it, but keep that in mind: the question itself should be complete, comments are just more .... temporary-ish?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22552481

http://stackoverflow.com/q/22604138
has comment: http://stackoverflow.com/comment/34519829
downvote count: 0
favorite count: 0
upvote count: 2
has title: proper method of constructing subject lines with special characters and tokens in SendGrid
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34416322
score: 2
answer count: 0
has body: I am using Java SendGrid API to send emails with subject lines in en, ja and ko characters and the subject linea contains a substitution token. It works fine for most cases but some ja and ko subject lines get broken within the token part so the substitution is not working. For workaround, I put line breaks after each space in the subject line. However, this approach does not work when the subject is pure English text. The xsmtpapi header seems not generated properly so no xsmtpapi-related fields get updated. Has anyone encountered a similar case? Are there any best practices or guidelines for constructing subject lines considering special characters and tokens? Here is a sample code to send the email: Hi ouflak, Here is the sample code: SendGrid sendGrid = new SendGrid(&lt;sendgridusername&gt;,&lt;sendgridpassword&gt;); sendGrid.setFrom("xxx@xxxxx.com"); sendGrid.setTo("yyy@yyyyy.com"); ... sendGrid.setSubject("sample subject line"); sendGrid.addHeader("X-SMTPAPI", &lt;generated xsmtpapi header&gt;); String response = sendGrid.send();
tagged with: java
tagged with: sendgrid
type: Question

http://stackoverflow.com/comment/35655536
type: Comment
comment on: http://stackoverflow.com/a/22618384
score: 1
type: AnswerComment
has text: A simple way to fix the equalsIgnoreCase NPE is to reverse the condition `if ("gray".equalsIgnoreCase(hm.get(new Coordinates(x - 32, y)))`

http://stackoverflow.com/comment/34299812
type: QuestionComment
has text: but where is the declaration of your variables as mSelectedOrderItem ?
score: 0
comment on: http://stackoverflow.com/q/22535252
type: Comment

javap
tags question: http://stackoverflow.com/q/22564085
type: Tag
tag name: javap

http://stackoverflow.com/comment/34453718
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22624535
score: 1
has text: after you removed the consecutive spaces, what would you want to fill the extra character at the end with?

http://stackoverflow.com/q/22633951
upvote count: 11
accepted answer: http://stackoverflow.com/a/22649702
has body: I am dying trying to figure out why a regex won't match. Any help is much appreciated. I'm going line by line of a web page (that works fine), but I need to pull out the links for each line. The application will check to see if there is a link in the line, but I need to actually pull out the URL. help? Pattern p = Pattern.compile("^.*href=\"([^\"]*)"); Matcher m = p.matcher(result); String urlStr = m.group(); links.add(urlStr); The error message I keep getting is this: Exception in thread "main" java.lang.IllegalStateException: No match found at java.util.regex.Matcher.group(Matcher.java:485) Even though 'result' has a link reference (hxxp://www.yahoo.com) in it. links is an ArrayList fyi. Thanks in advance!
score: 11
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22634070
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22634070
downvote count: 0
has answer: http://stackoverflow.com/a/22649702
favorite count: 0
has title: Java regex throwing exception for no match found when pattern found in line
tagged with: regex

http://stackoverflow.com/q/22640869
tagged with: resultset
has answer: http://stackoverflow.com/a/22641118
has comment: http://stackoverflow.com/comment/34488526
has answer: http://stackoverflow.com/a/22641153
has comment: http://stackoverflow.com/comment/34482831
has title: More than one jTable with the same ResultSet in Java
has comment: http://stackoverflow.com/comment/34482986
tagged with: swing
has comment: http://stackoverflow.com/comment/34484977
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has body: Can you populate more than one jTable with the same resultSet? public void tableDisplay() { String tableQuery = "SELECT foodQuantity,foodName FROM food ORDER BY RAND() LIMIT 3"; ResultSet rs; PreparedStatement statement; try { statement = con.prepareStatement(tableQuery); rs = statement.executeQuery(); jTable1.setModel(DbUtils.resultSetToTableModel(rs)); jTable2.setModel(DbUtils.resultSetToTableModel(rs)); } catch (SQLException ex) { System.out.println(ex.toString()); } } The code compiles but the second table doesn't get any records from DB. The point is that I need to select random items from mySql table and I want to display them in few jTables.
possible better answer: http://stackoverflow.com/a/22641153
type: Question
tagged with: apache-commons-dbutils
answer count: 2
accepted answer: http://stackoverflow.com/a/22641118
has comment: http://stackoverflow.com/comment/34482177
has comment: http://stackoverflow.com/comment/34492073
has comment: http://stackoverflow.com/comment/34482454
score: 0

http://stackoverflow.com/a/22646037
type: Answer
has comment: http://stackoverflow.com/comment/52609204
downvote count: 0
has body: You can use Collections.disjoint(): public static boolean disjoint(Collection c1, Collection c2): Returns true if the two specified collections have no elements in common. Code: List&lt;Integer&gt; a = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; b = new ArrayList&lt;Integer&gt;(); System.out.println(Collections.disjoint(a, b));
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22645993

http://stackoverflow.com/a/22588013
accepted answer of: http://stackoverflow.com/q/22524801
has body: By usin Java AWS SDK, able to connect to S3 bucket from Java and able to crawl the bucket. Crawling is nothing but taking the objects in a list and comparing and identifying the new object. Example can be found in http://aws.amazon.com/sdk-for-java/
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22524801

http://stackoverflow.com/comment/34424768
type: Comment
type: QuestionComment
has text: Looks like a side-effect of EE6's feature to allow EJBs in a WAR (I already noticed that although it's not clear from the standard whether this is allowed/desired, Glassfish 3 picks up MDB's that are packaged in a WAR) - and I know of no way to inhibit that behaviour, so splitting up your EJB project may be the best solution.
comment on: http://stackoverflow.com/q/22608762
score: 0

http://stackoverflow.com/q/22608862
has body: i've had edited my ANT build process. Here is my working list: create a copy of the src folder and a selfwritten AntTask Obfuscated all Strings ANT creates an JAR with the JAR will be Obfuscated by ProGuard An additional file will must be copied to the JAR JAR will be signed The bodled step is my Question. How i can copy a single file to the root directory of the JAR. I must make this step here! Before or after won't work: Before: ProGuard will be try to obfuscate this file and gives Exceptions. After cant work, the file must be signed. Anyone have an smart idea? Here a minified version of my ANT build script: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <property environment="env" /> <property name="debuglevel" value="source,lines,vars" /> <property name="target" value="1.7" /> <property name="source" value="1.7" /> <property name="version" value="1.0.0" /> <echo message="Copy source" /> <delete dir="builds/temp/" /> <mkdir dir="builds/temp/" /> <copydir src="src" dest="builds/temp/" /> <echo message="Obfuscate Strings" /> <taskdef resource="task.properties" classpath="libs/MyStringHelper.jar" /> <mystringhelper dir="builds/temp/" name="_X.class" decoder="MyClass.myMethod" imports="import test.MyClass;" /> <javac srcdir="builds/temp/" destdir="bin" /> <sleep seconds="1" /> <echo message="Create JAR Archive with Version ${version}" /> <attribute name="Application-Name" value="${name}" /> <attribute name="Application-Library-Allowable-Codebase" value="*.domain.com localhost" /> <attribute name="Caller-Allowable-Codebase" value="*.domain.com localhost" /> <attribute name="Codebase" value="*.domain.com localhost" /> <attribute name="Permissions" value="all-permissions" /> <attribute name="Author" value="Adrian Preuss" /> <attribute name="Main-Class" value="main.Run" /> <echo message="Obfuscate the Archive" /> <taskdef resource="proguard/ant/task.properties" classpath="libs/proguard.jar" /> <injar file="builds/${name}${version}.jar" /> <outjar file="builds/_…
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22613294
tagged with: ant
possible better answer: http://stackoverflow.com/a/22613294
has title: ANT - How i cant move File to JAR
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22609314
linked to: http://stackoverflow.com/q/4830474
accepted answer: http://stackoverflow.com/a/22609314
tagged with: java

http://stackoverflow.com/q/22501175
has comment: http://stackoverflow.com/comment/34233613
has answer: http://stackoverflow.com/a/22501246
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22502103
has answer: http://stackoverflow.com/a/22501786
tagged with: android
has answer: http://stackoverflow.com/a/22508933
answer count: 4
has comment: http://stackoverflow.com/comment/34233940
score: 2
has comment: http://stackoverflow.com/comment/34234387
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22166832
has title: Stop thread after button click
type: Question
has comment: http://stackoverflow.com/comment/34234607
tagged with: java
has comment: http://stackoverflow.com/comment/34236444
has comment: http://stackoverflow.com/comment/34234435
has body: I have created a thread on and called that on button click: btnUpload.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new Thread(new ClientThread()).start(); } }); This is my main thread: class ClientThread implements Runnable { @Override public void run() { try { InetAddress serverAddr = InetAddress.getByName(SERVER_IP); socket = new Socket(serverAddr, SERVERPORT); } catch (UnknownHostException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } } I need to stop the thread after actions of button click. How will I do it? I have tried Boolean, interrupt methods but not working. How can I stop it? Please help me.

http://stackoverflow.com/comment/66751271
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/34396968
type: Comment
has text: I imported the microsoft sql server latest jar into my local maven repository and, when generating the jar, a SecurityException was thrown. I added the filter regarding exclusions for SF, DSA and RSA and it worked! Thanks

http://stackoverflow.com/a/22650233
has comment: http://stackoverflow.com/comment/63722281
upvote count: 18
type: AcceptedAnswer
score: 17
answers question: http://stackoverflow.com/q/22625065
type: Answer
has body: For the first question, I agree with skiwi that it shouldn't be throwing a NPE. I hope they will change that (or else at least add it to the javadoc). Meanwhile, to answer the second question I decided to use Collectors.toMap instead of Collectors.groupingBy: Stream&lt;Class&lt;?&gt;&gt; stream = Stream.of(ArrayList.class); Map&lt;Class&lt;?&gt;, List&lt;Class&lt;?&gt;&gt;&gt; map = stream.collect( Collectors.toMap( Class::getSuperclass, Collections::singletonList, (List&lt;Class&lt;?&gt;&gt; oldList, List&lt;Class&lt;?&gt;&gt; newEl) -&gt; { List&lt;Class&lt;?&gt;&gt; newList = new ArrayList&lt;&gt;(oldList.size() + 1); newList.addAll(oldList); newList.addAll(newEl); return newList; })); Or, encapsulating it: /** Like Collectors.groupingBy, but accepts null keys. */ public static &lt;T, A&gt; Collector&lt;T, ?, Map&lt;A, List&lt;T&gt;&gt;&gt; groupingBy_WithNullKeys(Function&lt;? super T, ? extends A&gt; classifier) { return Collectors.toMap( classifier, Collections::singletonList, (List&lt;T&gt; oldList, List&lt;T&gt; newEl) -&gt; { List&lt;T&gt; newList = new ArrayList&lt;&gt;(oldList.size() + 1); newList.addAll(oldList); newList.addAll(newEl); return newList; }); } And use it like this: Stream&lt;Class&lt;?&gt;&gt; stream = Stream.of(ArrayList.class); Map&lt;Class&lt;?&gt;, List&lt;Class&lt;?&gt;&gt;&gt; map = stream.collect(groupingBy_WithNullKeys(Class::getSuperclass)); Please note rolfl gave another, more complicated answer, which allows you to specify your own Map and List supplier. I haven't tested it.
accepted answer of: http://stackoverflow.com/q/22625065
downvote count: 1

http://stackoverflow.com/a/22598322
answers question: http://stackoverflow.com/q/22595676
has body: As mentioned in the documentation, introducing an HTML template file will lead to Play generating a class in the views.html package. The way you organise your templates into packages is then replicated below views.html by Play. As a result, I think your return statement should be as follows: return ok(views.html.com.me.project.index(null)); (This admittedly doesn't explain the folder structure you're seeing in your target directory.)
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34406531
upvote count: 1

http://stackoverflow.com/comment/34396102
score: 0
type: AnswerComment
has text: i've edit the question, indeed java is installed on my Linux machine
comment on: http://stackoverflow.com/a/22592724
type: Comment

http://stackoverflow.com/comment/34428839
type: QuestionComment
has text: When the game finish. My game finish when the user lose.
comment on: http://stackoverflow.com/q/22611098
score: 0
type: Comment

multithreading
tags question: http://stackoverflow.com/q/22509521
tags question: http://stackoverflow.com/q/22583540
tags question: http://stackoverflow.com/q/22566131
tags question: http://stackoverflow.com/q/22623150
tags question: http://stackoverflow.com/q/22626599
tags question: http://stackoverflow.com/q/22488197
tags question: http://stackoverflow.com/q/22569551
tags question: http://stackoverflow.com/q/22540135
tags question: http://stackoverflow.com/q/22487992
tags question: http://stackoverflow.com/q/22584669
tags question: http://stackoverflow.com/q/22512424
type: Tag
tags question: http://stackoverflow.com/q/22632552
tags question: http://stackoverflow.com/q/22497880
tags question: http://stackoverflow.com/q/22569411
tags question: http://stackoverflow.com/q/22599968
tags question: http://stackoverflow.com/q/22545702
tags question: http://stackoverflow.com/q/22528713
tags question: http://stackoverflow.com/q/22578290
tags question: http://stackoverflow.com/q/22595284
tags question: http://stackoverflow.com/q/22515059
tags question: http://stackoverflow.com/q/22559527
tags question: http://stackoverflow.com/q/22570249
tags question: http://stackoverflow.com/q/22588591
tags question: http://stackoverflow.com/q/22561041
tags question: http://stackoverflow.com/q/22609552
tags question: http://stackoverflow.com/q/22548471
tags question: http://stackoverflow.com/q/22618624
tags question: http://stackoverflow.com/q/22558304
tags question: http://stackoverflow.com/q/22592874
tags question: http://stackoverflow.com/q/22625419
tags question: http://stackoverflow.com/q/22622742
tags question: http://stackoverflow.com/q/22492000
tags question: http://stackoverflow.com/q/22570921
tags question: http://stackoverflow.com/q/22626901
tags question: http://stackoverflow.com/q/22528587
tags question: http://stackoverflow.com/q/22591489
tags question: http://stackoverflow.com/q/22576668
tags question: http://stackoverflow.com/q/22589499
tags question: http://stackoverflow.com/q/22580981
tags question: http://stackoverflow.com/q/22614284
tags question: http://stackoverflow.com/q/22621981
tags question: http://stackoverflow.com/q/22588396
tags question: http://stackoverflow.com/q/22573046
tags question: http://stackoverflow.com/q/22617035
tags question: http://stackoverflow.com/q/22627685
tags question: http://stackoverflow.com/q/22561110
tags question: http://stackoverflow.com/q/22494484
tags question: http://stackoverflow.com/q/22524752
tags question: http://stackoverflow.com/q/22582964
tags question: http://stackoverflow.com/q/22636146
tags question: http://stackoverflow.com/q/22500127
tags question: http://stackoverflow.com/q/22585828
tags question: http://stackoverflow.com/q/22557429
tags question: http://stackoverflow.com/q/22597946
tags question: http://stackoverflow.com/q/22517695
tags question: http://stackoverflow.com/q/22605561
tags question: http://stackoverflow.com/q/22600668
tags question: http://stackoverflow.com/q/22630171
tags question: http://stackoverflow.com/q/22490061
tags question: http://stackoverflow.com/q/22636955
tags question: http://stackoverflow.com/q/22643808
tags question: http://stackoverflow.com/q/22528306
tags question: http://stackoverflow.com/q/22576811
tags question: http://stackoverflow.com/q/22575088
tags question: http://stackoverflow.com/q/22536341
tags question: http://stackoverflow.com/q/22548624
tags question: http://stackoverflow.com/q/22531024
tags question: http://stackoverflow.com/q/22603048
tags question: http://stackoverflow.com/q/22522068
tags question: http://stackoverflow.com/q/22568184
tags question: http://stackoverflow.com/q/22511211
tags question: http://stackoverflow.com/q/22562165
tags question: http://stackoverflow.com/q/22551691
tags question: http://stackoverflow.com/q/22593336
tags question: http://stackoverflow.com/q/22535826
tags question: http://stackoverflow.com/q/22608249
tags question: http://stackoverflow.com/q/22609634
tags question: http://stackoverflow.com/q/22527784
tags question: http://stackoverflow.com/q/22533905

http://stackoverflow.com/a/22493090
has body: Hi Susan this is a basic example using FaceDetector.Face Class: public class FaceDetection extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new myView(this)); } private class myView extends View { private int imageWidth, imageHeight; private int numberOfFace = 5; private FaceDetector myFaceDetect; private FaceDetector.Face[] myFace; float myEyesDistance; int numberOfFaceDetected; Bitmap myBitmap; public myView(Context context) { super(context); BitmapFactory.Options BitmapFactoryOptionsbfo = new BitmapFactory.Options(); BitmapFactoryOptionsbfo.inPreferredConfig = Bitmap.Config.RGB_565; myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.jorgesys, BitmapFactoryOptionsbfo); imageWidth = myBitmap.getWidth(); imageHeight = myBitmap.getHeight(); myFace = new FaceDetector.Face[numberOfFace]; myFaceDetect = new FaceDetector(imageWidth, imageHeight, numberOfFace); numberOfFaceDetected = myFaceDetect.findFaces(myBitmap, myFace); } @Override protected void onDraw(Canvas canvas) { canvas.drawBitmap(myBitmap, 0, 0, null); Paint myPaint = new Paint(); myPaint.setColor(Color.GREEN); myPaint.setStyle(Paint.Style.STROKE); myPaint.setStrokeWidth(3); for (int i = 0; i &lt; numberOfFaceDetected; i++) { Face face = myFace[i]; PointF myMidPoint = new PointF(); face.getMidPoint(myMidPoint); myEyesDistance = face.eyesDistance(); canvas.drawRect((int) (myMidPoint.x - myEyesDistance * 2), (int) (myMidPoint.y - myEyesDistance * 2), (int) (myMidPoint.x + myEyesDistance * 2), (int) (myMidPoint.y + myEyesDistance * 2), myPaint); } } } } Inside your /drawable folder add a an image with several faces to test, this example use an image called jorgesys.png (R.drawable.jorgesys) more info: Face recognition using android sdk not opencv
has comment: http://stackoverflow.com/comment/38814740
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22492994
answers question: http://stackoverflow.com/q/22492994
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/34250864
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22511279
has text: But does ForeignCollection class support ordering items? Maybe it will be easier sort when creating array.. Edit: i checked EagerForeignCollection class and it uses List internally so probably yes

http://stackoverflow.com/q/22514023
tagged with: java
upvote count: 42
type: Question
has answer: http://stackoverflow.com/a/22514093
downvote count: 0
tagged with: ide
score: 42
answer count: 3
has answer: http://stackoverflow.com/a/41790170
tagged with: windows
has title: Does IntelliJ IDEA work on a 64-bit Windows system?
favorite count: 0
accepted answer: http://stackoverflow.com/a/22514093
tagged with: installation
has body: I have downloaded and installed IDEA 13.1. However, even having a 64-bit system, Windows has automatically installed the program in the folder Program Files (x86), which is dedicated for 32-bit programs. Is there another download for the 64-bit version or maybe a special setting to make it suitable for a 64-bit system?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/41510699
has comment: http://stackoverflow.com/comment/34256256
has answer: http://stackoverflow.com/a/41510699

http://stackoverflow.com/q/22581724
has body: I am trying to create a c++ class and hold its objects into an array, and reference those c++ objects from java using JNI, since JNI does not provide any mechanism to hold any non primitive type of objects into java. I have implemented the code as mentioned below but the output is showing me as if multiple objects have got created and i am also receiving a heap error on the second call to create a new native object. Can anyone look into this? thanks Codes: Java class(The function for loading library dll has been defined in LibObj): package org.jnp.pkg004; import org.jnp.libloader.LibObj; public class PureCppObjFactory extends LibObj { private long cppobjlstsz; public PureCppObjFactory() { super(); cppobjlstsz=0; } public native void newCppObj(); public native void PrintCppObjDetails(long cppobjlstindex); } C++ library code: #include "stdafx.h" #include "stdlib.h" #include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;stdio.h&gt; using namespace std; #include "org_jnp_pkg004_PureCppObjFactory.h" class NativeObjClass { private: int num_ran; int obj_num; public: static int obj_cnt; NativeObjClass() { obj_cnt++; obj_num=obj_cnt; num_ran=rand(); cout&lt;&lt;"Native Object number "&lt;&lt;setfill('0')&lt;&lt;setw(5)&lt;&lt;obj_cnt&lt;&lt;" Random number:"&lt;&lt;num_ran&lt;&lt;endl; } int get_obj_num() { return obj_num; } int get_num_ran() { return num_ran; } }; int NativeObjClass::obj_cnt=0; NativeObjClass *nobj_lst; long nobj_lst_size=0; JNIEXPORT void JNICALL Java_org_jnp_pkg004_PureCppObjFactory_newCppObj (JNIEnv *env, jobject obj) { jclass thisCls = env-&gt;GetObjectClass(obj); jfieldID fid=env-&gt;GetFieldID(thisCls,"cppobjlstsz","J"); NativeObjClass nobj; jlong java_lst_sz=env-&gt;GetLongField(obj,fid); NativeObjClass *temp_nobj_lst; temp_nobj_lst=new NativeObjClass[nobj_lst_size]; if(nobj_lst_size&gt;0) { memmove(temp_nobj_lst,nobj_lst,nobj_lst_size); delete nobj_lst; } nobj_lst_size++; nobj_lst=new NativeObjClass[nobj_lst_size]; if(nobj_lst_size&gt;1) { …
has title: Holding reference to native class object in JNI
has answer: http://stackoverflow.com/a/22588121
type: Question
score: 5
tagged with: java-native-interface
upvote count: 5
answer count: 2
has answer: http://stackoverflow.com/a/22589927
downvote count: 0
has comment: http://stackoverflow.com/comment/34376372
favorite count: 0
has comment: http://stackoverflow.com/comment/34387103
type: UnansweredQuestion
tagged with: c++
has comment: http://stackoverflow.com/comment/34387987
tagged with: java

http://stackoverflow.com/comment/34420583
comment on: http://stackoverflow.com/a/22605375
type: AnswerComment
score: 0
has text: No,the problem is a bit more tricky. Let's say I should create JTable with 2 rows. The JComboBox of the FIRST row should be populated with employees[0].getQualification() = {"Programmer","Web"}. The JComboBox of the SECOND row should be populated with employees[1].getQualification() = {"Writer","Editor"}. The problem is that in both rows I see "Programmer" as a selected item!!! Only when I click on JComboBox, I see the proper dropdown list.
type: Comment

http://stackoverflow.com/q/22588565
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34388945
tagged with: android
has answer: http://stackoverflow.com/a/22588581
has body: I am trying to pass the value of matrix_id from MainActivity(extends Activity) to HomeActivity(extends Activity) and ScheduleFragment(extends Fragment). When I run the apps, it will crash. Im really amateur in Java Programming. What should I do ? Please help me, thank you. This is part of MainActivity.java public class MainActivity extends Activity { public static final String PREFS_NAME="PreferencesValue"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_screen); b = (Button)findViewById(R.id.btnLogin); matrix_id = (EditText)findViewById(R.id.txtMatric); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString("matrix", matrix_id.getText().toString()); editor.commit(); Intent i = new Intent(getApplicationContext(), HomeActivity.class); startActivity(i); finish(); } }); } This is part of HomeActivity.java /** * Displaying fragment view for selected nav drawer list item * */ private void displayView(int position) { // update the main content by replacing fragments Fragment fragment = null; switch (position) { case 0: fragment = new ScheduleFragment(); break; case 1: fragment = new ReminderFragment(); break; case 2: fragment = new AboutFragment(); break; case 3: fragment = new LogoutFragment(); break; } This is ScheduleFragment.java public class ScheduleFragment extends Fragment { private final Context context; public static final String PREFS_NAME="PreferencesValue"; public ScheduleFragment(Context context){ this.context = context; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_schedule, container, false); TextView tvmatrix = (TextView)rootView.findViewById(R.id.textViewMatrix); SharedPreferences settings = context.get…
type: AnsweredQuestion
score: 1
tagged with: sharedpreferences
upvote count: 1
tagged with: android-intent
has title: Unable to retrieve the values SharedPreferences from different extends
type: Question
has comment: http://stackoverflow.com/comment/34389012
accepted answer: http://stackoverflow.com/a/22588581

http://stackoverflow.com/comment/34368819
has text: i already configured session timeout, But how can i remove variable from application scope corresponding to that session. i am not able to track session timeout .
comment on: http://stackoverflow.com/q/22573757
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/74668026
comment on: http://stackoverflow.com/a/22517266
has text: @spiderman were you able to dynamically set the output file name?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34394100
type: AnswerComment
has text: Great, so just to reiterate, super allows me to obtain and use the functionality from the parent class, in my base class?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22591647

http://stackoverflow.com/a/22509196
answers question: http://stackoverflow.com/q/22509052
type: Answer
has body: Java supports a[b] syntax only for arrays, but you're trying to apply it to String here: myHotelRef[deleteRoom].
score: 0

http://stackoverflow.com/comment/34351162
type: Comment
has text: sure, it's just a short finite loop with no blocking calls
comment on: http://stackoverflow.com/a/22565677
type: AnswerComment
score: 0

http://stackoverflow.com/q/22637651
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/22637824
has comment: http://stackoverflow.com/comment/34476063
score: 0
tagged with: spring-data-jpa
answer count: 1
has body: I have a running spring application with applicationContext as @Configuration annotated class. It has a mysql datasource configured using hibernate and spring data-jpa. I need to drop the existing database and create a new database based on my domain model everytime I run the application. I know I have to set &lt;property name="hibernate.hbm2ddl.auto" value="create-drop"/&gt; But how do I set this property in my java configuration class? Please suggest. Thanking You.
type: UnansweredQuestion
tagged with: spring
has title: Hibernate property configuration in Spring applicationContext.class

http://stackoverflow.com/q/22619760
has title: Hibernate not recognizing column length in script. Its using default one and giving Data too long for column error
answer count: 1
has comment: http://stackoverflow.com/comment/34445073
has body: I am using scripts to generate tables instead of hibernate auto generate. There is a varchar column with length 5000 create table my_code ( cc_id bigint not null auto_increment unique, description varchar(5000), primary key (cc_id) ) ENGINE=InnoDB In my class i have a description field: @Column(name = "description", length=5000) private String description; But when i insert a field with length 300 it throws: Data truncation: Data too long for column 'description' at row 1 It accepts anything below 255 which is the default. Why is it not picking up length 5000?
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: spring-data
tagged with: mysql
has answer: http://stackoverflow.com/a/22621048
accepted answer: http://stackoverflow.com/a/22621048
type: Question
linked to: http://stackoverflow.com/q/1303476
score: 0
tagged with: sql

http://stackoverflow.com/comment/34368537
has text: Check this: http://stackoverflow.com/questions/602636/concurrentmodificationexception-and-a-hashmap
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22577577
score: 1

http://stackoverflow.com/q/22550796
has comment: http://stackoverflow.com/comment/34321710
linked to: http://stackoverflow.com/q/15668329
answer count: 4
duplicate of: http://stackoverflow.com/q/15668329
upvote count: 3
linked to: http://stackoverflow.com/q/4216745
has title: Converting String date to java.sql.Date
downvote count: 1
has answer: http://stackoverflow.com/a/22550881
type: Question
linked to: http://stackoverflow.com/q/530012
tagged with: simpledateformat
has answer: http://stackoverflow.com/a/22550928
tagged with: java
has comment: http://stackoverflow.com/comment/74950050
tagged with: date
has body: Please advise how can I convert the date that I am getting in String form to java.sql.Date form.. String Dateimp = abcObject.getabcDate(); java.sql.Date sd = ????? // what should i write in here. at last finally i want to convert the date that I am getting in String form to java.sql.Date
has answer: http://stackoverflow.com/a/22550851
score: 2
has answer: http://stackoverflow.com/a/22550864
has comment: http://stackoverflow.com/comment/34321570
favorite count: 0
has comment: http://stackoverflow.com/comment/34321687
has comment: http://stackoverflow.com/comment/34321499
type: UnansweredQuestion

http://stackoverflow.com/q/22594586
has comment: http://stackoverflow.com/comment/34399625
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/2497063
has title: ArrayList and ensureCapacity, strange behavior
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22594623
has comment: http://stackoverflow.com/comment/34399460
tagged with: java
has body: I have the following class: class CapacityTrackingArrayList&lt;T&gt; extends ArrayList&lt;T&gt; { public boolean add(T elem) { System.out.printf("Invoking add()... \n"); boolean isAdded = super.add(elem); return isAdded; } public void ensureCapacity(int arg) { System.out.printf("Invoking ensureCapacity(%d)... \n", arg); super.ensureCapacity(arg); } } // class CapacityTrackingArrayList and testing with... CapacityTrackingArrayList&lt;Integer&gt; numberList2 = new CapacityTrackingArrayList&lt;Integer&gt;(); numberList2.ensureCapacity(100); for (int i = 0; i &lt;= 5; i++) { numberList2.add(i); } I get following output Invoking ensureCapacity(100)... Invoking ensureCapacity(1)... Invoking add()... Invoking ensureCapacity(2)... Invoking add()... Invoking ensureCapacity(3)... Invoking add()... Invoking ensureCapacity(4)... Invoking add()... Invoking ensureCapacity(5)... What strikes me is that, even though I call numberList2.ensureCapacity(100); before adding, I would expect the list to keep this capacity until about 100 elements have been added. Apparently, not at all! Always, when adding an element, it invokes ensureCapacity(). How come?
upvote count: 1
downvote count: 1
type: Question
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/34384296
score: 0
type: Comment
has text: Thanks but as I've explained I do not want to launch an activity on a notification click. I'm looking at your second part, will report back with comment asap.
comment on: http://stackoverflow.com/a/22585875
type: AnswerComment

http://stackoverflow.com/a/22593158
has comment: http://stackoverflow.com/comment/34397266
score: 0
has comment: http://stackoverflow.com/comment/34397688
type: Answer
has comment: http://stackoverflow.com/comment/34397543
has body: Adjust your crawler method to return a string when called, like: public String crawler(String startingURL) { String result; listOfPendingURLs = new ArrayList&lt;String&gt;(); listOfTraversedURLs = new ArrayList&lt;String&gt;(); result = ""; listOfPendingURLs.add(startingURL); while (!listOfPendingURLs.isEmpty() &amp;&amp; listOfTraversedURLs.size() &lt;= 100) { String urlString = listOfPendingURLs.remove(0); if (!listOfTraversedURLs.contains(urlString)) { listOfTraversedURLs.add(urlString); // TODO display on panel instead System.out.println("Craw " + urlString); try { URL oURL = new URL(urlString); BufferedReader in = new BufferedReader( new InputStreamReader(oURL.openStream())); StringBuffer strbuf = new StringBuffer(); String lines; while ((lines = in.readLine()) != null) { strbuf.append(lines); } result = result + strbuf.toString(); // convert to string strbuf.delete(0, strbuf.length());// empty the buffer results++;// GUI statistics variable - for future use in.close(); } catch (Exception e) { e.printStackTrace(); } for (String s : getSubURLs(urlString)) { // Read the page from // this URL and for // each URL // contained in the // page if (!listOfTraversedURLs.contains(s)) listOfPendingURLs.add(s); // Add it to listOfPendingURLs // if it is not is // listOfTraversedURLs } } } return result; }
has comment: http://stackoverflow.com/comment/34397331
answers question: http://stackoverflow.com/q/22592872

http://stackoverflow.com/q/22602772
tagged with: java
accepted answer: http://stackoverflow.com/a/22602982
type: Question
has title: Can't use Jackson in eclipse
has answer: http://stackoverflow.com/a/22602982
tagged with: jackson
tagged with: eclipse
has body: I've downloaded jackson-core-2.4.0-20140316.193819-27.jar from Jason download page, then added it to Java Build Path - Library &amp; Order and Export. But I can't use ObjectMapper class (ObjectMapper cannot be resolved ....) I'm using jdk 7.0
score: 0
tagged with: jsoup
answer count: 2
possible better answer: http://stackoverflow.com/a/22603074
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22603074

http://stackoverflow.com/a/22590122
answers question: http://stackoverflow.com/q/22590061
downvote count: 0
type: Answer
score: 2
has body: Use while (!(X == 1 &amp;&amp; Y == 5)) { blah }
upvote count: 2

http://stackoverflow.com/comment/34323171
type: QuestionComment
type: Comment
has text: Sorry, Code compliance level was set to 1.6. So the errors. Thanks.
comment on: http://stackoverflow.com/q/22551770
score: 0

http://stackoverflow.com/comment/34304597
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22541145
type: Comment
has text: I agree with above comment, I think it should be better: String.format("%1$5s", y)

http://stackoverflow.com/a/22597627
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/22597271
score: 2
answers question: http://stackoverflow.com/q/22597271
has body: This is a variable-arity method: public void errorNew(final int a, final String key, final Object... params); and this is a fixed-arity method: public void errorNew(final int a, final String key, final Object[] params); A variable-arity method is applicable if the number of actual arguments is equal or greater to n - 1, where n is the number of parameters declared by the method. A fixed-arity method is only applicable if the number of arguments is exactly equal to the number of declared parameters (see the specs) So the difference is not at the bytecode level, but at the compiler stage: when the compiler has to resolve the method signature, the algorithm changes as I described above, depending on the declaration being a fixed- or variable-arity one. That's why the compiler doesn't complain when your LoggerImpl implements the Logger interface using a vararg parameter, but can't find the method when you call it on an instance of the Logger interface (method signatures are resolved statically at compile-time, not dynamically at runtime, depending on the actual type of the object)
type: AcceptedAnswer

http://stackoverflow.com/q/22606443
score: 0
answer count: 1
has title: Use fragments ans swipe views without extend fragmentsActivity
tagged with: android
has answer: http://stackoverflow.com/a/22606584
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22606584
type: Question
has body: my main activity have classic tabs, I want to implement swipable tabs in my main actuvity, But in every tutorial/guide I've found, each time main activity extends FragmentActivity : public class MainActivity extends FragmentActivity implements ActionBar.TabListener { But, I have other things in my activity, so my main activity extends Activity, My a question is : how to add all fragments, view pager and other methods, in activity that just extend activity ? Source http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/

http://stackoverflow.com/a/22534625
score: 0
answers question: http://stackoverflow.com/q/22532680
type: Answer
has comment: http://stackoverflow.com/comment/34301880
accepted answer of: http://stackoverflow.com/q/22532680
has comment: http://stackoverflow.com/comment/34299901
has comment: http://stackoverflow.com/comment/34301113
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34296681
has body: This is just to help you with the problem. What i mean to say is using the scriptlets in jsp, the naming conventions, using two servlets in this scenario are all not recommended.. code snippets web.xml myservleta com.examples.example.MyServletA 1 myservletb com.examples.example.MyServletB 1 myservleta *.do myservletb *.go index.jsp index.jsp <% session.setAttribute("location", "tvm"); %> page2.jsp MyServletA.java protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String loc = request.getSession().getAttribute("location").toString(); System.out.println("location in ServletA from session is " + loc); RequestDispatcher rd = request.getRequestDispatcher("geco.jsp"); rd.forward(request, response); } MyServletB.java protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); String loc = session.getAttribute("location").toString(); System.out.println("location in ServletB from session is " + loc); } Console log: Mar 20, 2014 9:28:33 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 343 ms location in ServletA from session is tvm location in ServletB from session is tvm edit: The jsp that performs 'gotobjava.go' action is renamed to page2.jsp as per OP's edit request

http://stackoverflow.com/comment/34347987
score: 0
comment on: http://stackoverflow.com/a/22565057
type: AnswerComment
type: Comment
has text: http://stackoverflow.com/questions/8379785/how-does-a-breadth-first-search-work-when-looking-for-shortest-path-java

http://stackoverflow.com/q/22636153
has comment: http://stackoverflow.com/comment/34483911
possible better answer: http://stackoverflow.com/a/22636258
type: Question
has answer: http://stackoverflow.com/a/22636224
downvote count: 0
has answer: http://stackoverflow.com/a/22661760
has comment: http://stackoverflow.com/comment/34508964
accepted answer: http://stackoverflow.com/a/22636224
has answer: http://stackoverflow.com/a/22636325
tagged with: getter-setter
linked to: http://stackoverflow.com/q/328496
upvote count: 6
has comment: http://stackoverflow.com/comment/34473282
has comment: http://stackoverflow.com/comment/34473384
favorite count: 0
has comment: http://stackoverflow.com/comment/34481226
has answer: http://stackoverflow.com/a/22636230
answer count: 5
has title: A setter with logic in java
score: 6
has answer: http://stackoverflow.com/a/22636258
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34477446
tagged with: oop
has body: Consider a Message object in Java that stores some text. public class Message { private String text; private boolean containsDigit; public Message() { //constructor } public String getText() { return text; } public void setText(String text) { this.text = text; } public boolean isContainsDigit() { return containsDigit; } } This is a persisted object. I have no problem with data being set in the constructors but the Message's text field can be set after the object is created and when the text is set, the containsDigit field should also be query-able thereafter. The obvious way to do this is in the setter: public void setText(String text) { // presume existence of method to check for digit if(text.containsDigit()) this.containsDigit = true; this.text = text; } But does this result in any "best practice" alarms bells going off due to having logic within a setter method? Would anyone suggest an alternative implementation? EDIT I should probably add that the containsDigit field is required because the object is persisted so the containsDigit field can be queried subsequently. Also, in an application using the Spring/Hibernate engine, this setter is constantly called when re-reading/writing the object so was wondering about the practicality/efficiency of this also.
tagged with: java
tagged with: setter
has comment: http://stackoverflow.com/comment/34483076
has comment: http://stackoverflow.com/comment/34473284

http://stackoverflow.com/q/22488734
tagged with: guava
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34212500
type: Question
has body: They seem identical to java.util counterparts. In a project I have to review these apis are used and an external jar is present for that. But...in what they are different from java.util ones?
has comment: http://stackoverflow.com/comment/34212581
has comment: http://stackoverflow.com/comment/34213231
has title: What is the purpose of google guava libraries?
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22488960
has comment: http://stackoverflow.com/comment/34337041
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22488960
score: 3

http://stackoverflow.com/q/22534293
linked to: http://stackoverflow.com/q/14510547
has title: Hibernate multiple ManyToMany association leads to wrong number of columns error
score: 0
has body: I have a bit of a complex database structure which I want to explain at first. We have the following tables: Mandant (Id, Name) Leistungsbereich (Id, Label) Benutzer (Id, LoginName) Here we have two association tables: Mandant_Leistungsbereich (Id, MandantId, LeistungsbereichId) Benutzer_Mandant_Leistungsbereich (Id, BenutzerId, MandantLeistungsbereichId) The primary keys are always the 'Id' columns and the foreign keys are obvious I think. For the first three tables I have the corresponding Domain Java classes that are working with Hibernate. To get all Leistungsbereich items for the Mandant I have the following code in my Mandant domain class: @JoinTable( name = "Mandant_Leistungsbereich", joinColumns = { @JoinColumn( name = "MandantId" ) }, inverseJoinColumns = { @JoinColumn( name = "LeistungsbereichId" ) } ) @ManyToMany( fetch = FetchType.LAZY ) private Set&lt;Leistungsbereich&gt; leistungsbereiche; When I load a Mandant automatically all Leitungsbereich items are loaded in the Java Set. Hibernate knows that it has to search in the Mandant_Leistungsbereich association table, so this works fine so far. Now comes the strange part. I also want to achieve the same thing for the Benutzer because the Benutzer should have a list (or better to say a set) of Mandant_Leistungsbereich items. So I do the same in the Benutzer class: @JoinTable( name = "Benutzer_Mandant_Leistungsbereich", joinColumns = {@JoinColumn( name = "BenutzerId" ) }, inverseJoinColumns = {@JoinColumn( name = "MandantLeistungsbereichId" ) } ) @ManyToMany( fetch = FetchType.LAZY ) private Set&lt;MandantLeistungsbereich&gt; mandantLeistungsbereiche; But then loading a user the following error gets printed out: org.hibernate.MappingException: Foreign key (FK_71hckf2bhqrp78gom71l6eq38:Benutzer_Mandant_Leistungsbereich [MandantLeistungsbereichId])) must have same number of columns as the referenced primary key (Mandant_Leistungsbereich [MandantId,LeistungsbereichId]) I really dont know why hibernate thinks t…
tagged with: mapping
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34292618
tagged with: orm
type: Question
tagged with: many-to-many
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34292897

http://stackoverflow.com/comment/34410768
comment on: http://stackoverflow.com/a/22600545
type: Comment
has text: OK thanks for your reply. I don't need to use bit shifting to get the pixel integer until further down the loop. So I can use getSubArray method to group 8 x 8 pixels? I hav'nt yet tested your method, but I could just simply assign pixelArray[start_i + i][start_j + j] instead of calling the getIntFromPixel method to just use each color component separately? Overall, your idea seems very legit.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34260075
type: QuestionComment
has text: What language are you using
score: 1
comment on: http://stackoverflow.com/q/22516273
type: Comment

union
type: Tag
tag name: union
tags question: http://stackoverflow.com/q/22551987

http://stackoverflow.com/comment/34449386
type: Comment
has text: Have you considered using Scala which supports higher-kinded types? You seem to be just starting out, after all.
comment on: http://stackoverflow.com/q/22620909
score: 0
type: QuestionComment

http://stackoverflow.com/q/22575608
has title: annotation configuration - how to say spring configuration class location
tagged with: annotations
has comment: http://stackoverflow.com/comment/34365903
tagged with: spring
has answer: http://stackoverflow.com/a/22575746
answer count: 4
accepted answer: http://stackoverflow.com/a/22584092
has answer: http://stackoverflow.com/a/22576118
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22576566
has comment: http://stackoverflow.com/comment/34365635
has body: Spring doesn't see request mapping for my controller. I try to use annotation configuration without xml. Project structure: Config.java package com.dnn.web.config; //imports @Configuration @ComponentScan("com.dnn.spring") @EnableWebMvc public class Config { @Bean public UrlBasedViewResolver setupViewResolver() { UrlBasedViewResolver resolver = new UrlBasedViewResolver(); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); resolver.setViewClass(JstlView.class); return resolver; } } WebInitializer.java package com.dnn.web.config; //imports public class WebInitializer implements WebApplicationInitializer { public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(servletContext); Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); } } HelloWorldController.java package com.dnn.spring.controller; //imports @Controller public class HelloWorldController { @RequestMapping("/hello") public String hello( @RequestParam(value = "name", required = false, defaultValue = "World") String name, Model model) { model.addAttribute("name", name); return "helloworld"; } } When I invoke this application I see following result: localhost:8080/dnn-project/hello returns same result. I really don't understand where I made mistake. P.S. source code of this example: source I suppose that Spring doesn't see Config and WebInitializer classes but I don't understand why and how to fix it. P.S. pom.xml 4.0.0 com.dnn.web dnn-project war 1.0.0-SNAPSHOT dnn-project Maven Webapp http://maven.apache.org <spring.version>4.0.1.RELEASE</spring.version> junit junit 3.8.1 test org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} javax.servlet javax.servl…
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/22575746
type: Question
has comment: http://stackoverflow.com/comment/34365308
tagged with: configuration
has comment: http://stackoverflow.com/comment/34365338
has comment: http://stackoverflow.com/comment/34365273
has answer: http://stackoverflow.com/a/22584092
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/22645190
score: 2
has comment: http://stackoverflow.com/comment/34492129
downvote count: 0
has body: You will have to alter the generated glue class (ScriptC_mono) and it's base (ScriptC) at the very least. &lt;ExtremeHax&gt; The .bc file is read and passed down to RenderScript's internals. So far as I can tell, that is done inside ScriptC.internalCreate(), which is wired to read a raw resource. You need it to instead read your file from a location you control. Possibly you will only need to modify internalCreate() but there will probably be complications requiring broader editing. Once you implement RuntimeScriptC, you should modify ScriptC_mono to inherit from that base class instead of ScriptC. As you noted, you will be very limited in the changes you can make to the rs code since you cannot modify the glue class at runtime. For example, you could not change the signature of a kernel. However you could take this hack a bit further: if you forgo the glue class, it is possible to make whatever changes you want. Kernels are invoked in the glue class by index rather than by name, and type/element checks are done inside the glue class. Thus even if you changed the kernel's signature, so long as you knew its index and the types of its in and out allocations, you could still invoke it by using forEach() directly. public class ScriptC_mono extends ScriptC { //... public void forEach_root(Allocation ain, Allocation aout) { // check ain if (!ain.getType().getElement().isCompatible(__U8_4)) { throw new RSRuntimeException("Type mismatch with U8_4!"); } // check aout if (!aout.getType().getElement().isCompatible(__U8_4)) { throw new RSRuntimeException("Type mismatch with U8_4!"); // Verify dimensions Type tIn = ain.getType(); Type tOut = aout.getType(); if ((tIn.getCount() != tOut.getCount()) || (tIn.getX() != tOut.getX()) || (tIn.getY() != tOut.getY()) || (tIn.getZ() != tOut.getZ()) || (tIn.hasFaces() != tOut.hasFaces()) || (tIn.hasMipmaps() != tOut.hasMipmaps())) { throw new RSRuntimeException("Dimension mismatch between input and output parameters!"); } forEach(mExportFor…
accepted answer of: http://stackoverflow.com/q/22636681
answers question: http://stackoverflow.com/q/22636681
has comment: http://stackoverflow.com/comment/34496884
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34536297
has comment: http://stackoverflow.com/comment/34492743
has comment: http://stackoverflow.com/comment/34492461
type: Answer
has comment: http://stackoverflow.com/comment/34559991

http://stackoverflow.com/q/22513509
has answer: http://stackoverflow.com/a/22513675
accepted answer: http://stackoverflow.com/a/22513675
favorite count: 0
has answer: http://stackoverflow.com/a/22513788
upvote count: 0
tagged with: collections
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/34255355
tagged with: java
downvote count: 1
possible better answer: http://stackoverflow.com/a/22513788
type: Question
has body: I'm currently faced with this problem: I have a LinkedList that contains several LinkedLists containing longs, so: LinkedList&lt;LinkedList&lt;Long&gt;&gt;() overalllList = new LinkedList&lt;LinkedList&lt;Long&gt;(); After some code runs, the overall List gets filled with lists of longs of varying sizes. What I need to do is order the overallList so that it contains the lists of longs from smallest to largest. I hope that makes sense. So to clarify, I need this: OverallList: LinkedList&lt;Long&gt; (size 2) - first LinkedList&lt;Long&gt; (size 245) - second LinkedList&lt;Long&gt; (size 1000) - third ...etc I'm not sure if using Collections would do this, or if I need to look at a custom comparator. Any input or advice would be appreciated. Thanks
score: -1
has title: Java sort LinkedList of LinkedLists into size order
tagged with: comparator
answer count: 2
has comment: http://stackoverflow.com/comment/34255232

http://stackoverflow.com/q/22541457
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34305073
answer count: 0
tagged with: java
has body: I'm implementing a basic Client-Server program in java. I read that 0 as the port number can be used to in the ServerSocket constructor to listen on any port. But my following code throws exceptions. Main Function for Server public static void main(String[] args) throws IOException { // TODO code application logic here ServerSocket s=new ServerSocket(0); Socket socket=s.accept(); } Main Function for client public static void main(String[] args) throws UnknownHostException, IOException { Socket socket=new Socket("127.0.0.1",1024); System.out.println(socket.getPort()); }
type: Question
tagged with: client-server
has comment: http://stackoverflow.com/comment/34305069
has comment: http://stackoverflow.com/comment/34305077
score: 0
has title: How to make the server listen on any port?

http://stackoverflow.com/comment/34345350
has text: what is the purpose of writing out.write(buf) to the outputstream of the socket?thats what i asked.out hold the output stream of a socket which has inetadress google.com .what is the purpose of write to the output stream of such a socket ? thats what i asked for and i got everything except that .I need an explanation for that please
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22564428

http://stackoverflow.com/q/22558127
score: 0
answer count: 1
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22577758
tagged with: java
tagged with: code-navigation
tagged with: search
type: Question
has title: find all public variables in a netbeans project?
has body: I'm debugging a project with many classes and forms and would be very useful for me to find all the public variables used in the project. Is there any way to do this in Netbeans? Neither I have been able to find a pluging for Netbeans to achieve this. Thanks a lot.

http://stackoverflow.com/comment/34293517
comment on: http://stackoverflow.com/a/22527183
score: 0
type: AnswerComment
type: Comment
has text: @RickRegan I read the question as asking how it works, rather than whether it works. Note that the 15 decimal digit observation depends on normal precision. Subnormal numbers with fewer than 15 significant digits may not round-trip exactly.

http://stackoverflow.com/comment/34442196
has text: Go through this for a clear understanding on regex patterns.http://www.vogella.com/tutorials/JavaRegularExpressions/article.html
comment on: http://stackoverflow.com/a/22615994
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34352697
type: Comment
type: QuestionComment
has text: at the beginning of your loop you need to add `p[i] = new Player();`
comment on: http://stackoverflow.com/q/22568636
score: 0

http://stackoverflow.com/comment/34442441
type: AnswerComment
score: 0
has text: @ChrisCrossman There *has* to be some `ActionListener` attached to the button. And this is the "minimal" way of attaching an `ActionListener` to the button and still retaining the information about which button was clicked. To put it that way: It's up to you to only call `controller.doSomethingWith(x,y)` in the `clickedButton` method. Or is your question aiming at injecting the ActionListeners from the outside? MVC is slightly controversial in this point (What is a controller, anyway?). For me, each `ActionListener` already *is* a little controller. Let's see what others say.
type: Comment
comment on: http://stackoverflow.com/a/22618377

http://stackoverflow.com/q/22550088
score: -1
has title: startActivity(intent) on Android not working
has body: So I am trying to pass some info with serialization, but for some reason it is not working, I wrote a couple of Log.e() for testing, and according to the LogCat it says it is not getting passed the startactivity(intent). Here is my code public class MainActivity extends Activity { FileManager file = new FileManager(); FileInputStream fileInput; FileOutputStream fileOutput; SortedArrayList&lt;Contact&gt; contactList = new SortedArrayList&lt;Contact&gt;(); ArrayList&lt;Contact&gt; theList =new ArrayList&lt;Contact&gt;(); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { fileInput = openFileInput("contacts.txt"); Log.e("FILE INPUT","FOUND!!"); contactList = file.read(fileInput,getApplicationContext()); Log.e("_____",contactList.toString()); } catch (Exception e) { Log.e("Error","ERROR CREATING FILE"); } if(contactList.size() != 0){ ListView lv =(ListView)findViewById(R.id.contactList); for(int i=0;i&lt;contactList.size();i++){ theList.add(contactList.get(i)); } ArrayAdapter&lt;Contact&gt; adapter = new MyListAdapter(); lv.setAdapter(adapter); clickOnContact(); } // Create The Adapter with passing ArrayList as 3rd parameter //OrderAdapter arrayAdapter = new OrderAdapter(this, R.layout.list_view, contactListNameView, contactListLastNameView, contactListCellphoneView); //Set The Adapter //lv.setAdapter(arrayAdapter); } private void clickOnContact() { ListView list = (ListView) findViewById(R.id.contactList); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View viewClicked, int pos, long id) { Contact Contact = theList.get(pos); Log.e("contact: ",Contact.getFirstName()); try{ Intent intent = new Intent(MainActivity.this, ShowContactActivity.class); Log.e("pass ","1"); intent.putExtra("Contact",Contact); Log.e("pass ","2"); startActivity(intent); } catch (Exception e){ Log.e("didnt","pass catch"); } } }); } p…
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
has answer: http://stackoverflow.com/a/22550160
has comment: http://stackoverflow.com/comment/34320545
tagged with: java
downvote count: 2
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34320998

http://stackoverflow.com/comment/34408980
type: AnswerComment
type: Comment
has text: So I have to create (getters/setters) for all the variables?
comment on: http://stackoverflow.com/a/22599407
score: 0

http://stackoverflow.com/comment/34436285
type: Comment
type: AnswerComment
has text: Interesting point - how can i create pages for listview? how can I limit the number of items and each page? and how they scrolling between the pages been done?
comment on: http://stackoverflow.com/a/22613878
score: 0

http://stackoverflow.com/a/22635660
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22629431
answers question: http://stackoverflow.com/q/22629431
has comment: http://stackoverflow.com/comment/34486093
has comment: http://stackoverflow.com/comment/34476192
type: Answer
has body: Solution 3: Extend SwingWorker, class MessageWorker extends SwingWorker&lt;List&lt;DataHolder&gt;, DataHolder&gt; {} In your implementation of doInBackground(), publish() intermediate results as they become available. In your implementation of process(), update the view component's model. Conveniently, SwingWorker will coalesce publish() invocations at a sustainable pace. Profile your application to verify. More examples may be found here.
has comment: http://stackoverflow.com/comment/34519334
score: 2
downvote count: 0

http://stackoverflow.com/comment/34302178
type: AnswerComment
comment on: http://stackoverflow.com/a/22539709
type: Comment
has text: Obviously, yeah. Except in the very top-top-top-level main, where you might want to show a generic message for a release version of your program, which you don't want to crash.
score: 0

http://stackoverflow.com/a/22604894
answers question: http://stackoverflow.com/q/22604825
type: Answer
score: 0
has body: The first method is Recursive. This means that the method makes calls to itself and the idea behind this is that recursion (when used appropriately) can yield extremely clean code, much like your factorial method. Formatted correctly is should look more like: private int factorial(int n) { if(n==1) return n; return fact(n-1) * n; } So that's a factorial calculator in two lines, which is extremely clean and short. The problem is that you can run into problems for large values of n. Namely, the infamous StackOverflowError. The second method is what is known as iterative. Iterative methods usually involve some form of a loop, and are the other option to recursion. The advantage is that they make quite readable and easy to follow code, even if it is somewhat more verbose and lengthy. This code is more robust and won't fall over for large values of n, unless n! &gt; Integer.MAX_VALUE.

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/22585596
tags question: http://stackoverflow.com/q/22645067
tags question: http://stackoverflow.com/q/22630207
tags question: http://stackoverflow.com/q/22501554
tags question: http://stackoverflow.com/q/22531652
type: Tag
tags question: http://stackoverflow.com/q/22584090
tags question: http://stackoverflow.com/q/22541986

http://stackoverflow.com/comment/34276298
has text: It's kind of safe to think, most of the time, that eclipse works correctly
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22525358
type: Comment

http://stackoverflow.com/q/22546537
tagged with: string
has title: StringIndesOutOfBoundsException: length=0; index=2 error in Java
favorite count: 0
upvote count: 3
has body: This is my code: String bericht = ""; while (cur.moveToNext()) { if (cur.getString(cur.getColumnIndex("address")).equals("SAH")) { bericht += cur.getString(cur.getColumnIndex("body")); adress = getadress(bericht); //basically cutting a part out datum = getdatum(bericht); //same afspraken[x][0] = datum; afspraken[x][1] = adress; x++; } cur.moveToNext(); bericht = ""; } It works without the bericht = ""; at the end but I want to reset the string with every loop! I tried: String bericht; bericht = cur.getString(cur.getColumnIndex("body")); Error message: E/AndroidRuntime(3171): java.lang.StringIndexOutOfBoundsException: length=0; index=2
has comment: http://stackoverflow.com/comment/34314551
downvote count: 1
has comment: http://stackoverflow.com/comment/34314633
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22546592
has comment: http://stackoverflow.com/comment/34314416
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22546826

http://stackoverflow.com/q/22491978
tagged with: applet
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34240885
answer count: 0
has title: Eclipse-applet into html page
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34226610
type: Question
has body: I am trying to import my applet into a html page within eclipse, when I am try to run the html page there is an error that says "incompatible magic value 218787937 in class file defaultPackage/StreamingApplet" I have tried to resolve this myself through clearing the internet files is which a few people had suggest but this did not help. any ideas Thanks?
score: 0
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/22509371
downvote count: 0
has comment: http://stackoverflow.com/comment/34247599
possible better answer: http://stackoverflow.com/a/22509548
tagged with: android
favorite count: 0
has title: Android why onReceive() does not work
has comment: http://stackoverflow.com/comment/34247461
tagged with: sms
has answer: http://stackoverflow.com/a/22509487
accepted answer: http://stackoverflow.com/a/22509487
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22509548
score: 1
tagged with: java
has body: I have a class for receiving sms: package com.example.app; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.telephony.gsm.SmsManager; import android.telephony.gsm.SmsMessage; import android.util.Log; import android.widget.TextView; import android.widget.Toast; public class SmsReceiver extends BroadcastReceiver { // Get the object of SmsManager final SmsManager sms = SmsManager.getDefault(); public void onReceive(Context context, Intent intent) { Log.i("SmsReceiver", "senderNum: "); // Retrieves a map of extended data from the intent. final Bundle bundle = intent.getExtras(); try { if (bundle != null) { final Object[] pdusObj = (Object[]) bundle.get("pdus"); for (int i = 0; i < pdusObj.length; i++) { SmsMessage currentMessage = SmsMessage.createFromPdu((byte[]) pdusObj[i]); String phoneNumber = currentMessage.getDisplayOriginatingAddress(); String senderNum = phoneNumber; String message = currentMessage.getDisplayMessageBody(); Log.i("SmsReceiver", "senderNum: "+ senderNum + "; message: " + message); // Show Alert int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, "senderNum: "+ senderNum + ", message: " + message, duration); toast.show(); } // end for loop } // bundle is null } catch (Exception e) { Log.e("SmsReceiver", "Exception smsReceiver" +e); } } } MainActivity: package com.example.app; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.util.Log; 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.TextView; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i("SmsReceiver", "sender…
has comment: http://stackoverflow.com/comment/34247481
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34247488

http://stackoverflow.com/comment/34278029
type: Comment
type: QuestionComment
has text: Please show the stack trace
score: 0
comment on: http://stackoverflow.com/q/22526533

http://stackoverflow.com/q/22566340
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/22566378
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22566400
accepted answer: http://stackoverflow.com/a/22566400
tagged with: loops
has title: ArrayList not adding objects?
type: Question
has body: I have a piece of code: public void setBoardMemberPosition() { int[] position = null; do{ positionX = RandomNumberGenerator.generateRandomNumber(Board.DIMENSION); positionY = RandomNumberGenerator.generateRandomNumber(Board.DIMENSION); position = new int[] { positionX, positionY }; } while(checkIfPositionIsOccupied(position)); board.setElementAt(positionX, positionY, name); storedMembers.add(position); } Can someone explain to me why the elements are not being added to the list, where: private ArrayList&lt;int[]&gt; storedMembers = new ArrayList&lt;int[]&gt;();is a Class variable and:checkIfPositionIsOccupied(position) returns true/false if (storedMembers.contains(position)) i have a feeling its something to do with the do while, ive debugged it with no luck.
has answer: http://stackoverflow.com/a/22566378
tagged with: arraylist
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/34369848
type: Comment
comment on: http://stackoverflow.com/a/22577769
score: 0
type: AnswerComment
has text: At the time of writing the commentary I wasn't understanding this. :)

http://stackoverflow.com/comment/34417598
score: 0
has text: Hint: the python syntax makes use of named capture groups. If you _understand_ what the python regex does, you should be able to translate it!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22604709

http://stackoverflow.com/q/22499271
has title: How to conditionally add(or modify) ContextConfigLocation to web.xml?
favorite count: 0
has answer: http://stackoverflow.com/a/22915859
tagged with: web.xml
tagged with: spring
possible better answer: http://stackoverflow.com/a/22915859
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: web-applications
has answer: http://stackoverflow.com/a/22509107
upvote count: 1
type: Question
tagged with: jakarta-ee
answer count: 2
has body: I need to modify the web.xml in my project after checking some parameters. My contextConfigLocation parameter in web.xml is as follows: contextConfigLocation classpath:*/test-spring-config.xml classpath:*/someContext.xml classpath:applicationContext.xml classpath:databaseContext.xml Now I need to add classpath:securityContext.xml to my contextConfigLocation in web.xml upon checking some condition before my application is loaded in tomcat. I've tried doing this in my applicationInitializer class which implements ServletContextListener as follows(part of the code is shown): public class ApplicationInitializer implements ServletContextListener { public void contextInitialized(ServletContextEvent event) { ServletContext sc = event.getServletContext(); if(someConditionIsTrue){ XmlWebApplicationContext appContext = new XmlWebApplicationContext(); appContext.setConfigLocation("classpath:securityContext.xml"); appContext.setServletContext(sc); appContext.refresh(); sc.setAttribute("org.springframework.web.context.WebApplicationContext.ROOT",appContext); } But this is not working because I'm again loading the context in my web.xml as org.springframework.web.context.ContextLoaderListener Can somebody suggest how to deal with this problem? Any suggestions are appreciated.
accepted answer: http://stackoverflow.com/a/22509107
downvote count: 0

http://stackoverflow.com/q/22595554
has answer: http://stackoverflow.com/a/22595564
tagged with: loops
answer count: 1
has title: Why does this while loop only run once?
has body: I'm having issues with all of my loops only running one time through and then quitting out and I'm very confused. Here's an example of the while loop that only runs once: public String getAstWhile(int ast) { int s = 0; int n = ast; while (s &lt; n) { s++; return "*"; } return ""; }
tagged with: java
downvote count: 5
accepted answer: http://stackoverflow.com/a/22595564
type: AnsweredQuestion
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/34401188
favorite count: 0
tagged with: while-loop
type: Question

http://stackoverflow.com/comment/34378971
type: QuestionComment
comment on: http://stackoverflow.com/q/22583057
score: 0
has text: You mean `R` cannot be resolved? If so try clean and build project
type: Comment

http://stackoverflow.com/a/22628497
score: 0
has comment: http://stackoverflow.com/comment/34463052
answers question: http://stackoverflow.com/q/22593665
has comment: http://stackoverflow.com/comment/34460554
has body: Wrap these two field as required field under an optional field.
type: Answer

http://stackoverflow.com/comment/34366437
type: Comment
comment on: http://stackoverflow.com/a/22576386
score: 0
type: AnswerComment
has text: Please make sure posted code actually compiles. That doesn't, even with imports.

swagger-ui
tags question: http://stackoverflow.com/q/22593383
tag name: swagger-ui
type: Tag

http://stackoverflow.com/comment/34776207
comment on: http://stackoverflow.com/q/22599905
has text: see this http://meta.stackexchange.com/questions/135493/informing-new-users-of-how-to-accept-answers
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34279208
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22526758
has text: its coming up saying 03-20 08:19:46.698: E/OpenGLRenderer(26027): GL_INVALID_OPERATION
type: Comment

http://stackoverflow.com/comment/34400108
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22594296
has text: I have one more problem with this. I have initialized a new array of textfields - JTextField[] allField = new JTextField [10]; and in constructor I have initialized textfields in this array - for(int a = 0;a < 10;a++){ allField[a] = new JTextField(String.valueOf(0)); allField[a].setBounds(189 + a * 50, 48, 39, 23); } - but it for some reason does not display my textfields when I run the GUI. Why is that? How can I fix it? I am really sorry for messy code display, I don't know how to display it properly in comments.
score: 0

http://stackoverflow.com/a/22592467
score: 1
accepted answer of: http://stackoverflow.com/q/22584737
type: AcceptedAnswer
downvote count: 0
has body: As @DaoWen said, since you are using threads you don't have to bother with an MQ. BlockingQueue and ConcurrentLinkedQueue should be fine.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22584737

http://stackoverflow.com/q/22621841
has title: How to test whether a tweet is the initiating tweet, instead of retweet in twitter4j?
tagged with: java
tagged with: twitter
tagged with: status
accepted answer: http://stackoverflow.com/a/24844906
type: Question
tagged with: twitter4j
score: 0
answer count: 1
has body: I want to get whether a tweet is the initiating tweet, instead of re-tweet. How to know this in twitter4j after I get a "Status" object? Will status.getInReplyToUserId() return null? Thanks.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24844906

http://stackoverflow.com/a/22615739
answers question: http://stackoverflow.com/q/22533313
upvote count: 1
has body: Assuming you're running Hazelcast/VoltDB on big(ger) servers with plenty of memory and cores, the Garbage First (G1) garbage collector in new versions of Java could largely ameliorate your concern. http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/22587721
has body: Android HttpURLConnection is doing some magic transparently for you like caching and gzip-handling. So if you don't set Accept-Encoding: identity, HUC sets Accept-Encoding: gzip,deflate. And since nginx is an intelligent nice thing, it might deliver your response gzip encoded. You didn't tell HUC to give the response as gzipped back to you, but it decompresses that response for you and drops the header since this was misleading. You can see this as a powerful feature to save bandwidth and radio power consumption without Android programmers having to deal with gzip or deflate encoding. If you just stream the response to your JSON-parser, you will get the uncompressed data in the correct size, though without knowing size in advance. You could verify what I said by running wireshark or tcpdump server-side, or if you have a rooted Android device, there are ways to do this client-side as well.
has comment: http://stackoverflow.com/comment/34393792
upvote count: 9
accepted answer of: http://stackoverflow.com/q/22586614
answers question: http://stackoverflow.com/q/22586614
type: AcceptedAnswer
downvote count: 0
score: 9
type: Answer

http://stackoverflow.com/comment/34309729
score: 2
comment on: http://stackoverflow.com/a/22529222
type: AnswerComment
has text: You could apply the option conditionally via a maven profile keyed on the Java version…?
type: Comment

http://stackoverflow.com/comment/34489143
score: 0
type: QuestionComment
type: Comment
has text: @staticx True. I was thinking there was some K&R style variable declaration going on there.
comment on: http://stackoverflow.com/q/22644474

http://stackoverflow.com/a/22596692
upvote count: 1
has body: There are few ways to achieve this functionality, it depends upon your level of expertise and the kind of data you want to get. I will give you few basic steps but you need to implement something and try it out. steps for you client side coding; i.e. in your java class. 1. Create HttpClient 2. Create HttpGet or HttpPost and initialize it with the get or post URL. (again get or post is your choice depending upon kind of data) 3. execute your get/post object and you will have the response as object of HttpResponse 4. you can then use concepts of buffer reader, string builder, input stream, etc to fetch desired data. steps for your server side code i.e. usually php file on server -- you can use XML, JSON or any other already defined approach to fetch the data for that you will have to correctly encode JSON and then decode it on your client side code with JSONparser classes similar is the concept with XML -- easier way if you are a beginner, just try to return one row at a time from server using mysql query and using 'echo' in php. use post method and pass different parameters to server, write different kind of mysql queries to get desired result. once you get along with them you can move on to the concepts of JSON. if you never done JSON before and will try to do it directly it might look bit confusing. also please mention specific queries while posting question as this is very wide topic and can not be answered in one post. Edit: don't forget to specify the permission to use internet in your manifest file and also use AsynkTask and threading to perform time consuming tasks Edit 2 according to your comment you want to access one column value for certain user, is it right? for eg you have 5 columns; id, name, surname, password, amount and you only want to retrieve the amount for certain user. if this is what you are looking for then you need to write a mysql query such a way that it only returns column value for particular row (this needs to be done on server side in yo…
downvote count: 0
has comment: http://stackoverflow.com/comment/34404141
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34535555
answers question: http://stackoverflow.com/q/22596499
has comment: http://stackoverflow.com/comment/34405948

http://stackoverflow.com/comment/34256273
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22514070
has text: If you understand you can't do it server-side, then why are you tag spamming? And this sort of "your browser is unsupported" is *very* bad practice. Unless you're just talking about detecting and warning about ancient versions of browsers, it causes more problems than it ever solves.
score: 0

http://stackoverflow.com/a/22568525
score: 0
has comment: http://stackoverflow.com/comment/34353730
type: Answer
has comment: http://stackoverflow.com/comment/34353959
has comment: http://stackoverflow.com/comment/34353921
has comment: http://stackoverflow.com/comment/34356671
answers question: http://stackoverflow.com/q/22568027
has comment: http://stackoverflow.com/comment/34356292
has comment: http://stackoverflow.com/comment/34354068
has comment: http://stackoverflow.com/comment/34356617
has comment: http://stackoverflow.com/comment/34356729
has comment: http://stackoverflow.com/comment/34353809
has body: Just do in this way. Check whether row is selected or not. public static void main(String[] args) { DiscountGUIView dgv = new DiscountGUIView(); setDiscountNames("Fixed", dgv.getjComboBox2()); ArrayList&lt;FlexiBand&gt; flexiband = null; if (dgv.getjTable2().getSelectedRow != -1) { flexiband = getFlexiBands(dgv.getjTable2(), dgv.getjTable5()); } if (flexiband !=null) { // user selected a row, do what ever you want to do } else { // nothing is selected // skip other operations } }
has comment: http://stackoverflow.com/comment/34356334

http://stackoverflow.com/q/22598186
type: Question
has body: I'm trying to migrate my web-app from XML-based configuration to Java-based one. I have properties files under "\src\main\resources\" directory. In XML configuration I had such bean: classpath:test.properties And it worked just fine. Now I switched to Java config so I have: @Configuration @ComponentScan(basePackages = {"blah.blah.blah.*"}) @Import({MVCConfig.class, PersistenceConfig.class, SecurityConfig.class}) @PropertySource("classpath:test.properties") public class TestConfig { } But unfortunately I'm getting exception: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:155) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:100) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:319) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:212) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.Pa…
has answer: http://stackoverflow.com/a/22598544
accepted answer: http://stackoverflow.com/a/22598544
score: 0
tagged with: junit
answer count: 1
has comment: http://stackoverflow.com/comment/34406174
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34406179
tagged with: spring-mvc-test
tagged with: java
has title: Spring MVC Java-based configuration can't see class-path properties file

http://stackoverflow.com/comment/34358795
type: Comment
has text: You haven't quite convinced me that my statements "make no sense at all" because I'm pretty sure they do, but your comments have encouraged me to review my asymptotic complexities again.
comment on: http://stackoverflow.com/a/22571611
score: 0
type: AnswerComment

http://stackoverflow.com/q/22518300
upvote count: 1
tagged with: android
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: Libgdx Quiz- Using SQLite Database?
tagged with: libgdx
tagged with: java
has body: I have been learning Android development and using the Libgdx framework for over a month now and want to create a test app. The app i want to create is a quiz and im stuck on the situation on how i am going to store all the questions, answers. Being a web developer for many years i of course thought of a database but libgdx doesn't have much support for sqlite which leaves me stuck on how to achieve the storing without using a database. Does anyway know any way to use sqlite with libgdx or how i can achieve this another way, i would appreciate the help, thank you.
type: Question
has answer: http://stackoverflow.com/a/22518402
score: 0

http://stackoverflow.com/q/22538433
type: Question
has body: He all, I am trying to calculate the first- and last-day of Week, Month and Year. For Month and Year it Works fine but week is wrong: public Date[] calcDateRange(Calendar c, int day) { Date[] dr = new Date[2]; // setMin c.set(day, c.getActualMinimum(day)); dr[0] = c.getTime(); // setMax c.set(day, c.getActualMaximum(day)); dr[1] = c.getTime(); return dr; } public void print() { SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy"); Calendar cStart = Calendar.getInstance(Locale.GERMANY); cStart.setFirstDayOfWeek(Calendar.MONDAY); System.out.println("startdate: " + sdf.format(cStart.getTime())); Date[] minMaxD = calcDateRange(cStart, Calendar.DAY_OF_WEEK); System.out.println("start_of_week:\t" + sdf.format(minMaxD[0]) + "\nend_of_week:\t" + sdf.format(minMaxD[1])); minMaxD = calcDateRange(cStart, Calendar.DAY_OF_MONTH); System.out.println("start_of_month:\t" + sdf.format(minMaxD[0]) + "\nend_of_month:\t" + sdf.format(minMaxD[1])); minMaxD = calcDateRange(cStart, Calendar.DAY_OF_YEAR); System.out.println("start_of_year:\t" + sdf.format(minMaxD[0]) + "\nend_of_year:\t" + sdf.format(minMaxD[1])); } Can someone help me to find my mistakes? What is the best way to calculate the dates? Output: startdate: 20.03.2014 start_of_week: 23.03.2014 &lt;--- wrong, should be '17.03.2014' end_of_week: 22.03.2014 &lt;--- wrong, should be '23.03.2014' start_of_month: 01.03.2014 end_of_month: 31.03.2014 start_of_year: 01.01.2014 end_of_year: 31.12.2014 Thank you in advance. //edit Currently I use the following methode, but im not realy happy with it: public Date[] calcDateRange(Calendar c, int day) { int fdow = c.getFirstDayOfWeek(); c.setFirstDayOfWeek(Calendar.SUNDAY); Date[] dr = new Date[2]; // setMin c.set(day, c.getActualMinimum(day)); //..setSecondsMinutes if (day == Calendar.DAY_OF_WEEK) c.add(day, 1); // German Week correction dr[0] = c.getTime(); // setMax c.set(day, c.getActualMaximum(day)); //..setSecondsMinutes if (day == Calendar.DAY_OF_WEEK) c.add(day, 1); // German We…
has answer: http://stackoverflow.com/a/22538532
tagged with: date
accepted answer: http://stackoverflow.com/a/22538532
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/22540382
has title: best way to calculate the first- and last-day of Week, Month and Year
has answer: http://stackoverflow.com/a/22540382
favorite count: 0
has answer: http://stackoverflow.com/a/22538747
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: calendar

http://stackoverflow.com/a/22556743
score: 1
has body: The exception says you are trying to load an lazy collection which of out of session. Meaning you need to initialize the collection object before you use. The initialization should happen either in entity setter method or in DAO class. Initializing in setter method of an entity is not recommended usually since it couples your entity with hibernate framework. So best place is DAO layer. But here I have mentioned just for your reference try this in your code public void setInfo(IndentityInfo info) { Hibernate.initialize(info); this.info = info; } Hope this is helpful!
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22555436
answers question: http://stackoverflow.com/q/22555436
downvote count: 0

http://stackoverflow.com/comment/123530645
type: Comment
comment on: http://stackoverflow.com/a/22561903
type: AnswerComment
has text: @Ralph why do we need the process method here, can't processAsync take care even if there is only one notification ?
score: 0

http://stackoverflow.com/comment/34429055
has text: But like this the start button is not showing because I have removed it when I started the game
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22611241

http://stackoverflow.com/comment/34406389
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22597822
has text: Well in those cases the parentheses aren't 'unnecessary'.
type: AnswerComment

http://stackoverflow.com/a/24583324
answers question: http://stackoverflow.com/q/22642230
has body: Step 1: Windows -> Preference -> Java -> Installed JRE -> Edit -> Directory (Specify the JDK directory (and not JRE)) Step 2: Click "Restore Defaults" Step 3: Click OK
upvote count: 5
score: 5
downvote count: 0
type: Answer

http://stackoverflow.com/a/22558453
has comment: http://stackoverflow.com/comment/34360771
has body: You can add a FieldUpdater for your hourColumn. It has update() method which fires when value of a cell in this column changes. For example: hourColumn.setFieldUpdater(new FieldUpdater&lt;EffortCost, String&gt;() { @Override public void update(int index, EffortCost object, String value) { // do something when value changes // return NumberFormat.getFormat("0.00").format(object.getHours()); } }); every time when you enter numbers it will format and update.
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34335980
accepted answer of: http://stackoverflow.com/q/22541029
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22541029

http://stackoverflow.com/comment/34348138
type: AnswerComment
type: Comment
has text: Yeah, there are talking about Dijkstra and I was specifically told not to use Dijkstra. I know the teachers are weired but this is what I'm asked. If I don't use BFS he won't even look at my project
score: 0
comment on: http://stackoverflow.com/a/22565057

http://stackoverflow.com/q/22597316
answer count: 1
has answer: http://stackoverflow.com/a/22597714
has body: I have this VO public class myVO { private final String latitude; private final String longtitude; private final String meterRadius; public myVO(String latitude, String longtitude, String meterRadius) { this.latitude = latitude; this.longtitude = longtitude; this.meterRadius = meterRadius; } public String getLatitude() { return latitude; } public String getLongtitude() { return longtitude; } public String getMeterRadius() { return meterRadius; } } And rest service @Path("/listrs") @Produces(MediaType.APPLICATION_JSON) public class MyResource { Logger logger = LoggerFactory.getLogger(MyResource.class); private final AtomicLong counter; public MyResource(String template, String defaultName) { //this.template = template; //this.defaultName = defaultName; this.counter = new AtomicLong(); } @GET @Timed public List<ResultVO> getMyList() { List<ResultVO> list = new ArrayList<>(); list.add(new ResultVO(counter.incrementAndGet(), "dummy text")); list.add(new ResultVO(counter.incrementAndGet(), "dummy text1")); return list; } @POST @Timed @Consumes(MediaType.APPLICATION_JSON) public List<ResultVO> getListByLoc(myVO loc) { logger.debug(loc.toString()); return getMyList(); } } Testing it using curl -i -X POST -d '{"latitude": "2.3433", "longtitude": "23.2233", "meterRadius":"5"}' http://localhost:8080/listrs Result I'm getting: curl: (6) Could not resolve host: 2.3433, curl: (6) Could not resolve host: longtitude curl: (6) Could not resolve host: 23.2233, curl: (3) [globbing] unmatched close brace/bracket at pos 14 HTTP/1.1 415 Unsupported Media Type Date: Sun, 23 Mar 2014 21:23:16 GMT Content-Type: text/html;charset=ISO-8859-1 Cache-Control: must-revalidate,no-cache,no-store Content-Length: 1350 Error 415 Unsupported Media Type HTTP ERROR 415 Problem accessing /listrs. Reason: Unsupported Media Type Any idea what I am doing wrong? Im using dropwizard but I dont think it is relevant.
favorite count: 0
has comment: http://stackoverflow.com/comment/34404574
tagged with: rest
tagged with: curl
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22597714
has title: Unsupported media type for REST POST
downvote count: 1
type: Question
score: 14
tagged with: java
upvote count: 15
tagged with: jersey
tagged with: dropwizard

http://stackoverflow.com/a/22559111
score: 8
answers question: http://stackoverflow.com/q/22550761
accepted answer of: http://stackoverflow.com/q/22550761
type: AcceptedAnswer
downvote count: 0
has body: I have same problem too and i contacted my provider which tracked trace to www.mvnrepository.com (repository for dependencies) and trace will end on ec2-79-125-0-137.eu-west-1.compute.amazonaws.com [79.125.0.137] Problem is on amazonaws.com. Here is trace route: 1 &lt; 1 ms &lt; 1 ms &lt; 1 ms private.rionet.cz [172.25.20.1] 2 10 ms 10 ms 9 ms private.rionet.cz [172.28.0.1] 3 11 ms 10 ms 10 ms rio-bb-jsw01-vlan-4050-94-74-192-164.net.rionet. cz [94.74.192.164] 4 11 ms 10 ms 10 ms sitK9-bb-jsw01-xe-0-1-2-0-188-175-255-85.net.rio net.cz [188.175.255.85] 5 10 ms 9 ms 10 ms sitK9-bb-jrt01-xe-9-0-0-0-188-175-255-197.net.ri onet.cz [188.175.255.197] 6 68 ms 10 ms 9 ms prag-b3-link.telia.net [213.248.87.97] 7 15 ms 17 ms 17 ms win-bb2-link.telia.net [213.155.131.68] 8 34 ms 34 ms 34 ms hbg-bb2-link.telia.net [62.115.136.30] 9 92 ms 154 ms 47 ms ldn-bb2-link.telia.net [80.91.247.169] 10 65 ms 64 ms 85 ms dln-b1-link.telia.net [213.155.136.121] 11 70 ms 55 ms 64 ms amazon-ic-300342-dln-b1.c.telia.net [80.239.128. 18] 12 65 ms 64 ms 64 ms 178.236.0.126 13 64 ms 71 ms 64 ms 178.236.0.125 14 66 ms 57 ms 57 ms ec2-79-125-0-137.eu-west-1.compute.amazonaws.com [79.125.0.137] 15 * * * Vypršel časový limit žádosti. 16 * * * Vypršel časový limit žádosti. 17 * * * Vypršel časový limit žádosti. 18 * * * Vypršel časový limit žádosti. 19 * * * Vypršel časový limit žádosti. 20 * * * Vypršel časový limit žádosti. 21 * * * Vypršel časový limit žádosti. 22 * * * Vypršel časový limit žádosti. 23 * * * Vypršel časový limit žádosti. 24 * * * Vypršel časový limit žádosti. 25 * * * Vypršel časový limit žádosti.
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/34344910
has comment: http://stackoverflow.com/comment/34335256

http://stackoverflow.com/comment/34442098
type: Comment
comment on: http://stackoverflow.com/a/22617974
type: AnswerComment
has text: @JorgeAlfaro because I have initialize listview.
score: 0

http://stackoverflow.com/a/22570398
has comment: http://stackoverflow.com/comment/34356410
has comment: http://stackoverflow.com/comment/34361294
score: 1
answers question: http://stackoverflow.com/q/22569892
has comment: http://stackoverflow.com/comment/34356385
upvote count: 1
has comment: http://stackoverflow.com/comment/34356940
has body: Well, I don't know what the goal of the program is, but if you just want it to print it (instead of re-using it in another operaton), why not using the International System for quick notation? That way, you only have to create an if statement with the desired range. (Here's a link to a table with the values : http://ronblond.com/MathGlossary/Division03/International%20System%20of%20Units/PrefixChart.gif) Not only it solves that issue (once again, if you merely want the output, and a non-exact one), but it's also easier on the eye. ---//--- Example (Edit) ---//--- Let's take 2222, thus, 1,10 and 1k. If on a cicle you divide it by a multiple of 10, you can in theory easily convert it. Let's see: // For cicle here with an increasing i. n is how many times you've divided if (i&gt;999 &amp;&amp; i&lt;10000){ // if you have i=2222 i=(i/(n*10)); // in this case, n=100 , thus the integer i = 2 System.out.println(i + "k"); // 2222 is aproximatly 2k } Although, this would only work if you could actually create a way to stop the loop. Something that has only came up to me now.
type: Answer
has comment: http://stackoverflow.com/comment/34357148
has comment: http://stackoverflow.com/comment/34375448
downvote count: 0

http://stackoverflow.com/q/22527854
answer count: 1
favorite count: 0
tagged with: python
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22528259
upvote count: 2
downvote count: 2
type: Question
has title: FRED rest API in python
has body: We are using FRED to convert plain data to RDF/XML format. We have found JAVA code for this online can u provide us with the PYTHON code. JAVA code that I found is : import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; public class TestGet { public static void main(String[] args) { try { Client client = Client.create(); WebResource webResource = client.resource("http://wit.istc.cnr.it/stlab-tools/fred/"); ClientResponse response = webResource.queryParam("text", "He is a good boy").accept("application/rdf+xml").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 from Server .... \n"); System.out.println(output); } catch (Exception e) { e.printStackTrace(); } } }
tagged with: java
accepted answer: http://stackoverflow.com/a/22528259
tagged with: python-2.7
score: 0

http://stackoverflow.com/comment/34221148
has text: @user2864740 can you be more specific because im just a noob and i dont know much about that.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22493562

http://stackoverflow.com/comment/34449400
has text: Can you post an example reproducing the problem you are facing?
comment on: http://stackoverflow.com/q/22622296
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22627063
answers question: http://stackoverflow.com/q/22626049
score: 0
type: AcceptedAnswer
type: Answer
has body: This answer tells you how to convert CSV to an object in java - Java API to make an object from a CSV file Are you uploading the CSV as a file ? Can you use a multipart upload instead (if that makes sense. Multipart let's you consider the file upload as an attachment of sorts. Usually there is meta-data associated with such requests, which can be sent as a separate part) ? CSV has it's own mime type as defined by RFC4180 although I'm unaware if jersey distinguishes it. As long as you read the stream using the right encoding you should be good.
accepted answer of: http://stackoverflow.com/q/22626049

http://stackoverflow.com/a/27323994
answers question: http://stackoverflow.com/q/22573064
has body: I had a silly issue with a .JAR opening. After running "java -jar MyApp.jar", I came to the realization that it was not launching the gui as my preferences file was not in the same path as the .jar file. Adding a check for if(!file)then create new file... the app worked as expected and became easier to port/share.
score: 0
type: Answer

http://stackoverflow.com/a/22488286
answers question: http://stackoverflow.com/q/22488240
has body: Because it should be readLine instead of readline. Please keep in mind that JAVA is case-sensistive. And please use the IDE, it will catch such mistakes even before compilation.
type: Answer
score: 0

http://stackoverflow.com/comment/34444785
type: Comment
type: QuestionComment
has text: IMHO, in a server environment -Xms and -Xmx should be the same. I doubt that's the source of your problem but it'll aid performance. I presume you have no other JVMs or significant processes running. Things to try: take regular thread dumps before problem arises, take Heap Dump before problem, check Tomcat thread pool (should be approx 50 threads per core), set c3p0 connections to <90% threads.
score: 1
comment on: http://stackoverflow.com/q/22563361

joptionpane
tags question: http://stackoverflow.com/q/22620310
tags question: http://stackoverflow.com/q/22515814
tags question: http://stackoverflow.com/q/22584090
tags question: http://stackoverflow.com/q/22576285
type: Tag
tags question: http://stackoverflow.com/q/22604547
tags question: http://stackoverflow.com/q/22622954
tags question: http://stackoverflow.com/q/22506805
tag name: joptionpane

http://stackoverflow.com/q/22490494
type: Question
has comment: http://stackoverflow.com/comment/34216007
has answer: http://stackoverflow.com/a/22492939
tagged with: java
tagged with: eclipse
score: 0
has body: I'm currently running Eclipse Kepler, with the Android Plugin. I recently created a new Android Project, added a few activities and everything seemed fine until I started noticing that Eclipse, everytime I opened an existing .xml file (strings, values, mainactivity, you name it) the progress console showed that Eclipse is loading the "data for Android 4.3". I mean, literally, everytime I open a .xml document. It's quite frustrating because it loads the same package over and over again and it can take some considerable time. The SDK is fully updated, so is Eclipse.
has title: Eclipse loads Android data repeatedly
linked to: http://stackoverflow.com/q/22297573
answer count: 1
accepted answer: http://stackoverflow.com/a/22492939
has comment: http://stackoverflow.com/comment/34215734
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34215960

http://stackoverflow.com/comment/34264089
comment on: http://stackoverflow.com/q/22493680
score: 0
type: Comment
type: QuestionComment
has text: the date is a Date type. didn't do any change.

http://stackoverflow.com/a/22624356
accepted answer of: http://stackoverflow.com/q/22624249
has comment: http://stackoverflow.com/comment/34454567
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22624249
has comment: http://stackoverflow.com/comment/34453430
has comment: http://stackoverflow.com/comment/34454802
type: AcceptedAnswer
downvote count: 0
has body: public void actionPerformed(ActionEvent e) { File file = null; TextStatistics stat = null; if (e.getSource() == openButton) { int returnVal = fc.showOpenDialog(ProcessText.this); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile(); stat = new TextStatistics(file); } } if (e.getSource() == calculate) { log.append(stat.toString()); } } The thing is, when you press the openButton, it creates the new TextStatisics but that's it. It doesn't append the text the the JTextArea. You only do that with the press of calculate. So when openButton is pressed, the local TextStatistics is created, then nothing is don't with it, so it's tossed out. When calculate is pressed, the log tries to append a null TextStatistics. So you can either append the TextStatistics stat to the log inside of the if (e.getSource() == openButton) { or make TextStatistics stats a global class member that will persist between button presses. So when openButton is pressed, TextStatisitcs stat will persist to a calculate button press.

http://stackoverflow.com/a/22497524
downvote count: 0
score: 1
has body: Is there any way to kill this thread which is causing my application to hang??? Quite unlikely. The underlying JVM implementation should know how to react when an external process kills one of it's threads. You'll likely put the VM in an inconsistent state. You already know where the dead lock is. Newer VMs pretty much tell you which threads are deadlocked with each other. Solve the problem at it's source instead of trying to kill the thread. Who is to say that the threads will not deadlock 10 seconds after you kill the locked threads (assuming that even works). I'd recommend a tool like JProfiler if you'd like to take a deeper look at the locking mechanism in your application. You can solve the problem faster. I'm alluding to the Monitor profiling section.
upvote count: 1
answers question: http://stackoverflow.com/q/22497231
type: Answer

http://stackoverflow.com/comment/34462838
type: QuestionComment
comment on: http://stackoverflow.com/q/22611099
has text: exactly! that's what I'm looking for! I do not know what focntion use to send this file to the client i.e assign the file to the output stream
score: 0
type: Comment

http://stackoverflow.com/comment/39008830
comment on: http://stackoverflow.com/a/22575658
type: Comment
has text: @user3449016 code updated. If the file size is big it takes more time to join.
score: 1
type: AnswerComment

http://stackoverflow.com/q/22554530
tagged with: java
linked to: http://stackoverflow.com/q/22414811
tagged with: swing
has comment: http://stackoverflow.com/comment/34327639
type: Question
score: 0
answer count: 1
has title: jpanel implementing button behavior
has comment: http://stackoverflow.com/comment/34328240
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34329455
has answer: http://stackoverflow.com/a/22557528
has body: I want to create a radio button that has more components than the default JRadioButton. I'm wondering what the best method is, should I subclass JRadioButton adding my extra components or is it better to subclass JPanel and add the behavior of a radio button as shown below. ---------JPanel--------------- - Titel (Label) - - RadioButton (JRadioButton) - - Description (label) - ------------------------------ The whole panel should be focusable and should provide feedback when clicked or has focus. Thanks for your help.
has comment: http://stackoverflow.com/comment/34328029

http://stackoverflow.com/a/22569529
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34354596
has comment: http://stackoverflow.com/comment/34354794
has comment: http://stackoverflow.com/comment/34354682
has comment: http://stackoverflow.com/comment/34354747
answers question: http://stackoverflow.com/q/22569040
has comment: http://stackoverflow.com/comment/34359799
has comment: http://stackoverflow.com/comment/34354473
upvote count: 1
has comment: http://stackoverflow.com/comment/34354659
type: Answer
has comment: http://stackoverflow.com/comment/34354433
has comment: http://stackoverflow.com/comment/34354502
has body: To find the real cause of this, you need to dig into the Files.lines() source, which calls the BufferedReader.lines(), which is the following: public Stream&lt;String&gt; lines() { Iterator&lt;String&gt; iter = new Iterator&lt;String&gt;() { String nextLine = null; @Override public boolean hasNext() { if (nextLine != null) { return true; } else { try { nextLine = readLine(); return (nextLine != null); } catch (IOException e) { throw new UncheckedIOException(e); } } } @Override public String next() { if (nextLine != null || hasNext()) { String line = nextLine; nextLine = null; return line; } else { throw new NoSuchElementException(); } } }; return StreamSupport.stream(Spliterators.spliteratorUnknownSize( iter, Spliterator.ORDERED | Spliterator.NONNULL), false); } Here it returns a Stream&lt;String&gt; that is: Of unknown size Ordered Not null Not parallel (the false argument at the end of StreamSupport.stream() And hence I am really unsure of whether it is even subject to be being parallellised, this could be found by digging even further into the source. What I do know is that parallel streams get explicitely provided in the Java APIs. Take for example List, it has a List.stream() and List.parallelStream() method.

http://stackoverflow.com/q/22629378
has comment: http://stackoverflow.com/comment/34462327
has comment: http://stackoverflow.com/comment/34462035
score: 0
has comment: http://stackoverflow.com/comment/34461873
has body: I have one quick question. I'm writing desktop application for generating reports from database and I want to get all tables and columns from database (no results of select queries only tables and columns) to put it in list, where user can select it and use to build own queries. I had written my own code to do this, but it is slow. If you see SQuirreL SQL Client you will know what I means. I know that are some libraries for do this but they are big. I use SELECT query to get all table names, and then use SELECT query to get columns from that table name. My code: public List&lt;String&gt; getTables() { Connection conn = null; Statement stmt = null; ResultSet rs = null; List&lt;String&gt; tables = new ArrayList&lt;String&gt;(); try { conn = getConnection(); stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT name FROM sys.Tables"); while (rs.next()) { tables.add(rs.getString(1)); } } catch (SQLException sqle) { sqle.printStackTrace(); } finally { DbUtils.closeQuietly(conn, stmt, rs); } return tables; } public List&lt;String&gt; getColumns(String table) { Connection conn = null; Statement smt = null; ResultSet rs = null; // DatabaseMetaData dm = null; List&lt;String&gt; colList = new ArrayList&lt;String&gt;(); try { conn = getConnection(); // dm = conn.getMetaData(); smt = conn.createStatement(); rs = smt.executeQuery("SELECT COLUMN_NAME FROM " + dbName + ".INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" + table + "' AND TABLE_SCHEMA = 'dbo' ORDER BY 1"); // rs = dm.getPrimaryKeys(null, null, tName); while (rs.next()) { colList.add(rs.getString(1)); } } catch (SQLException e) { e.printStackTrace(); } finally { DbUtils.closeQuietly(conn, smt, rs); } return colList; } it all goes to Map&lt;String, List&lt;String&gt;&gt;
has comment: http://stackoverflow.com/comment/34462204
has comment: http://stackoverflow.com/comment/34463012
has title: Java cache database tables and columns
has answer: http://stackoverflow.com/a/22630561
type: AnsweredQuestion
tagged with: java
tagged with: caching
type: Question
accepted answer: http://stackoverflow.com/a/22630561
has comment: http://stackoverflow.com/comment/34461975
answer count: 1
tagged with: database
has comment: http://stackoverflow.com/comment/34463174
has comment: http://stackoverflow.com/comment/34463054

http://stackoverflow.com/a/22604281
type: Answer
answers question: http://stackoverflow.com/q/22569180
has body: SolrQuery.toString method gives all the parameters which you can log.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22569180
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34432020
comment on: http://stackoverflow.com/q/22612689
type: Comment
has text: The error message means that Spring cannot find the desired bean. As @geoand noted, looks like your beans are not detected by the scan. Please post the name of the package per class/interface and how are you scanning them in beans.xml (or however you called your spring xml configuration).
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34619624
type: Comment
has text: Uh, OSGI is a system of its own... and i am not a expert in this. Sorry. :( Maybe then the best choice is, you ask a new question with a description of your OSGI architecture?
comment on: http://stackoverflow.com/a/22639457
score: 0
type: AnswerComment

http://stackoverflow.com/q/22580930
downvote count: 1
has title: Example on how to use TFileTransport in Thrift (Client/Server)
has answer: http://stackoverflow.com/a/22591150
tagged with: thrift
upvote count: 4
has comment: http://stackoverflow.com/comment/34391472
type: AnsweredQuestion
score: 3
answer count: 1
has comment: http://stackoverflow.com/comment/34375817
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34391560
accepted answer: http://stackoverflow.com/a/22591150
has body: Is there anyone who managed to get TFileTransport as a transport layer, to work? I've tried but since there is no documentation (or have I not found it?) for this, I am not able to make it work. If anyone have been more successful and could provide some sample code, it would be great. edit: What I've tried so far: public class FileThriftServer { public static void startThriftServer( ThriftDataBenchmark.Processor&lt;ThriftDataBenchmarkHandler&gt; processor) { try { File input = new File("ThriftFile.in"); if(!input.exists()){ input.createNewFile(); } File output = new File("ThriftFile.out"); if(!output.exists()){ output.createNewFile(); } TFileTransport inputFileTransport = new TFileTransport(input.getAbsolutePath(), true); TFileTransport outputFileTransport = new TFileTransport(output.getAbsolutePath(), false); inputFileTransport.open(); outputFileTransport.open(); TFileProcessor fProcessor = new TFileProcessor(processor, new TJSONProtocol.Factory(), inputFileTransport, outputFileTransport); // this results in error in case I don't call those open methods above fProcessor.processChunk(); System.out.println("File Thrift service started ..."); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { // ThriftDataBenchmarkHandler is an implementation of my test service startThriftServer(new ThriftDataBenchmark.Processor&lt;ThriftDataBenchmarkHandler&gt;( new ThriftDataBenchmarkHandler())); } } Now I don't know if I am even on a good way, maybe I misunderstood the concept of this transport (again, it is not documented). I would expect I start the server by some method now which will listen on the input file. When clients put there something, it would process it and write the answer to output file (I didn't try to write client yet since this peace of code just executes and exists, it is obviously not right). edit 2: Ok, so if I understand it right, this code is ok and it should process one request of the client, if it's there. So I am movi…
tagged with: java

http://stackoverflow.com/comment/34333629
comment on: http://stackoverflow.com/q/22557937
type: Comment
has text: @Caumons If I understand correctly, he is looking for some sort of Java REPL (but it's not really clear).
score: 0
type: QuestionComment

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/22555516
type: Tag

http://stackoverflow.com/a/22554215
answers question: http://stackoverflow.com/q/22553911
score: 4
has comment: http://stackoverflow.com/comment/34330009
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34327144
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/34335306
downvote count: 0
has comment: http://stackoverflow.com/comment/34328562
has body: I would recommend using Matcher.appendReplacement: public static void main(final String[] args) throws Exception { final String[] loginURLs = { "http://ip:port/path?username=abcd&amp;location={LOCATION}&amp;TXT{UE-IP,UE-Username,UE-Password}&amp;password={PASS}", "http://ip:port/path?username=abcd&amp;location={LOCATION}&amp;password={PASS}&amp;TXT{UE-IP,UE-Username,UE-Password}", "http://ip:port/path?TXT{UE-IP,UE-Username,UE-Password}&amp;username=abcd&amp;location={LOCATION}&amp;password={PASS}", "http://ip:port/path?TXT{UE-IP,UE-Username,UE-Password}", "http://ip:port/path?username=abcd&amp;password={PASS}"}; final Pattern patt = Pattern.compile("(\\?)?&amp;?(TXT\\{[^}]++})(&amp;)?"); for (final String loginURL : loginURLs) { System.out.printf("%1$-10s %2$s%n", "Processing", loginURL); final StringBuffer sb = new StringBuffer(); final Matcher matcher = patt.matcher(loginURL); while (matcher.find()) { final String found = matcher.group(2); System.out.printf("%1$-10s %2$s%n", "Found", found); if (matcher.group(1) != null &amp;&amp; matcher.group(3) != null) { matcher.appendReplacement(sb, "$1"); } else { matcher.appendReplacement(sb, "$3"); } } matcher.appendTail(sb); System.out.printf("%1$-10s %2$s%n%n", "Processed", sb.toString()); } } Output: Processing http://ip:port/path?username=abcd&amp;location={LOCATION}&amp;TXT{UE-IP,UE-Username,UE-Password}&amp;password={PASS} Found TXT{UE-IP,UE-Username,UE-Password} Processed http://ip:port/path?username=abcd&amp;location={LOCATION}&amp;password={PASS} Processing http://ip:port/path?username=abcd&amp;location={LOCATION}&amp;password={PASS}&amp;TXT{UE-IP,UE-Username,UE-Password} Found TXT{UE-IP,UE-Username,UE-Password} Processed http://ip:port/path?username=abcd&amp;location={LOCATION}&amp;password={PASS} Processing http://ip:port/path?TXT{UE-IP,UE-Username,UE-Password}&amp;username=abcd&amp;location={LOCATION}&amp;password={PASS} Found TXT{UE-IP,UE-Username,UE-Password} Processed http://ip:port/path?username=abcd&amp;lo…
accepted answer of: http://stackoverflow.com/q/22553911

http://stackoverflow.com/a/23010439
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22604038
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22604038
type: Answer
has body: Thanks to @alex2410 for the solution I had to make sure the cell was Editable this can be done by either extending the Table upon declaration and overriding the isCellEditable(int row, int col): boolean method, or in my case I overrode isCellEditable(EventObject e):boolean in the Cell Editor which I apply to the column, hence the snippet within the Cell Editor I am using would be @Override public boolean isCellEditable(EventObject e){ return true; } This is as all cells to which the editor is applied need to be editable, as they are all buttons in my case.
score: 4

http://stackoverflow.com/comment/34315282
comment on: http://stackoverflow.com/q/22546823
type: Comment
type: QuestionComment
has text: If a two-column predicate selects half the rows in the table, then indexing those two columns will not provide a benefit. The database will scan the index (which is at least as large as the table), then retrieve the selected rows from the table (or, if it's smart, from the index).
score: 0

http://stackoverflow.com/a/39280805
answers question: http://stackoverflow.com/q/22584206
has body: Regarding the file "androidscreencast.conf" (which is a copy of "...example"): Yes, enter path to your android-sdk-basedirectory (maybe /home/yourusername/adt-bundle-linux-x86_64-20131030/sdk/ in your case), build.xml expects a directory "tools/lib/" to be there: android.sdk=/path/to/your/android/sdk/installation If you don't know what to enter for... sign.keystore=../my_keystore sign.storepass=xxx sign.keypass=yyy sign.alias=zzz ...or run into trouble when it comes to signing/security, make yourself familiar with the "keytool" command - it's pretty simple once you get it. Basically you need to "keytool -genkeypair", or at least that's what I needed to do. then, edit the above lines from the config file to your needs. (You will know what to do after using "keytool".) "Launch ant (with target dist or jnlp)" means: Enter either "ant dist" or "ant jnlp" or both at the same time "ant dist jnlp" to compile/build androidscreencast. "dist" will create a subdirectory ("dist/") with the jar-files, "jnlp" does the signing (see above) of the jar-files. To run androidscreencast: Enter "dist/" directory, then type... javaws androidscreencast-DEV.jnlp (compare config file's first line: version=DEV) Most likely you will run into trouble now. First Bugfix: Remove the "codebase=...googlecode..." (line 3) from the androidscreencast-DEV.jnlp file. This will make the jnlp-file/javaws use local jar's instead of downloading from a outdated, non-existent URL. Second Bugfix: When I enter "javaws" it's in fact "icedtea". Make sure you have IcedTea 1.6.2 or higher. (Some bugfix regarding null-pointer on application-initialization. Or something.) Third Bugfix: You may have to copy "MyInjectEventApp.jar" and "icon.png" files from the src-tree to correct places. I think you have to copy "MyInjectEventApp.jar" to "bin/" and "icon.png" to "bin/net/srcz/android/screencast". (All inside the "AndroidScreencast/"-directory, not absolute linux filesystem paths!) ("grep" the source code folder for thes…
score: 0
type: Answer

http://stackoverflow.com/comment/34429812
type: Comment
has text: @venki To me, it looks like it's unclear for you what you have to accomplish for that project, and how to do it (correct me if I'm wrong). Take the time to do a rigorous analysis of the task instead of diving head first into it.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22611164

http://stackoverflow.com/comment/34399544
type: AnswerComment
type: Comment
has text: oh i see what happen, i would power 9^9 and would get 3.87420489E8. the E notation through me off. appreciate it guys.
score: 0
comment on: http://stackoverflow.com/a/22594336

lemmatization
type: Tag
tag name: lemmatization
tags question: http://stackoverflow.com/q/22589267

http://stackoverflow.com/comment/34440596
comment on: http://stackoverflow.com/a/22617464
type: AnswerComment
score: 0
type: Comment
has text: @user3349667 I don't know what that means. Your while statement is looking at each line one at a time. You either put the line in the new file or not.

http://stackoverflow.com/q/22576758
favorite count: 0
tagged with: sql
tagged with: android
score: -1
has comment: http://stackoverflow.com/comment/34367354
has comment: http://stackoverflow.com/comment/34367144
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34367552
downvote count: 2
has comment: http://stackoverflow.com/comment/34367052
upvote count: 1
has answer: http://stackoverflow.com/a/22576896
linked to: http://stackoverflow.com/q/468211
tagged with: java
has comment: http://stackoverflow.com/comment/34367295
has comment: http://stackoverflow.com/comment/34367049
type: Question
answer count: 1
has title: What do I get if I execute SELECT and element is not present in the db?
has body: So what do I get? I cannot find it and I already forgot. Will it be an error or just variable which is supposed to get the item will stay empty? (I am asking it because I want to check if in db is already the element to avoid duplicates, if you have any other way feel free to post it) EDIT: What is unclear about this question? I have asked what do I get if I execute SELECT query in SQLite (android) and the element is not present in the DB what value will have the cursor or what is the result. Is it an error or null value or what? As I already found out it is null value in cursor. That was all. EDIT2: If it is so unclear how is it possible that Viger understood and answered, unfortunately in the comment: You get an empty Cursor. Just use the cursor.getCount(); method to determine it it contains 0 rows

http://stackoverflow.com/q/22527814
has comment: http://stackoverflow.com/comment/34579445
has comment: http://stackoverflow.com/comment/34280380
has answer: http://stackoverflow.com/a/22665588
linked to: http://stackoverflow.com/q/3542018
accepted answer: http://stackoverflow.com/a/22665588
answer count: 1
downvote count: 0
has title: How to Scan all drives to find specific file extension in Java?
favorite count: 0
has body: I want to scan all disks in my pc to find notepad (.txt) files and copy them into newly created directory. How to do that ? If possible skip some of the folder under C like Windows.Currently I can only scan specific directory. Thanks public void scanFolder(int depth, File file) { StringBuilder indent = new StringBuilder(); String name = file.getName(); String extension; String txtcheck = "txt"; ; for (int i = 0; i &lt; depth; i++) { indent.append("."); } //Pretty print for directories if (file.isDirectory()) { String seperator = indent.toString() + "|"; if (isPrintName(name)) { } } //Print file name else if (isPrintName(name)) { out2 = indent.toString() + file.getName(); extension = name.substring(name.lastIndexOf(".") + 1, name.length()); if (txtcheck.equals(extension)) { outs.add(out2); } } if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i &lt; files.length; i++) { scanFolder(depth + 4, files[i]); } } } scanFolder(0, new File("C:\\lefdef"));
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/51320
type: AnsweredQuestion

http://stackoverflow.com/q/22556262
has comment: http://stackoverflow.com/comment/34330699
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34331025
has comment: http://stackoverflow.com/comment/34331828
has comment: http://stackoverflow.com/comment/34330295
score: 0
has comment: http://stackoverflow.com/comment/34330252
has body: Here I am trying to make an uploader in java spring where user is going to upload large files (around up to 200 mb) so can any one advise here to speed up the writing process of that file on server. Following is the code I am using to write the file on server. if (!file.isEmpty()) { byte[] bytes = file.getBytes() ; BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( new FileOutputStream(new File("/home/" + file.originalName()))); bufferedOutputStream.write(bytes); bufferedOutputStream.close() ; } else { System.out.println("file is empty"); }
tagged with: file-upload
has comment: http://stackoverflow.com/comment/34330678
has comment: http://stackoverflow.com/comment/34330358
has comment: http://stackoverflow.com/comment/34330127
has comment: http://stackoverflow.com/comment/34330411
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34330517
has title: how to speed up the uploading of files
has comment: http://stackoverflow.com/comment/34332501
answer count: 0

http://stackoverflow.com/q/22590206
has answer: http://stackoverflow.com/a/22595176
type: Question
linked to: http://stackoverflow.com/q/3709083
accepted answer: http://stackoverflow.com/a/22590347
downvote count: 0
has title: Display dates in multiple fragments
possible better answer: http://stackoverflow.com/a/22595176
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/34391777
has answer: http://stackoverflow.com/a/22590394
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/22590347
tagged with: fragment
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: date
has body: I'm having trouble trying to think of a way to display dates in fragments. What I need to do is display today's date at the top of a fragment and then when the user slides or presses a button the a fragment will replace the previous one and display tomorrows date and then the next fragment will display the date after tomorrow and so on.

http://stackoverflow.com/a/22586906
type: AcceptedAnswer
downvote count: 0
has body: Edit: It appears I answered the wrong question. As the OP mentioned in comments below: Sorry, my question may not be clear enough, what I am truly confusing is that when executing "firstNode = null", wether firstNode.data = null or firstNode.nextNode = null because firstNode is a object of type ListNode, which has int data and listNode type instances. After the assignment firstNode = null, there is no .data or .nextNode. You'd have to assign firstNode to a new ListNode() first. Once you do that, its data member will be initialized to 0 and its nextNode member will be initialized to null, as those are the default initial values for member fields if no explicit initialization is done. But again, you need to instantiate a ListNode and assign it to firstNode first, otherwise you'll get a NullPointerException if you try and access it while it is null. Original answer, re: firstNode = lastNode = null It assigns both firstNode and lastNode to null. It is a commonly used syntactic trick that takes advantage of the fact that an assignment expression as a whole evaluates to the value of the variable after assignment: a = b = 1 =&gt; a = (b = 1) (b = 1) assigns b then evaluates to 1 =&gt; a = 1 You can chain as many together as you want, as long as the types are compatible: a = b = c = d = 1 =&gt; a = b = c = (d = 1) (d = 1) assigns d then evaluates to 1 =&gt; a = b = (c = 1) (c = 1) assigns c then evaluates to 1 =&gt; a = (b = 1) (b = 1) assigns b then evaluates to 1 =&gt; a = 1 Incompatible types will result in an error: Integer x; Double y; x = y = null; // error: cannot convert from Double to Integer It's the same trick you use when you do stuff like: int ch; while ((ch = input.read()) != -1) { ... } From JLS 15.26: At run time, the result of the assignment expression is the value of the variable after the assignment has occurred.
type: Answer
has comment: http://stackoverflow.com/comment/34386148
accepted answer of: http://stackoverflow.com/q/22586896
score: 4
answers question: http://stackoverflow.com/q/22586896
upvote count: 4
has comment: http://stackoverflow.com/comment/34386076

http://stackoverflow.com/comment/34436171
has text: Show us what have your tried anyway.
score: 1
comment on: http://stackoverflow.com/q/22615037
type: Comment
type: QuestionComment

json-deserialization
tags question: http://stackoverflow.com/q/22623126
type: Tag
tag name: json-deserialization

http://stackoverflow.com/comment/34431233
type: AnswerComment
score: 0
has text: I tried adding this in my comparator before comparisons, but the empty cells still appear on top. The comparator does not see the nulls.
type: Comment
comment on: http://stackoverflow.com/a/22596744

http://stackoverflow.com/comment/34298903
has text: I realize I forgot about the truncating from being cast back down to an int. You would never reach 0 with floating points, but with ints that isn't a problem.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22537707
score: 0

http://stackoverflow.com/q/22614543
has comment: http://stackoverflow.com/comment/34479521
has comment: http://stackoverflow.com/comment/34435960
has comment: http://stackoverflow.com/comment/34465476
has comment: http://stackoverflow.com/comment/34436216
type: AnsweredQuestion
score: 2
tagged with: unsigned-integer
upvote count: 2
has comment: http://stackoverflow.com/comment/34461600
tagged with: java
has answer: http://stackoverflow.com/a/22615156
type: Question
has comment: http://stackoverflow.com/comment/34436027
has body: I am attempting to send the following Byte Array to a device running C. BYTES TO SEND: 80 3f 10 01 00 3c b2 5f 0d BYTES RECEIVED BY MACHNINE: 00 3f 10 01 00 3c 32 5f 0d It seems for some reason that java is turning the signed bit into a 0 which is manipulating what the C Machine is reading. 80 -&gt; 00 b2 -&gt; 32 Here is an example of my code: try { String response; Socket clientSocket = new Socket(iPAddress, port); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); byte[] bytes = new byte[] { (byte)0x80, 0x3f, 0x10, 0x01, 0x00, 0x3c, (byte) 0xb2, 0x5f, 0x0d}; outToServer.write(bytes); response = inFromServer.readLine(); System.out.println("FROM SCU: " + response); clientSocket.close(); } catch(Exception e) { e.printStackTrace(); } I am absolutely lost as to what I can do now as it seems nothing will work. I do not have access to the C Machine in order to change code.
linked to: http://stackoverflow.com/q/4266756
has comment: http://stackoverflow.com/comment/34524926
accepted answer: http://stackoverflow.com/a/22615156
has comment: http://stackoverflow.com/comment/34435298
has title: Sending Unsigned Bytes Over Socket In Java
has comment: http://stackoverflow.com/comment/34474812
linked to: http://stackoverflow.com/q/7276363
has comment: http://stackoverflow.com/comment/34435279
answer count: 1
has comment: http://stackoverflow.com/comment/34435710
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34436034
has comment: http://stackoverflow.com/comment/34435618
has comment: http://stackoverflow.com/comment/34436305
tagged with: sockets

http://stackoverflow.com/a/52197385
type: Answer
has body: Mine were located here on Ubuntu 18.04 when I installed JavaFX using apt install openjfx (as noted already by @jewelsea above) /usr/share/java/openjfx/jre/lib/ext/jfxrt.jar /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar
answers question: http://stackoverflow.com/q/22514310
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/111637670
has comment: http://stackoverflow.com/comment/98958846
upvote count: 7
has comment: http://stackoverflow.com/comment/129440676

http://stackoverflow.com/a/22523354
answers question: http://stackoverflow.com/q/22522490
upvote count: 9
score: 9
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34287286
downvote count: 0
has body: You have to first clean and build to generate one. As you do programming work you will see the result of your work , but this doesn't go into the dist folder until you clean and build.
type: Answer
accepted answer of: http://stackoverflow.com/q/22522490

http://stackoverflow.com/comment/34495053
type: QuestionComment
has text: So, one thing i notice is that the page isn't just html, it has lots of other stuff on it like javascript. Have you tried doing it with a basic HTML page to see if that will load?
score: 0
comment on: http://stackoverflow.com/q/22647691
type: Comment

http://stackoverflow.com/comment/34267860
score: 0
type: AnswerComment
type: Comment
has text: Hi Zhedar.. Logically it is supposed to work! I have corrected this before by creating a new object and returning! The database is returning unique actor objects everytime.. I have verified this by printing fields of the actor after this step: a = getActorFromResult(results); The only problem lies after the second iteration of arraylist.add().. The second object also replaces the first object!
comment on: http://stackoverflow.com/a/22519686

http://stackoverflow.com/comment/34418705
type: QuestionComment
has text: @LeosLiterak its version 1
comment on: http://stackoverflow.com/q/22602210
score: 0
type: Comment

http://stackoverflow.com/comment/34405894
has text: There just might be one problem with the action listener. What if the user clicks login and actually the details are wrong, I think the button becomes visible regardless.
comment on: http://stackoverflow.com/a/22598094
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34492484
type: AnswerComment
has text: @dognose That's not the desired behavior though. The op wants the game to end as soon as there's a winner, not after all the fields have been filled.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22646478

http://stackoverflow.com/a/22579590
has comment: http://stackoverflow.com/comment/34372800
has comment: http://stackoverflow.com/comment/34373585
answers question: http://stackoverflow.com/q/22579496
has comment: http://stackoverflow.com/comment/34372740
has comment: http://stackoverflow.com/comment/34372853
has comment: http://stackoverflow.com/comment/34373859
upvote count: 1
has comment: http://stackoverflow.com/comment/34373344
has comment: http://stackoverflow.com/comment/34372839
has comment: http://stackoverflow.com/comment/34372661
has comment: http://stackoverflow.com/comment/34372614
score: 1
has comment: http://stackoverflow.com/comment/34373658
downvote count: 0
has comment: http://stackoverflow.com/comment/34373394
has comment: http://stackoverflow.com/comment/34373065
has body: Don't close the OutputStream in the client (bout.close();) (at least not before invoking Socket.shutdownOutput(), see below). From the Javadoc of Socket.getOutputStream(): Returns an output stream for this socket. If this socket has an associated channel then the resulting output stream delegates all of its operations to the channel. If the channel is in non-blocking mode then the output stream's write operations will throw an java.nio.channels.IllegalBlockingModeException. Closing the returned OutputStream will close the associated socket. If you want to indicate that you're done writing to the socket, call Socket.shutdownOutput() instead. It's Javadoc states: Socket.shutdownOutput(): Disables the output stream for this socket. For a TCP socket, any previously written data will be sent followed by TCP's normal connection termination sequence. After invoking Socket.shutdownOutput(), which waits for the data to be flushed, you can close the OutputStream, the InputStream, or the Socket. (it doesn't matter which you close - all three will end up closing the Socket)
has comment: http://stackoverflow.com/comment/34373526
type: Answer

http://stackoverflow.com/a/22624618
answers question: http://stackoverflow.com/q/22624454
has body: Create a value object bean class having two fields, number and line. Implement comparable and override the compareTo method in that class. Populate an ArrayList of this bean class as you scan the file. Then sort the ArrayList.
downvote count: 0
score: 1
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34453638

http://stackoverflow.com/comment/34413745
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22602312
type: Comment
has text: hahaha,,, Okes,, Click on windows --> preferences if you cannot see Android that means you need to first get ADT plugin get it installed.

http://stackoverflow.com/q/22556481
has title: How to create an InputStream of files that have a certain extension in Java?
has comment: http://stackoverflow.com/comment/34330457
possible better answer: http://stackoverflow.com/a/22556601
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22556601
tagged with: java
has answer: http://stackoverflow.com/a/22556706
tagged with: inputstream
has body: I have a lot of files in a directory but I only want to read the ones with a certain extension (say .txt). I want these files added to the same BufferedInputStream so that I can read them in one go. When I call read() at the end of a file, the next one should begin. It really feels like there should be an obvious answer to this but I had no luck finding it.
type: Question
has comment: http://stackoverflow.com/comment/34330482
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/22556706
linked to: http://stackoverflow.com/q/3154488
has answer: http://stackoverflow.com/a/22556605

http://stackoverflow.com/q/22569694
answer count: 1
type: UnansweredQuestion
tagged with: sql-injection
tagged with: jdbc
has body: From the OWASP page on Preventing SQL Injection in Java: Variables passed as arguments to prepared statements will automatically be escaped by the JDBC driver. I understand how prepared statements seperate user input to be handled as parameter content and not as part of SQL command. But I stumbled across the quoted sentence above and I am wondering what’s all the escaping about. How does that help prevent the injection attack?
tagged with: java
has title: JDBC driver escaping arguments for prepared statement?
type: Question
has answer: http://stackoverflow.com/a/22569825
score: 0

http://stackoverflow.com/q/22645239
favorite count: 0
tagged with: android
linked to: http://stackoverflow.com/q/6713239
tagged with: autocompletetextview
score: 2
upvote count: 2
has body: Hi everyone I have an adapter which extends the ArrayAdapter class and overrides some Filterable methods. I am using this Adapter to perform some filtering while the user types inside an AutocompleteTextView. But I saw that if you type a bit fast the updanting of the filtered items becomes very slow. This is the adapter class: public class MunicipalitySearchAdapter extends ArrayAdapter&lt;Municipality&gt; { private ArrayList&lt;Municipality&gt; municipalities; private ArrayList&lt;Municipality&gt; allMunicipalities; private ArrayList&lt;Municipality&gt; suggestedMunicipalities; private int viewResourceId; @SuppressWarnings("unchecked") public MunicipalitySearchAdapter(Context context, int viewResourceId, ArrayList&lt;Municipality&gt; municipalities) { super(context, viewResourceId, municipalities); this.municipalities = municipalities; this.allMunicipalities = (ArrayList&lt;Municipality&gt;) this.municipalities.clone(); this.suggestedMunicipalities = new ArrayList&lt;Municipality&gt;(); this.viewResourceId = viewResourceId; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(this.viewResourceId, null); } Municipality municipality = municipalities.get(position); if (municipality != null) { TextView munNameTxtView = (TextView) v.findViewById(R.id.name); TextView proSignTxtView = (TextView) v.findViewById(R.id.sign); if (munNameTxtView != null) { munNameTxtView.setText(municipality.getName()); } if (proSignTxtView != null) { proSignTxtView.setText(municipality.getProvinceSign()); } } return v; } @Override public Filter getFilter() { return municipalityFilter; } Filter municipalityFilter = new Filter() { @Override public String convertResultToString(Object resultValue) { String str = ((Municipality) (resultValue)).getName(); return str; } @Override protected FilterResults pe…
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: trie
answer count: 1
downvote count: 0
has title: How can I speed up an AutocompleteTextView in Android?
has answer: http://stackoverflow.com/a/22645377

http://stackoverflow.com/comment/34246258
type: AnswerComment
has text: @Kraiss the question as posed was ambiguous, as it wasn't clear that the OP wanted the _effective_ longest sequence (once sorted) rather than the sequence as ordered in the array. I'd already written the `O(n)` solution to the latter problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22508224

http://stackoverflow.com/comment/34524926
comment on: http://stackoverflow.com/q/22614543
score: 0
type: Comment
type: QuestionComment
has text: @Holger I can of course. But please keep in mind that I don't spend my day thinking about questions on SOF, but come back occasionally, spot something, think just a littlebit about it and, in some cases post some. Sometimes I'm just wrong like I was and I have no excuse for that. Yet I'm really not a fulltime SOF staff member to just sit around and experiment with the problems posted here. Sorry for being dull, really, but it just seemed right - and the SW I'm working on right now really makes most of us around tired.

security
tags question: http://stackoverflow.com/q/22626808
tags question: http://stackoverflow.com/q/22631685
tags question: http://stackoverflow.com/q/22611993
tags question: http://stackoverflow.com/q/22609671
tags question: http://stackoverflow.com/q/22574199
tags question: http://stackoverflow.com/q/22497973
tags question: http://stackoverflow.com/q/22585065
tags question: http://stackoverflow.com/q/22619602
tags question: http://stackoverflow.com/q/22538037
tags question: http://stackoverflow.com/q/22490386
tags question: http://stackoverflow.com/q/22521121
tags question: http://stackoverflow.com/q/22516089
tags question: http://stackoverflow.com/q/22518240
tags question: http://stackoverflow.com/q/22584615
type: Tag
tags question: http://stackoverflow.com/q/22637587
tags question: http://stackoverflow.com/q/22506131
tags question: http://stackoverflow.com/q/22638494
tags question: http://stackoverflow.com/q/22635568
tag name: security

http://stackoverflow.com/q/22504637
tagged with: swing
type: Question
score: 0
has answer: http://stackoverflow.com/a/22506094
accepted answer: http://stackoverflow.com/a/22506094
answer count: 1
has comment: http://stackoverflow.com/comment/34242929
has comment: http://stackoverflow.com/comment/34239721
tagged with: jdialog
has body: I have JMenuItems , I wanna add to Project Creation dialog to JMenuItem (New) similar to any other Application , I am confused with that a little bit. Is it going to be JDialog , JFrame or JPanel to create such window shown in picture. Maybe I can also add click next in the future as well. Maybe Similar to Regards
tagged with: jframe
type: AnsweredQuestion
has title: How to add Project Creation Window to Swing JMenuItem
tagged with: java

http://stackoverflow.com/q/22596724
has body: I'm able to get the Image and Button widgets to render, however, I have not yet succeeded in getting the buttonPlay to receive input. This hypothesis is a result of the down image of the button not rendering when touched, and the onPlayClicked() not executing as well. I believe that I am properly setting the Stage as the InputProcessor. I have exhaustively searched for solutions on S.O. to no avail. The problematic Button is the buttonPlay within the buildControlsLayer() of ScreenMenuMain.java. Edit: Screen flow process: I want to switch from ScreenMenuMain.java to another screen named ScreenGame.java. I am trying to do this via DirectedGame.java which directs the screen switches. It also adds a transition effect, nullifies the input processor from the previous stage, and sets the input processor to the stage from the new screen. ScreenMenuMain.java public class ScreenMenuMain extends AbstractGameScreen { private Stage stage; private Skin skinMenuMain; //menu private Image menuLogo; private Button buttonPlay; public ScreenMenuMain (DirectedGame game) { super(game); } @Override public void render (float deltaTime) { Gdx.gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(deltaTime); stage.draw(); } @Override public void resize (int width, int height) { stage.setViewport(Constants.VIEWPORT_GUI_WIDTH, Constants.VIEWPORT_GUI_HEIGHT, false); } @Override public void show () { stage = new Stage(); rebuildStage(); } @Override public void hide () { stage.dispose(); skinMenuMain.dispose(); } private void rebuildStage () { skinMenuMain = new Skin(Gdx.files.internal(Constants.SKIN_MAINMENU), new TextureAtlas(Constants.TEXTURE_ATLAS_MAINMENU)); // build all layers Table layerLogo = buildLogoLayer(); Table layerControls = buildControlsLayer(); // assemble stage for menu screen stage.clear(); Stack stack = new Stack(); stage.addActor(stack); stack.setSize(Constants.VIEWPORT_GUI_WIDTH, Constants.VIEWPORT_GUI_HEIGHT); stack.add(layerLogo); st…
has answer: http://stackoverflow.com/a/22618670
type: UnansweredQuestion
upvote count: 1
tagged with: android-layout
tagged with: libgdx
score: 1
tagged with: java
has title: How to make this libGDX stage/Button receive touches?
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22608470

http://stackoverflow.com/comment/34494575
comment on: http://stackoverflow.com/q/22647176
score: 0
type: Comment
type: QuestionComment
has text: @user1803551 The code has been fixed. LoginPanel has been removed, and method is public. Sorry about that. There was a lot of code I had to remove in order to simplify this, so there might have been some issues that didn't relate to my problem, but I fixed it. Minor mistakes

http://stackoverflow.com/q/22521588
has body: Edit: I've got it now thanks everyone! What I'm supposed to be doing is printing the total hours for all the employees in descending order, as in Employee C: 100 hours, Employee A: 70, Employee B: 50, etc. I have everything set up to take in input for everything and now i have the objects with their total hour values I just can't figure out any way to print the highest total hours object. What I have so far will print the highest ones as it hits them but it skips any that weren't the highest when it gets to them. Every question I've seen about something similar using something called Comparators which I can't seem to get working, maybe I'm just not understanding how to get them to work. Any help would be appreciated. import java.util.*; import java.util.Collections; public class Employee { public String name; public int[] hours = new int[7]; public int totalHours; public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter number of employees"); int a = input.nextInt(); Employee[] employeeNames = new Employee[a]; for (int i = 0; i &lt; a; i++) { employeeNames[i] = new Employee(); } for (Employee b : employeeNames) { System.out.println("Enter name of employees"); b.setName(input.next()); System.out.println("Enter hours"); for (int i = 0; i &lt; 7; i++) { b.setHours(i, input.nextInt()); } } for (Employee b : employeeNames) { b.setTotalHours(); System.out.print("Employee: " + b.getName() + " "); System.out.println(b.getHours()); } int count = 0; for (int i = 0; i &lt; employeeNames.length; i++) { for (int j = 1; j &lt; employeeNames.length;j++) { if (employeeNames[i].getTotalHours() &gt;= employeeNames[j].getTotalHours()) { count++; } } if(count &gt;= employeeNames.length - i){ System.out.println(employeeNames[i].getTotalHours()); } } } private void setName(String a) { name = a; } private String getName() { return name; } private void setHours(int i, int a) { hours[i] = a; } private String getHours() { return Arrays.toStri…
upvote count: 2
has answer: http://stackoverflow.com/a/22521843
has answer: http://stackoverflow.com/a/22522057
accepted answer: http://stackoverflow.com/a/22522057
type: Question
type: AnsweredQuestion
has title: Java: How do I print out in descending order the values of a list of objects' properties?
tagged with: java
has answer: http://stackoverflow.com/a/22521858
has comment: http://stackoverflow.com/comment/34269998
answer count: 3
has comment: http://stackoverflow.com/comment/34270248
downvote count: 0
possible better answer: http://stackoverflow.com/a/22521843
favorite count: 0
score: 2

http://stackoverflow.com/comment/34324624
comment on: http://stackoverflow.com/q/22552148
has text: @Parthe Of course that's what it means. How could it possibly hold more?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22612537
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/22604333
upvote count: 1
has comment: http://stackoverflow.com/comment/34485582
has comment: http://stackoverflow.com/comment/34551909
answers question: http://stackoverflow.com/q/22604333
type: AcceptedAnswer
downvote count: 0
has body: As seen for instance in Adding attributes to a dataset, the following code should be enough: atts.addElement(new Attribute("class",labels)); Where labels is of type: java.util.List&lt;java.lang.String&gt;

http://stackoverflow.com/a/22518405
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34267240
has body: just do alpha@Alpha:~$ cd ~/Escritorio/Test alpha@Alpha:~$ javac Example.java alpha@Alpha:~$ java Example
answers question: http://stackoverflow.com/q/22518195

http://stackoverflow.com/comment/34215507
score: 0
comment on: http://stackoverflow.com/q/22489605
has text: If the datastore.put is a google api call, it is very likely that google has dropped support for the call or changed the api without informing you.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34332534
type: AnswerComment
comment on: http://stackoverflow.com/a/22538722
type: Comment
has text: could you give a short example boris?
score: 0

http://stackoverflow.com/q/22582964
has answer: http://stackoverflow.com/a/22587254
accepted answer: http://stackoverflow.com/a/22587254
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
has body: I'm trying to make a program with graphs and print the graph on the screen. I am using the GraphPainter (a SurfaceView type, implements Runnable) class to paint the graph to the screen. In the drawing function, which loops indefinitely, i am updating the elements of the graph: the node list and the edge list from the Graph class. The node list is perfectly updated from the Graph (when i delete, add or select a node), but the edge list in the Painter don't update if I delete an edge from the actual Graph. I debugged it and the graphEdgeList from the Graph class is updated correctly when I remove an edge. It's size gets lower. Can anybody tell me why isn't the list from GraphPainter updated accordingly? GraphDrawer.java: package com.rares.graphit; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.view.Window; import android.view.WindowManager; public class GraphDrawer extends Activity implements OnTouchListener{ /**Suface Manipulator*/ GraphPainter gp; /**Graph object*/ public static Graph graph = null; /**Touch coordinates*/ public static float touchX = 0; public static float touchY = 0; /**Drag state*/ public boolean isDragging = false; /**Drag coordinates*/ public static float dragX = 0; public static float dragY = 0; /**Id of the node that is currently selected * Is -1 if no node is selected during a touch event*/ public static int currentId = -1; /**Id of a node that was selected before and an action between 2 nodes or on a node * that needs to be deleted or moved*/ public static int firstId = -1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /*Set window to fullscreen**/ requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); gp = new GraphPainter(this); gp.setOnTouch…
type: Question
has title: thread doesn't update an array
score: 0
answer count: 1

http://stackoverflow.com/a/22634119
upvote count: 1
has comment: http://stackoverflow.com/comment/34598883
has comment: http://stackoverflow.com/comment/34598556
has comment: http://stackoverflow.com/comment/34598785
has comment: http://stackoverflow.com/comment/34469806
has body: change the layout to this: &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;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;/FrameLayout&gt; &lt;!-- android:layout_gravity="start" tells DrawerLayout to treat this as a sliding drawer on the left side for left-to-right languages and on the right side for right-to-left languages. The drawer is given a fixed width in dp and extends the full height of the container. A solid background is used for contrast with the content view. --&gt; &lt;ExpandableListView android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="#999999" android:dividerHeight="1dp" android:background="#ffffff"/&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; &lt;/RelativeLayout&gt; And in order to make it work on the menu icon, you could refer to the source code here Code snippets: @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if(mDrawerLayout.isDrawerOpen(mFrameHoldingList)) { mDrawerLayout.closeDrawer(mFrameHoldingList); }else { mDrawerLayout.openDrawer(mFrameHoldingList); } break; default: break; } return super.onOptionsItemSelected(item); } mFrameHoldingList in your case …
has comment: http://stackoverflow.com/comment/34471372
has comment: http://stackoverflow.com/comment/34471291
has comment: http://stackoverflow.com/comment/34470482
has comment: http://stackoverflow.com/comment/34470382
has comment: http://stackoverflow.com/comment/34470012
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34469950
has comment: http://stackoverflow.com/comment/34470113
type: Answer
has comment: http://stackoverflow.com/comment/34470155
has comment: http://stackoverflow.com/comment/34501907
answers question: http://stackoverflow.com/q/22633918
has comment: http://stackoverflow.com/comment/34598899
score: 1
has comment: http://stackoverflow.com/comment/34469851
accepted answer of: http://stackoverflow.com/q/22633918

http://stackoverflow.com/q/22592689
has comment: http://stackoverflow.com/comment/34395978
tagged with: jdbc
has title: SQL invalid identifier error
has comment: http://stackoverflow.com/comment/34395962
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34396074
tagged with: java
has comment: http://stackoverflow.com/comment/34395877
has comment: http://stackoverflow.com/comment/34396047
tagged with: oracle10g
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/47164056
has comment: http://stackoverflow.com/comment/34395988
score: 2
answer count: 1
has comment: http://stackoverflow.com/comment/34396019
has comment: http://stackoverflow.com/comment/34396168
downvote count: 0
has body: I was working on jdbc my sql statements.My table TBGROUP has these two columns GroupName,OwnerEmail and String n1=request.getParameter("GName"); String n3=request.getParameter("OEmail"); String sql1 = "SELECT GroupName,OwnerEmail FROM TBGROUP where GroupName='"+n1+"' and OwnerEmail='"+n3+"'"; But it gives an error on Tomcat output screen that "OWNEREMAIL": invalid identifier. What can be the reason.Please help
favorite count: 0
has comment: http://stackoverflow.com/comment/34395895
tagged with: sql

http://stackoverflow.com/comment/34410899
type: AnswerComment
comment on: http://stackoverflow.com/a/22600517
type: Comment
has text: so in this method i tried using return true or return false, is it both also can? because i still can get my output code
score: 0

http://stackoverflow.com/comment/34271277
type: QuestionComment
has text: Just run inspection click right button and see this in the menu list.
comment on: http://stackoverflow.com/q/22522013
score: 0
type: Comment

http://stackoverflow.com/comment/34275834
type: QuestionComment
comment on: http://stackoverflow.com/q/22524286
has text: ok then how the function will call. I am using this way ` {{#items}} {{name}} : {{detail}} `, and I want to truncate `detail`, can you please tell me how do I call the function over `detail`
score: 0
type: Comment

http://stackoverflow.com/q/22581095
has title: Finding Azimuth Value when Device is not FLAT to ground - Android?
downvote count: 0
tagged with: device-orientation
score: 1
tagged with: java
type: Question
has body: I want to find the Azimuth angle of device when It is not FLAT to the ground. Here is an already existing Answer but not complete for me: Here is the accepted answer on this question, which is almost same. Inconsistent orientation sensor values on Android for azimuth/yaw and roll Problem: But in this question, accepted answer gives azimuth value in the range -89 to 89. I want to calculate Azimuth angle value in range 0-359 degree, when moving from Magnetic North. How can I calculate that in Android Sensors?
linked to: http://stackoverflow.com/q/15537125
answer count: 2
has answer: http://stackoverflow.com/a/22652861
linked to: http://stackoverflow.com/q/22326720
upvote count: 1
tagged with: android-sensors
favorite count: 0
possible better answer: http://stackoverflow.com/a/22652861
tagged with: android-orientation
has comment: http://stackoverflow.com/comment/34402469
tagged with: android
has answer: http://stackoverflow.com/a/22588516
accepted answer: http://stackoverflow.com/a/22588516
type: AnsweredQuestion

junit
type: Tag
tags question: http://stackoverflow.com/q/22643364
tags question: http://stackoverflow.com/q/22638583
tags question: http://stackoverflow.com/q/22503558
tags question: http://stackoverflow.com/q/22639258
tags question: http://stackoverflow.com/q/22636660
tags question: http://stackoverflow.com/q/22644989
tags question: http://stackoverflow.com/q/22501573
tags question: http://stackoverflow.com/q/22595349
tags question: http://stackoverflow.com/q/22491137
tag name: junit
tags question: http://stackoverflow.com/q/22583490
tags question: http://stackoverflow.com/q/22526870
tags question: http://stackoverflow.com/q/22580415
tags question: http://stackoverflow.com/q/22524055
tags question: http://stackoverflow.com/q/22641081
tags question: http://stackoverflow.com/q/22605369
tags question: http://stackoverflow.com/q/22604497
tags question: http://stackoverflow.com/q/22589367
tags question: http://stackoverflow.com/q/22567843
tags question: http://stackoverflow.com/q/22532339
tags question: http://stackoverflow.com/q/22497349
tags question: http://stackoverflow.com/q/22607887
tags question: http://stackoverflow.com/q/22549619
tags question: http://stackoverflow.com/q/22493327
tags question: http://stackoverflow.com/q/22545116
tags question: http://stackoverflow.com/q/22645319
tags question: http://stackoverflow.com/q/22507299
tags question: http://stackoverflow.com/q/22534207
tags question: http://stackoverflow.com/q/22546013
tags question: http://stackoverflow.com/q/22612237
tags question: http://stackoverflow.com/q/22623649
tags question: http://stackoverflow.com/q/22598186
tags question: http://stackoverflow.com/q/22488479
tags question: http://stackoverflow.com/q/22570163
tags question: http://stackoverflow.com/q/22615361
tags question: http://stackoverflow.com/q/22591786
tags question: http://stackoverflow.com/q/22503395
tags question: http://stackoverflow.com/q/22533300
tags question: http://stackoverflow.com/q/22497146
tags question: http://stackoverflow.com/q/22592812
tags question: http://stackoverflow.com/q/22599980
tags question: http://stackoverflow.com/q/22541455
tags question: http://stackoverflow.com/q/22518614

http://stackoverflow.com/q/22599227
has body: So I have this abstract class: abstract class Shape { int Width; int Height; final String nazwaKształtu; public Shape(int w, String kształt) { nazwaKształtu = kształt; } public Shape(int w, int h, String kształt) { nazwaKształtu = kształt; } void setWidth(int w) { Width = w; } } And another class shape: class Square extends Shape { Square(int w, String kształt) { super(kształt); // I get an error here Width = w; Height = w; } @Override void setWidth(int w) { Width = w; Height = w; } public int getWidth() { return Width; } public int getHeight(){ return Height; } } But I get an error message telling me that something is wrong with the types. But in my abstract class I do have a constructor that should be applicable. When I change constructor in my Square class to: Square(int w) { super("Prostokąt"); Width = w; Height = w; } it still wont work. What mistake did I make?
tagged with: super
tagged with: java
has answer: http://stackoverflow.com/a/22599253
type: Question
tagged with: inheritance
has title: java abstract class constructor wont work as predicted
has comment: http://stackoverflow.com/comment/34407990
score: 0
tagged with: abstract-class
answer count: 2
has answer: http://stackoverflow.com/a/22599244
has comment: http://stackoverflow.com/comment/34407984
has comment: http://stackoverflow.com/comment/34407980
type: UnansweredQuestion

http://stackoverflow.com/q/22501353
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22501433
tagged with: notepad
possible better answer: http://stackoverflow.com/a/22501433
has title: how to align multiple line to single line in eclipse
answer count: 3
has comment: http://stackoverflow.com/comment/34233885
accepted answer: http://stackoverflow.com/a/22501788
score: 0
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22501883
has body: i have Muptiple line text in notepad (more than 10,000). my java program assign all text to single String EX: String text="here big text" after copy the notepad text assign to String text="... ... ... ... ... .. n line" i got above format how to change multiple line text to single line. Available at any eclipse shortcut or any way
has comment: http://stackoverflow.com/comment/34233957
type: Question
has answer: http://stackoverflow.com/a/22501788

http://stackoverflow.com/q/22599868
favorite count: 0
type: Question
answer count: 2
score: -1
has answer: http://stackoverflow.com/a/22599874
tagged with: java
downvote count: 1
has body: I am having say a servlet servlet1.java with a session in it like this String mykey = new String("hi"); HttpSession session = request.getSession(true); session.setAttribute(mykey, request.getParameter("GName")); response.sendRedirect("second.html"); In second servlet am doing Object OwnerName = request.getSession().getAttribute("mykey"); out.println(OwnerName); But this value retyrn NULL.What can be the reason ?
has answer: http://stackoverflow.com/a/22600252
upvote count: 0
type: UnansweredQuestion
tagged with: servlets
has title: Sending data from one servlet to other via session

http://stackoverflow.com/q/22543633
favorite count: 0
has answer: http://stackoverflow.com/a/22543773
answer count: 4
score: 5
tagged with: swing
has answer: http://stackoverflow.com/a/22547218
tagged with: jbutton
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22543773
has answer: http://stackoverflow.com/a/22545632
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/22547218
has answer: http://stackoverflow.com/a/22543833
has title: Stopping JButton highlighting on press
tagged with: user-interface
downvote count: 0
has body: Any JButton that is pressed will seem to "highlight" itself when pressed like so: I can't seem to find any way of disabling this.

http://stackoverflow.com/q/22600250
accepted answer: http://stackoverflow.com/a/22600397
tagged with: sqlite
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has body: I keep on getting this error saying that the table in my database doesn't exist but the table was declared. So, I have this class to create appointments into a database, which is: package com.example.calendar; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CalendarView; import android.widget.EditText; import android.app.Activity; import android.content.ContentValues; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.example.calendar.Appointment; import static com.example.calendar.Constants.KEY_DATE; import static com.example.calendar.Constants.KEY_DETAILS; import static com.example.calendar.Constants.KEY_ID; import static com.example.calendar.Constants.KEY_TIME; import static com.example.calendar.Constants.KEY_TITLE; import static com.example.calendar.Constants.TABLE_APP; public class CreateAppointment extends Activity implements OnClickListener{ EditText titleTextBox, timeTextBox, detailsTextBox; int[] dateSelected = new int[3]; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.create); titleTextBox = (EditText) findViewById(R.id.apptTitle); timeTextBox = (EditText) findViewById(R.id.apptTime); detailsTextBox = (EditText) findViewById(R.id.apptDetails); View createButton = (Button) findViewById(R.id.apptSave); String dateToPass = null; Bundle getExtraFromMain = getIntent().getExtras(); if(getExtraFromMain != null){ dateSelected = getExtraFromMain.getIntArray(dateToPass); } createButton.setOnClickListener(this); } private Cursor cursor(){ DBHandler appointment = new DBHandler(this); SQLiteDatabase db = appointment.getReadableDatabase(); String[] getValueFrom = {KEY_DATE, KEY_TITLE, KEY_TIME, KEY_DETAILS}; Cursor cursor = db.query(TABLE_APP, getValueFrom, null, null, null, null, KEY_DATE + " ASC"); return cursor; } private void save(){ St…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34409755
score: 1
has comment: http://stackoverflow.com/comment/34410444
tagged with: java
has answer: http://stackoverflow.com/a/22600397
has title: Sqlite android: table not found
upvote count: 1
tagged with: android-sqlite
type: Question
has comment: http://stackoverflow.com/comment/34409915
has comment: http://stackoverflow.com/comment/34409864

http://stackoverflow.com/a/22545510
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22545421
has comment: http://stackoverflow.com/comment/34313481
score: 4
has body: You should have a look at non blocking io. With blocking io, each socket will consume 1 thread and the number of threads in a system is limited. And even if you can create 1000+, it is a questionable approach. With non blocking io, you can server multiple sockets with a single thread. This is a more scalable approach + you control how many threads at any given moment are running.

http://stackoverflow.com/comment/34887810
type: Comment
has text: @user838204 Something to consider is that, Chronicle is designed to record all the data until you deleted it externally e.g. once per day. This is useful for replaying long sequences of real data in testing or reproducing a bug. However, it assumes disk space is very cheap which is not true in all organizations.
type: AnswerComment
comment on: http://stackoverflow.com/a/22629384
score: 0

http://stackoverflow.com/q/22585683
has comment: http://stackoverflow.com/comment/34383825
answer count: 1
has comment: http://stackoverflow.com/comment/34383972
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/22585906
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34384066
has comment: http://stackoverflow.com/comment/34383785
tagged with: java
has title: Java doesn't see space in string
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/34383799
has comment: http://stackoverflow.com/comment/34383728
has comment: http://stackoverflow.com/comment/34383746
tagged with: string
has comment: http://stackoverflow.com/comment/34383748
has comment: http://stackoverflow.com/comment/34383741
has comment: http://stackoverflow.com/comment/34383859
favorite count: 0
has body: So, I'm trying to parse some text file which has multiple lines of text. My job is to go through all words and print them out in file. So, I read all lines, I'm looping through them and splitting every line by spaces, like this: line.split("\\s+"); Now, the problem is that in some cases Java does not see space between two words... I was also trying to loop through string which has space but Java doesn't see it, and Character.isSpaceChar(char) returned true... And now I'm completly confused... Here is code: public void createMap(String inputPath, String outputPath) throws IOException { File f = new File(inputPath); FileWriter fw = new FileWriter(outputPath); List&lt;String&gt; lines = Files.readAllLines(f.toPath(), StandardCharsets.UTF_8); for (String l : lines) { for (String w : l.split("\\s+")) { if (isNotRubbish(w.trim())) { fw.write(w.trim() + "\n"); } } } fw.close(); } private boolean isNotRubbish(String w) { Pattern p = Pattern.compile("@?\\p{L}+", Pattern.UNICODE_CHARACTER_CLASS); Matcher m = p.matcher(w); return m.matches(); }
score: 0
has answer: http://stackoverflow.com/a/22585906
tagged with: char
has comment: http://stackoverflow.com/comment/34383773

http://stackoverflow.com/q/22588112
has answer: http://stackoverflow.com/a/22588753
has body: I want to take a text file as input , read the words , check each word with the englishwordslist , if the words are misspelled (like unwanted repeated characters)then replace the word with the correct word in the same file. if the word is beautifullllll then my code works fine..it writes beautiful into the file but if the word is beautttifulll then my code will not work properly.First i'm removing all the repeated characters in the word cross-checking with the wordslist if not present then allowing only one successive repetition of character.Since beautttifulll has more than one character repeated the output i get is beauttifull but its not in the dictionary. Please help me with this. import java.io.*; public class ownspell { public static String result(String input, boolean doubleLetter){ String pattern = null; if(doubleLetter) pattern = "(.)(?=\\1{2})"; else pattern = "(.)(?=\\1)"; return input.replaceAll(pattern, ""); } public static int checkingdic(String word) throws IOException,FileNotFoundException { FileInputStream fstream=new FileInputStream("G:/englishwordslist.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String sample=" "; word.toLowerCase(); int flag=1; while((sample=br.readLine())!=null &amp;&amp; flag==1) { if(sample.equalsIgnoreCase(word)) { flag=0; } } fstream.close(); return flag; } public static void addtofile(String old,String newv) throws IOException , FileNotFoundException { File file = new File("G:/1.txt"); BufferedReader reader = new BufferedReader(new FileReader(file)); String sample = "", oldtext = ""; while((sample = reader.readLine()) != null) { oldtext += sample + "\r\n"; } reader.close(); // replace a word in a file String newtext = oldtext.replaceAll(old, newv); FileWriter writer = new FileWriter("G:/1.txt"); writer.write(newtext);writer.close(); } public static void main(String[] args) throws IOException , FileNotFoundException { try{ FileInputStream f1stre…
has comment: http://stackoverflow.com/comment/34388244
score: 1
tagged with: java
has title: Basically I want to replace the unwanted repeated characters words with their correctly spelled words
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22589203
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34388048
has comment: http://stackoverflow.com/comment/34388706
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/22570619
has comment: http://stackoverflow.com/comment/34356710
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22570769
tagged with: java
downvote count: 2
type: Question
has body: //I know it must have to do with my formula but that is the formula I was given. (except for I had to switch the cos &amp; sin on the minute and second hand for them to work. Any help would be greatly appreciated. I'm just not seeing what I am doing wrong. import java.util.GregorianCalendar; import javax.swing.JComponent; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.*;//import * Class public class ClockComponent extends JComponent { int second; int minute; int hour; double secondHandLength = 300; double minuteHandLength = 200; double hourHandLength = 100; public void setCurrentTime() { GregorianCalendar calendar = new GregorianCalendar(); hour = calendar.get(calendar.HOUR_OF_DAY); minute = calendar.get(calendar.MINUTE); second = calendar.get(calendar.SECOND); } public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; int xCoord = 40; int yCoord = 25; Ellipse2D.Double clockFace = new Ellipse2D.Double(xCoord, yCoord, 700, 700); g2.setColor(Color.black); g2.draw(clockFace); g2.fill(clockFace); g2.setColor(Color.red); Font font1 = new Font("Old English Text MT",Font.BOLD,30); g2.setFont(font1); g2.drawString("John Doe", 305, 680); g2.setColor(Color.yellow); Font font2 = new Font("Arial",Font.BOLD,30); g2.setFont(font2); g2.drawString("3", xCoord + 670, yCoord + 355); g2.drawString("6", xCoord + 340, yCoord + 685); g2.drawString("9", xCoord + 10, yCoord + 355); g2.drawString("12", xCoord + 340, yCoord + 35); int xCenter = 380; int yCenter = 380; setCurrentTime(); double xSecond = xCenter + secondHandLength * Math.sin(second * (2 * Math.PI / 60)); double ySecond = yCenter - secondHandLength * Math.cos(second * (2 * Math.PI / 60)); double xMinute = xCenter + minuteHandLength * Math.sin(minute * (2 * Math.PI / 60)); double yMinute = yCenter - minuteHandLength * Math.cos(minute * (2 * Math.PI / 60)); double xHour = xCenter + hourHandLength * Math.cos((hour + minute / 60) * (2 * Math.PI / 60)); double yHour = yCenter - hourHandL…
linked to: http://stackoverflow.com/q/22496035
score: -2
has answer: http://stackoverflow.com/a/22570786
accepted answer: http://stackoverflow.com/a/22570769
has comment: http://stackoverflow.com/comment/34356871
answer count: 3
upvote count: 0
has title: What should I enter in the hour formula to get the correct hour? (the second and minute hand seem to be working)
possible better answer: http://stackoverflow.com/a/22570785
favorite count: 0
has comment: http://stackoverflow.com/comment/34356782
has answer: http://stackoverflow.com/a/22570785

http://stackoverflow.com/comment/34433143
comment on: http://stackoverflow.com/a/22613366
score: 0
type: AnswerComment
type: Comment
has text: I think that error *"Uncompilable source code - Erroneous sym"* type has nothing to do with your question or this answer, the problem lies somewhere else.

http://stackoverflow.com/comment/34393458
type: QuestionComment
has text: Is there any way to intelligently remove parts of the image? Because if I do something which statically and recursively removes a pre-specificed part of the image, I might just end up not being able to actually recognize any pattern (e.g. if the problem is a partially visible QR code, then removing X each time, might only repeat the same issue). Any suggestion? I would also like to not lose much speed with that.
score: 0
comment on: http://stackoverflow.com/q/22562408
type: Comment

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/22624179
tags question: http://stackoverflow.com/q/22602143
tags question: http://stackoverflow.com/q/22607701
tags question: http://stackoverflow.com/q/22608198
tags question: http://stackoverflow.com/q/22627169
tags question: http://stackoverflow.com/q/22612172
type: Tag
tag name: pdf
tags question: http://stackoverflow.com/q/22537516
tags question: http://stackoverflow.com/q/22605965
tags question: http://stackoverflow.com/q/22552402
tags question: http://stackoverflow.com/q/22498937
tags question: http://stackoverflow.com/q/22595683
tags question: http://stackoverflow.com/q/22562527
tags question: http://stackoverflow.com/q/22561303
tags question: http://stackoverflow.com/q/22565650
tags question: http://stackoverflow.com/q/22493198
tags question: http://stackoverflow.com/q/22505148
tags question: http://stackoverflow.com/q/22601499
tags question: http://stackoverflow.com/q/22502667
tags question: http://stackoverflow.com/q/22618136

http://stackoverflow.com/comment/73751981
type: AnswerComment
score: 0
type: Comment
has text: I had the same stack trace... after updating to a recent mail.jar, I got a more useful message - the file didn't exist.
comment on: http://stackoverflow.com/a/22552019

http://stackoverflow.com/comment/34372126
type: QuestionComment
comment on: http://stackoverflow.com/q/22579496
score: 0
has text: i have researched a lot for this and still it has been downgraded.such a pity
type: Comment

http://stackoverflow.com/a/22522178
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22522145
answers question: http://stackoverflow.com/q/22522145
type: AcceptedAnswer
downvote count: 0
has body: Try: .+\.add\(.+\.substring\(.+\)\)
type: Answer
score: 1

http://stackoverflow.com/q/22545153
has answer: http://stackoverflow.com/a/22546234
has comment: http://stackoverflow.com/comment/34312967
has comment: http://stackoverflow.com/comment/34312401
answer count: 1
has comment: http://stackoverflow.com/comment/34312230
tagged with: tomcat
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/34311989
tagged with: android
has body: I am trying to post data from android to application server.When the user register himself, he clicks register button.And AsynTask cycle starts from here.After that, the fragment should be replaced with download fragment. Here is the code for Register.java public class Register extends Fragment{ private Button register; private EditText tcno,username,confirmpassword,password; /** * Define Click listener for the button. */ private static final String SERVICE_URL = "http://10.0.2.2:8084/ClinicWebApp/rest/routine"; Context thiscontext; private OnClickListener registerClickListener = new OnClickListener() { public void onClick(View v) { SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(v.getContext()); Editor editor = sharedPreferences.edit(); editor.putString("verification_code", tcno.toString()); editor.commit(); //Dbye kaydet user bilgilerini if (tcno.equals("") || username.equals("") || password.equals("")||confirmpassword.equals("")) { // Toast.makeText(getActivity().getApplicationContext(), "Please enter in //all required fields.", // Toast.LENGTH_LONG).show(); return; } //post to web WebServiceTask wst = new WebServiceTask(WebServiceTask.POST_TASK, getActivity(), "Posting data..."); wst.addNameValuePair("tcno", tcno.getText().toString()); wst.execute(new String[] { SERVICE_URL }); FragmentManager fragmentManager = getFragmentManager(); DownloadRoutines downloadFragment = new DownloadRoutines(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.frameLayout, downloadFragment); transaction.addToBackStack(null); transaction.commit(); } }; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View contentView = inflater.inflate(R.layout.register, null); contentView.setDrawingCacheEnabled(false); register = (Button)contentView.findViewById(R.id.register); tcno=(EditText)contentView.findViewById(R.id.tcnoEditText); username=(EditText)co…
type: UnansweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34312250
has title: AsyncTask #3 Android crashes with doInBackground when posting data to tomcat server
type: Question
tagged with: android-fragments

custom-exceptions
type: Tag
tags question: http://stackoverflow.com/q/22594777
tag name: custom-exceptions

http://stackoverflow.com/q/22523920
tagged with: dom
has answer: http://stackoverflow.com/a/22524520
downvote count: 0
score: 1
has body: For the below XML Andrew Is there any way to get the entire node with text content Andrew as a string itself by using the DOM parsing strategy ?
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/xml
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34275085
tagged with: java
has title: How to get the entire node with its text content?
type: UnansweredQuestion

http://stackoverflow.com/comment/34494102
has text: The files? I want java to compile them. But they contain characters that are invalid utf. Everything else in the project is utf
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22646676
score: 0

http://stackoverflow.com/comment/34398324
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22593635
type: Comment
has text: @gstackoverflow That is boxing followed by widening. `Integer` to `Object` is a valid widening.

http://stackoverflow.com/a/22624887
type: Answer
answers question: http://stackoverflow.com/q/22624869
has comment: http://stackoverflow.com/comment/34454372
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/34454382
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34454199
has body: Since selectAll is a method of JTextComponent, which JTextPane extends from I would take a wild guess and say, probably, yes. Five minutes of coding probably would have gotten you the same answer yourself... Highlighting not seem to appear in the jTextPane area (note : I use Java 7) This is likely because the JTextPane doesn't have focus, try using requestFocusInWindow to bring keyboard focus back to the JTextPane. The JTextComponents don't always render selection highlighting when they don't have focus. For example... import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestTextPane { public static void main(String[] args) { new TestTextPane(); } public TestTextPane() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } final JTextPane tp = new JTextPane(); JButton withFocus = new JButton("Select with focus"); withFocus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tp.selectAll(); tp.requestFocus(); } }); JButton withOutFocus = new JButton("Select without focus"); withFocus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tp.selectAll(); } }); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new JScrollPane(tp)); JPanel panel = new JPanel(); panel.add(withFocus); panel.add(withOutFocus); frame.add(panel, BorderLayout.SOUTH); frame.pack(); frame.setLocationR…
accepted answer of: http://stackoverflow.com/q/22624869

http://stackoverflow.com/q/22642012
has answer: http://stackoverflow.com/a/62570411
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/42109541
has answer: http://stackoverflow.com/a/42109541
has answer: http://stackoverflow.com/a/30541653
has answer: http://stackoverflow.com/a/51891916
has answer: http://stackoverflow.com/a/77353300
tagged with: http
tagged with: unit-testing
has body: Clearly I'm not using this test fixture right. My servlet works just fine in tomcat, but when I try to use this mock, the multi-part boundary is not found. "the request was rejected because no multipart boundary was found". There is an answer here that shows how to use this using a text file, but that answer sets the boundary string explicitly and embeds the file as test. I would think I would not need to do with by hand with methods like mockrequest.addFile(...) What am I not setting here or how I am doing this wrong? @org.testng.annotations.Test public void testDoPost() throws Exception { MockMultipartFile file = new MockMultipartFile("test.zip", "test.zip", "application/zip", MyServletTest.class.getResourceAsStream("/test.zip")); MockMultipartHttpServletRequest mockRequest = new MockMultipartHttpServletRequest(); mockRequest.addFile(file); mockRequest.set mockRequest.setMethod("POST"); mockRequest.setParameter("variant", "php"); mockRequest.setParameter("os", "mac"); mockRequest.setParameter("version", "3.4"); MockHttpServletResponse response = new MockHttpServletResponse(); new MyServletTest().doPost(mockRequest, response); // BOOM ! } Here is the exception Caused by: blablah: the request was rejected because no multipart boundary was found
type: Question
has comment: http://stackoverflow.com/comment/34484052
tagged with: spring-test
accepted answer: http://stackoverflow.com/a/30541653
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/34516575
has title: How to use spring's MockMultipartHttpServletRequest? Getting "no multipart boundary was found"
upvote count: 10
has answer: http://stackoverflow.com/a/30987345
linked to: http://stackoverflow.com/q/9474813
tagged with: servlets
has answer: http://stackoverflow.com/a/79002846
downvote count: 0
answer count: 7
favorite count: 0
linked to: http://stackoverflow.com/q/2305218
has comment: http://stackoverflow.com/comment/34484671

http://stackoverflow.com/comment/34298643
has text: I'll +1 if you put the "salt and hash" first :-)
comment on: http://stackoverflow.com/a/22537706
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34317396
score: 0
type: Comment
type: QuestionComment
has text: ---> Found the problem. I was running the html file from my local machine by accessing the directory. Looks like the Origin header is null for such requests. All our requests have to be processed from the server. (So the home screen has to be served by the socket server).
comment on: http://stackoverflow.com/q/22540851

javascript
tags question: http://stackoverflow.com/q/22529590
tags question: http://stackoverflow.com/q/22505347
tags question: http://stackoverflow.com/q/22607791
tags question: http://stackoverflow.com/q/22521800
tags question: http://stackoverflow.com/q/22494544
tags question: http://stackoverflow.com/q/22606950
tags question: http://stackoverflow.com/q/22545422
tags question: http://stackoverflow.com/q/22584504
tags question: http://stackoverflow.com/q/22581609
tags question: http://stackoverflow.com/q/22500753
tags question: http://stackoverflow.com/q/22582023
tags question: http://stackoverflow.com/q/22603314
tags question: http://stackoverflow.com/q/22596469
tag name: javascript
tags question: http://stackoverflow.com/q/22489229
tags question: http://stackoverflow.com/q/22538160
tags question: http://stackoverflow.com/q/22599419
tags question: http://stackoverflow.com/q/22611686
tags question: http://stackoverflow.com/q/22497518
tags question: http://stackoverflow.com/q/22578452
tags question: http://stackoverflow.com/q/22602680
tags question: http://stackoverflow.com/q/22573264
tags question: http://stackoverflow.com/q/22550730
tags question: http://stackoverflow.com/q/22604986
tags question: http://stackoverflow.com/q/22626465
tags question: http://stackoverflow.com/q/22607229
tags question: http://stackoverflow.com/q/22565139
tags question: http://stackoverflow.com/q/22634428
type: Tag
tags question: http://stackoverflow.com/q/22534294
tags question: http://stackoverflow.com/q/22634007
tags question: http://stackoverflow.com/q/22579540
tags question: http://stackoverflow.com/q/22607361
tags question: http://stackoverflow.com/q/22508930
tags question: http://stackoverflow.com/q/22516514
tags question: http://stackoverflow.com/q/22563331
tags question: http://stackoverflow.com/q/22522945
tags question: http://stackoverflow.com/q/22565462
tags question: http://stackoverflow.com/q/22519254
tags question: http://stackoverflow.com/q/22638063
tags question: http://stackoverflow.com/q/22489175
tags question: http://stackoverflow.com/q/22610602
tags question: http://stackoverflow.com/q/22632774
tags question: http://stackoverflow.com/q/22585743
tags question: http://stackoverflow.com/q/22504160
tags question: http://stackoverflow.com/q/22618136
tags question: http://stackoverflow.com/q/22613278
tags question: http://stackoverflow.com/q/22566817
tags question: http://stackoverflow.com/q/22583342
tags question: http://stackoverflow.com/q/22572689
tags question: http://stackoverflow.com/q/22514070
tags question: http://stackoverflow.com/q/22594688
tags question: http://stackoverflow.com/q/22608017
tags question: http://stackoverflow.com/q/22553292
tags question: http://stackoverflow.com/q/22584829
tags question: http://stackoverflow.com/q/22564375
tags question: http://stackoverflow.com/q/22491017
tags question: http://stackoverflow.com/q/22568744
tags question: http://stackoverflow.com/q/22540851
tags question: http://stackoverflow.com/q/22548148
tags question: http://stackoverflow.com/q/22549429
tags question: http://stackoverflow.com/q/22494343
tags question: http://stackoverflow.com/q/22538457
tags question: http://stackoverflow.com/q/22574396
tags question: http://stackoverflow.com/q/22628315
tags question: http://stackoverflow.com/q/22644441
tags question: http://stackoverflow.com/q/22521346
tags question: http://stackoverflow.com/q/22517738
tags question: http://stackoverflow.com/q/22508773

http://stackoverflow.com/a/22606208
type: Answer
score: 0
has body: No, The targets of diagraming are: better understanding and readability of your concepts, and cheap preliminary testing of them. So, you needn't write diagrams for algorithms that are trivial and/or widely known, or are imported as a black box from some external resource. Also, don't forget that for many programmers reading code is more easy than reading a sequence diagram. If you work in such team, making diagrams for lower level algorithms has no extra use in comparison to simply good commenting and structuring of the code.
answers question: http://stackoverflow.com/q/22584044

http://stackoverflow.com/comment/36974895
score: 0
type: Comment
has text: I just installed sonarqube-4.3 and did the Update Center upgrade to java-2.2.1. Anything else I need to do? Here the jacoco-files I can find in install-dir: ./extensions/plugins/sonar-jacoco-plugin-2.2.1.jar ./lib/bundled-plugins/sonar-jacoco-plugin-2.1.jar ./web/deploy/plugins/jacoco/META-INF/lib/asm-debug-all-5.0.jar ./web/deploy/plugins/jacoco/META-INF/lib/org.jacoco.agent-0.7.0.201403182114.jar ./web/deploy/plugins/jacoco/META-INF/lib/org.jacoco.core-0.7.0.201403182114.jar ./web/deploy/plugins/jacoco/sonar-jacoco-plugin-2.2.1.jar
type: AnswerComment
comment on: http://stackoverflow.com/a/23312000

http://stackoverflow.com/q/22598177
answer count: 3
has answer: http://stackoverflow.com/a/22598219
has title: How to parse a string with regex?
possible better answer: http://stackoverflow.com/a/22598247
has answer: http://stackoverflow.com/a/22598202
tagged with: regex
tagged with: parsing
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22598247
tagged with: java
has body: How to retrive DELETE string from ROLE_DELETE_USER with reqular expression? String role = "ROLE_DELETE_USER"; Pattern pattern = Pattern.compile("???"); Matcher matcher = pattern.matcher(role); System.out.println(matcher.group());
accepted answer: http://stackoverflow.com/a/22598219
score: 0

http://stackoverflow.com/q/22629534
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1384802
tagged with: java
has body: I have a java code which writes the output to an XML by using DOM parsing strategy. The contents of the XML after writing it are as follows &lt;L-1&gt;&lt;?xm-replace_text {L-1}?&gt;&lt;/L-1&gt; Now if I rewrite the same XML after making some changes, the contents of XML after writing will be as follows &lt;L-1&gt; &lt;?xm-replace_text {L-1}?&gt; &lt;/L-1&gt; I am using the same transformer every time I write the XML as encoding = (doc.getXmlEncoding() != null) ? doc.getXmlEncoding() : "iso-8859-1"; version = (doc.getXmlVersion() != null) ? doc.getXmlVersion() : "1.0"; TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, encoding); transformer.setOutputProperty(OutputKeys.VERSION, version); Why do I have the indentation problem ?
tagged with: dom
type: Question
has answer: http://stackoverflow.com/a/22629931
score: 0
has title: How to maintain the same indentation while rewriting an xml from java?
answer count: 1

http://stackoverflow.com/q/22626920
type: Question
linked to: http://stackoverflow.com/q/2068961
score: 1
tagged with: java
tagged with: eclipse
has title: Eclipse giving me XML junk in console instead of running program
has comment: http://stackoverflow.com/comment/34458295
upvote count: 1
downvote count: 0
answer count: 1
favorite count: 0
has body: Note: I am running Eclipse ADT Build: v22.2.1-833290 Example: I have the java code: File: HelloWorld.java public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } Works just fine if a compile and run at the console. However, when I run this file in Eclipse, I get the garbage shown below. I trust computers enough to know that Eclipse is giving me exactly what I am asking it to give me, meaning that I've got some switch set somewhere. The question is, how do I get Eclipse to stop giving me what I asked for and actually give me what I want? Update I was using the "Run" button on the toolbar, as per usual, but I found that if I used the context menu Run As --> Java Application, it would run fine, and then run fine after that with just the button. I must have something messed up about the default run configuration. Is there a way to set that properly? Really, just a small annoyance at this point. &lt;ConnectionProperties&gt; &lt;PropertyCategory name="Connection/Authentication"&gt; &lt;Property name="user" required="No" default="" sortOrder="-2147483647" since="all versions"&gt; The user to connect as &lt;/Property&gt; &lt;Property name="password" required="No" default="" sortOrder="-2147483646" since="all versions"&gt; The password to use when connecting &lt;/Property&gt; &lt;Property name="socketFactory" required="No" default="com.mysql.jdbc.StandardSocketFactory" sortOrder="4" since="3.0.3"&gt; The name of the class that the driver should use for creating socket connections to the server. This class must implement the interface 'com.mysql.jdbc.SocketFactory' and have public no-args constructor. &lt;/Property&gt; &lt;Property name="connectTimeout" required="No" default="0" sortOrder="9" since="3.0.1"&gt; Timeout for socket connect (in milliseconds), with 0 being no timeout. Only works on JDK-1.4 or newer. Defaults to '0'. &lt;/Property&gt; &lt;Property name="socketTimeout" required="No" default="0" sortOrder="10" since=…
has comment: http://stackoverflow.com/comment/34457648
has comment: http://stackoverflow.com/comment/34458505
has answer: http://stackoverflow.com/a/22644154
has comment: http://stackoverflow.com/comment/34583655
linked to: http://stackoverflow.com/q/12220161
has comment: http://stackoverflow.com/comment/34458464
type: UnansweredQuestion

http://stackoverflow.com/comment/34419671
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22605943
type: Comment
has text: For a long time now, the current working directory is on the classpath automatically if you don't manually provide a classpath yourself. I can accept your answer as correct if you replace '.' with an absolute path.

http://stackoverflow.com/comment/34522110
type: Comment
comment on: http://stackoverflow.com/a/22656290
score: 0
type: AnswerComment
has text: That looks promising, but is there a way with this API to create the meeting on behalf of a user whose password I don't have?

http://stackoverflow.com/q/22518396
downvote count: 0
has answer: http://stackoverflow.com/a/22519379
tagged with: alfresco
has body: I have a couple test functions I've written to illustrate a problem (or at least some behavior that I don't understand). I am just doing some basic CMIS queries on an Alfresco 4.2.e community repository, but am getting some unexpected results depending on whether I use session.query() or session.queryObjects(). Specifically, the queryObjects doesn't return properties for custom aspects. Both return the relationships/associations fine. Am I doing something wrong, or is this a bug? I'm using opencmis 0.10, and the CMIS 1.1 URL. private static Collection&lt;Document&gt; testCmisObjectQuery(Session session) { List&lt;Document&gt; rv = new LinkedList&lt;&gt;(); OperationContext opCon = session.createOperationContext(); opCon.setLoadSecondaryTypeProperties(true); opCon.setIncludeRelationships(IncludeRelationships.BOTH); ItemIterable&lt;CmisObject&gt; cmisObjs = session.queryObjects("D:af:insuringFormInstance", null, false, opCon); for (CmisObject o : cmisObjs) { Document d = (Document) o; rv.add(d); printDocProps(d); } return rv; } private static Collection&lt;Document&gt; testCmisQuery(Session session) { List&lt;Document&gt; rv = new LinkedList&lt;&gt;(); String queryString = "SELECT cmis:objectId FROM af:insuringFormInstance"; OperationContext opCon = session.createOperationContext(); opCon.setIncludeRelationships(IncludeRelationships.SOURCE); ItemIterable&lt;QueryResult&gt; results = session.query(queryString, false); for (QueryResult qResult : results) { String objectId = qResult.getPropertyValueByQueryName("cmis:objectId"); Document doc = (Document) session.getObject(session.createObjectId(objectId),opCon); printDocProps(doc); rv.add(doc); } return rv; }
favorite count: 0
linked to: http://stackoverflow.com/q/42689664
tagged with: cmis
has answer: http://stackoverflow.com/a/76880719
upvote count: 2
has title: CMIS session.queryObjects doesn't return aspects
type: UnansweredQuestion
score: 2
tagged with: opencmis
tagged with: java
type: Question
answer count: 2
tagged with: apache-chemistry

http://stackoverflow.com/comment/34226940
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22496964
has text: @Aurand please give me some hint i am not getting because i have never work in thread and i am not using any thread method

http://stackoverflow.com/q/22517141
type: UnansweredQuestion
tagged with: sockets
tagged with: android
has body: I use kryonet to handle data exchange on network with a game. But I have no idea why the TCP socket and the UDP socket went Non-blocking. So I would be happy to have some help. I have a class for the server and one for the client. package com.me.mygdxgame; import java.io.IOException; import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryonet.Connection; import com.esotericsoftware.kryonet.Listener; import com.esotericsoftware.kryonet.Server; public class Serveur { private static Serveur instance; private World world; private WorldController controller; private GameScreen hoteScreen; private boolean leftPressedHote = false; private boolean rightPressedHote = false; private boolean leftPressedClient = false; private boolean rightPressedClient = false; private Server serveur; private boolean connected = false; private Serveur() { serveur = new Server(); Kryo kryo = serveur.getKryo(); kryo.register(KeyInfo.class); kryo.register(World.class); serveur.addListener(new Listener(){ public void connected(Connection connection) { Serveur.getInstance().setConnected(true); } public void received (Connection connection, Object object) { if (object instanceof KeyInfo) { Serveur.getInstance().setKeyInfo((KeyInfo) object); connection.sendTCP(Serveur.getInstance().getWorld()); } } public void disconnected(Connection connection) { ClientThread.getInstance().setConnected(false); } }); } public void initialize(GameScreen hote) { world = new World(); controller = new WorldController(world); this.hoteScreen = hote; hoteScreen.setWorld(world); } public void start() throws IOException { serveur.start(); serveur.bind(54555, 54777); } public void stop() { serveur.stop(); Serveur.instance = null; } And here is the client code : package com.me.mygdxgame; import java.io.IOException; import java.net.InetAddress; import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryonet.Client; import com.esotericsoftware.kryonet.Connection; import com.esotericsoftware.kryonet.List…
score: 0
tagged with: java
type: Question
has title: Non wanted non-blocking socket with kryonet
answer count: 1
has answer: http://stackoverflow.com/a/22518479
tagged with: kryonet

http://stackoverflow.com/q/22505389
tagged with: java
has answer: http://stackoverflow.com/a/22507386
accepted answer: http://stackoverflow.com/a/22507386
has comment: http://stackoverflow.com/comment/34242914
has title: @Async and task:annotation-driven don't work
type: Question
has comment: http://stackoverflow.com/comment/34242843
has comment: http://stackoverflow.com/comment/34243219
upvote count: 2
has comment: http://stackoverflow.com/comment/34242015
answer count: 1
downvote count: 0
favorite count: 0
tagged with: multithreading
has body: I would make new thread that will work in the background. I'm trying use @Async and task:annotation-driven but application don't work. root-context.xml &lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/&gt; &lt;context:component-scan base-package="com.cebul.jez.model, com.cebul.jez.service, com.cebul.jez.useful, com.cebul.jez.flows, com.cebul.jez.asynch" /&gt; &lt;task:annotation-driven executor="myExecutor" scheduler="myScheduler" /&gt; AsyncWorker.java @Service public class AsyncWorker { @Async public void work() { String threadName = Thread.currentThread().getName(); while(true) { System.out.println(" " + threadName + " work"); try { Thread.sleep(30000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void cancel() { Thread.currentThread().interrupt(); } } In controller, I use it like this: @RequestMapping(value = {"/", "/home"}) public String home(Model model, HttpSession session){ asyncWorker.work(); //other code } If I try run it, I have exception: Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.cebul.jez.asynch.AsyncWorker com.cebul.jez.controllers.HomeController.asyncWorker; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.cebul.jez.asynch.AsyncWorker] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:506) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanP…
tagged with: maven
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/34220807
score: 1
has text: Yes, it should give you an error, unless you've either got two copies of the method, or one class extends the other; both of which would be wrong things to do. I can only speculate on _which_ particular wrong thing you happened to do, but don't blame it on the language. C# would do the same thing if you made the same mistake.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22492214

http://stackoverflow.com/a/22495594
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34224596
has comment: http://stackoverflow.com/comment/34224619
upvote count: 1
answers question: http://stackoverflow.com/q/22495558
has body: There's no reason to have separate arrays for face cards and lower-ranking cards. Make a single cards array hold all the card values and another to hold the suits: public static void main(String[] args){ Scanner input = new Scanner(System.in); String suits[] = {"H", "D", "C", "S"}; String cards[] = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A" }; Random random = new Random(); System.out.println(cards[random.nextInt(cards.length)] + suits[random.nextInt(suits.length)]); }

http://stackoverflow.com/comment/34359292
type: AnswerComment
score: 0
type: Comment
has text: I know you are adding the component to the CENTER by default. Try adding the component to the SOUTH and see what happens? `Here I am giving solution for logo part only. If you want then I can remove message part.` - that is my point. You are doing the OP's howework and you are doing it incorrectly so the OP won't learn the proper way to do custom painting. That is why you should refer the OP to the tutorial and let him learn (or make mistakes) on his own.
comment on: http://stackoverflow.com/a/22571742

http://stackoverflow.com/comment/34453104
comment on: http://stackoverflow.com/a/22624198
score: 0
type: AnswerComment
has text: @BrianVanover Note that `Collections.frequency(a, word)` counts the frequency in the *original* `ArrayList a`, rather than in the set.
type: Comment

http://stackoverflow.com/q/22633752
tagged with: sql
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/34470049
has title: How to start derby server from within my java application
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22634410
type: Question
has body: i have been working with EclipseLink of recent and after creating my java application, without me starting the derby server manually from netbeans (Services>Databases>JavaDB> Start Server) my application will not be able to connect to the database, i don't know what is wrong or how to go about this. i used this code from a new thread and this is what i get. public static class DBServerStarter extends Thread { NetworkServerControl serverControl; public DBServerStarter(){ try { serverControl = new NetworkServerControl(); } catch (Exception ex) { Logger.getLogger(ContactManager.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void run(){ try { serverControl.start(new PrintWriter(System.out)); } catch (Exception ex) { Logger.getLogger(ContactManager.class.getName()).log(Level.SEVERE, null, ex); } } } and my log look like Tue Mar 25 12:50:33 WAT 2014 : Apache Derby Network Server - 10.9.1.0 - (1344872) started and ready to accept connections on port 1527 [EL Info]: 2014-03-25 12:50:36.098--ServerSession(21798543)--EclipseLink, version: Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5 [EL Severe]: ejb: 2014-03-25 12:50:36.583--ServerSession(21798543)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLNonTransientConnectionException: The connection was refused because the database Contact was not found. Exception in thread "main" java.lang.ExceptionInInitializerError at com.prodigy4440.contactmanager.ContactManager.main(ContactManager.java:28) Error Code: 40000 Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLNonTransientConnectionException: The connection was refused because the database Contact was not found. Error Code: 40000 at org.eclipse.persistence.int…
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/49100126
type: AcceptedAnswer
downvote count: 0
has body: https://docs.python.org/3/library/xml.sax.handler.html and for an example of Bible in OSIS XML take a look at this script.
type: Answer
answers question: http://stackoverflow.com/q/22553401
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22553401
score: 1

http://stackoverflow.com/comment/34371901
score: 0
type: Comment
has text: @user3449760 Declare `String x2 = "some value"` before that line. and pass replace with that `x1`
comment on: http://stackoverflow.com/a/22579439
type: AnswerComment

http://stackoverflow.com/a/22518840
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22518729
has body: As the Java Language Specification states An import declaration allows a named type or a static member to be referred to by a simple name (§6.2) that consists of a single identifier. You are not referring to the name MyClass, so no import statement is needed.
answers question: http://stackoverflow.com/q/22518729
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/comment/34496399
type: QuestionComment
type: Comment
has text: you can't message people, but you can leave "@"-annotated comments on their questions with links to yours! I've done that on Max Dy's question for you.
score: 0
comment on: http://stackoverflow.com/q/22623188

http://stackoverflow.com/a/22647513
has comment: http://stackoverflow.com/comment/34518088
has body: Updating is not much different, see the .update() method in the documentation. But you will want the $set operator instead: DBObject queryx = new BasicDBObject("userEmail", "some@some.com"); queryx.put("idRest", 24); BasicDBObject document1 = new BasicDBObject(); document1.put("idRest", rest.getEmailUser()); document1.put("userPhone", rest.getPhoneUser()); document1.put("date", rest.getFecha()); document1.put("hour", rest.getHora()); DBObject update1 = new BasicDBObject(); update1.put("$set", new BasicDBObject("reservations.$", document1)); collReservationByUser.update(queryx, update1);` You also do not need all the fields so to just update "userPhone" change to this: BasicDBObject document1 = new BasicDBObject(); document1.put("reservations.$.userPhone", rest.getPhoneUser()); DBObject update1 = new BasicDBObject(); update1.put("$set", document1); collReservationByUser.update(queryx, update1);` This relies on the positional $ operator in order to work on the "matching" index of the array.
has comment: http://stackoverflow.com/comment/34518270
score: 0
answers question: http://stackoverflow.com/q/22646102
type: Answer

http://stackoverflow.com/comment/34245351
type: Comment
comment on: http://stackoverflow.com/q/22500669
has text: @EJP Also as I am in the learning phase I would like to complete this project using RC4 and then move on to other methods
score: 0
type: QuestionComment

http://stackoverflow.com/a/22582181
answers question: http://stackoverflow.com/q/22582086
score: 0
has body: By the time you draw the "spotlight", you've already darkened the image with the rectangle. It would be difficult to recover information lost during that draw. A more flexible approach would be to draw a dark rectangle with a spotlight in a separate image (that is, compose the "darkness" and spotlight alpha and color mask image first), and then draw that mask image on top of the background as a separate step. This would also let you easily do things like e.g. give the spotlight fuzzy borders.
type: Answer

http://stackoverflow.com/q/22618804
upvote count: 1
has body: my PC crashed yesterday and all my eclipse projects are gone since than. They are still in the File system but eclipse doesn't show them. I made a new workspace and imported all projects. But now android support v7 disappeared form my build path. I didn't include that project, the project wizard did it for compatibility reasons. Now i want to fix the problem and eclipse offered me to chooses, "add project 'android-support-v7-appcompat' to build path of 'my project'" or "add archive 'andoird-support-v7-appcompat.jar -path to android-support-v7-appcompat\libs'" . Which should i choose and why?
answer count: 0
score: 1
tagged with: java
tagged with: eclipse
has title: eclipse lost all my (android) projekts/ how to repair the workspace
type: Question
downvote count: 0
tagged with: workspace
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/34444722
type: Comment
comment on: http://stackoverflow.com/q/22619602
has text: What exactly do you mean by _can't split the code_? P.S. seeing empty catch blocks makes most developer's skin crawl; **never ever do this**. Not even for fun.
score: 0
type: QuestionComment

http://stackoverflow.com/a/26717500
score: 14
downvote count: 0
has body: The only thing you need to do is to draw the background, before drawing the Buttons. There are a few possible ways to do that: - You can add the background as an Image (subclass of Actor) to the Stage and use the z-index to make sure it is drawn as a background. - You can get the Stages SpriteBatch (stage.getBatch()) and use one of its draw methods to draw the background, before calling stage.draw() You could also use another SpriteBatch, but i don't recommend it, as it is a pretty "heavy" object and it is just not neccessaty in this case. I guess, before calling stage.draw() you need to call spritebatch.end(), for the SpriteBatch you used to draw the background.
upvote count: 14
answers question: http://stackoverflow.com/q/22536755
type: Answer

http://stackoverflow.com/a/22515057
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22514947
score: 4
has body: I believe you could do it with reflection with something like: YourClass classInstance = new YourClass(); for (int i = 1; i &lt; 6; i++) { Method yourMethod = YourClass.class.getMethod("met" + i); method.invoke(instance); } Haven't tested it out, so no guarantees.
type: Answer

http://stackoverflow.com/a/22541782
answers question: http://stackoverflow.com/q/22541747
has comment: http://stackoverflow.com/comment/34305894
has comment: http://stackoverflow.com/comment/34305669
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34306233
type: Answer
has body: readability. a switch statement becomes A LOT more readable as the number of cases goes up compared to the equivalent if-else chain performance. though not as important as the previous point, switch statements can be compiled into faster code than if-else chains. fall-through. a lot less important than the previous two, and rare enough to be flagged as a warning by some IDE's/tools, there are still cases where you can benefit from a fall-through (==no break after a particular case). this ties into readability again.
has comment: http://stackoverflow.com/comment/34306115
has comment: http://stackoverflow.com/comment/34306194
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/22541747

http://stackoverflow.com/a/22495524
has comment: http://stackoverflow.com/comment/34271524
upvote count: 1
has body: There are several problems with your code. You should check for error returned by setLanguage. You cannot call speakOut until onInit has been called. One way you can insure this is to disable the talk button in the xml layout file and enable it in onInit.
accepted answer of: http://stackoverflow.com/q/22488558
answers question: http://stackoverflow.com/q/22488558
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34270387
type: Answer

http://stackoverflow.com/comment/34383195
type: QuestionComment
has text: Any progress on that screenshot?
comment on: http://stackoverflow.com/q/22569995
score: 0
type: Comment

http://stackoverflow.com/q/22506281
has body: Hello guys I'm new to Java and would like to take this challenge myself, since I'm new I need some help from you. I have a Java string like this: String strTime = "8:44 PM"; I would like to get the hr, min and am/pm.. How can I do that? I'm also thinking if the hour is 2-digit? What else should I be considering? Thanks for your help. UPDATE: String[] parts[] = strTime.split(":"); String strHr = parts[0]; String strMin = parts[1]; String strAM = parts[2]; But I don't know how to capture for the other to be split like the space, etc.
tagged with: java
has comment: http://stackoverflow.com/comment/34241862
score: 0
has comment: http://stackoverflow.com/comment/34244508
has title: Get each part of a Java String
has comment: http://stackoverflow.com/comment/34241960
has comment: http://stackoverflow.com/comment/34242285
has comment: http://stackoverflow.com/comment/34244301
linked to: http://stackoverflow.com/q/1154903
has comment: http://stackoverflow.com/comment/34241977
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22506790
has comment: http://stackoverflow.com/comment/34241958
answer count: 4
linked to: http://stackoverflow.com/q/999172
has comment: http://stackoverflow.com/comment/34241932
has answer: http://stackoverflow.com/a/22506442
has answer: http://stackoverflow.com/a/22506456
type: Question
has answer: http://stackoverflow.com/a/22506526

http://stackoverflow.com/comment/34334862
comment on: http://stackoverflow.com/q/22548148
has text: That's interesting. Did you compile with -O2? and what values did you initialize the variables with? Where they constants like `= 0;` or something more complex?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22634774
has comment: http://stackoverflow.com/comment/34472558
upvote count: 2
has comment: http://stackoverflow.com/comment/34474936
has comment: http://stackoverflow.com/comment/34476651
has comment: http://stackoverflow.com/comment/34473472
has comment: http://stackoverflow.com/comment/34477713
has comment: http://stackoverflow.com/comment/34477614
has comment: http://stackoverflow.com/comment/34475731
has comment: http://stackoverflow.com/comment/34478046
has body: Assuming your StockListRunningBean uses JavaFX observable properties, so that the TableView sees the changes, you shouldn't need to do anything additional to update the table. One problem with your code is that you're making changes to the UI (via changes to the StockListRunningBean price property) from a thread that's not the FX Application Thread. Try this refactoring: for (final StockListBean stockListBean : list) { final int code = stockListBean.getCode(); // assuming int, change as required final Task&lt;Float&gt; task = new Task&lt;Float&gt;() { @Override protected Float call() throws Exception { logger.debug("In jfx task for {}", code); return stocksListMService.getActualPrice(code); } }; task.setOnSucceeded(new EventHandler&lt;WorkerStateEvent&gt;() { @Override public void handle(WorkerStateEvent event) { ((StockListRunningBean)stockListBean).setActualPrice(task.getValue()); } }); executor.execute(task); } Again, this assumes that your StockListRunnerBean has a public FloatProperty actualPriceProperty() {...} method and that the table column is properly bound to it.
accepted answer of: http://stackoverflow.com/q/22632993
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34479384
has comment: http://stackoverflow.com/comment/34475317
downvote count: 0
has comment: http://stackoverflow.com/comment/34474797
has comment: http://stackoverflow.com/comment/34472460
has comment: http://stackoverflow.com/comment/34472659
answers question: http://stackoverflow.com/q/22632993
has comment: http://stackoverflow.com/comment/34476546
type: Answer
has comment: http://stackoverflow.com/comment/34478223
score: 2
has comment: http://stackoverflow.com/comment/34474074

http://stackoverflow.com/comment/34378774
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22582770
has text: I always go step by step. Do the above, then extract the then-block into another method; then you'll have a compact series of else-ifs where just the numbers change. Then you may come up with something further.
score: 0

http://stackoverflow.com/q/22518154
has comment: http://stackoverflow.com/comment/34265883
has comment: http://stackoverflow.com/comment/34265588
has answer: http://stackoverflow.com/a/22520207
type: Question
has body: I have the following problem. First of all, I'm send request from jsp to servlet, then I'm doing some operation, and put some data to request, and forward to the same page for rendering new data. But after forwarding, my jsp page doesn't update. Can anyone say me, what I'm doing wrong? <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> File Viewer Ftp server: / <c:forEach items="${requestScope.files}" var="fileEntity"> ${fileEntity.name} </c:forEach> This is my servlet @WebServlet("/ftp") public class FileServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doPost(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { FileManager fileManager = FileManager.getInstance(); String requestedFileName = req.getParameter("fileName"); req.setAttribute("files", fileManager.getAllFilesByPath(requestedFileName)); getServletContext().getRequestDispatcher("/test.jsp").forward(req, resp); } }
has comment: http://stackoverflow.com/comment/34264860
tagged with: java
has title: Jsp page doesn't updated after forward
tagged with: servlets
has comment: http://stackoverflow.com/comment/34264153
score: 0
has comment: http://stackoverflow.com/comment/34264527
has comment: http://stackoverflow.com/comment/34264372
answer count: 1
tagged with: jsp
accepted answer: http://stackoverflow.com/a/22520207
has comment: http://stackoverflow.com/comment/34265786
has comment: http://stackoverflow.com/comment/34265466
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34265547
has comment: http://stackoverflow.com/comment/34264087

http://stackoverflow.com/comment/34407274
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22546743
has text: Take a look at [How to use Lists]http://docs.oracle.com/javase/tutorial/uiswing/components/list.html). Basically, the `JList` will simply show all the students in the file. When you click on an item in the list, you can use a `ListSelectionListener` to monitor the change and refresh the UI (ie get the selected name and display it in a `JTextField`). If the user selects the "save" button, you would simply need to update the `ListModel`...

http://stackoverflow.com/comment/34403539
type: QuestionComment
has text: @Puru-- this is in `Future`'s contract; once the computation is over, the result is retained (until the reference to the `Future` falls out of scope of course)
comment on: http://stackoverflow.com/q/22596489
score: 1
type: Comment

http://stackoverflow.com/q/22572523
has title: Adding an array of text buttons to a grid lay out
has answer: http://stackoverflow.com/a/22572531
accepted answer: http://stackoverflow.com/a/22572531
tagged with: swing
has comment: http://stackoverflow.com/comment/34360153
tagged with: jbutton
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: grid-layout
upvote count: 1
answer count: 1
downvote count: 0
tagged with: nullpointerexception
has body: I am not sure exactly what I am doing wrong here, I want to create a grid lay out using a Jbutton array, however it is giving me a " null Pointer exception ". Can't seem to find exactly how to place the JButtons on the panel. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class GridLayout extends JFrame { private final int HEIGHT = 200; private JPanel panel; private final int WIDTH = 200; public GridLayout () { setTitle( " try this"); setSize( HEIGHT, WIDTH); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); JButton [] but = new JButton [9]; for(int i = 0; i &lt; 9; i++ ) { but[i]=new JButton(); } for ( int i = 0; i &lt; 9;i++) { panel.add(but[i]); } setVisible(true); } public static void main(String[] arg) { new FlowWindow(); } }
favorite count: 0

http://stackoverflow.com/comment/34275461
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22524780
has text: `System.currentTimeMillis()` is in mili seconds , `start` is in `nanoseconds` ....

http://stackoverflow.com/a/22564725
has comment: http://stackoverflow.com/comment/34345583
has comment: http://stackoverflow.com/comment/34345403
has comment: http://stackoverflow.com/comment/34345442
has body: In short, init code in first case will be called before constructor, in second - after. Check out this question. General rule is to avoid constructions like theese and use static-factory-methods instead. Order might matter then calling this() instead of super(): Consider code: public class InitOrderTest { static class Super { Super() { System.out.println("Super constructor"); } } static class Puper extends Super { { System.out.println("Code block"); } Puper() { this("Self constructor"); init(); } public Puper(String inner) { System.out.println(inner); } private void init() { System.out.println("Init call"); } } public static void main(String[] args) { new Puper(); } } It prints: Super constructor Code block Self constructor Init call
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22564466

http://stackoverflow.com/q/22573228
tagged with: java
has answer: http://stackoverflow.com/a/24275746
score: 0
answer count: 1
has title: how to get static map image from google maps url. Java
accepted answer: http://stackoverflow.com/a/24275746
type: AnsweredQuestion
tagged with: maps
has body: I am currently working on a java application in netbeans, which I require to display a map in the JFrame. I need to get a map that I created before so I have the url, but I just need to be an image (jpg or png). for example this map: https://www.google.co.ve/maps/dir/8.0969559,-63.5596847/Ciudad+Bol%C3%ADvar/@8.116559,-63.5568846,14z/am=t/data=!4m9!4m8!1m0!1m5!1m1!1s0x8dce862a669e5b7b:0xd96f2f60189fcd57!2m2!1d-63.55!2d8.122!3e0?hl=es or https://goo.gl/maps/0EFUd from that url I get an image to load in my JFrame. Any idea how to do it?
type: Question

http://stackoverflow.com/a/33414086
score: 0
answers question: http://stackoverflow.com/q/22566191
has body: The following Stackexchange question and answer worked for me. It uses a filter instead of and artifactSet exclude. I have tried the solutions in the above answer and it didn't work. "Invalid signature file" when attempting to run a .jar
type: Answer

http://stackoverflow.com/a/22589270
upvote count: 3
has comment: http://stackoverflow.com/comment/34393657
accepted answer of: http://stackoverflow.com/q/22578486
answers question: http://stackoverflow.com/q/22578486
has comment: http://stackoverflow.com/comment/34393905
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
has body: I think that you mean that you want to hide the tick labels for the Y axis, but still want to see the label for the axis itself. Am I correct? You can do that with: axis1.setTickLabelsVisible(false); Okay, if you want to: hide the label in the chart but still have it in the NumberAxis Then there is one solution, that isn't perfect either, that you could use. If you set the "attributed label" (a label with extra font markup attributes), it will draw the attributed label instead. You can set it to a single space (a zero-length string doesn't work - the font rendering code doesn't allow that). rangeAxis.setAttributedLabel(" "); At least axis1.getLabel() will still return your old label, but that's the only benefit of this that I can see. Otherwise, you can subclass NumberAxis and override the method drawLabel in the subclass to do nothing: protected AxisState drawLabel(String label, Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, AxisState state) { return state; }

http://stackoverflow.com/a/22625520
type: Answer
has comment: http://stackoverflow.com/comment/34455395
has comment: http://stackoverflow.com/comment/34455461
upvote count: 3
has comment: http://stackoverflow.com/comment/34455431
score: 3
has comment: http://stackoverflow.com/comment/34455294
has body: Note, this answer applies to Java. I am not a C# expert. I believe you want public interface Response&lt;T&gt; { void output(T arg); } Then you can write public class ClassA implements Response&lt;String&gt; { public void output(String arg) { // etc and also public class ClassB implements Response&lt;Comment&gt; public void output(Comment arg) { // etc
accepted answer of: http://stackoverflow.com/q/22625417
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22625417
has comment: http://stackoverflow.com/comment/34455508

http://stackoverflow.com/q/22512100
has comment: http://stackoverflow.com/comment/34279260
type: Question
tagged with: java
tagged with: eclipse
has body: I have tried to install the package jre-7u51-macosx-x64.dmg because I was told Eclipse´s PyDev Python extension needs it to work on Mavericks. Problem was that the JRE package would not even show up. The installer completed itself, the online check verified that I have the Java version installed, but when I looked in the directory it was empty! Checking with commands from terminal verified that the package could not be found from anywhere. Is this normal for Oracle software? I have never found software that says it installed ok but cant be found from the hd... I installed the JDK and it worked fine. Any ideas what I might have done wrong, or is the software really so bad? Or maybe it is an Apple issue, since I had the same problme with Python 3.4 packages. It shows as installed, yet cannot be found anywhere.
score: 0
tagged with: pydev
has comment: http://stackoverflow.com/comment/34276307
has comment: http://stackoverflow.com/comment/34279066
tagged with: python
tagged with: macos
answer count: 0
has comment: http://stackoverflow.com/comment/34252538
type: UnansweredQuestion
has title: Unable to install JRE 7_51 on OSX Mavericks

http://stackoverflow.com/comment/34251725
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22511689
has text: what are you trying to achieve? what is the result you expect?
score: 2

http://stackoverflow.com/q/22548362
tagged with: onlongclicklistener
answer count: 0
tagged with: java
tagged with: selection
type: Question
has comment: http://stackoverflow.com/comment/34318409
has comment: http://stackoverflow.com/comment/34319095
has title: onClick and onLongClick Selection in Textview
score: 0
has body: I have searched for the answer to this question for a couple of days with no result. When using onClick on a TextView I get the desired result of selecting the word clicked by using: textView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(final View arg0) { Spannable span = (Spannable)textView.getText(); Layout layout = textView.getLayout(); Toast.makeText(arg0.getContext(), "Selection: " + Selection.getSelectionStart(textView.getText().toString()) + Selection.getSelectionEnd(textView.getText().toString()), Toast.LENGTH_SHORT).show(); // returns -1, -1 Toast.makeText(arg0.getContext(), "Selection: " + textView.getSelectionStart() + textView.getSelectionEnd(), Toast.LENGTH_SHORT).show(); //returns -1, -1 Selection.moveToLeftEdge(span, layout); Selection.extendToRightEdge(span, layout); final int start = textView.getSelectionStart(); final int end = textView.getSelectionEnd(); String string = textView.getText().toString().substring(start, end); AlertDialog.Builder builder = new AlertDialog.Builder(arg0.getContext()); builder.setTitle("Delete: " + string) .setMessage("Are you sure? This operation can't be undone!") .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteItem(start, end); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }) .show(); return true; } }); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Spannable span = (Spannable)textView.getText(); Layout layout = textView.getLayout(); Selection.moveToLeftEdge(span, layout); Selection.extendToRightEdge(span, layout); writeStrikes(textView.getSelectionStart(), textView.getSelectionEnd()); } }); When I try using the same code for an onLongClick the selection is -1, -1. If I return false from onLongClick the next selection is where the last shou…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34318692
tagged with: android
has comment: http://stackoverflow.com/comment/34361064

http://stackoverflow.com/q/22610179
score: 0
has title: Cannot Use Openshift Client Tools
answer count: 2
type: UnansweredQuestion
has body: I am having a hard time with the OpenShift client tools on Ubuntu. It keeps asking for a password which I am now confused about. Issuing rhc apps command displays the following message : Please sign in to start a new session to openshift.redhat.com. I entered my openshift account password but got a message that it was invalid. What password is required here ??
tagged with: ubuntu-10.04
has answer: http://stackoverflow.com/a/22610588
tagged with: openshift
type: Question
tagged with: java
tagged with: ubuntu
tagged with: openshift-client-tools
has answer: http://stackoverflow.com/a/22610486

http://stackoverflow.com/comment/34270144
comment on: http://stackoverflow.com/q/22520531
score: 0
type: Comment
type: QuestionComment
has text: Oh wait I don't call that method, because I thought it is a void?

http://stackoverflow.com/comment/34476535
type: AnswerComment
score: 0
type: Comment
has text: Thanks a lot!! your answer helped.. now I am getting the correct output !! :)
comment on: http://stackoverflow.com/a/22637779

http://stackoverflow.com/q/22512627
has title: Mapreduce give error Conversion string date
has comment: http://stackoverflow.com/comment/34253442
has answer: http://stackoverflow.com/a/22513616
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22522806
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
score: 0
has body: In mapreduce, Reducer class in public static class Reduce1 extends MapReduceBase implements Reducer&lt;Text, Text, Text, Text&gt; { public void reduce(input,input,output,output) throws IOException { String fromdate="2014-03-19 20:20:20"; SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startDate=sdf.parse(fromdate); } } It gives follwing error at compile time unreported exception java.text.ParseException; must be caught or declared to be thrown Any one knows solution and why this error is coming. Thanks in advance
has answer: http://stackoverflow.com/a/22512686
answer count: 3

http://stackoverflow.com/comment/34335970
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22559498
has text: But how to do loop on the List ? List.size() does not work apparently.

http://stackoverflow.com/comment/34389751
type: AnswerComment
comment on: http://stackoverflow.com/a/22551241
type: Comment
score: 2
has text: In windows xp you have to self uncompress the exe. At least in my case i saw no src.zip

http://stackoverflow.com/a/22578197
has body: Two approaches: Implement a hashcode for your objects, and compare the hashcode of the in-memory objects against the hashcode of the serialized objects to see if they've been changed. This is has a low impact on your class design, but performance will go down as O(n^2) as the number of objects increases. Note that two objects might return the same hashcode, but a good hashing implementation will make this very unlikely. If you are concerned about this, implement and use your own equals() method. Have your objects implement the Observer pattern and have each setter method, or any other method that modifies the object, notify the observer when it's called. Performance will be better for large numbers of objects (as long as they aren't changing constantly), but it requires you to introduce Observer code into possibly lightweight classes. Java provides a utility interface for Observable, but you'll still need to do most of the work.
upvote count: 5
has comment: http://stackoverflow.com/comment/34370128
score: 5
has comment: http://stackoverflow.com/comment/34370467
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22578017
accepted answer of: http://stackoverflow.com/q/22578017

http://stackoverflow.com/q/22647619
has comment: http://stackoverflow.com/comment/34494827
type: UnansweredQuestion
upvote count: 1
tagged with: methods
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34494370
has comment: http://stackoverflow.com/comment/34495151
has answer: http://stackoverflow.com/a/22648714
has comment: http://stackoverflow.com/comment/34494534
score: 0
has answer: http://stackoverflow.com/a/22648391
tagged with: arrays
has comment: http://stackoverflow.com/comment/34496662
favorite count: 0
has answer: http://stackoverflow.com/a/22647767
has comment: http://stackoverflow.com/comment/34494515
has title: I want a method that accepts an array, low number, high number. and returns an array with only numbers in between that
has body: public static int [] filterRange(int [] array, int low, int high){ int numbers = 0; for (int i = 0; i &lt; array.length; i++){ if (i &lt;= high &amp;&amp; i &gt;= low){ numbers ++; } } int array1 [] = new int [numbers]; for (int i = 0; i &lt; array.length; i++){ if (i &lt;= high &amp;&amp; i &gt;= low){ array1[i] = array[i]; } } return array1; } I'm trying to write a method that doesn't use any built in functions. It accepts an array of numbers, a low value , and a high value and returns a new array that has only the numbers in between the high and low value, as well as the high and low value if applicable. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at Question_1.filterRange(Question_1.java:41) at Question_1.main(Question_1.java:13) This is the error message I'm getting.
has comment: http://stackoverflow.com/comment/34494753
answer count: 4
has answer: http://stackoverflow.com/a/22648312
has comment: http://stackoverflow.com/comment/34494243

http://stackoverflow.com/comment/34352028
comment on: http://stackoverflow.com/a/22568285
type: Comment
has text: But I want to create multiple objects based on this class. That's to say, I cannot initialize all 'salary' with the value 1_000_000L.
score: 0
type: AnswerComment

deployment
tags question: http://stackoverflow.com/q/22637621
tag name: deployment
tags question: http://stackoverflow.com/q/22550344
tags question: http://stackoverflow.com/q/22524337
tags question: http://stackoverflow.com/q/22583223
type: Tag
tags question: http://stackoverflow.com/q/22535969
tags question: http://stackoverflow.com/q/22567174

http://stackoverflow.com/comment/34292235
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22533527
score: 0
has text: @PhilippeGioseffi: With `param` tag: ` value1 `.

http://stackoverflow.com/comment/34265134
has text: Then look into boxing conversion.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22518907

http://stackoverflow.com/comment/34484827
comment on: http://stackoverflow.com/q/22633470
score: 0
type: Comment
type: QuestionComment
has text: im sory sir, should i re-edit my post to the original ?

http://stackoverflow.com/q/22497751
answer count: 1
linked to: http://stackoverflow.com/q/2467362
has answer: http://stackoverflow.com/a/22506795
favorite count: 0
has comment: http://stackoverflow.com/comment/34228013
upvote count: 3
has comment: http://stackoverflow.com/comment/34227988
has body: I need to create small files to save basic information. I can't read and write from the files once my project is exported as a JAR, so I created a folder to store the files outside of the src folder. This only works if I set the external folder to be a source folder. This is the code where I create the folder File f = new File("Characters"); try{ if(f.mkdir()) { System.out.println("Directory created"); } else { System.out.println("Directory not created"); } } catch(Exception e){ e.printStackTrace(); } How can I programmatically set this folder to be a source folder? I hope this is specific enough.
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34228848
tagged with: java
has comment: http://stackoverflow.com/comment/34228485
tagged with: eclipse
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34228687
accepted answer: http://stackoverflow.com/a/22506795
has comment: http://stackoverflow.com/comment/34232031
has title: How can I programmatically set a source folder in Eclipse?

http://stackoverflow.com/a/22604689
downvote count: 0
has body: use jstl's set method in the parent jsp and use the same variable in jspf. In parent jsp. <c:set var="foo" value="bar"/> In included jspf. The included parameter is ${foo} Also you can access all the attributes set inside a servlet using request.setAttribute() in the jsp page using EL e.g ${attributeName}
answers question: http://stackoverflow.com/q/22604639
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/34271780
comment on: http://stackoverflow.com/a/22522589
score: 0
type: AnswerComment
has text: So if I have 10000 lines, how do I do this? The while loop doesn't seem to work.
type: Comment

http://stackoverflow.com/comment/34484437
type: AnswerComment
score: 0
type: Comment
has text: But it doesn't change anything - the 'session' still won't be created when I call this method from a servlet (but the problem wont appear when I call that method from anywhere else).
comment on: http://stackoverflow.com/a/22642081

http://stackoverflow.com/q/22558160
answer count: 1
has body: I am building my gradle project and getting following issue.Please Help me out i am new in android programming No Signature found of method : org.gradle.api.internal.articraft.dsl.dependencies.defualtDependdencyHandler.compiler() is applicable for argument type : values : com.google.android.gms:play-source:4.0.30] My Gradle.build has following : apply plugin: 'android-library' buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.7.+' compile 'com.google.android.gms:play-services:3.1.+' compile 'net.hockeyapp.android:HockeySDK:3.0.+' compile fileTree(dir: 'libs', include: '*.jar') compile 'com.android.support:support-v4:18.0.+' compile 'com.android.support:appcompat-v7:18.0.+' } } android { compileSdkVersion 19 buildToolsVersion "19.0.1" sourceSets { main { java.srcDirs = ['src'] res.srcDirs = ['src/main/res'] manifest.srcFile 'src/main/AndroidManifest.xml' } } } Please let me know if i am misisngs ome thing Thanks in Advance
has title: Build Failed Evaluating root project - Gradle
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23951228
tagged with: java
tagged with: eclipse
tagged with: gradle
type: Question
score: 0

http://stackoverflow.com/comment/34382111
type: Comment
type: QuestionComment
has text: Global transition should be below the view state and above the end state. Reaarange it and try.
score: 0
comment on: http://stackoverflow.com/q/22556344

http://stackoverflow.com/comment/34471157
type: AnswerComment
comment on: http://stackoverflow.com/a/22634454
type: Comment
has text: I tried also using executeUpdate() method it return 0 but when i checked the table noting was found
score: 0

http://stackoverflow.com/comment/34317952
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22547864
score: 0
has text: @JamesKhoury The exact quote was: "For this last program, we are going to build a class that reads one line at a time from a file and uses a callback (interface) to process each line.". Also, I figured out a few things, so refresh the page because is going to be very different.

http://stackoverflow.com/q/22575304
linked to: http://stackoverflow.com/q/504103
has comment: http://stackoverflow.com/comment/34365138
has comment: http://stackoverflow.com/comment/34364788
has comment: http://stackoverflow.com/comment/34364711
favorite count: 0
has comment: http://stackoverflow.com/comment/34364942
has comment: http://stackoverflow.com/comment/34364809
has answer: http://stackoverflow.com/a/22575982
has comment: http://stackoverflow.com/comment/34364918
has title: Why is "or" slower than "and" in Java?
has answer: http://stackoverflow.com/a/22576090
has comment: http://stackoverflow.com/comment/34365182
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/22575982
has comment: http://stackoverflow.com/comment/34364866
has comment: http://stackoverflow.com/comment/34364811
upvote count: 3
linked to: http://stackoverflow.com/q/180158
tagged with: java
has body: Today I encountered a rather amazing behavior in java, or is slower than and! I even made a test case that you can see at the below.Now I wonder why this happens? Am I doing something wrong or does it happen just on my computer? I don't see any reason that or should be slower than and specially with this significant difference. I want to test this phenomenon with some other languages, do you have any idea about this in general? public class TestClass { public static void main(String[] args) { long[] or = new long[10]; long[] and = new long[10]; long lStartTime, lEndTime, difference = 0; for (int idx = 0; idx &lt; 10; idx++) { lStartTime = System.nanoTime(); for (int i= 0; i &lt; 1000000000; i++) { int j = i | i+1 ; } lEndTime = System.nanoTime(); difference = lEndTime - lStartTime; System.out.println("Elapsed milliseconds: " + difference/1000000); or[idx] = difference; lStartTime = System.nanoTime(); for (int i= 0; i &lt; 1000000000; i++) { int j = i &amp; i+1 ; } lEndTime = System.nanoTime(); difference = lEndTime - lStartTime; System.out.println("Elapsed milliseconds: " + difference/1000000); and[idx] = difference; System.out.println("------------------------------------" ); } long tmp = 0; for (long l : or) { tmp += l; } tmp /= 10; System.out.println("Elapsed milliseconds for or: " + tmp/1000000); tmp = 0; for (long l : and) { tmp += l; } tmp /= 10; System.out.println("Elapsed milliseconds for and: " + tmp/1000000); } } results : Elapsed milliseconds: 1600 Elapsed milliseconds: 1332 ------------------------------------ Elapsed milliseconds: 1609 Elapsed milliseconds: 1335 ------------------------------------ Elapsed milliseconds: 1609 Elapsed milliseconds: 1335 ------------------------------------ Elapsed milliseconds: 1542 Elapsed milliseconds: 1314 ------------------------------------ Elapsed milliseconds: 1705 Elapsed milliseconds: 1324 ------------------------------------ Elapsed milliseconds: 1559 Elapsed milliseconds: 1315 ----------------------------------…
has comment: http://stackoverflow.com/comment/34364925
downvote count: 1
has comment: http://stackoverflow.com/comment/34365011
type: Question
has comment: http://stackoverflow.com/comment/34364885
has comment: http://stackoverflow.com/comment/34364958
has comment: http://stackoverflow.com/comment/34364949
tagged with: performance
has comment: http://stackoverflow.com/comment/34364803
has comment: http://stackoverflow.com/comment/34365066
accepted answer: http://stackoverflow.com/a/22576090
has comment: http://stackoverflow.com/comment/34364745
answer count: 2

http://stackoverflow.com/comment/34453051
comment on: http://stackoverflow.com/a/22624198
type: Comment
has text: Thanks. I'm confused about iterating through the container. Maybe I need more clarification on the underlying process for Sets. Won't duplicates not be added to the Set, so there would be no reference to the duplicates to count?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34247093
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22508766
score: 0
has text: @ShellShock No, it is not.

http://stackoverflow.com/comment/34269604
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22520355
type: AnswerComment
has text: Well, it works by casting a double between -100 and +100, not inclusive, to int. So the smallest number it produces is `(int)(-99.9999....)`, which is -99, and the largest number it produces is `(int)(99.999999....)`, which is 99. Moreover, if the double that it starts with is between -1 and 1, not inclusive, it will get cast to 0. So it is twice as likely to be 0 as anything else, and it will never be -100 or 100. In my earlier comment, I didn't see that you had also forgotten the +1 that other respondents included.

http://stackoverflow.com/comment/34353133
comment on: http://stackoverflow.com/q/22568529
score: 0
type: Comment
type: QuestionComment
has text: If it was bad coding practice,Hibernate would have been extinct by now :)

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/22550048
tags question: http://stackoverflow.com/q/22616345
tags question: http://stackoverflow.com/q/22564113
tags question: http://stackoverflow.com/q/22591620
type: Tag

http://stackoverflow.com/a/55058785
score: 1
type: Answer
upvote count: 1
has body: import java.util.Arrays; public static void main( String[] args ) { int[] nums2 = {9,4,1,8,4}; nums2 =Arrays.copyOf(nums2,3); for (int i : nums2) { System.out.print(i+" "); } } //Output 9 4 1
answers question: http://stackoverflow.com/q/22587068
downvote count: 0

http://stackoverflow.com/comment/58908816
type: Comment
comment on: http://stackoverflow.com/q/22602217
score: 0
type: QuestionComment
has text: You're supposed to use the XposedHelpers class to call methods in system classes

http://stackoverflow.com/q/22624249
has title: How to pass a file into another class when uploaded with JFileChooser
tagged with: jfilechooser
type: Question
answer count: 2
has body: I am trying to take in a file from a JFileChooser that I can then pass into my TextStatistics class. I can't seem to keep reference to the file... Any help would be greatly appreciated. Thanks! ProcessText.java: public class ProcessText extends JPanel implements ActionListener { static private final String newline = "\n"; JButton openButton; JButton calculate; JTextArea log; JFileChooser fc; public ProcessText() { super(new BorderLayout()); log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setEditable(false); JScrollPane logScrollPane = new JScrollPane(log); JPanel buttonPanel = new JPanel(); // use FlowLayout buttonPanel.add(openButton); buttonPanel.add(calculate); // Add the buttons and the log to this panel. add(buttonPanel, BorderLayout.PAGE_START); add(logScrollPane, BorderLayout.CENTER); } public void actionPerformed(ActionEvent e) { File file = null; TextStatistics stat = null; if (e.getSource() == openButton) { int returnVal = fc.showOpenDialog(ProcessText.this); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile(); stat = new TextStatistics(file); } } if (e.getSource() == calculate) { log.append(stat.toString()); } } /** Returns an ImageIcon, or null if the path was invalid. */ protected static ImageIcon createImageIcon(String path) { java.net.URL imgURL = ProcessText.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL); } else { System.err.println("Couldn't find file: " + path); return null; } } private static void createAndShowGUI() { // Create and set up the window. JFrame frame = new JFrame("FileChooserDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Add content to the window. frame.add(new ProcessText()); // Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { // Schedule a job for the event dispatch thread: // creating and showing this application's GUI. SwingUtilities.invokeLater(new Runnable() { public void run() { // Tu…
has answer: http://stackoverflow.com/a/22624356
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22624356
upvote count: 1
tagged with: swing
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22624419
has answer: http://stackoverflow.com/a/22624419
score: 1
tagged with: java

http://stackoverflow.com/a/22605905
has comment: http://stackoverflow.com/comment/34420138
has comment: http://stackoverflow.com/comment/120783472
answers question: http://stackoverflow.com/q/22605666
has comment: http://stackoverflow.com/comment/44140808
has comment: http://stackoverflow.com/comment/55326246
type: AcceptedAnswer
has body: A FileSystemNotFoundException means the file system cannot be created automatically; and you have not created it here. Given your URI, what you should do is split against the !, open the filesystem using the part before it and then get the path from the part after the !: final Map&lt;String, String&gt; env = new HashMap&lt;&gt;(); final String[] array = uri.toString().split("!"); final FileSystem fs = FileSystems.newFileSystem(URI.create(array[0]), env); final Path path = fs.getPath(array[1]); Note that you should .close() your FileSystem once you're done with it.
upvote count: 68
has comment: http://stackoverflow.com/comment/65827883
has comment: http://stackoverflow.com/comment/65832203
type: Answer
has comment: http://stackoverflow.com/comment/62643164
has comment: http://stackoverflow.com/comment/55321243
has comment: http://stackoverflow.com/comment/34420946
has comment: http://stackoverflow.com/comment/55321155
has comment: http://stackoverflow.com/comment/55326289
has comment: http://stackoverflow.com/comment/65867454
has comment: http://stackoverflow.com/comment/34420548
accepted answer of: http://stackoverflow.com/q/22605666
score: 68
has comment: http://stackoverflow.com/comment/34429350
downvote count: 0

http://stackoverflow.com/a/22625346
has comment: http://stackoverflow.com/comment/34455949
has comment: http://stackoverflow.com/comment/34461402
type: Answer
has body: Assuming my understanding is correct, for a search query I will retrieve a reasonable number of records from the DB (say 500) and store it in something like a PagedListHolder and set the per page data to whatever number you want(say 20). Now I have two options, when the user clicks next I will simply call the nextPage() and retrieve the data set. (This might be applicable for infinite loading) Or if the user is clicks on a particular page number (conventional pagination), I will pass on the page number to the setPage() method and retrieve the elements from that page. I have used the PagedlistHolder example to make it easy for you to understand. You may use any similiar Class if available, or you can write one. I think this achieves your objective of not hitting the DB for the same set of data. Let me know if it helped.
has comment: http://stackoverflow.com/comment/34458671
has comment: http://stackoverflow.com/comment/34455337
answers question: http://stackoverflow.com/q/22624861
score: 0
has comment: http://stackoverflow.com/comment/34455126

http://stackoverflow.com/q/22514947
upvote count: 2
answer count: 5
has comment: http://stackoverflow.com/comment/34257969
has comment: http://stackoverflow.com/comment/34257622
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22515267
score: 2
has comment: http://stackoverflow.com/comment/34258038
has comment: http://stackoverflow.com/comment/34258261
tagged with: java
has answer: http://stackoverflow.com/a/22515138
has answer: http://stackoverflow.com/a/22515034
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/22515138
downvote count: 0
has comment: http://stackoverflow.com/comment/34257669
has body: I have 5 different methods like this public void met1(){} public void met2(){} public void met3(){} public void met4(){} public void met5(){} I want to call this method from 1 to 5 is there any convinient way to do this. I don't want to call one by one or I don't want to put method call inside other method. How Can I do this??
has answer: http://stackoverflow.com/a/22515057
possible better answer: http://stackoverflow.com/a/22515057
has title: Call Methods in Sequence
favorite count: 0
has answer: http://stackoverflow.com/a/74256352
linked to: http://stackoverflow.com/q/160970

http://stackoverflow.com/a/22609314
has comment: http://stackoverflow.com/comment/34427722
has comment: http://stackoverflow.com/comment/34426723
has body: This is a part from my ant build file including all xml, jpg, gif and png: &lt;!-- ============================================================== --&gt; &lt;!-- Build application --&gt; &lt;!-- ============================================================== --&gt; &lt;target name="build" depends="make-bin-dir" description="Build application"&gt; &lt;javac srcdir="${src.dir}" destdir="${bin.dir}" debug="on" classpathref="javac.classpath" /&gt; &lt;copy todir="${bin.dir}"&gt; &lt;fileset dir="${src.dir}"&gt; &lt;include name="**/*.xml" /&gt; &lt;include name="**/*.jpg" /&gt; &lt;include name="**/*.gif" /&gt; &lt;include name="**/*.png" /&gt; &lt;/fileset&gt; &lt;/copy&gt; &lt;/target&gt; To only include one file just put the full name in include name= "fullnamehere" /&gt; Sorry...haven't seen your part to add... Try it like this: include name= "builds/temp/_XA.class" /&gt;
has comment: http://stackoverflow.com/comment/34427378
has comment: http://stackoverflow.com/comment/34427863
has comment: http://stackoverflow.com/comment/34426839
accepted answer of: http://stackoverflow.com/q/22608862
has comment: http://stackoverflow.com/comment/34426408
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34426633
type: Answer
has comment: http://stackoverflow.com/comment/34426160
answers question: http://stackoverflow.com/q/22608862
score: 1
upvote count: 1

http://stackoverflow.com/q/22595754
has answer: http://stackoverflow.com/a/22595775
has body: Hello everyone I'm working with a ListView and when i open the activity my app crashes due to a NullPointerException. Everything is declared, so I really have no idea of why this is happening. So I have this layouts: delete.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/background" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@android:id/android:list" android:layout_width="match_parent" android:layout_height="wrap_content"&gt;&lt;/ListView&gt; &lt;Button android:id="@+id/btn_deleteAll" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/deleteAll"/&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; And item.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/date" android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt; &lt;TextView android:id="@+id/time" android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt; &lt;TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt; &lt;TextView android:id="@+id/details" android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt; &lt;/RelativeLayout&gt; And my ListActivity class is: package com.example.calendar; import com.example.calendar.DBHandler; import android.app.ListActivity; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.…
has comment: http://stackoverflow.com/comment/34401913
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34401595
has title: NullpointerException in Listview on android
tagged with: java
accepted answer: http://stackoverflow.com/a/22595775
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22595798
has answer: http://stackoverflow.com/a/22595798
tagged with: android

http://stackoverflow.com/comment/34244920
score: 1
type: AnswerComment
has text: and to add, arrays are objects in java unlike C.
type: Comment
comment on: http://stackoverflow.com/a/22508075

http://stackoverflow.com/q/22503465
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22503888
score: 0
tagged with: sql
answer count: 1
tagged with: jdbc
tagged with: pom.xml
has answer: http://stackoverflow.com/a/22503888
has body: I am currently developing my first JAX-RS based REST service and in order to access different databases based on the environment I am executing the service on, I added profiles to my pom.xml. Based on the currently chosen profile I am able to create a configuration file, that lets me establish the connection to the local database. However, I also use this information to create a database and tables and load some test data into it using dbunit. The problem is, that the database is created and dropped for all profiles, but I just want to recreate the database for test profiles. If I use production or development profiles the database should just be altered if there have been structural changes to the database tables. So my question is how I could execute plugin actions based on the currently chosen profile. Therefore please consider the example below. How to alter the executions so they are just executed if I set the profile test using maven clean install -P test? org.codehaus.mojo sql-maven-plugin ${sql.maven.plugin.version} postgresql postgresql ${postgresql.jdbc.version} ${database.jdbc.driverClass} ${database.jdbc.connectionURL} ${database.jdbc.username} ${database.jdbc.password} postgres-db ${maven.test.skip} drop-db-before-test-if-any process-test-resources execute jdbc:postgresql://localhost:5432 true DROP DATABASE ${database.jdbc.dbName}; continue create-db process-test-resources execute jdbc:postgresql://localhost:5432 true CREATE DATABASE ${database.jdbc.dbName}; create-tables process-test-resources execute true row src/main/sql/spozz-schema.sql
tagged with: java
has title: Executing maven tasks based on chosen profile
tagged with: maven
type: Question

http://stackoverflow.com/comment/34368905
type: AnswerComment
comment on: http://stackoverflow.com/a/22577209
type: Comment
has text: @JoopEggen I am getting java.lang.NumberFormatException, for some unknown reason. Do you know how I could fix this?
score: 0

http://stackoverflow.com/a/22554477
accepted answer of: http://stackoverflow.com/q/22554417
has body: Essentially, you just store references in your ArrayList, so it does not matter whether you use something like Product tmp = tmpRef;. tmp still points to the same object, thus changes are applied to both. In this case, final just means that a pointer cannot be changed once it has been set. Just search for deep copy java for possible solutions.
answers question: http://stackoverflow.com/q/22554417
type: Answer
has comment: http://stackoverflow.com/comment/34327354
upvote count: 4
score: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22630452
has comment: http://stackoverflow.com/comment/34528394
has comment: http://stackoverflow.com/comment/34526717
has body: Reiterating Kleopatra : Don't Sleep the EDT You can instead use a javax.swing.Timer as seen in this answer EDIT I didn't want to mess with your code too much (just because it looks weird to me) but I changed it somewhat to add the Timer import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.Timer; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableModel; public class Main { static JTable table; static GUI gui; static Processor p = null; public static void main(String[] args) { // Show GUI java.awt.EventQueue.invokeLater(new Runnable() { public void run() { gui = new GUI(); p = new Processor() { @Override public void execute() { final JTable table = new JTable(p.getTableModel()); final JScrollPane scrollPane = new JScrollPane(table); gui.getContentPane().add(scrollPane, BorderLayout.CENTER); gui.setLocationRelativeTo(null); gui.setVisible(true); Timer timer = new Timer(100, new ActionListener(){ public void actionPerformed(ActionEvent e) { p.processRow(); table.scrollRectToVisible(table.getCellRect(table.getRowCount() - 1, 0, true)); } }); timer.start(); } }; p.execute(); } }); } } class GUI extends JFrame { private static final long serialVersionUID = 1L; public GUI() { setTitle("GUI"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 350, 400); JPanel contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(10, 10, 10, 10)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); } } interface Callback { void execute(); } abstract class Processor implements Callback { private final String[] cols = {"COL", "COL", "COL", "COL", "COL"}; private DefaultTableModel tableModel; int numRows; int numCols; int a, b, c, d, e; Processor() { a = 1; b = 2; c = 3; d = 4; e = 4; numRows = 1000; tableModel = new DefaultTableModel(col…
has comment: http://stackoverflow.com/comment/34580903
score: 4
upvote count: 4
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34527541
answers question: http://stackoverflow.com/q/22629697
has comment: http://stackoverflow.com/comment/34527790

http://stackoverflow.com/a/22596995
has comment: http://stackoverflow.com/comment/34405324
has comment: http://stackoverflow.com/comment/34405160
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22586233
score: 0
has comment: http://stackoverflow.com/comment/34405041
type: Answer
has comment: http://stackoverflow.com/comment/34404938
has comment: http://stackoverflow.com/comment/34405457
has comment: http://stackoverflow.com/comment/34406506
has comment: http://stackoverflow.com/comment/34404276
has body: With almost 37,000 songs in your text-file database, and a significant number of ways for users to access it (by year, year-range, rank, rank-range, ...), including the possibility of sorting, I think it's almost required that you pre-process your song-database with a one-time-only process--once every time the database is changed--to optimize your data before ever giving your users the chance to query against it. (I am making the assumption here that you can't use a real database, which would be the ideal solution) The first thing I would recommend is to assign a unique key (ID) to each song, starting with 1, which, in code, should be represented with a long. Make this the first column in your database. For example, call it agazillionsongs_with_id.txt: 1 2008 50 Ashley Tisdale He Said, She Said 2 2008 123 Taylor Swift Teardrops On My Guitar 3 2008 233 Finger Eleven Paralyzer 4 2008 258 Paramore Misery Business ... 470 2007 251 Hannah Montana True Friend 471 2006 1 Beyonce Irreplaceable ... Now create additional sub-tables (indexes), in separate text files, each of which simply refer to the song's key. The simplest one is a year-index, which could be stored in a file called agazillionsongs_sub_year.txt: 2008 1 2008 2 2008 3 2008 4 ... 2007 470 ... 2006 471 ... Alternatively, you could store each year in this form (I prefer this format) 2008 1, 2, 3, 4, ... 2007 470, ... 2006 471, ... Either way, this could be represented in code as a yearMap object, which is a Map&lt;Integer,List&lt;Song&gt;&gt;, where the value is a reference to the appropriate Song object. Once these maps are created, outputting them to file is easy. Do this also with rank: agazillionsongs_sub_rank.txt / rankMap / Map&lt;Integer,List&lt;Song&gt;&gt; Indexing by name and title is trickier--do you index the whole name, literally or with some concept of "fuzziness", or only the beginning, ...? It's a hard but important concept. The farther you can take this idea, the more ways you slice-and-dice your …
has comment: http://stackoverflow.com/comment/34405711
has comment: http://stackoverflow.com/comment/34405406
answers question: http://stackoverflow.com/q/22586233

http://stackoverflow.com/comment/34437793
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22615171
has text: Any help to figure out this problem !! I just got empty table without records, it seems the XSL file does not work properly !!
score: 0

http://stackoverflow.com/comment/34298872
comment on: http://stackoverflow.com/q/22537899
score: 0
type: Comment
type: QuestionComment
has text: @JonSkeet Jon, you are everywhere! I have read so many of your useful answers over the years. The question you pointed me to is indeed similar and it is unfortunate there isn't a good answer for it. It sounds like I may have to take the list of car features outside of each car implementation then, forcing me to have car-related info in a couple of places. Not ideal but if that's the only option...

http://stackoverflow.com/q/22581006
has comment: http://stackoverflow.com/comment/34376887
has title: Cannot convert project: C:\workspace_IntelliJ\Main\new-webapp\.idea\workspace.xml: Error on line 1: Content is not allowed in prolog
type: AnsweredQuestion
has body: I have no clue what suddenly have happened. I restarted my Idea workspace and it popped up the following error: Cannot convert project: C:\workspace_IntelliJ\Main\new-webapp.idea\workspace.xml: Error on line 1: Content is not allowed in prolog. What does this error mean? I have checked my workspace.xml. Whenever I try to open it in an editor it displays the following (I believe it's broken): nulnulnul I have no clue what to change and how to fix this thing. Any help on this would be great!
possible better answer: http://stackoverflow.com/a/27298624
tagged with: java
has answer: http://stackoverflow.com/a/27298624
has comment: http://stackoverflow.com/comment/34376958
has answer: http://stackoverflow.com/a/25301859
type: Question
has answer: http://stackoverflow.com/a/22582108
tagged with: intellij-idea
downvote count: 0
has comment: http://stackoverflow.com/comment/34377019
tagged with: ide
favorite count: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/xml
score: 2
accepted answer: http://stackoverflow.com/a/22582108
upvote count: 2

http://stackoverflow.com/comment/34227836
score: 1
comment on: http://stackoverflow.com/a/22497574
type: AnswerComment
has text: @user2155922 and when it comes to the second approch its not valid until your getInstance method is static..otherwise you need to create object to access the getInstance() method then which is not singleton..
type: Comment

http://stackoverflow.com/comment/34247699
score: 0
has text: It's because of it's improved type inference.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22509488

http://stackoverflow.com/comment/34242723
has text: after edit: and again, it does not work, please, read carefully original post, I don't want _all_ dependencies to one place, I want _part_ of dependencies with all transitive dependency go to one place. If I change ` org.springframework:spring-jdbc:jar ` to ` org.springframework:spring-aop:jar ` in original post I have exactly same result - some transitive dependencies missing.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22506243

http://stackoverflow.com/a/22549022
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/22548471
upvote count: 1
answers question: http://stackoverflow.com/q/22548471
has comment: http://stackoverflow.com/comment/34579092
has body: From your comment it seems like you have some kind of tasks that yield other tasks, but each task can be executed individually. Try using an ExecutorService to submit Runnables or Callables to, depending on what suites you best. Within your tasks, you can then submit to the very same ExecutorService, without actually creating threads. For the actual implementation, have a look at ThreadPoolExecutor - it will basically manage all the threading stuff for you.

http://stackoverflow.com/q/22532345
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22532433
type: Question
tagged with: jackson
score: 0
has body: I have class like this: @XmlRootElement(name = "info") @XmlAccessorType(XmlAccessType.FIELD) @Data public class BasketInfoResult extends FibResult { private List&lt;Map&lt;String, String&gt;&gt; items; } How to map it on XML? Resteasy map it in json without errors but when I try to get xml i got an error 1 counts of IllegalAnnotationExceptions
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
tagged with: resteasy
type: UnansweredQuestion
has title: jackson List<Map<String, String>> to xml

http://stackoverflow.com/comment/34285542
type: QuestionComment
comment on: http://stackoverflow.com/q/22529926
score: 0
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/50117/discussion-between-rethinavel-pillai-and-samet)
type: Comment

http://stackoverflow.com/comment/34424402
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22607791
score: 0
has text: "*But the JavaScript decryption is not working*" > Can you please elaborate on this?

http://stackoverflow.com/q/22610886
type: UnansweredQuestion
tagged with: keystore
has answer: http://stackoverflow.com/a/22611219
has body: I always receive a java.security.cert.CertificateException: No subject alternative names present exception, however i've imported the certificate to my trusrstore. Here my Setup: I'm using a small HTTPS Server based on com.sun.net.httpserver.HttpsServer. I've create a keystore with a self signed certificate: keytool -genkey -keyalg RSA -alias myCert -keystore keystore.jks -storepass myPass -validity 360 -keysize 2048 I'm passing the path and password to the keystore as VM arguments Djavax.net.ssl.keyStore=/tmp/truststore.jks Djavax.net.ssl.keyStorePassword=myPass If I run openssl s_client -connect 192.168.1.101:4443 I can see that it uses the right certificate. To trust the certificate on client site, I've exported the certificate from the server keystore and imported it to the client truststore: keytool -export -alias myCert -file myCert.crt -keystore keystore.jks keytool -import -trustcacerts -alias -file myCert.crt -keystore truststore.jks For the client I use a small test program using jersey. I'm passing the path to the truststore as VM argument -Djavax.net.ssl.trustStore=/tmp/truststore.jks public class Tester { public static void main(String[] args) { Client client = ClientBuilder.newClient(); try { String name = client.target("https://192.168.1.101:4443") .request(MediaType.TEXT_PLAIN) .get(String.class); System.out.println(name); } catch (final Exception e) { System.err.println(e); } } } But however the self signed certificate is in the truststore, I always get the java.security.cert.CertificateException: No subject alternative names present exception What can be the reason for it?
tagged with: https
type: Question
tagged with: java
tagged with: ssl-certificate
score: 0
answer count: 1
has title: Getting java.security.cert.CertificateException, however the certificate is imported into the truststore
tagged with: truststore

http://stackoverflow.com/comment/34447405
has text: we don't need anyhting, you want to do post an SSCCE/MCVE/MCTRE, short, runnable, compilable with hardcoded valuse in local variables
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/22620807
type: Comment

http://stackoverflow.com/comment/34273701
score: 0
comment on: http://stackoverflow.com/q/22523806
type: Comment
has text: just match the string with the ASCII char of space.
type: QuestionComment

http://stackoverflow.com/comment/34237756
has text: I'm speaking about Java
type: AnswerComment
comment on: http://stackoverflow.com/a/22503563
score: 0
type: Comment

http://stackoverflow.com/a/22608580
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22608198
has body: The Javadocs for a closely related interface, PdfEncryptionSettings, provides some clues: Encryption settings are described in section 3.5 (more specifically section 3.5.2) of the PDF Reference 1.7. They are explained in section 3.3.3 of the book 'iText in Action'. Looking at that section of the reference we can see that either RC4 or AES is used. With that in mind, I'd say the specific method you linked to will either do 40-bit RC4 or 128-bit RC4. An overloaded alternative method allows you to specify 40-bit RC4, 128-bit RC4 or 128-bit AES.
type: Answer

http://stackoverflow.com/comment/34276399
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22524157
has text: It seems that list all public key in the keystore don't need password ?!

http://stackoverflow.com/comment/107315894
score: 0
type: AnswerComment
type: Comment
has text: https://issues.apache.org/jira/browse/MASSEMBLY-357 matches (it's original issue I posted), but https://issues.apache.org/jira/browse/MASSEMBLY-873 - does not match and was created later than I created answer.
comment on: http://stackoverflow.com/a/22516543

antlr4
tags question: http://stackoverflow.com/q/22595468
tags question: http://stackoverflow.com/q/22611090
type: Tag
tags question: http://stackoverflow.com/q/22559158
tag name: antlr4

http://stackoverflow.com/q/22535483
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22964560
accepted answer: http://stackoverflow.com/a/22964560
tagged with: java
tagged with: lotus-domino
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34297463
has title: use javaClass in lotusScript
tagged with: lotus
has body: Hello ! First, excuse my poor english... :C I try to use my Java Class in Domino Lotuscript. I do that : in my Global Form Option Public Uselsx "*javacon" Use "libEssai" and in my button on Clic : Sub Click(Source As Button) Dim mySession As JAVASESSION Dim utilDate As JAVACLASS Dim objUtilDate As JAVAOBJECT Dim toto As String Set mySession = New JAVASESSION Set utilDate = mySession.GetClass("test/UtilDate") Set objUtilDate = utilDate.CreateObject toto = objUtilDate.essaiMethode Messagebox (toto + "*******************************************************") End Sub I try to put this class in library java (Code /library/libEssai) and in a java package (Code/Java/ package test/UtilDAte.java) i try the two way with the same result it's a "hello word" class java to test. package test; public class UtilDate { public String essaiMethode() { String texte = null; texte = "Bonjour"; return texte; } } And the error i have is : "Instance member ESSAIMETHODE does not exist" I don't understand, could you help me ? Thanks for your help ! ;D i found !! Sub Click(Source As Button) Dim mySession As JAVASESSION Dim utilDate As JAVACLASS Dim objUtilDate As JAVAOBJECT Dim toto As String Dim toto2 As String Dim myMCollection As JavaMethodCollection Dim myMethod As JavaMethod Dim methodJava As JavaMethod toto2 = "test" Set mySession = New JAVASESSION Set utilDate = mySession.GetClass("test/UtilEssai") Set objUtilDate = utilDate.CreateObject Messagebox (toto2) Set myMCollection = utilDate.getClassMethods() Set myMethod = myMCollection.getFirst() Do If myMCollection.count &lt;&gt; 0 Then toto2 = myMethod.MethodName &amp; " " &amp; myMethod.signature Messagebox (toto2) If myMethod.MethodName = "essaiMethode" Then Set methodJava = utilDate.GetMethod("essaiMethode","()Ljava/lang/String;") toto = methodJava.Invoke(objUtilDate) Messagebox (toto) End If End If Set myMethod = myMCollection.getNext() Loop While myMCollection.current &lt;&gt; 1 End Sub
score: 0
answer count: 1

linechart
tag name: linechart
tags question: http://stackoverflow.com/q/22592158
type: Tag

http://stackoverflow.com/comment/34485689
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22642870
has text: List or List<DataMS> will be the same thing (List<DataMS> -> List)

http://stackoverflow.com/comment/34367144
has text: You get an empty Cursor. Just use the `cursor.getCount();` method to determine it it contains 0 rows.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22576758

http://stackoverflow.com/a/22633463
score: 0
has body: mapFragment is null after the findFragmentById() call. Please make sure you have id = mapView (case-sensitive) inside activity_main.xml. If you have it there, you can also try to move the work with MapFragment from onCreate to onStart or onResume
answers question: http://stackoverflow.com/q/22633363
type: Answer
has comment: http://stackoverflow.com/comment/34468756
has comment: http://stackoverflow.com/comment/34468807

http://stackoverflow.com/comment/34414715
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22603062
has text: @David I have removed that.
score: 0

http://stackoverflow.com/comment/34497386
type: AnswerComment
score: 0
type: Comment
has text: OK, the change from UP to HALF_UP is correct, but you still have the second problem that I mentioned. You need for the actual multiplication to be done with BigDecimals, not with doubles, otherwise the floating point error creeps in. Converting a double with an error to a BigDecimal won't take away the error. For example, even with HALF_UP rounding, 11.95 will become 13.04, where it should be 13.05. I would post a correct answer myself if the question hadn't been incorrectly closed - but the gist of it is that you need to parse the original String into a BigDecimal and work with that.
comment on: http://stackoverflow.com/a/22646840

http://stackoverflow.com/comment/34382401
type: QuestionComment
comment on: http://stackoverflow.com/q/22584841
score: 1
has text: Basically, your problem is this: `int size = s.length(); s.replace(s.charAt(i), s.charAt(size));`. "size" here will be the length of `s`, and `charAt` must be passed a parm between 0 and size-1. So it will inevitably get an error. (It's easy to tell what the error is, of course, because the above exception message gives you the method (`charAt`) and where it was called (`stringReversal` at line 24).
type: Comment

http://stackoverflow.com/q/22512300
has title: How to view a longer code revision history in Eclipse
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22512403
tagged with: repository
score: 2
downvote count: 0
type: UnansweredQuestion
type: Question
has body: To view historical code revisions/deletions/changes (etc), we right click a .java file in Package Exlorer and go Replace With -&gt; Local History. This shows the revisions over the last two days. How do I get a more complete history of revisions? Note I know about SVN.
tagged with: java
tagged with: eclipse
tagged with: revision-history
upvote count: 2

http://stackoverflow.com/comment/34256056
score: 0
type: QuestionComment
has text: @chrylis I am trying to find a suitable `Game` interface that captures the already information correctly from `Player`. I need the `<A, R>` types for later use in the methods.
type: Comment
comment on: http://stackoverflow.com/q/22513952

http://stackoverflow.com/a/22608916
score: 2
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22608854
has body: The second one is comparing Object Id's.Since every object is having a unique Id it is returning false.

http://stackoverflow.com/q/22509542
tagged with: collections
has comment: http://stackoverflow.com/comment/34247786
type: Question
has comment: http://stackoverflow.com/comment/34248619
has comment: http://stackoverflow.com/comment/34254434
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34253545
tagged with: algorithm
has comment: http://stackoverflow.com/comment/34253457
tagged with: java
has comment: http://stackoverflow.com/comment/34253270
has comment: http://stackoverflow.com/comment/34254158
has answer: http://stackoverflow.com/a/22513748
has comment: http://stackoverflow.com/comment/34254359
has comment: http://stackoverflow.com/comment/34247963
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/34248940
has comment: http://stackoverflow.com/comment/34253852
has comment: http://stackoverflow.com/comment/34253052
has title: Java find common elements in a collection
has comment: http://stackoverflow.com/comment/34248163
has comment: http://stackoverflow.com/comment/34251422
score: 0
accepted answer: http://stackoverflow.com/a/22513748
has comment: http://stackoverflow.com/comment/34254208
has comment: http://stackoverflow.com/comment/34247909
has comment: http://stackoverflow.com/comment/34254580
has comment: http://stackoverflow.com/comment/34249741
has comment: http://stackoverflow.com/comment/34254944
has comment: http://stackoverflow.com/comment/34249444
has comment: http://stackoverflow.com/comment/34249500
has comment: http://stackoverflow.com/comment/34254727
has comment: http://stackoverflow.com/comment/34248990
has body: I need to find common elements in a collection of arrays using public Comparable[] findCommonElements(Object[] collection) as the signature of my algorithm, it should accept a collection of arrays (of varying length and of any type) as input, and be no greater than O(knlogn). I want to do a quick sort (??) of the arrays then do a binary search for the common elements. This should put me right at O(knlogn), but I'm not 100% sure about efficiency. I'm lost on how to get the binary search to search the collections and then print the common elements. I am aware I cannot call common from a static method, but I left it to give an idea of what I tried. I am aware my time would be better spent learning how to use array lists and hash sets, but I am supposed to use concepts already covered, and these have not been. Code: public class CommonElements2&lt;T extends Comparable&lt;T&gt;&gt; { Comparable[] tempArr; Comparable[] queryArray; Comparable[] common = new Comparable[queryArray.length]; int counter = 0; /* sort algorithm goes here */ public Comparable[] findCommonElements(Object[] collections) { queryArray = ((Comparable[])collections[0]); boolean found = false; for(int x = 0; x &lt; queryArray.length; ++x) { for(int y = 1; y &lt; collections.length; ++y) { tempArr = (Comparable[])collections[y]; found = binarySearch(tempArr, 0, tempArr.length, queryArray[x]); if(!found) { break; } if(found) { common[counter] = queryArray[x]; ++counter; } } //end y for loop } // end x for loop return common; } // end findCommonElements public boolean binarySearch(Comparable[] arr, int first, int last, Object searchItem) { boolean found; int mid = (first + (last - first)) /2; if(first &gt; last) return false; int value = ((Comparable)searchItem).compareTo(arr[mid]); if(value &lt; 0) value = -1; switch(value) { case 0: found = true; break; case -1: found = binarySearch(arr, first, mid - 1, searchItem); break; default: found = binarySearch(arr, mid + 1, last, searchItem); break; } return fou…
has comment: http://stackoverflow.com/comment/34252395
has comment: http://stackoverflow.com/comment/34252589

http://stackoverflow.com/q/22590328
linked to: http://stackoverflow.com/q/18376138
score: 8
has comment: http://stackoverflow.com/comment/34392018
tagged with: iso9660
has answer: http://stackoverflow.com/a/22612017
accepted answer: http://stackoverflow.com/a/22612017
type: Question
has body: I already asked something similar here several months ago, but of course the solution used in my update is not good, because I don't know at which offset starts the file I want, that code reads the entire file until it finds the wanted string and that's not convenient. That's why I searched for an ISO9660 File reader coded in Java and I came accross this project which reads perfectly ISO9660 files, but there are some file formats like bin and img that I'd like to be able to open. Unfortunately, the code doesn't work because it expects the ISO9660 header \x01CD001\x01 at a prefixed offset (32768, right after the first 16 sectors, reserved for other purposes) as defined by the standard here and here: 7. The First Sixteen Sectors are Empty The first sixteen sectors (sector numbers 0 to 15, inclusive) contain nothing but zeros. ISO9660 does not define the contents of these sectors, but for DOS they are apparently always written as zeros. They are apparently reserved for use by systems that can be booted from a CD-ROM. In my case, i have img and bin disk images that have the \x01CD001\x01 header at offset 37656, 792 bytes after the end of the 18th sector. This makes the code throw an error. Since there are softwares able to read the contents of a bin and img file without the need of cue or ccd file, what's the rule to fild the header in such cases? Is it a standard or do they brutally search the header through the bytes? If it's a standard where can I find any kind of documentation/implementation? UPDATE: I found out that those files have a different sector size: 2352 bytes/sector, because they are raw copies of the CD-R.
type: AnsweredQuestion
has title: Read files from raw disk image (2352 bytes/sector)
tagged with: java
upvote count: 8
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34392002
favorite count: 0
has comment: http://stackoverflow.com/comment/34391931

http://stackoverflow.com/comment/34321478
comment on: http://stackoverflow.com/q/22550534
score: 0
type: Comment
type: QuestionComment
has text: What line is causing the "Connection Refused" error? And are you seeing any exceptions on the server side? What about that `SocketException` you're silently handling up at `servsock.accept()`, is that getting thrown?

http://stackoverflow.com/q/22516273
has comment: http://stackoverflow.com/comment/34260331
has answer: http://stackoverflow.com/a/22516716
has title: rewrite file instead of recreating a file
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34260245
tagged with: java
has comment: http://stackoverflow.com/comment/34260269
tagged with: file
has comment: http://stackoverflow.com/comment/34260075
type: Question
has comment: http://stackoverflow.com/comment/34260769
has comment: http://stackoverflow.com/comment/34260859
accepted answer: http://stackoverflow.com/a/22516716
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22517035
tagged with: url-rewriting
has body: I have the following piece of code which allows me to recreate a file holding updated data. Even though I used the "StandardOpenOption.TRUNCATE_EXISTING" option to overwrite the old file I was getting an error saying that the file already exists and it wouldn't write on top of it! File filename = new File("data.txt"); public void writeToFile(char[] data){ filename.delete(); Files.write(filename.toPath(), data, StandardOpenOption.TRUNCATE_EXISTING); } Is it possible instead of deleting and recreating the same file over and over to edit the initial file's data? Thank you EDIT1: It seems like it was a mistake of mine. Together with "StandardOpenOption.TRUNCATE_EXISTING" I have included "StandardOpenOption.CREEATE_NEW". This is because I want the file to be created in case it doesn't already exist! How is it possible to first try to edit it and if it doesnt exist create a new one? Sorry for my initial mistake
possible better answer: http://stackoverflow.com/a/22517035

http://stackoverflow.com/a/22607283
has body: You don't need to extract anything from the first string. You can use String.startsWith: if (string1.startsWith(string2)) { // do something }
upvote count: 6
score: 6
answers question: http://stackoverflow.com/q/22607217
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22607217
type: Answer

http://stackoverflow.com/q/22559280
answer count: 0
tagged with: fonts
tagged with: java
has comment: http://stackoverflow.com/comment/34336350
tagged with: swing
tagged with: tablecellrenderer
type: Question
has comment: http://stackoverflow.com/comment/34335818
has comment: http://stackoverflow.com/comment/34397913
has comment: http://stackoverflow.com/comment/34335751
has comment: http://stackoverflow.com/comment/34347808
tagged with: jtable
score: 0
has body: I would like to make multiple cells bold, I have arraylist with the cell names that should be bold but doesn't seem to work. My Arraylist with the cells that I want to bold is called bibNumbers, so far tried converting the arralist into array and putting the if statement into a loop and loop results into bolding variable //edit added example, so now id want all the 0's and 1's in the column 2 to be bold. import java.awt.*; import java.util.ArrayList; import javax.swing.*; import javax.swing.border.*; import javax.swing.table.*; public class as extends JFrame { /** * */ private static final long serialVersionUID = 1L; private JPanel contentPane; private JTable table; private ArrayList&lt;String&gt; ShadowBibNumber; /** * Launch the application. */ public static void main(String[] args) { as frame = new as(); frame.setVisible(true); } /** * Create the frame. */ public as() { 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(new BorderLayout(0, 0)); ShadowBibNumber = new ArrayList&lt;String&gt;(); ShadowBibNumber.add("0"); ShadowBibNumber.add("1"); JLabel lblNewLabel = new JLabel("New label"); contentPane.add(lblNewLabel, BorderLayout.NORTH); DefaultTableModel tableModel = new DefaultTableModel(); tableModel.addColumn("column 0"); tableModel.addColumn("column 1"); tableModel.addColumn("column 2"); tableModel.addColumn("column 3"); tableModel.addColumn("column 4"); new JScrollPane(table); table = new JTable(tableModel); table.setEnabled(false); table.setPreferredScrollableViewportSize(new Dimension(200, 100)); JScrollPane scrollPaneForTable = new JScrollPane(table); contentPane.add(scrollPaneForTable, BorderLayout.CENTER); for (int i = 0; i &lt; 20; ++i) { tableModel .addRow(new Object[] { i, i, i, i, i }); } table.getColumn("column 2").setCellRenderer(new boldRenderer()); } class boldRenderer extends DefaultTabl…
has title: CellRenderer - making multiple cells bold
has comment: http://stackoverflow.com/comment/34359106
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34345257
has comment: http://stackoverflow.com/comment/34398779

http://stackoverflow.com/comment/34493187
score: 1
comment on: http://stackoverflow.com/q/22644707
type: Comment
type: QuestionComment
has text: I do not think this question should be closed, as the discussion of whether to use `filter()` and `.forEach()` is a **functional discussion**, not so much of aesthetics.

http://stackoverflow.com/comment/34471416
type: QuestionComment
has text: Hmmmm. Well, if there is a dependency between projects, it really ought to be stated in the POM file(s). Even if that requires work each time a project is added.
comment on: http://stackoverflow.com/q/22635075
score: 3
type: Comment

http://stackoverflow.com/a/22600151
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22589055
type: Answer
has body: I have fixed this problem by modify the attributeFormDefault = "qualified" of the xsd file. This will assign each attribute with the targetNamespace. In this case, glassfish will not feel confused then to put a empty namespace. Not sure this solution can help others but this fix my problem.
answers question: http://stackoverflow.com/q/22589055

stanford-nlp
tags question: http://stackoverflow.com/q/22612939
tags question: http://stackoverflow.com/q/22589267
tags question: http://stackoverflow.com/q/22510616
type: Tag
tags question: http://stackoverflow.com/q/22586658
tag name: stanford-nlp
tags question: http://stackoverflow.com/q/22513006

http://stackoverflow.com/comment/40712090
type: Comment
type: QuestionComment
has text: What is X referring to? No mention is made in the question. Please update it to provide more information.
comment on: http://stackoverflow.com/q/22561429
score: 0

http://stackoverflow.com/comment/34284026
has text: Methods are referenced by indexes, not by pointers, as your own JVM Specification reference states.
type: Comment
comment on: http://stackoverflow.com/a/22521246
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34458783
type: Comment
score: 0
has text: @Coffee what you want to know more?
comment on: http://stackoverflow.com/q/22613139
type: QuestionComment

http://stackoverflow.com/a/22564791
answers question: http://stackoverflow.com/q/22564552
upvote count: 0
type: Answer
downvote count: 1
has body: It appears you are not connecting your HTTPUrlClient try con.connect()
score: -1

http://stackoverflow.com/a/25394602
type: Answer
score: 1
has body: You should never actually save it, it should be a static field!
answers question: http://stackoverflow.com/q/22595318
accepted answer of: http://stackoverflow.com/q/22595318
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34252153
type: AnswerComment
comment on: http://stackoverflow.com/a/22504110
type: Comment
has text: I haven't coded android apps for a while now, but try searching in google or StackOverflow, I'm sure you'll find something. [Here's something to get you started](http://stackoverflow.com/questions/7607235/swipe-pages-in-android).
score: 0

apache
tag name: apache
tags question: http://stackoverflow.com/q/22608934
tags question: http://stackoverflow.com/q/22609628
tags question: http://stackoverflow.com/q/22526146
tags question: http://stackoverflow.com/q/22609548
tags question: http://stackoverflow.com/q/22589058
tags question: http://stackoverflow.com/q/22592036
tags question: http://stackoverflow.com/q/22617633
tags question: http://stackoverflow.com/q/22609994
tags question: http://stackoverflow.com/q/22550157
tags question: http://stackoverflow.com/q/22525023
tags question: http://stackoverflow.com/q/22594933
type: Tag
tags question: http://stackoverflow.com/q/22626669
tags question: http://stackoverflow.com/q/22611881
tags question: http://stackoverflow.com/q/22495239
tags question: http://stackoverflow.com/q/22613492
tags question: http://stackoverflow.com/q/22589410
tags question: http://stackoverflow.com/q/22586950

http://stackoverflow.com/comment/34511399
has text: Thanks @wumpz, Yes in fact, I could go with StAX for now, since I know exactly how many duplicate child nodes I have and they can be identified from the attribute values. It's a fixed structure. However, I will go through your suggestions, since I am still in the learning phase of XML parsing and there is a lot to know. Its really nice to use and know benefits of each of these different technologies.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22648893

http://stackoverflow.com/q/22561717
type: AnsweredQuestion
tagged with: activemq-classic
has body: I have a simple route in camel, which reads messages from an activemq queue 'A' and writes it to another activemq queue 'B'.I was able to get this to this part to work. But I need to add a new property to the message before writing it to 'B'. I have tried to add the property 'prop1' to the message using the Spring DSL below, but the property is not being added to the message. <from uri="activemq:queue:A"/> prop1Value <to uri="activemq:queue:B"/> Is this the correct way to add a property to a message in SPRING DSL?
has title: CAMEL: Adding Properties to a message in Spring DSL
type: Question
has answer: http://stackoverflow.com/a/22563086
tagged with: java
tagged with: apache-camel
accepted answer: http://stackoverflow.com/a/22563086
score: 0
answer count: 1
tagged with: jms
linked to: http://stackoverflow.com/q/10330998
tagged with: spring

http://stackoverflow.com/a/25947617
has body: I got the solution for my question, I follow the below method Set hive.metastore.schema.verification property in hive-site.xml to true, by default it is false. For further details check this Hive Schema Tool
accepted answer of: http://stackoverflow.com/q/22591305
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22591305

http://stackoverflow.com/q/22494343
score: 1
tagged with: java
has body: Here is the javascript code below with a few anonymous inner functions linked to it seems 2 array indexes for each switch, they seem to return some value too, but I have no idea where they are returning to the memoryReadJumpCompile() function or both those array index's. Most likely they are reuturning to the actual array indexes and by the function name Compile it seems that everytime you call any of those array indexes they will re-evaluate the function linked to them with some new result still don't know where the result is stored if the actual index's hold functions, my best guess is the actual array indexes are like function names and they are returned by another piece of code where-ever else the index's are called somewhere in code but lets say the first 2 example array indexes. this.memoryHighReader[0] = this.memoryReader[0xFF00] So they both become the same thing, I found that it gets processed in the instruction executor like so case 242: a.registerA = a.memoryHighReader[a.registerC](a, a.registerC); break; GameBoyCore.prototype.memoryReadJumpCompile = function () { //... else if (index &gt;= 0xFF00) { switch (index) { case 0xFF00: //JOYPAD: this.memoryHighReader[0] = this.memoryReader[0xFF00] = function (parentObj, address) { return 0xC0 | parentObj.memory[0xFF00]; //Top nibble returns as set. } break; case 0xFF01: //SB this.memoryHighReader[0x01] = this.memoryReader[0xFF01] = function (parentObj, address) { return (parentObj.memory[0xFF02] &lt; 0x80) ? parentObj.memory[0xFF01] : 0xFF; } break; case 0xFF02: //SC if (this.cGBC) { this.memoryHighReader[0x02] = this.memoryReader[0xFF02] = function (parentObj, address) { return ((parentObj.serialTimer &lt;= 0) ? 0x7C : 0xFC) | parentObj.memory[0xFF02]; } } else { this.memoryHighReader[0x02] = this.memoryReader[0xFF02] = function (parentObj, address) { return ((parentObj.serialTimer &lt;= 0) ? 0x7E : 0xFE) | parentObj.memory[0xFF02]; } } break; } } The above javascript is nearly like Java but I can't understand…
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22510289
tagged with: arrays
tagged with: javascript
tagged with: variables
tagged with: anonymous-function
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22510289
has title: How to convert Javascript Anonymous Function to Java maybe with switch?
type: AnsweredQuestion

http://stackoverflow.com/comment/34407701
type: QuestionComment
score: 1
has text: i just need a push to understand some things , and then ill go alone.
type: Comment
comment on: http://stackoverflow.com/q/22598977

http://stackoverflow.com/q/22621225
tagged with: mule-studio
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/31219006
type: UnansweredQuestion
has body: I have a requirement to pull the data from database using java component in mule studio. That is Http>SOAP>Java Component(here in main class I will be giving the DB query to get details from my database)>SOAP>http sending request in xml and getting response in xml. I am getting a response when I use hardcoded values in java class ,but when trying to get from Database facing problems. Help would be greatly appreciated. below is the part of my java code String url = "jdbc:oracle:thin:@localhost:1521:XE"; Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection(url, "uname", "pwd"); Statement st = conn.createStatement(); ResultSet result= st.executeQuery("select * from mule.tablename"); while(result.next()) { long quoteId = result.getLong("quote_id"); if(parameters.getQuote().getQuoteId() == quoteId) { QuoteResponseType quoteresp = new QuoteResponseType(); quoteresp.supplierId = result.getString("supplier_id"); quoteresp.respFreightAmount = result.getDouble("resp_freight_amount"); quoteresp.respTaxAmount = result.getDouble("resp_tax_amount"); quoteresp.supplierQuoteNumber = result.getString("supplier_quote_no"); al.add(quoteresp); } NewQuoteResponse.quote.quoteResponse = al; } Thanks in advance.
has answer: http://stackoverflow.com/a/22622608
type: Question
tagged with: java
tagged with: database
has title: retrieving data from database using java component on mule studio
tagged with: mule

http://stackoverflow.com/q/22548977
tagged with: io
has body: After trying to test this Bufferered Reader import java.io.*; public class Test { public static void main(String[] args) throws IOException{ BufferedReader Br = new BufferedReader(new InputStreamReader(System.in)); if (Br.readLine() == "one") print1(); if (Br.readLine() == "two") print2(); } public static void print1(){ System.out.print("1"); } public static void print2(){ System.out.print("2"); } } Nothing I can type in will get it to print. If I change the first "if" statement to if (Br.readLine().startsWith("one") print1(); it will print "1" if I type in "one". Why does this happen?
score: 0
type: UnansweredQuestion
type: Question
has title: Java Standard System Input and Buffered Reader
tagged with: java
has comment: http://stackoverflow.com/comment/34318876
answer count: 2
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/22549304
has answer: http://stackoverflow.com/a/22549084

http://stackoverflow.com/comment/34327324
score: 0
has text: @MadProgrammer i told i am new in connection pooling i have posted the code so that i can proceed from here
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22549433

http://stackoverflow.com/q/22598092
score: 0
answer count: 2
has body: I am trying to make the Endurance button on the Exercise List Page launch Endurance list. The Warmups button works fine. But, the endurance button makes the app crash when clicked. Here is the Exercise List Java: package com.example.chopbuilderfordrums; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class ExerciseList extends Activity implements View.OnClickListener { Button button1; Button button2; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_exercise_list); button1 = (Button)findViewById(R.id.button1); button1.setOnClickListener(this); button2 = (Button)findViewById(R.id.button2); button2.setOnClickListener(this); } private void button1Click() { startActivity(new Intent("com.example.chopbuilderfordrums.LaunchWarmupsList" )); } private void button2Click() { startActivity(new Intent("com.example.chopbuilderfordrums.LaunchEnduranceList" )); } public void onClick (View v) { switch (v.getId()) { case R.id.button1: button1Click(); break; case R.id.button2: button2Click(); break; } } } Here are the errors that come up when button is pressed: 03-23 16:18:36.056: D/dalvikvm(1541): Not late-enabling CheckJNI (already on) 03-23 16:18:41.536: D/gralloc_goldfish(1541): Emulator without GPU emulation detected. 03-23 16:18:47.766: I/Choreographer(1541): Skipped 61 frames! The application may be doing too much work on its main thread. 03-23 16:26:41.666: I/Choreographer(1541): Skipped 87 frames! The application may be doing too much work on its main thread. 03-23 16:26:52.336: I/Choreographer(1541): Skipped 119 frames! The application may be doing too much work on its main thread. 03-23 16:26:52.636: D/dalvikvm(1541): GC_FOR_ALLOC freed 119K, 6% free 3263K/3452K, paused 272ms, total 286ms 03-23 16:37:32.486: D/gralloc_goldfish(1613): Emulator witho…
has comment: http://stackoverflow.com/comment/34405874
has comment: http://stackoverflow.com/comment/34405934
has answer: http://stackoverflow.com/a/22598283
has comment: http://stackoverflow.com/comment/34406129
has title: AndroidRuntime FATAL EXCEPTION: main amongst many other errors
tagged with: android
has comment: http://stackoverflow.com/comment/34406156
tagged with: android-intent
has comment: http://stackoverflow.com/comment/34406107
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34405946
tagged with: java
accepted answer: http://stackoverflow.com/a/22598283
has comment: http://stackoverflow.com/comment/34405961
type: Question
linked to: http://stackoverflow.com/q/18964329
possible better answer: http://stackoverflow.com/a/22598317
has answer: http://stackoverflow.com/a/22598317

http://stackoverflow.com/a/22616643
answers question: http://stackoverflow.com/q/22604038
score: 1
downvote count: 0
type: Answer
has body: Answering to the comment of "how to make 1st column editable" here's how class MyTableModel extends AbstractTableModel { public boolean isCellEditable(int row, int col) { if (col == 1) { return true; } else { return false; } } } Anyway I leave How to Use Tables Documentation in case it's needed. And also this post that could help: How to make a table (Jtable) not editable
upvote count: 1

http://stackoverflow.com/comment/34490475
score: 0
type: Comment
type: QuestionComment
has text: This was a misunderstanding in my end. Order is always retained during array deserialization which is the concept that drives ObjectMapper. According to this [blog](http://www.cowtowncoder.com/blog/archives/2009/01/entry_153.html), ObjectMapper implements a Tree Model to represent the incoming Json. Tree Model, like DOM, offers reliable one on one mapping between column and its values.
comment on: http://stackoverflow.com/q/22623126

http://stackoverflow.com/a/22636657
has body: Usually you initialize your variables and stuff on Start of your Application to make sure u dont use uninitialized variables. You can do that in androit with onCreate() http://developer.android.com/reference/android/app/Application.html#onCreate()
type: Answer
answers question: http://stackoverflow.com/q/22636550
score: 0

http://stackoverflow.com/comment/34420755
comment on: http://stackoverflow.com/q/22606654
type: Comment
type: QuestionComment
has text: check that, google play service is installed in your device.
score: 0

http://stackoverflow.com/comment/34474812
score: 0
type: QuestionComment
type: Comment
has text: @Holger Well, yes, it turns out to be right; yet, your style is unacceptable. If I had time to experiment and verify my stance I'd have posted the exact solution as an answer, not just a comment. As simple as that. Mistake were my thoughts - nonsense is your attitude. Please be a bit more professional.
comment on: http://stackoverflow.com/q/22614543

http://stackoverflow.com/q/22513697
has answer: http://stackoverflow.com/a/22913986
favorite count: 0
tagged with: exception
has body: I use iText 5.5.0 and BouncyCastle bcprov-jdk15on-1.50 for digitally signing a pdf. It all works fine if I do not include a time stamp in the MakeSignature.signDetached method. When I use the TSAClient specifying the TSAURL, my code gives me the error java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1Encodable at MakeSignature.signDetached method and my program gets terminated even though I handled exceptions. I tried different versions of bouncycastle jars but I get the same error with difference in the classes not found. I really need Timestamp included in the Signature. What should I do.
has answer: http://stackoverflow.com/a/75313157
answer count: 4
has comment: http://stackoverflow.com/comment/34262178
tagged with: bouncycastle
upvote count: 5
has answer: http://stackoverflow.com/a/35547546
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23760484
tagged with: timestamp
linked to: http://stackoverflow.com/q/10391271
downvote count: 0
has comment: http://stackoverflow.com/comment/34256334
has title: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1Encodable
tagged with: java
tagged with: itext
type: Question
has comment: http://stackoverflow.com/comment/34255775
has comment: http://stackoverflow.com/comment/80795529
score: 5

http://stackoverflow.com/a/27125427
has body: Not all sources with jdk Some people say that sources should be included with jdk's src.zip file. This is what I got in C:\Program Files\Java\jdk1.8.0_25\src.zip\com\sun\security auth jgss So there is no provider directory nor rsa etc. Solution You can see the file source here. To get it working in Eclipse using F3, download the zipped source. Rename it to C:\Program Files\Java\jdk1.8.0_25\src.zip Linux's jdk src.zip is also incomplete. Eclipse settings If you cannot find the declaration with F3 in Eclipse try this Also if you want to open implementation declaration try this
type: Answer
score: 4
answers question: http://stackoverflow.com/q/22538037
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/34357481
comment on: http://stackoverflow.com/a/22565520
has text: If a thread reads the contents of a `final` field and copies it to a non-final field, do happens-before relationships that were applicable to the `final` field also applicable to the copied field? Otherwise, what would you think of the idea of having two `data` fields, one volatile and one not? For many read operations, the costs associated with stale data would be less than the costs of having the CPU ensure that data was up-to-date, but if code which read `null` from the non-volatile pointer were to read the volatile pointer, correctness would be assured.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22565650
tagged with: java
has comment: http://stackoverflow.com/comment/34380131
has title: creating a link to pdf files in netbeans
type: Question
has comment: http://stackoverflow.com/comment/34359524
score: 0
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/34359715
has comment: http://stackoverflow.com/comment/34359618
type: UnansweredQuestion
tagged with: netbeans
answer count: 0
has body: I am working on a project in netbeans, and right now I want to embed links to various pdf files so that when that link is clicked, the program will call up the appropriate pdf in it or somewhere in the hard disk and open it with the pdf viewer. I came across a 'clickable label' concept in one article, but I dont know how to do that, all the labels I insert do not link to the source tab when I double click on them. Can someone please provide an example of how to implement a 'clickable label'?

character-encoding
tags question: http://stackoverflow.com/q/22613533
tags question: http://stackoverflow.com/q/22628163
tag name: character-encoding
tags question: http://stackoverflow.com/q/22626975
tags question: http://stackoverflow.com/q/22591958
type: Tag
tags question: http://stackoverflow.com/q/22641131
tags question: http://stackoverflow.com/q/22505182

http://stackoverflow.com/comment/38822743
has text: You can write your own fill function. I think it is because of recursive callbacks this function has.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22596287

http://stackoverflow.com/q/22546800
has comment: http://stackoverflow.com/comment/34321746
answer count: 0
type: UnansweredQuestion
tagged with: swt
has title: How to make a SWT java program working with both 32 and 64 JVM?
tagged with: 32bit-64bit
has comment: http://stackoverflow.com/comment/34316851
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34351653
upvote count: 1
downvote count: 0
favorite count: 0
has body: I'm using SWT and i want to make one program that works with 32 and 64 JVM. My solution is stupid and i don't think it will work but if i simply add both SWT (32 and 64 bit) JARs to my build path, does it work? It's a bit vague because they both contain the same packages, and when i import a package, how can i know from which JAR i imported it? And if i can specify from which JAR i'm importing, is it possible to do it by using System.getProperty("sun.arch.data.model")) ? I'm searching java code solutions because i found some solutions with - as i think - xml files but i didn't understand them and i prefer resolving this problem using java. Otherwise, please explain to me any method that does the work.
tagged with: jvm

http://stackoverflow.com/comment/34429950
type: QuestionComment
comment on: http://stackoverflow.com/q/22606313
score: 0
has text: Interestingly it works in Firefox...
type: Comment

http://stackoverflow.com/comment/34492209
score: 0
has text: AFAIK, there's no way to edit a bucket's default object ACL through the console. What you've probably changed is the ACL on the bucket itself. There's a [table](https://developers.google.com/storage/docs/accesscontrol#scopes) in our docs that explains this relationship. Probably the easiest way to set default object ACLs is through [gsutil's "defacl" command](https://developers.google.com/storage/docs/gsutil/commands/defacl).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22618766

http://stackoverflow.com/q/22538633
has body: I am trying to have a button call a method in another class to update the color of something, however it is not functioning as I expect it to. The issue is that the color is changed once but never changed again. This is the file where the changing happens: public class Status { //initial conditions Color pedLightColor = Color.RED; Color warnLightsColor = Color.GREEN; Boolean GatesUp= true; Color drawbridgeColor = Color.green; public Status() { } public Color getPedestrianStatus() { return pedLightColor; } public void setPedestrianColor(Color c) { if(c.equals(Color.RED)) { pedLightColor=Color.green; System.out.println("Pedestrian Light color changed to " + pedLightColor); } else { pedLightColor=Color.red; System.out.println("Pedestrian Light color changed to " + pedLightColor); } } } and it is called as follows: pedButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { System.out.println("Control Unit/Pedestrian Button Clicked"); Status status = new Status(); status.setPedestrianColor(status.getPedestrianStatus()); System.out.println(status.getPedestrianStatus()); } }); Currently I believe that I am changing the color by calling the setPedestrianColor() method with the current color as the argument. However I am not sure why once you press the button a second time the color should be green so it should change back to red but this is not the case. Any suggestions for where I am going wrong are appreciated.
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34300002
possible better answer: http://stackoverflow.com/a/22538762
has comment: http://stackoverflow.com/comment/34300087
tagged with: colors
accepted answer: http://stackoverflow.com/a/22538730
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34299957
has answer: http://stackoverflow.com/a/22538762
tagged with: java
has title: Changing variables from different classes
has answer: http://stackoverflow.com/a/22538730
type: Question
has comment: http://stackoverflow.com/comment/34300003

http://stackoverflow.com/a/22587007
score: 0
has body: The reason you're getting an output of 0.0 for the getComputeRatio() method is because you never actually made any changes to the results instance variable after construction. During construction results was implicitly set to 0.0. In essence, it were as if your constructor were written like so: public Checkup(int number, int sys, int dia, double l, double h) { patientNumber = number; systolic = sys; diastolic = dia; ldl = l; hdl = h; results = 0.0; // &lt;==== } After that, however, the variable is never touched again... To better explain what I mean, take a look at the following sample code: public class Tester { public static void main(String[] args) { // Create a new Checkup object Checkup personA = new Checkup(1, 2, 3, 4.0, 5.0); // Calculate ratio personA.setComputeRatio(personA.getLDL(), personA.getHDL()); // &lt;== This is needed... // Get results personA.printCheckup(); // ... before you do this. Otherwise results will always equal 0.0 } } Now in your original post you asked: "Can anyone please guide in the right direction on how to properly use get and set methods and using them with other methods that do calculations?" One way to accomplish this would be to make the following change to your setComputeRatio(...) method definition: public void setComputeRatio() { results = getLDL() / getHDL(); /* Or you could also do: results = ldl / hdl; */ } The above code not only implements your previously created get methods, but does so in a calculation. It also makes things less cumbersome and awkward, for example: // Calculate ratio personA.setComputeRatio(personA.getLDL(), personA.getHDL()); can now be shortened to: // Calculate ratio personA.setComputeRatio(); Hope this helps! Kind regards, KLM
has comment: http://stackoverflow.com/comment/34398430
has comment: http://stackoverflow.com/comment/34396001
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34387512
answers question: http://stackoverflow.com/q/22586898
accepted answer of: http://stackoverflow.com/q/22586898

http://stackoverflow.com/q/22593748
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34399828
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/34398902
has comment: http://stackoverflow.com/comment/34423599
downvote count: 0
has body: I have a problem with my snake game for android. I have managed to write a simple application with LibGDX and it works. However when I try to use OpenGL ES 2.0 (as opposed to 1.0) it crashes on both an Android phone and a virtual device. It works fine on desktop. I know that my phone supports OpenGL ES 2.0 as the sample application from this tutorial works just fine. The problem occurs when I change the line: cfg.useGL20 = false; to cfg.useGL20 = true; How can I fix this?
has comment: http://stackoverflow.com/comment/34397955
favorite count: 0
tagged with: android
tagged with: opengl-es
has title: Crash when trying to use LibGDX and OpenGL ES 2.0 on Android

http://stackoverflow.com/a/22499190
accepted answer of: http://stackoverflow.com/q/22499096
has comment: http://stackoverflow.com/comment/34230454
type: Answer
has comment: http://stackoverflow.com/comment/34230292
downvote count: 0
has body: Please set the JAVA_HOME environment variable in your machine. It is failing because the property JAVA_HOME is not set. If you do not want to set it at machine level, then set it in the build.xml file. UPDATE after the code has been posted Looks like you are using a property java.home1_6 in the build.xml file. You need to set that in the file by either using the properties file or using the property task. for e.g. &lt;property name="foo.dist" value="dist"/&gt;
score: 1
has comment: http://stackoverflow.com/comment/34230352
answers question: http://stackoverflow.com/q/22499096
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/22555485
type: UnansweredQuestion
tagged with: utf-8
has title: Encode french character in Java?
tagged with: java
has comment: http://stackoverflow.com/comment/34328934
type: Question
tagged with: jsmpp
has comment: http://stackoverflow.com/comment/34328979
has body: How can i encode french Character? let's say i have String strMEssage='Pour se désinscrire du service '; String utf8 = new String(strMessage.getBytes("ISO8859_15"),"ISO8859_15"); o/P is not proper for special char ? is coming
tagged with: smpp
score: 0
has comment: http://stackoverflow.com/comment/34329015
has comment: http://stackoverflow.com/comment/34328875
answer count: 1
has answer: http://stackoverflow.com/a/22555605

http://stackoverflow.com/q/22512345
tagged with: bukkit
has body: Basically I have started updating a lot of Heroes spells to 1.7.2 and this update broke the .getHealth() and .getMaxHealth(). I am trying to fix it but I do not know how to. If anyone has some advice or samples I will be in debt. I will place some code where I use the .getHealth() method. this is the link of the error: http://puu.sh/7BrEP.png. It is saying this method is ambigous for that type. public void tickHero(Hero hero) { if ( hero.getPlayer().getHealth() - damage &gt; 1) { addSpellTarget(hero.getPlayer(), plugin.getCharacterManager().getHero(caster)); damageEntity(hero.getPlayer(), caster, damage, DamageCause.MAGIC); //hero.getPlayer().damage(damage, caster); } }
type: Question
score: 0
has title: How to use the method getHealth() in Bukkit using Heroes
answer count: 1
tagged with: minecraft
has comment: http://stackoverflow.com/comment/34252882
has comment: http://stackoverflow.com/comment/34266766
has comment: http://stackoverflow.com/comment/34253689
has comment: http://stackoverflow.com/comment/34252931
has comment: http://stackoverflow.com/comment/34254940
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22521249
tagged with: java

http://stackoverflow.com/comment/34491846
comment on: http://stackoverflow.com/q/22645937
type: Comment
type: QuestionComment
has text: i think without a response from him, we could say everything can cause a NPE here.
score: 2

http://stackoverflow.com/q/22547932
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/22549992
has comment: http://stackoverflow.com/comment/34336680
tagged with: java
upvote count: 1
has title: Android: getting classcastexception when creating button on fragment
has comment: http://stackoverflow.com/comment/34316951
has body: here is the fragment code. I am trying to create a button inside but i keep getting an error. public static class PlaceholderFragment extends Fragment { Button startButton; public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView; rootView = inflater.inflate(R.layout.fragment_main, container, false); startButton = (Button) rootView.findViewById(R.id.enter); startButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent("com.appname.STUFF")); } }); return rootView; } @Override public void onAttach(Activity activity) { super.onAttach(activity); } } here is the error i keep getting. I dont know why, ive tried doing this in many locations and still get this error. 03-20 20:27:21.093: E/AndroidRuntime(27201): FATAL EXCEPTION: main 03-20 20:27:21.093: E/AndroidRuntime(27201): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appname/com.appname.MainActivity}: java.lang.ClassCastException: android.widget.Button 03-20 20:27:21.093: E/AndroidRuntime(27201): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) 03-20 20:27:21.093: E/AndroidRuntime(27201): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 03-20 20:27:21.093: E/AndroidRuntime(27201): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 03-20 20:27:21.093: E/AndroidRuntime(27201): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935) 03-20 20:27:21.093: E/AndroidRuntime(27201): at android.os.Handler.dispatchMessage(Handler.java:99) 03-20 20:27:21.093: E/AndroidRuntime(27201): at android.os.Looper.loop(Looper.java:130) 03-20 20:27:21.093: E/AndroidRuntime(27201): at android.app.ActivityThread.main(ActivityThread.java:3691) 03-20 20:27:21.093: E/AndroidRuntime(27201): at java.lang.reflect.Method.invokeNative(Native Method) 0…
accepted answer: http://stackoverflow.com/a/22549992
has answer: http://stackoverflow.com/a/22548043
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22548043
tagged with: button
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34316911
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34316989
has comment: http://stackoverflow.com/comment/34317423

http://stackoverflow.com/comment/34324777
type: Comment
comment on: http://stackoverflow.com/a/22552474
has text: Viewing is very small..i m newer in stackoverflow..tel me how to load my snapshot..here??
score: 0
type: AnswerComment

http://stackoverflow.com/a/22561897
score: 1
has body: How about this? int output=0; for(int i=0;i&lt;u.length();i++) output=output&lt;&lt;1|u[i]-'a';
has comment: http://stackoverflow.com/comment/34340392
answers question: http://stackoverflow.com/q/22561767
downvote count: 0
has comment: http://stackoverflow.com/comment/34340169
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34489524
comment on: http://stackoverflow.com/q/22644767
has text: The sender is going to need a reference to the object it wants to send to. There's a few ways to do this. For example, if the instance of MealButtonListener exists when you construct your NoButtonListener you can pass a reference to the object to it then. Without the containing context it's hard to say what the "best way" is to do this.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34226610
comment on: http://stackoverflow.com/q/22491978
has text: So let me get this straight. You have an applet with package statement:- `package defaultPackage;`? (Package names should be all lower case, BTW.)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22602705
has comment: http://stackoverflow.com/comment/34414132
upvote count: 4
has comment: http://stackoverflow.com/comment/34414102
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22602432
has body: Your bootstrap code is flawed you are calling both start and run effectively running the code twice. Remove the call to run.
type: Answer

http://stackoverflow.com/a/22657326
answers question: http://stackoverflow.com/q/22524516
has body: The problem is caused by the call of uiModel.addAttribute("smaker", Smak.findAllSmaker(sortFieldName, sortOrder)); especially this part: Smak.findAllSmaker Without any application context and resulting dependency injection or mocking this line will produce the problem you are facing.
upvote count: 1
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22524516
type: Answer
score: 1

http://stackoverflow.com/q/22589700
has comment: http://stackoverflow.com/comment/44137371
downvote count: 0
has answer: http://stackoverflow.com/a/49717839
answer count: 3
has comment: http://stackoverflow.com/comment/115630138
has title: Searching WordNet for Synonym gives only one result
has answer: http://stackoverflow.com/a/27896853
favorite count: 0
tagged with: jwi
has comment: http://stackoverflow.com/comment/44195451
accepted answer: http://stackoverflow.com/a/27896853
has comment: http://stackoverflow.com/comment/44117102
has comment: http://stackoverflow.com/comment/44137339
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22598570
has comment: http://stackoverflow.com/comment/44119588
has comment: http://stackoverflow.com/comment/44191769
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/44118426
tagged with: wordnet
possible better answer: http://stackoverflow.com/a/22598570
has comment: http://stackoverflow.com/comment/44194060
type: Question
has body: I am using java jwi API for searching the wordnet to get the synonyms of a word. The problem is that it only gives me one result the word to find its synonyms itself. Please guide me. Is it possible to get the list of all possible synonyms of a given word? My code is: public void searcher() { try { url = new URL("file", null, path); dict = new Dictionary(url); try { dict.open(); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Dictionary directory does not exist\n" + ex + "\nClass:Meaning Thread", "Dictionary Not Found Error", JOptionPane.ERROR_MESSAGE); } IIndexWord idxWord = dict.getIndexWord("capacity", POS.NOUN); IWordID wordID = idxWord.getWordIDs().get(0); IWord word = dict.getWord(wordID); //Adding Related Words to List of Realted Words ISynset synset = word.getSynset(); for (IWord w : synset.getWords()) { System.out.println(w.getLemma()); } } catch (Exception e) { } } The output is only: capacity itself! The actual synonyms must be: capability capacitance content electrical capacitance mental ability...(so on) So is there anything I missed in the code or can somebodygive me any ideas what is the real problem? Thanks in advance
has comment: http://stackoverflow.com/comment/44192888
score: 5
tagged with: synonym
linked to: http://stackoverflow.com/q/65403290

http://stackoverflow.com/q/22578953
score: -1
tagged with: floating-point-precision
favorite count: 0
has answer: http://stackoverflow.com/a/22579092
tagged with: double
has comment: http://stackoverflow.com/comment/34371116
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/34371095
type: AnsweredQuestion
tagged with: java
has body: I am trying to create a class dedicated to the floating point precision management. Actually, it takes your double and the number of decimal it has to be rounded, then everytime you will modify it with set(double), the number will be automatically rounded. public class Precision { public Precision(int rounding, double n) { setRounding(rounding); set(n); } public double get() { return this.n; } public void set(double n) { this.n = Math.round(n * Math.pow(10, rounding)) / rounding; } public void inc(double n) { set(get() + n); } public int getRounding() { return this.rounding; } public void setRounding(int rounding) { if (rounding &gt; 324) throw new UnsupportedOperationException("Can't round numbers after 324 decimals"); else this.rounding = rounding; } public void copy(Precision p) { this.rounding = p.getRounding(); this.n = p.n; } private int rounding; private double n; } But it doesn't work as expected, when I do operations on the number it simply doesn't set the expected number. For instance: Precision p = new Precision(2, 0); // Here p.n is worth 0.00 p.set(8.6596) // Here p.n is worth 432.5 p.inc(3.2); // Here p.n is worth 21785
type: Question
accepted answer: http://stackoverflow.com/a/22579092
has comment: http://stackoverflow.com/comment/34371008
has title: Rounding a floating number
has comment: http://stackoverflow.com/comment/34371133
answer count: 1

http://stackoverflow.com/q/22592530
tagged with: java
has comment: http://stackoverflow.com/comment/34396376
type: Question
has title: How to configure the web.xml file?
has body: I have created login page in servlet: public class dologin extends HttpServlet { static Connection con; static String query =null; static ResultSet rs; static PreparedStatement pstmt; String user=null; String passwd = null ; public void init(ServletConfig sc) { try { super.init(sc); /*Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); System.out.println("class loaded ... "); con=DriverManager.getConnection("jdbc:odbc:Odbc_mailing"); System.out.println("connected ... "); st=con.createStatement(); System.out.println("stmt created ... ");*/ } catch(Exception e) { e.printStackTrace(); } } public void service(HttpServletRequest hreq ,HttpServletResponse hrep) { boolean flag=false; try { String s1=hreq.getParameter("smid"); String s2=hreq.getParameter("smpw"); System.out.println("s1 : "+ s1+"s2 : "+s2); Cookie logincook=new Cookie("logincook",s1); Cookie pwdcook=new Cookie("pwdcook",s2); hrep.addCookie(logincook); hrep.addCookie(pwdcook); System.out.println("logincook :"+ logincook); System.out.println("pwd:"+ pwdcook); ServletOutputStream sos = hrep.getOutputStream(); String query="select * from login where username=?"; con=DBConnection.getConnection(); pstmt=con.prepareStatement(query); pstmt.setString(1, s1); rs=pstmt.executeQuery(); //fname,pass1 System.out.println("query executed ... rs "+rs); while(rs.next()) { System.out.println("in while loop"); // user=rs.getString(1); //passwd=rs.getString(2); System.out.println("user : "+ user + "passwd : "+passwd); if((user.equals(s1))&&(passwd.equals(s2))) { flag=true; break; } } System.out.println("Aft while loop flag : "+ flag); if (flag==false) { sos.println(" You are an invalid user "); hrep.setHeader("Refresh", "2 URL=/supermail/index.html"); } if(flag==true){ hrep.sendRedirect("/supermail/inbox.html"); } flag = false; } catch(Exception ex) { ex.printStackTrace(); } } } and login.html is: Username: Paswword: I have configured the web.xml like: dologin dologin dologin /dologin I am using myeclipse IDE if run the I am getting …
tagged with: servlets
score: 0
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/22593009
type: UnansweredQuestion

http://stackoverflow.com/comment/34419144
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22596988
has text: Thank you. I had tried searching Hibernate's JIRA but hadn't been able to find this. This is exactly the same problem, so thanks for the link.

http://stackoverflow.com/a/22626902
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34459106
has comment: http://stackoverflow.com/comment/34459905
has body: Let's just count the comparisons: for (int anArray : array) { // &lt;- One: check array's border if (anArray &lt; min) // &lt;- Two min = anArray; else { if (anArray &gt; max) // &lt;- Three max = anArray; } } Finally N * 3 = 3N (in the worst case) for (; i &lt; length / 2; i++) { // &lt;- One int number1 = arr[i * 2]; // &lt;- Two int number2 = arr[i * 2 + 1]; // &lt;- Three if (arr[i * 2] &gt;= arr[i * 2 + 1]) // &lt;- Five, Six: arr[i * 2]; Seven: arr[i * 2 + 1] { if (number1 &gt; max) // &lt;- Eight max = number1; if (number2 &lt; min) // &lt;- Nine min = number2; } else { if (number2 &gt; max) // &lt;- Eight max = number2; if (number1 &lt; min) // &lt;- Nine min = number1; } } Finally: N/2 * 9 = 4.5N or if optimizer is good enough and it can eliminate 5, 6 we have however N/2 * 7 = 3.5N You can slightly improve your code int min = array[array.length - 1]; int max = min; // &lt;- there's no need to call array[array.length - 1] // You can start from array.length - 2 not from usual array.length - 1 here // Comparison with constant 0 is slightly better // (one JZ or JNZ assembler instruction) // than with array.length for (int i = array.length - 2; i &gt;= 0; --i) { int v = array[i]; if (v &gt; max) max = v; else if (v &lt; min) min = v; }
answers question: http://stackoverflow.com/q/22626713
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34459391

http://stackoverflow.com/comment/34469330
type: QuestionComment
has text: Are you using `EncryptStringToBytes_Aes` as defined on this page: http://msdn.microsoft.com/en-us/library/system.security.cryptography.aes.aes%28v=vs.110%29.aspx?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22633253

http://stackoverflow.com/comment/34441316
comment on: http://stackoverflow.com/a/22616807
score: 0
type: AnswerComment
has text: In this case, your NPE is probably because the `person` String passed into `isValid` isn't the same as the `person` value (presumably from a field) that is in scope during `testIsValid`.
type: Comment

http://stackoverflow.com/comment/34470042
comment on: http://stackoverflow.com/a/22632755
has text: Look into this example: it explains everything: http://www.learn-android-easily.com/2013/06/android-viewflipper-example.html
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34286783
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22529436
has text: It's a bit hard to read the math, but I am getting the idea. Tnx

http://stackoverflow.com/q/22637914
tagged with: lucene
has body: I'm attempting to use a lucene index in a neo4j 2.0.1 database to do a fuzzy query for particular terms in the name property of nodes. When executing these queries, although the lucene syntax looks OK, it fails with a mysterious NullPointerException. It could be that I've made some straightforward mistake in the lucene syntax, but how can I discover what that is? String query = "start n=node:node_auto_index({searchCriteria}) "+ "match (n:Provenance) " + "return n " + "order by n.created desc " + "limit 10"; String expr = term; if(term.contains(" ") || term.contains("\t")) expr = "\"" + term + "\""; expr = "'name:" + expr + "~'"; log.info("search expression=" + expr); Map&lt;String,Object&gt;params = new HashMap(); params.put("searchCriteria", expr); When this method is run with an argument of "track", the output is this: INFO: search expression='name:track~' java.lang.NullPointerException at org.apache.lucene.util.SimpleStringInterner.intern(SimpleStringInterner.java:54) at org.apache.lucene.util.StringHelper.intern(StringHelper.java:39) at org.apache.lucene.index.Term.(Term.java:38) at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:643) at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1436) at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1319) at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1275) at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234) at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206) at org.neo4j.index.impl.lucene.IndexType.query(IndexType.java:303) at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:251) at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:263) at org.neo4j.kernel.impl.coreapi.AbstractAutoIndexerImpl$ReadOnlyIndexToIndexAdapter.query(AbstractAutoIndexerImpl.java:249) at org.neo4j.cypher.internal.spi.v2_0.TransactionBoundExecutionContext$NodeOperations.indexQuery(Transactio…
type: Question
tagged with: neo4j
has title: Overcoming NullPointerException on Cypher Lucene query
tagged with: cypher
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22639250
type: UnansweredQuestion

http://stackoverflow.com/comment/34491042
score: 0
type: AnswerComment
has text: regarding your edited code, what are the properties of the "addBefore" method so I can understand what you're trying to do? Or is that what you mean by the "previous node"?
type: Comment
comment on: http://stackoverflow.com/a/22644215

http://stackoverflow.com/comment/34464209
score: 0
comment on: http://stackoverflow.com/q/22629884
type: QuestionComment
type: Comment
has text: @Octopus Read my post again

http://stackoverflow.com/comment/34448594
comment on: http://stackoverflow.com/q/22615264
score: 0
has text: @BlaiseDoughan, nope the exception only occurs when the code is run under cobertura tool. It never occurs when unit test are run without the coverage, also it works fine in production and in the IntelliJ IDE. In fact in IntelliJ it works both when it run with or without coverage tool.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34490305
score: 0
comment on: http://stackoverflow.com/a/22623538
type: AnswerComment
type: Comment
has text: @nachokk, This approach is probably the simplest, although I would use a BorderLayout on the panel and then just add the text area to the SOUTH. There is no need for the second component. You can use a custom view for the JTextPane. Not sure how simple it is but check out stanislavl's [Center Text Vertically](http://java-sl.com/tip_center_vertically.html). You just need to change the "offset" calculation in the `CenteredBoxView` to use `offset = (targetSpan - textBlockHeight);`

http://stackoverflow.com/q/22579661
tagged with: bytecode
linked to: http://stackoverflow.com/q/10315354
has comment: http://stackoverflow.com/comment/34395813
type: AnsweredQuestion
score: 3
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34377824
has title: Is it possible to get an estimation of the number of instructions executed by Dalvik bytecode through analyzing Java bytecode
tagged with: dalvik
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/34374232
has answer: http://stackoverflow.com/a/22579838
has body: I am building a static code analyzer that estimates the number of instructions executed by a Java method in an Android application. I want to know how resource-intensive is the method for the device. Thus, I am interested to know the number of instructions executed when running Dalvik bytecode. Currently, I am using the following command to get information about the instructions to be executed. $ dexdump -d Class.dex | less I know that the Dalvik bytecode is created by wrapping Java bytecode, like this public class Foo{ public static void main (String[] args){ System.out.println("Here we do smt"); } } $ javac Foo.java $ dx --dex --output=foo.jar Foo.class Since the input of my static analyzer is the Java source code of the application. I thought at first to convert each source file to dex, and then to execute the dexdump command to the information I need. However, I'd like to avoid converting to dex files, and instead to use the following command directly on the source code. Ideally, I am planning to use an existing tool for Java code analysis. $ javap -c Classes But, since Java VM is stack-based, and the Dalvik VM is register-based. I am bit skeptical about this strategy. I think that even though, I am comparing the same source code, Dalvik bytecode requires less number of instructions than Java bytecode. Thus, probably I'll lose some accuracy in my estimation. Am I right? or I am missing something here? Any thoughts on this or suggestions about any other method, I'll be appreciate it. Thanks
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22579838
has comment: http://stackoverflow.com/comment/34372835

http://stackoverflow.com/a/73060513
score: 0
has body: A java solution that gave me 100/100 class Solution { public int solution(int[] A) { int sumOfNPlusOne = ((A.length)*(A.length+1))/2; boolean sumStatus = false; int arrayEleSum = 0; for(int a: A){ arrayEleSum+=a; } if(arrayEleSum == sumOfNPlusOne) sumStatus = true; if(!sumStatus) return 0; boolean[] status = new boolean[A.length+1]; status[0]=true; for(int i=0; i&lt;A.length; i++){ if(A[i]&gt;=status.length) continue; if(!(status[A[i]])){ status[A[i]] = true; } } boolean missingStatus = false; for(boolean stat: status){ if(!stat){ missingStatus = true; break; } } if(!missingStatus)return 1; return 0; } }
answers question: http://stackoverflow.com/q/22579054
type: Answer

http://stackoverflow.com/comment/34286052
has text: you can typecast (uppercast) to `JComponent` and then do an `instanceof` test with `JButton` and `JMenuItem`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22530571
type: AnswerComment

http://stackoverflow.com/comment/34376279
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22581571
has text: Are these all local variables?

http://stackoverflow.com/q/22621194
linked to: http://stackoverflow.com/q/24551
has comment: http://stackoverflow.com/comment/34447530
answer count: 4
has answer: http://stackoverflow.com/a/22621317
has answer: http://stackoverflow.com/a/22621326
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34447612
tagged with: default-constructor
tagged with: java
has answer: http://stackoverflow.com/a/22621345
has comment: http://stackoverflow.com/comment/34447685
type: Question
has title: Java constructor does not look the way it should
has comment: http://stackoverflow.com/comment/34447847
has comment: http://stackoverflow.com/comment/34447637
accepted answer: http://stackoverflow.com/a/22621317
has comment: http://stackoverflow.com/comment/34447833
possible better answer: http://stackoverflow.com/a/22621277
score: 0
has comment: http://stackoverflow.com/comment/34447619
has answer: http://stackoverflow.com/a/22621277
has body: I am referencing Y. Daniel Liang's book "Introduction To Java Programming, Comprehensive Version, Ninth Edition" when I ask this question. Every time I see an object created by using a constructor, it goes something like this : Car engine = new Car(). But in Daniel Liang's book, I found the following code (only the first 9 lines written here): public class SimpleGeometricObject { private String color = "white"; private boolean filled; private java.util.Date dateCreated; /** Construct a default geometric object */ public SimpleGeometricObject() { dateCreated = new java.util.Date(); } What I don't understand is how come the object "dateCreated" is not created in the normal way, ie.: SimpleGeometricObject dateCreated = new SimpleGeometrciObject(); I'm confused.

http://stackoverflow.com/a/22508489
upvote count: 9
accepted answer of: http://stackoverflow.com/q/22507590
score: 9
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34245899
answers question: http://stackoverflow.com/q/22507590
type: Answer
has body: The short version is that login processes that use a login page need to create session to store the target page. The longer version is that the login process (assuming successful authentication) will be something along these lines: User agent requests /some/secure/page Container checks for authenticated user User not authenticated so container starts login process Container creates a session Container adds target page URL (/some/secure/page) to session Container redirects user to login page User logs in Container validates credentials Container changes ID of session (to prevent session fixation) Container gets target page URL from session Container redirects user to target page User agent requests target page Container checks for authenticated user User is authenticated so container displays requested page Without the session the container has no way to track which (of the potentially many) pages requiring authentication the user asked for and therefore no way to redirect them to the requested page after authentication completes.

http://stackoverflow.com/q/22637877
has title: Java Memoization of Recursive method
linked to: http://stackoverflow.com/q/3906831
tagged with: java
has answer: http://stackoverflow.com/a/29740406
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34476899
downvote count: 0
score: 8
favorite count: 0
possible better answer: http://stackoverflow.com/a/29740406
accepted answer: http://stackoverflow.com/a/22638182
upvote count: 8
has body: I am trying to create a memoized version of Factorial function. When I call factMemoized(4), it computes the factorial of 4 for the first time and stores it in a Map. When I call factMemoized(4) again, it now gives the stored result instead of recomputing it again. This works as expected. But, when I call factMemoized(3), it recomputes the value, eventhough it had computed fact(3) as part of computing fact(4). Is there any way to make sure that even the values computed as part of recursive calls will be stored in the map without adding the memoization function within the fact() function? import java.util.HashMap; import java.util.Map; public class MemoizeBetter { public static &lt;F, T&gt; Function&lt;F, T&gt; memoize(final Function&lt;F, T&gt; inputFunction) { return new Function&lt;F, T&gt;() { // Holds previous results Map&lt;F, T&gt; memoization = new HashMap&lt;F, T&gt;(); @Override public T apply(final F input) { // Check for previous results if (!memoization.containsKey(input)) { // None exists, so compute and store a new one memoization.put(input, inputFunction.apply(input)); }else{ System.out.println("Cache hit:"+input); } // At this point a result is guaranteed in the memoization return memoization.get(input); } }; } public static void main(String args[]){ final Function&lt;Integer, Integer&gt; fact = new Function&lt;Integer, Integer&gt;() { @Override public Integer apply(final Integer input) { System.out.println("Fact: " + input); if(input == 1) return 1; else return input * apply(input -1); } }; final Function&lt;Integer, Integer&gt; factMemoized = MemoizeBetter.memoize(fact); System.out.println("Result:"+ factMemoized.apply(1)); System.out.println("Result:"+factMemoized.apply(2)); System.out.println("Result:"+factMemoized.apply(3)); System.out.println("Result:"+factMemoized.apply(2)); System.out.println("Result:"+factMemoized.apply(4)); System.out.println("Result:"+factMemoized.apply(1)); } } interface Function&lt;F,T&gt;{ T apply(F input); }
tagged with: memoization
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22638182

http://stackoverflow.com/q/22490122
has title: Embedded H2 + Tomcat 7 JDBC realm + Hibernate = "Locked by another process"
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/35388820
upvote count: 1
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/22937826
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34215231
has body: Perhaps the title is self explanatory, but I am trying to create a web application with an embedded instance of the H2 database. I am configuring Tomcat 7 to use the JDBC realm to form-based authentication. server.xml has: &lt;Realm className="org.apache.catalina.realm.JDBCRealm" driverName="org.h2.Driver" connectionURL="jdbc:h2:/someDir/myDB" connectionName="userName" connectionPassword="password" userTable="user_enabled" userNameCol="user_name" userCredCol="pass" userRoleTable="user_role" roleNameCol="role_name" /&gt; I am also using Hibernate for persistence. persistence.xml has: &lt;property name="hibernate.connection.driver_class" value="org.h2.Driver" /&gt; &lt;property name="hibernate.connection.url" value="jdbc:h2:/someDir/myDB" /&gt; &lt;property name="hibernate.connection.username" value="userName" /&gt; &lt;property name="hibernate.connection.password" value="password" /&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /&gt; &lt;property name="hibernate.hbm2ddl.auto" value="validate" /&gt; &lt;property name="hibernate.show_sql" value="true" /&gt; &lt;property name="current_session_context_class" value="org.hibernate.context.internal.ThreadLocalSessionContext" /&gt; If I try to start the server I get: (...) Caused by: org.h2.jdbc.JdbcSQLException: Database may be already in use: "Locked by another process". And my web application fails to start. Starting an H2 TCP server and replacing JDBC URLs with jdbc:h2:tcp://myIP/ works fine. So no problem with my database files. Also, I am sure nothing else is trying to use those files. So the conflict can only be between the JDBC realm and Hibernate. Why do I want an embedded server? For the classic reasons: I want to distribute this application and I don't want users to have to start two processes instead of just one. Also, this will not be a shared database, so no need to create a new process just for that. Finally, no additional server ports are open for database, which is good fo…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34215136
downvote count: 0
has answer: http://stackoverflow.com/a/22937826
score: 1
possible better answer: http://stackoverflow.com/a/35388820
tagged with: java
tagged with: hibernate
tagged with: h2

http://stackoverflow.com/comment/34283208
type: QuestionComment
comment on: http://stackoverflow.com/q/22524128
score: 0
has text: @Amit.D I don't think I understand your question. Can you elaborate or maybe add a screenshot?
type: Comment

http://stackoverflow.com/q/22605621
has comment: http://stackoverflow.com/comment/34419230
has body: I have created an EJB project, and it's working fine, but when I add the Logger private transient static final Logger LOG=Logger.getLogger(MyServiceDAO.class); for log4j I get an error. That error is : Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB. When I remove the line everything is normal and works fine. the stacktrace: Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:700) at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:246) at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:430) ... 72 more Caused by: javax.ejb.CreateException: Could not create stateless EJB at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:514) at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:97) at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:698) ... 74 more Caused by: java.lang.IllegalStateException: Exception attempting to inject Remote ejb-ref name=LookupDAO,Remote 3.x interface =com.jpa.dao.LookupDAO,ejb-link=null,lookup=,mappedName=,jndi-name=com.jpa.dao.LookupDAO,refType=Session into class com.silence.session.stateless.AttachmentServiceSession: Lookup failed for 'java:comp/env/LookupDAO' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:145) at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:46) at org.jboss.weld.injection.producer.Def…
answer count: 0
tagged with: java
tagged with: logging
has title: Log4j prevent EJB to be created on the glassfish
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/34419168
has comment: http://stackoverflow.com/comment/34419256
tagged with: glassfish
score: 0
has comment: http://stackoverflow.com/comment/34418932
has comment: http://stackoverflow.com/comment/34419103
has comment: http://stackoverflow.com/comment/34419218
has comment: http://stackoverflow.com/comment/34419200
type: UnansweredQuestion

http://stackoverflow.com/q/22531061
tagged with: eclipse
type: Question
answer count: 1
score: 0
tagged with: osgi
tagged with: bundle
has title: Access to osgi bundle resources
has body: I have an osgi bundle that gets activated when I start my application. I only need to use it from time to time, but I need the bundle to maintain its state (its variables should stay with the same value). But I have been unable to do this: each time the handler gets activated, I have to initialize the bundle's variables again. Can someone explain how this is done?
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22531800

nullpointerexception
tags question: http://stackoverflow.com/q/22567404
tags question: http://stackoverflow.com/q/22633363
tags question: http://stackoverflow.com/q/22586835
tags question: http://stackoverflow.com/q/22489056
tags question: http://stackoverflow.com/q/22622756
tags question: http://stackoverflow.com/q/22628376
tags question: http://stackoverflow.com/q/22536622
tags question: http://stackoverflow.com/q/22616764
tags question: http://stackoverflow.com/q/22630098
tags question: http://stackoverflow.com/q/22626640
tags question: http://stackoverflow.com/q/22494255
tags question: http://stackoverflow.com/q/22610531
tags question: http://stackoverflow.com/q/22597486
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/22592087
tags question: http://stackoverflow.com/q/22493171
tags question: http://stackoverflow.com/q/22580955
tags question: http://stackoverflow.com/q/22640457
tags question: http://stackoverflow.com/q/22591160
tags question: http://stackoverflow.com/q/22531710
tags question: http://stackoverflow.com/q/22624439
tags question: http://stackoverflow.com/q/22582106
tags question: http://stackoverflow.com/q/22509114
tags question: http://stackoverflow.com/q/22596637
tags question: http://stackoverflow.com/q/22623269
tags question: http://stackoverflow.com/q/22642619
tags question: http://stackoverflow.com/q/22553890
tags question: http://stackoverflow.com/q/22539763
tags question: http://stackoverflow.com/q/22494866
tags question: http://stackoverflow.com/q/22612364
tags question: http://stackoverflow.com/q/22563248
tags question: http://stackoverflow.com/q/22507104
tags question: http://stackoverflow.com/q/22546028
tags question: http://stackoverflow.com/q/22573035
tags question: http://stackoverflow.com/q/22618323
tags question: http://stackoverflow.com/q/22624694
tags question: http://stackoverflow.com/q/22581201
tags question: http://stackoverflow.com/q/22569298
tags question: http://stackoverflow.com/q/22596731
tags question: http://stackoverflow.com/q/22572523

http://stackoverflow.com/a/22645343
has comment: http://stackoverflow.com/comment/34496719
has comment: http://stackoverflow.com/comment/34491704
has body: Remember, Rectangle (and Graphics#fillRect and Graphics#drawRect) won't render rectangles with negative width/heights You need two things... The current mouse point (or drag point in your case) The point where the mouse was first pressed (anchor or origin point) You should get the anchor point from the mousePressed event... public void mousePressed(MouseEvent e) { clickPoint = new Point(e.getPoint()); } You then need to make determinations about which point is the smallest and use that as the start and which is the largest and use those for dimensions. public void mouseDragged(MouseEvent e) { int minX = Math.min(e.getX(), clickPoint.x); int minY = Math.min(e.getY(), clickPoint.y); int maxX = Math.max(e.getX(), clickPoint.x); int maxY = Math.max(e.getY(), clickPoint.y); selection.x = minX; selection.y = minY; selection.width = maxX - minX; selection.height = maxY - minY; repaint(); } import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class SelectionExample { public static void main(String[] args) { new SelectionExample(); } public SelectionExample() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private Rectan…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34491872
accepted answer of: http://stackoverflow.com/q/22645172
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/34492370
answers question: http://stackoverflow.com/q/22645172
has comment: http://stackoverflow.com/comment/34542497
has comment: http://stackoverflow.com/comment/34491977
has comment: http://stackoverflow.com/comment/34495162
type: Answer
has comment: http://stackoverflow.com/comment/34496469
has comment: http://stackoverflow.com/comment/34540106
has comment: http://stackoverflow.com/comment/34491219
has comment: http://stackoverflow.com/comment/34496676
upvote count: 4
has comment: http://stackoverflow.com/comment/34496258

http://stackoverflow.com/q/22613976
has comment: http://stackoverflow.com/comment/34434413
has answer: http://stackoverflow.com/a/22618175
tagged with: java
has body: How could I display the values of enum structure in JSP? I use the Spring MVC to implement my project. Many thanks! public enum ProjectStatusEnum { INITIAL(0,"Initial"),ONGOING(1,"Ongoing"),CLOSED(2,"Closed"); private int value; private String key; ProjectStatusEnum(int value , String key){ this.value=value; this.key = key; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } }
type: Question
upvote count: 2
has title: How to create a drop down menu from an enum?
answer count: 2
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/34434180
has answer: http://stackoverflow.com/a/22614109
accepted answer: http://stackoverflow.com/a/22614109
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/22618175
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: enums

http://stackoverflow.com/a/22523749
type: Answer
has body: user1.setUser(request.getParameter("name")); user1.setPassword(request.getParameter("Password")); After this line try to print System.out.println("Name "+user1.getUser()+" password " +user1.getPassword)
answers question: http://stackoverflow.com/q/22523545
score: 0

http://stackoverflow.com/comment/34238361
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22504212
has text: From the [JavaDoc for `StringTokenizer`](http://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html) _StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code._ So the answer is don't catch any exception, rewrite your code. In this case you seem to be parsing a date so why not use the [correct approach](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html).
type: Comment

http://stackoverflow.com/q/22570401
tagged with: android
upvote count: 7
favorite count: 0
linked to: http://stackoverflow.com/q/934794
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/48798268
linked to: http://stackoverflow.com/q/16567136
has answer: http://stackoverflow.com/a/28863317
linked to: http://stackoverflow.com/q/24718958
has body: I just used Android Studio to make an unmodified empty Android app. I'm trying to set an exception breakpoint. The default exception breakpoint triggers repeatedly. So I added !(this instance of java.lang.ClassNotFoundException) as a condition, as suggested in this question. However, I still get interrupted by my exception, this time with a modal dialog box: How do I make an exception breakpoint that will stay silent until something exceptional happens? Edited to clarify: I don't want to make a breakpoint for a specific exception, I want a general exception breakpoint that I can leave on at all times.
tagged with: java
score: 7
type: Question
tagged with: debugging
answer count: 2
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/27838023
has comment: http://stackoverflow.com/comment/34371521
has title: Android Studio: Create well-behaved Exception Breakpoint
has comment: http://stackoverflow.com/comment/34356101
tagged with: breakpoints

http://stackoverflow.com/a/55195625
answers question: http://stackoverflow.com/q/22526695
has comment: http://stackoverflow.com/comment/132294000
has body: I had the same problem and solved it. I am using spring 3.x with java 8. If above solutions are not working change the jars and search whether those jars are compatible with the java version you are using or not. spring 3.x is not compatible with java 8.
upvote count: 1
downvote count: 1
score: 0
type: Answer

http://stackoverflow.com/comment/34284200
type: Comment
comment on: http://stackoverflow.com/q/22522964
type: QuestionComment
has text: Actually calling `executeQuery(<string>)` on a `PreparedStatement` should always throw a `SQLException`. It is a bug that MySQL Connector/J even allows this.
score: 0

http://stackoverflow.com/q/22589582
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/34413629
has title: Splash Screen Issue (No image on splash, no text on home)
downvote count: 0
favorite count: 0
tagged with: android
tagged with: splash-screen
has body: So I've tried to implement a splash screen for this android application that I'm trying to make. However, after looking at a lot of stack overflow solutions, none of them seem to fix it. There are several problems: When the splash screen transitions to the home screen, the home screen is just white with the action bar, no "Hello World!". The splash screen itself is pretty black. Not pitch black, but it either just doesn't show the picture, or it shows like the top 25% of it. The splash screen I used is located here: http://www.onlymobilepro.com/2013/01/16/android-beginner-creating-splash-screen/ (this is only used for testing purposes) So those are the two biggest issues. The splash screen transitions at the correct time, but with these weird glitches occuring. Here is my code. MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } fragment_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.studyapp.MainActivity" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> </RelativeLayout> styles.xml SplashActivity.java public class SplashActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent i = new Intent(SplashActivity.this, MainActivity.class); SplashActivity.this.startActivity(i); SplashActivity.this.finish(); } …
answer count: 0
type: UnansweredQuestion
tagged with: screen
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/comment/34223222
has text: I am not sure how I would check.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22494714

http://stackoverflow.com/q/22647034
score: 1
has comment: http://stackoverflow.com/comment/34493292
has answer: http://stackoverflow.com/a/22647189
tagged with: sockets
has answer: http://stackoverflow.com/a/22674941
upvote count: 1
accepted answer: http://stackoverflow.com/a/22671735
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22647189
tagged with: java
tagged with: timeout
type: Question
downvote count: 0
has body: I have a server (java app running on my laptop) and a client (java app running on my android smartphone). I'm trying to automatically find the IP address of the server from my client. Right now i just loop all IPs in the same LAN (192.168.1.0 > 192.168.1.1.255) and if the server (that is listening on a custom port) accept the connection then i found the IP. The problem is, if i set the connection timeout less then 200ms most of times the client can't find the server. So the question is, how i can implement a better (faster) way to find the server IP? I have tried the java InetAddress.isReachable() method but the server always seems unrechable... And, if there isn't a better way, what do you think it's a good timeout value from local (LAN) socket connections?
favorite count: 0
has answer: http://stackoverflow.com/a/22671735
has title: java: Good socket timeout for LAN connections?
answer count: 3
tagged with: android

http://stackoverflow.com/comment/34244761
type: Comment
has text: What about Apache's Http-components ?
score: 0
comment on: http://stackoverflow.com/q/22507736
type: QuestionComment

http://stackoverflow.com/a/22621180
upvote count: 2
has body: Use Spring ROO. It is good for an entry-level website and it doesn't required in-depth knowledge of all technologies enlisted. As you learn more you can replace components with your own. http://projects.spring.io/spring-roo/
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22621006
has comment: http://stackoverflow.com/comment/34447594
has comment: http://stackoverflow.com/comment/34587280

http://stackoverflow.com/q/22554417
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34327312
has comment: http://stackoverflow.com/comment/34327158
downvote count: 0
possible better answer: http://stackoverflow.com/a/22554469
favorite count: 0
accepted answer: http://stackoverflow.com/a/22554477
has answer: http://stackoverflow.com/a/22554469
tagged with: android
answer count: 4
has title: final reference object get modified
type: AnsweredQuestion
has body: I'm turning crazy on this one. What I want to do is to get an object from an ArrayList, and add it in 3 others after modifying it. The problem is that the object I get from my ArrayList is modified aswell when I modify the others... Can't figure out why, is this normal? Code below: final Product tmpRef = productsRef.get(i); Product tmp = tmpRef; tmp.setPos(products1.size()); Log.d("test2","tmpRef:"+tmpRef.getPos()+";tmp:"+tmp.getPos()); Product tmp2 = tmpRef; tmp2.setPos(products2.size()); Log.d("test2","tmpRef:"+tmpRef.getPos()+";tmp:"+tmp.getPos()+";tmp2:"+tmp2.getPos()); Product tmp3 = tmpRef; tmp3.setPos(products3.size()); Log.d("test2","tmpRef:"+tmpRef.getPos()+";tmp:"+tmp.getPos()+";tmp2:"+tmp2.getPos()+";tmp3:"+tmp3.getPos()); tmp.setPos(products1.size()); "pos" is just a simple int, with a getter/setter. LogCat output: 03-21 09:56:14.926: D/test2(6200): tmpRef:9;tmp:9 03-21 09:56:14.926: D/test2(6200): tmpRef:7;tmp:7;tmp2:7 03-21 09:56:14.926: D/test2(6200): tmpRef:0;tmp:0;tmp2:0;tmp3:0 With @FD_, @blackbelt and @Guidobaldo da Montefelt's explainations, I ended creating a simple new Porduct's constructor to be able to copy the object, and not only the reference. Thanks guys.
has comment: http://stackoverflow.com/comment/34327110
score: 1
tagged with: final
has answer: http://stackoverflow.com/a/22554542
tagged with: java
has comment: http://stackoverflow.com/comment/34327238
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22554477
has answer: http://stackoverflow.com/a/22554804

status
tags question: http://stackoverflow.com/q/22621841
tags question: http://stackoverflow.com/q/22628825
type: Tag
tag name: status

http://stackoverflow.com/comment/34470513
has text: So it seems something went wrong during code generation. Do u have JAVA_HOME properly set and pointing to JDK 7 you have ?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22629455
type: QuestionComment

http://stackoverflow.com/comment/34267894
score: 0
type: AnswerComment
type: Comment
has text: Hey Thanks for the help, doesn't seem to have worked. Currently this code is inside a fragment because I only want that search to be available when the fragment is on the screen. hence the getActivities. As a test I brought out all the code into the Main Activity itself, and I'm still having the exact same issue, I can find the menu item but I nullpointer when I try to get the actionView.
comment on: http://stackoverflow.com/a/22499125

http://stackoverflow.com/q/22566596
has title: Delegating the default hibernate message to failed validation in constraint composition
upvote count: 2
has answer: http://stackoverflow.com/a/22569715
score: 2
type: AnsweredQuestion
has body: I am developing an application where the use of constraint composition would be of great value. For example, instead of: @Size(min=1, max=60) @Pattern(regexp = "[a-zA-Z0-9]*") protected String invoiceNumber; I would be able to just write: @ValidInvoiceNumber protected String invoiceNumber; With the following annotation: @Size(min=1, max=60) @Pattern(regexp = "[a-zA-Z0-9]*") @ReportAsSingleViolation @Target({ METHOD, FIELD, ANNOTATION_TYPE }) @Retention(RUNTIME) @Constraint(validatedBy = {}) @Documented public @interface ValidInvoiceNumber { String message() default "{someMessageCode}"; Class&lt;?&gt;[] groups() default {}; Class&lt;? extends Payload&gt;[] payload() default {}; } The problem I am facing is that I would like the constraint violation message that is being returned from the validation to not be some generic @ValidInvoiceNumber message (like someMessageCode above), but instead to be the message of the actual annotation that failed. So for example, if the size check failed, I'll get back a Size error default message. If the Pattern message failed, I'll get the Pattern error default message. Currently I am just getting the general @ValidInvoiceNumber message which isn't providing enough information to the user. Thanks for your help.
tagged with: java
type: Question
tagged with: bean-validation
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22569715
favorite count: 0
tagged with: hibernate-validator

http://stackoverflow.com/a/22583123
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22583079
has body: You could make the resident set a member of the Floor class, so each instance keeps track of it's own residents: public class Floor { private Set&lt;Passenger&gt; resident = new HashSet&lt;&gt;(); public boolean isResident(Passenger p) { return resident.contains(p); } }
score: 4
type: Answer

http://stackoverflow.com/comment/34356046
type: AnswerComment
comment on: http://stackoverflow.com/a/22569415
score: 0
type: Comment
has text: I think I changed, it, but it's still incorrect. Been fiddling for the past 30 minutes trying to figure out why it doesn't account for the two elements? (updated question with new code)

http://stackoverflow.com/comment/34383161
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22585127
type: QuestionComment
has text: Do you need this because of an assignment or not? Because if not, you can just use repeated invocations of `Collections.indexOfSublist()`

http://stackoverflow.com/q/22571339
tagged with: collections
has comment: http://stackoverflow.com/comment/34358238
type: AnsweredQuestion
has body: I basically reviewed few open source libraries providing primitive collections types but can't find the exact thing I need. Here are my requirements: Primitive double as a key Object as value, or (even better) parametrized by value type Sorted - after each insertion sorts automatically Sorting should be customizable - I might need my own sorting on doubles Advise, please. Performance matters but let's not hollywar here on which favorite lib is faster. PS: Please, do not ask why i need primitive double as a key. Thank you for your advises!
has comment: http://stackoverflow.com/comment/34358007
tagged with: java
downvote count: 3
has title: Java: What type to use for sorted map with primitive double as key?
has comment: http://stackoverflow.com/comment/34358281
has comment: http://stackoverflow.com/comment/34358312
type: Question
accepted answer: http://stackoverflow.com/a/22571457
has comment: http://stackoverflow.com/comment/34358017
has comment: http://stackoverflow.com/comment/34358153
has comment: http://stackoverflow.com/comment/34357914
has comment: http://stackoverflow.com/comment/34358342
score: -1
has comment: http://stackoverflow.com/comment/34358031
has comment: http://stackoverflow.com/comment/34358235
has comment: http://stackoverflow.com/comment/34357980
answer count: 1
favorite count: 0
tagged with: primitive-types
has comment: http://stackoverflow.com/comment/34358114
has comment: http://stackoverflow.com/comment/34358438
has answer: http://stackoverflow.com/a/22571457
upvote count: 2
has comment: http://stackoverflow.com/comment/34358035

http://stackoverflow.com/a/22610407
has comment: http://stackoverflow.com/comment/34428877
has comment: http://stackoverflow.com/comment/34427910
has comment: http://stackoverflow.com/comment/34428158
score: 0
has comment: http://stackoverflow.com/comment/34428418
answers question: http://stackoverflow.com/q/22610141
type: Answer
has body: Yes, it is possible. But it is not easy to develop. This is why: Push notifications work attached to an account service. So you would have to implement an Authenticator service and then the whole push platform yourself. I would not use GCM for what you are doing though. If it is working on a local network, you can use "polling" (request the server every now and then for updates)

libgdx
tags question: http://stackoverflow.com/q/22554922
tags question: http://stackoverflow.com/q/22616596
tags question: http://stackoverflow.com/q/22633736
tags question: http://stackoverflow.com/q/22645422
tags question: http://stackoverflow.com/q/22511263
tags question: http://stackoverflow.com/q/22628866
tag name: libgdx
tags question: http://stackoverflow.com/q/22607995
tags question: http://stackoverflow.com/q/22606313
tags question: http://stackoverflow.com/q/22624133
tags question: http://stackoverflow.com/q/22646308
tags question: http://stackoverflow.com/q/22583471
tags question: http://stackoverflow.com/q/22536673
tags question: http://stackoverflow.com/q/22593748
tags question: http://stackoverflow.com/q/22590518
tags question: http://stackoverflow.com/q/22536755
type: Tag
tags question: http://stackoverflow.com/q/22596817
tags question: http://stackoverflow.com/q/22519584
tags question: http://stackoverflow.com/q/22622159
tags question: http://stackoverflow.com/q/22495005
tags question: http://stackoverflow.com/q/22545396
tags question: http://stackoverflow.com/q/22560492
tags question: http://stackoverflow.com/q/22631126
tags question: http://stackoverflow.com/q/22550259
tags question: http://stackoverflow.com/q/22596724
tags question: http://stackoverflow.com/q/22522542
tags question: http://stackoverflow.com/q/22544678
tags question: http://stackoverflow.com/q/22558688
tags question: http://stackoverflow.com/q/22547029
tags question: http://stackoverflow.com/q/22640893
tags question: http://stackoverflow.com/q/22570592
tags question: http://stackoverflow.com/q/22590193
tags question: http://stackoverflow.com/q/22591324
tags question: http://stackoverflow.com/q/22576840
tags question: http://stackoverflow.com/q/22518300
tags question: http://stackoverflow.com/q/22631247
tags question: http://stackoverflow.com/q/22596272

http://stackoverflow.com/comment/34267030
type: Comment
has text: left out the question of duplication all together, please see edited question.
comment on: http://stackoverflow.com/a/22499814
score: 0
type: AnswerComment

http://stackoverflow.com/q/22592870
type: Question
has body: I implementing a linkedlist with generics. But I'm getting "Multiple markers at this line - The type MyIterator is not generic; it cannot be parameterized with arguments " at the return statement. Figure is an interface public Iterator&lt;Figure&gt; iterator() { class MyIterator implements Iterator&lt;Figure&gt; { private Node current; private MyIterator(Node n) { current = n; } public boolean hasNext() { return current.next != null; } public Figure next() throws NoSuchElementException { if (current.next == null) throw new NoSuchElementException(); current.setNext(current.next); Object c=current; return (Figure) c; } public void remove() { throw new UnsupportedOperationException(); } } return new MyIterator&lt;Figure&gt;(); }
has title: CustomLinkedList with generics
accepted answer: http://stackoverflow.com/a/22592900
answer count: 1
tagged with: generics
type: AnsweredQuestion
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/22592900

http://stackoverflow.com/comment/34418200
score: 1
has text: @HoussemBdr : No, you just passed the reference of it to outside the method, I won't disappeared.
type: AnswerComment
comment on: http://stackoverflow.com/a/22605015
type: Comment

http://stackoverflow.com/q/22622676
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20487889
has title: Java "VariableDeclaratorId expected after this token"
has answer: http://stackoverflow.com/a/22622693
type: Question
has body: I'm working on a little project for fun, that's essentially a little combat emulator. I'm trying to use a class similar to struct in C++, as in using it to create an object (in this case, a character or "entity", as the class is called). I'm getting the error in the title when attempting to call any integer in said class from the main function. class entity{ public int health; public int accuracy; public int power; public int defense; } And public class Tutorial { static Random rnd = new Random(); entity player; player.health = 100; // Issue on the health part player.accuracy = 19; // Issue on the accuracy part player.power = 15; // Issue on the power part player.defense = 18; // I think you get it by now... I've been looking around for a while to find some explanation, but there's none that I could find that explain the nature of the error as well as possible fixes for my situation. If I could get those, it would be wonderful.
has answer: http://stackoverflow.com/a/71864402
tagged with: java
tagged with: class
downvote count: 0
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/76125872
linked to: http://stackoverflow.com/q/12557452
has comment: http://stackoverflow.com/comment/34450438
answer count: 5
has comment: http://stackoverflow.com/comment/34450068
has answer: http://stackoverflow.com/a/22622688
score: 8
has answer: http://stackoverflow.com/a/61293057

http://stackoverflow.com/comment/34233297
has text: @Eel Lee did you read the text or only the title?
score: 1
comment on: http://stackoverflow.com/q/22500979
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22597719
tagged with: eclipse
type: Question
score: 0
answer count: 2
tagged with: string
has answer: http://stackoverflow.com/a/22597732
tagged with: while-loop
has body: I'm trying to write a program that reads pairs of words and outputs the number of pairs of identical words. It's assumed an even number of words are inputted. When I run my code, it doesn't output anything. It appears to be continually running. When I press Ctrl-Z after I'm done inputting words, it either returns "0" or nothing at all. Any thoughts on how to make my program run properly? Thanks. EDIT: it runs fine in the command prompt, but not in Eclipse. public static void main(String[] args) { Scanner input = new Scanner(System.in); int counter = 0; while (input.hasNext()) { String string1, string2; string1 = input.next(); string2 = input.next(); if (string1.equals(string2)) { ++counter; } } System.out.println(counter); }
tagged with: input
type: UnansweredQuestion
has title: Trouble With hasNext() in Java
has answer: http://stackoverflow.com/a/37507396
tagged with: java

http://stackoverflow.com/comment/34236886
has text: line 200 is setText line. and double increment of i shouldn't effect the output. only the table content(column value) will get changed.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22501919

http://stackoverflow.com/a/46963811
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22615311
score: 1
has body: Like already answered you'll get a one-dimensional JSON tree with MDC and/or using a Marker with logstash-logback-encoder. If you are also looking for the following: codebooks for definition of logged datatype key and type, configuration of log-aggregation tools (like elasticsearch) generated Java helper-code for efficient and correct logging then try a project I've created: json-log-domain. It defines a simple YAML-format definition from which the above can be generated. An example helper-code statement would be logger.info(host("localhost").port(8080), "Hello world"); while generated markdown would like something like this.
downvote count: 0

http://stackoverflow.com/q/22556020
tagged with: gson
has comment: http://stackoverflow.com/comment/34332914
has body: I am using Gson to parse data from Json String. Everything is working fine. But now, Main Json String contains Inner Json String and I want that Inner Json String's data. How to get it ? Check my Json String: [{"Question":"Are you inclined to:","QId":"2","Options":[{"Option":"Argue or debate issues","OptionId":"4"},{"Option":"Avoid arguments","OptionId":"5"},{"Option":"Swutch topics","OptionId":"6"}]}] Here, I want value of "Options". My Sample code is as below : PrimaryTest[] testlist = gson.fromJson(result, PrimaryTest[].class); // result is Json String. List&lt;PrimaryTest&gt; lstTest = Arrays.asList(testlist); PrimaryTest objTest = lstTest.get(0); String Question = objTest.getQuestion(); Here, I am getting Question value perfectly but don't know how to get Options value. If I am using same method then It is giving error : Invalid Json Data. PrimaryTest.java Code : public class PrimaryTest { private String Question; public PrimaryTest(String Question) { this.Question = Question; } public void setQuestion(String Question) { this.Question = Question; } public String getQuestion() { return this.Question; } }
possible better answer: http://stackoverflow.com/a/22558693
type: Question
has answer: http://stackoverflow.com/a/22558693
score: -1
has comment: http://stackoverflow.com/comment/34329896
answer count: 2
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/34332297
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22559342
accepted answer: http://stackoverflow.com/a/22559342
has title: Get Inner Json String Data from Main Json String using Gson
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34333316
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/34367932
score: 0
type: Comment
has text: Hi, I keep getting this error 'Data truncation: Out of range value for column, 'Number'. Its because it is not creating 7 records and instead creating one record with values 1-7. How do I fix this?
type: AnswerComment
comment on: http://stackoverflow.com/a/22577209

http://stackoverflow.com/comment/34440250
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22617269
has text: Why don't you just do it "the standard way"? By default, test sources will depend on main sources, no need to generate a jar inbetween

http://stackoverflow.com/q/22600647
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34410450
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/34410447
has answer: http://stackoverflow.com/a/22600666
type: Question
has comment: http://stackoverflow.com/comment/34410641
tagged with: math
has comment: http://stackoverflow.com/comment/34410578
tagged with: arrays
has body: I want to generate 6 different random numbers by using Math.random and store all of them into an array. How can I make sure that they are different? I only have this so far and this has a bug. I only need numbers between 1 and 49. ( 1 + (int) (Math.random() * 49) ). public static void main (String []args) { int []randomNumArray = new int [6]; randomNumArray[0] = randomNumber(); System.out.println(randomNumArray[0]); for (int i = 1; i &lt; 6; i++) { for (int j = 0; j &lt; i; j++) { randomNumArray[i] = randomNumber(); do { if (randomNumArray[i] == randomNumArray[j]) { randomNumArray[i] = randomNumber(); } } while(randomNumArray[i] == randomNumArray[j]); } System.out.println(randomNumArray[i]); } } //This method is for generating random numbers public static int randomNumber (){ return ( 1 + (int) (Math.random() * 49) ); }
possible better answer: http://stackoverflow.com/a/22600666
has answer: http://stackoverflow.com/a/22600806
linked to: http://stackoverflow.com/q/22584244
answer count: 2
tagged with: random
upvote count: 0
accepted answer: http://stackoverflow.com/a/22600806
duplicate of: http://stackoverflow.com/q/22584244
has title: How to generate 6 different random numbers in java without using collection.shuffle
favorite count: 0
score: -2

http://stackoverflow.com/q/22564532
has body: I have a Spring MVC web app secured with Spring Security and I'm in the process of writing tests. I'm struggling with getting one of my (custom) user retrieved by Spring Security in its SecurityContextHolder. Once my user is "inserted" (java-configured) with : auth.inMemoryAuthentication().getUserDetailsService().createUser(myCustomUser); I can then create the related token (a UsernamePasswordAuthenticationToken) and ask for Spring to authenticate my user with this token. The problem is Spring doesn't retrieve a custom user instance but an instance of its User class. When Spring looks for such a user in the following method (from Spring's InMemoryUserDetailsManager) : public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { UserDetails user = users.get(username.toLowerCase()); if (user == null) { throw new UsernameNotFoundException(username); } return new User(user.getUsername(), user.getPassword(), user.isEnabled(), user.isAccountNonExpired(), user.isCredentialsNonExpired(), user.isAccountNonLocked(), user.getAuthorities()); } It instantiates a new User with the details provided by my configuration. I don't see the problem with having the InMemoryUserDetailsManager directly returning what was sent to him via the "getUserDetailsService().createUser" call but there must be one probably... Anyway, I'm probably doing something wrong here, any idea ?
score: 8
accepted answer: http://stackoverflow.com/a/22584977
tagged with: spring-security
has title: How to get a custom user logged via InMemoryAuthentication with Spring Security?
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34346067
has comment: http://stackoverflow.com/comment/34345607
favorite count: 0
upvote count: 8
type: Question
has comment: http://stackoverflow.com/comment/34346310
tagged with: spring
has answer: http://stackoverflow.com/a/22584977
answer count: 1
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/34345787

http://stackoverflow.com/a/68706947
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/121466136
has body: Have a look on this repo nambach/ExcelUtil. It supports reading and writing Excel files in declarative way. public class Main { static final Style HEADER_STYLE = Style .builder() .fontColorInHex("#ffffff") .backgroundColorInHex("#191970") .border(BorderSide.FULL) .horizontalAlignment(HorizontalAlignment.LEFT) .build(); static final Style OTHER_STYLES... static final DataTemplate<Book> BOOK_TEMPLATE = DataTemplate .fromClass(Book.class) .includeFields("isbn", "title", "author") .column(c -> c.title("Category") .transform(book -> book.getCategory().getName())) // derive new column .column(c -> c.field("rating") .conditionalStyle(book -> book.getRating() > 4 ? // styles with conditions HIGH_RATE : null)) .config(cf -> cf.startAtCell("A2") .autoSizeColumns(true) .headerStyle(HEADER_STYLE) .dataStyle(DATA_STYLE) .conditionalRowStyle(book -> book.getTitle() // selective styling .contains("Harry Potter") ? FAVORITE_ONE : null)); public static void main(String[] args) { List<Book> books = dataSource.fetchData(); InputStream stream = BOOK_TEMPLATE.writeData(books); FileUtil.writeToDisk(".../books.xlsx", stream, true); } }
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22511413

http://stackoverflow.com/a/22505219
has body: Try to keep your ifs clean, it is not just good practice, it is pretty important for future refactors or modifications. - Always use {} for if statements - Don't nest ifs if it is not necessary. - Use () for separation between &amp;&amp; and || to improve the readability. - If the structure gets complicated, write it down first on paper, or think about separation of statements, maybe you can merge something. - Furthermore I recommend some studies on formal logic. ideally an if should look like something like this: if( (A &amp;&amp; B) || (C &amp;&amp; D) ){ ... do something } or if( (A || B) &amp;&amp; (C || D) ){ ... do something } if you make it clean and nice, it will pay back the effort later if you have to change something. If I understood you well, your case can be described as if( !A &amp;&amp; (B || C)){ ... do something }
answers question: http://stackoverflow.com/q/22503714
score: 0
has comment: http://stackoverflow.com/comment/34242939
type: Answer

http://stackoverflow.com/q/22505567
has answer: http://stackoverflow.com/a/22828451
accepted answer: http://stackoverflow.com/a/22828451
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34240605
has comment: http://stackoverflow.com/comment/34240604
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22506477
has answer: http://stackoverflow.com/a/22506477
type: Question
has comment: http://stackoverflow.com/comment/34240549
tagged with: mockito
has body: I have the following field in my class @Resource(name = "lobIdCancellationNodeMap") private Map&lt;String, List&lt;String&gt;&gt; lobIdCancellationNodeMap; After this line we have directly accessed this field lobIdCancellationNodeMap I am not able to set value for this using Mockito, and there is no construtor available which can set this value. This is how it is used lobIdCancellationNodeMap.get(lobId) I am not allowed to change implementation class
answer count: 2
upvote count: 1
has title: Mocking private field of a class
favorite count: 0
tagged with: powermock

http://stackoverflow.com/q/22638583
type: UnansweredQuestion
score: 2
has title: Is there a way with Mockito to run a stubbed method of an spied object from an inner class?
tagged with: inner-classes
tagged with: java
type: Question
tagged with: mockito
has answer: http://stackoverflow.com/a/22644040
has body: I'm writing junit tests using Mockito for a code that has been implemented by someone else. Simplifying: There is an Outer class and an Inner class The Outer class keeps an instance of the Inner class. The Inner class uses a method of the Outer class. The simplified code could looks like this: public class Outer { private Inner inner; public Outer(){ inner=new Inner(); } public Inner getInner(){ return inner; } public String getOuterName(){ return "outer"; } public String getOuterNiceName(){ return "name="+getOuterName(); } public class Inner { public String getInnerName(){ return getOuterName()+"-inner"; } } } I want to stub the method getOuterName() of the Outer class to return a value convenient for my test. To do that I'm "spying" on the object: Outer outer=new Outer(); Outer spyOuter=spy(outer); doReturn("outerspied").when(spyOuter).getOuterName(); Now, if I call: spyOuter.getObjectName(); spyOuter.getOuterNiceName(); The stubbed method is invoked in both calls, and I get the string: "outerspied" and "name=outerspied" However if I call: spyOuter.getInner().getInnerName(); In this case the stubbed method is not called, but the original one. I expected "outerspied-inner", but got "outer-inner" Summarising, in the spied outer object the reference "this" points to the spied instance. But for the inner object, the reference to "Outer.this" points to a "non spied" instance. I don't know if I'm doing something wrong, it is a bug, or it is working as designed; question is: is there a workaround? Many thanks in advance
upvote count: 2
has comment: http://stackoverflow.com/comment/34479651
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0

warnings
tags question: http://stackoverflow.com/q/22559158
type: Tag
tag name: warnings

http://stackoverflow.com/comment/34251434
has text: Yeah that would work fine, it gets a little more complicated if they're all separate projects, you'd be better to make the main project you run on Tomcat and try running it from Eclipse, once you get that, it should export as a war. You can mark a project as dynamic web project in the project facade if you go to the properties of the project.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22510592
type: Comment

http://stackoverflow.com/comment/34270372
score: 0
type: Comment
type: QuestionComment
has text: You need to provide more information. In your case "Auxilary" may be the name of actual class in that library.
comment on: http://stackoverflow.com/q/22521288

size
type: Tag
tag name: size
tags question: http://stackoverflow.com/q/22612389
tags question: http://stackoverflow.com/q/22633629

http://stackoverflow.com/comment/34279185
has text: So you're storing only one key-value pair in each map? It seems to me that a custom object would have been enough.
comment on: http://stackoverflow.com/q/22527149
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34396353
score: 0
type: Comment
type: QuestionComment
has text: Check out [Making a robust, resizable Chess GUI](http://stackoverflow.com/questions/21142686/making-a-robust-resizable-chess-gui/21142687#21142687)
comment on: http://stackoverflow.com/q/22584813

http://stackoverflow.com/comment/34529673
comment on: http://stackoverflow.com/a/22641636
type: AnswerComment
has text: OK, you're making good progress. Your bdd.txt file in on your server, so the server should be able to read it the same way as your current application does.
score: 0
type: Comment

http://stackoverflow.com/comment/34466771
comment on: http://stackoverflow.com/q/22631692
has text: It looks like the answer is right there in that answer. What happened when you tried to use the suggested code?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34579030
comment on: http://stackoverflow.com/q/22622125
score: 0
type: Comment
type: QuestionComment
has text: @AndreiI Thank you for offering to share screens. If I knew you, I would take you up on it. But this is a hacker site, and it is not a good practice to share screens with strangers on a hacker site. In the past, people have just used the stack overflow chat rooms to explain things. If we keep trading messages here, a link to continue the conversation in chat will appear. I want to learn how to do it myself, but we all reach dead ends from time to time.

http://stackoverflow.com/a/22628444
has comment: http://stackoverflow.com/comment/78624273
has comment: http://stackoverflow.com/comment/34942960
type: Answer
has body: Below is an example using Jetty9 Embedded/Servlets using a supplied Jetty 'DefaultServlet' class. public static void main(String[] args) throws Exception { Server server = new Server(8080); ServletContextHandler context=new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); DefaultServlet defaultServlet = new DefaultServlet(); ServletHolder holderPwd = new ServletHolder("default", defaultServlet); context.addServlet(holderPwd, "/*"); server.setHandler(context); server.start(); server.join(); } Output: 2014-04-08 10:04:18.173:INFO::main: Logging initialized @132ms 2014-04-08 10:04:18.243:INFO:oejs.Server:main: jetty-9.1.3.v20140225 2014-04-08 10:04:18.282:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@52e21a17{/,null,AVAILABLE} 2014-04-08 10:04:18.298:INFO:oejs.ServerConnector:main: Started ServerConnector@7388665b{HTTP/1.1}{0.0.0.0:8080} 2014-04-08 10:04:18.298:INFO:oejs.Server:main: Started @259ms
downvote count: 0
has comment: http://stackoverflow.com/comment/34994348
answers question: http://stackoverflow.com/q/22624152
score: 3
upvote count: 3

http://stackoverflow.com/q/22611092
answer count: 3
tagged with: error-handling
accepted answer: http://stackoverflow.com/a/22612897
upvote count: 1
has body: Upon running following code under class FlightSearch String moreSearch = "y"; List&lt;Flight&gt; resultList; // load initial flight data into DB if (!init()) { return; } // A background thread to monitor changes in csv repository FileListner fl = new FileListner(); fl.start(); do { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); // main thread gets input Input inputQuery = new Input(); try { inputQuery.getQuery(); } catch (InvalidException e1) { e1.getMessage(); } finally { fl.stopThread(); } // main thread STARTs processing task as background monitors csv // repo QueryProcessor processor = new QueryProcessor(); resultList = null; resultList = processor.matchQuery(inputQuery); displayResult(resultList, inputQuery.getFlightClass()); System.out .println("More Flight Query ? Press n/N to exit. Anyother key to continue searching."); try { moreSearch = br.readLine(); // LINE 56 } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ if(br!=null){ try { br.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } while (!moreSearch.equalsIgnoreCase("n")); System.out.println("Thank You !!!"); I get following error : java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162) at java.io.BufferedInputStream.read(BufferedInputStream.java:325) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:154) at java.io.BufferedReader.readLine(BufferedReader.java:317) at java.io.BufferedReader.readLine(BufferedReader.java:382) at com.myApp.FlightSearch.main(FlightSearch.java:56) I have also tried moving InputStreamReader isr = new InputStreamReader(System.in); BufferedRead…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22827601
downvote count: 0
tagged with: bufferedreader
score: 1
has title: error message : stream closed
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/8203981
has answer: http://stackoverflow.com/a/22612897
possible better answer: http://stackoverflow.com/a/22612280
tagged with: ioexception
has answer: http://stackoverflow.com/a/22612280
tagged with: java

http://stackoverflow.com/a/22609891
has body: In the case where an exception is thrown or not thrown, the finally clause will ensure that both data and result streams are closed. Otherwise, they may not be closed.
type: Answer
score: 1
upvote count: 2
answers question: http://stackoverflow.com/q/22609779
downvote count: 1

http://stackoverflow.com/a/22488814
type: Answer
upvote count: 3
score: 3
has body: It can be quite a problem. This error (ENFILE) means that either you, or the OS, has too many open file descriptors. stdin, stdout and stderr are file descriptors; any open file is a file descriptor; any socket you create is a file descriptor as well. To know your limit of open files, as a user, do: ulimit -n To know the limit of the OS, do: cat /proc/sys/fs/file-max Generally, it is the user limit which is the problem. You can try and raise the limit using: ulimit -n &lt;a greater number here&gt; but more than likely it won't work. What you need to do is editing /etc/security/limits.conf of, preferred, create a new file in /etc/security/limits.d with a relevant name and add these two lines: theuser soft nofile &lt;somelargenumber&gt; theuser hard nofile &lt;somelargenumber&gt; Note that in order for these limits to take effect, the user must log out and login again; if it is a user dedicated to a system service, then restarting this service will do. Additionally, if you know the PID of the process running your application, you can see the number of currently open file descriptors by issuing the command: ls /proc/&lt;thepid&gt;/fd|wc -l If the kernel limit is the problem (very unlikely but who knows) then you'll have to edit /etc/sysctl.conf and change the proc.sys.fs.file-max entry, then run sysctl -- as root.
accepted answer of: http://stackoverflow.com/q/22488409
answers question: http://stackoverflow.com/q/22488409
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34212650

http://stackoverflow.com/comment/34244674
has text: thanks after typing the cmnt to piyush I realised that Vinayak1 has ".class" there. So i tried that. Now wait I am checking if this works
type: Comment
comment on: http://stackoverflow.com/a/22507692
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34262593
type: QuestionComment
comment on: http://stackoverflow.com/q/22517592
score: 4
has text: Looks about `14.7` inches.
type: Comment

http://stackoverflow.com/q/22584504
has answer: http://stackoverflow.com/a/22585017
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/22584582
tagged with: javascript
has comment: http://stackoverflow.com/comment/34381778
tagged with: servlets
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/34381635
downvote count: 0
tagged with: jquery
favorite count: 0
has body: I can't retrieve the values from a request. Servlet: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String location_id = request.getReader().readLine(); // &lt;---- null location_id = request.getParameter("location_id"); // &lt;--- null PrintWriter out = response.getWriter(); out.write(this.get_events_json(location_id)); } On the client-side: $.get("EventServe", {location_id : location_id}).done(function() { var events = JSON.parse(responseText); outer_this.events = events.map(function(event){ var event = new Event(event.address, event.name, event.event_start, event.event_end) return event; }); outer_this.events.map(function(event){outer_this.insert_event(event)}); }); I've also tried to pass it in directly without jQuery, using only literals.
tagged with: ajax
accepted answer: http://stackoverflow.com/a/22585017
possible better answer: http://stackoverflow.com/a/22584582
type: AnsweredQuestion
has title: How to get parameters from GET request?

http://stackoverflow.com/q/22541060
has comment: http://stackoverflow.com/comment/34306778
has comment: http://stackoverflow.com/comment/34513649
has comment: http://stackoverflow.com/comment/34632728
downvote count: 2
possible better answer: http://stackoverflow.com/a/27036482
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/34314175
has comment: http://stackoverflow.com/comment/34307458
has comment: http://stackoverflow.com/comment/34513357
has comment: http://stackoverflow.com/comment/34513164
has answer: http://stackoverflow.com/a/22562548
accepted answer: http://stackoverflow.com/a/22562548
favorite count: 0
has comment: http://stackoverflow.com/comment/34306699
has comment: http://stackoverflow.com/comment/34311057
tagged with: oracle-sqldeveloper
has comment: http://stackoverflow.com/comment/34307555
has comment: http://stackoverflow.com/comment/34307424
has body: I'm trying to install Oracle SQLDeveloper4 on my windows7 machine. I set JAVA_HOME to point my jdk 1.7, I add to my PATH variable %JAVA_HOME%/bin. When I echo and java -version I can see it is Java 1.7 and when I echo I can see it is in the %PATH% I even set it in its sqlDeveloper.conf file to point to my jdk1.7; SetJavaHome C:\Java\jdk1.7 BUT STILL Whenever I run the sqldeveloper.exe I get warning saying it can not run on Java 1.6 and it needs Java1.7 !! How can I get this stupid thing installed on my machine?? very frustrating..
upvote count: 4
has comment: http://stackoverflow.com/comment/34511119
has comment: http://stackoverflow.com/comment/37115469
has comment: http://stackoverflow.com/comment/34305983
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/27036482
has comment: http://stackoverflow.com/comment/34307080
tagged with: java
has comment: http://stackoverflow.com/comment/34306050
has title: Oracle SqlDeveloper can not find correct JDK
has comment: http://stackoverflow.com/comment/34512578
type: Question
has comment: http://stackoverflow.com/comment/34306625
has comment: http://stackoverflow.com/comment/34512882
answer count: 2
has comment: http://stackoverflow.com/comment/39027063
has comment: http://stackoverflow.com/comment/34339183
has comment: http://stackoverflow.com/comment/34514162
has comment: http://stackoverflow.com/comment/34306996
has comment: http://stackoverflow.com/comment/34327113

http://stackoverflow.com/q/22519084
has answer: http://stackoverflow.com/a/22520081
accepted answer: http://stackoverflow.com/a/22520081
tagged with: android
tagged with: android-alertdialog
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am trying to create a dialog box which will show when an image is clicked but there seems to be a few issues with my code. The code is shown below. I have done the import for the dialog box but it doesn't seem to work as there is an error when initiating a new dialog box. ImageButton ib = (ImageButton)findViewById(R.id.imageButton1); ib.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog ad = new AlertDialog.Builder(this) .setMessage("Blah blah blah.\n Fine pring.\n Do you accept all our terms and conditions?") .setIcon(R.drawable.ic_launcher) .setTitle("Terms of Service") .setNeutralButton("back", this) .setCancelable(false) .create(); ad.show(); } });
has comment: http://stackoverflow.com/comment/34265824
score: 0
has comment: http://stackoverflow.com/comment/34266364
answer count: 1
has title: issue with alert dialog box, due to it not recognizing the initiation of the alert box

http://stackoverflow.com/q/22639571
linked to: http://stackoverflow.com/q/16742060
type: Question
has comment: http://stackoverflow.com/comment/34479967
answer count: 2
downvote count: 0
favorite count: 0
tagged with: slf4j
has answer: http://stackoverflow.com/a/22639986
score: 1
tagged with: scala
upvote count: 1
has title: unclutter logging with scala?
tagged with: logging
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22639986
possible better answer: http://stackoverflow.com/a/23021782
has body: I like scala as it can help me have cleaner code. However while logging i feel my code gets cluttered... def myFunc(args) = { log.trace("entering myfunc, args are ... ") val result = doSomething() log.info("I really want to print that result which is {}", result) log.trace("exiting myfunc result {}", result) result } as you can see instead of just calling def myFunc(args) = doSoemthing I needed to split the result into a var so that i can first log it and only then return it. now that was a simple use case in more complex use cases I have more loggings in my methods, some info some debug things become more complex and code becomes much more cluttered due to logging.. while I could wrap my method with another method which would add logging on entry and exit this would make my code more complex so i'm looking for a very clean logging solution not focusing only on method entry and exit (I dont want to use AOP because it makes code also more compelx and hard to understand). how to unclutter code while still having code simple and easy to understand with powerful logging? (solution not invented yet?) or is there a true clean solution?
tagged with: java
has answer: http://stackoverflow.com/a/23021782

http://stackoverflow.com/comment/34254509
comment on: http://stackoverflow.com/q/22512865
type: Comment
type: QuestionComment
score: 0
has text: @Pshemo If this is the case, then I guess i should exclude the words before storing them in a string array.

http://stackoverflow.com/comment/34387897
score: 0
comment on: http://stackoverflow.com/q/22587938
has text: I think you'll find "/db.properties" or "db.properties" will work...
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22588524
score: 1
upvote count: 1
has body: Generics were introduced to the Java language to increase the type safety. Say you have a list of items, to which you are only adding instances of class A: List list = new LinkedList(); list.add(new A()); list.add(new A()); ... When you want to use some of the objects you entered the list, you do something like: A a1 = (A) list.get(0); A a2 = (A) list.get(1); ... However, nothing prevents anyone from doing the following: list.add(new NonA()); which will result in you getting a ClassCastException in your code. This is because the types are being checked in run time not in compilation time. Enter generics, which allow you to do the following: List&lt;A&gt; list = new LinkedList&lt;A&gt;(); list.add(new A()); list.add(new A()); ... And now, if anyone tries the following: list.add(new NonA()); They will get a compilation error, thus preventing this error.
type: Answer
answers question: http://stackoverflow.com/q/22588379
downvote count: 0

http://stackoverflow.com/comment/34296284
type: QuestionComment
comment on: http://stackoverflow.com/q/22517131
type: Comment
has text: i pasted the code i used in selenium. I think if there was a way to force results to display on the page instead a popup js it would work.
score: 0

http://stackoverflow.com/comment/34400898
has text: @ManuelSelva http://stackoverflow.com/questions/6060848/junit-assertequals-fails-for-two-objects
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22595349

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/22516940

http://stackoverflow.com/q/22610728
has answer: http://stackoverflow.com/a/22610920
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22610938
has title: Using compareTo in ArrayLists
type: Question
has comment: http://stackoverflow.com/comment/34428245
tagged with: compareto
tagged with: arraylist
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34428381
has body: I need some help using compareTo in ArrayLists. As a guide I was given this paragraph: addOrder(ArrayList words, String newWord) – this method adds newWord in the proper alphabetical order. Hint you can use: x.compareTo(y) If x.compareTo(y) is < 0, x comes before y) addOrder should then return this updated ArrayList of Strings. But even though I researched alot still struggling to understand how to apply it to ArrayLists. This is my code that I want to use the compareTo method: import java.util.ArrayList; import java.util.ArrayList; import java.util.List; class StringList { public static void main(String [] args) { ArrayList< String> list = new ArrayList< String>(); list.add("Goldsmiths"); list.add("College"); list.add("London"); list.add("Manchester"); list.add("London"); list.add("York"); System.out.println("These are your words:"); System.out.println(list); System.out.println("This is the size of the array:"); System.out.println(lengthArray(list)); System.out.println("The length of all strings is:"); System.out.println(totalLengthArray(list)); } public static int lengthArray(List<String> list) { return list.size(); } public static int totalLengthArray(List<String> list) { int count = 0; for (String s: list) { count += s.length(); } return count; } } I want to compare and sort out the list items that I have added which you can see in my code.

http://stackoverflow.com/a/22528891
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34341928
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22527187
answers question: http://stackoverflow.com/q/22527187
has body: Introduction: The path parameters guide the request to the correct method, and therefore a big flexibility is needed for that. The request parameters (GET/POST/...) on the other side need to be validated, i.e if a request contain invalid parameter value, you should take care of that. Solution: Beginning with JAX-RS 2.0 (published in May 2013 with the reference implementation Jersey 2.0) you have support for validation. Check this examples. Before JAX-RS 2.0 (probably your situation) you should do the validation manually, e.g by injecting an int or long and checking its limits.

http://stackoverflow.com/a/22528509
score: 2
downvote count: 0
upvote count: 2
type: Answer
has body: It is not thread safety at all even if you only add elements. In case that you only increase your FILES there is also some multi access problem if your collection is not thread safe. When collection exceeds their size it has to be copied to new space and in that moment you can have problems with concurrent access, because in the moment that one thread will do the copy stuff... another can be trying add at the same time element to that collection, resizing is done by internal arraylist implementation but it is not thread-safe at all. Check that code and lets assume that more than one thread execute it when collection capacity is full. private int size; //it is not thread safe value! public boolean add(E e) { ensureCapacityInternal(size + 1); // Increments modCount!! elementData[size++] = e; //size is not volatile value it might be cached by thread return true; } public void add(int index, E element) { rangeCheckForAdd(index); ensureCapacityInternal(size + 1); // Increments modCount!! System.arraycopy(elementData, index, elementData, index + 1, size - index); elementData[index] = element; size++; } public void ensureCapacity(int minCapacity) { if (minCapacity &gt; 0) ensureCapacityInternal(minCapacity); } private void ensureCapacityInternal(int minCapacity) { modCount++; // overflow-conscious code if (minCapacity - elementData.length &gt; 0) grow(minCapacity); } In the moment that collection need to exceed its capacity and copy existed element to new internal array you can have real problems with multi-access, also size is not thread because it is not volatile and it can be cached by some thread and you can have overrides :) and this is answer why it might be not thread safe even if you use only use add operation on non synchronized collection. You should consider using FILES=new CopyOnWriteArrayList();, orFILES= Collections.synchronizedList(new ArrayList()); where add operation is thread-safe.
answers question: http://stackoverflow.com/q/22528306

http://stackoverflow.com/comment/34370123
has text: The add method's parameter is in contravariant position, I think that is the reason why it does not work.
comment on: http://stackoverflow.com/q/22578404
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22540168
favorite count: 0
has comment: http://stackoverflow.com/comment/34302666
has title: How to use springframework AssertFileEquals?
has answer: http://stackoverflow.com/a/22540961
tagged with: spring
has body: I am trying to compare 2 files and see if they are the same with the spring framework. The documentation on the assertFileEquals function says to use it like this: private static final String EXPECTED_FILE = "src/main/resources/data/input.txt"; private static final String OUTPUT_FILE = "target/test-outputs/output.txt"; AssertFile.assertFileEquals(new FileSystemResource(EXPECTED_FILE), new FileSystemResource(OUTPUT_FILE)); Doing this, eclipse says 'Unhandled exception type Exception' When adding catch I get the following error after running: Exception in thread "main" java.lang.NoClassDefFoundError: junit/framework/Assert at org.springframework.batch.test.AssertFile.assertFileEquals(AssertFile.java:42) at org.springframework.batch.test.AssertFile.assertFileEquals(AssertFile.java:56) at Main.main(Main.java:51) Caused by: java.lang.ClassNotFoundException: junit.framework.Assert at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 3 more Can anyone explain how this is solved or how I use this function? I have also tried giving it two equal files, but still this persists.
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34302674
has comment: http://stackoverflow.com/comment/34303218
has comment: http://stackoverflow.com/comment/34302789
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/22540961
tagged with: eclipse
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34267384
type: QuestionComment
has text: How is that different from what I have done?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22519990

http://stackoverflow.com/comment/48018348
score: 2
comment on: http://stackoverflow.com/q/22614912
has text: I'm having the same problem. Did you find the reason?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22593101
accepted answer: http://stackoverflow.com/a/22593316
type: Question
tagged with: linked-list
score: 0
tagged with: java
answer count: 1
tagged with: vector
has answer: http://stackoverflow.com/a/22593316
has body: I have to return elements of a linked list in a vector form.How can I return linkedlist in vector form.I have tried following but unable to get the right result.Can anyone tell me what I did wrong? package BasicList1; import java.util.Vector; public class BasicList1 implements ListInterface{ static String[] testcase1 = {"3","1","2","6","7","4","5"}; public static void main (String[] args){ BasicList1 testInstance = new BasicList1(); ListNode head = new ListNode(testcase1[0]); ListNode node = head; System.out.println(testInstance.elements(head)); System.out.println(testInstance.length(head)); } public BasicList1 getBasicList(String data){ return this; } //write your code here public Vector&lt;String&gt; elements(ListNode head){ ListNode temp=head; Vector v=new Vector(); while(temp!=null){ System.out.println(temp.data); temp=temp.next; v.addElement(temp); } return v; } public int length(ListNode head) { int count=0; for(int i=0;i&lt;testcase1.length;i++){ count++; } return count; }
linked to: http://stackoverflow.com/q/13778441
type: AnsweredQuestion
has title: How Can I add linked list to vector?

http://stackoverflow.com/a/22523985
type: Answer
accepted answer of: http://stackoverflow.com/q/22523959
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22523959
has body: Well, don't you delete all the records before closing the database? } finally { if (newDB != null) newDB.execSQL("DELETE FROM " + tableName); newDB.close(); } That would explain that behaviour.
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/comment/34272633
comment on: http://stackoverflow.com/a/22523138
type: AnswerComment
has text: yes having it in reverse was the whole point. good catch though
score: 0
type: Comment

http://stackoverflow.com/q/22535969
tagged with: deployment
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34390464
tagged with: jakarta-ee
type: UnansweredQuestion
answer count: 0
has body: In Linux environment, when I keep my Java web-application's war file into webapps directory and start the server, it strangely gets extracted to 2 different applications (with 2nd one unwanted application with first letter removed). More specifically, I have application war file as configurator.war, I'm copying it to webapps directory of tomcat and starting server with ./startup.sh in Linux environment. But this extracts 2 folders configurator &amp; onfigurator (don't know how). Can anybody please suggest what wrong I might have done?
tagged with: tomcat
tagged with: linux
type: Question
has title: Incorrect Java application deployment in tomcat6 on linux
has comment: http://stackoverflow.com/comment/34297612

http://stackoverflow.com/q/22570736
has title: There is no method "Filereader" in class
has comment: http://stackoverflow.com/comment/34357233
has comment: http://stackoverflow.com/comment/34356730
has comment: http://stackoverflow.com/comment/34356875
has comment: http://stackoverflow.com/comment/34356780
has comment: http://stackoverflow.com/comment/34357015
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22570932
type: Question
has comment: http://stackoverflow.com/comment/34356877
has body: Could you help me understand why I get this message: There is no method Filereader` in class... I transferred a file into the readFile() method. It is visible in the picture that the file has been transferred correctly. Then I'm trying to create a FileReader instance. In java-doc I can the constructor scheme: public FileReader(File file). I can't understand why this doesn't work?
score: 0
has comment: http://stackoverflow.com/comment/34356906
accepted answer: http://stackoverflow.com/a/22570932
has comment: http://stackoverflow.com/comment/34357061
answer count: 1
has comment: http://stackoverflow.com/comment/34356955

http://stackoverflow.com/a/22556890
answers question: http://stackoverflow.com/q/22553344
has comment: http://stackoverflow.com/comment/34412892
score: 0
has body: Not only the Library and Jar file Make sure you datasource setting is correct as follow: dependencies { runtime "postgresql:postgresql:9.1-901.jdbc4" } dataSource { pooled = true driverClassName = "org.postgresql.Driver" dialect = "org.hibernate.dialect.PostgreSQLDialect" username = "iqbal" password = "" } hibernate { cache.use_second_level_cache = true cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3 // cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4 } // environment specific settings environments { development { dataSource { dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', '' url = "jdbc:postgresql://localhost:5432/seram" } } test { dataSource { dbCreate = "update" url = "jdbc:postgresql://localhost:5432/seram" } } production { dataSource { dbCreate = "update" url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE" properties { maxActive = -1 minEvictableIdleTimeMillis=1800000 timeBetweenEvictionRunsMillis=1800000 numTestsPerEvictionRun=3 testOnBorrow=true testWhileIdle=true testOnReturn=false validationQuery="SELECT 1" jdbcInterceptors="ConnectionState" } } } }
type: Answer

http://stackoverflow.com/q/22583540
has comment: http://stackoverflow.com/comment/34379981
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/22583676
has answer: http://stackoverflow.com/a/22583676
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34379948
has title: How can I make interrupt() work?
tagged with: java
type: Question
has body: Could you have a look at the picture. Now the A step ago I executed this.interrupt(). You can see that this.isInterrupted() is false. I was scrutinyzing - "this" has not changed. It had the same id (12). So, why there is no result of the interrupt() method? Added later. Code as text: @Override protected void letUsFinalise() { this.interrupt(); }
has answer: http://stackoverflow.com/a/22583624
accepted answer: http://stackoverflow.com/a/22583624
score: 0
answer count: 2

http://stackoverflow.com/comment/34461123
has text: Not all database support scroll sensitive, or only support scroll sensitive for changes in the own transaction. You might want to check 1) if the result set is actually scroll sensitive (downgrading is allowed) and 2) what behavior is supported by MySQL.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22625783
score: 1

http://stackoverflow.com/a/22629796
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22628408
has body: Here are 2 methods to Shuffle an Array: Approach 1: Shuffle elements in an array Approach 2: Java Collection.shuffle() method And the method you use is one standard way accomplishing this. There are 2 ways in java: java.util.Random and java.lang.Math.random. java.lang.Math.random() uses java.util.Random. It provides only doubles and has no seeding capability.

http://stackoverflow.com/comment/34282549
has text: The `RECURRENCE-ID` is required because the events use the same `UID` and something is required to differentiate between them. So it's either issues with other ICAL clients, or Google just being lazy/dumb when they generate ICS exports. On that point, your guess is as good as mine.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22500159
type: Comment

http://stackoverflow.com/comment/34245453
type: Comment
comment on: http://stackoverflow.com/a/22502930
type: AnswerComment
has text: So if my answer is suitable for you you can simply upvote it and accept. Thanks in advance.
score: 0

http://stackoverflow.com/comment/34319799
has text: @DonBranson, no, it's not crystal-clear at all. You can make some assumptions about what the OP actually means, but the wording in itself is ambiguous. There were are at least 4 other people who agreed with me when the post was closed as ambiguous. Also, the revision timestamps don't give enough granularity to prove the error was added after my comment, but I can assure you it was.
comment on: http://stackoverflow.com/q/22521917
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22581607
has body: The main thread will exit, and claim the live of the threads in the ForkJoinPool. You can see this with public static void main(String[] args) { ForkJoinPool pool = new ForkJoinPool(); pool.invoke(new MyRecursiveTask()); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } } (Just for illustration, of course...)
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22580981
answers question: http://stackoverflow.com/q/22580981
score: 1

http://stackoverflow.com/comment/34226048
type: QuestionComment
has text: I think you should take a look at the accepted answer in this thread: http://stackoverflow.com/questions/729368/bytecode-instrumentation-using-classfiletransformer-transform?rq=1 and if none of the answers applies, please provide a sample that demonstrates the problem.
type: Comment
comment on: http://stackoverflow.com/q/22496004
score: 0

http://stackoverflow.com/comment/34581831
comment on: http://stackoverflow.com/a/22630280
score: 0
type: AnswerComment
has text: Modules will indeed replace Backends, and the deprecation notice is to advise developers to redesign their applications. The change will improve future AppEngine capabilities. The tutorials are not quite up to date with this change, but it may take several months for them to be rewritten. I suggest you follow the deprecated Backends based tutorial in the meantime. Backends will remain available for long enough. What you learn will put you in a better position to migrate to Modules later.
type: Comment

http://stackoverflow.com/a/22520464
answers question: http://stackoverflow.com/q/22520421
has comment: http://stackoverflow.com/comment/34267897
has comment: http://stackoverflow.com/comment/34268052
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22520421
has comment: http://stackoverflow.com/comment/34267979
type: Answer
upvote count: 3
has body: To create an ImageIcon from an image file within the same jar your code is loaded: bg = new ImageIcon(getClass().getResource("/sprites/bg.png")).getImage(); Then put your image file in your classes directory instead of your "src" directory (e.g. "classes/sprites" in your case). (duplicate of Java Swing: Displaying images from within a Jar)
has comment: http://stackoverflow.com/comment/34268422
has comment: http://stackoverflow.com/comment/34268346
score: 3
has comment: http://stackoverflow.com/comment/34268802

http://stackoverflow.com/comment/34223127
has text: I'm not calling System.exit anywhere in my code......? I'm not getting any error messages when I open details of the error. I'm getting a bunch of stuff before that, but's that's not error code.
comment on: http://stackoverflow.com/a/22494656
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/123687568
has text: There are now more details on the official documentation, in the page "Color Conversion Formulas RGB to XY and back": https://developers.meethue.com/develop/application-design-guidance/color-conversion-formulas-rgb-to-xy-and-back/
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22649803

http://stackoverflow.com/a/22574244
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22574212
has body: What is this, while(eleccion!=null){ Vx.setText(file);//how can you set a file handler to a TextField linea = eleccion.readLine(); } use, while((linea=eleccion.readLine())!=null){ Vx.setText(linea); } If you need to show all the Text in your file it's better to use JTextArea and append all the lines to it that you read from the file.

http://stackoverflow.com/q/22526819
has answer: http://stackoverflow.com/a/22526904
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34278909
type: Question
has title: String hashCodes
has body: Small question. String s1 = "test"; String s2 = "test"; s1,s2 both have same hashCode value String sn1 = new String("java"); String sn2 = new String("java"); all of them said sn1 and sn2 have different hashCode values and those are different objects When I am printing hashCode values it gives same value that means sn1 and sn2 points to the same object or not ?
has comment: http://stackoverflow.com/comment/34278552
has answer: http://stackoverflow.com/a/22526943
accepted answer: http://stackoverflow.com/a/22526943
has answer: http://stackoverflow.com/a/22526847
upvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/34278814
answer count: 4
favorite count: 0
tagged with: string-literals
has answer: http://stackoverflow.com/a/22527292
linked to: http://stackoverflow.com/q/513832
possible better answer: http://stackoverflow.com/a/22526904
type: AnsweredQuestion

http://stackoverflow.com/comment/34250162
has text: How is your CLASSPATH set when compiling from the command line?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22510809
score: 0

http://stackoverflow.com/comment/34278798
type: Comment
has text: @user3436273, that's in the answer. You need to use `rs` to get the information you want.
type: AnswerComment
comment on: http://stackoverflow.com/a/22526839
score: 0

http://stackoverflow.com/comment/34482326
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22630818
has text: I tried different fonts, but no success, also notice Aaron wrote me a legitimate comment, which made me realize that it still might be the way the file is loaded, since all of those characters are "replacement character"s, even before it gets to the jTable

http://stackoverflow.com/comment/34311327
has text: I *need* to know the origin of `loadCustomers()`'s data. Is it a file? Is it information already contained in the or another object? Is it user input? Where is the data coming from? This data is crucial to the context. Besides that, I don't know what I'm trying to code for.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22522037

http://stackoverflow.com/comment/34511854
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22641472
has text: Are you sure you want to be doing an `attach-descriptor`? Try removing the `execution` section
score: 0

http://stackoverflow.com/comment/34274666
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22523959
has text: @Squonk I understand, but the code was clearly Java, and syntax highlighting was not happening due to the missing tag.

http://stackoverflow.com/a/22605380
score: 0
has comment: http://stackoverflow.com/comment/34421521
has comment: http://stackoverflow.com/comment/34421122
has comment: http://stackoverflow.com/comment/34419872
has comment: http://stackoverflow.com/comment/34420177
has comment: http://stackoverflow.com/comment/34420414
has comment: http://stackoverflow.com/comment/34421025
type: Answer
has comment: http://stackoverflow.com/comment/34418796
has body: Java also takes care of not being able to access private members, even when doing it via reflection. But constructors, methods, and fields are AccessibleObjects, which provides a method to flag the member as being accessible although it might be private: field.setAccessible(true); Afterwards you can read it and even set a new value on it. An edit to make it clear. Consider the following simple record class: public class Record { private int length; private String name; public Record(int length, String name) { this.length = length; this.name = name; } public int getLength() { return length; } public String getName() { return name; } } And now let's write a reflection test program: public class ReflectionTest { public static void main(String[] args) throws Exception { Record record = new Record(42, "42"); Field[] fields = record.getClass().getDeclaredFields(); for (Field field : fields) { System.out.println(field.getName() + " => " + field.get(record)); } } } This will result in an IllegalAccessException, as the private fields cannot be accessed. Now change the foreach loop a little: for (Field field : fields) { field.setAccessible(true); System.out.println(field.getName() + " => " + field.get(record)); } This time you will see expected output: length => 42 name => 42 Your mistake also was to call the get method on the class and not on the object. This would be like this little modification: for (Field field : fields) { field.setAccessible(true); System.out.println(field.getName() + " => " + field.get(record.getClass())); } This time you will see an IllegalArgumentException (not an IllegalAccessException).
has comment: http://stackoverflow.com/comment/34420006
answers question: http://stackoverflow.com/q/22605244
has comment: http://stackoverflow.com/comment/34420858
has comment: http://stackoverflow.com/comment/34419743
has comment: http://stackoverflow.com/comment/34419642

http://stackoverflow.com/comment/34373034
has text: thanks guys. totally skipped my mind.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22575340

http://stackoverflow.com/comment/34399777
has text: I edited my question.Please check???@JasonC
comment on: http://stackoverflow.com/q/22594519
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22546268
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22546419
accepted answer: http://stackoverflow.com/a/22546415
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/22546419
has title: How elements are stored in a collection?
has body: I am familiar with Java collections are implemented and I am trying to understand how collections are implemented in Scala. Do Scala's collections ultimately wrap Java collections? What is the equivalent of ArrayList in Scala? ArrayList in Java contains a variable elementData that holds an array [*]. Is this implementation similar in the equivalent class/trait in Scala? How growable collections in Scala are implemented? Kind regards, Alexandre [*] http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/ArrayList.java
upvote count: 2
tagged with: scala
answer count: 2
linked to: http://stackoverflow.com/q/8287360
has comment: http://stackoverflow.com/comment/34313881
tagged with: java
tagged with: arraylist
has answer: http://stackoverflow.com/a/22546415

http://stackoverflow.com/a/22596988
answers question: http://stackoverflow.com/q/22595138
has body: Mapping is correct. This Hibernate bug reported in HHH-8834. Attached test case in bug report uses annotations, but otherwise it matches to the one in question.
accepted answer of: http://stackoverflow.com/q/22595138
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34419144

http://stackoverflow.com/comment/34217335
comment on: http://stackoverflow.com/q/22491244
score: 0
has text: why do you cast to (byte)? and why do you give the parseInt-method a radix 2?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34471252
type: Comment
type: QuestionComment
score: 1
has text: You could try adding a dependency on Child3 in your Integration project with "provided" scope - perhaps that will trigger the correct build order.
comment on: http://stackoverflow.com/q/22635075

http://stackoverflow.com/a/22559692
answers question: http://stackoverflow.com/q/22559604
type: Answer
has body: Eclipse does not automatically find all Java instances, but has a list of known JREs. To add your newly installed JRE, open Preferences, select the Java/Installed JREs page, and try search to find your new engine. If search does not yield results, select the Add... button, on the first page, select Standard VM, and then add '/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home' as the Java home (or something similar).
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22559604

http://stackoverflow.com/comment/34648667
has text: @Riya, no problem, yrw :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22517003
type: AnswerComment

http://stackoverflow.com/comment/34308598
score: 0
has text: @AVolpe I am refering to apache.commons.collections framework class. Will learn Hadoop when get a chance :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22542916

http://stackoverflow.com/comment/34274478
score: 0
type: Comment
has text: I do not know what you mean.
comment on: http://stackoverflow.com/a/22524036
type: AnswerComment

http://stackoverflow.com/a/22571820
answers question: http://stackoverflow.com/q/22571805
type: Answer
has comment: http://stackoverflow.com/comment/34359076
has comment: http://stackoverflow.com/comment/34359044
score: 1
upvote count: 1
has body: Have you implemented hashCode and equals for Key and BasicRectangleCollection? If not, I think Java uses the objects reference in memory as the hashcode which means that unless two objects are the same instance they are not equal and your search will not work as desired.
has comment: http://stackoverflow.com/comment/34360278
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34359063
accepted answer of: http://stackoverflow.com/q/22571805
has comment: http://stackoverflow.com/comment/34358970

atomic
type: Tag
tags question: http://stackoverflow.com/q/22528840
tags question: http://stackoverflow.com/q/22610603
tag name: atomic

http://stackoverflow.com/comment/34271262
has text: oh it sounds so useful i will favorite this question for easy access
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22522212
type: Comment

math
tags question: http://stackoverflow.com/q/22558000
tags question: http://stackoverflow.com/q/22550322
tags question: http://stackoverflow.com/q/22563558
tags question: http://stackoverflow.com/q/22637468
tags question: http://stackoverflow.com/q/22516409
type: Tag
tags question: http://stackoverflow.com/q/22600647
tags question: http://stackoverflow.com/q/22544785
tags question: http://stackoverflow.com/q/22584244
tags question: http://stackoverflow.com/q/22498282
tags question: http://stackoverflow.com/q/22594245
tags question: http://stackoverflow.com/q/22608827
tags question: http://stackoverflow.com/q/22629884
tags question: http://stackoverflow.com/q/22567650
tags question: http://stackoverflow.com/q/22595502
tags question: http://stackoverflow.com/q/22621513
tags question: http://stackoverflow.com/q/22595470
tag name: math
tags question: http://stackoverflow.com/q/22520315
tags question: http://stackoverflow.com/q/22577986

http://stackoverflow.com/q/22594773
has comment: http://stackoverflow.com/comment/34399748
has answer: http://stackoverflow.com/a/22594845
score: 0
has title: Creating a new Class without creating a new window in Swing
has comment: http://stackoverflow.com/comment/34399792
has comment: http://stackoverflow.com/comment/34399906
answer count: 1
has comment: http://stackoverflow.com/comment/34399812
tagged with: swing
type: AnsweredQuestion
has body: I'm making a game that uses Swing but the problem is, in the code, I have to create a few classes and call a method in them. Because those methods are in subclasses of the class that uses swing, when I create it, it creates a new window of the same swing component and starts doing everything there. Is there a way to accomplish what I want without having multiple swing windows? Here is where I'm creating the subclasses and calling their method. new Chapter1(player).engage(); new Chapter2(player).engage(); I've tried just doing Chapter1().engage(player); Chapter2().engage(player); but that requires for the engage() method to be static which causes errors in my whole program. as a lot of methods need to be inherited and aren't static. Is there a way around this or will I have to deal with multiple windows? Edit: A little more information about what the windows do. I created a console in swing for myself and I print a lot of information to it. The engage methods just print more things but I want them to be in the same window rather than printing in their own windows
tagged with: java
accepted answer: http://stackoverflow.com/a/22594845
type: Question
has comment: http://stackoverflow.com/comment/34399765

http://stackoverflow.com/comment/34300205
has text: Well, look at the example code of the Fragment in my answer.
comment on: http://stackoverflow.com/a/22537168
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/40608907
has body: Your comment indicates this is for Guava, so you want the JSR305 library, which extends the javax package. 2020 Update: Note that this library breaks the Oracle licensing agreement and Guava has since moved to checkerframework's Nullable annotation.
score: 6
answers question: http://stackoverflow.com/q/22589302
downvote count: 0
type: Answer
upvote count: 6

http://stackoverflow.com/comment/34443388
comment on: http://stackoverflow.com/q/22618680
has text: no the column is added as is. all columns are.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24069768
upvote count: 6
has comment: http://stackoverflow.com/comment/82123846
score: 6
has comment: http://stackoverflow.com/comment/67005105
has body: You can use JsonManagedReference / JsonBackReference and at the same time use JsonIdentityInfo to complement bidirectional relationships. In question Class: // bi-directional one-to-many association to Answer (Question is owner) @JsonManagedReference @OneToMany(mappedBy = "question", cascade = CascadeType.ALL) @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property = "@QuestionAnswers") private Set&lt;Answer&gt; answers = new HashSet&lt;&gt;(); In answer Class: // bi-directional many-to-one association to Question @JsonBackReference @ManyToOne @JoinColumn(name = "questionId", referencedColumnName="id", foreignKey = @ForeignKey(name = "fk_answer_question")) private Question question; If you need parent reference in child object, remove Managed / Back Reference, this works fine for me.
answers question: http://stackoverflow.com/q/22615317
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34412321
type: AnswerComment
has text: @Radiodeg I kinda agree. When he said that, though with good intention and I really appreciated the help, I was kinda left confused like... Uh... Haha. Either way, problem solved. Thanks everyone!
comment on: http://stackoverflow.com/a/22601454
type: Comment
score: 0

http://stackoverflow.com/comment/34296297
score: 0
comment on: http://stackoverflow.com/q/22536284
type: Comment
type: QuestionComment
has text: I just added the project structure

http://stackoverflow.com/q/22556144
has comment: http://stackoverflow.com/comment/34356690
linked to: http://stackoverflow.com/q/9451651
has comment: http://stackoverflow.com/comment/34330983
has body: I ve got an ArrayList testset. This list contains my data for SMO evaluation in WEKA. I want to use Evaluation weka class in order to classify my testset. In simpliest case, I had a features extracted by only one image in a ArrayList. What conversion it must be done in order to use my list in the following: Evaluation eval = new Evaluation(testset); // how can I cast testset2 Instances object? eval.evaluateModelOnce(c, data); This code found from here: I am using it in order to train a SMO model. Train dataset contains feature extracted train images, stored in an .arff file. In test process I am reading in my code an image I calculate the features, stored them in arrayList without stored them in .arff files. I want to cast the list directly to Instances object and proceed with classification. EDIT: I ve tried to do something else, first connvert arrayList to array double data and to proceed as I proceed for my trainSet: int numAtts = data[0].length; FastVector atts = new FastVector(numAtts); for (int att = 0; att &lt; numAtts; att++) { atts.addElement(new Attribute("Attribute" + att, att)); } int numInstances = data.length; Instances dataset = new Instances("Dataset", atts, numInstances); for (int inst = 0; inst &lt; numInstances; inst++) { dataset.add(new Instance(1.0, data[inst])); } However I am received : Exception in thread "main" java.lang.ClassCastException: javax.management.Attribute cannot be cast to weka.core.Attribute EDIT: I change a little my code double data[][] = new double[1][]; data[0] = dt; System.out.println(args[1]); System.out.println(args[2]); ClothesAnalysis asdf = new ClothesAnalysis(); weka.classifiers.Classifier c = asdf.loadModel(new File(args[1]), args[2]); String opt = ("-C 100 -K weka.classifiers.functions.supportVector.NormalizedPolyKernel"); String[] options = opt.split(" "); int numAtts = data[0].length; FastVector atts = new FastVector(numAtts); for (int att = 0; att &lt; numAtts; att++) { atts.addElement(new weka.core.Attribute("At…
has comment: http://stackoverflow.com/comment/34356606
upvote count: 2
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/24205330
tagged with: casting
has answer: http://stackoverflow.com/a/22557339
has title: ArrayList conversion to Instances object
type: UnansweredQuestion
tagged with: weka
has answer: http://stackoverflow.com/a/55276496
score: 2
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34330039

http://stackoverflow.com/a/22565014
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22562277
answers question: http://stackoverflow.com/q/22562277
type: Answer
has comment: http://stackoverflow.com/comment/34349755
has body: Self-contained example means code which compiles and relies on no external resource to run/demonstrate the problem. Your code doesn't. Here is modified version of your code which works and demonstrates partial matches. public class Demo { static Directory dir; IndexWriter indexWriter; public boolean openIndex() { try { dir = new RAMDirectory(); Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_44); IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_44, analyzer); indexWriter = new IndexWriter(dir, iwc); return true; } catch (Exception e) { return false; } } public void finish() { try { indexWriter.close(); } catch (IOException e) { e.printStackTrace(); } } public void addDoc() { Document doc = new Document(); doc.add(new TextField("field1", "val1", Field.Store.YES)); doc.add(new TextField("field2", "val2", Field.Store.YES)); doc.add(new TextField("field3", "val3", Field.Store.YES)); doc.add(new TextField("field4", "val4", Field.Store.YES)); try { indexWriter.addDocument(doc); indexWriter.commit(); } catch (IOException e) { e.printStackTrace(); } } private static void printResults(Query query) throws IOException { IndexReader reader = DirectoryReader.open(dir); IndexSearcher searcher = new IndexSearcher(reader); TopDocs result = searcher.search(query, 5); System.out.println("# of results:" + result.totalHits); for (ScoreDoc doc : result.scoreDocs) { System.out.println(doc); } reader.close(); } public static void main(String[] args) throws IOException, ParseException { Demo demo = new Demo(); demo.openIndex(); demo.addDoc(); demo.finish(); BooleanQuery booleanQuery = new BooleanQuery(); Query query1 = new TermQuery(new Term("field1", "val1")); Query query2 = new TermQuery(new Term("field2", "val2")); Query query3 = new TermQuery(new Term("field3", "val3")); Query query4 = new TermQuery(new Term("field4", "val4")); booleanQuery.add(query1, BooleanClause.Occur.SHOULD); booleanQuery.add(query2, BooleanClause.Occur.SHOULD); booleanQuery.add(query3, Boolean…
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/comment/34292723
comment on: http://stackoverflow.com/q/22534574
type: QuestionComment
has text: http://docs.oracle.com/javase/7/docs/api/java/awt/Toolkit.html#getScreenInsets%28java.awt.GraphicsConfiguration%29 - may be what you need.
score: 0
type: Comment

http://stackoverflow.com/comment/34283265
type: Comment
has text: Nothing seems wrong, Do you kill and restart your abd ?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22529286

http://stackoverflow.com/q/22567133
possible better answer: http://stackoverflow.com/a/22570084
tagged with: primefaces
has answer: http://stackoverflow.com/a/22570084
tagged with: servlets
has answer: http://stackoverflow.com/a/22578292
score: 0
answer count: 2
has body: I have to use my Company login resource and, how can I set the logout servlet into my primefaces component? How "translate" this... //in a jsp page: &lt;a href="&lt;%=request.getContextPath()%&gt;/servlet/com.app.ServletEndSession?initialPage=/index.jsp" &gt; Logout &lt;/a&gt; ...into this: &lt;p:commandButton type="button" value="Logout" action="??" /&gt; Thanks in advance.
has title: How to Logout in a JSF application
accepted answer: http://stackoverflow.com/a/22578292
type: AnsweredQuestion
tagged with: jsf
tagged with: java
type: Question

http://stackoverflow.com/comment/34404736
comment on: http://stackoverflow.com/q/22597421
type: Comment
type: QuestionComment
has text: do you want to develop a website or an computer application? For the first one you use javascript and HTML, for the second one you use Java.
score: 0

http://stackoverflow.com/a/22492081
type: AcceptedAnswer
has body: As others have pointed out, your error is likely in your onCreate code for your second activity. If you read the documentation here you'll see they start their activity off with onCreate and an immediate call back to super.onCreate(...) Your code should be as follows: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //added this line setContentView(R.layout.search_results); } If you chose to have your IDE automatically generate an Activity stub, it will always place the call to super.onCreate in your activity. It initializes the activity, see this question for more of an explanation. If this doesn't fix your problem and you have more code in your second activity, it might be useful to post code for the entire activity.
answers question: http://stackoverflow.com/q/22491077
score: 4
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22491077

http://stackoverflow.com/q/22529455
type: Question
tagged with: java
answer count: 2
has title: Redeploy web application on Tomcat through Maven
has body: I have installed and deployed a web application on Linux server using Tomcat and the following commmands: mvn clean install -Dmaven.test.skip=true mvn tomcat:run -Dmaven.tomcat.port=8081 &amp; &gt; log.txt I've changed the tomcat > web.xml that exists inside my project folder and in order for the modification to be activated I need to restart server or re-deploy the web application? What command do I need to restart this tomcat instance? I tried this mvn package -Dmaven.test.skip=true tomcat:redeploy but it returned the error: Cannot invoke Tomcat manager: Error writing to server Thank you in advance.
downvote count: 0
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22529583
score: 1
has answer: http://stackoverflow.com/a/22529877
tagged with: maven
upvote count: 1

http://stackoverflow.com/q/22547351
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/22547378
has answer: http://stackoverflow.com/a/37217452
upvote count: 7
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/55455285
downvote count: 0
has body: I am in a need of a way to keep two keys for a value - exactly what Guavan's HashBasedTable does . The issue is that it does not keep the insertion order when iterating over values. Is there any elegant solution to get it working? It doesn't have to be Guava, but I wouldn't want to bloat my project with dependencies. I am trying to use mentioned ImmutableTable - and I haven't found any example. I get NPE everywhere when building a table like that: ImmutableTable&lt;String, String, AbstractUnit&gt; units; ImmutableTable.Builder&lt;String, String, AbstractUnit&gt; builder = units.builder(); builder.put(unit1.getType(), unit1.getName(), unit1); ... units = builder.build(); I will get NPE when gettinb units.values(). Also, will I be able to modify values of AbstractUnit in the table?
favorite count: 0
has title: Guava: HashBasedTable that keeps insertion order?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34315856
tagged with: guava

http://stackoverflow.com/a/22605294
type: Answer
has comment: http://stackoverflow.com/comment/34419211
has body: Instead of command.getClass() pass the object of command class. The value contains by object not by class
has comment: http://stackoverflow.com/comment/34421177
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34419391
has comment: http://stackoverflow.com/comment/34418361
has comment: http://stackoverflow.com/comment/34419118
has comment: http://stackoverflow.com/comment/34419318
answers question: http://stackoverflow.com/q/22605244
has comment: http://stackoverflow.com/comment/34420948
has comment: http://stackoverflow.com/comment/34420797
upvote count: 1

http://stackoverflow.com/q/22644368
tagged with: performance
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34488944
has comment: http://stackoverflow.com/comment/34488578
has body: I was trying to solve Euler Project. Gist here. Yes, I get it, there is no algorithm used - I am not trying to. The question is, the 2nd file is using an ExecutorService to find the values - I understand that the result will not be correct but it is crawling compared to single threaded one. I thought creating threads itself might have overhead reduced the pool size to 4 (I have an eight core processor) but that did nothing. Earlier I had also used similar approach to significantly speed up thumbnail generation using multiple threads. But I am not able to understand what might be causing the slowness of this particular case. I am not trying to get the correct solution - I understand that I should do that first and then attempt anything else. What is that I doing it wrong. I am not coming here with intention to find a solution to the problem but I want to understand why is it slow. I have used static variables that are accessed by Threads. Could that be an issue ?
upvote count: 2
answer count: 1
has title: Multi-Threaded program runs slower than single threaded
accepted answer: http://stackoverflow.com/a/22644700
favorite count: 0
has comment: http://stackoverflow.com/comment/34488275
has comment: http://stackoverflow.com/comment/34488687
linked to: http://stackoverflow.com/q/13184005
tagged with: multithreading
has answer: http://stackoverflow.com/a/22644700
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/34325218
has text: Interesting. I'll keep that in mind for future reference and usage. You learn something new everyday. :)
comment on: http://stackoverflow.com/a/22552944
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34404276
score: 0
type: Comment
has text: Wouldn't that require me redoing my entire project? I don't know if I have time to do this, though it is an interesting solution
comment on: http://stackoverflow.com/a/22596995
type: AnswerComment

http://stackoverflow.com/a/22554459
upvote count: 6
accepted answer of: http://stackoverflow.com/q/22554373
answers question: http://stackoverflow.com/q/22554373
has body: Just count how many primes number have been printed so far. If this number is more than 10 then stop. Your loop should be like that: for(int number = 2; number&lt;=limit; number++){ //print prime numbers only if(isPrime(number)){ System.out.println(number); count++; } } Whole code: import java.util.Scanner; class PrimeNumberExample { public static void main(String args[]) { //get input till which prime number to be printed System.out.println("Enter the amount of prime numbers to be printed: "); int limit = new Scanner(System.in).nextInt(); int count=0; //printing primer numbers till the limit ( 1 to 100) System.out.println("Printing prime number from 1 to " + limit); for(int number = 2; number&lt;=limit; number++){ //print prime numbers only if(isPrime(number)){ System.out.println(number); count++; } } } /* * Prime number is not divisible by any number other than 1 and itself * @return true if number is prime */ public static boolean isPrime(int number){ for(int i=2; i&lt;number; i++){ if(number%i == 0){ return false; //number is divisible so its not prime } } return true; //number is prime now } }
type: AcceptedAnswer
downvote count: 0
score: 6
type: Answer

http://stackoverflow.com/a/22600862
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22600528
type: Answer
answers question: http://stackoverflow.com/q/22600528
score: 2
upvote count: 2
has body: The Android Developer's Guide has a detailed guide on this: Shape Drawbables. <corners android:radius="3dp" /> <stroke android:width="5px" android:color="#1a1a1a" /> button with shadow <item android:drawable="@drawable/shadow"/> <item android:drawable="@drawable/button" android:bottom="4px" /> Refer this tutorial

http://stackoverflow.com/comment/34357407
type: QuestionComment
has text: @DevMaha: I'm afraid it was a bit slow too...
comment on: http://stackoverflow.com/q/22569306
score: 0
type: Comment

http://stackoverflow.com/q/22488194
has answer: http://stackoverflow.com/a/22488237
tagged with: java
type: Question
answer count: 1
tagged with: jar
has title: Run a jar file without JDK installed
score: 0
has comment: http://stackoverflow.com/comment/34211570
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3014187
has body: is there any way to run a jar file without JDK installed ? for example convert jar file to exe or put the jdk or jre into the jar file or something like this...

http://stackoverflow.com/comment/34254983
type: QuestionComment
score: 0
has text: How to retrive the textbox value and add to the database
comment on: http://stackoverflow.com/q/22512431
type: Comment

http://stackoverflow.com/comment/34227912
score: 0
type: AnswerComment
has text: I posted the new code
comment on: http://stackoverflow.com/a/22497656
type: Comment

http://stackoverflow.com/a/22601271
has comment: http://stackoverflow.com/comment/34411754
type: Answer
answers question: http://stackoverflow.com/q/22601241
score: 1
has comment: http://stackoverflow.com/comment/34411680
has body: It looks like a design problem. Why you would like to have a list of alarms in the Alarm class?. That class should be supposed to represent one single alarm. You could try creating another class, for example AlarmList (I'm not good with names), and there, you can store the Alarm instances.
upvote count: 1
has comment: http://stackoverflow.com/comment/34412084
has comment: http://stackoverflow.com/comment/34412138
downvote count: 0

http://stackoverflow.com/comment/34389630
type: QuestionComment
comment on: http://stackoverflow.com/q/22588879
has text: @AndrewThompson, sorry I was writing my response to Klemens before I'd seen your reply. Does my edit achieve what you were asking?
score: 0
type: Comment

http://stackoverflow.com/q/22575056
tagged with: java
tagged with: ssl
has answer: http://stackoverflow.com/a/22656368
score: 0
has title: jetty ssl with client-auth throws null cert exception
answer count: 1
tagged with: cxf
has body: I am trying to run jetty in ssl mode with client authentication. I pass keystore.But instead of passing truststore, i import my certificate into java/jre/lib/security/cacerts. please find the jetty.xml configuration javax.net.ssl.keyStore <SystemProperty name="jetty.home" default="." />/../workspace/conf/xyz.ks javax.net.ssl.keyStorePassword abc javax.net.ssl.keyStoreType JKS Socketconnector <SystemProperty name="port"/> 600000 <SystemProperty name="javax.net.ssl.keyStore"/> <SystemProperty name="javax.net.ssl.keyStorePassword"/> <!--Set name="truststore"><SystemProperty name="javax.net.ssl.trustStore"/> <SystemProperty name="javax.net.ssl.trustStorePassword"/></Set--> true Now when i hit the url https://localhost:1234/xyz?wsdl i get bad_certificate exception which is caused due to null cert chain. i) can java cacerts be used to configure jetty? ii) is it because of the webservice call because in the logs it is shown as the server is started. I am using jetty 6 and cxf 2.6 webservice. thanks, Keerthi.
type: UnansweredQuestion
tagged with: jetty
type: Question

http://stackoverflow.com/comment/34480729
comment on: http://stackoverflow.com/q/22632167
score: 0
type: Comment
type: QuestionComment
has text: http://www.mariussoutier.com/blog/2013/09/17/playframework-2-2-action-building-action-composition/

http://stackoverflow.com/a/22590397
upvote count: 68
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: It's because mm is for minutes, not months. More in the documentation. Just about the time you were asking your question the newer java.time package was added to the standard Java library. These days, you'd probably use that as shown in Arvind Kumar Avinash's answer. But the same thing applies to the formatter there, mm is minutes, MM is months.
accepted answer of: http://stackoverflow.com/q/22590381
score: 68
answers question: http://stackoverflow.com/q/22590381

http://stackoverflow.com/a/22617100
score: 2
has body: Use two SimpleDateFormats - one to parse() the first String into a Date, and the second to format() the resultant Date back into a String.
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22616998
type: Answer

http://stackoverflow.com/a/22575591
type: Answer
downvote count: 0
score: 7
has body: From the Java language specification: 14.2. Blocks: A block is a sequence of statements, local class declarations, and local variable declaration statements within braces. 6.3. Scope of a Declaration The scope of a declaration is the region of the program within which the entity declared by the declaration can be referred to using a simple name, provided it is visible (§6.4.1). In a block, you can declare variables. A scope defines the region, where you can access a declared variable by its simple name.
answers question: http://stackoverflow.com/q/22575444
upvote count: 7

http://stackoverflow.com/comment/34355457
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22569995
score: 0
has text: This tutorial should definitely help: http://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html

http://stackoverflow.com/comment/34267642
type: AnswerComment
comment on: http://stackoverflow.com/a/22520212
score: 0
type: Comment
has text: You probably want `lastIndexOf`. And handle the case where there is no dot.

http://stackoverflow.com/comment/118720829
has text: I got the same error from the java compiler and found that `javac -encoding utf-8 ...` works in that case, too.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22599043
score: 1

http://stackoverflow.com/comment/111305145
type: Comment
has text: This example worked for what I was looking for. However, it seems I can not catch the error name. For instance, if you catch the exception like this `except Exception as e:` and do a `print(e)`, nothing is printed.
comment on: http://stackoverflow.com/a/22547155
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34400861
score: 0
comment on: http://stackoverflow.com/q/22594631
type: Comment
has text: Please post also your shader code.
type: QuestionComment

http://stackoverflow.com/comment/34247951
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22509715
type: Comment
has text: See [subset sum problem](http://en.wikipedia.org/wiki/Subset_sum_problem).

http://stackoverflow.com/q/22534356
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34292734
tagged with: event-handling
tagged with: asynchronous
favorite count: 0
has body: I am very curious why we have to use java.awt.EventQueue.invokeLater to control swing components. Why can't we do that in a normal thread? What exactly is going on behind the scenes? From what I have noticed if I have a JFrame I can set visibility to true or false from the main thread without getting any errors, and it does seem to work. So what exactly do I achieve by using java.awt.EventQueue.invokeLater? I am also fully aware that I can use SwingUtilities.invokeLater but as explained here, they seem to be one and the same thing. Thanks to anyone for their explanation. Hopefully this is a valid question. EDIT: to answer wumpz question We can create a jframe JFrame frame = new JFrame("Hello world"); frame.setSize(new Dimension(300, 300)); frame.setPreferredSize(new Dimension(300, 300)); frame.setMaximumSize(new Dimension(300, 300)); frame.setMinimumSize(new Dimension(300, 300)); frame.setVisible(true); frame.pack(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); And on the same thread it was created do the following. for (int i = 0; i < 34; i++) { System.out.println("Main thread setting to "+(!frame.isVisible())); frame.setVisible(!frame.isVisible()); } And no complaints.
has answer: http://stackoverflow.com/a/22534931
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34293426
score: 47
tagged with: java
tagged with: swing
has title: java.awt.EventQueue.invokeLater explained
accepted answer: http://stackoverflow.com/a/22534931
possible better answer: http://stackoverflow.com/a/22534738
has answer: http://stackoverflow.com/a/22534738
has comment: http://stackoverflow.com/comment/34296367
upvote count: 47

http://stackoverflow.com/comment/34366316
score: 0
type: Comment
type: QuestionComment
has text: @Andrew Thompson I can't get that error I only get the signed error. I have now signed all the JMonkey jars by adding my signature to them. This worked running javaws <jnlp name> for loading the applicaiton. When I then added it to my ear file and deployed it to my local machine I still get the not signed error.
comment on: http://stackoverflow.com/q/22567874

http://stackoverflow.com/a/22630851
answers question: http://stackoverflow.com/q/22614943
type: Answer
has comment: http://stackoverflow.com/comment/34539176
has comment: http://stackoverflow.com/comment/34488474
has body: Finally, I ended up changing Hibernates Oracle dialect. Depending on Oracle using my hint was a bit too vague and would have required a client change as well. Alex Poole's answer was good, but would involve database evolution AND a client change. So here goes my solution: I subclassed Hibernates Oracle10gDialect (an 11g version isn't present in my version of Hibernate). I registered a new function in it: @Override protected void registerFunctions() { super.registerFunctions(); registerFunction("punctuation_replace", new PunctuationReplacerSQLFunction() ); } I wrote the PunctuationReplacerSQLFunction: public class PunctuationReplacerSQLFunction implements SQLFunction { [...] @Override public String render(Type firstArgumentType, List arguments, SessionFactoryImplementor sessionFactory) { return "REGEX_REPLACE" + "(" + arguments.iterator().next() + ", '[:punct:]', '')"; } } And then use it like this in my code: jpaCriteriaBuilder.function("punctuation_replace", String.class, path); The hacky thing about it is that I hardwire the pattern as a String, so that for any new pattern or replacement string I'd have to provide a new function. Anyway, it works. My SQL - for some other test szenario not related to my example in the question - looks like this: SELECT demoentity0_.ID AS ID2_15_, demoentity0_.VERSION AS VERSION3_15_, demoentity0_.NAME AS NAME11_15_, FROM DEMO_ENTITY demoentity0_ WHERE REGEXP_REPLACE(demoentity0_.NAME, '[:punct:]', '')=?
score: 0

clojure
tags question: http://stackoverflow.com/q/22508965
tags question: http://stackoverflow.com/q/22514877
tags question: http://stackoverflow.com/q/22641901
type: Tag
tag name: clojure
tags question: http://stackoverflow.com/q/22561658

http://stackoverflow.com/a/22501805
has body: You may need to set the accesible to true on that field before actually getting it: Field field = Foo.getClass().getDeclaredField("myButton")); field.setAccessible(true); View button = (View) field.get(fooInstance);
type: Answer
answers question: http://stackoverflow.com/q/22501600
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/22609806
has comment: http://stackoverflow.com/comment/34426293
downvote count: 0
score: 7
type: AcceptedAnswer
has body: The most common reasons I hear quoted for using this are: It's clever and cool. It helps protect against assignment vs. comparison errors, since you can't assign to null. I vehemently argue against the former, since "clever" very easily becomes "difficult to maintain" in any codebase. The latter has validity, though I think decent test coverage can accomplish the same task with more added value. Personally I don't care for this style because it doesn't read correctly for me. Generally I like code to "read like prose" to make it easy to follow. And consider two prose statements: The object is empty. Empty is the object. The former sounds more natural to me.
upvote count: 7
type: Answer
accepted answer of: http://stackoverflow.com/q/22609745
answers question: http://stackoverflow.com/q/22609745
has comment: http://stackoverflow.com/comment/34458277

http://stackoverflow.com/comment/34262270
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22517416
has text: A `SortedSet` will be fine as long as "duplicates" are not allowed however
type: AnswerComment

http://stackoverflow.com/q/22506680
upvote count: 1
has body: Background: I need to send many small-size messages to WebSocket clients in asynchronous way. Messages are usually sent in peak, so after some pause I need to send ~5000 messages fast. So the problem is: I don't want to start 5000 async's in single thread I don't want to loop "start async"-"wait for complete" 5000 times in serial I don't want to use 5000 threads, with single "start async"-"wait for complete" per thread The best way would be to group ~20 asyncs per thread, so I need very specific queue: lot of means concurrent push/poll in queue small-sized asynchronous means I want to poll in bundles, like 1 to 20 messages per queue take() (so I can start 1...20 async I/O and wait for completness in single thread) immediately means that I dont want to wait until 20 messages will be polled, bundle-poll should be used only if queue has lot of messages. Single message should be polled and sent immediately. So basically: I need structure like queue that has blocking take(1 to X) waiting elements in single blocking call. Pseudocode: [each of ~50 processing threads]: messages = queue.blockingTake( max 10 or at least 1 if less than 10 available ); for each message: message.startAsync() for each message: message.waitToComplete() repeat
tagged with: queue
type: Question
tagged with: concurrency
tagged with: producer-consumer
answer count: 1
downvote count: 0
tagged with: websocket
has answer: http://stackoverflow.com/a/22568006
favorite count: 0
type: UnansweredQuestion
has title: How to create Java concurrent queue from which we can blocking-take more than 1 element in single call?
score: 1
tagged with: java

http://stackoverflow.com/q/22605520
type: AnsweredQuestion
tagged with: java
has title: (R) Automatically calculate optimized Arima(p, d , q) value
type: Question
tagged with: forecasting
has answer: http://stackoverflow.com/a/22605521
accepted answer: http://stackoverflow.com/a/22605521
tagged with: http://stackoverflow.com/tag/r
score: 0
answer count: 1
has body: I'm developing automatic forecast Software with JAVA &amp; R. The following steps are used in R to forecast next 18 values: trends &lt;- scan("c:/data_for_R/trends.dat") auto.arima(trends) (cf. arima(pdq)) trendsarima &lt;- arima(trends, order=c(2,1,3)), note that (2,1,3) was found by the step #2) trendsforecasts &lt;- forecast.Arima(trendsarima, h=18) trendsforecasts plot.forecast(trendsforecasts) All I want to know is, how do you integrate steps #2, #3 (preferably by a single command)?

http://stackoverflow.com/q/22622756
answer count: 1
has answer: http://stackoverflow.com/a/22622794
has comment: http://stackoverflow.com/comment/34545322
has comment: http://stackoverflow.com/comment/34450492
favorite count: 0
has title: NULLPOINT EXCEPTION ERROR during Simple Android app development
tagged with: nullpointerexception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34450670
tagged with: android
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/34522469
has body: i am trying to develop this simple app using Android ADT and I got null point exception error. It is returning null point exception error at line 32 which is add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub counter++; display.setText("your total is" + counter); } }); My whole java code is 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.*; public class MainActivity extends ActionBarActivity { int counter; Button add , subtract; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); counter = 0; add = (Button) findViewById(R.id.badd1); subtract = (Button) findViewById(R.id.bsub1); display = (TextView) findViewById(R.id.textView1); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub counter++; display.setText("your total is" + counter); } }); subtract.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub counter--; display.setText("your total is" + counter); } }); } @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; } } MY xml CODE IS &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:gravity="center_horizontal" android:paddingBottom="@dimen/activity_verti…
upvote count: 0
has comment: http://stackoverflow.com/comment/34450916
tagged with: java
has comment: http://stackoverflow.com/comment/34521387
tagged with: android-emulator
has comment: http://stackoverflow.com/comment/34522560
type: Question
has comment: http://stackoverflow.com/comment/34527750
has comment: http://stackoverflow.com/comment/34499807
linked to: http://stackoverflow.com/q/218384
score: -2
has comment: http://stackoverflow.com/comment/34450683
tagged with: adt
has comment: http://stackoverflow.com/comment/34451010
downvote count: 2
has comment: http://stackoverflow.com/comment/34453257

http://stackoverflow.com/comment/34465289
score: 2
type: AnswerComment
has text: please elaborate why I need to override `.hashCode()` if I override `.equals()`
comment on: http://stackoverflow.com/a/22631497
type: Comment

http://stackoverflow.com/q/22528582
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/34281862
tagged with: java
has body: I dont want to take the path using command line arguments. Scanner sc = new Scanner(System.in); String xmlPath, xsltPath; System.out.println("Enter the path of XML file"); xmlPath = sc.nextLine(); System.out.println("Enter the path of XSLT file"); xsltPath = sc.nextLine();
has answer: http://stackoverflow.com/a/22528775
type: Question
answer count: 2
upvote count: 0
score: -1
tagged with: file-io
has comment: http://stackoverflow.com/comment/34281792
has comment: http://stackoverflow.com/comment/34281739
has comment: http://stackoverflow.com/comment/34281761
has comment: http://stackoverflow.com/comment/34281816
favorite count: 0
has comment: http://stackoverflow.com/comment/34281852
has answer: http://stackoverflow.com/a/22528661
has title: How to get an file path in Java? I want to take that path in some string variable and use it further for some XML transformations
type: UnansweredQuestion

http://stackoverflow.com/comment/34398309
type: Comment
has text: I noticed one more strange behaviour. can you explain it ?(added in topic)
type: AnswerComment
comment on: http://stackoverflow.com/a/22593635
score: 0

http://stackoverflow.com/q/22557028
has comment: http://stackoverflow.com/comment/34331529
has answer: http://stackoverflow.com/a/22557117
tagged with: concurrency
upvote count: 4
type: AnsweredQuestion
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22557117
type: Question
tagged with: future
has title: Why Java program not terminating
score: 4
has body: The code below checks the usage of ExecutorCompletionService from Java Concurrency framework (the IDE being used is Netbeans). But the program doesn't terminate. Why? Code: import java.util.concurrent.Callable; import java.util.concurrent.CompletionService; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.Executors; public class TestFuture { public static void main(String... args) throws InterruptedException, ExecutionException { Executor ex = Executors.newCachedThreadPool(); CompletionService&lt;Long&gt; cs = new ExecutorCompletionService&lt;Long&gt;(ex); cs.submit(new Worker()); cs.submit(new Worker()); cs.submit(new Worker()); for (int i = 0; i &lt; 3; i++) { long l = cs.take().get(); //utilize the result System.out.println(l); } } } class Worker implements Callable { @Override public Long call() throws Exception { //do some task and return back return System.currentTimeMillis(); } }
tagged with: executors
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/34331421

http://stackoverflow.com/comment/107792532
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22528050
has text: This is an old thread. But if you are reading this comment chances are that you have already configured your tomcat correctly. The CORS headers like allowed-origin are only exposed to request that do have a ORIGIN header set. So if you are only rushing through documentation like me, you might be checking the dev tools of your browser and wondering where your headers are. Try this for testing: curl -I -H 'Origin: http://www.example.com' http://localhost:8080/

http://stackoverflow.com/q/22630235
answer count: 3
has title: is it possible to configure Ant to compile only the changed classes
has body: Is there any way to configure ANT to compile only the changed modules? my suggestion is to specify the change module in a build property and execute based on property file content. For example if compile with below target. <src path="${source.java.dir}/module1"/> <src path="${source.java.dir}/module2"/> <classpath refid="libs"/> Is there a way to evaluate time taken for each target ?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34576314
has answer: http://stackoverflow.com/a/22630850
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22630790
type: Question
tagged with: ant

http://stackoverflow.com/q/22625681
has title: No operations allowed after connection closed.Connection was implicitly closed by the driver. C3P0
has comment: http://stackoverflow.com/comment/34455733
has comment: http://stackoverflow.com/comment/34461347
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/22625770
has comment: http://stackoverflow.com/comment/34471392
type: AnsweredQuestion
score: 2
tagged with: connection-pooling
upvote count: 3
has comment: http://stackoverflow.com/comment/34456206
has body: I am trying to upload images(one by one) using c3p0 connection pooling but my jdbc type 4 driver(connecting to mysql) keeps on closing the connection. I have seen that the maximum timeout in the configuration of mysql is set to 300 seconds. Here is how my persistence xml uses c3p0. <property name="driverClass" value="...." /> <property name="jdbcUrl" value="...." /> <property name="user" value="....." /> <property name="password" value="...." /> <property name="initialPoolSize" value="10" /> <property name="minPoolSize" value="5" /> <property name="maxPoolSize" value="20" /> <property name="maxIdleTime" value="5" /> <property name="autoCommitOnClose" value="false" /> Can someone explain what exactly is causing the driver to implicitly close the connection. Also, how can i reolve this issue? Here is the error message I get: 19:01:45,504 WARN NewPooledConnection:486 - [c3p0] A PooledConnection that has already signalled a Connection error is still in use! 19:01:45,505 WARN NewPooledConnection:487 - [c3p0] Another error has occurred [ com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed by the driver. ] which will not be reported to listeners! com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed by the driver.
tagged with: java
tagged with: mysql
downvote count: 1
has comment: http://stackoverflow.com/comment/34455599
type: Question
has comment: http://stackoverflow.com/comment/34455631
has comment: http://stackoverflow.com/comment/34456024
has comment: http://stackoverflow.com/comment/34456036
has answer: http://stackoverflow.com/a/22625770
answer count: 1
has comment: http://stackoverflow.com/comment/34599442
tagged with: c3p0
favorite count: 0

http://stackoverflow.com/q/22537795
has answer: http://stackoverflow.com/a/22538008
score: 6
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/22538653
has title: Error: Could not find or load main class com.google.gwt.dev.Compiler while compiling a GWT project
tagged with: java
accepted answer: http://stackoverflow.com/a/22539247
tagged with: eclipse
has answer: http://stackoverflow.com/a/46969271
has answer: http://stackoverflow.com/a/53892720
has answer: http://stackoverflow.com/a/44536472
downvote count: 0
answer count: 7
has body: Whenever I try to compile any of my GWT application the compilation fails with the error message "Error: Could not find or load main class com.google.gwt.dev.Compiler". This problem started after I made some changes to the path and classpath environment variables while installing Tomcat, I don't know whether these changes caused the problem. I tried to reinstall GWT plugin but all in vain. Any help would be greatly appreciated. I am using Eclipse 4.3 and GWT SDK 2.6.0.
favorite count: 0
has answer: http://stackoverflow.com/a/37181256
upvote count: 6
has answer: http://stackoverflow.com/a/22539247
type: AnsweredQuestion
tagged with: compiler-errors
possible better answer: http://stackoverflow.com/a/22538008

classnotfoundexception
tags question: http://stackoverflow.com/q/22571550
tags question: http://stackoverflow.com/q/22527389
type: Tag
tags question: http://stackoverflow.com/q/22617927
tag name: classnotfoundexception
tags question: http://stackoverflow.com/q/22605831

http://stackoverflow.com/comment/34268945
has text: Hi Elliott, Iam quite new to WebDriver and hence wasnt sure whether mine was a good approach. Also these were initial simple tests that I ran. Worried whether i will hit major issues later once i start automating the page based on my initial tests.
comment on: http://stackoverflow.com/q/22516207
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22581671
type: Answer
accepted answer of: http://stackoverflow.com/q/22581348
score: 6
upvote count: 6
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22581348
has body: But say I am storing integers in a node in a Linked-list that is pointing to another node holding a string. First, is it allowable? And second, how would this be ever useful? Yes, it's allowed as long as the list is declared as List&lt;Object&gt; or List&lt;Serializable&gt;, which both String and Integer extend/implement. In this particular case, it wouldn't be very useful. But consider a List&lt;Vehicle&gt;. It could store instances of Car, Bike, Truck or any other kind of Vehicle. what are the most common operations done on a linkedlist? Those that are documented in the javadoc. I would say that adding and iterating are probably the most common. But I haven't make any statistical measurement. If I were to store a million mobile number, would it be efficient to use a linkedlist? It depends on the operation you need to do on the list. If you just need to add at the beginning or the end, it will be O(1). Iterating is not a problem. Finding the index of a phone would be O(n). Accessing at a given index in the list would also be O(n). In general, an ArrayList is much faster than a LinkedList for almost every use-case. The only use-case where a LinkedList is faster is when it always inserts at the biginning, or when it removes/inserts elements while iterating using its Iterator. would this make it harder in NON- auto garbage collection languages like C++/C in terms of memory allocation and free-ing? I'm not experiences enough in those languages to answer, but yes, since you have to manage the memory, it's harder.

http://stackoverflow.com/a/42109541
score: 3
answers question: http://stackoverflow.com/q/22642012
has body: Vote up for Samuel. Though spent one day trying to make it working. The problem was in: String end = "--" + boundary + "--"; Should be: String end = "\r\n--" + boundary + "--";
downvote count: 1
upvote count: 4
type: Answer

http://stackoverflow.com/q/22610400
has comment: http://stackoverflow.com/comment/34432814
favorite count: 0
has comment: http://stackoverflow.com/comment/34427483
type: Question
has comment: http://stackoverflow.com/comment/34430172
has comment: http://stackoverflow.com/comment/34427876
has comment: http://stackoverflow.com/comment/46461371
has comment: http://stackoverflow.com/comment/34446299
has body: I am a little confused. Oracle says Java 8 is highly compatible with Java 7 (backward). But, what possibilities exist that Java 8 program can be run on Java 7 successfully (SE/EE)? If point one was true, Java 8 applications will be deployed and executed on a Java 7 server support? for example, Tomcat 8 or WildFly?
answer count: 6
has answer: http://stackoverflow.com/a/22610560
has answer: http://stackoverflow.com/a/22610595
has answer: http://stackoverflow.com/a/22610424
linked to: http://stackoverflow.com/q/16143684
possible better answer: http://stackoverflow.com/a/22610560
tagged with: java-8
has comment: http://stackoverflow.com/comment/34427603
has answer: http://stackoverflow.com/a/22610476
downvote count: 1
has answer: http://stackoverflow.com/a/22610703
tagged with: backwards-compatibility
has comment: http://stackoverflow.com/comment/34428460
has comment: http://stackoverflow.com/comment/34427915
tagged with: java
has answer: http://stackoverflow.com/a/36273336
linked to: http://stackoverflow.com/q/17756604
accepted answer: http://stackoverflow.com/a/22610424
linked to: http://stackoverflow.com/q/9260448
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/104123588
tagged with: java-server
upvote count: 55
has title: Can program developed with Java 8 be run on Java 7?
score: 54

http://stackoverflow.com/q/22511563
type: UnansweredQuestion
tagged with: java
tagged with: bitmap
tagged with: android-intent
type: Question
tagged with: android-drawable
has answer: http://stackoverflow.com/a/22511899
score: 0
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/34251488
has body: I have passed a ResourceId as an integer from my CreateActivity to my MainActivity with the use of putInt(); I would like to be able to pass a drawable from one activity to another. What should I be looking to do to reference that ResourceId to get the drawable associated with it? or should I look at converting the image to a bitmap, and passing it that way? LOGCAT 03-19 11:59:41.353: E/AndroidRuntime(5566): FATAL EXCEPTION: main 03-19 11:59:41.353: E/AndroidRuntime(5566): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent { cmp=com.example.datetracker/.MainActivity (has extras) }} to activity {com.example.datetracker/com.example.datetracker.MainActivity}: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x12/d=0x0 a=3 r=0x7f090006} MAINACTIVITY public class MainActivity extends FragmentActivity implements OnClickListener { ListView listView; int lastIndex = -1; ArrayList&lt;Event&gt; lstEvents = new ArrayList&lt;Event&gt;(); // detail view TextView tvTitle, tvTime, tvDate; ImageView ivPic; View vw_master; boolean _isBack = true; ImageButton add; String title; String date; String time; int resId; static final int PICK_CONTACT_REQUEST = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // // get detail controls tvTitle = (TextView) findViewById(R.id.textViewTitle); tvDate = (TextView) findViewById(R.id.textViewDate); tvTime = (TextView) findViewById(R.id.textViewTime); ivPic = (ImageView) findViewById(R.id.imageView1); add = (ImageButton) findViewById(R.id.add); add.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.add: Intent intent = new Intent(this, CreateActivity.class); startActivityForResult(intent, 100); break…
has title: Passing ResourceId as an Integer between Activities

http://stackoverflow.com/comment/34229946
comment on: http://stackoverflow.com/a/22498807
has text: but if i give the value x=200 here with range [100,300] the result is 100%. it should be 50% actually..
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/22594631
has comment: http://stackoverflow.com/comment/34400861
answer count: 1
tagged with: textures
has title: Drawing a texture in modern OpenGL with lwjgl
favorite count: 0
has comment: http://stackoverflow.com/comment/34401771
has answer: http://stackoverflow.com/a/22595884
upvote count: 1
has body: Im trying to draw a texture using opengl in java from this tutorial and everything has been working fine until i tried to draw a texture. It just draws a multicolored box, but no texture. Here is my code: package main; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.util.Scanner; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.newdawn.slick.opengl.Texture; import org.newdawn.slick.opengl.TextureLoader; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL15.*; import static org.lwjgl.opengl.GL20.*; import static org.lwjgl.opengl.GL30.*; //OpenGL version: 4.4.0 public class OpenGLTester { final static int SIZE_OF_FLOAT = 4; final int screenWidth = 1000; final int screenHeight = 800; int program; final float[] vertices = { // Position Color Texcoords -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // Top-left 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // Top-right 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // Bottom-right -0.5f, -0.5f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f // Bottom-left }; final byte[] elements = { 0, 1, 2, 2, 3, 0 }; private int vao; private int vbo; private int vertexShader; private int fragmentShader; private int ebo; private FloatBuffer verticiesBuffer; private ByteBuffer indicesBuffer; private Texture texture; public OpenGLTester() { createDisplay(); initOpenGL(); while(!Display.isCloseRequested()) { // Clear the screen to black glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); texture.bind(); glDrawElements(GL_TRIANGLES, indicesBuffer); Display.update(); Display.sync(60); } glDeleteProgram(program); glDeleteShader(vertexShader); glDeleteShader(fragmentShader); glDeleteBuffers(vbo); glDeleteBuffers(ebo); glDeleteVertexArrays(vao); texture.release(); } private void createDisplay() { //make dis…
accepted answer: http://stackoverflow.com/a/22595884
type: AnsweredQuestion
tagged with: opengl
score: 1
tagged with: java
tagged with: lwjgl
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34402141

http://stackoverflow.com/q/22587601
has comment: http://stackoverflow.com/comment/34387233
has comment: http://stackoverflow.com/comment/34387254
has comment: http://stackoverflow.com/comment/34387345
answer count: 1
has answer: http://stackoverflow.com/a/22587686
favorite count: 0
has comment: http://stackoverflow.com/comment/34387209
tagged with: capitalize
has title: How do I create a method that capitalizes the first letter of a string in java?
has comment: http://stackoverflow.com/comment/34387187
has body: what I'm trying to do is write a method that has one argument and returns a new string that capitalises that string and returns in its parameter. this is my code so far: public void input(){ this.printmessage("Dillon", "Francis", "chimes", "chimes from hudson mohawke", "2", "$69.00", "$420.00", "$1337.00"); } public void printmessage(String firstName, String lastname, String product, String company, String number, String retail, String price, String saving){ UI.println("text " + firstName + ","); UI.println(text + " " + product + "s text, text text text text -"); UI.println(" "); } What I want to do is capitalise the product parameter (chimes) and then return into into the printMessage capitalized if it is used at the beginning of a sentence. Will something like this work? public String capitalise(String product){ return Character.toUpperCase(product.charAt(0)) + product.substring(1); } I'm really stuck and would love some help. Thanks. I've tried this String pls = (product + " example"); if ( pls.startsWith(product) ) { product = capitalise(product); } UI.println(pls); but it doesnt print out the capitalised version.
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22587686
has comment: http://stackoverflow.com/comment/34387315
upvote count: 1
linked to: http://stackoverflow.com/q/3904579
tagged with: methods
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34387180
type: AnsweredQuestion
tagged with: cpu-word
has comment: http://stackoverflow.com/comment/34387282
has comment: http://stackoverflow.com/comment/34387306
duplicate of: http://stackoverflow.com/q/3904579

http://stackoverflow.com/comment/34291302
comment on: http://stackoverflow.com/q/22532339
score: 0
has text: sorry for @PeterSmith =)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34405529
type: Comment
comment on: http://stackoverflow.com/a/22596603
has text: @MarkoTopolnik They know their clientel. Nevertheless I do not understand why then we're not supposed to `new Integer(42).plus(new Integer(2))`. We see here on SO that the concept of primitive types is a deep mystery to some Java programmers.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34383326
comment on: http://stackoverflow.com/a/22585179
type: AnswerComment
has text: Actually there is a load of difference between the things datahaki and me suggested and what you have in the question. What you have put in the question is broken.
score: 0
type: Comment

http://stackoverflow.com/comment/34407178
comment on: http://stackoverflow.com/a/22598775
type: AnswerComment
type: Comment
score: 1
has text: You can't possibly get the same error, unless you tried `setName = reader.readLine()` not `setName(reader.readLine())`, i.e. calling it as a method. This is the Java 'property' convention: rather than directly read or write member fields you call getXXX or setXXX. The getters and setters are methods to call, not variables.

http://stackoverflow.com/comment/34387071
has text: This is your code, so you're free to change the constructor, right? I don't see a better way to solve your problem than the solution I posted. The bottom line with Java enums is that each member (such as `one` in your example) is a full-blown object on its own.
type: Comment
comment on: http://stackoverflow.com/a/22587517
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34397137
type: Comment
has text: Are you sure your code's latest version is compiled ? The stack trace doesn't make a lot of sense given the code you're showing.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22592491

http://stackoverflow.com/q/22633538
answer count: 2
has answer: http://stackoverflow.com/a/49103401
has answer: http://stackoverflow.com/a/22633908
score: 0
type: UnansweredQuestion
type: Question
tagged with: spring-mvc
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have the following controller in springmvc. import java.text.DateFormat; import java.util.Date; import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * Handles requests for the application home page. */ @Controller public class HomeController { private static final Logger logger = LoggerFactory.getLogger(HomeController.class); /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! the client locale is "+ locale.toString()); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate ); return "main"; } } getting following error when i request to http://localhost:8080/Woodcutter/ url
has title: springmvc using json response error

a-star
tags question: http://stackoverflow.com/q/22590572
type: Tag
tag name: a-star

http://stackoverflow.com/a/22522057
upvote count: 1
has body: Here is an easy example to make you understand SORITNG OF OBJECTS : public class Employee implements Comparable { String eid; String ename; int esal; public Employee(String eid, String ename, int esal) { super(); this.eid = eid; this.ename = ename; this.esal = esal; } public String getEid() { return eid; } public String getEname() { return ename; } public int getEsal() { return esal; } @Override public int compareTo(Object o) { Employee obj=(Employee)o; if (this.getEsal() &lt; obj.getEsal()){ return -1; }else if (this.getEsal() &gt; obj.getEsal()){ return 1; }else return 0; } } Now lets sort Employees as per Salary: import java.util.Collections; public class MainClass { public static void main(String[] args){ ArrayList&lt;Employee&gt; al=new ArrayList&lt;Employee&gt;(); Employee obj=new Employee("e01", "Shan", 222); Employee obj1=new Employee("e02", "viv", 600); Employee obj2=new Employee("e00", "arun", 100); al.add(obj); al.add(obj1); al.add(obj2); Collections.sort(al); Iterator i=al.iterator(); while(i.hasNext()){ Employee o1=(Employee)i.next(); System.out.println("Sal: "+o1.getEsal()); } } } It will give you output: Sal: 100 Sal: 222 Sal: 600 I hope now you get the logic behind comparable.If suppose you need to reverse the pattern of sorting then simply modify as below @Override public int compareTo(Object o) { Employee obj=(Employee)o; if (this.getEsal() &gt; obj.getEsal()){ return -1; }else if (this.getEsal() &lt; obj.getEsal()){ return 1; }else return 0; } and new Output will be: Sal: 600 Sal: 222 Sal: 100
answers question: http://stackoverflow.com/q/22521588
accepted answer of: http://stackoverflow.com/q/22521588
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34272094
type: Answer
score: 1

http://stackoverflow.com/comment/34398355
type: Comment
comment on: http://stackoverflow.com/q/22593866
score: 0
has text: If you can build a tree out of your input and then do a postfix traversal, that should do the trick.
type: QuestionComment

http://stackoverflow.com/comment/34434090
score: 0
type: QuestionComment
has text: i was controled by other goole code so i can;t create new class like that cos it too complicated
comment on: http://stackoverflow.com/q/22613691
type: Comment

http://stackoverflow.com/comment/34730693
comment on: http://stackoverflow.com/a/22601071
score: 0
type: AnswerComment
type: Comment
has text: Hi Mark. You're correct about canonical answer. I just don't think it's useful to focus on this aspect too much. Questions like this one are best answered by listing all important design alternatives, so you can pick the optimal trade-off. Without the best alternative in the mix the trade-off will always be net-negative. Therefore I think the question is compatible with the spirit of the bounty (while not with the letter as you noticed).

http://stackoverflow.com/a/22645270
score: 0
type: AcceptedAnswer
has body: I do not know what exacly you use, but I bet you have nine (Image)Views in a Layout and registered all their touchevents to one listener. The effect you describe would happen if you do so, because touch events are in the subcoordinate system of the touched view. You can lay a transparent View above everything and use the touch events arriving there. Then it would work. Or you draw everything in one view.
type: Answer
has comment: http://stackoverflow.com/comment/34500763
accepted answer of: http://stackoverflow.com/q/22643978
answers question: http://stackoverflow.com/q/22643978

http://stackoverflow.com/q/22491931
has answer: http://stackoverflow.com/a/22491948
possible better answer: http://stackoverflow.com/a/22492014
has answer: http://stackoverflow.com/a/22491955
answer count: 4
has answer: http://stackoverflow.com/a/22548212
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34218392
has answer: http://stackoverflow.com/a/22492014
type: Question
accepted answer: http://stackoverflow.com/a/22491948
has title: Replacing old list with new list java
tagged with: arraylist
has body: so basically right now I have a list, in order to remove invalid items from the list I'm looping through it and saving all valid items to a new list. After the loop is done I want to set the old list equal to the new list. I'm just wondering, if I go list = newList; will list now be a pointer to newList? Or will I have 2 completely independent lists now. Thanks
score: 0

http://stackoverflow.com/comment/34456933
type: Comment
comment on: http://stackoverflow.com/a/22626469
score: 0
type: AnswerComment
has text: Oh! I am sorry, I didn't realize that. Although the process will remain same, I will post the correct sample code. Thanks for pointing it out.

http://stackoverflow.com/comment/34251961
score: 0
type: AnswerComment
has text: That's an interesting analogy.
type: Comment
comment on: http://stackoverflow.com/a/22511814

http://stackoverflow.com/comment/34407446
comment on: http://stackoverflow.com/a/22598531
type: Comment
has text: thank you! as to my last comment - this was because i stupidly put the println statement right after rowCount and before the bracket.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34429388
type: Comment
comment on: http://stackoverflow.com/a/22610143
score: 0
type: AnswerComment
has text: Thank you so much for your clear answer and source code. It matches what I want.

http://stackoverflow.com/comment/34479165
comment on: http://stackoverflow.com/q/22638991
score: 0
has text: Look at your question. There is a small `edit` button. Click it and edit the content of your question.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22566755
tagged with: android
type: UnansweredQuestion
tagged with: java
tagged with: image-processing
type: Question
tagged with: opencv
score: -1
downvote count: 2
upvote count: 1
answer count: 1
has body: I want to build an android app to read the pixels of a circular area in an image, any circular area.Can anyone suggest what is the best algorithm i should follow?
favorite count: 0
has title: Android app to read pixels of circular ROI
linked to: http://stackoverflow.com/q/9445102
has answer: http://stackoverflow.com/a/22567501

http://stackoverflow.com/comment/34370323
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22578554
has text: The interface should have little to do with this. I'm not sure how this question can be answered without code. I suggest that you try to produce a small program with similar code that we can run, compile and test, and try to debug that reproduces your problem, a [minimal example program](http://stackoverflow.com/help/mcve).

http://stackoverflow.com/a/22619523
has body: notifyAll (or its native equivalent) is called in ensure_join in src/share/vm/runtime/thread.cpp, at line 1526 in the current version, which is called from JavaThread::exit in the same file.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/22495652
score: 6
answers question: http://stackoverflow.com/q/22495652

http://stackoverflow.com/q/22613314
answer count: 1
has answer: http://stackoverflow.com/a/22613472
linked to: http://stackoverflow.com/q/2090033
type: UnansweredQuestion
has body: Here is 2 working example doing same purpose: Retrieving FAQ results which are global to the application. We fetch results according to the input value and update the datatable. First one use a RequestScoped and bean bindng. The second one use an ApplicationScoped bean and view binding. Example 1 : xhtml &lt;h:inputText id="faqSearch" value="#{faqBean.filter}"/&gt; &lt;h:commandButton value="submit" ajax="true" update="faqResults"/&gt; &lt;h:dataTable id="faqResults" value="#{faqBean.retrieveResults()}" var="result"&gt; &lt;h:column&gt;${result}&lt;/h:column&gt; &lt;/h:dataTable&gt; Bean @RequestScoped @ManagedBean public class FaqBean { String filter; public String getFilter(){ return filter; } public void setFilter(String filter){ this.filter = filter; } public List&lt;String&gt; retrieveResults(){ //compute result from a backend service based on filter return doSomething(filter); } Example 2 : xhtml &lt;h:inputText id="faqSearch" binding="#{filter}"/&gt; &lt;h:commandButton value="submit" ajax="true" update="faqResults"/&gt; &lt;h:dataTable id="faqResults" value="#{faqBean.retrieveResults(filter.value)}" var="result"&gt; &lt;h:column&gt;${result}&lt;/h:column&gt; &lt;/h:dataTable&gt; Bean @ApplicationScoped @ManagedBean public class FaqBean { public List&lt;String&gt; retriveResults(String filter){ //Compute result from a backend service based on filter return doSomething(filter); } So 1 seems the good way to go with jsf. But 2 seems a better solution for me cause it doesn't create/destroy a bean at each execution, bean is static to the application. But with this way of thinking we could kinda get rid of all requestscoped bean so it doesn't feel right. Maybe this solution is worse than the first one, I don't know how all this is managed. So what's the better way to go ?
tagged with: managed-bean
has title: View binding & ApplicationScoped bean vs RequestScoped bean
tagged with: jsf
tagged with: java
type: Question
tagged with: jsf-2.2
score: 0

http://stackoverflow.com/a/22503236
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22495634
answers question: http://stackoverflow.com/q/22495634
upvote count: 3
score: 3
has body: Convert java application to jsp/servlet Depending on what kind of program it is, it could be as easy as taking the class that has the main() method in it, making it a subclass of HttpServlet and taking everything that's in the main() method and putting it in the doGet() method of the servlet. Then you'd replace all the System.out.println() statements with statements to print the output in HTML. This would work if it's just a command line program without a GUI (Graphical User Interface). If your program has no GUI then you can stop reading here. If it does have a GUI, then it could be a lot more complicated. Depending on what kind of program it is, you could do one of the following: 1. Put the whole thing in an Applet. This is pretty simple. Instead of replacing a few lines to turn the program into a Servlet, you'd be replacing a few lines to turn it into an Applet. This you could do if you don't need the server to communicate with, like if you had a solitare game. Otherwise, you could do #2. 2. Put the GUI in an Applet and keep the back end on the server. This is what you'd call a "client/server" application. 3. Create a JSP/Servlet based website. The most complicated option, but if you don't want to use Applets this is the only way to go.Here you're changing from a Java based GUI to an HTML/CSS based GUI. You might also need some JavaScript. If you're not familiar with all this stuff, but you're comfortable making Java GUI's using things like Swing, you might want to check out GWT (Google Web Toolkit). This allows you to make rich websites using plain Java. The Java code "compiles" into HTML and Javascript. Another one: It's done at runtime, when the JSP is invoked for the first time. Some web servers also come with a JSP compiler allowing to do that at build time, which has two advantages : It allows detecting JSP syntax errors at build time rather than runtime. It avoids the first invocation time penalty (it takes some time compiling JSP to Java and then Java to …

http://stackoverflow.com/comment/34238180
score: 0
comment on: http://stackoverflow.com/q/22503556
has text: Please create an issue with a cpu snapshot, so they can fix it.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34355020
comment on: http://stackoverflow.com/q/22568993
score: 0
has text: Basic debugging could have solved this problem in a few seconds. I suggest you learn how to use a debugger; your IDE (you are using one, right?) should come with one equipped and google will show you how to use it. Although in this case, adding a few print statements would have probably been enough...
type: Comment
type: QuestionComment

if-statement
tags question: http://stackoverflow.com/q/22523532
tag name: if-statement
type: Tag
tags question: http://stackoverflow.com/q/22586520
tags question: http://stackoverflow.com/q/22600217
tags question: http://stackoverflow.com/q/22599410
tags question: http://stackoverflow.com/q/22619314
tags question: http://stackoverflow.com/q/22503714
tags question: http://stackoverflow.com/q/22576166
tags question: http://stackoverflow.com/q/22634636
tags question: http://stackoverflow.com/q/22588710
tags question: http://stackoverflow.com/q/22591162
tags question: http://stackoverflow.com/q/22642326
tags question: http://stackoverflow.com/q/22601098
tags question: http://stackoverflow.com/q/22615864
tags question: http://stackoverflow.com/q/22633271
tags question: http://stackoverflow.com/q/22625821
tags question: http://stackoverflow.com/q/22493246
tags question: http://stackoverflow.com/q/22537833
tags question: http://stackoverflow.com/q/22541747
tags question: http://stackoverflow.com/q/22629884
tags question: http://stackoverflow.com/q/22638229
tags question: http://stackoverflow.com/q/22590061
tags question: http://stackoverflow.com/q/22530897
tags question: http://stackoverflow.com/q/22622332
tags question: http://stackoverflow.com/q/22611623

http://stackoverflow.com/comment/34242631
type: Comment
has text: Definitely there is. ANd those are the layout managers which act as a container in which all the components reside. So you will have to choose a suitable container to suit your need. Its not that difficult. Try them and you will be glad to see the end result and many more things you can do using LayoutManagers. :)
comment on: http://stackoverflow.com/a/22506449
type: AnswerComment
score: 0

http://stackoverflow.com/a/22564128
has body: You are using indices outside the bouds of the array. Array's indexes in java go from zero to length of the array minus one. To avoid this kind iof problems you could loop on the size of the array buttons.length-1 and buttons[i].length-1 for(int i=buttons.length-1;i&gt;=0;i--){ for(int j=buttons[i].length;j&gt;=0;j--){ buttons[i][j] = new XOButton(); // if((i + j) % 2 != 0){ buttons[i][j].setText(i + "," +j); // } p.add(buttons[i][j]); } }
type: Answer
answers question: http://stackoverflow.com/q/22563973
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/34481987
comment on: http://stackoverflow.com/q/22640511
score: 0
type: Comment
type: QuestionComment
has text: Could you please help me with a function for this in c++. In not good at c++ but need this part of code.

http://stackoverflow.com/comment/34417217
has text: I added the error message above
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22563609

mockito
tags question: http://stackoverflow.com/q/22625188
tags question: http://stackoverflow.com/q/22619716
tags question: http://stackoverflow.com/q/22604497
tags question: http://stackoverflow.com/q/22620664
tags question: http://stackoverflow.com/q/22540108
tags question: http://stackoverflow.com/q/22497349
tags question: http://stackoverflow.com/q/22507299
tag name: mockito
tags question: http://stackoverflow.com/q/22643364
tags question: http://stackoverflow.com/q/22638583
tags question: http://stackoverflow.com/q/22592812
tags question: http://stackoverflow.com/q/22491326
tags question: http://stackoverflow.com/q/22505567
tags question: http://stackoverflow.com/q/22507447
type: Tag
tags question: http://stackoverflow.com/q/22554470
tags question: http://stackoverflow.com/q/22524055
tags question: http://stackoverflow.com/q/22563208
tags question: http://stackoverflow.com/q/22517127
tags question: http://stackoverflow.com/q/22616450
tags question: http://stackoverflow.com/q/22594960
tags question: http://stackoverflow.com/q/22610503

http://stackoverflow.com/q/22519346
linked to: http://stackoverflow.com/q/1387027
has answer: http://stackoverflow.com/a/44468124
has comment: http://stackoverflow.com/comment/34266549
score: 12
possible better answer: http://stackoverflow.com/a/29084734
answer count: 7
has comment: http://stackoverflow.com/comment/34266203
has answer: http://stackoverflow.com/a/22519929
has comment: http://stackoverflow.com/comment/34267018
accepted answer: http://stackoverflow.com/a/22519929
favorite count: 0
has answer: http://stackoverflow.com/a/22519382
has answer: http://stackoverflow.com/a/22520934
has comment: http://stackoverflow.com/comment/34266487
upvote count: 13
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34267039
tagged with: java
has answer: http://stackoverflow.com/a/25882726
has title: How to split a byte array around a byte sequence in Java?
has answer: http://stackoverflow.com/a/29084734
downvote count: 1
has body: How to split a byte[] around a byte sequence in Java? Something like the byte[] version of String#split(regex). Example Let's take this byte array: [11 11 FF FF 22 22 22 FF FF 33 33 33 33] and let's choose the delimiter to be [FF FF] Then the split will result in these three parts: [11 11] [22 22 22] [33 33 33 33] EDIT: Please note that you cannot convert the byte[] to String, then split it, then back because of encoding issues. When you do such conversion on byte arrays, the resulting byte[] will be different. Please refer to this: Conversion of byte[] into a String and then back to a byte[]
type: Question
linked to: http://stackoverflow.com/q/2758654
has comment: http://stackoverflow.com/comment/34267225
has answer: http://stackoverflow.com/a/65314440

google-api
tags question: http://stackoverflow.com/q/22522407
tags question: http://stackoverflow.com/q/22590255
tags question: http://stackoverflow.com/q/22507927
tag name: google-api
tags question: http://stackoverflow.com/q/22538625
tags question: http://stackoverflow.com/q/22516693
tags question: http://stackoverflow.com/q/22612352
type: Tag

http://stackoverflow.com/comment/34241676
score: 0
type: Comment
type: AnswerComment
has text: Heh, Windows has notoriously bad UTF-8 support; Notepad and Excel among others expect a BOM in order to read UTF-8.
comment on: http://stackoverflow.com/a/22505220

http://stackoverflow.com/q/22560687
tagged with: java
has answer: http://stackoverflow.com/a/22565372
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/22565372
answer count: 1
has body: Option Menu show incorrectly on Custom Style map The problem raised on an application in android I have a custom theme on my app. The problem is that the option menu shows incorrectly ,so the option menu shows cut of on the screen. I wondering why could happen? This is my style file xml
tagged with: android
tagged with: android-manifest
tagged with: styles
has title: Option Menu show incorrectly on Custom Style map
type: AnsweredQuestion

http://stackoverflow.com/comment/34252995
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22512116
has text: Is using Guava or Java 8 an option here? Because it is pretty easy with MultiSet or a combination of lambdas to achieve this. What you have to do is to take a majority vote on a bag of characters which is similar to [this question](http://stackoverflow.com/questions/1852631/determine-the-most-common-occurance-in-an-array) about a majority vote on integers.

http://stackoverflow.com/comment/78788320
type: Comment
score: 2
has text: Works great, this should be the accepted answer as of IntelliJ 2017.2 !
type: AnswerComment
comment on: http://stackoverflow.com/a/45914842

http://stackoverflow.com/q/22628397
type: Question
tagged with: tomcat
has comment: http://stackoverflow.com/comment/34505585
has comment: http://stackoverflow.com/comment/34695039
score: 0
has comment: http://stackoverflow.com/comment/34462302
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34712127
has comment: http://stackoverflow.com/comment/34694053
has body: Connections does not returned to the pool, the size of the connection pool increases more than the maxSize. I am using the DB2 9.1 and 9.5 both and Tomcat 7.0.47. I am setting maxSize = "30" but when I see the database connection log it shows connection more than 30 and it increases to 100 and after that database gets locked. I am using Applet, Servlet & Javabeans (for business logic). I have configure the Tomcat by changing the web.xml, context.xml and server.xml (which are at the conf directry of the server). The configurations are as follows web.xml DB2 Datasource example jdbc/datasourcename javax.sql.DataSource Container context.xml <ResourceLink name="jdbc/datasourcename" global="jdbc/datasourcename" type="javax.sql.DataSource" /> server.xml <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> <Resource name="jdbc/datasourcename" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" testWhileIdle="true" testOnBorrow="true" testOnReturn="false" validationQuery="SELECT 1" validationInterval="30000" timeBetweenEvictionRunsMillis="30000" maxActive="30" minIdle="1" maxWait="10000" initialSize="1" removeAbandonedTimeout="60" logAbandoned="true" removeAbandoned="true" closeMethod="close" abandonWhenPercentageFull="60" minEvictableIdleTimeMillis="3000" jmxEnabled="true" jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer" alternateUsernameAllowed="true" username="user" password="pass" driverClassName="com.ibm.db2.jcc.DB2Driver" url="jdbc:db2:://127.0.0.1:50000/DBname" /> The code where I use some connections and closing it. public Vector getCargo() throws SQLException { PreparedStatement ps = null; ResultSet rs = null; int rec = 0; Vector v = new Vector(); …
answer count: 0
has title: Connections does not returned to pool.I am using DB2 9.1 & DB2 9.5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34695264
tagged with: java
has comment: http://stackoverflow.com/comment/34693907
has comment: http://stackoverflow.com/comment/34461056

http://stackoverflow.com/comment/34413663
score: 3
has text: How is `run()` called? Are there multiple threads? Why do you use `&` instead of `&&`? It shouldn't cause any problems but it is interesting.
type: Comment
comment on: http://stackoverflow.com/q/22602432
type: QuestionComment

http://stackoverflow.com/q/22630210
tagged with: neo4j
has answer: http://stackoverflow.com/a/27444336
tagged with: spring-data-neo4j
upvote count: 3
type: UnansweredQuestion
tagged with: spring-data
score: 3
has title: Unable to map repositories
tagged with: java
type: Question
downvote count: 0
answer count: 1
has body: I'm using the advanced mapping mode in Spring Data Neo4j. When I try to expose my repositories with Spring data REST, I'm getting the exception messages below. Check out my GitHub project. Mapped "{[/{repository}/{id}/{property}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/x-spring-data-compact+json || text/uri-list],custom=[]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.followPropertyReferenceCompact(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,java.lang.String) throws java.lang.Exception Mapped "{[/{repository}/{id}/{property}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.followPropertyReference(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,java.lang.String) throws java.lang.Exception Mapped "{[/{repository}/{id}/{property}/{propertyId}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.followPropertyReference(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,java.lang.String,java.lang.String) throws java.lang.Exception Mapped "{[/{repository}/{id}/{property}],methods=[DELETE],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<? extends org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.deletePropertyReference(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,java.lang.S…
favorite count: 0
tagged with: spring-data-rest

liferay
tags question: http://stackoverflow.com/q/22557897
tag name: liferay
tags question: http://stackoverflow.com/q/22619794
type: Tag
tags question: http://stackoverflow.com/q/22557207
tags question: http://stackoverflow.com/q/22613748

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/22501975
type: Tag

http://stackoverflow.com/comment/34387958
type: Comment
type: QuestionComment
has text: @MadProgrammer thanks for ur guidness i have mentioned "db.properties" after that it works..
score: 0
comment on: http://stackoverflow.com/q/22587938

http://stackoverflow.com/q/22579250
accepted answer: http://stackoverflow.com/a/22579346
has comment: http://stackoverflow.com/comment/34371815
answer count: 1
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/34371564
has comment: http://stackoverflow.com/comment/34371878
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34371718
tagged with: swing
has body: What I have: A split panel with a scroll panel in the right part. In this scroll panel, I have a JPanel. I want to have in this JPanel a series of others JPanels stacked one under the other one. I set the Layout to be a BoxLayout. Now it stacks multiple JPanels, but I have 2 problems: If my content from JPanel take less space then my frame, then will be lot of space between Jpanels. If my content from JPanel it's bigger then my frame, the Pannels will go over each other and my scroll from scrollPanel wont activate. frame = new Frame(); splitPane = new SplitPane(); scrollPane = new ScrollPane(); frame.add(splitPane); scrollPane.setViewportView(new Lesson()); splitPane.setRightComponent(scrollPane); splitPane.setLeftComponent(new JTree()); Where Frame, SplitPane, ScrollPane() are classes that extends JFrame, JSplitPane, JScrollPane. Atm they only have a constructor, after it will work, I want to make some customization there. public class Lesson extends JPanel { private static final long serialVersionUID = 1L; public Lesson() { customize(); String text = "text from pictures"; add(new Paragraph(text)); add(new Paragraph(text)); } private void customize() { BoxLayout boxLayout = new BoxLayout(this, BoxLayout.PAGE_AXIS); setLayout(boxLayout); } } public class Paragraph extends JPanel { private static final long serialVersionUID = 1L; public Paragraph(String text) { setLayout(new FlowLayout(FlowLayout.LEFT)); setPreferredSize(new Dimension()); StringTokenizer splitStringTokenizer = new StringTokenizer(text, " "); while(splitStringTokenizer.hasMoreTokens()){ add(label(splitStringTokenizer.nextToken().toString())); } } private JLabel label(String string){ JLabel jlabel= new JLabel(string); return jlabel; } } Any hints about how I can resolve this ? Ty in advance.
type: Question
tagged with: layout
tagged with: jpanel
has title: JScrollPanel JPanel and Layouts
score: 0
has answer: http://stackoverflow.com/a/22579346

http://stackoverflow.com/q/22575096
score: 0
has answer: http://stackoverflow.com/a/22575309
answer count: 1
has body: The following code is the common way of establishing a connection to create an array of certificates by given a URL link (that I use it in my program): URL destinationURL = new URL("https://www.google.com"); HttpsURLConnection con = (HttpsURLConnection) destinationURL.openConnection(); con.connect(); Certificate[] certs = con.getServerCertificates(); My question is how con.getServerCertificates() really imports all the certificates chanining into Java from given a URL link, does con.getServerCertificates() always set a SSL connection to the webpage and import all the certificates chaining into an array OR does it just use (cacerts file) that comes with JKD ?
type: UnansweredQuestion
tagged with: x509certificate
has title: How certificates are really imported in JAVA?
tagged with: java
type: Question
tagged with: ssl

http://stackoverflow.com/comment/34460622
type: AnswerComment
type: Comment
score: 0
has text: Also, if I depend on an `android-library` project from a plain old Java project, will I have to make a new configuration to avoid importing the `AAR` file into my classpath?
comment on: http://stackoverflow.com/a/22627677

neo4j
tags question: http://stackoverflow.com/q/22637914
tags question: http://stackoverflow.com/q/22552727
tags question: http://stackoverflow.com/q/22626137
tags question: http://stackoverflow.com/q/22585460
tags question: http://stackoverflow.com/q/22642851
tag name: neo4j
tags question: http://stackoverflow.com/q/22630210
tags question: http://stackoverflow.com/q/22618102
tags question: http://stackoverflow.com/q/22552357
tags question: http://stackoverflow.com/q/22554960
tags question: http://stackoverflow.com/q/22621789
tags question: http://stackoverflow.com/q/22499345
tags question: http://stackoverflow.com/q/22600013
tags question: http://stackoverflow.com/q/22610561
tags question: http://stackoverflow.com/q/22626824
tags question: http://stackoverflow.com/q/22541820
tags question: http://stackoverflow.com/q/22526396
type: Tag
tags question: http://stackoverflow.com/q/22600920
tags question: http://stackoverflow.com/q/22501402
tags question: http://stackoverflow.com/q/22618532
tags question: http://stackoverflow.com/q/22510623

http://stackoverflow.com/q/22501377
has body: I have a test with the use of REST-assured. In this test when I pass full host and path to get() method, everything goes fine, test passes. But when I try to use RestAssured.baseURI and RestAssured.basePath like it's shown in this part of the tutorial: http://code.google.com/p/rest-assured/wiki/Usage#Default_values, test ends up with Connection reset. Below I paste working version and version with baseURI which doesn't work, and the error I get. Help please :> Working version: import com.jayway.restassured.RestAssured; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import java.util.Iterator; import static com.jayway.restassured.RestAssured.basic; import static com.jayway.restassured.RestAssured.given; import static org.hamcrest.Matchers.containsString; public class SomeTest { @Test(dataProvider = "provideData") public void doSomeTest(String someParameter, String someExpectedValue) { given(). auth().basic("login", "pass"). param("someParameter", someParameter). when(). get("http://some.host/some-base-path/some-path-relevant-in-test"). then(). statusCode(200). body("some json", containsString(someExpectedValue)). log().ifError(); } @DataProvider(name = "provideData") public Iterator&lt;Object[]&gt; provideData() { //this provides data for test method in irrelevant way } } Not working version which results in Connection reset: import com.jayway.restassured.RestAssured; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import java.util.Iterator; import static com.jayway.restassured.RestAssured.basic; import static com.jayway.restassured.RestAssured.given; import static org.hamcrest.Matchers.containsString; public class SomeTest { @Test(dataProvider = "provideData") public void doSomeTest(String someParameter, String someExpectedValue) { RestAssured.baseURI = "http://some.host"; RestAssured.basePath = "/some-base-path"; given(). auth().basic("login", "pass"). param("someParameter", someParameter). when(). get…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/39617044
has answer: http://stackoverflow.com/a/22542537
tagged with: java
has title: Connection reset in test using REST-assured
has comment: http://stackoverflow.com/comment/71870086
type: Question
upvote count: 4
answer count: 2
score: 4
tagged with: rest
tagged with: rest-assured
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/34294351
type: Comment
comment on: http://stackoverflow.com/a/22534722
score: 0
type: AnswerComment
has text: @ChandraSekhar I added a section at the end explaining why your code doesn't work.

http://stackoverflow.com/comment/34373827
type: AnswerComment
type: Comment
has text: Perfect, please chose like selected answer
comment on: http://stackoverflow.com/a/22579780
score: 0

http://stackoverflow.com/a/22616906
answers question: http://stackoverflow.com/q/22616825
score: 0
has comment: http://stackoverflow.com/comment/34439445
has body: That's not how do-while loops work in Java. I'd recommend sticking with a while loop since your initial pass is a little different from each subsequent one. System.out.println("Please enter a floor which is less than 8"); current_Floor = in.nextInt(); while (current_Floor &gt; MAX_FLOORS) { System.out.println("\nPlease enter the floor you are on: "); current_Floor = in.nextInt(); } Here you prompt the user for an input. If it's invalid, you enter the loop where you display the error message and prompt them again. This will continue until the user behaves.
type: Answer

http://stackoverflow.com/a/22640087
has comment: http://stackoverflow.com/comment/34564767
type: Answer
answers question: http://stackoverflow.com/q/22639543
has body: Take a look at don't repeat yourself (DRY) principle which was designed to prevent situations like yours. Instead of renaming variables create separate method which will accept any Rectangle and print its details. public static void printRectangleDetails(Rectangle r){ System.out.println("Rectangle 1: " + "\n" + "Width: " + r.width + "\n" + "Height: " + r.height + "\n" + "Color: " + r.color + "\n" + "Area and Perimeter: " + r.getArea(r.width, r.height) + ", " + r.getPerimeter(r.width, r.height)); } Now you can use it with your r1 and r2 rectangles when needed printRectangleDetails(r1); ... printRectangleDetails(r2); If for some reason where you can't create separate method and use DRY principle you can do something like this: lets say we have String foo = "foo"; System.out.println(foo+" hello wordls"+ foo); String bar = "bar"; System.out.println(foo+" hello wordls"+ foo); and you want to replace foo in second print statement to bar. Using Alt + Shift + R (or from menu: Refactor -> Rename..) on second printing statement would rename all foo references . To prevent it redeclare your foo reference (compiler will give you error, but don't worry, we will later remove it, it is helpful only while renaming process) just before statements from which you want to change foo to bar like String foo = "foo"; System.out.println(foo+" hello wordls"+ foo); String bar = "bar"; String foo = "whatever"; // ^^^ System.out.println(foo+" hello wordls"+ foo); Now use Alt + Shift + R on this new duplicate foo and eclipse will look for foo from this new reference, and ignore earlier foos, so you should be able to see something like (as you can see first two foo are not selected for renaming) so you can change it to bar like String foo = "foo"; System.out.println(foo+" hello wordls"+ foo); String bar = "bar"; String bar = "whatever"; System.out.println(bar+" hello wordls"+ bar); and after that just removed this additional String bar = "whatever"; since you don't need it any more. BUT BE CAREF…
has comment: http://stackoverflow.com/comment/34503719
downvote count: 1
accepted answer of: http://stackoverflow.com/q/22639543
has comment: http://stackoverflow.com/comment/34480724
has comment: http://stackoverflow.com/comment/34551018
has comment: http://stackoverflow.com/comment/34564711
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/34519951
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34481068
has comment: http://stackoverflow.com/comment/34518413

http://stackoverflow.com/a/36542691
score: 0
type: Answer
has body: My issue was actually related to having duplicate files. Well not really duplicates, but I had 2 adMob sdk packages (different versions), that were getting into conflict. After deleting the older one, everything was fixed. Are you using any 3rd party SDK's or something similar, if so, try removing them if possible and see if the issue persists. Try to find out which part of the code is causing this to happen. You could ultimately try to compile an empty project just for testing.
answers question: http://stackoverflow.com/q/22542330

http://stackoverflow.com/comment/34281744
comment on: http://stackoverflow.com/q/22525023
type: Comment
type: QuestionComment
has text: I solved it.There was Problem in the location of .keystore file.
score: 0

http://stackoverflow.com/comment/34613508
has text: I think that is optional
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22708181

http://stackoverflow.com/q/22543701
has comment: http://stackoverflow.com/comment/34310141
score: 0
has comment: http://stackoverflow.com/comment/34309467
has comment: http://stackoverflow.com/comment/34309347
has comment: http://stackoverflow.com/comment/34309270
has body: I am decomposing a series of 90,000+ strings into a discrete list of the individual, non-duplicated pairs of words that are included in the strings with the rxcui id values associated with each string. I have developed a method which tries to accomplish this, but it is producing a lot of redundancy. Analysis of the data shows there are about 12,000 unique words in the 90,000+ source strings, after I clean and format the contents of the strings. How can I change the code below so that it avoids creating the redundant rows in the destination 2D ArrayList (shown below the code)? public static ArrayList<ArrayList<String>> getAllWords(String[] tempsArray){//int count = tempsArray.length; int fieldslenlessthan2 = 0;//ArrayList<String> outputarr = new ArrayList<String>(); ArrayList<ArrayList<String>> twoDimArrayList= new ArrayList<ArrayList<String>>(); int idx = 0; for (String s : tempsArray) { String[] fields = s.split("\t");//System.out.println(" --- fields.length is: "+fields.length); if(fields.length>1){ ArrayList<String> row = new ArrayList<String>(); System.out.println("fields[0] is: "+fields[0]); String cleanedTerms = cleanTerms(fields[1]); String[] words = cleanedTerms.split(" "); for(int j=0;j<words.length;j++){ String word=words[j].trim(); word = word.toLowerCase(); if(isValidWord(word)){//outputarr.add(word); System.out.println("words["+j+"] is: "+word); row.add(word_id);//WORD_ID NEEDS TO BE CREATED BY SOME METHOD. row.add(fields[0]); row.add(word); twoDimArrayList.add(row); idx += 1; } } }else{fieldslenlessthan2 += 1;} } System.out.println("........... fieldslenlessthan2 is: "+fieldslenlessthan2); return twoDimArrayList; } The output of the above method currently looks like the following, with many rxcui values for some name values, and with many name values for some rxcui: How do I change the code above so that the output is a list of unique pairs of name/rxcui values, summarizing all relevant data from the current output while removing only the redundancies?
has title: separating unique values in an algorithm
accepted answer: http://stackoverflow.com/a/22543967
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22544199
has answer: http://stackoverflow.com/a/22544199
has answer: http://stackoverflow.com/a/22543967

http://stackoverflow.com/a/22607964
has comment: http://stackoverflow.com/comment/34423242
type: Answer
has body: How you store the information depends very much on what it is intended to be used for. There are a few approaches you might take: private static final This is a good choice if the value will never be modified during the lifetime of the application. It means, when you're creating your multiple instances, you are only actually storing this particular variable ONCE. private final This is meant for those times when the value might take on different values for different instances of your object, but any specific instance will not have it's value modified throughout the object's life time. If you're looking at something which might take on different values over a range of time, then this might be of interest to you. public static int GetNumber(){...} Another approach you might consider is to have a static method return the value you are after. This makes it easy to deal with changes in the value, but you also need to consider the effect of such a change throughout the lifetime of any given instance. Hope that helps...
upvote count: 4
has comment: http://stackoverflow.com/comment/34423308
downvote count: 0
answers question: http://stackoverflow.com/q/22607743
score: 4
has comment: http://stackoverflow.com/comment/34422852

http://stackoverflow.com/comment/107383801
type: AnswerComment
type: Comment
has text: It should be noted that, as specified by its javadoc, `COPY_ATTRIBUTES` is only 'best effort basis'. Except 'modified timestamp', nothing else is guaranteed.
score: 0
comment on: http://stackoverflow.com/a/22616256

http://stackoverflow.com/comment/34386737
type: QuestionComment
comment on: http://stackoverflow.com/q/22587349
score: 1
has text: "It was functioning correctly until I added the for-loop." Huh? The for loop *is* the program...
type: Comment

http://stackoverflow.com/comment/34320290
type: Comment
comment on: http://stackoverflow.com/a/22531520
has text: @Creative_Cimmons Oh really, I was not aware of it. Can you please tell how you solved it?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34320444
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22549930
has text: Yes, the reason I chose array is because if i need to rotate it, I can just change the index of the color.
score: 0

http://stackoverflow.com/comment/34497583
has text: The connection should be running on a separate thread than the `Server` / `Client`'s GUI thread (`MainWindow`). So what will happen is the `Server` receives a message from the `Client` to move the square, then the `Server`'s socket thread will receive the message in a `Socket.receive()` call. The thread running the socket on the Server then sends a message to the GUI thread to update the GUI's display, and afterwards continues listening for more messages.
type: AnswerComment
comment on: http://stackoverflow.com/a/22647130
type: Comment
score: 1

http://stackoverflow.com/a/22567898
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22567752
answers question: http://stackoverflow.com/q/22567752
upvote count: 2
type: AcceptedAnswer
has body: Your tie resolution logic is inverted: instead of comparing surnames for equality upfront, compare them with compareToIgnoreCase first, and check the result for zero. Otherwise, you are effectively doing the comparison twice: int res = this.surname.compareToIgnoreCase(o.surname); return res != 0 ? res : this.initial.compareToIgnoreCase(o.initial); Assuming a small number of ties, this should speed up your comparisons about twofold. In addition, your code has other inefficiencies: for example, it is pointless to null check the result of this.getClass(), because it is never null.

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/22543155
tag name: maven-jaxb2-plugin

http://stackoverflow.com/q/22634360
downvote count: 3
has title: Inserting into Oracle database
has comment: http://stackoverflow.com/comment/34471106
type: Question
has answer: http://stackoverflow.com/a/22688990
has comment: http://stackoverflow.com/comment/34478264
has comment: http://stackoverflow.com/comment/34470058
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/34470037
has answer: http://stackoverflow.com/a/22634434
has comment: http://stackoverflow.com/comment/34478543
has body: I tried everything possible but it's not working. I'm trying to insert records into a database on the server using Datasource it worked for SELECT statement but doesn't work for INSERT statement. Is there anything I need to do apart from this code? Prepared Statement insertCampusian = connection.prepareStatement("INSERT INTO CAMPUSIAN ( CAMPUSIAN_USER_NAME, CAMPUSIAN_FIRST_NAME, " + "CAMPUSIAN_LAST_NAME, CAMPUSIAN_PASSWORD, CAMPUSIAN_PHONE_NO, CAMPUSIAN_EMAIL, CAMPUSIAN_MARITAL_STATUS, " + "CAMPUSIAN_SEX ) VALUES( ?, ?, ?, ?, ?, ?, ?, ? )"); For inserting public boolean register(Campusian campusian) { try { insertCampusian.setString(1, campusian.getUserName()); insertCampusian.setString(2, campusian.getFirstName()); insertCampusian.setString(3, campusian.getLastName()); insertCampusian.setString(4, campusian.getPassword()); insertCampusian.setString(5, campusian.getPhoneNo()); insertCampusian.setString(6, campusian.getEmail()); insertCampusian.setString(7, campusian.getMaritalStatus()); insertCampusian.setString(8, campusian.getSex()); boolean result = insertCampusian.execute(); System.out.println("Is Successful: "+result); if (!result) { //connection.rollback(); return false; } } catch (SQLException ex) { System.out.println("ERROR.. "+ex); Logger.getLogger(CampusianDataBaseBean.class.getName()).log(Level.SEVERE, null, ex); } //connection.commit(); return true; }
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
score: -3
has comment: http://stackoverflow.com/comment/34474993
tagged with: jdbc
has answer: http://stackoverflow.com/a/22634454
tagged with: java

http://stackoverflow.com/q/22540751
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22541227
has answer: http://stackoverflow.com/a/22540885
possible better answer: http://stackoverflow.com/a/22540804
type: Question
has answer: http://stackoverflow.com/a/22540804
has answer: http://stackoverflow.com/a/22541602
has title: Comparing Just the Date (not time)
has body: I need to compare 2 dates to a third date and ignore the time portion of all of them. The code below generates a parse exception because the toString() method returns something like "Wed Feb 26 00:00:00 EST 2014". Any suggestions on how I might fix this? private boolean needToSendEmail(EmSelfCertEntity escd) throws ParseException { boolean sendEmail = false; DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); Date justTheDate = df.parse(escd.getCurrentFCESDate().toString()); Calendar firstSent = Calendar.getInstance(); firstSent.setTime(justTheDate); justTheDate = df.parse(new Date().toString()); Calendar firstFollowUp = Calendar.getInstance(); firstFollowUp.setTime(justTheDate); firstFollowUp.add(Calendar.DATE, -daysToFirstFollowUpEmail); Calendar secondFollowUp = Calendar.getInstance(); secondFollowUp.setTime(justTheDate); secondFollowUp.add(Calendar.DATE, -daysToSecondFollowUpEmail); if ((firstSent.before(firstFollowUp) &amp;&amp; escd.countEmailsSent &lt;= 1) || (firstSent.before(secondFollowUp) &amp;&amp; escd.countEmailsSent &lt;= 2)) { sendEmail = true; } return sendEmail; } Thanks!
score: 0
accepted answer: http://stackoverflow.com/a/22540885
has comment: http://stackoverflow.com/comment/34303846
has comment: http://stackoverflow.com/comment/34304362
tagged with: java

http://stackoverflow.com/comment/37964464
score: 0
comment on: http://stackoverflow.com/q/22521636
type: Comment
type: QuestionComment
has text: I have exactly the same problem right now, it is working as expected when running, but it crashes with this same error message when trying to debug my app. Have you find a solution to this problem ?

http://stackoverflow.com/comment/34294727
type: QuestionComment
has text: I want to set instance of Base class new object depending on what value String parameter holds. Suppose, String data can hold only values that match with the names of derived classes
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22535581

http://stackoverflow.com/comment/34338179
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22544874
has text: Hmmm, you should be able to write the file on-the-fly (in Windows, this tends to manifest as files having "unknown size" in download dialogs). So you'd use a scrollable result-set as normal, etc. However, I'm not sure how to do this (and you might have an easier time writing out a `.csv`, which would be more portable regardless). You might also be able to write the file to the server first using the same technique. Although personally, I'd be more worried about the fact that you're giving somebody such a large portion of your data...

http://stackoverflow.com/a/72378482
has body: I was facing the same issue and the solution was to remove 'mode': 'no-cors' and adding the hostname as an allowed origin at backend server. Setting mode to 'no-cors' will always take "Content-Type" as "text/plain". For more info, visit info
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/22566433
upvote count: 3
has comment: http://stackoverflow.com/comment/130849901
type: Answer

http://stackoverflow.com/comment/34231846
type: Comment
score: 0
has text: Yes. Backslash hell... I am familiar with it :)
type: AnswerComment
comment on: http://stackoverflow.com/a/22499941

http://stackoverflow.com/q/22581102
has answer: http://stackoverflow.com/a/22581143
type: Question
has body: In the code below, the instance variable called "x" inside subclass "B" hides the instance variable also called "x" inside the parent superclass "A". public class A { public int x; } public class B extends A { public int x; } In the code below, why does println(z.x) display the value of zero? Thanks. A a = new A(); B b = new B(); a.x = 1; b.x = 2; A z = b; System.out.println(z.x); // Prints 0, but why?
upvote count: 5
tagged with: java
has title: Instance variable hiding with inheritance
score: 5
accepted answer: http://stackoverflow.com/a/22581143
answer count: 1
downvote count: 0
tagged with: inheritance
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/34364142
has text: Thanks. My list will probably never get above 1000 Holidays so I'm guessing a binary search won't matter, but how many entries do you need before you would start seeing worthwhile performance improvements with a binary search?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22574769

http://stackoverflow.com/comment/34328240
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22554530
has text: A JPanel is just a container, it's not a component, therefore you can't attach an ActionListener to a JPanel.
score: 0

http://stackoverflow.com/a/22600675
has comment: http://stackoverflow.com/comment/34498641
answers question: http://stackoverflow.com/q/22600606
has comment: http://stackoverflow.com/comment/34415255
has comment: http://stackoverflow.com/comment/34498760
score: 0
type: Answer
has body: int is a primitive type and is not an Object so is not a reference that can be null. Read more in this previous answer Then in your code just remove that condition. And also is preferred you use c.isEmpty() rather than c.size()&gt;0 Your code would look like this: if (c != null &amp;&amp; !c.isEmpty()) { return (Application) c.toArray()[0]; }
has comment: http://stackoverflow.com/comment/34443605

http://stackoverflow.com/q/22617892
has answer: http://stackoverflow.com/a/22617943
accepted answer: http://stackoverflow.com/a/22617943
type: Question
answer count: 2
has body: I am trying to check if a long integer is greater than the INTEGER.MAX value but it's not working. It's very straight forward so I am just wondering if there is some problem with comparing an Integer object with a long as I have done because otherwise I don't know what the problem is. At the moment when the nextTotal value exceeds INTEGER.MAX, it kicks into negative numbers instead of printing the error message. public Integer initialValue=0; int amount = Integer.parseInt(amountStr); System.out.println("Received from client: " + amount); long nextTotal=amount+initialValue; if((nextTotal&gt;Integer.MAX_VALUE)|| (nextTotal&lt;Integer.MIN_VALUE)){ System.out.println("Error: Integer has not been added as the total exceeds the Maximum Integer value!"); out.flush(); } else{ initialValue+=amount; out.println(initialValue); //server response System.out.println("Sending total sum of integers to the client:"+initialValue); out.flush(); } }
has title: How to compare an Integer with a long?
score: 0
has answer: http://stackoverflow.com/a/22618131
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22618131

communication
tag name: communication
tags question: http://stackoverflow.com/q/22510629
type: Tag

http://stackoverflow.com/comment/34395877
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22592689
score: 1
has text: Depending on your db, the cols may be case sensitive.

http://stackoverflow.com/a/78721128
upvote count: 1
answers question: http://stackoverflow.com/q/22536279
downvote count: 0
score: 1
type: Answer
has body: If you have arrived at this post due to a compilation problem in your Jenkins. Know that most likely you are running Jenkins with a more updated JDK and your project is compatible with an older version of Java, making it necessary for you to install another version of the JDK in parallel on your VM/Container. In Jenkins, the option is called “With Ant” and allows you to select Java with the specific version to build your project.

http://stackoverflow.com/q/22543186
has body: Say if I had a layout, "X", with one button: "x". When I click "x", it opens up "Y", and there is a "y" button. What I am aiming to achieve is: When "y" is clicked, it changes the button "x" text and image to something else. But, what is happening instead is that it is opening up a new, identical layout to "X", with the same button "x", and applying the changes in that layout. Some paint attempts for better visual understanding: http://tinypic.com/r/2417ev7/8 But this is what actually happens: http://tinypic.com/r/1p9q2b/8
answer count: 1
score: 0
tagged with: android
has title: Quick android layout questions
has comment: http://stackoverflow.com/comment/34308420
accepted answer: http://stackoverflow.com/a/22543516
type: AnsweredQuestion
tagged with: android-layout
tagged with: java
has comment: http://stackoverflow.com/comment/34308458
has answer: http://stackoverflow.com/a/22543516
has comment: http://stackoverflow.com/comment/34308343
type: Question

http://stackoverflow.com/q/22588187
score: 2
type: AnsweredQuestion
has body: when i do public class TestClass { // i have intentionally not used TestClass&lt;T&gt; void method1(T obj){ // i know i can use Object instead of T but i am not getting why T is not allowed here? } Compile time exception is T cannot be resolved to a type When i do this, it does not given any exception. How come T is resolved now ? &lt;T&gt;T method1(T obj){ return null; }
tagged with: java
accepted answer: http://stackoverflow.com/a/22588231
type: Question
has title: why void method1(T obj) is not allowed generics?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22588231
tagged with: generics
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/34323281
has text: Sure... Your first problem is: you have to describe your problem and tell what doesn't work.
comment on: http://stackoverflow.com/q/22551930
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34393607
comment on: http://stackoverflow.com/q/22583467
has text: JSON is pretty symmetrical, so I don't see why it couldn't be parsed "backwards". You'd have to write your own parser, however.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34257947
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22515152
has text: Please post the errors, but my first guess is a null pointer exception as I don't see you ever instantiating origin
type: Comment

http://stackoverflow.com/a/36254705
has comment: http://stackoverflow.com/comment/110913842
upvote count: 13
has body: The method for reversing a linked list is as below; Reverse Method public void reverseList() { Node&lt;E&gt; curr = head; Node&lt;E&gt; pre = null; Node&lt;E&gt; incoming = null; while(curr != null) { incoming = curr.next; // store incoming item curr.next = pre; // swap nodes pre = curr; // increment also pre curr = incoming; // increment current } head = pre; // pre is the latest item where // curr is null } Three references are needed to reverse a list: pre, curr, incoming ... pre curr incoming ... --&gt; (n-1) --&gt; (n) --&gt; (n+1) --&gt; ... To reverse a node, you have to store previous element, so that you can use the simple stament; curr.next = pre; To reverse the current element's direction. However, to iterate over the list, you have to store incoming element before the execution of the statement above because as reversing the current element's next reference, you don't know the incoming element anymore, that's why a third reference needed. The demo code is as below; LinkedList Sample Class public class LinkedList&lt;E&gt; { protected Node&lt;E&gt; head; public LinkedList() { head = null; } public LinkedList(E[] list) { this(); addAll(list); } public void addAll(E[] list) { for(int i = 0; i &lt; list.length; i++) add(list[i]); } public void add(E e) { if(head == null) head = new Node&lt;E&gt;(e); else { Node&lt;E&gt; temp = head; while(temp.next != null) temp = temp.next; temp.next = new Node&lt;E&gt;(e); } } public void reverseList() { Node&lt;E&gt; curr = head; Node&lt;E&gt; pre = null; Node&lt;E&gt; incoming = null; while(curr != null) { incoming = curr.next; // store incoming item curr.next = pre; // swap nodes pre = curr; // increment also pre curr = incoming; // increment current } head = pre; // pre is the latest item where // curr is null } public void printList() { Node&lt;E&gt; temp = head; System.out.print("List: "); while(temp != null) { System.out.print(temp + " "); temp = temp.next; } System.out.println(); } public static class Node&lt;E&gt; …
type: Answer
score: 13
answers question: http://stackoverflow.com/q/22605050
downvote count: 0
has comment: http://stackoverflow.com/comment/67101451

http://stackoverflow.com/comment/34462356
type: Comment
has text: be.getModel() will give you the ModelData of the particular row. Suppose you have 2 cases, for case 1: you have to enable the cell of the particular row, for case 2, disable. Initally: Row 1, row 3, row 5: case 1: enable, AND Row 2,row 4:case 2 Now, you changed row 3 to case 2, row 1 is still in case 1, so its cell will not be disabled. you do not have to worry about it. This approach works. Try it
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22627987

http://stackoverflow.com/a/22523787
type: Answer
answers question: http://stackoverflow.com/q/22522491
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34275254
has comment: http://stackoverflow.com/comment/34275171
has body: I found it - At line number 14 you are executing st1.executeQuery() but it should be st2.execute query I have commented your line and added the correct one. Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost/task4DB?" + "user=root&amp;password=123"); PreparedStatement st = con.prepareStatement("select Distinct AreaId from TableName") ResultSet r1=st.executeQuery(); while (r1.next()) { int id = r1.getInt("AreaId"); PreparedStatement st1 = con.prepareStatement("select Distinct LineId where AreaId = id") ResultSet r2=st1.executeQuery(); while (r2.next()) { int lineid = r2.getInt("LineId"); PreparedStatement st2 = con.prepareStatement("select x,y where AreaId = id and LineId = lineid") //ResultSet r3=st1.executeQuery(); ResultSet r3 = st2.executeQuery(); int size = 0; int [][]xy = new int[r3.getCount()][r3.getCount()] while (r3.next()) { xy[size][0] = r3.getInt("x"); xy[size][1] = r3.getInt("y"); size++; } callShapePointConv(id,lineId,xy); } }
downvote count: 0

http://stackoverflow.com/comment/34452155
has text: Could you be a bit more specific about the scope of duplicate removal? Do you need to remove duplicate lines from the last day of data? The last week? Since the beginning of time? Also, do you require the data to remain "in order" aside from the duplicate removal? If so, does it matter which duplicate remains?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22623472

http://stackoverflow.com/comment/34367997
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22570722
has text: When I do long before = System.currentTimeMillis(); selector.select(10000); long after = System.currentTimeMillis(); When the system is very loaded (like close to 0% idle, 15% usr/sys and 85% wa), but all the IO is disk (there is no other network IO), I occasionally see "after - before" way above 10000 - it can be 50000 or even 100000. This is even though I have found the OS LWP corresponding to the java-thread doing the select and upped it to realtime OS priority (chrt -f -p 99 <LWP-id>). I want the process to continue after the 10 secs!

http://stackoverflow.com/comment/34289031
type: Comment
has text: @Batty: both CMS and parallel use multiple threads to process a GC in eden. (ParNew for CMS and Parallel Scavenge for Parallel)
score: 0
comment on: http://stackoverflow.com/a/22506391
type: AnswerComment

http://stackoverflow.com/q/22606034
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/5287538
has answer: http://stackoverflow.com/a/22606127
has comment: http://stackoverflow.com/comment/34419537
upvote count: 0
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/34420509
has comment: http://stackoverflow.com/comment/34419640
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34419674
has answer: http://stackoverflow.com/a/22606116
favorite count: 0
has comment: http://stackoverflow.com/comment/34419690
has answer: http://stackoverflow.com/a/22606207
type: UnansweredQuestion
has title: is ArrayList a java library class if not, what is a java library class used to store arrays?
answer count: 4
tagged with: java
has body: if it is, and i wanted to store input from a user into an array without using a java library class, how would i go about doing this? I only know how to use ArrayList&lt; String &gt; items = new ArrayList&lt; String &gt;();
has answer: http://stackoverflow.com/a/22606148

http://stackoverflow.com/comment/34427722
type: Comment
has text: No i can't. It's **not an Java class**! Had **no** class and **no** methods ;)
type: AnswerComment
comment on: http://stackoverflow.com/a/22609314
score: 0

http://stackoverflow.com/comment/34394346
comment on: http://stackoverflow.com/a/22590940
has text: Thanks for the feedback. So the code is okay. What is the JPA provider you used in the test? I can't make this work in hibernate-entitymanager 4.3.4.Final. The square brackets is Groovy syntax, it should be compatible with Java.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22555374
score: 10
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/22555520
answer count: 3
has answer: http://stackoverflow.com/a/22555511
favorite count: 0
tagged with: weak-references
has title: android - java - WeakReferences with an ArrayList?
has answer: http://stackoverflow.com/a/42961800
tagged with: android
upvote count: 10
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22555520
downvote count: 0
tagged with: java
tagged with: garbage-collection
type: Question
has body: I know that with a WeakReference, if I make a WeakReference to something that unless there's a direct reference to it that it will be Garbage Collected with the next GC cycle. My question becomes, what if I make an ArrayList of WeakReferences? For example: ArrayList&lt;WeakReference&lt;String&gt;&gt; exArrayList; exArrayList = new ArrayList&lt;WeakReference&lt;String&gt;&gt;(); exArrayList.add(new WeakReference&lt;String&gt;("Hello")); I can now access the data with exArrayList.get(0).get(). My question becomes: This is WeakReference data, will the data located at exArrayList.get(0) be GC'd with the next GC cycle? (even IF I don't make another direct reference to it) or will this particular reference stick around until the arraylist is emptied? (eg: exArrayList.clear();). If this is a duplicate I haven't found it with my keywords in google.
accepted answer: http://stackoverflow.com/a/22555511

http://stackoverflow.com/comment/34280063
comment on: http://stackoverflow.com/q/22518710
score: 0
has text: @Leeor - Yes, "bus locking" != "full bus locking"
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22585417
linked to: http://stackoverflow.com/q/9572795
duplicate of: http://stackoverflow.com/q/960431
duplicate of: http://stackoverflow.com/q/1073919
upvote count: 2
has comment: http://stackoverflow.com/comment/34383263
duplicate of: http://stackoverflow.com/q/9572795
downvote count: 3
has body: import java.util.*; public class Tester2 { public static void main(String[] args) { int[] array = new int[] {1,2,3,1,2,3}; System.out.println(Arrays.toString(deleteElement(array, 1))); } public static int[] deleteElement(int [] array, int target) { ArrayList&lt;Integer&gt; a1 = new ArrayList&lt;Integer&gt;(); for(int i=0; i&lt;array.length; i++) { if (array[i] != target) a1.add(array[i]); } int[] returnedArray = new int[a1.size()]; returnedArray = a1.toArray(returnedArray); return returnedArray; } } When I try to compile this code I get the following error: 1 error found: File: /Users/Hyeunjoon/Desktop/CS/A4/Tester2.java [line: 25] Error: /Users/Hyeunjoon/Desktop/CS/A4/Tester2.java:25: cannot find symbol symbol : method toArray(int[]) location: class java.util.ArrayList Can anyone help me out? I don't understand why I am getting this error
type: Question
has answer: http://stackoverflow.com/a/22585474
tagged with: java
score: -1
answer count: 1
has title: cannot convert ArrayList<Integer> to int[]
favorite count: 0
linked to: http://stackoverflow.com/q/960431
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1073919

http://stackoverflow.com/comment/34437405
type: Comment
has text: What do you mean that you do not get all the results? What are you expecting to get? Try using an Iterator instead over the PaginatedResult, and see if that works.
comment on: http://stackoverflow.com/a/22612282
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34277845
type: QuestionComment
comment on: http://stackoverflow.com/q/22525770
has text: @AndrewThompson There's "limited" support. I wasn't able to get `width` or `text-align` to work, not even sure about `display` but did get `color` to work :P
score: 0
type: Comment

http://stackoverflow.com/a/22519393
has body: Yes, on most architectures each core would attempt a Read-For-Ownership flow, which means it asks for the line exclusively with the purpose of changing it. One of them would win, sending the data back to the requesting core and making the other request block or recycle somehow. The exact details depend on the design, but in general you could expect the winning core to consume the data and change it to the new value atomically (through internal locking, so it can't be interfered in the process), and then finish the operation with the new data either written back or cached internally (in modified state). At that point the other request may continue and attempt to get ownership on the line - if this line is still held in the first core, that would result in a snoop reading the modified data. Then the second core can repeat the same process as the first one. On simpler systems the same can be achieved by stopping all memory transactions during this process (a "bus lock", like Egor mentioned), but that's pretty rare these days as the performance is horrible, so it's kept for really complicated cases like when the variable isn't aligned and the data splits between two lines. Note that the crucial part (the CaS), should ideally be done internally within the core, where the local cache line lock can maintain atomicity (no one else can read or take ownership on that line while he's locking it), while other cores can access other memory addresses without loss of coherency or atomicity.
upvote count: 3
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22518710
score: 3
accepted answer of: http://stackoverflow.com/q/22518710
downvote count: 0

http://stackoverflow.com/comment/34368492
type: Comment
has text: I tested it and it works fine. Are you sure you are copying my code correctly? The error you are seeing would happen if you omitted the `!` - you must not have copied my code properly. Try copy-pasting it directly into your code.
comment on: http://stackoverflow.com/a/22577436
score: 0
type: AnswerComment

http://stackoverflow.com/q/22509185
favorite count: 0
has answer: http://stackoverflow.com/a/22519388
has comment: http://stackoverflow.com/comment/34251568
upvote count: 1
accepted answer: http://stackoverflow.com/a/22519388
has title: PDFBox character bad characters in the pdf to string conversation
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22510166
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22510166
has comment: http://stackoverflow.com/comment/34250641
tagged with: pdfbox
has body: I am using PDFBox 1.8.4 to convert PDF to string. For example my pdf contains : Pólya, G. and G. Szegő, The output is : Po´lya, G. and G. Szego˝ Is there any way to solve that problem? (Yeah i know i can change with replaceAll("o'","ó")) PDDocument doc = PDDocument.load(path); PDFTextStripper strp = new PDFTextStripper("UTF-8"); System.out.println(strp.getText(doc)); All suggestions are welcomed! Edit 1: PDF_Example
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/34220389
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22491968
has text: I created, plugin from jfxrt.jar and it is working. I thought that I will not need a plugin with jfxrt.jar as that javafx is now an integral part of the jdk.
score: 0

http://stackoverflow.com/q/22494714
has comment: http://stackoverflow.com/comment/34223195
has comment: http://stackoverflow.com/comment/34223222
score: 0
answer count: 1
tagged with: adapter
has body: I am trying to reference a drawable from a resource ID that is passed through putInt() in CreateActivity. I would like to use the drawable associated with the resource ID and use it as part of creating Event Object (with other parameters). Am I referencing the drawable incorrectly? or is there a problem with the way I have structured the Event Object? Sorry for the longwinded post. CreateActivity public class CreateActivity extends Activity implements OnClickListener { EditText etTitle; Button btDate; Button btTime; Button btPic; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //onclicklistener findViewById(R.id.btn_confirm).setOnClickListener(this); findViewById(R.id.btn_back).setOnClickListener(this); etTitle = (EditText) findViewById(R.id.editTextTitle); btDate = (Button) findViewById(R.id.btn_date); btTime = (Button) findViewById(R.id.btn_time); btPic = (Button) findViewById(R.id.btn_picture); } // Will be called via the onClick attribute // of the buttons in main.xml public void onClick(View view) { switch (view.getId()) { case R.id.btn_confirm: String title = etTitle.getText().toString(); String time = btTime.getText().toString(); String date = btDate.getText().toString(); int resId = getResources().getInteger(R.id.btn_picture); Log.e("LOG", title); Log.e("LOG", time); Log.e("LOG", date); Bundle newBundle = new Bundle(); newBundle.putString("TITLE", title); newBundle.putString("TIME", time); newBundle.putString("DATE", date); //Trying to pass a drawable from one activity to another newBundle.putInt("DRAWABLE", resId); Intent intent = new Intent(this, MainActivity.class); intent.putExtras(newBundle); setResult(RESULT_OK, intent); finish(); break; case R.id.btn_back: finish(); break; } } public void showTimePickerDialog(View v) { DialogFragment newFragment = new TimePickerFragment(); newFragment.show(getFrag…
has title: Error Generated when Passing Drawables
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
tagged with: android-drawable
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34223255
has answer: http://stackoverflow.com/a/22494896

http://stackoverflow.com/a/22569900
answers question: http://stackoverflow.com/q/22569040
has body: The parallel execution of streams is based on a fork-join model. For ordered streams, the parallel execution only works, if the stream can be split into parts, strictly following one another. In general, that's not possible with streams generated by BufferedReader. However, in theory parallel execution should be possible for unordered streams: BufferedReader reader = ...; reader.lines().unordered().map(...); I am not sure if the stream returned by BufferedReader supports this kind of parallel execution. A very simple alternative is to create an intermediate list: BufferedReader reader = ...; reader.lines().collect(toList()).parallelStream().map(...); In this case, the parallel execution starts after all lines have been read. This might be a problem, if reading the lines takes a long time. In this case, I recommend using an ExecutorService for parallel execution instead of parallel streams: ExecutorService executor = ...; BufferedReader reader = ...; reader.lines() .map(line -&gt; executor.submit(() -&gt; ... line ...)) .collect(toList()) .stream() .map(future -&gt; future.get()) .map(...);
has comment: http://stackoverflow.com/comment/34359815
downvote count: 0
has comment: http://stackoverflow.com/comment/34355204
has comment: http://stackoverflow.com/comment/34367847
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/34367194
has comment: http://stackoverflow.com/comment/34355182
score: 2

http://stackoverflow.com/comment/34262464
comment on: http://stackoverflow.com/a/22517165
type: AnswerComment
has text: Yes you are correct. Because of the fact that String is immutable the String concatenation method is much less efficient and slower.
type: Comment
score: 2

http://stackoverflow.com/q/22584813
type: Question
has comment: http://stackoverflow.com/comment/34396353
answer count: 1
has title: Checkerboard center and resizing in java
tagged with: resize
has body: I wrote a checkerboard program (shown below). My problem is that I can't figure out how to center it with resize, and have it resize proportionately. I added in a short statement. Int resize (shown below) I did something similiar with a previous program regarding a bullseye where I used a radius. I just haven't the slightest clue how to implement that in here. import java.awt.*; import javax.swing.JComponent; public class CheckerboardComponent extends JComponent { @Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.RED); int s = 12; int x = s; int y = s; // int resize = Math.min(this.getHeight(), this.getWidth()) / 8 ; for (int i = 0; i &lt; 8; i++) { // one row for (int j = 0; j &lt; 8; j++) { g2.fill(new Rectangle(x, y, 4 * s, 4 * s) ); x += 4 * s; if(g2.getColor().equals(Color.RED)){ g2.setColor(Color.BLACK); }else{ g2.setColor(Color.RED); } } x = s; y += 4 * s; if(g2.getColor().equals(Color.RED)){ g2.setColor(Color.BLACK); }else{ g2.setColor(Color.RED); } } } } here is a viewer program import javax.swing.*; public class CheckersViewer { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(430, 450); frame.setTitle("Checkerboard"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); CheckerboardComponent component = new CheckerboardComponent(); frame.add(component); frame.setLocationRelativeTo(null); frame.setVisible(true); } }
score: 0
has answer: http://stackoverflow.com/a/22584929
tagged with: jframe
type: UnansweredQuestion
tagged with: jcomponent
linked to: http://stackoverflow.com/q/21142686
tagged with: swing
tagged with: java

http://stackoverflow.com/comment/34458960
type: Comment
has text: OP has more than one links in that page to download
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22627853

http://stackoverflow.com/q/22551987
tagged with: drools
score: 0
has answer: http://stackoverflow.com/a/28205006
answer count: 1
has title: How to union result in drools
tagged with: accumulate
has comment: http://stackoverflow.com/comment/34323939
type: UnansweredQuestion
has body: I want to get one result only in drools. I tried to use "from" and "from accumulate" but It did not work. Main.java // Main class KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); kbuilder.add(ResourceFactory.newClassPathResource("Rules_Schedule.drl", getClass()), ResourceType.DRL); if (kbuilder.hasErrors()) { System.err.println(kbuilder.getErrors().toString()); } kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); try { String[] Sss = new String[2]; Sss[0] = "RLC"; Sss[1] = "DCK"; int i=0; rs_sch_exam = stm_sch_exam.executeQuery("SELECT *,DATE_FORMAT(sc_date,'%a') AS day FROM schedule_exam"); while(rs_sch_exam.next()){ String date = rs_sch_exam.getString("sc_date"), day = rs_sch_exam.getString("day"), start = rs_sch_exam.getString("sc_star"), end = rs_sch_exam.getString("sc_end"), subj = rs_sch_exam.getString("sc_subj"), depa = rs_sch_exam.getString("sc_depa"), sec = rs_sch_exam.getString("sc_sec"), room = rs_sch_exam.getString("sc_room"); Schedule schedule = new Schedule(date,day,subj,sec,depa,room,start,end); schedule.setControlExam1(Sss[i++]); //Test add data,Get value from SQL 2 Recode not had Control Exam1 ksession.insert(schedule); } rs_peo = stm_peo.executeQuery("SELECT * FROM control_exam"); while(rs_peo.next()){ String code = rs_peo.getString("ce_code"), name = rs_peo.getString("ce_name"), depart = rs_peo.getString("ce_department"), room = rs_peo.getString("ce_room"), sun = rs_peo.getString("ce_sunday"), mon = rs_peo.getString("ce_monday"), tue = rs_peo.getString("ce_tuesday"), wed = rs_peo.getString("ce_wednesday"), thu = rs_peo.getString("ce_thursday"), fri = rs_peo.getString("ce_friday"), sat = rs_peo.getString("ce_saturday"); Control_Exam controlExam = new Control_Exam(code,name,depart,room, Integer.parseInt(sun),Integer.parseInt(mon),Integer.parseInt(tue), Integer.parseInt(wed),Intege…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34520211
tagged with: union

http://stackoverflow.com/a/41071660
answers question: http://stackoverflow.com/q/22592612
score: 0
has body: public boolean prefixAgain(String str, int n) { return str.substring(n).contains(str.substring(0,n)); } just looking the prefix(str.substring(0,n)) in the substring of str without the prefix this means starting from n which is (str.substring(n)).
type: Answer

http://stackoverflow.com/comment/34395564
comment on: http://stackoverflow.com/a/22592348
score: 0
type: Comment
has text: Err, yes, by catching them. Initialize the fields using a method or a constructor, and catch the exception in the method or constructor. But why would you want that? Your object will probably not be able to do anything useful if its fields haven't been initialized properly. Exceptions are a good thing: they signal errors. Catching the exception will only hide the error and cause others, harder to diagnose.
type: AnswerComment

http://stackoverflow.com/comment/52932488
score: 0
type: QuestionComment
has text: Unfortunately, no :(
type: Comment
comment on: http://stackoverflow.com/q/22604531

http://stackoverflow.com/comment/34379978
score: 0
type: Comment
type: QuestionComment
has text: Instead of -num2, use -1 * num2. or put -num2 at the end of the equation
comment on: http://stackoverflow.com/q/22583479

http://stackoverflow.com/a/22498177
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22497973
type: Answer
has body: If a \n (linefeed/newline) or \r (carriage return) character exists, the corresponding index (its position in the string) will be >=0. If so, the substring operation truncates the string, removing the offending character and everything after it. The logic seems to be set up so that if both \n and \r are found, only the later of the two (and anything after it) will be removed. I have no idea why the author thought that was a good idea; I would have expected truncation to be done from the earlier one.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22497973

http://stackoverflow.com/comment/34373767
score: 0
type: AnswerComment
has text: ViewRootImpl #2 Surface is not valid.
type: Comment
comment on: http://stackoverflow.com/a/22579780

http://stackoverflow.com/a/22509487
type: Answer
has body: Just take a look here http://developer.android.com/guide/topics/manifest/receiver-element.html receiver is contained inside application node. Move it out of activity
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22509371
answers question: http://stackoverflow.com/q/22509371

http://stackoverflow.com/q/22578155
possible better answer: http://stackoverflow.com/a/22578183
score: 2
type: AnsweredQuestion
has title: How to refresh a JPanel at runtime?
linked to: http://stackoverflow.com/q/8027849
has answer: http://stackoverflow.com/a/22578183
upvote count: 2
tagged with: java
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/6811064
linked to: http://stackoverflow.com/q/22275435
linked to: http://stackoverflow.com/q/5668132
linked to: http://stackoverflow.com/q/22436631
linked to: http://stackoverflow.com/q/5695387
has answer: http://stackoverflow.com/a/22578187
linked to: http://stackoverflow.com/q/5600051
answer count: 3
tagged with: user-interface
downvote count: 0
linked to: http://stackoverflow.com/q/5414177
has answer: http://stackoverflow.com/a/22578181
favorite count: 0
linked to: http://stackoverflow.com/q/6893078
has body: I have found that there are many similar topics here, but my problem is something more complicated. Background of my problem:- I have a JFrame called Main. On this JFrame I have two buttons and one JPanel called WorkingPanel. Then I have another JPanel(called PlayerPanel) but this one is a seprate file (as a class). Now I want that when I click a button, it should change WorkingPanel to PlayerPanel. I have wrote following code. private void MenuButtonPlayerViewMouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: WorkingPanel = new PlayerPanel(); System.out.println(WorkingPanel.getName()); WorkingPanel.revalidate(); WorkingPanel.repaint(); WorkingPanel.setVisible(true); Window.revalidate(); Window.repaint(); } Please guide me, Thanks.
accepted answer: http://stackoverflow.com/a/22578181
has comment: http://stackoverflow.com/comment/34371792

http://stackoverflow.com/a/74826779
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22631258
has body: I know this is very late reply but it may helps to someone. Please check updated code below. public boolean onTouchEvent(MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: x1 = event.getX(); break; case MotionEvent.ACTION_UP: x2 = event.getX(); float deltaX = x2 - x1; if (Math.abs(deltaX) > MIN_DISTANCE) { if (deltaX > 0) { month++; Log.v("test", "test"); theCursor = dbh.getDiaries(month); adapter = new MyCursorAdapter(this, theCursor); this.setListAdapter(adapter); } else { month--; Log.v("test", "test"); theCursor = dbh.getDiaries(month); adapter = new MyCursorAdapter(this, theCursor); this.setListAdapter(adapter); } } break; } return super.onTouchEvent(event); }

http://stackoverflow.com/q/22571278
type: Question
tagged with: overloading
has title: Can someone help me with the attack method in my fighter class
tagged with: java
has comment: http://stackoverflow.com/comment/34357846
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/22571319
accepted answer: http://stackoverflow.com/a/22571319
answer count: 1
has body: import java.util.Scanner; public class Assignment5 { public static void main(String[] arg){ Fighter myFighter, enemyFighter; Scanner console = new Scanner(System.in); int num1, num2, num3; String str, another; System.out.println ("*** Fighter Game ***"); do { System.out.println("Create your fighter (Type three integers + name): "); num1 = console.nextInt(); num2 = console.nextInt(); num3 = console.nextInt(); str = console.next(); if (num1 + num2 + num3 == 10) { myFighter = new Fighter (num1, num2, num3, str); enemyFighter = new Fighter( ); enemyFighter.setName ("Enemy"); System.out.print( myFighter.getName()+" ["+myFighter.getPower()+","+myFighter.getSpeed()+","+myFighter.getHeal()+"] "); System.out.print( enemyFighter.getName()+" ["+enemyFighter.getPower()+","+enemyFighter.getSpeed()+","+enemyFighter.getHeal()+"] "); System.out.println(); int fights = 0; boolean gameOver= false; while (fights &lt; 10 &amp;&amp; !gameOver){ System.out.print("Fight[" + fights + "]: "); myFighter.attack (enemyFighter); myFighter.heal (); enemyFighter.attack(myFighter); enemyFighter.heal(); myFighter.printInfo(); enemyFighter.printInfo(); if (enemyFighter.isDead() || myFighter.isDead()) gameOver = true; fights ++; System.out.println(); } if(myFighter.getHealth() &gt; enemyFighter.getHealth()) System.out.println(" You Win"); else System.out.println("You Lost"); System.out.println(); System.out.print("Play another fight (y/n)? "); another = console.next(); } else { System.out.println("Invalid Inputs. The total of three numbers should be 10."); another = console.next(); } } while (another.equalsIgnoreCase("y")); } } public class Fighter { public Fighter() { } private int power = (int)(1 + Math.random()*5); private int speed = (int)(1 + Math.random()*5); private int heal = 10 - (power + speed); private int health = 50; private String name; public Fighter (int num1, int num2, int num3, String str) { this.power = num1; this.speed = num2; this.heal = num3; this.name = str; } public String get…
type: AnsweredQuestion
tagged with: instance
tagged with: methods

http://stackoverflow.com/comment/34245880
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22508461
has text: Maybe I'm misunderstanding something, but why don't you declare a boolean before the while with false value, check it in your if and set it to true when you entering the if statement?

http://stackoverflow.com/q/22581246
has answer: http://stackoverflow.com/a/22581960
has title: Confusion regarding JTextArea and newline character
has body: I'm a bit confused on how the JTextArea works with regards to newline characters. I've got a JTextArea within a JScrollPane object. JScrollPane scrollPane4 = new JScrollPane(); scrollPane4.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane4.setBounds(66, 155, 474, 133); getContentPane().add(scrollPane4); postingArea = new JTextArea(); postingArea.setMaximumSize(new Dimension(470, 200)); postingArea.setLineWrap(true); postingArea.setBorder(border); postingArea.setLineWrap(true); postingArea.setWrapStyleWord(true); scrollPane4.setViewportView(postingArea); The text area is used to gather input from the user and post to an SQL database. The string can be read from the database and redisplayed on a separate web page at another time. When a user enters text, the line does wrap, however, what gets entered into the database is one long string. Therefore, what is redisplayed is one long string with a horizontal scroll bar. Is there a way for me to add newline characters at the appropriate location in the text via an event handler? Or, do I simply inform the user to press "Enter" when they want a new line?
linked to: http://stackoverflow.com/q/5621338
tagged with: jtextarea
accepted answer: http://stackoverflow.com/a/22610050
tagged with: newline
has comment: http://stackoverflow.com/comment/34375371
has comment: http://stackoverflow.com/comment/34376245
tagged with: jscrollpane
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34383737
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22610050
tagged with: swing
linked to: http://stackoverflow.com/q/17874717
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/22581960

http://stackoverflow.com/comment/34326068
has text: I've fixed it. Now I can deploy my project. No my fault, it was with google compiler.
comment on: http://stackoverflow.com/q/22527898
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34285111
comment on: http://stackoverflow.com/q/22529926
score: 0
type: QuestionComment
type: Comment
has text: @RethinavelPillai Sorry, there is no more errors in log. But button is doesnt work, there is only warnings.

http://stackoverflow.com/comment/34223767
has text: Yes if it's possible ! I'm using this one now, to get the good F and L but i would like to delete F if L doesn't exist. `//F[ancestor::D/E[text()='DataE']]|//L[ancestor::D/E[text()='DataE'] and ancestor::J/K[text()='DataK']]`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22493971
type: Comment

http://stackoverflow.com/q/22624632
tagged with: class
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/22628062
has answer: http://stackoverflow.com/a/22628062
type: Question
type: AnsweredQuestion
has title: need help accessing information in embedded classes
has body: Long story short, I want a method to return two items. I think I learned the best way to do that is with an embedded class. I'm having difficulty with the structure and syntax though, as well as how to access the info. Really what I want to do is have a method return an array String[] and a String. If you can think of an easier way to do this I'd be really interested in hearing about it. Thank you so much for you help Thanks import java.util.*; public class test { public test() { } public class SQLarguments //embedded class { String[] columns; String table; public SQLarguments(String table, String... columns) { this.table = table; this.columns = columns; } } public SQLarguments arguments(String table, String... columns) { SQLarguments testArgs = new SQLarguments(table,columns); return testArgs; } public static void main(String[] args) { test t1 = new test(); t1.arguments("table","col 1","col 2", "col 3"); System.out.println(.arguments[0]); System.out.println("test"); }//end main }//end class
tagged with: java

http://stackoverflow.com/q/22576620
has answer: http://stackoverflow.com/a/22576903
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22576695
tagged with: return-type
has answer: http://stackoverflow.com/a/22576695
answer count: 2
accepted answer: http://stackoverflow.com/a/22576903
has body: I have an abstract class that is extended by two other classes. In the abstract class I have a method that is implemented differently by those two classes. I want to be able to use that method even if I don't know which concrete class object it is. Is there a way to make the return type the same as what the method was used on not the abstract type? To make it more concrete, the relevant part of abstract class: public abstract class State&lt;abstarct&gt; { public abstract Set&lt;State&lt;?&gt;&gt; findNeighbors(); And for the other two classes: public class PuzzleState extends State&lt;PuzzleState&gt; { @Override public Set&lt;PuzzleState&gt; findNeighbors() { // making the set // unrelevant to the question return set; } and public class QueensState extends State&lt;QueensState&gt; { @Override public Set&lt;QueensState&gt; findNeighbors() { // making the set // unrelevant to the question return set; } For now it doesn't work of course. I just thought State might be what I was looking for but it isn't. Is there a way to make it work? I want the findNeighbors() to return either Set or Set according to what the method was used on. I want it to be that way because in another part of the program I have a display() method that takes as an input either PuzzleState or QueensState and displays it accordingly. I don't know if my question was clear enough, but basically I just want to know if there is a way to change the abstract methods return type according to the class.
tagged with: extend
score: 0
tagged with: java
has title: Abstract class extensions return type

http://stackoverflow.com/a/22602567
downvote count: 0
has body: You could use a PropertyPlaceholderConfigurer as follows classpath:external.properties See more examples at 5.8.2 Customizing configuration metadata with a BeanFactoryPostProcessor and Spring PropertyPlaceholderConfigurer Example
has comment: http://stackoverflow.com/comment/34413810
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22602239
score: 1

http://stackoverflow.com/comment/116040506
type: AnswerComment
comment on: http://stackoverflow.com/a/49530957
type: Comment
score: 0
has text: Is there an advantage to using FileInputStream as in your example, versus the method in the other answer?

http://stackoverflow.com/a/22602089
score: 0
has body: ActionListener event will occur on TextField only when you type something and hit enter. this handler will not be raised, insurancevaluetextField.addActionListener (handler); its value will be 0, that why the error message was displayed if you dont hit enter after typing
type: Answer
answers question: http://stackoverflow.com/q/22601720

http://stackoverflow.com/a/22494883
upvote count: 5
type: Answer
downvote count: 0
has body: I found it based on Vit Hnilica's answer at loading a certificate from keystore. I"m going to leave the question with this answer since most Stack Overflow answers start with "convert with openssl, then use keytool ...". Hat's off to Vit for posting that answer. Hnilica's answer is the only one I found after wading through pages of similar questions and answers on Stack Overflow. String CA_FILE = ...; FileInputStream fis = new FileInputStream(CA_FILE); X509Certificate ca = (X509Certificate) CertificateFactory.getInstance( "X.509").generateCertificate(new BufferedInputStream(fis)); KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(null, null); ks.setCertificateEntry(Integer.toString(1), ca); TrustManagerFactory tmf = TrustManagerFactory .getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks);
accepted answer of: http://stackoverflow.com/q/22494763
answers question: http://stackoverflow.com/q/22494763
score: 5
type: AcceptedAnswer

http://stackoverflow.com/q/22578595
has body: I need to develoj a java REST webapp using jersey-server 1.17, my resources need to avoid csrf (cross site request forgery) attack, i know that exists a class in jersey that can do this, this class is csrfProtectionFilter so i need to check every request with this filter, but i cannot understand where and how to insert this declaration, i knok that i must put it in web.xml, but i cannot see any good result yet, i am trying to modify a jersey example with this web.xml com.sun.jersey.samples.servlet.resources.MyApplication com.sun.jersey.spi.container.servlet.ServletContainer javax.ws.rs.Application com.sun.jersey.samples.servlet.resources.MyApplication com.sun.jersey.spi.container.ContainerRequestFilters com.sun.jersey.api.container.filter.CsrfProtectionFilter 1 com.sun.jersey.samples.servlet.resources.MyApplication /resources/* 30 did i forget something? thanks.
answer count: 2
has title: create webservice with jersey 1.1x with csrf filter
downvote count: 0
favorite count: 0
tagged with: rest
type: UnansweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25680742
tagged with: jersey
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25254018

http://stackoverflow.com/comment/34887730
type: Comment
comment on: http://stackoverflow.com/a/22629384
has text: @user838204 Chronicle need about 100 KB of main memory each, and I don't suggest you have too many of them. The more memory you have free, the more it can use, but this is handled transparently by the OS and it is not something you should have to worry about. It supports multiple readers and writers in different *processes* on the same machine. It also supports TCP replication.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34406181
comment on: http://stackoverflow.com/a/22598247
has text: @Flavio, use regex only as a last resort. Reimeus' solution is far better than a regular expression for your particular problem.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34413792
has text: Why do you say it prints twice per iteration of the while() loop? Where are you counting / tracking iterations?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22602432

http://stackoverflow.com/q/22637156
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23286774
score: 0
has body: I want to plot a line graph, which is not "autocompleted". My problem is, I want to add XY Points over a time period. But after adding the first point, android plot draws this point in the middle and draws a line form the beginning of the graph to the point and form there to the end of the graph. How it is: How it should be: Can anyone tell me how to achieve that?
answer count: 1
tagged with: androidplot
tagged with: android
has title: Androidplot plot a half empty line graph

http://stackoverflow.com/comment/34502653
type: Comment
has text: hi this can work with any test tools like Jmeter or rest service tools and also in java resthttpclient ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22631790

http://stackoverflow.com/comment/91503041
type: Comment
comment on: http://stackoverflow.com/a/22636750
score: 2
has text: Now with Java 9, you can use: `Map<String,String> unmodifiableMap = Map.ofEntries(entry("A","B"), entry("C","D"), entry("E","F"));` which is more beautiful to my mind
type: AnswerComment

http://stackoverflow.com/q/22513102
has comment: http://stackoverflow.com/comment/34254391
answer count: 1
tagged with: string
favorite count: 0
linked to: http://stackoverflow.com/q/995918
has body: Hey I've recently started using Java, and I'm having trouble with a program I'm writing. Ive seen how the teacher has had his solution done but I dont see any difference in my solution compared to his except for me using a different equals in the if statements, and the names are different. Can anyone tell me why I may be getting a 0.0 instead of a actual number grade? * Grade Class * public class Grade { private String grade; public Grade(String getGrade) { grade = getGrade; } public double getNumericGrade() { double total = 0; double add = 0; String firstLetter = grade.substring(0, 1); if (grade.length() &gt; 1) { String minusOrPlus = grade.substring(1, 2); if(minusOrPlus == "+") add = 0.3; if(minusOrPlus == "-") add = -0.3; } if (firstLetter == "A") { total = 4; if (add &lt; 0) total = total + add; } else if (firstLetter == "B") total = 3 + add; else if (firstLetter == "C") total = 2 + add; else if (firstLetter == "D") total = 1 + add; else if (firstLetter == "F") total = 0; return total; } } Ive tested to see if my tester is wrong but if I put in the teachers code my tester works fine so I know it isnt that. But here it is anyway.. * GradeTester * import java.util.Scanner; public class GradeTester { public static void main (String[] args){ Scanner in = new Scanner(System.in); System.out.print("Hey what letter grade did you get ? : "); String letterGrade = in.next(); Grade x = new Grade(letterGrade); System.out.print("Your letter grade was " + letterGrade + " That means your number grade is " + x.getNumericGrade()); System.out.println(""); } } If you could help me out that would be awesome. Thanks, Nathan
has comment: http://stackoverflow.com/comment/34256559
duplicate of: http://stackoverflow.com/q/513832
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22513126
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has title: Code doesn't work when "using a different equals"
has comment: http://stackoverflow.com/comment/34254374
has comment: http://stackoverflow.com/comment/34254399
accepted answer: http://stackoverflow.com/a/22513126
score: 0
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/a/22554986
has comment: http://stackoverflow.com/comment/34455650
accepted answer of: http://stackoverflow.com/q/22554515
has comment: http://stackoverflow.com/comment/34329190
answers question: http://stackoverflow.com/q/22554515
score: 0
type: AcceptedAnswer
has body: You have to traverse xml backwards to reach root node. Using Node Node.getParentNode() method you can get parent node of the current node and apply same on parent node until you reach required node(Parent).
type: Answer
has comment: http://stackoverflow.com/comment/34437680

http://stackoverflow.com/a/22614805
has body: Use System.arraycopy(theDirectory, 0, newDirectory, 0, theDirectory.length).
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22614729
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34298586
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22537707
has text: @RudiKershaw An `if` statement is not a loop. It will only be entered so long as `first` is less than `last`. When it is entered, it will make a recursive call to the function. Eventually `first` will equal `last` and the `if` statement will not be entered effectively terminating the recursion for that initial call.

http://stackoverflow.com/q/22497305
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/34229817
has comment: http://stackoverflow.com/comment/34227282
type: Question
tagged with: hyperlink
score: 0
answer count: 1
has title: LinkedList test
has answer: http://stackoverflow.com/a/22500617
type: UnansweredQuestion
has body: public X get(int index) { if (index &gt;= 0) { Node&lt;X&gt; i = head; int c = 0; while (c &lt; index) { i = i.getLink(); c++; } return i.getValue(); } else { throw new ArrayIndexOutOfBoundsException(); } } . @Test public void testGet12() { LList&lt;String&gt; b = new LList&lt;String&gt;(); b.add("str1"); b.add("str2"); b.add("str3"); b.add("str4"); b.add("str5"); b.add("str6"); b.add("str7"); b.add("str8"); b.add("str9"); b.add("str10"); b.add("str11"); b.add("str12"); assertEquals("str8", b.get(7)); assertEquals("str12", b.get(11)); assertEquals("str1", b.get(0)); } It is saying that it's expecting str8, but is getting str5, why is my index off by 3? Am i missing something here? To me it seems when it doesnt reach the index it goes up one link until it finally reaches it then spits out the value.

http://stackoverflow.com/comment/34430013
type: AnswerComment
score: 0
type: Comment
has text: I'll let it be, and see how much negative votes this answer could fetch i.e how much wayward my answer to the question is.(Even though the OP has explicitly mentioned it). The answer to the question(as of now) is not within my knowledge. Hence, I didn't edit it.
comment on: http://stackoverflow.com/a/22603149

http://stackoverflow.com/q/22493247
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22493696
tagged with: casting
tagged with: types
answer count: 1
downvote count: 0
tagged with: generics
favorite count: 0
has body: So I have a Tuple2 class as follows: public final class Tuple2&lt;T1, T2&gt; { private final T1 mItem1; private final T2 mItem2; public T1 getItem1() { return mItem1; } public T2 getItem2() { return mItem2; } public Tuple2(final T1 pItem1, final T2 pItem2) { mItem1 = pItem1; mItem2 = pItem2; } public static &lt;TItem1, TItem2&gt; Tuple2&lt;TItem1, TItem2&gt; Create(final TItem1 pItem1, final TItem2 pItem2) { return new Tuple2&lt;&gt;(pItem1, pItem2); } } and I'm trying to instantiate a List of Tuple2s, but the type inference seems way weird. I would expect I could do something like this: // doesn't work // note that Type2 extends Type1, and Type3 extends Type2 final List&lt;Tuple2&lt;String, Class&lt;?&gt;&gt;&gt; list = Arrays.asList( Tuple2.Create("1", Type1.class), Tuple2.Create("2", Type2.class), Tuple2.Create("3", Type3.class) ); // still doesn't work final List&lt;Tuple2&lt;String, Class&lt;? extends Type1&gt;&gt;&gt; list = Arrays.asList( Tuple2.Create("1", Type1.class), Tuple2.Create("2", Type2.class), Tuple2.Create("3", Type3.class) ); Neither of these work if I cast to Class&lt;?&gt; or to Class&lt;? extends Type1&gt; either. What it requires me to do instead is: final List&lt;Tuple2&lt;String, ? extends Class&lt;? extends Type1&gt;&gt;&gt; list = Arrays.asList( Tuple2.Create("1", Type1.class), Tuple2.Create("2", Type2.class), Tuple2.Create("3", Type3.class) ); But then if I want to define a reference to one of these Tuple2s I have to write: final Tuple2&lt;String, ? extends Class&lt;? extends Type1&gt;&gt; item = list.get(0); That is one ugly type name... Is there a way to simplify this? Why does it have to be a Tuple2 "of something that extends Class of something that extends Type1", rather than simply "of Class of something"? The only simpler way I've found is using the Class raw type, which seems to be discouraged, and needs some casting: final List&lt;Tuple2&lt;String, Class&gt;&gt; list = Arrays.asList( Tuple2.Create("1", (Class)Type1.class), Tuple2.…
accepted answer: http://stackoverflow.com/a/22493696
has title: Type inference strangeness
linked to: http://stackoverflow.com/q/2745265
score: 1
tagged with: java
upvote count: 1
tagged with: type-inference
type: Question

http://stackoverflow.com/comment/34283737
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22529645
has text: You can just use [`Files.move`](http://download.java.net/jdk8/docs/api/java/nio/file/Files.html#move-java.nio.file.Path-java.nio.file.Path-java.nio.file.CopyOption...-) to move a file. If you have a directory this is very tricky for a number of reasons.

http://stackoverflow.com/comment/34391847
comment on: http://stackoverflow.com/a/22589203
has text: my dictionary has 235878 words.You suggest me to write regular expression for all these words?I didn't get you.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34413151
comment on: http://stackoverflow.com/a/22601990
score: 0
type: AnswerComment
type: Comment
has text: It will be just use for prevent network operation. You can't use it for live application

http://stackoverflow.com/comment/34432145
has text: @Elliott Frisch would do the same.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22612917
type: Comment

http://stackoverflow.com/q/22540216
upvote count: 2
answer count: 5
type: UnansweredQuestion
tagged with: local-variables
has answer: http://stackoverflow.com/a/22540267
has body: I'm trying to write a simple dice rolling game, where if the dice match, it's a win, if they are one number apart, it's a tie (junker), and if they satisfy neither of those conditions, it's a loss. I'm using a do while loop, and can't seem to get the local variables to initialize: import java.util.Scanner; public class Program06 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); String response = "k"; int d1 = 1; int d2; int win; int lose; int junker; System.out.println("Welcome to Computer Dice"); System.out.println("---------------------------"); System.out.println("\nYou will first roll your dice"); System.out.println("Next the outcome of your roll will be determined:"); System.out.println("Any pair and you Win"); System.out.println("Anything else and you Lose"); System.out.println("\n----------------------------"); System.out.println(); do { System.out.println("Player"); System.out.println("----------"); d1 = (int)(Math.random() * 6) + 1; d2 = (int)(Math.random() * 6) + 1; if (d1 == d2) ++win; else if (d1 == d2 +1 || d1 == d2 -1) ++junker; else ++lose; System.out.print("Do you wish to play again? [y, n]: "); response = stdIn.next(); } while (d1 == -1); stdIn.close(); } } I've tried inserting brackets with the if else statements but that hasn't helped.
has answer: http://stackoverflow.com/a/22540311
score: 2
has title: Local Variables will not initialize (Java)
tagged with: java
has answer: http://stackoverflow.com/a/22540312
type: Question
tagged with: do-while
downvote count: 0
has answer: http://stackoverflow.com/a/22540438
favorite count: 0
has answer: http://stackoverflow.com/a/22540303

http://stackoverflow.com/a/22630786
type: Answer
has body: Some basic checks: Was your project whitelisted by Google? Do you use the correct sender_id (project number)? Is network connection up? Are Google Play Services installed and up to date? One of the above checks should not be OK.
score: 0
answers question: http://stackoverflow.com/q/22584420

http://stackoverflow.com/q/22614269
score: 0
tagged with: eclipselink
has body: It's hard to put this into words, but I'll do my best. High Level: I am writing a web service to add a new PrblFldr entity to the database, but I need to associate the proper PrblTmplt with it (please ignore the terrible naming scheme, I didn't do it). I am POSTing JSON, which Jersey maps to the correct POJOs. But, instead of calling the POJO's constructor for one of the fields, I want it to use the EntityManager to find the correct object based on an ID. Low Level: Here's a sample of the JSON I am currently trying to pass to my web service: { fldrNm: "test", prblTmplt: { tmpltSeqId: 4 } } Here's the code on the other side, where the web service sits: @POST @Consumes(MediaType.APPLICATION_JSON) @Path("/folders/create") public Response createFolder(PrblFldr folder) { em.persist(folder); return Response.ok(gson.toJson(folder), MediaType.APPLICATION_JSON).build(); } Now, here's what the PrblFldr entity looks like, with a lot of irrelevant fields omitted: @Entity @Table(name="PRBL_FLDR") @NamedQuery(name="PrblFldr.findAll", query="SELECT p FROM PrblFldr p") public class PrblFldr implements Serializable { @Expose @Column(name="FLDR_NM") private String fldrNm; //bi-directional many-to-one association to PrblTmplt @Expose @ManyToOne @JoinColumn(name="FLDR_TYP_SEQ_ID", insertable=false, updatable=false) private PrblTmplt prblTmplt; // other fields... } See how that prblTmplt field is joined on FLDR_TYP_SEQ_ID? I need to get from that ID to the object. Lastly, here is what our PrblTmplt class looks like, again with only relevant information included: @Entity @Table(name="PRBL_TMPLT") @NamedQuery(name="PrblTmplt.findAll", query="SELECT p FROM PrblTmplt p") public class PrblTmplt implements Serializable { @Expose @SerializedName("id") @Id @Column(name="TMPLT_SEQ_ID") private long tmpltSeqId; // other fields... } The ultimate goal is to prevent the need for creating some intermediate POJO that Jersey maps to, only to turn right around to fill out the relevant fields in a new Pr…
answer count: 1
has answer: http://stackoverflow.com/a/22722322
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34442923
has comment: http://stackoverflow.com/comment/34447129
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34443024
has comment: http://stackoverflow.com/comment/34470380
has title: Can Jersey find a POJO from an ID when mapping from JSON?
type: Question
accepted answer: http://stackoverflow.com/a/22722322
tagged with: jersey
tagged with: jpa
has comment: http://stackoverflow.com/comment/34441336

http://stackoverflow.com/comment/34466132
score: 0
type: AnswerComment
has text: -1 for empty catch blocks. It should also be noted that you cannot just convert a `byte[]` of encrypted bytes into a `String`. The `byte[]` does not conform to any encoding. You have to use something like hex or base64 to store these bytes as a `String`.
comment on: http://stackoverflow.com/a/22620403
type: Comment

http://stackoverflow.com/comment/34481226
type: QuestionComment
has text: Could you point out a reference to this narrative. I suspect it applies to immutability which was not part of your question.
comment on: http://stackoverflow.com/q/22636153
score: 0
type: Comment

http://stackoverflow.com/comment/34447210
comment on: http://stackoverflow.com/q/22620909
has text: It would be really helpful to sketch two use-cases. Particularly how you intend to use the `setValues` method, how the board should internally access its `cells`, and what types `T` can be (when you say "Tree", do you mean a `TreeSet`? If it always is a `Collection`, then this is fairly trivial...)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34380435
has text: @AndrewThompson - I believe my edit is what you were asking for; the method being called simply creates a frame with some components. No other methods are called until one of several buttons are clicked in the created frame. I'm not sure where I could upload a file, unless you have a suggestion.
comment on: http://stackoverflow.com/q/22539651
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34455777
type: Comment
comment on: http://stackoverflow.com/q/22625824
type: QuestionComment
score: 1
has text: Does it need the user to press the Return key?

http://stackoverflow.com/q/22488364
tagged with: jsf
has title: How to navigate between pages in JSF using commandButton?
score: 0
tagged with: java
answer count: 1
type: UnansweredQuestion
has body: I have a list of Strings (in my case the names of Projects) displayed using JSF, with each String having a corresponding 'view' button created in JSF. When the user presses the view button, I want to navigate to a new page that shows a description for the project in question. This is achieved by passing the project_id through the method as shown below. I know how to navigate between JSF pages using faces-config by navigating based on the string returned (ie return "success"). The problem that I am having is that the method I am calling is already displaying a string (that is dynamic) in it's return type. As my method already displays a string, how do I configure this with JSF, so that I navigate to the appropriate page. The code below shows the problem more clearly. xhtml file: Past Projects <h:dataTable value="#{projectBean.projectList}" var="p" border="1"> <h:column> <f:facet name="header"> Project Name </f:facet> #{p.projectName} <h:commandButton id="viewProject" action="#{projectBean.displayProjectDetails(p.project_id)}" value="View"> </h:commandButton> </h:column> </h:dataTable> Java Class: public String displayProjectDetails(int id) { factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factory.createEntityManager(); em.getTransaction().begin(); Query myQuery = em.createQuery("SELECT p FROM Projects p WHERE p.project_id=:projectId"); myQuery.setParameter("projectId", id); List<Projects> currentProject=myQuery.getResultList(); em.getTransaction().commit(); em.close(); String projectName=currentProject.get(0).getProjectName(); String projectDescription=currentProject.get(0).getProjectDescription(); String output=(projectName+" "+projectDescription+" "); return output; } XML file: //Faces file output /projectDescription.xhtml
has answer: http://stackoverflow.com/a/22488624
type: Question

http://stackoverflow.com/comment/34508215
comment on: http://stackoverflow.com/q/22504389
has text: I'm stuck at this as well. Surprisingly, this is the only question I came across and it was asked just a week ago!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34444972
type: QuestionComment
comment on: http://stackoverflow.com/q/22619602
has text: @fge im actually trying to encrypt a String not and actual XML
score: 0
type: Comment

http://stackoverflow.com/comment/34464309
has text: +1 For a well formatted question with all required information provided.
comment on: http://stackoverflow.com/q/22629737
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34302176
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22539779
score: 1
has text: Can you post the full text of the error, including how you're trying to run it? You don't need the JDK to run a Java program, just the JRE.

http://stackoverflow.com/q/22607772
tagged with: java
has answer: http://stackoverflow.com/a/22607920
has answer: http://stackoverflow.com/a/31802532
type: Question
accepted answer: http://stackoverflow.com/a/31802532
score: 0
answer count: 2
tagged with: encryption
tagged with: aes
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22607920
has body: i try to decrypt a encrypted text and use this code but get this error to me: Exception in thread "main" java.security.InvalidKeyException: Illegal key size and decryption code is: String key = "ffce885876a617e7"; String vector = "9ee153a3df56965e7baf13a7fa1075cc"; IvParameterSpec ivSpec = new IvParameterSpec(key.getBytes()); SecretKeySpec keySpec = new SecretKeySpec(vector.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); //error occured in this line
has title: AES encryption error in java

http://stackoverflow.com/q/22606186
type: Question
has answer: http://stackoverflow.com/a/22625166
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34419946
has answer: http://stackoverflow.com/a/22606381
score: 0
answer count: 2
has body: Following mentioned are codes implemented. Please suggest me how to create the "overflow menu" option in action bar even if a phone have the hardware menu button? This is my current code: MainActivity.java public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.activity_main_actions, menu); return super.onCreateOptionsMenu(menu); } activity_main_actions.xml &lt;?xml version="1.0" encoding ="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;!-- Search --&gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="ifRoom"/&gt; &lt;!-- Email --&gt; &lt;item android:id="@+id/action_email" android:icon="@drawable/ic_action_email" android:title="@string/action_email" android:showAsAction="never"/&gt; &lt;!-- Help --&gt; &lt;item android:id="@+id/action_help" android:icon="@drawable/ic_action_help" android:title="@string/action_help" android:showAsAction="never"/&gt; &lt;!-- attach --&gt; &lt;item android:id="@+id/action_attach" android:icon="@drawable/ic_action_attachment" android:title="@string/action_attach" android:showAsAction="never" /&gt;
possible better answer: http://stackoverflow.com/a/22606381
has title: How to always show overflow menu (ActionBar) even if phone has hardware menu button?
tagged with: android
tagged with: android-actionbar
tagged with: menu
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/22625166
tagged with: java

http://stackoverflow.com/comment/34382852
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22584807
has text: @Andrew121007: Yep I found that already. However I'm curious about volley's comment "Oracle's SDK checks for == in both containsKey and remove. Android doesn't."
score: 0

http://stackoverflow.com/a/22601595
answers question: http://stackoverflow.com/q/22601477
score: 0
has body: If this program is intended to be running on all your machines for monitoring purposes, you should be running it as a service from your server's init system (systemd for most systems these days). You can use the Java Service Wrapper or jsvc or write your own init script.
type: Answer

http://stackoverflow.com/a/22540961
score: 2
accepted answer of: http://stackoverflow.com/q/22540168
answers question: http://stackoverflow.com/q/22540168
downvote count: 0
type: AcceptedAnswer
has body: Using the advice of Ashish and Dave Newton I looked for a jar containing junit/framework/Assert and found junit-4.4. Added this as a referenced library and it's fixed. Seems that the spring framework uses this. Thanks for your help guys.
upvote count: 2
type: Answer

http://stackoverflow.com/a/22548258
accepted answer of: http://stackoverflow.com/q/22548148
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The compiler may reorder/modify your code as it wishes, as long as the modified code is equivalent to the original if executed sequentially. So hoisting is allowed, but not required. This is an optimization and it is completely compiler specific. Variable declarations in C++ can be wherever you wish. In C they used to have to be on top in a context, but when the c99 standard was introduced, the rules were relaxed and now they can be wherever you want, similarly to c++. Still, many c programmers stick to putting them on top in a context. In your example, the compiler is free to move the if statements to the top, but I don't think it would. These variables are just pointers that are declared on stack and are un-initialized, the cost of declaring them is minimal, moreover it might be more efficient to create them at the beginning of the function, rather than after the asserts. If your declarations would involve any side-effects, for example struct node *a = some_function(); then compiler would be limited in what it can reorder. Edit: I checked GCC's loop hoisting in practice with this short program: #include &lt;stdio.h&gt; int main(int argc, char **argv) { int dummy = 2 * argc; int i = 1; while (i&lt;=10 &amp;&amp; dummy != 4) printf("%d\n", i++); return 0; } I've compiled it with this command: gcc -std=c99 -pedantic test.c -S -o test.asm This is the output: .file "test.c" .def ___main; .scl 2; .type 32; .endef .section .rdata,"dr" LC0: .ascii "%d\12\0" .text .globl _main .def _main; .scl 2; .type 32; .endef _main: LFB7: .cfi_startproc pushl %ebp .cfi_def_cfa_offset 8 .cfi_offset 5, -8 movl %esp, %ebp .cfi_def_cfa_register 5 andl $-16, %esp subl $32, %esp call ___main movl 8(%ebp), %eax addl %eax, %eax movl %eax, 24(%esp) movl $1, 28(%esp) jmp L2 L4: movl 28(%esp), %eax leal 1(%eax), %edx movl %edx, 28(%esp) movl %eax, 4(%esp) movl $LC0, (%esp) call _printf L2: cmpl $10, 28(%esp) jg L3 cmpl $4, 24(%esp) jne L4 L3: movl $0, %eax leave .cfi_restore 5 .cfi_def_cfa 4, 4 r…
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/22548148

http://stackoverflow.com/comment/34219343
score: 0
type: Comment
type: QuestionComment
has text: What package is the Application class located?
comment on: http://stackoverflow.com/q/22491638

http://stackoverflow.com/q/22537420
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22537936
has comment: http://stackoverflow.com/comment/34297814
downvote count: 2
has body: public Class&lt;?&gt;[] scriptLibraryReturnColumnTypes() { return QueryResultViewHelper.getClasses(); } I would want to know what to they mean by Class[]
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/22537936
type: Question
has title: public Class<?>[] scriptLibraryReturnColumnTypes()
score: -2

http://stackoverflow.com/q/22493535
has body: Im building a IRC Bot and came up with a Problem. Im trying to get the user list, check the amount of tickets each user has and if they got tickets they should be added to the raffle-list(Vector). Specially with this part i receive the Error: raffleuserlist.add(ticketquery.getUsers("#"+ownerchannel)[i].getNick()); Error: "Cannot invoke getUsers(String) on the primitive type int" Whole Code Snippet below. for(int i = 0; i &lt; this.getUsers("#"+ownerchannel).length; i++){ System.out.println("raffle-user&gt; "+this.getUsers("#"+ownerchannel)[i].getNick()); // User got tickets? Y= Add him to the list N= nothing ticketquery = MySQLAccess.gettickets(this.getUsers("#"+ownerchannel)[i].getNick()); if(ticketquery &gt;= 1){ raffleuserlist.add(ticketquery.getUsers("#"+ownerchannel)[i].getNick()); } } Did i do something wrong? Apreciate any help! :)
type: Question
has title: Cannot invoke getUsers(String) on the primitive type int
score: 0
has answer: http://stackoverflow.com/a/22493548
answer count: 1
accepted answer: http://stackoverflow.com/a/22493548
tagged with: irc
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/77976049
type: Answer
has body: I know you're talking about marginal optimization, but in terms of time complexity, it's worth noting that O(n!) and O((n−1)!/2) are asymptotically equivalent. To generate circular permutations while treating mirrored permutations as equivalent, you can leverage Satollo's algorithm: https://danluu.com/sattolo/ https://doi.org/10.1016/0020-0190(86)90073-6
answers question: http://stackoverflow.com/q/22587033
score: 0

http://stackoverflow.com/q/22503028
has title: Encrypt/Hash database Ids before sending to client side
has comment: http://stackoverflow.com/comment/34237635
has comment: http://stackoverflow.com/comment/34236845
answer count: 0
has comment: http://stackoverflow.com/comment/34237355
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34238730
has comment: http://stackoverflow.com/comment/34237492
has comment: http://stackoverflow.com/comment/34237018
has comment: http://stackoverflow.com/comment/34237831
tagged with: hash
type: Question
tagged with: encryption
has body: I have a requirement that lists of some objects to be displayed in the client side using table. And the user may edit or delete any of those objects. For that purpose I am using hidden database ids in the client side. But I think this is not appropriate if the user can guess the ids. Hence, what can be done to improve this mechanism? What should be the encryption/hash algorithm for this purpose?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34236448

http://stackoverflow.com/comment/34316661
score: 0
type: AnswerComment
has text: +1 for the custom ButtonModel, but overriding the setPressed() method causes the ActionListener not to work. Seems like all you need is to override the getPressed() method to return false to prevent the background from changing.
comment on: http://stackoverflow.com/a/22547218
type: Comment

http://stackoverflow.com/q/22549634
has body: I am using struts2-fullhibernatecore-plugin-2.2.2-GA.jar to inject a session in my DAO class like below: public class UserDAO { @SessionTarget Session session; @TransactionTarget Transaction transaction; public List<User> getUsers() { return session.createQuery("from user").list(); } } But I got java.lang.NullPointerException com.wudi.DAO.UserDAO.getUsers(UserDAO.java:28) com.wudi.action.UserListAction.execute(UserListAction.java:24) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) ... According to debugging output, session and transaction in the UserDAO are null. Some files for reference: User.java: @Entity @Table(name = "user") public class User implements Serializable { @Id @GeneratedValue private int id; @Column private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } UserListAction.java: public class UserListAction extends ActionSupport { private List<User> users; private UserDAO userDAO = new UserDAO(); @Override public String execute() throws Exception { users = userDAO.getUsers(); return SUCCESS; } } hibernate.cfg.xml: <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/sample?zeroDateTimeBehavior=convertToNull root 10 <mapping class="com.wudi.model.User" /> </hibernate-configuration>
accepted answer: http://stackoverflow.com/a/22566904
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
has answer: http://stackoverflow.com/a/22566904
has title: Struts + Hibernate: @SessionTarget not working
type: Question
upvote count: 2
answer count: 1
favorite count: 0
tagged with: struts2
tagged with: dao
downvote count: 0

http://stackoverflow.com/a/23341751
has comment: http://stackoverflow.com/comment/35744279
answers question: http://stackoverflow.com/q/22530949
type: Answer
score: -1
downvote count: 1
has body: The ordering of rows returned can't be guaranteed unless you specify "order by"; in databases other than oracle (and maybe oracle as well) and also hibernate. If an order-by clause can be supplied, you can then simply use the indexOf in returned collection. Assuming id and hashcode are set up as expected. For pagination with hibernate criteria, just use : criteria.setMaxResults(10); criteria.setFirstResult(20); And adjust the parameters accordingly ... the example returns 10 rows, starting at row 20. So in your example, whichever criteria query returned the id - use indexof on returned collection, then add that result to the setFirstResult() parameter, and you'll have the index of row in database. Or if you are not going to change from oracle, there is always a nativequery.
has comment: http://stackoverflow.com/comment/35826428
has comment: http://stackoverflow.com/comment/35824448
upvote count: 0
has comment: http://stackoverflow.com/comment/35822570
has comment: http://stackoverflow.com/comment/35824247

http://stackoverflow.com/q/22571135
type: Question
upvote count: 4
has body: I have to import a .key file into a Java keystore to decrypt a message. There are many instructions out there on how to do this (with openssl + keytool), but they all require a certificate file to be imported along with the key. If I create a self-signed certificate and add this, will I be able to decrypt the message? Why do I need a certificate for this in the first place? Is a key alone not sufficient for decryption?
has answer: http://stackoverflow.com/a/22573560
linked to: http://stackoverflow.com/q/22493997
tagged with: openssl
answer count: 1
downvote count: 0
tagged with: keytool
favorite count: 0
accepted answer: http://stackoverflow.com/a/22573560
score: 4
type: AnsweredQuestion
tagged with: java
tagged with: certificate
has title: Importing private key to keystore
has comment: http://stackoverflow.com/comment/34361284

http://stackoverflow.com/a/22496461
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22496268
score: 4
upvote count: 4
has body: Just use this PreparedStatement ps = conn.prepareStatement("select * from table_nm where Date1 BETWEEN ? AND ? "); ps.setDate( 1, startDate ); ps.setDate( 2, endDate ); ResultSet rs = ps.executeQuery(); while(rs.next()) { // your table values

http://stackoverflow.com/q/22595540
has title: java help, Total and Enter buttons in the class are not working, I tried to review the action listener for both buttons
tagged with: java
has body: /** This java class works as sales simulator, I have difficulty working the Total and the enter buttons, the problem is with the Total and Enter buttons, I cannot figure why these buttons are not working!! */ // Import applications from Java library import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.*; // Starting CashRegister class public class CashRegister extends JFrame { //initiate value double subtotal = 0.0; // stores subtotal of items purchased // JLabel and JTextField to enter amount private JLabel amountJLabel; private JTextField amountJTextField; // JButtons to enter numbers in amountJTextField private JButton oneJButton; private JButton twoJButton; private JButton threeJButton; private JButton fourJButton; private JButton fiveJButton; private JButton sixJButton; private JButton sevenJButton; private JButton eightJButton; private JButton nineJButton; private JButton zeroJButton; private JButton pointJButton; // JButton to add value in amountJTextField to subtotal private JButton enterJButton; // JButton to determine tax and calculate final total private JButton totalJButton; // JButton to delete value displayed in amountJTextField private JButton deleteJButton; // JButton to clear results private JButton clearJButton; // JLabel and JTextField to display subtotal private JLabel subtotalJLabel; private JTextField subtotalJTextField; // JLabel and JTextField to display tax private JLabel taxJLabel; private JTextField taxJTextField; // JLabel and JTextField to display final total private JLabel totalJLabel; private JTextField totalJTextField; // DecimalFormat to format dollar amounts private DecimalFormat dollars = new DecimalFormat( "$0.00" ); // no-argument constructor public CashRegister() { createUserInterface(); } // create and position GUI components; register event handlers private void createUserInterface() { // get content pane for attaching GUI components Container contentPane = getContentPane(); // enable explicit pos…
has comment: http://stackoverflow.com/comment/34401781
type: Question
has comment: http://stackoverflow.com/comment/34401569
answer count: 2
has answer: http://stackoverflow.com/a/22596076
tagged with: calculator
score: 0
has comment: http://stackoverflow.com/comment/34401229
has answer: http://stackoverflow.com/a/22596001
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/34401742
has comment: http://stackoverflow.com/comment/34401686
tagged with: jbutton

http://stackoverflow.com/comment/34391684
has text: what are you fighting for? Its just my mistake. I'm not angry on you.. I know my mistake and I admit it
comment on: http://stackoverflow.com/q/22590036
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/22542348
accepted answer: http://stackoverflow.com/a/22724230
upvote count: 2
score: 0
downvote count: 2
tagged with: sparql
type: AnsweredQuestion
tagged with: java
tagged with: protege
type: Question
tagged with: jena
favorite count: 0
has body: hey i'm new to semantic web,i see the terms like sparql,jena api,owl api,sparql dl,please explain the terms and what they do exactly like what does it mean by jena and sparql are they same are different api,what is the relation between them, i want to find the semantic distance between concepts,which of the above i could use to do this given an owl file what is difference between protege api and jena api role in it because while setting up protege why do i have jena jar file in it Its all so confusing,please help to answer these questions
tagged with: semantic-web
answer count: 1
has answer: http://stackoverflow.com/a/22724230
has title: querying the owl ontology

http://stackoverflow.com/a/22619296
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22619037
has body: If you're trying to define a "different layout" to your app when the orientation changes, just define a new layout give it the same name as your other layout and put it under res/layout-land. So that when your application recreates itself and calls setContentView(layout_name) within the onCreate function it will call the under res/layout-land and not the one under res/layout .

http://stackoverflow.com/comment/34398824
score: 0
type: AnswerComment
type: Comment
has text: Exactly.To set a particular letter (in this case the first letter of `anim` to `Anim`) before comparing it with the "original", take a look at [this](http://stackoverflow.com/questions/5725892/how-to-capitalize-the-first-letter-of-word-in-a-string-using-java) tutorial. because setting the entire string to upper or lower case won't make sense.
comment on: http://stackoverflow.com/a/22594115

http://stackoverflow.com/q/22643364
has answer: http://stackoverflow.com/a/22645206
accepted answer: http://stackoverflow.com/a/22645206
tagged with: hamcrest
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34492324
downvote count: 0
tagged with: unit-testing
possible better answer: http://stackoverflow.com/a/22643881
type: Question
has body: I have the following method invocation in my class under test: class ClassUnderTest { [...] restTemplate.getForEntity(url, MyResponseEntity.class, parameterMap); [...] } In the unit test of the class containing this line, I want to stub the getForEntity method such that it returns different responses for different entries in the parameterMap. Using BDDMockito, I'm trying to match that the desired parameter is part of the parameterMap by using argThat: @InjectMocks private ClassUnderTest classUnderTest; @Mock private RestTemplate restTemplate; [...] given(restTemplate.getForEntity(anyString(), any(Class.class), argThat(hasEntry("myKey", "myValue")) .willReturn(responseEntityA); However, if I run the test such that the parameterMap contains (I verified this in the debugger) a key "myKey" and a value "myValue", I get a NullPointerException, because mockito does not seem to be able to match the method call with the stub I created. On the other hand, using the following very general matching allows me run my tests without NPE, by providing a default response for all calls, however it does not allow me to define a custom response for a given parameter. given(restTemplate.getForEntity(anyString(), any(Class.class), anyMap()) .willReturn(defaultResponseEntity); What is the reason for this? Does argThat only work for methods with a single parameter? Is there another way to match calls of the getEntity with a map that contains a certain (key, value) pair?
tagged with: java
upvote count: 2
answer count: 2
tagged with: mockito
tagged with: junit
has answer: http://stackoverflow.com/a/22643881
favorite count: 0
has title: Does matching with argThat only work for methods with a single argument?

http://stackoverflow.com/q/22503287
favorite count: 0
has answer: http://stackoverflow.com/a/22503526
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: MediaPlayer and returning to current activity via Intent
accepted answer: http://stackoverflow.com/a/22503526
has body: I'm using MediPlayer to stream internet radio, and have a notification display in the notification center when the stream is playing. If I leave the app (i.e. via home button) and then return to the app with the notification (radio playing in background), I get a new activity where I am unable to then stop the music due to a new instance of MediaPlayer being created. Is there any way to either stop all MediaPlayer instances or return to the current (active) activity? @Override protected void onPause() { super.onPause(); } @Override protected void onResume() { if (player.isPlaying()) { buttonPlay.setEnabled(false); buttonStopPlay.setEnabled(true); } super.onResume(); } //Display notification in notification center public void showStatus () { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("RADIO") .setContentText("You're listening to RADIO"); Intent resultIntent= new Intent(this, MainActivity.class); resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( 0, PendingIntent.FLAG_UPDATE_CURRENT ); mBuilder.setContentIntent(resultPendingIntent); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(123, mBuilder.build()); }
upvote count: 1
tagged with: android
answer count: 1

http://stackoverflow.com/q/22517980
favorite count: 0
type: UnansweredQuestion
has body: I am currently an IT trainee and have a new issue to figure out, dealing with JMX. My company is using JManage because it contains an application cluster support, so that they can perform operations accross their Tomcat clusters. However, Jmanage is not maintained anymore, and they got dead nodes without knowing the reason. As some non Java users are also working with JManage, my mission is to find a JMX console web application which have a cluster support. I searched on the Internet and couldn't find something equivalent as JManage does. I found a lot of JConsole like JMinix, MC4J but it's not what my company expected. I didn't find documentation about Jolokia and clustering. As I want to make sure that any software already exits, I prefer ask everyone if you know a web app that I can use to replace JManage? If it is not the case, I have to try building a new software doing this. It will be my first software to develop, do you have any advice about how I can do it? Starting from JManage open source code and investigate what doesn't work? It will be helpful to have other points of views before starting! :) Thank you for your help!
tagged with: jmx
has answer: http://stackoverflow.com/a/23200709
score: 2
downvote count: 0
tagged with: java
tagged with: cluster-computing
type: Question
upvote count: 2
answer count: 1
has title: Cluster Management using JMX

http://stackoverflow.com/a/22635705
has comment: http://stackoverflow.com/comment/34472657
accepted answer of: http://stackoverflow.com/q/22634535
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The problem is that the xml parser is trying to access the schema file which is specified in the configuration file. Can the box, where you are running your program, access the internet? Here is some additional information: https://forum.hibernate.org/viewtopic.php?f=1&amp;t=949031
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22634535

http://stackoverflow.com/q/22595011
score: 1
tagged with: java
tagged with: noclassdeffounderror
upvote count: 1
has body: I get NoClassDefFoundError at jsoup library trying to run my project jar on other computer. I added jsoup as maven dependency, added in project settings-modules-dependencies, though I get same Exc. I run project via: java -classpath lostfilm-1.0.jar project.start.Entrance Please tell me where am I wrong. 4.0.0 lostfilm lostfilm 1.0 jar org.jsoup jsoup 1.7.3 commons-httpclient commons-httpclient 3.1 <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target>
type: Question
has answer: http://stackoverflow.com/a/22595112
has answer: http://stackoverflow.com/a/22595074
has comment: http://stackoverflow.com/comment/34400222
possible better answer: http://stackoverflow.com/a/22595112
has title: Jsoup NoClassDefFoundError
answer count: 2
tagged with: jsoup
downvote count: 0
has comment: http://stackoverflow.com/comment/34400263
favorite count: 0
has comment: http://stackoverflow.com/comment/34400501
accepted answer: http://stackoverflow.com/a/22595074
tagged with: maven
type: AnsweredQuestion

http://stackoverflow.com/comment/67793998
comment on: http://stackoverflow.com/a/22527057
type: Comment
score: 2
has text: There was another bug fixed in 3.2.10, so I'd recommend going with 3.2.16 or whatever is the latest. Here are the key Spring bugs that were fixed: [Metadata reading should never use ASM for java.* and javax.* types (in particular on JDK 8)](https://jira.spring.io/browse/SPR-11719) [Java 8: ASM5 visitors required for parsing INVOKESPECIAL/STATIC on interfaces](https://jira.spring.io/browse/SPR-11979)
type: AnswerComment

http://stackoverflow.com/comment/34360186
type: QuestionComment
has text: You could, or you could answer your own question.
comment on: http://stackoverflow.com/q/22572557
score: 1
type: Comment

http://stackoverflow.com/comment/34221156
score: 0
comment on: http://stackoverflow.com/q/22493562
type: Comment
type: QuestionComment
has text: @fge Date if im not mistaken 2013-03-19

http://stackoverflow.com/comment/34389192
comment on: http://stackoverflow.com/a/22583674
type: Comment
has text: Ok, I have edited the code. It was a mistake at delta. Not it is like this : double del= num2*num2-4*num1*num3 ; and i've also added a if loop:if (del>=0) { ... else { System.out.println("No solutions!");.For example when I select that: num1==1;num2==6;num3==9 it should appear that delta is 0 ,and x1=x2=-3 but I get that delta is 24 x1 is -8.4494... and x2 is -3.55051...
score: 0
type: AnswerComment

http://stackoverflow.com/comment/87626084
comment on: http://stackoverflow.com/a/22577274
type: Comment
score: 1
has text: one more case where u would use collect instead of reduce is when reduce operation involves adding elements to a collection, then every time your accumulator function processes an element, it creates a new collection that includes the element, which is inefficient.
type: AnswerComment

http://stackoverflow.com/comment/34372829
type: AnswerComment
type: Comment
score: 0
has text: +1 Thanks. I am going to accept the answer if it works.
comment on: http://stackoverflow.com/a/22579861

http://stackoverflow.com/comment/34454448
has text: Do you have the mysql connector in your libs folder?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22624971
type: QuestionComment

http://stackoverflow.com/comment/34465764
score: 0
comment on: http://stackoverflow.com/q/22629884
type: Comment
type: QuestionComment
has text: Why is `R` static? any use case?

http://stackoverflow.com/q/22573336
has answer: http://stackoverflow.com/a/22573490
has comment: http://stackoverflow.com/comment/34361639
tagged with: android-edittext
has title: Use a TextView to get a Contact from Address Book
tagged with: java
has comment: http://stackoverflow.com/comment/34361544
type: Question
score: 0
tagged with: contacts
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I'm very new to Android Dev and am having issues trying to get an editText to pull out one contact. I've created 3 editTexts that will take a contact each and will send a SMS to the selected contact(s). https://i.sstatic.net/fIEDH.jpg I've tried several things that I've found online, but they all crash and I don't really understand what I'm doing. I know that I have to create a onClickListener(): contact.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub } }); The other question that I have is, since I need to select one contact per EditText, do I have to copy the same code for the three EditTexts? After the contact is selected I would like to display just the name of the contact. Any help would be appreciated!

http://stackoverflow.com/q/22597046
type: UnansweredQuestion
tagged with: netty
answer count: 0
tagged with: java
has title: ResourceLeak turned on paranoid level got some netty leak stack traces
has comment: http://stackoverflow.com/comment/34410021
type: Question
has comment: http://stackoverflow.com/comment/34407003
tagged with: nio
score: 0
has comment: http://stackoverflow.com/comment/34443762
has comment: http://stackoverflow.com/comment/34441998
has comment: http://stackoverflow.com/comment/34963131
has body: When running the new 4.1.0.Alpha1 netty with my version HTTP server with ResourceLeak level set to "paranoid" and stress testing with Jmeter, I found there are some potential leaks ALL happening in netty codes - none of my HTTP server codes. Not sure where are the leaks in the following netty stack traces: #4: io.netty.buffer.AdvancedLeakAwareByteBuf.release(AdvancedLeakAwareByteBuf.java:721) io.netty.handler.codec.http.DefaultHttpContent.release(DefaultHttpContent.java:84) io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:93) io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:91) io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83) io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153) io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:186) io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83) io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153) io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:186) io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:254) io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83) io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153) io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:186) io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:155) io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:83) io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoke…

http://stackoverflow.com/a/22546857
answers question: http://stackoverflow.com/q/22541986
has comment: http://stackoverflow.com/comment/34358155
has comment: http://stackoverflow.com/comment/34349905
upvote count: 1
has comment: http://stackoverflow.com/comment/34353788
has comment: http://stackoverflow.com/comment/34327206
downvote count: 0
has comment: http://stackoverflow.com/comment/34350575
has comment: http://stackoverflow.com/comment/34347683
type: Answer
has comment: http://stackoverflow.com/comment/34343534
score: 1
has body: You can use the DialogFragment. What you need to change is your MyCustomDialog.class to extend DialogFragment and the responsability of create the listview and the adapter will be of your dialog too. Something like this (my example is more simple, but I think will help to understand). protected void showMyCustomDialog(){ MyCustomDialog newFragment = new MyCustomDialog(); newFragment.show(getFragmentManager()); } protected class MyCustomDialog extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout View view = inflater.inflate(R.layout.my_layout, null); // now you customize your view! //... builder.setView(view); return builder.create(); } }

http://stackoverflow.com/comment/34366754
has text: This will work for Frame not for lable what if there are more than one lable???No use of this...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22576386
type: AnswerComment

http://stackoverflow.com/q/22513050
has comment: http://stackoverflow.com/comment/34254385
tagged with: java
tagged with: eclipse
type: Question
has title: 0 references in workspace for method that I KNOW is being called
has comment: http://stackoverflow.com/comment/34255199
has comment: http://stackoverflow.com/comment/34254526
has body: I am trying to find references of a particular subclass method that is being called in my webapp, but the search is returning 0 results. I know for a fact that the method is being called because I have added System.out.println statements inside the method. I have also tried to add a breakpoint and use the debugger but it is not helpful either since the method calls in the thread seem to be low-level and then all of a sudden call the method in question. The stacktrace in the debug view is: MyClass.myMethod() line: 144 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 BeanELResolver.getValue(ELContext, Object, Object) line: 363 FacesCompositeELResolver(CompositeELResolver).getValue(ELContext, Object, Object) line: 188 FacesCompositeELResolver.getValue(ELContext, Object, Object) line: 171 AstValue.getValue(Object, Node, EvaluationContext) line: 138 AstValue.getValue(EvaluationContext) line: 183 ValueExpressionImpl.getValue(ELContext) line: 224 _DeltaStateHelper.eval(Serializable) line: 246
upvote count: 3
has comment: http://stackoverflow.com/comment/34254653
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22513422
accepted answer: http://stackoverflow.com/a/22513422
has comment: http://stackoverflow.com/comment/34254468
favorite count: 0
has comment: http://stackoverflow.com/comment/34254471
tagged with: web-applications
has comment: http://stackoverflow.com/comment/34254373
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/22530978
has body: How do I get the next date(2014/03/21) given the current date(2014/03/20) in Java? Code: public static String getNextDate(String curDate) { String nextDate=""; try { //here logic to get nextDate } catch (Exception e) { return nextDate; } return nextDate; }
tagged with: date
has comment: http://stackoverflow.com/comment/34286009
downvote count: 0
duplicate of: http://stackoverflow.com/q/428918
has answer: http://stackoverflow.com/a/22531197
has answer: http://stackoverflow.com/a/22531543
has comment: http://stackoverflow.com/comment/34286081
has comment: http://stackoverflow.com/comment/34286017
favorite count: 0
linked to: http://stackoverflow.com/q/428918
has answer: http://stackoverflow.com/a/22531573
has comment: http://stackoverflow.com/comment/34286038
answer count: 4
type: AnsweredQuestion
has title: How get next date by passing current Date in java
upvote count: 3
has answer: http://stackoverflow.com/a/22531179
accepted answer: http://stackoverflow.com/a/22531179
possible better answer: http://stackoverflow.com/a/22531197
type: Question
has comment: http://stackoverflow.com/comment/34286072
score: 3
tagged with: java

http://stackoverflow.com/comment/34448059
score: 0
has text: What are you trying to do? I don't get a clear picture based on what you've posted in your question.
comment on: http://stackoverflow.com/q/22620807
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22553535
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22552614
accepted answer of: http://stackoverflow.com/q/22552614
type: Answer
has comment: http://stackoverflow.com/comment/34348364
upvote count: 1
has comment: http://stackoverflow.com/comment/34338398
score: 1
has body: The Servlet specification does allow containers to unload Servlets at any point although they don't have to do this (Tomcat doesn't for example). You are unlikely to hit a problem but if Quartz is used by components other than the Servlet that starts it them it really belongs to the application not the Servlet and should be configured at that level. Generally, it is better to start and stop Quartz with a ServletContextListener than with a Servlet.

http://stackoverflow.com/comment/34282498
type: Comment
type: AnswerComment
has text: so what value will be returned if nothing is found?
comment on: http://stackoverflow.com/a/22528889
score: 0

http://stackoverflow.com/q/22564552
has answer: http://stackoverflow.com/a/22623454
tagged with: java
has comment: http://stackoverflow.com/comment/34346254
has body: I've been trying to figure out how to read a HttpURLConnection. According to this example: http://www.vogella.com/tutorials/AndroidNetworking/article.html , the following code should work. However, readStream never fires, and I'm not logging any lines. I do get that the InputStream is passed through the buffer and all, but for me the logic breaks down in the readStream method, and then mostly the empty string 'line' and the while statement. What exactly is happening there / should happen there, and how would I be able to fix it? Also, why do I have to create the url in the Try statement? It gives back a Unhandled Exception; java.net.MalformedURLException. Thanks in advance! static String SendURL(){ try { URL url = new URL("http://www.google.com/"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); readStream (con.getInputStream()); } catch (Exception e) { e.printStackTrace(); } return ("Done"); } static void readStream(InputStream in) { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(in)); String line = ""; while ((line = reader.readLine()) != null) { Log.i("Tag", line); } } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } }
has answer: http://stackoverflow.com/a/22564791
type: AnsweredQuestion
tagged with: inputstreamreader
tagged with: bufferedreader
accepted answer: http://stackoverflow.com/a/22623454
possible better answer: http://stackoverflow.com/a/22564791
type: Question
tagged with: android
tagged with: httpurlconnection
has title: Reading HttpURLConnection
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34347134

http://stackoverflow.com/a/22519009
has comment: http://stackoverflow.com/comment/34265797
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34265386
has body: There is an implicit mapping between primitives and objects, so an int can be used where an Integer is expected. It is a feature called autoboxing. For example: Integer foo = 4; // 4 is really an int Also, primitives have things in common with objects. They have a Class, such as int.class. It should also be noted that all arrays are objects. However, the notion of Object vs primitive is one of the worst thing there is in Java. A lot of modern languages simply don't make too much difference between them, or even don't have any primitives. (In java as well, you can do everything without ever using explicitly a primitive).
answers question: http://stackoverflow.com/q/22518907
downvote count: 0
has comment: http://stackoverflow.com/comment/34265970

http://stackoverflow.com/q/22566189
has comment: http://stackoverflow.com/comment/34348086
has body: When running this code case 6 is being skipped and sent to the catch statement. The user is supposed to enter his/her in put all on one line ( Ex. 6 4 10 ENTER) and then the numbers are supposed to be split by the StringTokenizer and then added in the while statement, But instead is sent to the catch printing the statement. Included below is my consoleReader class to explain what it does and what exceptions are thrown by it, as well as my case 6 from my program. case 6: System.out.println("Enter your numbers all on one line then press enter"); String pnum = console.readLine(); StringTokenizer tokenizer = new StringTokenizer(pnum); double sum = 0; while(tokenizer.hasMoreTokens()){ double num = Double.parseDouble(pnum); sum = num + num; } mathOut = String.valueOf(sum); break; } }catch(NumberFormatException e){ System.out.println("Your number was incorrect, please try again, enter \"E\" to exit or enter to continue."); String continueOrQuit = console.readLine(); if(continueOrQuit.equalsIgnoreCase("e")){ done = true; }else{ done = false; } ConsoleReader: import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; /** A class to read strings and numbers from an input stream. This class is suitable for beginning Java programmers. It constructs the necessary buffered reader, handles I/O exceptions, and converts strings to numbers. */ public class ConsoleReader { /** Constructs a console reader from an input stream such as System.in @param inStream an input stream */ public ConsoleReader(InputStream inStream) { reader = new BufferedReader (new InputStreamReader(inStream)); } /** Reads a line of input and converts it into an integer. The input line must contain nothing but an integer. Not even added white space is allowed. @return the integer that the user typed */ public int readInt() { String inputString = readLine(); int n = Integer.parseInt(inputString); return n; } /** Reads a line of input and converts it int…
has title: Case being skipped and sent to catch?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34348106
tagged with: tokenize
score: 1
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34348119
tagged with: java
has comment: http://stackoverflow.com/comment/34348070
has answer: http://stackoverflow.com/a/22566335
has comment: http://stackoverflow.com/comment/34348055
has comment: http://stackoverflow.com/comment/34348148
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/22566335

http://stackoverflow.com/q/22561041
score: 0
linked to: http://stackoverflow.com/q/5161951
answer count: 1
has comment: http://stackoverflow.com/comment/34338872
duplicate of: http://stackoverflow.com/q/5161951
has comment: http://stackoverflow.com/comment/34341250
tagged with: timer
tagged with: multithreading
tagged with: android
has answer: http://stackoverflow.com/a/22561455
has body: I have done quit a bit of my first android game already and it works good. Now I need to make the screen refresh like every second so my counter in game refreshes. Doing a timer gives this problem: Only the original thread that created a view hierarchy can touch its views. I've searched stackoverflow and the solution is to create a runnable. I don't know how that works. I create one and then the program breaks because context doesn't work in runnable error: constructor DrawGame in class DrawGame cannot be applied to given types; required: Context found: no arguments reason: actual and formal argument lists differ in length What can I do? Why would I need a runnable. My game is a simple chess type game. Tried to do it like this: public class DrawGame extends View implements OnTouchListener { Timer turnTimer = new Timer("timeLeft", false); TimerTask countDown = new TimerTask() { @Override public void run() { invalidate(); } }; public DrawGame(Context context){ super(context); Turns.turnTimeCounter(); Turns.yourTurn(); turnTimer.scheduleAtFixedRate(countDown, 1000, 1000 ); } @Override public void onDraw(Canvas canvas){ //lot of code }
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/12850143
has comment: http://stackoverflow.com/comment/34338613
has title: Only the original thread that created a view hierarchy can touch its views. No runnable
type: Question
has comment: http://stackoverflow.com/comment/34338589
has comment: http://stackoverflow.com/comment/34338548
accepted answer: http://stackoverflow.com/a/22561455
has comment: http://stackoverflow.com/comment/34338455

http://stackoverflow.com/comment/34411313
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22600981
type: Comment
has text: I don't think the concept of callbacks addresses the OP's question. The issue in the OP is about API clutter and the maintenance / readability issues that result. Callbacks are more about structuring logical flow of control under particular circumstances.

http://stackoverflow.com/comment/34306762
has text: @chrylis Not as far as I know. You have to write your own, which isn't particularly hard with `TypeAdapter`.
comment on: http://stackoverflow.com/a/22542141
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22521848
type: Question
answer count: 1
has body: How can I take an ArrayList and turn it sqlite approved? I tried the following two methods and neither work, but one works for longs: Method 1: Arrays.deepToString(ids.toArray()).replace("[", "(").replace("]", ")"); Method 2: Arrays.toString(ids.toArray()).replace("[", "(").replace("]", ")");
tagged with: arraylist
score: 0
tagged with: android
tagged with: sqlite
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22521886
has title: how to stringify an ArrayList<String> to do a sqlite query?
tagged with: java

http://stackoverflow.com/q/22634636
has body: I have just realised that I have problems with understanding one of the most basic principle in programming languages and that is how to figure out how an "if" statement will execute given some boolean values and operators like &amp;, &amp;&amp;, |, || without enclosing them in brackets. I was wondering if someone could show me ho to figure out how the JVM looks at the following "if" statement. if( true || false &amp; true &amp;&amp; false | false ) ; Im not interested in the resulting boolean value but rather how the above "if" statement would look like if enclosed in brackets.
has answer: http://stackoverflow.com/a/22634881
has comment: http://stackoverflow.com/comment/34470478
favorite count: 0
has answer: http://stackoverflow.com/a/22634779
has title: How to read the following "if" statement and what is the rule to determine the precedence in JAVA?
answer count: 5
has answer: http://stackoverflow.com/a/22635022
accepted answer: http://stackoverflow.com/a/22635022
has answer: http://stackoverflow.com/a/22634817
possible better answer: http://stackoverflow.com/a/22634862
has answer: http://stackoverflow.com/a/22634862
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34470634
type: Question
tagged with: if-statement
has comment: http://stackoverflow.com/comment/34470636
upvote count: 2
score: 0
downvote count: 2

http://stackoverflow.com/a/22648493
has body: ... My app is written in Java and there is no compatible type for SecureString in Java ... Can anyone help me with how to overcome this interoperability issue? As you know, there is no SecureString in Java. In Java, you are supposed to use char[] and overwrite the material when you are finished with it. From Using Password-Based Encryption in the Java Cryptography Extension (JCE) Reference Guide: It would seem logical to collect and store the password in an object of type java.lang.String. However, here's the caveat: Objects of type String are immutable, i.e., there are no methods defined that allow you to change (overwrite) or zero out the contents of a String after usage. This feature makes String objects unsuitable for storing security sensitive information such as user passwords. You should always collect and store security sensitive information in a char array instead. So your SecureString will have a private char[], and you will zeroize the array on destruction. I believe .Net's SecureString masks the string when not in use (I don't believe its true encryption, but I could be wrong). So you'll need to provide a mask function, too.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/91352835
upvote count: 2
has comment: http://stackoverflow.com/comment/34498979
has comment: http://stackoverflow.com/comment/34498672
has comment: http://stackoverflow.com/comment/81278847
has comment: http://stackoverflow.com/comment/40174926
has comment: http://stackoverflow.com/comment/46307807
downvote count: 0
answers question: http://stackoverflow.com/q/22645382

http://stackoverflow.com/comment/34491190
has text: possible duplicate of [Difference between minutes](http://stackoverflow.com/questions/7501311/difference-between-minutes)
type: QuestionComment
comment on: http://stackoverflow.com/q/22645787
type: Comment
score: 0

http://stackoverflow.com/q/22638206
has comment: http://stackoverflow.com/comment/34484661
has comment: http://stackoverflow.com/comment/34497457
has comment: http://stackoverflow.com/comment/34479517
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34478640
has comment: http://stackoverflow.com/comment/34497531
has comment: http://stackoverflow.com/comment/34479801
type: Question
has title: Animating smoothly in android surfaceview
linked to: http://stackoverflow.com/q/21838523
has comment: http://stackoverflow.com/comment/34488261
has body: I have created a Tetris game on android and I don't think the animation is as good as it could be. When blocks are moving fast (100ms between the ticks), it's a pretty obvious flicker in the animation, as if there's a very short moment where you can see traces of the previous position of the moving block. Here is the animation loop, implemented in a separate thread as an extension of SurfaceView: public void run() { while(running) { if(surfaceHolder.getSurface().isValid()) { sleep(1); canvas = surfaceHolder.lockCanvas(); canvas.drawColor(Color.BLACK); //reset canvas int width = canvas.getWidth(); int squareSpaceW = (width/4)*3; int squareSize = squareSpaceW/10; squareSpaceW = squareSize*10; int squareSpaceH = squareSpaceW*2; //Draw lines on the play field canvas.drawLine(squareSpaceW, 0, squareSpaceW, squareSpaceH, whitePaint); canvas.drawLine(0, squareSpaceH, squareSpaceW, squareSpaceH, whitePaint); //draw next piece int nxtPieceSize = board.getNextPiece().getBlocks().size() -1; while(nxtPieceSize &gt;= 0) { rectPaint.setColor(Color.parseColor(board.getNextPiece().getBlocks().get(nxtPieceSize).getColor())); int x = board.getNextPiece().getCoordList().get(nxtPieceSize).getX(); int y = board.getNextPiece().getCoordList().get(nxtPieceSize).getY(); nxtPieceSize--; rect.set(x*(squareSize/2) + (squareSpaceW/17)*16, y*(squareSize/2) + (squareSize/2), x*(squareSize/2) + (squareSize/2) + (squareSpaceW/17)*16, y*(squareSize/2)+ (squareSize/2) + (squareSize/2)); canvas.drawRect(rect, rectPaint); } //draw text canvas.drawText("Score: " + Integer.toString(board.getScore()), width - (width/8), (width/8) + (squareSize), whitePaint); canvas.drawText("Level: " + Integer.toString(board.getLevel()), width - (width/8), (width/8) + (squareSize*2), whitePaint); //draw the blocks for(int x = 0; x &lt; board.getWidth(); x++) { for(int y = 0; y &lt; board.getHeight(); y++) { tempBlock = board.getBlock(x, y); if(tempBlock != null) { rectPaint.setColor(Color.parseColor(tempBlock.getColor()))…
downvote count: 0
tagged with: surfaceview
has comment: http://stackoverflow.com/comment/34478149
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/34484477
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34480365
tagged with: android
tagged with: animation
upvote count: 1

http://stackoverflow.com/q/22536755
has comment: http://stackoverflow.com/comment/34299866
tagged with: scene2d
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34300759
upvote count: 12
tagged with: libgdx
tagged with: game-engine
linked to: http://stackoverflow.com/q/18200669
has body: I am learning libgdx but i am stuck at a point.. I have added a button in my stage , now i want to add a image in the stage so that the image looks as the background image to the button.i mean to say that the button should lie on the image. I have been looking tutorials but not been able to do that. How can it be done? any help?
downvote count: 0
has answer: http://stackoverflow.com/a/26717500
has comment: http://stackoverflow.com/comment/72886592
score: 12
answer count: 3
has title: libgdx - how to add background image in stage?
has answer: http://stackoverflow.com/a/36111006
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27495633

http://stackoverflow.com/comment/125016300
score: 0
type: Comment
has text: This solution was provided on Wikitechy.com and is the one that worked for me (app that uses BouncyCastle)
comment on: http://stackoverflow.com/a/38061710
type: AnswerComment

http://stackoverflow.com/comment/34426160
type: Comment
comment on: http://stackoverflow.com/a/22609314
score: 0
type: AnswerComment
has text: try with many options on `javac` or `jar` but that won't work: `javac doesn't support the nested "copy" element.` EDIT: Wait, found an logical error :)

http://stackoverflow.com/q/22612531
answer count: 3
has comment: http://stackoverflow.com/comment/34431907
possible better answer: http://stackoverflow.com/a/22612686
has answer: http://stackoverflow.com/a/22612686
has answer: http://stackoverflow.com/a/22613112
has body: I want to show Image on Panel by press Button. I create some code JButton btnNewButton = new JButton("next"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(i&lt;files1.length){ BufferedImage bi; try { bi = ImageIO.read(new File(""+files1[i])); System.out.println(files1[i]); JLabel label = new JLabel(new ImageIcon(bi)); panel_1.add(label); panel_1.repaint(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else System.out.println("end of picture"); i++; } }); But after click button image doesn't show.
has answer: http://stackoverflow.com/a/22615192
upvote count: 1
tagged with: swing
tagged with: jbutton
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22615192
has title: How to show Image in Panel using button press action
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/22567404
has comment: http://stackoverflow.com/comment/34350631
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34350574
tagged with: android
has title: Android: NullPointerException creating new Intent
has comment: http://stackoverflow.com/comment/34350414
has answer: http://stackoverflow.com/a/22567576
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34350370
has body: I always get a Nullpointer Exception when creating a new Intent Object. My intention is to create a new Activity which opens a new View with its "onCreate" method. This is my Main Activity: public class MainActivity extends Activity { public void activateTimer(){ // some code .... MyTimer timer = new MyTimer(MainActivity.this); } } This is my Timer Class: public class MyTimer extends MainActivity{ private Context contextMain; public MyTimer(Context context){ this.contextMain = context; // some more code ... openMyActivity(contextMain); } public void openMyActivity(Context contextMain){ // some code ... // The next line throws the NPE! Intent intent = new Intent(contextMain, MyNotificationActivity.class); this.startActivity(intent); } } My Activity which should be created: public class MyNotificationActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.notification); } } Here is the error log: 03-21 12:47:51.949: W/dalvikvm(2442): threadid=11: thread exiting with uncaught exception (group=0x41465700) 03-21 12:47:51.959: E/AndroidRuntime(2442): FATAL EXCEPTION: Timer-0 03-21 12:47:51.959: E/AndroidRuntime(2442): java.lang.NullPointerException 03-21 12:47:51.959: E/AndroidRuntime(2442): at android.app.Activity.startActivityForResult(Activity.java:3390) 03-21 12:47:51.959: E/AndroidRuntime(2442): at android.app.Activity.startActivityForResult(Activity.java:3351) 03-21 12:47:51.959: E/AndroidRuntime(2442): at android.app.Activity.startActivity(Activity.java:3587) 03-21 12:47:51.959: E/AndroidRuntime(2442): at android.app.Activity.startActivity(Activity.java:3555) 03-21 12:47:51.959: E/AndroidRuntime(2442): at com.myApp.MyTimer.openNotificationInMain(MyTimer.java:135) 03-21 12:47:51.959: E/AndroidRuntime(2442): at com.myApp.MyTimer.prompt(MyTimer.java:80) 03-21 12:47:51.959: E/AndroidRuntime(2442): at com.myApp.MyTimer$1.run(MyTimer.java:38) 03-21 12:47:51.959: E/AndroidRuntime(2…
possible better answer: http://stackoverflow.com/a/22567576
tagged with: java
has answer: http://stackoverflow.com/a/22567546
has comment: http://stackoverflow.com/comment/34350333
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34350493
accepted answer: http://stackoverflow.com/a/22567546

http://stackoverflow.com/q/22590872
has comment: http://stackoverflow.com/comment/34393405
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34393753
type: Question
has title: Using lejos for NXT with Linux
score: 0
tagged with: lego-mindstorms
has body: I have a Mindstorms NXT and only could flash it with sudo right? So now I want to upload a test program, but: Initializing LeJOS JDK at /opt/lukas/lejos Linking ... Program has been linked successfully Uploading ... leJOS NXJ&gt; Failed to find any NXTs leJOS NXJ&gt; Failed to connect to any NXT No NXT found - is it switched on and plugged in (for USB)? uploading the program failed with exit status 1 I use eclipse an d the eclipse plugin. The NXT is turned on and also connected via USB, I think there are a few permission problems. Do you have any ideas?
tagged with: linux
tagged with: nxt
type: UnansweredQuestion
tagged with: lejos-nxj

http://stackoverflow.com/a/22596089
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22596022
type: Answer
score: 2
upvote count: 2
has body: Use a Map&lt;String, String&gt;. And use Files.readAllLines(): final Map&lt;String, String&gt; entries = new HashMap&lt;&gt;(); final Path dict = Paths.get("dictionaryTXT.txt"); String[] array; for (final String line: Files.readAllLines(dict, StandardCharsets.UTF_8)) { array = lines.split("\\s*:\\s*"); entrues.put(array[0], array[1]); } Then to search for a word: final String description = entries.get(input); if (description == null) System.out.println("not found"); else System.out.println("definition: " + description); Of course, if your dictionary is extra large, you'll want to use Files.newBufferedReader() instead and read line by line. Also, the code above lacks basic error checking; exercise left to the reader
answers question: http://stackoverflow.com/q/22596022
type: AcceptedAnswer

http://stackoverflow.com/comment/34406953
comment on: http://stackoverflow.com/a/22598355
score: 0
type: AnswerComment
has text: The method should be a method of the `StackOverflow_Image_Resource_Demo` class, just like `initialize`, expect it should be `public`. You would then only call this from within the context of the EDT
type: Comment

http://stackoverflow.com/a/22630751
answers question: http://stackoverflow.com/q/22630398
has body: You have an error in the first method where you define s outside the scope which you return it from. In the second method you return inside the loop. As others in this thread suggests, use an IDE like Eclipse (https://www.eclipse.org/) or IntelliJ (http://www.jetbrains.com/idea/) import java.util.Scanner; public class AssignmentQ7 { public static int recursivesum(int n, int m) { int s = n; if (n &lt; m) { s += recursivesum(n + 2, m); } else { if (m &lt; n) { s = m; s += recursivesum(m + 2, n); } } return s; } public static int iterativesum(int n, int m) { int s = 0; if (n &lt; m) { for (int i = n; i &lt;= m; i += 2) { s += i; } } else if (m &lt; n) { for (int i = m; i &lt;= n; i += 2) { s += i; } } return s; } public static void main(String args[]) { int n, m; Scanner in = new Scanner(System.in); System.out.println("Enter two numbers: "); n = in.nextInt(); m = in.nextInt(); while (n % 2 == 0) { System.out.println("Enter the first number again: "); n = in.nextInt(); } while (m % 2 == 0) { System.out.println("Enter the second number again: "); m = in.nextInt(); } System.out.println("The answer of the recursive sum is: " + recursivesum(n, m)); System.out.println("The answer of the iterative sum is: " + iterativesum(n, m)); } }
score: 0
type: Answer

http://stackoverflow.com/comment/34270113
score: 0
type: Comment
has text: Your link doesn't contain the word "auxiliary" anywhere in it. Did you link to the wrong place? If this is what you intended to link to, how do you know that this is what's meant by auxiliary in the OP's question?
comment on: http://stackoverflow.com/a/22521705
type: AnswerComment

http://stackoverflow.com/comment/34288984
comment on: http://stackoverflow.com/q/22532364
score: 0
has text: You can always specify your own date format and pass it to GsonBuilder instance.
type: Comment
type: QuestionComment

apache-commons
tags question: http://stackoverflow.com/q/22545116
tag name: apache-commons
tags question: http://stackoverflow.com/q/22608827
type: Tag

http://stackoverflow.com/comment/34488445
type: QuestionComment
comment on: http://stackoverflow.com/q/22644474
score: 0
has text: Java is not C... what are you really asking? And, your code is not valid.
type: Comment

http://stackoverflow.com/comment/34212019
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22488479
has text: Create a test with each of these methods, print something inside, execute the test, and see by yourself. Or read the documentation (gasp!): http://junit.sourceforge.net/javadoc/
type: Comment

http://stackoverflow.com/a/22555218
has comment: http://stackoverflow.com/comment/34328664
score: 0
has comment: http://stackoverflow.com/comment/34330551
has comment: http://stackoverflow.com/comment/34329185
has comment: http://stackoverflow.com/comment/34328855
has comment: http://stackoverflow.com/comment/34329778
answers question: http://stackoverflow.com/q/22555058
has comment: http://stackoverflow.com/comment/34328389
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34330767
has comment: http://stackoverflow.com/comment/34328511
has comment: http://stackoverflow.com/comment/34330436
accepted answer of: http://stackoverflow.com/q/22555058
has comment: http://stackoverflow.com/comment/34330834
has comment: http://stackoverflow.com/comment/34330334
has body: Since you say that you use Spring Integration, your gateway interface should have 'implementation' - &lt;gateway&gt; Something like this: &lt;gateway id="testGateway" service-interface="com.my.proj.TestGateway" default-request-channel="gatewayChannel"/&gt;
type: Answer
has comment: http://stackoverflow.com/comment/34331236

http://stackoverflow.com/comment/34460068
has text: A link with an example would be appreciated.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22628321

http://stackoverflow.com/comment/107164027
has text: also see "Streams in Java 8: Reduce vs. Collect" by Angelika Langer - https://www.youtube.com/watch?v=oWlWEKNM5Aw
comment on: http://stackoverflow.com/q/22577197
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22570400
score: 2
has comment: http://stackoverflow.com/comment/34431888
downvote count: 0
has body: On OpenNTF there is OpenNTF Essentials. It contains everything that you need to handle word documents. Try to use that. You might run foul of security or logging. Reuse what is there already.
accepted answer of: http://stackoverflow.com/q/22563609
upvote count: 2
answers question: http://stackoverflow.com/q/22563609
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34464800

http://stackoverflow.com/q/22508869
favorite count: 0
has answer: http://stackoverflow.com/a/23620443
tagged with: serialization
has comment: http://stackoverflow.com/comment/42548818
has body: I have trained libsvm model on weka and then I saved the model. Now I want to use this model in java. Classifier cls = (Classifier)weka.core.SerializationHelper.read(this.modelPath); I get this error "java.io.InvalidClassException: libsvm.svm_model; local class incompatible: stream classdesc serialVersionUID = -8642637231196646922, local class serialVersionUID = 2709444323471798245" when I run above code. I wanna know how i can load and use model.
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/28583273
linked to: http://stackoverflow.com/q/285793
type: Question
tagged with: weka
answer count: 2
has title: how to load libsvm model in java after serialVersionUID has changed
score: 4
tagged with: serialversionuid
accepted answer: http://stackoverflow.com/a/23620443
tagged with: libsvm
upvote count: 4
linked to: http://stackoverflow.com/q/6979067
has answer: http://stackoverflow.com/a/28583273

http://stackoverflow.com/q/22529926
has title: Authentication with Twitter4j Android
has comment: http://stackoverflow.com/comment/34284748
tagged with: android
has comment: http://stackoverflow.com/comment/34284979
has comment: http://stackoverflow.com/comment/34284388
answer count: 0
type: UnansweredQuestion
tagged with: authentication
has comment: http://stackoverflow.com/comment/34285111
type: Question
tagged with: twitter4j
tagged with: java
has body: I am trying to post tweet after being authenticated with twitter4j and walking on this tutorial. The problem is that the login button doesn't do anything while it has to open authentication page. I couldn't find the reason. Thanks for help. MainActivity: public class MainActivity extends Activity { // Constants static String TWITTER_CONSUMER_KEY = "my_api_key"; static String TWITTER_CONSUMER_SECRET = "my_api_secret"; // Preference Constants static String PREFERENCE_NAME = "twitter_oauth"; static final String PREF_KEY_OAUTH_TOKEN = "oauth_token"; static final String PREF_KEY_OAUTH_SECRET = "oauth_token_secret"; static final String PREF_KEY_TWITTER_LOGIN = "isTwitterLogedIn"; static final String TWITTER_CALLBACK_URL = "oauth://t4jsample"; // Twitter oauth urls static final String URL_TWITTER_AUTH = "auth_url"; static final String URL_TWITTER_OAUTH_VERIFIER = "oauth_verifier"; static final String URL_TWITTER_OAUTH_TOKEN = "oauth_token"; // Login button Button btnLoginTwitter; // Update status button Button btnUpdateStatus; // Logout button Button btnLogoutTwitter; // EditText for update EditText txtUpdate; // lbl update TextView lblUpdate; TextView lblUserName; // Progress dialog ProgressDialog pDialog; // Twitter private static Twitter twitter; private static RequestToken requestToken; // Shared Preferences private static SharedPreferences mSharedPreferences; // Internet Connection detector private ConnectionDetector cd; // Alert Dialog Manager AlertDialogManager alert = new AlertDialogManager(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); cd = new ConnectionDetector(getApplicationContext()); // Check if Internet present if (!cd.isConnectingToInternet()) { // Internet Connection is not present alert.showAlertDialog(MainActivity.this, "Internet Connection Error", "Please connect to working Internet connection", f…
has comment: http://stackoverflow.com/comment/34285476
score: 0
has comment: http://stackoverflow.com/comment/34285542
has comment: http://stackoverflow.com/comment/34284225

http://stackoverflow.com/q/22603228
downvote count: 3
has answer: http://stackoverflow.com/a/22603293
tagged with: throws
has title: Can anyone please correct my given statement if its wrong(about throw/throws)
type: Question
upvote count: 0
score: -3
tagged with: exception
accepted answer: http://stackoverflow.com/a/22603293
answer count: 1
tagged with: throw
favorite count: 0
has comment: http://stackoverflow.com/comment/34414858
has body: THROW:-We have to handle the exception(we in the sense user here). Throws:We are asking the compiler to handle the exception raised. Please correct if what I stated above is wrong . If wrong please tell me the correct statement. Thanks in Adv!
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34414900
tagged with: java

http://stackoverflow.com/comment/34434487
comment on: http://stackoverflow.com/a/22614109
type: Comment
has text: @ScottShipp Well actually, you're right, I not sure there is any benefit to use a map in this case, I'll edit. Thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/q/22523717
tagged with: hashmap
has body: I am trying to get values from an ArrayList that is sorted and want to store it in a HashMap, where the values of the ArrayList become keys of the HashMap. Will the order of the values in the HashMap still be the same as that of ArrayList?
has title: ArrayList to HashMaps in Java
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34274104
score: 0
possible better answer: http://stackoverflow.com/a/22523767
answer count: 4
has comment: http://stackoverflow.com/comment/34273655
has comment: http://stackoverflow.com/comment/34273589
accepted answer: http://stackoverflow.com/a/22523853
has answer: http://stackoverflow.com/a/22523946
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22523853
has answer: http://stackoverflow.com/a/22523767
linked to: http://stackoverflow.com/q/2889777
tagged with: java
has answer: http://stackoverflow.com/a/22523969
type: Question

http://stackoverflow.com/q/22612837
score: 0
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/22615404
has comment: http://stackoverflow.com/comment/34436534
type: UnansweredQuestion
has title: embedding .jar in html (to RC a Raspberry Pi)
tagged with: java
has body: I'm working in a project; we want to remote control a toy-car via 2 Raspberry Pi's (1 in the Car, 1 in the remote). It's all running so far, the remote can be used (touch display) to drive around with the car. We used Java so there is a .jar running on the remote Raspberry. We also want to implement a feature allowing remote control from the web. I know, after reading a bit, how to add a .jar in a website. But it will take a few days, till our web server is online and I could test it.. So I wanted to ask, will it be possible for the Java App, if running in a browser, to remotely control the car? I mean, the App is sending information (e.g. "Button left pressed") to a "Server" (which is our Router, both Raspberrys are connected to) Or do I have to change things?
type: Question
has answer: http://stackoverflow.com/a/22613288
answer count: 2
tagged with: raspberry-pi
has comment: http://stackoverflow.com/comment/34432493

http://stackoverflow.com/comment/44056216
has text: This should be the correct answer to this question.
comment on: http://stackoverflow.com/a/22570672
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34220201
has text: Take a look at [Java, JDBC and MySQL Types](https://dev.mysql.com/doc/refman/5.0/es/connector-j-reference-type-conversions.html) for details about mappings between database types and Java
score: 3
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22493056

http://stackoverflow.com/a/22566421
downvote count: 0
has body: The first thing that happens in any constructor is a call to this() or super(); There is no harm putting in empty super(), but if you dont the compiler will generate it. An explicit call is only necessary when the constructor of the superclass takes parameters. class Parent{ Parent(String s1){ } } class Child extends Parent{ Child(String s1,String s2){ super(s1); this.s2=s2; } }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22566187

http://stackoverflow.com/comment/34340753
comment on: http://stackoverflow.com/q/22542300
score: 0
type: QuestionComment
type: Comment
has text: Ya. I've done it a million ways. The strange thing is Netbeans gets the same output if I run the command as a batch file from within the ide. I've set the /OUTPUT and /APPEND tags to files, stdout, etc. I might just have to find a way to run the script on startup using a startup batch and write the output then.

http://stackoverflow.com/comment/34361622
comment on: http://stackoverflow.com/q/22573385
score: 0
type: Comment
type: QuestionComment
has text: The blue line passes through the center of blue, not the bigger surface. It should be drawn just between its intersection with the bigger surface. It is NOT perpendicular with the other green lines. The two green lines form 60 degrees. I'm trying to show a human's eyesight.

http://stackoverflow.com/comment/34348364
comment on: http://stackoverflow.com/a/22553535
type: Comment
score: 1
has text: Tomcat is holding a reference to the Servlet so it can't be GC'd unless Tomcat releases it (which it doesn't until the application is unloaded).
type: AnswerComment

http://stackoverflow.com/q/22608248
accepted answer: http://stackoverflow.com/a/22621297
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: ssl
tagged with: tomcat
score: 0
has answer: http://stackoverflow.com/a/22621297
answer count: 1
has title: Cannot disable SSL for JMX
tagged with: jmx
has body: I am following this JMX guide here. Under the Disabling SSL section it says that com.sun.management.jmxremote.ssl=false JVM property can be set to disable SSL for JMX. I am testing this on tomcat server. I edit the tomcat startup script catalina.sh and add this property. This property is used by tomcat during startup: Then I connect to tomcat using jconsole It still tries to connect via SSL: I've also tried this with Active MQ, SOAP UI etc with no luck.

http://stackoverflow.com/a/22586263
has comment: http://stackoverflow.com/comment/34406510
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34390671
answers question: http://stackoverflow.com/q/22584237
has body: There could be any number of reasons why you're not getting the results you expect, but you've provided such little information for us to diagnose the problem with that it's all speculation. You might have- Forgotten to register the renderer with the table, or registered it with the wrong type or column You might have- Not put the images in the right location You might have- No directories in your file listing. The following is a simple example that demonstrates that the core concept of your renderer is working, there must be something else missing... import java.awt.Color; import java.awt.Component; import java.awt.EventQueue; import java.io.File; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; public class TestTable100 { public static void main(String[] args) { new TestTable100(); } public TestTable100() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } DefaultTableModel model = new DefaultTableModel(); model.addColumn("Files"); for (File file : new File(System.getProperty("user.home")).listFiles()) { model.addRow(new Object[]{file}); } JTable table = new JTable(model); table.getColumnModel().getColumn(0).setCellRenderer(new FirstCellRenderer()); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(table)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class FirstCellRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRende…
has comment: http://stackoverflow.com/comment/34391775
upvote count: 1
type: Answer

http://stackoverflow.com/q/22638581
has comment: http://stackoverflow.com/comment/34478408
has title: Jackson JsonParser fails reading an array in Json
has answer: http://stackoverflow.com/a/22639533
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22639126
has comment: http://stackoverflow.com/comment/34477942
has comment: http://stackoverflow.com/comment/34479845
has comment: http://stackoverflow.com/comment/34478705
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/34479444
score: 0
answer count: 2
upvote count: 1
downvote count: 1
tagged with: jackson
has body: I have a Json Structure something like this { "name" : "abcd", "details" : [{"city":"string", "zipcode":"integer"}], "name" : "qwert", "details" : [{"address":"long", "state":"string"}] } And my java code looks like below public class JsonTest { public static void main(String[] args) throws JsonParseException, IOException { JsonFactory jf = new JsonFactory(); JsonParser jp = jf.createParser(new File("C:\\sample.json")); while (jp.nextToken() != JsonToken.END_OBJECT) { String jsonField = jp.getCurrentName(); if ("name".equalsIgnoreCase(jsonField)) { jp.nextToken(); System.out.println(jp.getText()); } if ("details".equalsIgnoreCase(jsonField)) { jp.nextToken(); while (jp.nextToken() != JsonToken.END_ARRAY) { jp.nextToken(); String field = jp.getText(); System.out.println(field); } } } } } All am trying to do is parse the whole json token by token and get the text. But the line while (jp.nextToken() != JsonToken.END_OBJECT) fails when it encounters a '}' in the array. Am just stuck here since yesterday and experimenting with several other tricks but nothing works out. Do we have another way doing this? Is my JSON structure looks okay? Please tell me where am going wrong. Thanks!
favorite count: 0

http://stackoverflow.com/comment/34461873
has text: If you are using the SELECT statements for the table names and the column names, then why can't you put them in the list? Where is the problem?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22629378

http://stackoverflow.com/comment/34436868
comment on: http://stackoverflow.com/a/22615214
type: AnswerComment
type: Comment
has text: A copy of the *reference* is passed to the method. The name "reference" is distressingly misleading here. Be aware that `MyClass ref` is NOT the whole object itself, but only some sort of "handle", or a "remote control"... EDIT @fge The name "pointer" also came to my mind, but it's an even more overloaded term than "reference" ;-)
score: 0

http://stackoverflow.com/comment/34291242
score: 1
has text: Deinum, I tried to camelRepository.flush() but still the last find doesnt bring the new name. why i dont update simply the object? my real life use case is much more complicated than the one i posted, its only for the sake of simplicity. Dhanush, the method is transactional so why should the repository be?
comment on: http://stackoverflow.com/q/22533399
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34400986
type: AnswerComment
has text: The question here however is, is there a `Set<? extends Notifiable>` that **can exist**? If you can find such a case, then I would gladly see it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22595392

http://stackoverflow.com/q/22583939
tagged with: printing
type: Question
has comment: http://stackoverflow.com/comment/34380621
type: AnsweredQuestion
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/22584011
has title: click a button multiple times to run the same function, java android studio
score: 0
tagged with: java
has body: when i click a button i want to print a random string, but so far i can only click it once then i have to restart to print a new one. what do i have to do to continuously print strings. java code: public String converse = randomStarter(); public static String randomStarter() { Random generator = new Random(); int rand = generator.nextInt(6); String starter = new String(""); switch (rand) { case 0: starter = "What was your favorite subject in \n school as a kid? \n Worst?"; break; case 1: starter = "My favorite room in the house is..."; break; case 2: starter = "If you had 1 million dollars, what would you do with it?"; break; case 3: starter = "Did you ever have a nickname? \n If so, what was it?"; break; case 4: starter = "If I had magical powers I would..."; break; case 5: starter = "If you were invisible for a day, \nwhat would you do?"; break; case 6: starter = "5 people I would NOT like to meet..."; break; } return starter; } public void printStarter(View view) { ((TextView)findViewById(R.id.fullscreen_content)).setText(converse); } xml code to where the text is printed: &lt;TextView android:id="@+id/fullscreen_content" android:layout_width="match_parent" android:layout_height="match_parent" android:keepScreenOn="true" android:textColor="#2f4b66" android:textStyle="bold" android:textSize="50sp" android:gravity="center" android:text="@string/dummy_content" /&gt; button xml: &lt;Button android:id="@+id/dummy_button" style="?metaButtonBarButtonStyle" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/dummy_button" android:clickable="true" android:onClick="printStarter" /&gt;
has answer: http://stackoverflow.com/a/22584011
tagged with: button
tagged with: string

http://stackoverflow.com/comment/34357460
has text: The reason I want to try this new approach is that I experience that my thread does not always continue running after waitTimeOut when doing selector.select(waitTimeOut). I have logs in the line just before and just afterwards, and there can (when my system is very loaded - but not wrt network traffic) go 100+ secs between those two logs, even though waitTimeOut is 10 secs. And that is even thought I have upped the priority of the OS-LWP (thread) behind to "RT" (chrt -f -p 99 <LWP-id>). The Selector doc says something about "no realtime guarantee", so I wanted to try this new approach
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22570722

http://stackoverflow.com/q/22527784
tagged with: multithreading
tagged with: android
has answer: http://stackoverflow.com/a/47217247
accepted answer: http://stackoverflow.com/a/22529596
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34280390
tagged with: java
has body: I want my android app to display a pop-up window when the internet connection lost in order to tells the user that he lost the connection, I tried to catch null stream and then initiate a pop-up then, but it gives me that exception: 03-20 10:16:35.015: W/System.err(2922): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? 03-20 10:16:35.016: W/System.err(2922): at android.view.ViewRootImpl.setView(ViewRootImpl.java:646) 03-20 10:16:35.016: W/System.err(2922): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248) 03-20 10:16:35.016: W/System.err(2922): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) 03-20 10:16:35.016: W/System.err(2922): at android.widget.PopupWindow.invokePopup(PopupWindow.java:993) 03-20 10:16:35.016: W/System.err(2922): at android.widget.PopupWindow.showAtLocation(PopupWindow.java:847) 03-20 10:16:35.016: W/System.err(2922): at android.widget.PopupWindow.showAtLocation(PopupWindow.java:811) 03-20 10:16:35.016: W/System.err(2922): at com.example.solaceap.Login$5.run(Login.java:135) 03-20 10:16:35.016: W/System.err(2922): at android.app.Activity.runOnUiThread(Activity.java:4662) 03-20 10:16:35.016: W/System.err(2922): at com.example.solaceap.Login.init_conn_lost_popup(Login.java:119) 03-20 10:16:35.016: W/System.err(2922): at com.example.solaceap.Login$6$1.run(Login.java:281) 03-20 10:16:35.016: W/System.err(2922): at android.os.Handler.handleCallback(Handler.java:725) 03-20 10:16:35.017: W/System.err(2922): at android.os.Handler.dispatchMessage(Handler.java:92) 03-20 10:16:35.017: W/System.err(2922): at android.os.Looper.loop(Looper.java:153) 03-20 10:16:35.017: W/System.err(2922): at android.app.ActivityThread.main(ActivityThread.java:5299) 03-20 10:16:35.017: W/System.err(2922): at java.lang.reflect.Method.invokeNative(Native Method) 03-20 10:16:35.017: W/System.err(2922): at java.lang.reflect.Method.invoke(Method.java:511) 03-20 10:16:…
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/34282065
score: -1
has answer: http://stackoverflow.com/a/22528650
linked to: http://stackoverflow.com/q/2002288
has answer: http://stackoverflow.com/a/22529596
answer count: 3
tagged with: applicationcontext
possible better answer: http://stackoverflow.com/a/22528650
favorite count: 0
has title: how to display a pop_up window when losing the Internet connection?
has comment: http://stackoverflow.com/comment/34280628

http://stackoverflow.com/comment/34254727
score: 0
type: Comment
type: QuestionComment
has text: No, no I'm definitely not asking for it to be done for me. Probably a dumb question, but is a collection an array of arrays? In your concept, what happens if the element is common in A1 and A2 (it has gone to the array B), but it is not in A3?
comment on: http://stackoverflow.com/q/22509542

http://stackoverflow.com/q/22580296
has answer: http://stackoverflow.com/a/22587594
score: 0
has comment: http://stackoverflow.com/comment/34409857
answer count: 1
has comment: http://stackoverflow.com/comment/34421805
has comment: http://stackoverflow.com/comment/34476334
has comment: http://stackoverflow.com/comment/34468444
tagged with: blackberry-eclipse-plugin
tagged with: blackberry-jde
linked to: http://stackoverflow.com/q/11375284
type: UnansweredQuestion
tagged with: java
has body: I want to pass the value of a LocalURL to another Screen. I have tried this but all I get is blank Screen: BlackBerry - how to pass data like Intent.putExtra() in Android Like in android: (In Screen1) WebView webView; webView = (WebView) findViewById(R.id.webView); Bundle extras = getIntent().getExtras(); String value = "file:///android_asset/errorpage.html"; if (extras != null) { value = extras.getString("keyHTML"); } and (in Screen2) Intent i = new Intent(this, Screen1.class); i.putExtra("keyHTML", "file:///android_asset/page2.html"); startActivity(i); How do I implement something like this in Blackberry, I currently use: BrowserFieldConfig myBrowserFieldConfig = new BrowserFieldConfig(); myBrowserFieldConfig.setProperty( BrowserFieldConfig.NAVIGATION_MODE, BrowserFieldConfig.NAVIGATION_MODE_POINTER); BrowserField browserField = new BrowserField( myBrowserFieldConfig); sscreen = new MainScreen(); sscreen.add(browserField); if (name.equals("Santa Claus")) { Ui.getUiEngine().pushScreen(sscreen); browserField.requestContent("local:///santa.html"); } else if (name.equals("Christmas")) { Ui.getUiEngine().pushScreen(sscreen); browserField.requestContent("local:///christmas.html"); But I see it takes a while before it displays the HTML, I thought if I could pass data as it is in android, then it would open faster. EDIT in NewScreen public NewScreen(String url) { BrowserFieldConfig myBrowserFieldConfig = new BrowserFieldConfig(); myBrowserFieldConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE, BrowserFieldConfig.NAVIGATION_MODE_POINTER); BrowserField browserField = new BrowserField(myBrowserFieldConfig); add(browserField); url = "local:///errorpage.html"; browserField.requestContent(url); } in OldScreen if (check.equals("1") || check.equals("001")) { NewScreen newscreen = new NewScreen("local:///page1.html"); UiApplication.getUiApplication().pushScreen(newscreen); The NewScreen is pushed but still shows the default value "url = "local:///errorpage.html";" I thought it…
tagged with: blackberry
has comment: http://stackoverflow.com/comment/34462252
tagged with: blackberry-simulator
type: Question
has title: BlackBerry - How to pass URL from one screen to another
has comment: http://stackoverflow.com/comment/34469100

http://stackoverflow.com/comment/34408497
type: QuestionComment
comment on: http://stackoverflow.com/q/22599460
has text: Put it on paper and calculate to be sure. Maybe you will discover something.
score: 0
type: Comment

http://stackoverflow.com/comment/34414010
score: 0
has text: May be you should follow what Jason C said!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22602529

http://stackoverflow.com/comment/62951891
type: AnswerComment
type: Comment
has text: @Charlires ```@Bean public ParserPool parserPool() throws Exception { StaticBasicParserPool pool = new StaticBasicParserPool(); pool.initialize(); return pool; }```
comment on: http://stackoverflow.com/a/22540023
score: 0

http://stackoverflow.com/comment/34219089
score: 1
type: Comment
type: QuestionComment
has text: I don't understand. Which class is `processQuery` in? You seem to be using it from your test class, without specifying a reference to an `InvertedIndex` object. And if it's in your test class, do you actually have a second copy of `invertedList` in there too?
comment on: http://stackoverflow.com/q/22492214

http://stackoverflow.com/comment/34471744
score: 0
type: AnswerComment
type: Comment
has text: I did not really understand that.
comment on: http://stackoverflow.com/a/22633987

http://stackoverflow.com/comment/34417596
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22604763
has text: What is `getBaseContext()`? Are you trying to use a stale context object? Does it work if you create the Intent the way the documentation http://developer.android.com/guide/components/activities.html#StartingAnActivity says: `i = new Intent(context, MyActivity.class);` then addFlags and startActivity?

http://stackoverflow.com/comment/34348835
score: 10
has text: `TreeSet` is what you need .
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22566653

http://stackoverflow.com/q/22571805
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34358901
tagged with: null
has comment: http://stackoverflow.com/comment/34358922
has title: Getting value by key in hashmap returns null
has comment: http://stackoverflow.com/comment/34358877
score: 0
has answer: http://stackoverflow.com/a/22571820
answer count: 1
linked to: http://stackoverflow.com/q/2265503
accepted answer: http://stackoverflow.com/a/22571820
has body: I'm trying to store a collection of BasicRectangle objects in a hashmap (which is contained in the class BasicRectangleCollection. The key is an object containing the integer fields x and y. I'm then using the method "find" to retrieve it, which simply takes the x and y values and turns them into a Key object. However, when I run "find" then it returns null and I don't understand why this would happen when the object I'm looking for is most definitely present... Relevant code: HashMap&lt;Key,BasicRectangle&gt; rectangles; public BasicRectangleCollection(BasicRectangle bRect){ this.rectangles = new HashMap&lt;&gt;(); int x = bRect.getX(); int y = bRect.getY(); rectangles.put(new Key(x,y), bRect); } @Override public BasicRectangle find(int x, int y) { return rectangles.get(new Key(x,y)); } public static void main(String[] args) { BasicRectangle rectangle= new BasicRectangle(0,0,5,5); BasicRectangleCollection collection = new BasicRectangleCollection(rectangle); BasicRectangle found = collection.find(0,0); System.out.println(found); }
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34358821

http://stackoverflow.com/comment/34455461
type: Comment
comment on: http://stackoverflow.com/a/22625520
type: AnswerComment
has text: no. i meant to say if i dont use generic and instead of this just use object data type like void output(Object o); so then it make any difference.i can cast object to my custom class ass well as for string.
score: 0

http://stackoverflow.com/a/22510999
has comment: http://stackoverflow.com/comment/34253223
has comment: http://stackoverflow.com/comment/34252610
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34253018
has comment: http://stackoverflow.com/comment/34252277
has body: Read the error message, it says what you need to do: 01-01 10:11:20.570: E/AndroidRuntime(8222): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the element: 01-01 10:11:20.570: E/AndroidRuntime(8222): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source) 01-01 10:11:20.570: E/AndroidRuntime(8222): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source) 01-01 10:11:20.570: E/AndroidRuntime(8222): at com.google.android.gms.maps.internal.q.v(Unknown Source) 0 Also, make sure you put the meta-data nodes within the tag, not outside of it. <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="YourKeyHere" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.about_layout" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.intent.action.tab1_layout" /> <category android:name="android.intent.category.DEFAULT" />
has comment: http://stackoverflow.com/comment/34255389
answers question: http://stackoverflow.com/q/22510893
has comment: http://stackoverflow.com/comment/34253297
has comment: http://stackoverflow.com/comment/34253249

http://stackoverflow.com/comment/34486111
comment on: http://stackoverflow.com/q/22642027
score: 0
type: Comment
type: QuestionComment
has text: No man this is for the widget,i want to listen to the phone menu.

http://stackoverflow.com/q/22625417
has comment: http://stackoverflow.com/comment/34455188
accepted answer: http://stackoverflow.com/a/22625520
has body: I have created an interface Response Interface Response{ public output(String s); } and i implement this interface on my class A . now i have a class B too and it also need to implement this interface but it need different parameter for interface method. (mean class B needs public output(Comment c);) So my question is , do i need to create another interface for class B because it need different parameter Like this Interface Response{ public output(Comment c); } or is there any way to handle this. also can i used object data type for this.? Thank you.
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/12575068
favorite count: 0
has title: Interface overloading
has comment: http://stackoverflow.com/comment/34455261
tagged with: interface
tagged with: android
has comment: http://stackoverflow.com/comment/34455133
has comment: http://stackoverflow.com/comment/34455167
has comment: http://stackoverflow.com/comment/34455211
has comment: http://stackoverflow.com/comment/34455223
has comment: http://stackoverflow.com/comment/34455244
has answer: http://stackoverflow.com/a/22625520
has comment: http://stackoverflow.com/comment/34455273
downvote count: 1
type: Question
tagged with: c#
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34455247
tagged with: java
score: -1

http://stackoverflow.com/comment/34237898
score: 1
has text: PS: For now I solved the problem by converting all the *.mp3 files in my game to *.wav and I'm playing them using java API not javaFx it works fine but its becoming to be quite heavy.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22497685

http://stackoverflow.com/a/22557744
answers question: http://stackoverflow.com/q/22557567
has body: Regex is interpreted from left to right, so if regex engine in case of regex1|regex2|regex3 will first try to find match for regex1, then if not succeeded with regex2, and lastly regex3 (if not succeeded with regex2). So in your case xrayTed would be matched by [A-Za-z]+. If you wan't to finding Ted or Barry had higher priority move it before [A-Za-z]+ so try with Pattern.compile("(Ted)|(Barry)|[A-Za-z]+|[0-9]|| "); Also in your case you will have to break matching [A-Za-z]+ if it will try to match first letter of Ted or Barry. To do so you can use negative-look-ahead mechanism like ((?!Ted|Barry)[A-Za-z])+ So try with Pattern.compile("(Ted)|(Barry)|((?!Ted|Barry)[A-Za-z])+|[0-9]|| ");
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34464957
has comment: http://stackoverflow.com/comment/34467751
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22557567
type: Answer

http://stackoverflow.com/q/22533521
accepted answer: http://stackoverflow.com/a/22536348
tagged with: java
has body: I use Netbeans 7.4 for my Java development. I try to use web service client/server application. I am hiving a strange problem, let me describe it in details. At server side, suppose i have DeviceInfo and LocationInfo classes like the following: @XmlRootElement(name="DeviceInfo") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DeviceInfo") public class DeviceInfo { @XmlElement(name = "Name") private String name; public void setName(String name) { this.name = name; } public String getName() { return this.name; } } LocationInfo class has a member of DeviceInfo type: @XmlRootElement(name="LocationInfo") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "LocationInfo") public class LocationInfo { @XmlElement(name = "Name") private String name; @XmlElement(name = "DeviceInfo", type=DeviceInfo.class) private DeviceInfo deviceInfo; public void setName(String name) { this.name = name; } public String getName() { return this.name; } public DeviceInfo getDeviceInfo() { return deviceInfo; } public void setDeviceInfo(DeviceInfo deviceInfo) { this.deviceInfo = deviceInfo; } } And my web service class is like: @WebService public class DbAccess { public List&lt;LocationInfo&gt; getListLocation() { List&lt;LocationInfo&gt; listLocation = new ArrayList&lt;&gt;(); LocationInfo location1 = new LocationInfo(); location1.setName("Location 1"); DeviceInfo device1_1 = new DeviceInfo(); device1_1.setName("Device1_1"); location1.setDeviceInfo(device1_1); listLocation.add(location1); LocationInfo location2 = new LocationInfo(); location2.setName("Location 2"); DeviceInfo device2_1 = new DeviceInfo(); device2_1.setName("Device2_1"); location2.setDeviceInfo(device2_1); listLocation.add(location2); return listLocation; } } The web service simply returns list of LocationInfo. At web client side, I simply added a web service client from Netbeans(New/Web Service Client). I just gave the web service WSDL address to IDE and it imported the web service types. So i can consume the web servic…
type: Question
has answer: http://stackoverflow.com/a/22536348
has title: web service returns null insead of List<MyCustomObj> in Java
score: -1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34295232
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34291499
has comment: http://stackoverflow.com/comment/34292399
tagged with: web-services
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/34290723

http://stackoverflow.com/a/23760484
score: 1
downvote count: 1
has body: Please download the bcprov-jdk15on-150.jar (for JDK 1.5 - 1.7) file from below given link and add in your project to resolve java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1Encodable exception. http://www.bouncycastle.org/latest_releases.html find the appropriate jar file from the above link according to your JDK version.
answers question: http://stackoverflow.com/q/22513697
type: Answer
has comment: http://stackoverflow.com/comment/58783333
upvote count: 2

http://stackoverflow.com/comment/34443940
score: 1
type: AnswerComment
has text: ylun.za: Gmail allows 25MB attachments now. my problem is not sending the email, but excluding unecessary libraries.
comment on: http://stackoverflow.com/a/22614339
type: Comment

http://stackoverflow.com/comment/34439369
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22616752
type: Comment
has text: @BackSlash i think instead of providing further links you should help here only

http://stackoverflow.com/a/22536852
upvote count: 1
answers question: http://stackoverflow.com/q/22536054
downvote count: 0
type: Answer
score: 1
has body: OK, I'm only guessing, but I think I can see a pattern here. The file types that are working are text based The file types that are not working are binary This suggests to me that maybe the problem is that there is some kind of issue with the way that non-text data is being handled by the upload process. Maybe it is being transcoded when it shouldn't be. Anyway, I suggest that you use some tool like Wireshark to capture the TCP/IP traffic in an upload to see if the upload request body has valid MIME encapsulation.

http://stackoverflow.com/q/22592946
has comment: http://stackoverflow.com/comment/34401751
linked to: http://stackoverflow.com/q/22217428
tagged with: jtabbedpane
has comment: http://stackoverflow.com/comment/34401416
answer count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: nimbus
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/8166875
has title: Missing 'top border' on JTabbedPane?
type: Question
has body: I am adding tabs to the pane like so: JTextPane field = new JTextPane(); field.setText("New test string"); field.setEditable(false); chatTabPane.addTab("Tab 1", null, new JScrollPane(field), "Does nothing"); for (int i = 0; i &lt; chatTabPane.getTabCount(); i++) { chatTabPane.setTabComponentAt(i, new ButtonTabComponent(chatTabPane)); } However, unless i'm mistaken there should be a blueish bar along underneath the tabs? why is it they're floating way above the pane?
tagged with: border

http://stackoverflow.com/q/22532383
downvote count: 0
favorite count: 0
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22541120
tagged with: performance
upvote count: 3
tagged with: java
tagged with: jsoup
has title: JSoup execute method slow on linux
has comment: http://stackoverflow.com/comment/34415627
type: UnansweredQuestion
tagged with: linux
score: 3
tagged with: windows
has body: I'm having an issue with the performance of the http request within JSoup. On the development pc (Windows 7) it works great. When I deploy the same service on a Suse Linux enterprise server, the http requests is much slower. The difference is +- 15 seconds. (15 seconds slower on linux) JSoup version 1.7.3. Java version : 1.7.0_51. The JVM parameters are exactly the same on both machines. My call: Connection.Response response = Jsoup.connect(urlWrk).data(headerDataMap).cookies(cookieStore).method(httpMethod).userAgent(userAgent).timeout(requestTimeout).execute(); I'm using the POST method. I started a tcpdump session and it looks like the execute method hangs a few seconds before it actually executes the http request. Any help is appreciated!

http://stackoverflow.com/q/22490610
has title: Hibernate get field of the object stored in map in the select clause
score: 0
tagged with: maps
answer count: 1
has answer: http://stackoverflow.com/a/22558175
tagged with: java
tagged with: hibernate
tagged with: hql
has body: I have the class structure like this: Class A { private HashMap&lt;\String, B&gt; someFieldMap = // Retrieves some map //getter for someFieldMap //setter for someFieldMap } B is a custom class with the following structure. class B { private String type; private String value; //getters and setters for the above fields } Now, I'm trying to write a HQL to retrieve the value in class B select value(fieldMap) from A a join a.someFieldMap fieldMap where index(fieldMap) = 'xyz' //index(fieldMap) will give me the Key of the map. value(fieldMap) gives me the entire object of instance B. so it will give me the whole object whose type is B. I want to select b.value and b.type through the select clause. I tried (value(fieldMap)).value, (value(fieldMap)).getValue() but it doesn't work. I tried to search this up but couldn't find anything.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22558175
type: Question
tagged with: sql

http://stackoverflow.com/a/23509107
answers question: http://stackoverflow.com/q/22528510
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
score: 3
has body: Solved. I didn't save changes. Need to add code befire "downloadImage()" int i = 0; File input = new File(result_doc); Document doc = Jsoup.parse(input, "UTF-8"); for( Element img : doc.select("img[src]") ) { img.attr("src",array[i]); // set attribute 'src' to 'your-source-here' ++i; } try { String strmb = doc.outerHtml(); bw = new BufferedWriter(new FileWriter(result_doc)); bw.write(strmb); bw.close(); } catch (Exception ex) { System.out.println("Program stopped. The problem is " + "\"" + ex.getMessage()+"\""); }
accepted answer of: http://stackoverflow.com/q/22528510

http://stackoverflow.com/a/22504214
score: 5
downvote count: 0
has body: You could override the toString() method of your enum or provide a getter. public enum Status { /** * ACTIVE (Ordinal 1). */ ACTIVE(1), /** * INACTIVE (Ordinal 2). */ INACTIVE(2); // Note the semicolon private final int value; private Status(int value) { this.value = value; } public int getValue() { return value; } // OR @Override public String toString() { return String.valueOf(value); } } Then you can call System.out.println(ACTIVE); // toString is called or System.out.println(ACTIVE.getValue());
type: Answer
answers question: http://stackoverflow.com/q/22504097
has comment: http://stackoverflow.com/comment/34238476
upvote count: 5

http://stackoverflow.com/a/22496972
answers question: http://stackoverflow.com/q/22496899
type: Answer
has body: Use Arrays.equals: Arrays.equals(ary, ary2)); Or Arrays.deepEquals Returns true if the two specified arrays are deeply equal to one another. Unlike the @link{#equals{Object[],Object[]) method, this method is appropriate for use with nested arrays of arbitrary depth. Two array references are considered deeply equal if both are null, or if they refer to arrays that contain the same number of elements and all corresponding pairs of elements in the two arrays are deeply equal. Two possibly null elements e1 and e2 are deeply equal if any of the following conditions hold: e1 and e2 are both arrays of object reference types, and Arrays.deepEquals(e1, e2) would return true e1 and e2 are arrays of the same primitive type, and the appropriate overloading of Arrays.equals(e1, e2) would return true. e1 == e2 e1.equals(e2) would return true.
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34228042

http://stackoverflow.com/comment/34292826
comment on: http://stackoverflow.com/a/22532346
score: 0
type: AnswerComment
has text: and do you know why I got "'}' found"?
type: Comment

http://stackoverflow.com/a/59716721
type: Answer
downvote count: 0
has body: In Dialog or BottomSheetDialogFragment you have to implement this solution which is work for me. Step 1: In your dialog or BottomSheetDialog, write this code in onActivityCreated method, override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) var viewParent = view while (viewParent is View) { viewParent.fitsSystemWindows = false viewParent.setOnApplyWindowInsetsListener { _, insets -&gt; insets } viewParent = viewParent.parent as View? } } Step 2: Also, override the below method : override fun setupDialog(dialog: Dialog, style: Int) { super.setupDialog(dialog, style) dialog?.window?.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) } Now see the magic :)
score: 1
answers question: http://stackoverflow.com/q/22577654
upvote count: 1

http://stackoverflow.com/a/22602982
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/22602772
type: Answer
answers question: http://stackoverflow.com/q/22602772
has body: That's expected. ObjectMapper is part of the jackson-databind artefact.

http://stackoverflow.com/comment/34382334
score: 1
comment on: http://stackoverflow.com/a/22584856
type: AnswerComment
has text: @dognose as a *very* broad rule of thumb with many exceptions, I would say methods should be static when they can be. If, however, the OP had this problem on variables instead of on methods, it would be just as likely that those should indeed be instance variables and main should instantiate an object. In any case I'm guessing this is far over the OP's head... and just going with static is the right thing to do around chapter 3 of an intro Java book.
type: Comment

http://stackoverflow.com/comment/34271735
type: Comment
type: AnswerComment
has text: @nanachan: Then read as many lines as is needed. You are in complete control of your code and how many lines your Scanner reads. I have a strong suspicion that your problem lies elsewhere that this really is an XY problem in disguise.
comment on: http://stackoverflow.com/a/22522589
score: 0

http://stackoverflow.com/q/22598065
linked to: http://stackoverflow.com/q/8875674
score: 0
has comment: http://stackoverflow.com/comment/66175638
has comment: http://stackoverflow.com/comment/34406253
has comment: http://stackoverflow.com/comment/34406034
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34405797
has comment: http://stackoverflow.com/comment/34406666
has title: how to select a radiobutton in buttongroup in Java
answer count: 0
tagged with: java
has body: I created several radio buttons in a button group but I cannot understand how to set necessary radio button in a code. My program reads the personal information in a file and shows it in the form (one person at a time). The personal information includes a marital status apart from name and other data, so I use radio buttons for the marital status. This is my code (I used class Person with public enum MaritalStatus {SINGLE, MARRIED, WIDOW};): buttonGroup = new ButtonGroup(); for (Person.MaritalStatus c : Person.MaritalStatus.values()) { JRadioButton radioButton = new JRadioButton(c.name()); buttonGroup.add(radioButton); if (c == mStatus) { radioButton.setSelected(true); } radioButtonPanel.add(radioButton); } So, I have a group of radio buttons: SINGLE, MARRIED, WIDOW If user changes the person, the program must update the info about the marital status of the next person in a file. In other words, I don't know how to choose necessary radio button. The method of button group setSelected(buttonModel, bool) requires the buttonModel/radioButton name, but I don't have it in the code
tagged with: buttongroup
type: Question

http://stackoverflow.com/q/22580697
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22580698
type: UnansweredQuestion
tagged with: web-applications
has body: I have the following assignment I need to program using Jetty. I've done a bit of research into how Jetty works but I can't understand how I can have two applications running at once, as below it says I need to have two forms of URL: /student and /course. I made a very simple web server before using com.sun.net.httpserver.HttpServer to host a page with multiple contexts (different pages based on different URLs) but I'm not sure how to emulate the same behavior in Jetty. Do I want to use multiple handlers, or a single handler with multiple contexts? How do I even implement multiple handlers or contexts? Every example I've seen seems to allow only the use of one context or one handler. I'm not worried right now about the logic of the program. I just don't understand how to separate the logic into two accessible web apps. What type of object do I need to use to host multiple apps in one program? Write a web application using the jetty framework that implements the following functionality. Alternative web frameworks can be used with the permission of the instructor (I will provide a signed permission note, if approved). The application should allow for the creation and editing a student profile, the URL should start with /student. Additionaly the application should allow for the display of sections that a course is taught (similar to assignment 3). This URL for courses should start with courses. These two features are independent. The student page should provide a form to register a student, a registered student must supply their name, student number, and contact information. Contact information should include their mailing address, and email address. The page must support creation and editing of the student's profile. Once the profile is created, the system must be able to edit all the fields. You should use fake data for testing. The student's profile must be saved to the disk. You can serialize the Java class that contains the information and write it a file. This fi…
tagged with: java
type: Question
has title: How do I use Jetty to host multiple web apps?

http://stackoverflow.com/comment/34370249
comment on: http://stackoverflow.com/a/22558056
has text: Cannot make a static reference to the non-static method startActivity(Intent) from the type Context
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22608507
has comment: http://stackoverflow.com/comment/34424272
linked to: http://stackoverflow.com/q/4948325
tagged with: sql
tagged with: jdbc
favorite count: 0
has comment: http://stackoverflow.com/comment/34424087
downvote count: 0
type: Question
has comment: http://stackoverflow.com/comment/34424513
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34424441
tagged with: derby
has answer: http://stackoverflow.com/a/22610096
accepted answer: http://stackoverflow.com/a/22610096
upvote count: 1
answer count: 1
has body: I would like to how can I reset primary key counter in JDBC:Derby from code? I want it reset when I delete database records, but leave tables intact. When I do that, primary key counter does not reset and continue where it ended. I was thinking about something like this ALTER SEQUENCE &lt;tabname&gt;_&lt;id&gt;_seq RESTART WITH 1 Will this work? And if yes will it work correctly?
has title: Reset primary key counter in JDBC

http://stackoverflow.com/comment/34381146
score: 1
has text: Just keep generating numbers and adding them to the array as long as they are unique; generate a number and check it against the others in the array.
comment on: http://stackoverflow.com/q/22584244
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23009052
answers question: http://stackoverflow.com/q/22508604
type: Answer
score: 3
has body: http://en.wikibooks.org/wiki/Java_Persistence/ElementCollection#Primary_keys_in_CollectionTable The JPA 2.0 specification does not provide a way to define the Id in the Embeddable. However, to delete or update a element of the ElementCollection mapping, some unique key is normally required. Otherwise, on every update the JPA provider would need to delete everything from the CollectionTable for the Entity, and then insert the values back. So, the JPA provider will most likely assume that the combination of all of the fields in the Embeddable are unique, in combination with the foreign key (JoinColumn(s)). This however could be inefficient, or just not feasible if the Embeddable is big, or complex. Some JPA providers may allow the Id to be specified in the Embeddable, to resolve this issue. Note in this case the Id only needs to be unique for the collection, not the table, as the foreign key is included. Some may also allow the unique option on the CollectionTable to be used for this. Otherwise, if your Embeddable is complex, you may consider making it an Entity and use a OneToMany instead. So thats it, it can't be done.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22508604
upvote count: 3

http://stackoverflow.com/comment/34457879
comment on: http://stackoverflow.com/q/22627025
score: 0
has text: @VikalpPatel, And what about body message. that is `String message = "Thank you for regestering with";` i am not getting this message also.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34301990
comment on: http://stackoverflow.com/a/22519813
has text: Changed the factory package name but did not work either. Downgraded from NetBeans8 to NetBeans7 and it started working again. Looks like Tomcat8 has some problems.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22632914
has comment: http://stackoverflow.com/comment/34468995
tagged with: java
has answer: http://stackoverflow.com/a/22633286
tagged with: finalize
upvote count: 4
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22633286
has answer: http://stackoverflow.com/a/22673648
has answer: http://stackoverflow.com/a/22633305
has body: I was reading that Any Exception thrown by finalize method is ignored by GC thread and it will not be propagated further but what is the reason for ignoring Exception by GC. Also finalization of that object terminates, does that means, that object always remains in memory?
score: 4
possible better answer: http://stackoverflow.com/a/22633305
answer count: 3
tagged with: garbage-collection
has title: Does Garbage Collector ignores Exception

http://stackoverflow.com/q/22531710
has comment: http://stackoverflow.com/comment/34290834
has body: I keep on getting NullPointerException errors on my app whenever I launch the activity. It just seems strange because everything is declared. Here's my activity: package com.example.calendar; import java.util.Date; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CalendarView; import android.widget.EditText; import android.app.Activity; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import com.example.calendar.Appointment; public class CreateAppointment extends Activity implements OnClickListener{ EditText nameTextBox; EditText timeTextBox; EditText detailsTextBox; Button createButton; Date date = new Date(); Appointment getNewID; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.create); createButton = (Button) findViewById(R.id.apptSave); nameTextBox = (EditText)findViewById(R.id.apptName);//Assign the global name box timeTextBox = (EditText)findViewById(R.id.apptTime);//Assign the global time box detailsTextBox = (EditText)findViewById(R.id.apptDetails);//Assign the global details box createButton.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.apptSave: String getNewDate = date.toString(); String getNewTitle = nameTextBox.getText().toString(); String getNewTime = timeTextBox.getText().toString(); String getNewDetails = detailsTextBox.getText().toString(); DBHandler db = new DBHandler(this); db.addAppointment(new Appointment(getNewID.getID(), getNewDate, getNewTitle, getNewTime, getNewDetails)); finish(); break; } } } and logcat gives me this: 03-20 11:24:50.800: E/AndroidRuntime(706): FATAL EXCEPTION: main 03-20 11:24:50.800: E/AndroidRuntime(706): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.calendar/com.example.calendar.CreateAppointment}: java.lang.N…
has title: NullPointerException crashes android app
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34287254
tagged with: java
has answer: http://stackoverflow.com/a/22531734
has answer: http://stackoverflow.com/a/22531839
has comment: http://stackoverflow.com/comment/34287271
type: Question
has comment: http://stackoverflow.com/comment/34288062
has answer: http://stackoverflow.com/a/22531730
has comment: http://stackoverflow.com/comment/34292348
score: 0
tagged with: nullpointerexception
answer count: 3
possible better answer: http://stackoverflow.com/a/22531730
accepted answer: http://stackoverflow.com/a/22531839
tagged with: android

http://stackoverflow.com/comment/34403514
comment on: http://stackoverflow.com/q/22596489
type: Comment
score: 0
has text: Future<> looks like a good idea but how do I guarantee that only one object gets created do you have a sample @David Ehrmann yes duplicate object creation is a concern as XMLObject creation involves both NIO and DB?
type: QuestionComment

http://stackoverflow.com/comment/100880491
comment on: http://stackoverflow.com/q/22561527
score: 0
type: QuestionComment
has text: @ChuckM, in your solution, original rest exception is wrapped by ResponseProcessingException, which is not good. As an alternative approach, without filters, you can extract response body from the exception.
type: Comment

http://stackoverflow.com/q/22513427
has title: Inserting from one Mysql database to Another
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/22513533
tagged with: java
tagged with: mysql
has body: I am trying to transfer data from one mysql db to another .For one i have the connection url as the db name ,username and pwd (As this has to be present on the remote location).And for another I am using a data source . public class errorlog { public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver"); System.out.println("Driver loaded mysql1server"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); System.out.println("Driver loaded mysql"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block System.out.println("not loaded"); } String connectionUrl = "jdbc:mysql//localhost:3306/db1" ; String connectionUrl2="jdbc:odbc:test"; Connection con=null; Connection con2=null; Statement stmt = null; ResultSet rs = null; PreparedStatement pstmt = null; try { con = DriverManager.getConnection(connectionUrl,"root","root"); System.out.println("CONNECTED1 mysql1"); con2 = DriverManager.getConnection(connectionUrl2); System.out.println("CONNECTED2 mysql"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { stmt = con.createStatement(); rs=stmt.executeQuery("select * FROM db1.db1_table"); System.out.print("Select executed"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { while (rs.next()) { int col1 = rs.getInt("col1"); String col2=rs.getString("col2"); Date TimeStamp = rs.getDate("Time Stamp"); String insertSql ="Insert into db2.db2_table (`col1`,`col2`) values(?,?)"; pstmt = con2.prepareStatement(insertSql); pstmt.setInt(1,col1); pstmt.setString(2,col2); pstmt.setDate(3,(java.sql.Date) TimeStamp); pstmt.executeUpdate(); pstmt.close(); System.out.println("insert done"); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } System.out.println("out insert done"); } } I am getting an error as "No suitable driver found for jdbc:mysql//localhost:3306/databaseName=db1;user=root;password=root" Please let me know where i am wrong…
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22514135

http://stackoverflow.com/a/22564553
answers question: http://stackoverflow.com/q/22564342
score: 0
type: Answer
has body: The problem is public void onClick(View v) where v is the button. Try to put Button btnResetForm = (Button) v.findViewById(R.id.btnResetFormxml); et = (EditText)v.findViewById(R.id.edArea); and define EditText et; as a property of your fragment. After that you can use public void resetForm(View v) { et.setText(""); }

http://stackoverflow.com/comment/34320742
type: Comment
has text: Jut create a `shift` method in the `Cube` class that will shift _all_ the x points or y points a certain increment then call repaint.
type: AnswerComment
comment on: http://stackoverflow.com/a/22550167
score: 0

http://stackoverflow.com/q/22542638
tagged with: java
tagged with: image
linked to: http://stackoverflow.com/q/43157
answer count: 2
upvote count: 1
has body: How can i write data into an image (create image by received data) . (By socket) My client read an image from system and send it to server and server should receive and save it in any other place in my computer. Here is my code: client: public class Client_Image_Transfer { Socket clientSocket = null; OutputStream outputStream = null; DataOutputStream dataOutputStream = null; InputStream inputStream = null; public Client_Image_Transfer() { try { clientSocket = new Socket("localhost", 6002); outputStream = clientSocket.getOutputStream(); dataOutputStream = new DataOutputStream(outputStream); inputStream = clientSocket.getInputStream(); BufferedReader br = new BufferedReader(new FileReader("HelloNewPic.jpg")); outputStream.write(br.read()); System.out.println("Client: Image sent to server"); dataOutputStream.close(); clientSocket.close(); } catch (Exception e) { e.printStackTrace(); } } Server: public class Server_Image_Transfer { ServerSocket serverSocket = null; Socket socket = null; DataInputStream dataInputStream = null; public Server_Image_Transfer() { try { serverSocket = new ServerSocket(6002); System.out.println("Server is Waiting for request..."); socket = serverSocket.accept(); System.out.println("Connected with: " + socket.getInetAddress()); dataInputStream = new DataInputStream(socket.getInputStream()); System.out.println("Server received image from client"); // How write ? } catch (Exception e) { e.printStackTrace(); } } My server received image correctly, But now how write by an image without ImageIO? This is not worked also: File outPutFile = new File("C:\\Users\\khoy\\Desktop\\a2.jpg"); FileOutputStream fos = null; fos = new FileOutputStream(outPutFile,true); fos.write(socket.getInputStream()); // Compile Error
favorite count: 0
has answer: http://stackoverflow.com/a/22543139
accepted answer: http://stackoverflow.com/a/22543139
has answer: http://stackoverflow.com/a/22542912
tagged with: sockets
possible better answer: http://stackoverflow.com/a/22542912
type: AnsweredQuestion
downvote count: 0
score: 1
type: Question
has title: Write an image without `ImageIO` through socket

http://stackoverflow.com/a/22649702
type: Answer
answers question: http://stackoverflow.com/q/22633951
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/22633951
has body: Ok, so I figured it out. The only issue was, my regex had to be ".*href=\"([^\"]*?)\".*" Which then made the code private String regex = ".*href=\"([^\"]*?)\".*"; private Pattern p = Pattern.compile(regex); Matcher m = p.matcher(result); if (m.matches()) { String urlStr = m.group(1); links.add(urlStr); } So that was my issue with the regex, I had to use the '?' to not be greedy I guess!

http://stackoverflow.com/comment/34356324
has text: @user3439075 technically no, as you are doing one more operation per loop (`++i`), but it will still be `O(n)`
type: Comment
comment on: http://stackoverflow.com/a/22570081
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34285337
comment on: http://stackoverflow.com/a/22530609
type: AnswerComment
type: Comment
has text: You don't need to post this as an answer. If you want, edit the question and put it at the end of the question. (don't edit the code in the question if you do this, because then people can't see what the original problem was)
score: 0

http://stackoverflow.com/q/22529645
answer count: 2
downvote count: 0
has title: Atomically move and rename a Path instance
score: 4
favorite count: 0
upvote count: 4
possible better answer: http://stackoverflow.com/a/22529751
accepted answer: http://stackoverflow.com/a/22529755
tagged with: file
has comment: http://stackoverflow.com/comment/34283737
has answer: http://stackoverflow.com/a/22529755
type: AnsweredQuestion
has body: Given a Path path instance, I have the following questions: How do I rename the file at which the path points, without resorting to the old File API if possible, I have not been able to find it anywhere yet? Is it possible to atomically both move a physical file to a new directory and rename it at the same time? I am using Java 8, new things for the Path class got added in for sure, not sure if the are of any help answering this question though.
tagged with: java
has answer: http://stackoverflow.com/a/22529751
type: Question

http://stackoverflow.com/a/22648087
accepted answer of: http://stackoverflow.com/q/22646382
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34516570
has body: Java has implementation of "PBKDF2" algorithm as "PBKDF2WithHmacSHA1". You can import those libs and generate/ check passwords using the same params.
type: Answer
answers question: http://stackoverflow.com/q/22646382

http://stackoverflow.com/comment/34476877
score: 5
type: AnswerComment
comment on: http://stackoverflow.com/a/22637993
has text: I knew, but I prefer the long one in terms of readability, because otherwise it could be confusing to find out where these variables come from.
type: Comment

http://stackoverflow.com/comment/34251773
type: QuestionComment
comment on: http://stackoverflow.com/q/22511279
has text: well you just need read Docs: http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/field/ForeignCollectionField.html#orderColumnName%28%29
score: 0
type: Comment

http://stackoverflow.com/comment/34609217
has text: I added the invokation handler, it's not a traditional decorator, but sure, if that helps
comment on: http://stackoverflow.com/a/22694594
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22569902
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24164437
favorite count: 0
has body: Problem I'm getting some strange behavior where the Spring Jaxb2Marshaller doesn't scan my package-info.java. Could anyone take a look? I have a Spring MVC/Camel application that accepts multiple objects that are wrapped with a generic wrapper, where the XML MUST look like: &lt;mlf:message id="22" product="great.event" xmlns:mlf="special mlf URI"&gt; &lt;mlf:header&gt; &lt;mlf:action value="notify-published"/&gt; &lt;/mlf:header&gt; &lt;mlf:payload status="partial"&gt; &lt;can be any element at all&gt; &lt;/mlf:payload&gt; &lt;/mlf:message&gt; My setup follows the Error. Error -00:00 [localhost-startStop-1] ERROR o.s.web.context.ContextLoader Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxb2Marshaller' defined in class path resource [com/company/CamelConfig.class]: Invocation of init method failed; nested exception is ... Exception [EclipseLink-25016] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.XMLMarshalException Exception Description: A namespace for the prefix mlf:header was not found in the namespace resolver. with linked exception: [Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.IntegrityException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) ~[spring-beans-4.0.1.RELEASE.jar:4.0.1.RELEASE] Setup My package-info.java and Wrapper classes look like this: package-info.java @XmlSchema( xmlns={ @XmlNs(prefix="mlf", namespaceURI="special mlf URI") }, elementFormDefault=XmlNsForm.UNQUALIFIED) package com.company.camel; import javax.xml.bind.annotation.*; Message.java package com.company.camel; @XmlRootElement(name = "message", namespace = "special mlf URI") @XmlAccessorType(XmlAccessType.FIELD) public class Message { @XmlAttribute(required = false) private int id; @XmlAttribute(namesp…
has title: Spring/Jaxb2Marshaller/MOXy not loading package-info.java namespace mappings
tagged with: moxy
upvote count: 2
accepted answer: http://stackoverflow.com/a/24164437
tagged with: spring
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
type: Question

http://stackoverflow.com/a/22636231
has body: What you could do would be to make your application persistent. In Java, the 2 main approaches to this is to either: Make your application use a database (through JDBC) or Make your application use a file system with serialization methodologies such as XStream The most standard way is to provide a Save button which explicitly stores the information upon the user's request. Another option would be to capture the closing event which the window throws just before closing. This previous SO post should point you in the right direction.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22636060
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/34240001
score: 0
comment on: http://stackoverflow.com/a/22505202
type: Comment
has text: It is there. I'm using `quartz-2.2.1.jar` and It's available in my library folder
type: AnswerComment

selenium
tags question: http://stackoverflow.com/q/22588096
tags question: http://stackoverflow.com/q/22552270
tags question: http://stackoverflow.com/q/22493419
tags question: http://stackoverflow.com/q/22612652
tags question: http://stackoverflow.com/q/22614290
tags question: http://stackoverflow.com/q/22583490
tags question: http://stackoverflow.com/q/22504373
tags question: http://stackoverflow.com/q/22519996
tags question: http://stackoverflow.com/q/22532339
tag name: selenium
tags question: http://stackoverflow.com/q/22549429
tags question: http://stackoverflow.com/q/22625534
tags question: http://stackoverflow.com/q/22517131
tags question: http://stackoverflow.com/q/22601655
tags question: http://stackoverflow.com/q/22590466
tags question: http://stackoverflow.com/q/22607887
tags question: http://stackoverflow.com/q/22516207
tags question: http://stackoverflow.com/q/22625624
tags question: http://stackoverflow.com/q/22550124
tags question: http://stackoverflow.com/q/22507204
tags question: http://stackoverflow.com/q/22506582
type: Tag
tags question: http://stackoverflow.com/q/22505192
tags question: http://stackoverflow.com/q/22489229
tags question: http://stackoverflow.com/q/22636660

http://stackoverflow.com/comment/34221287
score: 0
comment on: http://stackoverflow.com/q/22493638
has text: It depends on the situation, if they are posting a form the redirect is better to prevent double form submissions if the back button is used. Are they actually submitting data through a form?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34400606
type: QuestionComment
has text: @RohitJain I am guessing because it does not show a minimal effort to post a compilable example.
comment on: http://stackoverflow.com/q/22595165
score: 0
type: Comment

http://stackoverflow.com/a/22641623
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22641489
type: Answer
has body: Here're some advice: Use enhanced for loop instead of indexed one. This will avoid using this.getBooks().get(i) twice in each method. Unavailable books + Available books = Total books. Use this equation to avoid writing all the codes in both the methods. You might want to use a Set&lt;Book&gt; instead of List&lt;Book&gt; to make this easier to work with. [HINT: Set Difference]. Also, rather than doing the null check in those methods, I'll add a method isAvailable() inside the Book class only, which will return true if it is available, else false.
downvote count: 0

http://stackoverflow.com/comment/44118426
score: 0
type: QuestionComment
type: Comment
has text: I am asking for Synonym combinig code.
comment on: http://stackoverflow.com/q/22589700

http://stackoverflow.com/a/22566244
upvote count: 2
has body: I would recommend holding Student grades inside of your Student object public class Student { private String name; private int[] grades; public Student(String name) { this.name = name; this.grades = new int[10]; } public void setGrade(int assignmentNumber, int grade) { grades[assignmentNumber] = grade; } public int[] getGrades() { return grades; } } Then create an ArrayList of type Student and use the getter to get that student's grades List&lt;Student&gt; roster = new ArrayList&lt;Student&gt;(); Student stu = new Student("Bob"); stu.setGrade(0, 100); roster.add(stu); You can now call the getter to get the array of grades roster.get(0).getGrades();
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22566112
answers question: http://stackoverflow.com/q/22566112
type: Answer

http://stackoverflow.com/a/22591551
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22590914
has body: Java can only do "box and wide" not "wide and box". For example, int --> Number [OK!] int boxed to Integer widen to Number byte --> Integer [DOESN'T COMPILE] byte needs to widen to int first, then box to Integer. Java doesn't allow it. Pls note that you can't do this -byte box to Byte then widens to Integer (Integer is not super class of Byte). So, in your given methods, first argument byte already fails the two Integer methods. So, only int... is applicable. I wrote the following class for demo: public class Overload{ public static void primitiveWiden(int x){ System.out.println("int"); } public static void refWiden(Map m){ System.out.println("Map"); } public static void priWideAndBox(Integer o){//doesn't work System.out.println("Object"); } public static void boxAndRefWide(Number n){//it works System.out.println("Number"); } public static void main(String[] args){ byte b =0; int i =0; HashMap m = new HashMap(); primitiveWiden(b); refWiden(m); priWideAndBox(b);//compile error boxAndRefWide(i); } }
score: 5
upvote count: 5

http://stackoverflow.com/comment/34453723
comment on: http://stackoverflow.com/a/22624583
score: 0
type: AnswerComment
has text: android:src = " @drawable/picture"
type: Comment

http://stackoverflow.com/comment/34308157
has text: replace the tags using String.replace()
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22542731

http://stackoverflow.com/q/22575444
possible better answer: http://stackoverflow.com/a/22575591
has answer: http://stackoverflow.com/a/65261803
has body: I saw a piece of code in a book, which is as follows: x = 10; if(x ==10) { // start new scope int y = 20; // known only to this block x = y * 2; } Are both, scope and block, the same?
downvote count: 3
has answer: http://stackoverflow.com/a/22575547
upvote count: 17
has answer: http://stackoverflow.com/a/22575481
score: 14
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22575542
has answer: http://stackoverflow.com/a/57663115
type: Question
has answer: http://stackoverflow.com/a/22575524
has answer: http://stackoverflow.com/a/22575535
has answer: http://stackoverflow.com/a/22575591
accepted answer: http://stackoverflow.com/a/22575481
has answer: http://stackoverflow.com/a/22575487
favorite count: 0
answer count: 9
has title: What is the difference between scope and block?

cocos2d-android
type: Tag
tag name: cocos2d-android
tags question: http://stackoverflow.com/q/22565371

http://stackoverflow.com/a/22635864
score: 2
type: AcceptedAnswer
downvote count: 0
has body: If You are suggesting interactive moving of items, then You should search for "Drag and Drop". For example: Drag and drop for linearlayout&#39;s child views. If you want to overlay one view over another - then use RelativeLayout and remember that latest view in xml layout has more Z axis value. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;Button android:id="@+id/button_below" android:layout_width="match_parent" android:layout_height="100dp" android:layout_centerVertical="true" android:text="ButtonBelow" /&gt; &lt;Button android:id="@+id/button_above" android:layout_width="match_parent" android:layout_height="100dp" android:layout_alignBottom="@+id/button_below" android:layout_alignParentLeft="true" android:layout_marginBottom="62dp" android:text="ButtonAbove" /&gt; &lt;/RelativeLayout&gt;
accepted answer of: http://stackoverflow.com/q/22635421
upvote count: 2
answers question: http://stackoverflow.com/q/22635421
type: Answer

http://stackoverflow.com/a/22507946
score: 0
has body: You should probably use a JSON parser, however... This regex will capture all the labels in a group names "labels" .*?(?:label)":"(?&lt;labels&gt;[^"]+)+.*? Or depending how you are executing this, just search for this match (?:label)":"(?&lt;labels&gt;[^"]+) You can see it working here: http://regex101.com/r/fS8jA8 And the resulting JAVA (generated by regex101): String re = "(?:label)\\":\\"(?&lt;labels&gt;[^\\"]+)"; String str = "[{\"id\":\"9\",\"label\":\"P\",\"price\":\"0\",\"oldPrice\":\"0\",\"products\":[\"606\",\"610\",\"614\",\"618\",\"622\",\"625\",\"629\"]},{\"id\":\"8\",\"label\":\"M\",\"price\":\"0\",\"oldPrice\":\"0\",\"products\":[\"607\",\"611\",\"615\",\"619\",\"626\",\"630\"]},{\"id\":\"7\",\"label\":\"G\",\"price\":\"0\",\"oldPrice\":\"0\",\"products\":[\"609\",\"613\",\"617\",\"621\",\"624\",\"628\",\"632\"]},{\"id\":\"36\",\"label\":\"GG\",\"price\":\"0\",\"oldPrice\":\"0\",\"products\":[\"608\",\"612\",\"616\",\"620\",\"623\",\"627\",\"631\"]},{\"id\":\"152\",\"label\":\"XGG\",\"price\":\"0\",\"oldPrice\":\"0\",\"products\":[\"3713\",\"6577\",\"6578\",\"6579\",\"6580\",\"6581\",\"6582\"]}] "; Pattern p = Pattern.compile(re, Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(str);
type: Answer
answers question: http://stackoverflow.com/q/22507774

http://stackoverflow.com/a/22539877
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/34302737
has comment: http://stackoverflow.com/comment/34302545
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/34302379
has comment: http://stackoverflow.com/comment/34302197
answers question: http://stackoverflow.com/q/22539818
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34303006
has body: Constructors always take the name of the class - which is what you are seeing.
accepted answer of: http://stackoverflow.com/q/22539818

http://stackoverflow.com/q/22527821
favorite count: 0
has answer: http://stackoverflow.com/a/22530815
possible better answer: http://stackoverflow.com/a/22529457
has answer: http://stackoverflow.com/a/22529457
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22530815
answer count: 2
has body: I am newbie to selenium web driver. I just wanted verify the order of the dropdown values. Eg, i have one drop down for : Service Provider. It has 7 Values. Aircel, Airtel, BSNL, Docomo, Idea, Reliance, Vodofone. This dropdown values are sorted based on the Ascending order. How to verify that there only 7 values and the order is correct? Thanks
downvote count: 0
has title: How to verify the order of the dropdown values in selenium webdriver 2?

http://stackoverflow.com/comment/34397993
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22593776
score: 0
has text: That is the thing that is throwing me off as well, I've tried similar formats but the T and Z may be variable may not be its very weird.

proxy
tags question: http://stackoverflow.com/q/22604089
tags question: http://stackoverflow.com/q/22546495
tags question: http://stackoverflow.com/q/22506582
type: Tag
tags question: http://stackoverflow.com/q/22498820
tag name: proxy
tags question: http://stackoverflow.com/q/22604531
tags question: http://stackoverflow.com/q/22520088
tags question: http://stackoverflow.com/q/22557504

http://stackoverflow.com/q/22595502
score: 1
has comment: http://stackoverflow.com/comment/34401203
tagged with: math
tagged with: java
tagged with: collision-detection
has body: O'k so I'm trying to write a simple collision detection between 2 moving ovals(circles) and update their position and speed using this guide I found. However the results I get are not quite polished, the objects ARE colliding and updating but not always correctly, they get tangled somethimes and I'm frustrated since I cant figure out why this is happening. NOTE: please ignore the collisions of the objects with the borders, they get stuck sometimes(I need to change that and its NOT the issue I'm having trouble with) Here is my code of the 2 classes I use: package letifer.com; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.Point2D; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public class MaxwellsDemon extends JPanel{ public static final long serialVersionUID = 1L; private final Dimension DIMS = new Dimension(800, 500); private final int UPDATE_INTERVAL = 20, BALLS_COUNT = 20; private final JFrame FRAME = new JFrame("MaxwellsDemon"); private int leftCountR, leftCountB, rightCountR, rightCountB; private Ball balls[]; private Random random; private Timer timer; public MaxwellsDemon(){ super(); initThis(); initFrame(); initBalls(); registerTimer(); timer.start(); } private void initThis(){ setSize(DIMS); setBackground(Color.white); random = new Random(); } private void initFrame(){ FRAME.setContentPane(new Container(){ public void paint(Graphics g){ super.paint(g); Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)); for(int i=0; i&lt;2; i++) g2d.drawLine(0, DIMS.height+i, DIMS.width-1, DIMS.height+i); g2d.setColor(Color.blue); g2d.fillOval(25, DIMS.height+20, Ball.radius*2, Ball.radius…
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34401267
favorite count: 0
has title: how to Check for collision between 2 moving ovals(circles) correctly and update there position+speed
has answer: http://stackoverflow.com/a/22595978
accepted answer: http://stackoverflow.com/a/22595978
tagged with: collision
type: AnsweredQuestion
downvote count: 0
type: Question
tagged with: game-physics

http://stackoverflow.com/comment/34380304
has text: Sharp edge thanks for nothing, I tried a try-catch if you don't want to help then move onto the next post.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22582672

http://stackoverflow.com/comment/34379248
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22583096
has text: Yes, it is the most elegant. Use it if you don't need to keep count of indices/positions.

http://stackoverflow.com/comment/34493899
type: AnswerComment
comment on: http://stackoverflow.com/a/22644337
type: Comment
score: 0
has text: Thank you so much! That worked! I didn't even think about using all of the parameters

http://stackoverflow.com/a/22560786
has body: Firstly 17:00 isn't a valid literal on its own in XPath, you need to wrap it in quotes (single or double) if you want to treat it as a string. /trains/train[depart&lt;'17:00'] however &lt; comparison between strings only works in XPath 2.0. If you're limited to 1.0 (which you will be unless your application includes Saxon) then the less than operator is only defined between numbers. So you would need to convert the string to a suitable number to do the comparison by removing the colon /trains/train[number(translate(depart, ':', '')) &lt; 1700]
downvote count: 0
answers question: http://stackoverflow.com/q/22560386
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/34435977
type: Comment
has text: @user3456094 Sorry, but I don't know what your program is supposed to do. You're creating an array with only one element. Is that what you really want? Only you can answer that.
comment on: http://stackoverflow.com/a/22614621
score: 0
type: AnswerComment

http://stackoverflow.com/a/22550347
downvote count: 0
answers question: http://stackoverflow.com/q/22550165
has body: Add this to your game program, where curHealth is accessible. timer = new Timer(); timer.schedule(new TimerTask (){ public void run() { curHealth = curHealth + 0.1; } }, 1000);
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/a/22607920
type: Answer
has body: .getBytes() will not automagically convert a "hex string" to the matching bytes. Instead, try this utility method: private static byte[] hexStringToBytes(final String input) { final int len = input.length(); if (len % 2 != 0) throw new IllegalArgumentException(); final byte[] ret = new byte[len / 2]; int offset = 0; for (int i = 0; i &lt; ret.length; i++) { ret[i] = (byte) Integer.parseInt(input.substring(offset, offset+2), 16); offset += 2; } return ret; } Then in your code use hexStringToBytes(key) etc.
has comment: http://stackoverflow.com/comment/34423235
downvote count: 0
has comment: http://stackoverflow.com/comment/34424571
score: 1
has comment: http://stackoverflow.com/comment/34424294
has comment: http://stackoverflow.com/comment/34424504
upvote count: 1
has comment: http://stackoverflow.com/comment/34423565
answers question: http://stackoverflow.com/q/22607772

http://stackoverflow.com/comment/34212501
type: Comment
has text: `@Test` is how you mark your test methods. The others are used for setup, teardown, etc to support your tests.
type: QuestionComment
comment on: http://stackoverflow.com/q/22488479
score: 0

http://stackoverflow.com/comment/34310503
score: 0
type: AnswerComment
has text: Thanks @TedHopp, it caused a few problems elsewhere but I've managed to resolve them and it's working
comment on: http://stackoverflow.com/a/22542100
type: Comment

http://stackoverflow.com/q/22549617
accepted answer: http://stackoverflow.com/a/22549694
has comment: http://stackoverflow.com/comment/34320165
type: AnsweredQuestion
has body: public class Location { private String city; private double latitude; private double longitude; public Location(String aCity, double aLatitude, double aLongitude) { city = aCity; latitude = aLatitude; longitude = aLongitude; } void setLocation(String theCity) { city = theCity.trim(); } void setLatitude(double lat) { latitude = lat; } void setLongitude(double long1) { longitude = long1; } public String getLocation() { return city; } public double getLatitude() { return latitude; } public double getLongitude() { return longitude; } public String tooString() { String result = String.format("City: %s (%1.3f; %1.3f)", city, latitude,longitude); return result; } Main program: public class Hmwk { public static void main(String[] args) throws FileNotFoundException { Scanner input=new Scanner (new File ("input.txt")); while (input.hasNextLine()) { String line=input.nextLine(); String[] tokens; tokens = line.split("\t"); String city=tokens[0]; double lat=Double.parseDouble(tokens[1]); double longy=Double.parseDouble(tokens[2]); //Error Location loc=new Location(city,lat,longy); loc.tooString(); } } I'm getting an ArrayIndexOutOfBoundsException noted in the main program which I don't quite understand. Input is divided by tabs even if it doesn't look like it... St. Joseph, MO +39.76580 -94.85060 Shanghai,China +31.23300 +121.45000 Kansas_City,KS +39.11780 -94.64000
tagged with: java
has comment: http://stackoverflow.com/comment/34320274
has comment: http://stackoverflow.com/comment/34320147
type: Question
has comment: http://stackoverflow.com/comment/34319918
tagged with: class
has answer: http://stackoverflow.com/a/22549694
has answer: http://stackoverflow.com/a/22549736
score: 0
possible better answer: http://stackoverflow.com/a/22549857
tagged with: string
has answer: http://stackoverflow.com/a/22549857
tagged with: parsing
has answer: http://stackoverflow.com/a/22549676
has comment: http://stackoverflow.com/comment/34320045
has comment: http://stackoverflow.com/comment/34320245
has comment: http://stackoverflow.com/comment/34320178
has comment: http://stackoverflow.com/comment/34319989
has comment: http://stackoverflow.com/comment/34320288
answer count: 5
has answer: http://stackoverflow.com/a/22549695
has comment: http://stackoverflow.com/comment/34319793
tagged with: double
has comment: http://stackoverflow.com/comment/34319821
has title: Problems with a Class in Java

http://stackoverflow.com/comment/34385720
comment on: http://stackoverflow.com/a/22586702
has text: String can start with | or || or :: as well, so will this regex give me correct values? ::20:1234 ||20:|1234 etc.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22761239
type: AcceptedAnswer
type: Answer
upvote count: 23
has body: I would recommend that you set up your own context and run your blocking/cpu-intensive operations there using Plays F.Promise&lt;A&gt;. As always with threads, the optimal solution depends on numerous of things like number of cores etc. First set up your context in applications.conf: play { akka { akka.loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { fork-join-executor { parallelism-min = 1 parallelism-factor = 2 parallelism-max = 6 } } my-context { fork-join-executor { parallelism-min = 1 parallelism-factor = 4 parallelism-max = 16 } } } } } Then in your controller, make use of your context using Plays Promises (I'm using Java 8): public static F.Promise&lt;Result&gt; love() { ExecutionContext myExecutionContext = Akka.system().dispatchers().lookup("play.akka.actor.my-context"); F.Promise&lt;Integer&gt; integerPromise = F.Promise.promise(() -&gt; LongRunningProcess.run(10000L) , myExecutionContext); F.Promise&lt;Integer&gt; integerPromise2 = F.Promise.promise(() -&gt; LongRunningProcess.run(10000L) , myExecutionContext); return integerPromise.flatMap(i -&gt; integerPromise2.map(x -&gt; ok())); } This way your Play app will still handle short lasting requests on the default-dispatcher execution context and the blocking/cpu-intensive will run in my-context. I made a very short example for you demonstrating this, check it out on github.
answers question: http://stackoverflow.com/q/22535826
score: 23
accepted answer of: http://stackoverflow.com/q/22535826
has comment: http://stackoverflow.com/comment/40724433
downvote count: 0

http://stackoverflow.com/comment/34933927
score: 0
type: Comment
has text: @Angel I haven't tried this, but I think this method doesn't actually download the code. [Get()](http://msdn.microsoft.com/en-us/library/bb139264.aspx) does.
comment on: http://stackoverflow.com/a/22635965
type: AnswerComment

http://stackoverflow.com/a/22634163
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22632950
upvote count: 2
has body: If you look at ImageIO's javadoc, you'll see, that one may use an (existing) ImageWriter. With that one may set different options. How this fits into your school project I do not know. Using an existing ImageWriter, with options might be one possibility. Writing your ImageWriter including the compression I do not entirely consider school level or that educational. A start might be to look at this.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22632950
has comment: http://stackoverflow.com/comment/34470941

http://stackoverflow.com/a/22571457
accepted answer of: http://stackoverflow.com/q/22571339
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22571339
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34358234
type: Answer
has comment: http://stackoverflow.com/comment/34358337
upvote count: 1
has comment: http://stackoverflow.com/comment/34358253
has body: Check out trove, colt or apache. From first glance it doesn't appear that they have built in auto-sorting (and chances are it's probably be pretty slim pickings to find one since auto-sorting and efficiency aren't usually closely related :-)) but that shouldn't be too hard for you to implement on top of their classes. Here's a blog post showing the comparison between a couple primitive collection wrappers and java.util

http://stackoverflow.com/a/22503356
answers question: http://stackoverflow.com/q/22503275
has comment: http://stackoverflow.com/comment/34237741
has comment: http://stackoverflow.com/comment/34237472
downvote count: 0
type: Answer
score: 1
has body: I assume that you don't have brickie resource. Simply you have to have image on that path in resources "../images/brickie.png"
upvote count: 1

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/22594132
tags question: http://stackoverflow.com/q/22534667
tags question: http://stackoverflow.com/q/22560769
tags question: http://stackoverflow.com/q/22576225
tags question: http://stackoverflow.com/q/22601260
tags question: http://stackoverflow.com/q/22559506
tags question: http://stackoverflow.com/q/22492060

http://stackoverflow.com/q/22616782
has comment: http://stackoverflow.com/comment/34441732
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22729008
answer count: 2
has comment: http://stackoverflow.com/comment/34440071
downvote count: 0
tagged with: listview
has title: Most appropriate way to load data from internet into listview
has body: I have a simple query but have been picking my mind around a lot lately without a straight solution. I have a listview with loads quote data from internet. The list item is a bit complex but that is not a problem . The listview is loaded using a loader which fetches the quote data from internet, parses the json and populates the VOs. The list of VOs is set in the adapter and the notifyDataSetChanged changed is called which reloads the list through the adapter's getView now the pattern i have used here is: user clicks a button, we open a fragment the fragment has LoaderCallbacks and we initiate the loader in onActivityCreated the loader has a cached Thread Pool executor (I cant use async loaders as they essentially use linear loading not parallel across the Android API versions) which creates a download worker for each stock. the worker hits the url and downloads the data, parses the JSON using GSON, creates an object and puts it in the loader's arraylist. Loader uses a latch to wait till all the quotes are downloaded. once all are done the list is loaded. My problem is that when the listview has a lots of stocks, like 70 to 90 the quote downloading process becomes slow. ON a direct wifi network it takes about 1.5 to 2 seconds for the list to load. On mobile data networks like 2G and 3G and Hybrids it takes about 30-40 seconds to load. Profiling shows majority time spend in reading data from stream. Each quote URL hit is about 700-800 bytes and takes about 800-900ms to load. I am using HttpURLConnection to load the URLs. I cannot use the dynamic loading pattern in list as i have menu items to filter and sort the listview. They wont make any sense if we don't have all the quote data in the list in the first place. is there any better way to do this? I have read the things around and have tried "new async task for each row in the list when that row becomes visible on screen" but cant use it as such as that would mean lazy loading of data. Edit to show how the Data is d…
tagged with: android-listview
has comment: http://stackoverflow.com/comment/34439308
tagged with: android
accepted answer: http://stackoverflow.com/a/22729008
favorite count: 0
has comment: http://stackoverflow.com/comment/34440113
upvote count: 2
has comment: http://stackoverflow.com/comment/34441666
has comment: http://stackoverflow.com/comment/34441422
possible better answer: http://stackoverflow.com/a/23369526
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/23369526

http://stackoverflow.com/comment/34334143
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22548632
type: AnswerComment
has text: @user3444455 - But the compiler should have told you that ... assuming you were paying attention to warnings.

http://stackoverflow.com/a/22617279
answers question: http://stackoverflow.com/q/22617035
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34526177
type: Answer
has body: I know it's bad practice to ever sleep the UI thread. Correct, it's a very bad practice and you should avoid it as possible. You can easily achieve that by running a Thread that process what you're supposed to run within the main UI and then just update the main UI by declaring a Handler. The steps are, you declare a Handler within your main UI, you access your Handler inside the Thread loop inside your class, and whenever you need to update something in the main UI, simply send a Message to the UI Thread. static class MyHandler extends Handler { @Override synchronized public void handleMessage(final Message msg) { final String myMessage = msg.toString(); // Do whatever you need to do... ... } } final MyHandler handler = new MyHandler(); final Thread lowp = new Thread( new Runnable() { public void run() { // Do whatever you need to do ... // And call this when you have to do something in the main UI final Message mess = new Message(); mess.obj = "Update the UI!"; handler.sendMessage(mess); } }); myLoop.start();
accepted answer of: http://stackoverflow.com/q/22617035

http://stackoverflow.com/q/22501630
upvote count: 1
tagged with: swing
has body: I am a novice Java programmer and I'm finding quite some difficulty in figuring out the actual difference between the functioning of the paint() and repaint() method. Also in some of the programs that I studied I found paint() and repaint() interchangeable. Can someone please explain the difference? Thank you
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22501950
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22501836
has answer: http://stackoverflow.com/a/22501733
type: Question
has comment: http://stackoverflow.com/comment/34235273
possible better answer: http://stackoverflow.com/a/22501836
downvote count: 0
has answer: http://stackoverflow.com/a/22504109
has answer: http://stackoverflow.com/a/22501950
has title: Difference between paint() and repaint()
answer count: 4
favorite count: 0

oracle-database
tags question: http://stackoverflow.com/q/22497083
tags question: http://stackoverflow.com/q/22505130
tags question: http://stackoverflow.com/q/22580867
tags question: http://stackoverflow.com/q/22492400
tags question: http://stackoverflow.com/q/22525392
tag name: oracle-database
tags question: http://stackoverflow.com/q/22552646
tags question: http://stackoverflow.com/q/22539988
tags question: http://stackoverflow.com/q/22598172
tags question: http://stackoverflow.com/q/22618251
tags question: http://stackoverflow.com/q/22598550
tags question: http://stackoverflow.com/q/22527259
tags question: http://stackoverflow.com/q/22561632
tags question: http://stackoverflow.com/q/22576208
tags question: http://stackoverflow.com/q/22578460
type: Tag
tags question: http://stackoverflow.com/q/22614943
tags question: http://stackoverflow.com/q/22503296
tags question: http://stackoverflow.com/q/22567830
tags question: http://stackoverflow.com/q/22576460
tags question: http://stackoverflow.com/q/22643259
tags question: http://stackoverflow.com/q/22567188
tags question: http://stackoverflow.com/q/22501612
tags question: http://stackoverflow.com/q/22518991
tags question: http://stackoverflow.com/q/22629084
tags question: http://stackoverflow.com/q/22524149
tags question: http://stackoverflow.com/q/22582514
tags question: http://stackoverflow.com/q/22541060
tags question: http://stackoverflow.com/q/22503593
tags question: http://stackoverflow.com/q/22634360
tags question: http://stackoverflow.com/q/22562139
tags question: http://stackoverflow.com/q/22491177

http://stackoverflow.com/q/22489372
has comment: http://stackoverflow.com/comment/34251056
tagged with: octave
tagged with: glassfish
tagged with: linux
answer count: 0
type: UnansweredQuestion
score: 0
has title: Trying to run octave through Runtime.exec in a JSF application
tagged with: jsf
has comment: http://stackoverflow.com/comment/34213621
tagged with: java
has body: Ok, so my situation is as follows: I NEED to run a .mod file (a mathematical model) in Octave (a mathematical program used for advanced calculations), get its result and return for the user THROUGH a webapp. Not that much really, I have a application that run as smoothly as one would need on my windows enviro (development enviro, I developed it using Glassfish 4.0 and Eclipse) with the following code: ... Process p = rt.exec("C:\\Octave\\Octave3.6.4_gcc4.6.2\\bin\\octave.exe --eval \"cd " + actingFolder + "; dynare code.mod; save -text saida.txt; exit\""); InputStream in = p.getInputStream(); while(in.read != -1); ... However, when I migrate it to the linux envior (Debian GNU/Linux 7, using a Glassfish 4.0 as the AppServer) and adjust the code to run in the said system it stopped working! Follows the code which I'm currently trying to run: ... p = rt.exec("/bin/bash -c /root/octave --eval \"cd " + actingFolder + "; dynare code.mod; save -text saida.txt; exit\" --silent"); InputStream in = p.getInputStream(); while(in.read() != -1); ... When this code runs it never ends: in.read() never returns -1 (InputStream code for the end of execution) so it never stops... Also, when octave is run it generates several exit files and none of them has been created, to what I assume that either the program wasn't able to be started or, for some reason, it was denied for the webApp to create the files as an output of the Octave application... I don't really know... could you guys give me a hand? and P.S.: I'm running this application through runtime because I know no better way in order to make Octave interpret the .mod. If there's another sollution I would really aprecciate it too. UPDATE I tested througly and I can 100% guarantee that the application has the rights to create files in the server and Octave has full rights on my system... I should be able to run it correctly, right? I also was able to verify that no: the program generates no errors on running the String on shell. In…
type: Question

http://stackoverflow.com/a/29934887
score: -2
has body: I had the same issue. Upgrade your machine, you will definitely need one with an 8GB RAM. Also, reinstall IntelliJ with only the components that you need, this will increase the startup time of IntelliJ. Make sure you do not have any memory intensive program running along with IntelliJ in your current system. These things helped me.
upvote count: 0
answers question: http://stackoverflow.com/q/22503556
type: Answer
downvote count: 2

http://stackoverflow.com/a/22488291
upvote count: 4
answers question: http://stackoverflow.com/q/22488193
downvote count: 0
score: 4
has body: It has to do with how the % modulus operator works in Java. The sign of the result of this operator cannot be the opposite of the original number. That is, if the original number is negative, then the modulus would be 0 or negative. According to the JLS, Section 15.17.3, It follows from this rule that the result of the remainder operation can be negative only if the dividend is negative, and can be positive only if the dividend is positive. Moreover, the magnitude of the result is always less than the magnitude of the divisor. You're getting -1, not 1 from the result of -25 % 2, and your print statement executes. Check if the remainder is not equal to zero instead. if((arr[i] % 2) != 0) continue; Or, to eliminate the continue... if((arr[i] % 2) == 0) { System.out.println(arr[i]); }
type: Answer

http://stackoverflow.com/q/22556720
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: google-maps
has title: saving coordinates to a .gpx file and sending them to a site
downvote count: 0
favorite count: 0
has body: I have a tracking app that tracks a user through the use of gps. My plan is to save the coordinates and put them into a .gpx file so I can send them to a website so the tracks can be viewed by an administrator of the app. Is there a site that already exists that will accept my coordinates and plot the paths that it recieves?
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/79754506
type: AnswerComment
comment on: http://stackoverflow.com/a/22577274
score: 0
type: Comment
has text: How will we be using StringBuilder with collect ?

http://stackoverflow.com/comment/34249883
comment on: http://stackoverflow.com/a/22510643
type: AnswerComment
score: 0
type: Comment
has text: You are right, but I don't think you'd like to throw the *same exception* since those are different issues.

http://stackoverflow.com/q/22555787
has comment: http://stackoverflow.com/comment/34329654
has answer: http://stackoverflow.com/a/22556300
has comment: http://stackoverflow.com/comment/34329731
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22556300
type: Question
has body: I have used this code to get a list of class names from a package: private List&lt;String&gt; getClasses() { List&lt;String&gt; classes = new ArrayList&lt;String&gt;(); String packageName = "algorithm/impl"; URL directoryUrl = Thread.currentThread().getContextClassLoader(). getResource(packageName); File directory = new File(directoryUrl.getFile()); if(directory.exists()) { String [] files = directory.list(); for(String filename : files) { classes.add(filename.substring(0, filename.lastIndexOf("."))); } } return classes; } but this does not work when the app is packaged as an executable jar file. Why?
score: 0
has title: return class names not working in Jar
answer count: 1

http://stackoverflow.com/a/22604041
answers question: http://stackoverflow.com/q/22575297
score: 0
has body: Sorry. Maybe my answer is wrong. But I had the same problem when I use the URL private String url = "http://10.0.2.2/TA/adduser.php"; Then I changed the format likeas private static String url = "http://192.168.137.1:81/TA/adduser.php"; Then I was work properly. Again I am saying I don't know my answer is correct or wrong. But try this as well.
has comment: http://stackoverflow.com/comment/34416135
type: Answer

http://stackoverflow.com/comment/34298981
comment on: http://stackoverflow.com/a/22537274
has text: You have to define interface in src folder, in the same folder when you have MainActivity of Fragments classes files for example, just click right button on your pack and pick Create and then new class
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34493765
has text: Please show any code you have that attempts to solve the problem, along with any problems you might have encountered, and then you will receive some guidance. But, we won't do your (home)work for you.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22647352

http://stackoverflow.com/a/22632211
answers question: http://stackoverflow.com/q/22631993
has comment: http://stackoverflow.com/comment/34467902
has comment: http://stackoverflow.com/comment/34466588
has body: You can get the length of the text of a JFormattedTextField, say jtf here this way: jtf.getText().length(); Note: according to what you want use this : String s = jtf.getText(); s = s.replaceAll(",", ""); if (s.length() != 4) But the problem you've got is due to the way you've used the loops. I think you want to show a reaction when the user enters exactly for digits, and if so, you don't need a loop at all. According to the comments: Remove the loops (nTry &lt; 3 ... ) Define int nbTry = 0; as a class member and keep track of it in your action listener. Inside the BoutonListener check if everything is right do whatever otherwise nTry++, and if nTry >=3 do whatever you want. import java.io.*; import java.text.NumberFormat; import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main extends JFrame { //-------------------------------here int nbTry = 0; //-------------------------------here private static final long serialVersionUID = 1L; private JPanel container = new JPanel(); private JFormattedTextField jtf = new JFormattedTextField(NumberFormat.getIntegerInstance()); private JLabel label = new JLabel("Enter Pin: "); private JButton b = new JButton("OK"); public Main() { jtf.getText().length(); this.setTitle("APP"); this.setSize(300, 500); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); container.setBackground(Color.white); container.setLayout(new BorderLayout()); JPanel top = new JPanel(); Font police = new Font("Arial", Font.BOLD, 14); jtf.setFont(police); jtf.setPreferredSize(new Dimension(150, 30)); jtf.setForeground(Color.BLUE); b.addActionListener(new BoutonListener()); top.add(label); top.add(jtf); top.add(b); this.setContentPane(top); this.setVisible(true); } class BoutonListener implements ActionListener { public void actionPerformed(ActionEvent e) { String s = jtf.getText(); s = s.replaceAll(",", ""); System.out.println(s); System.out.println(s.length()); boolean authenticat…
has comment: http://stackoverflow.com/comment/34467958
has comment: http://stackoverflow.com/comment/34467427
type: Answer
has comment: http://stackoverflow.com/comment/34467847
score: 0
has comment: http://stackoverflow.com/comment/34468223
has comment: http://stackoverflow.com/comment/34467638
has comment: http://stackoverflow.com/comment/34467802
has comment: http://stackoverflow.com/comment/34466323
has comment: http://stackoverflow.com/comment/34468300
has comment: http://stackoverflow.com/comment/34467218
has comment: http://stackoverflow.com/comment/34466404

http://stackoverflow.com/q/22614929
has title: Remove shadows below actionbar appcompat
score: 8
type: AnsweredQuestion
has body: Is it possible to remove the shadow below the Actionbar? I am using the AppCompat v7 library.
linked to: http://stackoverflow.com/q/12246388
tagged with: android-actionbar
tagged with: android-actionbar-compat
type: Question
possible better answer: http://stackoverflow.com/a/22615043
tagged with: java
has answer: http://stackoverflow.com/a/29354822
accepted answer: http://stackoverflow.com/a/29354822
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22615043
upvote count: 8
has comment: http://stackoverflow.com/comment/54406729
tagged with: android

http://stackoverflow.com/comment/34388063
type: AnswerComment
has text: What would be the benefit of a skip list over a hashtable?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22588060

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/22628085
tags question: http://stackoverflow.com/q/22537415
tags question: http://stackoverflow.com/q/22580853
tags question: http://stackoverflow.com/q/22560998
tags question: http://stackoverflow.com/q/22505753
tags question: http://stackoverflow.com/q/22610761

http://stackoverflow.com/comment/34485186
comment on: http://stackoverflow.com/q/22641639
has text: YES, the session is NULL when I try to call the method from the SERVLET. But it is NOT NULL whenever I call the method from ANYWHERE ELSE!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/97439814
has text: The Lucene Core version x.x.x needs to be > 3.0.0. We had an older Lucene (2.x) in Maven pom.xml which caused exactly the same error.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22539802

http://stackoverflow.com/a/22578391
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22578373
has body: Add the JScrollPane to the JPanel, not the JTextArea. To Scroll to the bottom, see this answer.
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/22496864
upvote count: 2
has comment: http://stackoverflow.com/comment/34253030
has body: You'll note that in the Javadoc for HashMap Map.containsKey() takes an Object as its argument. The class was added in Java 1.2 prior to generics, and when generics were added in 1.5 the method signature wasn't changed. This means when you do: if (map1.containsKey(1)) { 1 gets autoboxed to an Integer object. Then during the key lookup, the hashcode() method is called for that Integer object to see if it exists in the Map. And ... it doesn't. You would need to convert that int to a String for it to work correctly given your Map&lt;String,String&gt;: if (map1.containsKey(String.valueOf(1)) {
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/22496735
answers question: http://stackoverflow.com/q/22496735
has comment: http://stackoverflow.com/comment/34249934
type: Answer
score: 1

http://stackoverflow.com/q/22517318
has comment: http://stackoverflow.com/comment/34443491
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34263963
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34266612
has body: I'm a beginner and haven't used MyBatis before and decided to start by working through the MyBatis getting started guide on the official Github site: http://mybatis.github.io/mybatis-3/getting-started.html However, I ran into some trouble early on and I was hoping it is something simple that someone can help me with. Specifically, I'm stuck trying to do the example under the header "Building SqlSessionFactory without XML". The example is as follows: If you prefer to directly build the configuration from Java, rather than XML, or create your own configuration builder, MyBatis provides a complete Configuration class that provides all of the same configuration options as the XML file. DataSource dataSource = BlogDataSourceFactory.getBlogDataSource(); TransactionFactory transactionFactory = new JdbcTransactionFactory(); Environment environment = new Environment("development", transactionFactory, dataSource); Configuration configuration = new Configuration(environment); configuration.addMapper(BlogMapper.class); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration); I then looked through the JavaDoc for the latest mybatis-3.2.5 release and couldn't find some of the classes I was looking for, like BlogDataSourceFactory and BlogMapper. Also, everything is under org.apache.ibatis when I would have expected it to be under org.mybatis (apparently ibatis is the old project name when it was maintained by Apache). I also checked the pre-release mybatis-3.2.6-SNAPSHOT but it had the same package structure and I still couldn't find those missing classes. Sorry if this is a really dumb question/I'm missing something obvious, I'm not that experienced of a Java developer either and I appreciate any help!
answer count: 2
has answer: http://stackoverflow.com/a/42051489
downvote count: 0
tagged with: mybatis
favorite count: 0
possible better answer: http://stackoverflow.com/a/22664437
has title: Can't find some MyBatis classes to import in getting started guide
has answer: http://stackoverflow.com/a/22664437
accepted answer: http://stackoverflow.com/a/42051489
upvote count: 1

http://stackoverflow.com/a/22508150
has comment: http://stackoverflow.com/comment/34251327
has comment: http://stackoverflow.com/comment/34252939
has body: Your regex is already optimized one as its very simple. You can make is much simpler or readable only. Also if you use the matches() method of Java's String class then you'll not require the ^ and $ at the both ends. .*([\\[\\]^$?*+]).* Double slashes(\\) for Java, otherwise please use single slash(\). Look, I have removed the captures () along with escape character \ for the characters ^$?*+ as they are inside the character class [].
has comment: http://stackoverflow.com/comment/34253381
type: Answer
answers question: http://stackoverflow.com/q/22507972
has comment: http://stackoverflow.com/comment/34253121
score: 2
upvote count: 3
downvote count: 1
accepted answer of: http://stackoverflow.com/q/22507972
has comment: http://stackoverflow.com/comment/34252628
type: AcceptedAnswer

http://stackoverflow.com/q/22552530
type: Question
has body: I have the below method as shown below in which date is coming as of string: public static java.sql.Date getSimpleDate11(String dateString) { if (dateString == null) { return null; } java.util.Date date = null; java.sql.Date sqlDate =null ; try { DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); df.setLenient(false); date = df.parse(dateString); sqlDate = new java.sql.Date(date.getTime()); } catch (ParseException pe) { throw new RuntimeException("The date entered is invalid or has incorrect format"+ dateString); } return sqlDate; Now I want to change the format: I want to store the date in the format dd-MMM-yyyy. What should I do?
has title: Getting date in format dd-MMM-yyyy
downvote count: 1
has comment: http://stackoverflow.com/comment/34324375
has comment: http://stackoverflow.com/comment/34325743
upvote count: 3
tagged with: java
answer count: 3
tagged with: date
has answer: http://stackoverflow.com/a/22552743
score: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5401236
has comment: http://stackoverflow.com/comment/34324205
has comment: http://stackoverflow.com/comment/34324326
has comment: http://stackoverflow.com/comment/34324255
has comment: http://stackoverflow.com/comment/34324395
has answer: http://stackoverflow.com/a/22553669
favorite count: 0
has answer: http://stackoverflow.com/a/22553831
has comment: http://stackoverflow.com/comment/34324310

http://stackoverflow.com/comment/34415371
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22603473
has text: I am using Spring 3 MVC.
score: 0

http://stackoverflow.com/comment/34470244
type: Comment
type: QuestionComment
has text: Can you say a bit more about how is the data stored/read? For me, it seems that you read this data from a file.
score: 0
comment on: http://stackoverflow.com/q/22634450

http://stackoverflow.com/a/22606381
downvote count: 1
has comment: http://stackoverflow.com/comment/42409162
score: -1
upvote count: 0
has body: Try this: Since you set the showAsAction attribute to never, then these menu items will never show as action views. Try this: &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="ifRoom|withText"/&gt; &lt;!-- Email --&gt; &lt;item android:id="@+id/action_email" android:icon="@drawable/ic_action_email" android:title="@string/action_email" android:showAsAction="ifRoom|withText"/&gt; &lt;!-- Help --&gt; &lt;item android:id="@+id/action_help" android:icon="@drawable/ic_action_help" android:title="@string/action_help" android:showAsAction="ifRoom|withText"/&gt; &lt;!-- attach --&gt; &lt;item android:id="@+id/action_attach" android:icon="@drawable/ic_action_attachment" android:title="@string/action_attach" android:showAsAction="ifRoom|withText"/&gt;
answers question: http://stackoverflow.com/q/22606186
type: Answer

http://stackoverflow.com/comment/34328993
score: 0
type: AnswerComment
has text: I don't understand your code. Sorry. I tried it in SQL Fiddle and I am getting errors. Also where do I write this code? In Java? SQL?
type: Comment
comment on: http://stackoverflow.com/a/22555560

http://stackoverflow.com/comment/34423555
type: Comment
has text: Yes, but I have converted my pdf to bytearray, in your example, where I send my bytearray to printer?
comment on: http://stackoverflow.com/a/22608234
score: 0
type: AnswerComment

http://stackoverflow.com/a/22629618
downvote count: 0
score: 1
has body: I think you have to document your framework : To do a specific think you have to create a class which implements a specific interface. (like in the spring documentation)
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22629400

ibm-mq
tags question: http://stackoverflow.com/q/22552678
type: Tag
tags question: http://stackoverflow.com/q/22491911
tag name: ibm-mq

http://stackoverflow.com/a/22581575
has comment: http://stackoverflow.com/comment/34376046
accepted answer of: http://stackoverflow.com/q/22581216
score: 0
answers question: http://stackoverflow.com/q/22581216
type: AcceptedAnswer
has body: You might put and run everything in one black box, but it's not recommended. The Enterprise JavaBeans are supposed to perform actions related to the database or external resources. The managed beans are responsible of interaction with your pages (View) and with those EJB (Logic). The JSF framework respects the MVC architecture which isolates the layers from each others: your entites and logic layer (Model) and your pages (View).
type: Answer

http://stackoverflow.com/q/22536931
has comment: http://stackoverflow.com/comment/34337464
has comment: http://stackoverflow.com/comment/34296861
has title: Gooddata Data loading in demo TwitterAPI project?
score: 0
answer count: 1
has body: Component [Twitter API call:TWITTER_API_CALL1] finished with status ERROR. Exception occurred during signing the request: GET org.apache.https://api.twitter.com/1.1/search/tweets.json?q=gooddata&amp;result_type=mixed&amp;count=100 HTTP/1.1 This consumer expects requests of type org.apache.http.HttpRequest ERROR [main] - Execution of graph failed !
type: UnansweredQuestion
tagged with: gooddata
tagged with: java
has answer: http://stackoverflow.com/a/22560422
type: Question

http://stackoverflow.com/q/22519982
possible better answer: http://stackoverflow.com/a/22520360
has body: I have created a GUI and have a database located externally in which I fetch data from. I am using the GUI builder in NetBeans to do this. Does anyone know of a simple way to populate a jComboBox with values coming from the database? When I run the project there are no errors but the combo box remains empty. Here is the code that sets the combo box with the names of discounts: public void setDiscountNames(String type, JComboBox cbox) { cbox.removeAllItems(); ArrayList&lt;Discount&gt; names = new ArrayList&lt;Discount&gt;(); try { Connection con = null; PreparedStatement stmt = null; ResultSet rs = null; con = DriverManager.getConnection("jdbc:mysql://localhost:3306/abpp034?user=abpp034&amp;password=120001772"); stmt = con.prepareStatement("SELECT Name FROM Discount WHERE Type = \"" + type + "\""); rs = stmt.executeQuery(); while(rs.next()){ cbox.addItem(rs.getString("Name")); } } catch (SQLException ex) { Logger.getLogger(Model.class.getName()).log(Level.SEVERE, null, ex); } } This is located in a seperate class from the jComboBox object. This class is called Model. Here is the place I call the setDiscountNames method in a form called DiscountGUIView: private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt){ model.setDiscountNames("Fixed", jComboBox1); } Okay (Update) the query does print the results: run: Travel Standard Fixed Standard BUILD SUCCESSFUL (total time: 1 second)
upvote count: 1
has comment: http://stackoverflow.com/comment/34268028
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34267419
has title: How to populate data in a JComboBox?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22520399
has comment: http://stackoverflow.com/comment/34267582
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34267648
favorite count: 0
accepted answer: http://stackoverflow.com/a/22520399
has comment: http://stackoverflow.com/comment/34267753
has answer: http://stackoverflow.com/a/22520520
tagged with: jdbc
has answer: http://stackoverflow.com/a/22520360
has comment: http://stackoverflow.com/comment/34267944
tagged with: jcombobox
tagged with: netbeans

http://stackoverflow.com/a/22594328
downvote count: 0
answers question: http://stackoverflow.com/q/22594207
has body: Hava a look at Java: Identifier expected : i = 900; is a statement as any other. You can't write statement anywhere. It must be in methods/constructors body. Initializing variable in declaration is called definition and is exception to this rule. http://docs.oracle.com/javase/tutorial/java/nutsandbolts/expressions.html If you want to initialize static variable you can do it 2 (sane) ways: Initialize variable right where you are declaring it: class Sekar { public static int i = 900, j,k; static void max() { j = 100; if(i&gt;j) { k=i; } else { k=j; } System.out.println("The maxmimum vale between"+i+"and"+j+"is :"+k); } public static void main(String[] args) { max(); } } or do it in static constructor: class Sekar { public static int i, j,k; static { i = 900; } static void max() { j = 100; if(i&gt;j) { k=i; } else { k=j; } System.out.println("The maxmimum vale between"+i+"and"+j+"is :"+k); } public static void main(String[] args) { max(); } } Also, if you want to define a constant I recommend using final keyword. j could be converted to local variable. class Sekar { public static final int I = 900; static void max() { int k; int j = 100; if(I&gt;j) { k=I; } else { k=j; } System.out.println("The maxmimum vale between"+I+"and"+j+"is :"+k); } public static void main(String[] args) { max(); } }
upvote count: 2
has comment: http://stackoverflow.com/comment/34399909
has comment: http://stackoverflow.com/comment/34404191
has comment: http://stackoverflow.com/comment/34412349
type: Answer
score: 2

http://stackoverflow.com/a/22525038
answers question: http://stackoverflow.com/q/22525002
upvote count: 3
has body: You do realise that you never create an instance of DrawImage nor do you actually add it to anything that could display it public class DrawImage extends JPanel { BufferedImage image; public DrawImage() throws IOException { getFile(); } public void getFile() throws IOException { image = ImageIO.read(new File("grass.png")); } //... public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { DrawImage pane = new DrawImage(); JFrame frame = new JFrame(); frame.add(pane); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setSize(400, 400); frame.setVisible(true); } catch (IOException exp) { exp.printStackTrace(); } } }); }
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34275867
accepted answer of: http://stackoverflow.com/q/22525002
has comment: http://stackoverflow.com/comment/34275810
type: Answer

http://stackoverflow.com/a/22488069
answers question: http://stackoverflow.com/q/22487849
score: 0
has body: A compile error will generate stating to override abstract methods. Remember that, an interface, unlike an abstract classs, can provide no implementation at all. This means that, any class that implements an interface must provide the implementation for all methods.
type: Answer

http://stackoverflow.com/q/22592133
type: Question
has body: I'm trying to take the asynctask code and converting it to a function that will run at a service class. The asynctask code starts like that - public class HttpUploader extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... path) { String outPut = null; for (String sdPath : path) { Bitmap bitmapOrg = BitmapFactory.decodeFile(sdPath); ByteArrayOutputStream bao = new ByteArrayOutputStream(); //rest of the code Now I've tried to convert it a function - like that - private String httpUploader (String path){ String outPut = null; for (String sdPath : path) { Bitmap bitmapOrg = BitmapFactory.decodeFile(sdPath); ByteArrayOutputStream bao = new ByteArrayOutputStream(); With this code above, it shows me the path is in error, at the line - for (String sdPath : path) And when standing on it - it says - "Can only iterate over an array or instance of java.lang..." So I guess that the problem is because that in the asynctask the do in the backround function gets - String... path. So with what can I changed it in order to get this error off? Thanks for any kind of help
answer count: 1
has answer: http://stackoverflow.com/a/22592178
accepted answer: http://stackoverflow.com/a/22592178
score: 0
tagged with: android
has title: Android - Changing the (String... path) from asynctask into a function that sits at a service
tagged with: android-asynctask
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22633311
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22632826
has body: What about having the arrays in an array: String[] arr1 = { "a", "b", "c" }; String[] arr2 = { "d", "e" }; String[] arr3 = { "f", "g", "h", "i" }; String[][] arrays = new String[][] { arr1, arr2, arr3 }; public void mix(String[][] arrays) { if (arrays.length &gt; 0) { List&lt;String&gt; result = Arrays.asList(arrays[0]); for (int i = 1; i &lt; arrays.length - 1; i++) { String[] aux = arrays[i]; for (int j = 0; j &lt; aux.length; j++) { result.add(j, result.get(j) + aux[j]); } } } }
score: 0

http://stackoverflow.com/q/22582867
has comment: http://stackoverflow.com/comment/34378503
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I made a an android app with only 1 screen activity_main.xml. When I ran the app it worked fine. Later on I added another file welcome.xml to res/layouts. Now when i set setContentView(R.layout.welcome); The app crashes. Here is my welcome.xml code: &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/head" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="80dp" android:text="2D X&amp;amp;O" android:textAppearance="?android:attr/textAppearanceLarge" android:textSize="50sp" /&gt; &lt;Button android:id="@+id/go" android:layout_width="100dp" android:layout_height="50dp" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="Start" android:textSize="20sp" /&gt; &lt;/RelativeLayout&gt; MainActivity.java: package com.nhw.dxo; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { char[][] a=new char[3][3]; char b=' '; int i=0,j=0,k=0,o=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome); for(j=0;j&lt;3;j++) { for(k=0;k&lt;3;k++) { a[j][k]=' '; } } Button btn1 = (Button)findViewById(R.id.btn1); Button btn2 = (Button)findViewById(R.id.btn2); Button btn3 = (Button)findViewById(R.id.btn3); Button btn4 = (Button)findViewById(R.id.btn4); Button btn5 = (Button)findViewById(R.id.btn5); Button btn6 = (Button)findViewById(R.id.btn6); Button btn7 = (Button)findViewById(R.id.btn7); Button btn8 = (Button)findViewById(R.id.btn8); Button btn9 = (Button)findViewById(R.id.btn9); btn1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { j=0;k…
upvote count: 1
has answer: http://stackoverflow.com/a/22582884
type: Question
tagged with: android-layout
accepted answer: http://stackoverflow.com/a/22582884
score: 1
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
has title: App crashes when default layout is changed saying, Unfortunately app has stopped
tagged with: android

http://stackoverflow.com/q/22518594
score: 2
type: AnsweredQuestion
tagged with: java.util.scanner
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/49255862
has answer: http://stackoverflow.com/a/22518857
has title: Populating Scanner with default value on Scanner.nextLine();
has answer: http://stackoverflow.com/a/22689846
accepted answer: http://stackoverflow.com/a/22689846
has answer: http://stackoverflow.com/a/79545151
upvote count: 2
possible better answer: http://stackoverflow.com/a/49255862
has answer: http://stackoverflow.com/a/74351079
tagged with: string
tagged with: default
favorite count: 0
answer count: 5
has body: I am writing a Java program that runs a loop and keeps asking the user for input. The program then does a bunch of things with the string, and asks for another string and repeats. The issue is that many strings are very similar, so I would like to populate the prompt with the input from the last time in the loop. For example, if the user enters a value as follows: Enter the SKU Number: APE-6603/A ... then the next time it asks for an SKU, it will wait till the user presses enter as normal, but be ready with the last value before the user even types anything: Enter the SKU Number: APE-6603/A ... and the user can make simple changes very fast like replace the /A with /B and press enter! If the string that holds the user input is called "lookFor", is there a way to populate the prompt with this value in Java? It would be very useful!

http://stackoverflow.com/comment/34408071
type: Comment
has text: @lvi Because in that case `Product` has a constructor `Product(int)`, which matches `super(2)` from a subclass.
score: 2
comment on: http://stackoverflow.com/a/22599253
type: AnswerComment

http://stackoverflow.com/comment/34475074
type: QuestionComment
comment on: http://stackoverflow.com/q/22636440
has text: @Neil Of course they have to be taken into account, and of course the list shouldn't be resized if it can be avoided. My comment only touches your classification as "rather inefficient". The overhead induced by resizing when doing nothing but inserting the same object is maybe 10-20%.
score: 0
type: Comment

http://stackoverflow.com/a/22578269
score: 0
has comment: http://stackoverflow.com/comment/34369994
type: Answer
has body: public void onClick(View v) { //i would like this part to check that checktime is checked and that there is no data in editText Time1 if(Time1.length()==0){ checktime.setChecked(true); Toast.makeText(Current.this, "Bro, try Android :)", Toast.LENGTH_LONG).show(); } //i would like this part to check that checkCurrent is checked and that there is no data in editText current1 if(current1.length()==0){ checkCurrent.setChecked(true); Toast.makeText(Current.this, "Bro, i mean it ", Toast.LENGTH_LONG).show(); } //i would like this part to check that checkCharge is checked and that there is no data in editText charge1 if(charge1.length()==0){ checkCharge.setChecked(true); Toast.makeText(Current.this, "Bro, tryAndroid ", Toast.LENGTH_LONG).show(); } // please note that i have not yet added the current.text field yet as i cannot be bothered with it throwing up errors just yet, please bear // in mind that i will be doing another two sums on this program, the next sum will be current1 / time1 and then the next will be charge1/current1 // any help would be much appreciated, for now i only want the program to check that EditText current1 is empty and if so do the calculation bellow // EditText Charge1 = (EditText)findViewById(R.id.number_input_2); // EditText Time1 = (EditText)findViewById(R.id.number_input_3); // TextView Distances_answer = (TextView)findViewById(R.id.Distances_answer); double charge = Double.parseDouble(Charge1.getText().toString()); double time = Double.parseDouble(Time1.getText().toString()); //Time is a class in Java Distances_answer.setText("" +charge*time); } }); Just make sure that you findviewbyid all the edit texts before the button click.
answers question: http://stackoverflow.com/q/22577986

http://stackoverflow.com/a/22648312
type: Answer
has body: If the high and low numbers are array index, Tony has already answered your question. If the high and low numbers are array values, please see code below. public static int [] filterRange(int [] array, int low, int high){ int[] array1 = new int[array.length]; int numbers = 0; for (int i = 0; i &lt; array.length; i++){ ///// this is what you really mean, right? if (array[i] &lt;= high &amp;&amp; array[i] &gt;= low){ array1[numbers] = array[i]; numbers ++; } } return Arrays.copyOfRange(array1, 0, numbers); } then you can use a for loop to output the result int[] result = new int[numbers]; for (int i = 0; i &lt; numbers; i++) result[i] = array1[i]; return result;
score: 0
has comment: http://stackoverflow.com/comment/34495586
answers question: http://stackoverflow.com/q/22647619

http://stackoverflow.com/comment/34712413
type: AnswerComment
has text: This error occurs when any class is not found in project. Check that "business.schedular.QuartzSchedulerListener" class is included in your project and also struts2 is there.
comment on: http://stackoverflow.com/a/22661211
score: 0
type: Comment

http://stackoverflow.com/q/22625575
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/22776185
has title: Creating a Commons Collections MultiValueMap with a custom value collection type
tagged with: apache-commons-collection
type: AnsweredQuestion
has body: The 4.0 release of the Apache Commons Collections library has added generics support. I am having trouble converting my code to take advantage of it: I would like a MultiValueMap which takes a String as a key, and a collection of Strings as the value. But: The keys should retain insertion ordering (so I create the multi-valued map by decorating a LinkedHashMap) The values should be unique for each key and retain insertion ordering (so I want the values Collection type to be a LinkedHashSet). The closest I can get is: MultiValueMap&lt;String, String&gt; orderedMap = MultiValueMap.multiValueMap( new LinkedHashMap&lt;String, Collection&lt;String&gt;&gt;(), LinkedHashSet.class ); But that produces the error: The method multiValueMap(Map&lt;K,? super C&gt;, Class&lt;C&gt;) in the type MultiValueMap is not applicable for the arguments (LinkedHashMap&lt;String,Collection&lt;String&gt;&gt;, Class&lt;LinkedHashSet&gt;) So now I am in generics hell. Any suggestions would be most welcome. Prior to version 4.0, I accomplished that with the following: MultiValueMap orderedMap = MultiValueMap.decorate( new LinkedHashMap&lt;&gt;(), LinkedHashSet.class ); Simple! I provide the LinkedHashMap to decorate with MultiValueMap behaviour, and specify the type of collection (LinkedHashSet) to use as the values. But that requires casting when I call put() and get() and so I'd like to be able to use the new generic version provided by 4.0.
tagged with: java
possible better answer: http://stackoverflow.com/a/22625619
accepted answer: http://stackoverflow.com/a/22776185
type: Question
has answer: http://stackoverflow.com/a/22625619
score: 5
upvote count: 5
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/34422785
score: 0
has text: You don't need all those flushes and closes. Just close the BufferedOutputStream and the BufferedInputStream. There's nothing here that would corrupt the data except possibly a resumed download if you didn't resume at the right place, or you didn't do the right closes when you get an exception. What *is* your exception handling?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22607588

http://stackoverflow.com/a/29839890
score: 0
type: Answer
has body: I want to know how can we call the servlet class on that button click.I m using button in place of submit button You don't need js here, you can do it with the existing form itself. Replace the input tag as follows: &lt;input type="submit" name="fetchdata" value="CLick to get data" /&gt; If you still want to use js, try below script instead: function callservlet() { document.forms.getdata.submit(); }
answers question: http://stackoverflow.com/q/22505347

http://stackoverflow.com/a/22517101
downvote count: 0
has comment: http://stackoverflow.com/comment/34262364
upvote count: 3
has comment: http://stackoverflow.com/comment/34262412
type: AcceptedAnswer
has body: Yes, Use the DataOutputStream: ByteArrayOuputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); dos.writeShort(val); This works even on embedded java devices with low java version 1.3 To read in use: ByteArrayInputStream and DataInputStream dis, and dis.readShort(): ... byte[] bytes = bos.toByteArray(); ByteArrayInputStream bis = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bis); short val = dis.readShort();
has comment: http://stackoverflow.com/comment/34262253
answers question: http://stackoverflow.com/q/22516923
type: Answer
has comment: http://stackoverflow.com/comment/34262420
accepted answer of: http://stackoverflow.com/q/22516923
score: 3

http://stackoverflow.com/comment/34339764
comment on: http://stackoverflow.com/q/22556701
has text: Is JDK 7 in your `PATH`? see also [*SDB:Installing Java*](http://en.opensuse.org/SDB:Installing_Java).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34212563
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22488434
has text: But i firstly flush() the printWriter and then write to the PrintStream(i also tried with the normal outputStream) and flushing() the byteStream! And why does it work on wlan and a Thread.sleep()?

spongycastle
type: Tag
tag name: spongycastle
tags question: http://stackoverflow.com/q/22518092

http://stackoverflow.com/comment/34333161
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22557546
has text: I am sorry, you mean the command and the output?
score: 0

http://stackoverflow.com/comment/34282292
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22528831
has text: You've given `checkQuery` the value `"SELECT iid FROM item WHERE iid = KEY_IID"`, so why would it be `null`?
score: 0

http://stackoverflow.com/comment/34374243
comment on: http://stackoverflow.com/q/22572833
score: 0
has text: That's ok, although Amith below, gave me the exact solution I was looking for, I will be using Javascript in tough situations where Selenium selectors aren't enough. For instance, using JavascriptExecutor(jqueryScript) to run javascript/jquery code within Java. So that's still very helpful, thanks.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34302446
score: 1
type: Comment
type: QuestionComment
has text: Try to use **g & 0xFF**
comment on: http://stackoverflow.com/q/22539995

http://stackoverflow.com/q/22569083
has answer: http://stackoverflow.com/a/22569394
type: Question
answer count: 2
has title: Java hangman - repeated letters
tagged with: java
possible better answer: http://stackoverflow.com/a/22569304
upvote count: 1
accepted answer: http://stackoverflow.com/a/22569394
has answer: http://stackoverflow.com/a/22569304
has comment: http://stackoverflow.com/comment/34353776
has body: I've been developing a hangman code for java and managed to get it working, but when it comes to words with repeated letters such as "banana" where the 'a' is repeated, my code does not seem to work. So far, I've created a loop, where it loops from 0 to the 'genRadmLetter's array length. Inside the loop, I've created a if statement saying if the position is not -1, then update the array. Else print 'letter not found'. Here is the particular piece of code I'm talking about: int rpCount = 0; for (int y = 0; y&lt;genRadmLetter.length; y++){ int position = radmWord.indexOf(guessedLetter, rpCount); if (position != -1){ genRadmLetter[RW] = guessedLetter; System.out.println(genRadmLetter); result = true; } } } if (result != true){ System.out.println("Wrong letter, try again."); } Here is my whole code: import java.util.Scanner; import java.util.Arrays; public class Hangman{ public static void main(String []args){ Scanner Input = new Scanner(System.in); String[] CollectionOfWords = {"","gravity","banana","gate","processor","momentum","earth","star","light","television","pan","cupboard"}; int radmNumber = (int) Math.ceil (Math.random() * CollectionOfWords.length); int counter = 10; String radmWord = CollectionOfWords[radmNumber]; System.out.println(radmWord); char[] genRadmLetter = radmWord.toCharArray(); char[] genRadmLetter2 = radmWord.toCharArray(); for (int x = 0; x&lt;genRadmLetter.length; x++){ genRadmLetter[x]='?'; } System.out.println(String.valueOf(genRadmLetter)); System.out.println("Hello. Guess a letter."); char guessedLetter = Input.next().charAt(0); int RW = radmWord.indexOf(guessedLetter); boolean result = false; if (RW &gt;= 0 ){ int rpCount = 0; for (int y = 0; y&lt;genRadmLetter.length; y++){ int position = radmWord.indexOf(guessedLetter, rpCount); if (position != -1){ genRadmLetter[RW] = guessedLetter; System.out.println(genRadmLetter); result = true; } } } if (result != true){ System.out.println("Wrong letter, try again."); } while (counter != 0) { if (RW…
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/34227855
type: AnswerComment
type: Comment
has text: made changes as guided by you. Result is not encouraging. now the whole arraylist is gone. bean.itmLst.size is zero.
comment on: http://stackoverflow.com/a/22496927
score: 0

http://stackoverflow.com/q/22593280
tagged with: jquery
has body: I'm making a jsp site with spring mvc. protected String[] complexProperty = null;// ["something","something's value"] in controller I added model.addAttribute("SetProperties", arrays);//where arrays is [] of complexProperties = [[1,a],[2,b],[]...] in javascript(jquery) in jsp site I wanted to access concrete elements like var complexProperty = '${SetProperties[0][0]}';// will give me 1 alert(whichTable+" complex:"+complexProperty2); Now I want to print them in for loop, so I need to change those [0][0] dynamicly somehow. but I cant figure out how to do it I already tried var temp=0; var complexProperty = '${SetProperties[temp][temp]}'; var complexProperty = '${SetProperties["temp"]["temp"]}'; var complexProperty = '${SetProperties[${"temp"}][${"temp"}]}'; var complexProperty = '${SetProperties["${temp}"]["${temp}"]}'; but none of them gave me 1, either error or something strange.
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22595918
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22595918
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22593689
has title: How can I access element of complicated model in jquery?
has answer: http://stackoverflow.com/a/22593689
tagged with: jsp

http://stackoverflow.com/q/22561303
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22561437
score: 0
tagged with: printing
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
has body: I have to print a pdf from a URL. I had read a lot of websites but, I have not found a solution. I´m using JAVA 7 for my project. Could somebody help me with this problem? (example, website, manual, code) Thank you in advance.
has answer: http://stackoverflow.com/a/22561437
tagged with: java
has title: Print pdf from url java
type: Question

http://stackoverflow.com/a/22621591
answers question: http://stackoverflow.com/q/22621569
has body: BigDecimal productOfStock1 = BigDecimal.ZERO; you need to initialize it with 1, because 0 * X = 0 (except for X= 1/0 :) )
score: 5
upvote count: 5
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34244662
comment on: http://stackoverflow.com/a/22507858
type: AnswerComment
has text: Ok, I just tried with `spy()`, but it isn't working. What happens to the references in a class when we use spy? Are they null? Currently I was injecting some mock objects into it using @InjectMocks
score: 0
type: Comment

http://stackoverflow.com/q/22556057
answer count: 4
type: AnsweredQuestion
has title: Android acessing MainActivity from AsyncTask
tagged with: java
has answer: http://stackoverflow.com/a/22556313
has answer: http://stackoverflow.com/a/22556285
type: Question
has answer: http://stackoverflow.com/a/22556154
possible better answer: http://stackoverflow.com/a/22556129
score: 0
accepted answer: http://stackoverflow.com/a/22556313
has answer: http://stackoverflow.com/a/22556129
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/34330510
has body: My application crashes after click the button, but the code executes properly. public void makeLead(View v) throws Exception { try { RegisterTimer rt = new RegisterTimer(); rt.ma = this; rt.execute(null); } catch (Exception e) { e.printStackTrace(); } } public void log(String msg) { final TextView tv = (TextView)findViewById(R.id.editText); tv.append(msg); } private class RegisterTimer extends AsyncTask { public MainActivity ma; @Override protected Object doInBackground(Object[] objects) { ma.log("ausd"); return null; } } makeLead is onClick event. Method ma.log generates an error but works properly (msg added to textEdit). When I delete ma.log, app doesn't crash. I have no logs in my AndroidStudio so I can't see error message. What's wrong ?
tagged with: android

http://stackoverflow.com/q/22558003
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34333501
favorite count: 0
tagged with: android
score: -2
accepted answer: http://stackoverflow.com/a/22558302
has title: void is an invalid type for the variable
downvote count: 2
has comment: http://stackoverflow.com/comment/34333584
type: AnsweredQuestion
has body: I am getting this error: void is an invalid type for the variable q1b1 When I tried this: My layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/RelativeLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:orientation="vertical" tools:context=".Q1" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginBottom="20dp" android:layout_marginTop="20dp" android:gravity="center" android:contentDescription="note" android:src="@drawable/note" /&gt; &lt;Button android:id="@+id/button1" android:textColor="#ffff" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/imageView1" android:layout_alignRight="@+id/imageView1" android:layout_below="@+id/imageView1" android:onClick="q1b1" android:text="Button1" /&gt; &lt;Button android:id="@+id/button2" android:textColor="#ffff" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/button1" android:layout_alignRight="@+id/button1" android:layout_below="@+id/button1" android:onClick="q1b2" android:text="Button2" /&gt; &lt;Button android:id="@+id/button3" android:textColor="#ffff" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/button2" android:layout_alignRight="@+id/button2" android:layout_below="@+id/button2" android:onClick="q1b3" android:text="Button3" /&gt; &lt;Button android:id="@+id/button4" android:textColor="#ffff" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/button3" android:layout_alignRight="@+id/button3" android:layout_below="@+id/but…
tagged with: java
has comment: http://stackoverflow.com/comment/34333177
type: Question
has answer: http://stackoverflow.com/a/22558302

http://stackoverflow.com/q/22639127
has title: How to solve JRE synchronisation issue between Websphere Application server and IIM
answer count: 1
score: 0
has body: I am trying to import a Websphere Application server version 7.0.0.27, which was installed using standalone installer, into IBM Installation manager for installing the "WebSphere Application Server V7 Feature Pack for OSGi Applications and Java Persistence API 2.0". The readme which came with the feature pack details the steps to import an installation of WAS 7 into IIM. But when I am entering the WAS installation path into IIM, it is throwing the following error. "The software development kit version is not the same as the IBM Websphere Application server version. Use another tool, such as the update installer for Websphere software to synchronize versions" I am guessing this is because of version mismatch between the jre used by WAS and the jre used by the IIM, the details of which are given below: IIM Jre: java version "1.6.0" Java(TM) SE Runtime Environment (build pwi3260sr9fp1-20110208_03(SR9 FP1)) IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Windows 7 x86-32 jvmwi3260sr9-2011020 3_74623 (JIT enabled, AOT enabled) J9VM - 20110203_074623 JIT - r9_20101028_17488ifx3 GC - 20101027_AA) JCL - 20110203_01 WAS JRE: java version "1.6.0" Java(TM) SE Runtime Environment (build pwa6460sr9fp2ifix-20110727_01(SR9 FP2+IV0 3622)) IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Windows 7 amd64-64 jvmwa6460sr9-20110 619_85080 (JIT enabled, AOT enabled) J9VM - 20110619_085080 JIT - r9_20101028_17488ifx12 GC - 20101027_AA) JCL - 20110727_07 I have updated IIM to the latest available(1.7.2) but still getting the error. What might be the solution for this problem ?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22763016
tagged with: java
tagged with: eclipse
type: Question
tagged with: websphere-7

http://stackoverflow.com/q/22572602
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34360377
type: Question
has comment: http://stackoverflow.com/comment/34360415
has body: I'm doing an assignment and had some questions, when my frame opens when I run my program, it doesn't open to its full size, 700x100. Why is that? Also, how can I make the contents within the frame resizable? Here's what I have. package hw06; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseAdapter; import java.awt.geom.Ellipse2D; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; public class TargetLogoUI { /** * @param args the command line arguments */ public static void main(String[] args) { JFrame frame = new JFrame(); JTextField TargetMessagePanel = new JTextField(); TargetMessagePanel.setBackground(new java.awt.Color(204, 204, 204)); TargetMessagePanel.setFont(new java.awt.Font("Helvetica", 1, 72)); // NOI18N TargetMessagePanel.setText("Welcome to Target"); frame.add(TargetMessagePanel, BorderLayout.NORTH); final TargetLogoPanel panel = new TargetLogoPanel(); panel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent e) { panel.setTarget(true); panel.repaint(); } }); frame.add(panel); frame.setSize(700, 100); frame.setVisible(true); } } class TargetLogoPanel extends JPanel { private boolean isTarget; public void paintComponent(Graphics g) { super.paintComponent(g); // erase back Graphics2D g2 = (Graphics2D) g; Color c = null; if (isTarget) { c = Color.BLUE; } else { c = Color.RED; } g2.setColor(c); g2.fill(new Ellipse2D.Double(250, 50, 160, 160)); g2.setColor(Color.WHITE); g2.fill(new Ellipse2D.Double(275, 75, 110, 110)); g2.setColor(c); g2.fill(new Ellipse2D.Double(300, 100, 60, 60)); } public boolean isTarget() { return isTarget; } public void setTarget(boolean isTarget) { this.isTarget = isTarget; } }
upvote count: 1
has title: Changing my frame, and making the contents resizable
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34360518
has answer: http://stackoverflow.com/a/22572648
accepted answer: http://stackoverflow.com/a/22572648
has comment: http://stackoverflow.com/comment/34360485
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/comment/34411431
score: 0
type: Comment
type: QuestionComment
has text: The program would force him to change the date to a valid one.
comment on: http://stackoverflow.com/q/22601145

http://stackoverflow.com/comment/34259273
comment on: http://stackoverflow.com/a/22515872
type: Comment
has text: @DavidWallace Oh was that required? Let me fix that.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22603205
upvote count: 5
has comment: http://stackoverflow.com/comment/34414971
score: 4
has comment: http://stackoverflow.com/comment/34414889
type: Answer
answers question: http://stackoverflow.com/q/22603153
has body: add this to your activity.xml: &lt;ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/iso" android:id="@+id/background" android:scaleType="fitXY" /&gt; add this to activity.java: ImageView layout = (ImageView) findViewById(R.id.background); layout.setBackgroundResource(R.drawable.iso);
downvote count: 1

http://stackoverflow.com/comment/34267681
type: QuestionComment
has text: @msandiford So if you call `BufferedInputStream(InputStream in)` and it saves `in` in a member field, this exposes the internal representation of `BufferedInputStream`? I guess "can" (_can_ be caused by...) is the operative word here, depending on what the object reference is used for...
comment on: http://stackoverflow.com/q/22519006
score: 0
type: Comment

http://stackoverflow.com/comment/34388836
has text: You have no control over how many times SWT calls the JPanel paintComponent method. Just make sure that you are doing nothing but drawing in the paintComponent method. You need to call super.paintComponent() in the first line of your paintComponent method.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22578337
type: Comment

http://stackoverflow.com/q/22612237
has body: Which one is advisable to use out of the two ? When there is "same implementation" testcode but "different output" because "slight difference in input" i.e input1 and input2 has minor difference. "Suppose input1 is empty list and input2 is parameterized list" let have a dummy code for two possibilities of test Classes : Both Behaviour is achieved from same Test method i.e : public Class DataProvider{ private static setUp(){ } public static Object[][] data_all_Behaviour(){ setUp(); return new Object[][]{ {"DataForBehavior1",Input1,Output1}, {"DataForBehavior2",Input2,Output2}}; } } } @RunWith(JUnitParamsRunner.class) public class TestClass{ @Parameters(class=DataProvider.class) public void Test_all_Behaviour(String message,Input inp, Output out){ //execute input and verify output and display message } } Here for each behaviour ,there is separate test method. @RunWith(JUnitParamsRunner.class) public class TestClass{ public Object[][] data_for_Behaviour1(){ setUp(); return new Object[][]{ {"DataForBehavior1",Input1,Output1} } } public void test_Behaviour1(String message,Input inp, Output out){ //execute input and verify output and display message } } public Object[][] data_for_Behaviour2(){ setUp(); return new Object[][]{ {"DataForBehavior2",Input2,Output2} } } public void test_Behaviour2(String message,Input inp, Output out){ //execute input and verify output and display message } } } Also provide other possible ways to achieve the same ?
has comment: http://stackoverflow.com/comment/34430871
tagged with: junit4
score: 1
tagged with: java
type: Question
tagged with: tdd
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22614713
has title: What is the proper implementation for test cases which accept similar type of input parameter,same implementation code but different output
type: UnansweredQuestion
upvote count: 1
tagged with: unit-testing

http://stackoverflow.com/q/22645172
linked to: http://stackoverflow.com/q/13948122
has body: hi i have some code in java that draws a rectangle, hwever itll only drag right, even if i drag left itll drag to the right, here is the code i have any help please? public void mouseDragged(MouseEvent e) { Point p = e.getPoint(); int width = Math.max(selection.x - e.getX(), e.getX() - selection.x); int height = Math.max(selection.y - e.getY(), e.getY() - selection.y); selection.setSize(width, height); repaint();
type: AnsweredQuestion
has title: java draws rectangle one way not both
accepted answer: http://stackoverflow.com/a/22645343
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22645282
has answer: http://stackoverflow.com/a/22645282
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/34490002
linked to: http://stackoverflow.com/q/15776549
has answer: http://stackoverflow.com/a/22645343

http://stackoverflow.com/q/22568456
type: Question
has answer: http://stackoverflow.com/a/22568531
score: 0
has answer: http://stackoverflow.com/a/22568481
has title: Java initializing iVars outside the scope of any method
has body: New to Java, and I am a little confused about this piece of code: public class CitiesDialog extends DialogFragment { private AsyncHttpClient client = new AsyncHttpClient(); } client is being initialized outside the scope of any method. What does this exactly mean? Does each instance of CititiesDialog have a separate client object? Or is this some sort of static/class variable ? And lastly, is this the norm in Java? to initialize variables outside the scope of constructors/methods, etc... Thanks
type: UnansweredQuestion
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/22568479
has answer: http://stackoverflow.com/a/22568493

http://stackoverflow.com/q/22561333
has answer: http://stackoverflow.com/a/22561748
type: AnsweredQuestion
tagged with: java
has body: I am unable to start jvm with attached profile on linux with following command: java -Xverify:none -agentlib:JPIBootLoader=JPIAgent:server=enabled;CGProf TestClass I am getting following error: Error occurred during initialization of VM agent library failed to init: JPIBootLoader CGProf: command not found On windows aforementioned command runs successfully and I get message from main method of the class. linux details uname -a Linux michael 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux LD_LIBRARY_PATH=/home/michael/eclipse/tptp/agntctrl.all_platforms-TPTP-4.7.2/linux_em64t/lib/:/home/michael/eclipse/tptp/linux.gtk.x86-TPTP-4.7.2/plugins/org.eclipse.tptp.platform.jvmti.runtime_4.6.3.v201102041710/agent_files/linux_em64t/ TPTP_AC_HOME=/home/michael/eclipse/tptp/agntctrl.all_platforms-TPTP-4.7.2/linux_em64t
has title: unable to run jvm with attached profiler
type: Question
accepted answer: http://stackoverflow.com/a/22561748
score: 0
tagged with: eclipse-tptp
answer count: 1
tagged with: jvm

http://stackoverflow.com/comment/34372171
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22579354
score: 1
has text: Thank you. The [API guide](https://developer.android.com/guide/topics/ui/controls/pickers.html) example uses a dialogFragment. I've included a cast and now it's working.

http://stackoverflow.com/a/22550682
downvote count: 0
score: 1
has body: I would launch a new intent and open a Google Map in a separate activity. The intent should include a LatLng object and the image to display. To display these images at specific locations in a Google Map, you will want to use the LatLng class to store the latitude and longitude for each spot. Then you will want to create a Marker which takes a LatLng object to determine its position. The Marker object will use your desired image by way of the setIcon() method. To display the image on the map, simply call the addMarker() method with your Google Map object. LatLng Marker
answers question: http://stackoverflow.com/q/22550429
upvote count: 1
type: Answer

http://stackoverflow.com/a/22604457
has comment: http://stackoverflow.com/comment/34417347
score: 36
type: Answer
accepted answer of: http://stackoverflow.com/q/22604064
answers question: http://stackoverflow.com/q/22604064
has comment: http://stackoverflow.com/comment/52209140
has body: When you have Spring Security CSRF protection enabled, you must logout with POST: &lt;c:url var="logoutUrl" value="/logout"/&gt; &lt;form action="${logoutUrl}" method="post"&gt; &lt;input type="submit" value="Log out" /&gt; &lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/&gt; &lt;/form&gt;
upvote count: 36
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34637446
score: 0
has text: Good idea, it's the same but more clear.. For the moment the best solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/22725265
type: Comment

http://stackoverflow.com/comment/34318823
type: Comment
comment on: http://stackoverflow.com/a/22534503
score: 0
type: AnswerComment
has text: Hi Andrei, Thanks for your answer. But if I did that, it will gave me this error : /_ah/start java.lang.NullPointerException at com.google.api.client.extensions.appengine.auth.oauth2.AbstractAppEngineAuthorizationCodeServlet.getUserId(AbstractAppEngineAuthorizationCodeServlet.java:92)

http://stackoverflow.com/q/22561614
tagged with: java-stream
tagged with: method-reference
tagged with: java
possible better answer: http://stackoverflow.com/a/22561690
has title: Why do .max(Integer::max) and .min(Integer::min) compile on a Java 8 Stream?
has answer: http://stackoverflow.com/a/48858301
downvote count: 1
type: Question
upvote count: 220
has answer: http://stackoverflow.com/a/22561853
score: 219
has comment: http://stackoverflow.com/comment/49603336
has body: See the following code, which originates from a now-deleted Stack Overflow question: final List<Integer> list = IntStream.rangeClosed(1, 20).boxed().collect(Collectors.toList()); System.out.println(list.stream().max(Integer::max).get()); System.out.println(list.stream().min(Integer::min).get()); (note: I do know that this code won't "work" and that Integer::compare should be used — I just extracted it from the linked question) According to the Javadoc of .min() and .max(), the argument of both should be a Comparator. Yet here the method references are to static methods of the Integer class. Why does this compile at all?
has comment: http://stackoverflow.com/comment/49603444
favorite count: 0
has comment: http://stackoverflow.com/comment/49602861
answer count: 5
has answer: http://stackoverflow.com/a/22561687
has answer: http://stackoverflow.com/a/22561690
tagged with: java-8
accepted answer: http://stackoverflow.com/a/22561853
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22809146

http://stackoverflow.com/comment/34390671
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22586263
has text: the point was, how can i set 3 images instead of two? In my folder I have directories, files and zip files, I need to set up for them diferent icons.
type: AnswerComment

http://stackoverflow.com/q/22624836
upvote count: 1
type: Question
has title: Simulating deadlock using multi-dimensional array
tagged with: deadlock
has answer: http://stackoverflow.com/a/22627005
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34456305
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22627005
type: AnsweredQuestion
has body: I am attempting to code a deadlock detection algorithm. I must use a 7x7 array filled with w's, x's, and n's. w = waiting for resource, x = exclusively holding a resource, and n = no need for the resource. The rows represent jobs or processes and the columns represent resources. I will give a test case array: String [][] grid = {{"w","n","x","x","x","n","n"}, {"x","w","n","n","n","x","n"}, {"n","x","w","n","n","n","n"}, {"n","n","n","n","n","n","x"}, {"n","n","n","n","n","n","n"}, {"n","n","w","n","n","n","w"}, {"w","w","w","w","w","w","w"}}; As you can see the deadlock is among Row 0, 1 and 2. R0 is waiting forC0 (resource 1), but R1 is holding it. R1 is waiting for C1 (resource 2) but R2 is holding it. R2 is waiting for C2 (resource 3), but R0 is holding it. Visually, it is a cycle. My algorithm searches the rows for w's and the columns for x's and places them in a single dimensional array. That part works. The array should read w x w x w x...until the end. To check if we have completed a cycle I keep track of the index of the rows where w's and x's are found and place them into another single dimensional array. So in this example, the first array would read w x w x w x... and the the second array would read 0 1 1 2 2 0... Once the single dimensional arrays reach a size of 4 (determined by count variable) I would check the first index (array[0]) and the last index (array[count-1]). If array[0] is 'w' and array[count-1] is 'x' and if the row indexes are equal then a deadlock is detected. My algorithm works on paper, but somehow my math is wrong with my second array (WHI) The indexes print out correctly the first time ( 0 1 1 2 2 0...) but if I print out WHI[0] (which should always be 0) it gives me 1 2 5 5 6 6 6 6 ... public void printSingleArrays() { String [] WH = new String[14]; int [] WHI = new int[14]; int count = 0; for (int a = 0; a &lt; WH.length &amp;&amp; a &lt; WHI.length; a += 2) for (int i = 0; i &lt; array.length ; i++) for (int j = 0; j &lt; array[i]…
tagged with: java

http://stackoverflow.com/comment/34341895
has text: Yeah, but just want to monitor some format of files like .txt or .pfd, but these can be anywhere in the file system, that's why i need monitor the whole filesystem
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22562427
type: Comment

http://stackoverflow.com/a/22524803
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22524687
has body: What happens is that the next() method doesn't consume the new-line character that is entered when you press Enter. Since that character is still there waiting to be read, the nextLine() consumes it. To fix this you can add a nextLine() after the next() call: char ch = input.next().charAt(0); input.nextLine(); // consumes new-line character // ... For futher information, you could read this post.
answers question: http://stackoverflow.com/q/22524687
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4

http://stackoverflow.com/comment/34518521
score: 1
has text: Cool thanks, I'll accept this. But one last question anyway... how do you avoid them in a normal many-to-many denormalization scenario where you need a table that just consists of 2 foreign keys? You can let there be a third auto-generated key as the primary key, but then that key ends up being different in different data centers which is a nuisance and complicates debugging greatly.
type: AnswerComment
comment on: http://stackoverflow.com/a/22647184
type: Comment

http://stackoverflow.com/q/22555819
tagged with: garbage-collection
answer count: 1
score: 4
has comment: http://stackoverflow.com/comment/34336687
tagged with: java
has comment: http://stackoverflow.com/comment/34357717
has answer: http://stackoverflow.com/a/22571918
tagged with: memory
has body: Consider the following code: public class BitSetTest { public static void main(final String[] args) throws IOException { System.out.println("Start?"); int ch = System.in.read(); List&lt;Integer&gt; numbers = getSortedNumbers(); System.out.println("Generated numbers"); ch = System.in.read(); RangeSet&lt;Integer&gt; rangeSet = TreeRangeSet.create(); for (Integer number : numbers) { rangeSet.add(Range.closed(number, number)); } System.out.println("Finished rangeset"); ch = System.in.read(); BitSet bitset = new BitSet(); for (Integer number : numbers) { bitset.set(number.intValue()); } System.out.println("Finished bitset"); ch = System.in.read(); //System.out.println(numbers.size()); //System.out.println(rangeSet.isEmpty()); //System.out.println(bitset.size()); } private static List&lt;Integer&gt; getSortedNumbers() { int max = 200000000; int n = max / 10; List&lt;Integer&gt; numbers = Lists.newArrayListWithExpectedSize(max); File file = new File("numbers.txt"); if (file.exists()) { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { String line = reader.readLine(); while ((line = reader.readLine()) != null) { numbers.add(Integer.valueOf(line)); } } catch (IOException e1) { throw new RuntimeException(e1); } } else { for (int i = 0; i &lt; n; i++) { int number = (int) (Math.random() * max); numbers.add(number); if (i &gt; 0 &amp;&amp; i % 10000 == 0) { System.out.println(i); } } Collections.sort(numbers); try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) { writer.write(numbers.get(0) + ""); for (int i = 1; i &lt; n; i++) { writer.write("\n"); writer.write(numbers.get(i) + ""); } } catch (IOException e1) { throw new RuntimeException(e1); } } return numbers; } } At the first pause(System.in.read()), JConsole shows memory usage as 4MB. At the second pause("Generated Numbers"), since a large list is instantiated, the memory usage jumps to 922MB. At the next pause ("Finished rangeset"), after running GC the memory comes back to 4MB wh…
upvote count: 4
downvote count: 0
type: UnansweredQuestion
tagged with: scope
type: Question
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/34332529
has comment: http://stackoverflow.com/comment/34365622
has title: Is Java7 intelligent in collecting objects if they are not used further in a scope, although the scope has not completely ended

http://stackoverflow.com/a/22527349
has comment: http://stackoverflow.com/comment/34424166
type: Answer
answers question: http://stackoverflow.com/q/22527259
has body: I think DD/MM/RR is the default NLS_DATE_FORMAT for the oracle database. you can query it out to see exactly. Your issue is not how the data is store but how you retrieve it. Try to use TO_CHAR() and a mask format with mm:ss to get the exact time stamp and see if gets the correct date
upvote count: 1
downvote count: 1
score: 0

http://stackoverflow.com/q/22560343
tagged with: java
tagged with: servlets
answer count: 2
tagged with: jsp
has title: Java JSP exception Report
score: 0
tagged with: exception
has answer: http://stackoverflow.com/a/22560609
has body: I'm having a hard time with this code, every time I test and run it, I always get the same error but cant seem to fix it. The error I'm getting is, can anyone help? Its the last thing I need to get done to get this project working! type Exception report message description The server encountered an internal error that prevented it from fulfilling this request. exception java.lang.NullPointerException Servlets.addFunds.processRequest(addFunds.java:43) Servlets.addFunds.doPost(addFunds.java:95) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.34 logs. /* * To change this template, choose Tools > Templates and open the template in the editor. */ package Servlets; import beans.UserBean; import eventaccess.DatabaseConnector; 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; import javax.servlet.http.HttpSession; /** * * @author sberry3 */ @WebServlet(name = "addFunds", urlPatterns = {"/addFunds"}) public class addFunds extends HttpServlet { /** * Processes requests for both HTTP * GET and * POST methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String url = null; double addFunds = Double.parseDouble(request.getParameter("addFunds")); String username = request.getParameter("username"); HttpSession session = request.getSession(); UserBean userSession = (User…
tagged with: report
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22560627
type: Question

http://stackoverflow.com/comment/34358337
type: Comment
has text: But, java 7's Arrays.sort() uses Timsort (http://svn.python.org/projects/python/trunk/Objects/listsort.txt) which is just about as fast as it gets right now. You could also use Collections.sort() which would provide you with consistent O(nlogn) performance.
comment on: http://stackoverflow.com/a/22571457
type: AnswerComment
score: 0

http://stackoverflow.com/a/22635450
has body: If we take an ArrayList as an example, the clear() method does this: public void clear() { modCount++; // Let gc do its work for (int i = 0; i &lt; size; i++) elementData[i] = null; size = 0; } Basically, if a List and elements of the List are not referenced anywhere else in the code there is really no need to call clear() (or at least you do not gain anything by doing so). You also do not need to assign null to the List variable because it will be garbage collected at some point after it falls out of scope (again, if the list itself is not referenced anywhere else). Check out how "mark and sweep" garbage collection algorithm works: http://wiki.c2.com/?MarkAndSweep
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22635188
type: Answer
upvote count: 3

http://stackoverflow.com/a/22564095
has body: You are comparing String using ==, you need to use .equals() method for String Try to change your code to something like this: if(subject.substring(17,18).equals("e")){ subjectName = "English"; }else if(subject.substring(17,18).equals("m")) { subjectName = "Math"; }
answers question: http://stackoverflow.com/q/22564055
type: Answer
upvote count: 4
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/34344329
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22564055

http://stackoverflow.com/a/22580134
answers question: http://stackoverflow.com/q/22580124
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/22580124
has body: You can do it like: total += list[i] != null ? list[i].getVotes() : 0; In Java 8, your method would be like: public static int getTotal(Candidate[] list) { return Stream.of(list) .filter(s -&gt; s != null) .collect(Collectors.summingInt(Candidate::getVotes)); }

http://stackoverflow.com/comment/34435926
has text: I get it. But where do u think i need to do the change? Please correct my code if possible.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22614621

http://stackoverflow.com/a/22633172
has comment: http://stackoverflow.com/comment/34469297
has comment: http://stackoverflow.com/comment/48682309
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/48680867
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22632552
has body: That depends on what you consider as being "worst". I'm not sure whether this question aimed at a detailed, technical analysis of the current implementation considering all possible race conditions and the nitty-gritty details of the Java memory model. So if the question is: "What can provably happen in the current implementation?" then I have to say: "I don't know". And I assume that hardly anybody knows this for sure in detail. (It's somehow like asking "Which parts of your car will be broken after you hit a wall with 100 mph?" - well, maybe the steering wheel will still be intact, but does this matter?) But if the question is "What is not unlikely to happen when accessing a not-threadsafe HashMap with multiple threads?" then there are many possible answers: Deadlocks Exceptions Missing elements Elements being inserted multiple times Elements being inserted into the wrong hash bin ... (Roughly ordered by my subjective interpretation of "badness"...) EDIT: A clarification for the comment: Of course, an element could only be added twice if the call to insert it occurs multiple times. According to the specifiction, the HashMap should contain each key at most once. But the call for adding a new entry to the HashMap eventually delegates to the call void createEntry(int hash, K key, V value, int bucketIndex) { Entry&lt;K,V&gt; e = table[bucketIndex]; table[bucketIndex] = new Entry&lt;&gt;(hash, key, value, e); size++; } And there is no (obvious) reason why no other thread should cause a rehash (and thus, the creation of a new table array) between the first and the second line of this method. Then the bucketIndex for this call would be wrong. When the entry is then added a second time, it could use the (then) right bucketIndex, and thus, would afterwards be contained twice in the map. But again: In order to really prove that this might happen, one would have to study the implementation in a detail that is hardly feasible. The bottom line is: Basically anything can go wro…
answers question: http://stackoverflow.com/q/22632552
type: Answer
has comment: http://stackoverflow.com/comment/34472777
upvote count: 5

http://stackoverflow.com/comment/34378832
type: Comment
comment on: http://stackoverflow.com/a/22579331
type: AnswerComment
has text: factoring out invariants weren't and won't be a nano-optimization for the reasons stated above. Reducing the complexity of the algorithm by a constant factor is *never* a nano-optimization. Have you ever programmed a microcontroller, Eric? If so, why are you hurting people with views like "we shouldn't optimize without profiler even at the concept level!"?
score: 0

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/22570385
tags question: http://stackoverflow.com/q/22581886
tags question: http://stackoverflow.com/q/22626982
type: Tag
tags question: http://stackoverflow.com/q/22538964
tags question: http://stackoverflow.com/q/22506013

http://stackoverflow.com/q/22606791
has comment: http://stackoverflow.com/comment/34420902
tagged with: java
has title: Reference to array of objects in java
answer count: 1
has body: Before I get onto my question, I'd really like someone to give me specific advice because I've been searching for a long time now but can't seem to find out correct answer. I know it's basics but I am having issues. This is what I have in my code: private Interface ClassName; //initializing class that implements interface public Interface methodName () { /*This is where I need to make arraylist of objects of my class and return whole class as reference, maybe something like this:*/ List&lt;Interface&gt; listName = new ArrayList&lt;&gt;(perhaps needs number of objects added?); listName.add(ClassName); return ClassName; //or however this should be done and I guess once I call method I could simply use listName.get(number of object); Problem is, I would simply return list as reference, but my method requires me to only return class with said interface and I am not sure how to reference my class to that specific arraylist of objects and return it back in my method. Thank you for your time. I'll try explaining in plain English. First of all, it's assigement so I can't change the ways methods are given. By the way, those were not actual variable names, just names to clarify what I am reffering to. This is explanation: /** * * Gets the {@link ISystemRegisters} object of the current computer system. * * * * @return Object representing the system registers. */ public ISystemRegisters getRegisters(); So I have class with different interface than ISystemRegisters and this method it in that is supposed to hold arrayList of objects (here registers) and then return object reference in which that array is, as I understood it.
score: 0
tagged with: reference
has comment: http://stackoverflow.com/comment/34420999
has comment: http://stackoverflow.com/comment/34421298
type: UnansweredQuestion
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/22606915

http://stackoverflow.com/comment/34289081
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22530272
has text: @erhan i dint get you ..
score: 0

http://stackoverflow.com/a/22539057
has body: The dependency injection you mentioned is, to me, the reason why non-static controllers should always be used. It makes your code way easier to test. It is true that non-static controllers can make it slightly easier to write thread-safe code. If you want to put mutable (and not shared across instances) state directly in your controller (which I do not recommend) it helps, however, the controller is only one part of your application, if you have non thread-safe code somewhere else it won't save you. Can't think of any reason why you would want to use static controllers.
answers question: http://stackoverflow.com/q/22507785
score: 3
upvote count: 3
type: Answer
downvote count: 0

nexus
type: Tag
tags question: http://stackoverflow.com/q/22569710
tag name: nexus
tags question: http://stackoverflow.com/q/22639471

http://stackoverflow.com/q/22582500
answer count: 2
downvote count: 0
favorite count: 0
tagged with: swing
has answer: http://stackoverflow.com/a/22713973
type: AnsweredQuestion
has title: can't set text to Jbutton on a grid for a game
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22582829
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22582829
tagged with: arrays
has body: i am creating a game based on a grid and a parser from english to java. i am having trouble making the command draw on a grid. right now im trying to simply write a letter onto the grid so i can see it and then later i will add graphics. basically, the game accepts commands in english, then parses them to java and should draw it to a grid. i have done most of the code, but its not working. im not too good with swing and GUI in java. below is the code for the parser which has been reduced, and the grid its self. i have some methods that should draw but they dont, im not sure why. ServerPlayerParsing class: public class ServerPlayerParsing { ServerGridGenerator serverGrid = new ServerGridGenerator (10, 10); public String validate(String command){ serverGrid.frameGen(); if (wordCount(command)== 3) { String[] commandArray = command.split(" "); commandParsing(commandArray); } else { System.out.println("Error! Format incorrect!"); System.out.println("Correct format = [COMMAND 1] [COMMAND 2] [COMMAND 3]"); } return ""; } public int wordCount(String command){ String[] commandCount = command.split("\\s"); return commandCount.length; } public String commandParsing(String[] commandArray) { switch (commandArray[0]) { case "move": secondCommand (commandArray); break; default: System.out.println("Error in first command!"); } return " "; } public String secondCommand (String commandArray[]) { switch (commandArray[1]) { case "forward": forwardMovement(commandArray); break; case "backward": backwardMovement (commandArray); break; case "left": leftMovement (commandArray); break; case "right": rightMovement (commandArray); break; default: System.out.println("Error in second command!"); } return " "; } public String forwardMovement (String commandArray[]) { switch (commandArray[2]) { case "1": serverGrid.serverPlayerMoveForward(1); break; case "2": serverGrid.serverPlayerMoveForward(2); break; default: System.out.println("Error in third command!"); } return " "; } public String backwar…
accepted answer: http://stackoverflow.com/a/22713973

war
tags question: http://stackoverflow.com/q/22508337
tags question: http://stackoverflow.com/q/22566642
tags question: http://stackoverflow.com/q/22553344
type: Tag
tags question: http://stackoverflow.com/q/22616921
tags question: http://stackoverflow.com/q/22536461
tag name: war
tags question: http://stackoverflow.com/q/22491000
tags question: http://stackoverflow.com/q/22567174

http://stackoverflow.com/a/22559761
score: 1
downvote count: 0
has body: Looks like xfa.getCOSObject() is returning a COSArray but you are casting it to COSStream. Should be COSArray coss = (COSArray) cos;
upvote count: 1
answers question: http://stackoverflow.com/q/22559701
type: Answer

http://stackoverflow.com/comment/34360811
type: Comment
has text: Have you considered how well a code dump of the solution helps the OP understand the problem at hand and write a better program in the future using the tools provided in the language?
type: AnswerComment
score: 4
comment on: http://stackoverflow.com/a/22572778

http://stackoverflow.com/comment/34491178
comment on: http://stackoverflow.com/q/22645787
has text: just i was not asked question here, tried sevral ways and posted question.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34263124
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22516438
has text: Why do you need to increase the heap? It's only a hash table basically. And why do you need to set useCodebaseOnly?

http://stackoverflow.com/a/27036482
has body: Goto the file: C:\Users\&lt;USER&gt;\AppData\Roaming\sqldeveloper\1.0.0.0.0\product.conf In this file eg: SetJavaHome &lt;PATH&gt;\jdk1.7.0_67
answers question: http://stackoverflow.com/q/22541060
downvote count: 0
type: Answer
upvote count: 6
score: 6

http://stackoverflow.com/comment/34487224
comment on: http://stackoverflow.com/q/22643588
has text: FYI [It doesn't answers java part directly, but anyways](https://github.com/scala/async#comparison-with-direct-use-of-future-api)
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22526765
has answer: http://stackoverflow.com/a/22527079
has comment: http://stackoverflow.com/comment/34278469
answer count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/22526877
has answer: http://stackoverflow.com/a/22526839
type: Question
type: AnsweredQuestion
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/34278477
has answer: http://stackoverflow.com/a/22526867
downvote count: 2
possible better answer: http://stackoverflow.com/a/22526839
has body: I find that the control never seems to go in if block that starts from "if(sqlquery.equals("1"))" when it actually returns to be true. What could be the reason to it and how should ! modify it ?My program code is : //package searchbook; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import java.util.*; public class SearchBook extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ response.setContentType("text/html"); HttpSession session = request.getSession(true); List booklist=new ArrayList(); Connection con = null; String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + "C:\\users\\ppreeti\\executive_db.accdb"; String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; String user = ""; String pass = ""; String category=""; category=request.getParameter("input"); String sqlquery="select Index1.link_id " + "FROM Index1 " + " WHERE Index1.index_name LIKE '%"+category+"%' "; try { Class.forName(driver); con = DriverManager.getConnection(url, user, pass); try{ Statement st = con.createStatement(); System.out.println("Connection created 1"); ResultSet rs = st.executeQuery(sqlquery); System.out.println("Result retreived 1"); //System.out.println('"sqlquery"'); } catch (SQLException s) { System.out.println("SQL statement is not executed! "+ s); } } catch (Exception e){ e.printStackTrace(); } System.out.println("************"); //String sqlq=""; if(sqlquery.equals("1")) { String sqlq="select Section.Section_Name , Report.Report_Name , Report.Link, Contact.Contact_Name, Metrics.Metric_Name " + "FROM Section , Report , Contact,Metrics " + "WHERE Report.Contact_ID=Contact.Contact_ID and Report.Section_ID=Section.Section_ID " + "and Report.Report_ID IN (SELECT Metrics.Report_ID FROM Metrics WHERE Metrics.Metric_Name = Report.Report_ID') and Metrics.Metric_Segment = 'M' "; System.out.println("2nd query executed too !"); try { Class.forName(…
has title: control never seems to go in the if block
favorite count: 0
accepted answer: http://stackoverflow.com/a/22526877

http://stackoverflow.com/comment/34438421
type: QuestionComment
comment on: http://stackoverflow.com/q/22616379
has text: I would just call it a Java application.
score: 0
type: Comment

http://stackoverflow.com/comment/34353076
score: 0
comment on: http://stackoverflow.com/a/22568768
type: Comment
type: AnswerComment
has text: so there is no value 101? with each new list it just begins again at 0-99?

http://stackoverflow.com/comment/120062645
score: 0
type: AnswerComment
has text: @theo It worked bro!! Thanks for existing :)
type: Comment
comment on: http://stackoverflow.com/a/35948730

http://stackoverflow.com/q/22620513
type: Question
answer count: 1
has body: I want to check if a library is present either in my app or the System. In java I usually do System.loadlibrary, but does anyone know a similar corresponding call in C ?
tagged with: static-libraries
has answer: http://stackoverflow.com/a/22620900
tagged with: android
has comment: http://stackoverflow.com/comment/34446387
score: 0
has title: Corresponding 'C' call for System.loadlibrary
accepted answer: http://stackoverflow.com/a/22620900
type: AnsweredQuestion
tagged with: java-native-interface
tagged with: java
tagged with: http://stackoverflow.com/tag/c

http://stackoverflow.com/comment/34260584
type: Comment
comment on: http://stackoverflow.com/q/22514745
type: QuestionComment
has text: Are you sure? It's like .indexof(...)==0
score: 0

http://stackoverflow.com/comment/34336677
has text: Because the OP wants it to work _regardless of the class' implementation of it_ (ie, without having to override it at all)
type: AnswerComment
comment on: http://stackoverflow.com/a/22557122
score: 0
type: Comment

http://stackoverflow.com/q/22610652
score: 2
has answer: http://stackoverflow.com/a/23387169
has answer: http://stackoverflow.com/a/29696687
downvote count: 0
tagged with: java
tagged with: code-injection
type: Question
upvote count: 2
tagged with: jsf-2
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22611943
type: UnansweredQuestion
has title: @Autowired JSF 2 Spring 3 Null
tagged with: spring
has body: I am not able to inject the service using the @Autowired. AplicationContext.xml <context:component-scan base-package="com.mypackage" /> <context:component-scan base-package="com.mypackage.bean" /> <context:component-scan base-package="com.mypackage.dao" /> <context:component-scan base-package="com.mypackage.service" /> <context:component-scan base-package="com.mypackage.filters" /> <context:annotation-config /> faces-config.xml org.springframework.web.jsf.el.SpringBeanFacesELResolver web.xml org.springframework.web.context.request.RequestContextListener org.springframework.web.context.ContextLoaderListener Service declaration: @Service public class UsuarioServiceImpl extends GenericServiceImpl implements UsuarioService{...} ManagedBean: @ManagedBean(name="cadastroUsuarioMB") @SessionScoped public class CadastroUsuarioBean { @Autowired UsuarioService usuarioService; private Usuario usuario = new Usuario(); public String salvar() { //Error !!! usuarioService is null ! usuarioService.retornaUsuarioPorLogin(usuario.getEmail(), usuario.getSenha()); JsfUtil.addSuccessMessage(null, usuario.getCelular()); return ""; } }

celltable
type: Tag
tags question: http://stackoverflow.com/q/22530667
tag name: celltable

http://stackoverflow.com/a/22815942
has comment: http://stackoverflow.com/comment/34989434
score: 0
answers question: http://stackoverflow.com/q/22638494
has body: You are missing access token and access token secret. To sign an OAuth 1.0 request you need three things: the CONSUMER_SECRET that you already have, the access token and the access token secret which you will get in the oauth_token and oauth_token_secret variables respectively in the response of the Temporary Credentials request. I have no experience with Java, but according to Signpost documentation i guess that you should call this... consumer.setTokenWithSecret(ACCESS_TOKEN, TOKEN_SECRET); ...before you try to sign the url consumer.sign(urlConnection); Seems like you can get ACCESS_TOKEN and TOKEN_SECRET with ... String accessToken = provider.getResponseParameter('oauth_token'); String tokenSecret = provider.getResponseParameter('oauth_token_secret'); ... after you call this: provider.retrieveAccessToken(consumer, verificationCode); Here is my take (I didn't try it): public class DiscogsAuth { /** * Constructs a consumer with valid access token for signing urls (can only be used once user has authorizaed application and auth code * available to application somewhere * * NOTE:Not thread safe, has to be done once for each thread * * @return * @throws Exception */ public static OAuthConsumer getAccessToken() throws Exception { OAuthConsumer consumer = new DefaultOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); OAuthProvider provider = new DefaultOAuthProvider( "http://api.discogs.com/oauth/request_token", "http://api.discogs.com/oauth/access_token", "http://www.discogs.com/oauth/authorize"); provider.setRequestHeader("User-Agent", SongKong.USER_AGENT); provider.retrieveAccessToken(consumer, UserPreferences.getInstance().getDiscogsAuthorization()); // Retrieve access token and access token secret String accessToken = provider.getResponseParameter('oauth_token'); String tokenSecret = provider.getResponseParameter('oauth_token_secret'); // Set them on the consumer so it can sign the requestst with them consumer.setTokenWithSecret(accessToken, tokenSecret); return consumer…
has comment: http://stackoverflow.com/comment/36107292
type: Answer
has comment: http://stackoverflow.com/comment/35016464
has comment: http://stackoverflow.com/comment/35016393
has comment: http://stackoverflow.com/comment/35017142

http://stackoverflow.com/a/22628963
has comment: http://stackoverflow.com/comment/34461749
has comment: http://stackoverflow.com/comment/34461240
has comment: http://stackoverflow.com/comment/34462943
has comment: http://stackoverflow.com/comment/34461176
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34501777
has comment: http://stackoverflow.com/comment/34502266
accepted answer of: http://stackoverflow.com/q/22628605
has comment: http://stackoverflow.com/comment/34461938
downvote count: 1
answers question: http://stackoverflow.com/q/22628605
has comment: http://stackoverflow.com/comment/34461868
score: 0
has comment: http://stackoverflow.com/comment/34501900
has comment: http://stackoverflow.com/comment/34461803
has body: you have to use setbounds method like below for this if you do not want use any layouts. text1.setBounds(10,10,50,50); setlayout(null) But this is not the correct way though.You have to use like below only. TextField text1 = new TextField(20); text1.setText("JOHN DOE"); add(text1); text1.setBounds(10, 10, 100, 20); setLayout(new BorderLayout()); Note Andrew Thompson notes: Java GUIs might have to work on a number of platforms, on different screen resolutions &amp; using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or combinations of them1, along with layout padding &amp; borders for white space2.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34501809

http://stackoverflow.com/q/22583850
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/34380477
tagged with: windows-phone-8
has title: How can I write Windows Phone app in Java
type: Question
has comment: http://stackoverflow.com/comment/34380496
has answer: http://stackoverflow.com/a/22583907
has comment: http://stackoverflow.com/comment/34380662
downvote count: 4
upvote count: 0
answer count: 1
has body: I'm sure it's possible, but how exactly am I able to write WP application in Java?
favorite count: 0
has comment: http://stackoverflow.com/comment/34380538
accepted answer: http://stackoverflow.com/a/22583907
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34380681

http://stackoverflow.com/comment/34236904
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22503275
has text: paste your code how you use it already maybye you made an mistake in writing it by your own.

http://stackoverflow.com/comment/34382300
type: Comment
comment on: http://stackoverflow.com/a/22584856
score: 0
type: AnswerComment
has text: @djechlin About the context of THIS method you are right. But since TC does have trouble calling a non static method from within Main Method, the simple solution "make method static" seems too broad to me.

http://stackoverflow.com/q/22585944
tagged with: audio
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34410309
score: 0
tagged with: playback
has comment: http://stackoverflow.com/comment/34388906
tagged with: macos
has comment: http://stackoverflow.com/comment/34385155
answer count: 0
has body: I have created a TCP connection that sends Audio captured from the microphone to another computer. In my case I am using a Linux Distribution and a Macbook 10.6 laptop. I can send the microphone feed from my Mac to the Linux box with no problems at all, it sounds really good! (I was using UDP, but the same problem occurred and it wasn't as crisp). However, when I just listen to what the Mac receives and outputs to speaker, it sounds like white noise. I cannot hear anything over it. I have a feeling my problem may lie within my get audio format method which I have right here private AudioFormat getFormat() { int sampleSizeInBits = 16; int channels = 2; boolean signed = true; boolean bigEndian = false; return new AudioFormat(44100, sampleSizeInBits, channels, signed, bigEndian); } My two classes I am using for it are right here Microphone public class Microphone implements Runnable { private TargetDataLine targetDataLine; private final AudioFileFormat.Type WAVE = AudioFileFormat.Type.WAVE; private InputStream inputStream; private byte[] buffer; private Socket socket; private ServerSocket serverSocket; private volatile boolean run; private final int SAMPLE_RATE = 44100; private final int SAMPLE_INTERVAL = 2; private final int SAMPLE_SIZE = 2; private final int BUFFER_SIZE = SAMPLE_INTERVAL * SAMPLE_INTERVAL * SAMPLE_SIZE * 2; private OutputStream outputStream; private boolean isServer; private final int PORT = 6000; private InetAddress ipAddr; private AudioReceiver audioReceiver; public Microphone(boolean server) { try{ ipAddr = InetAddress.getByName("192.168.1.112"); } catch (UnknownHostException e) { e.printStackTrace(); } this.isServer = server; DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, getFormat()); try { targetDataLine = (TargetDataLine) AudioSystem.getLine(dataLineInfo); targetDataLine.open(getFormat()); targetDataLine.start(); } catch (LineUnavailableException e) { e.printStackTrace(); } } @Override public void run() { run = true; bool…
tagged with: javasound
type: UnansweredQuestion
has title: Java TCP Audio... Works on Linux, whitenoise on Mac

http://stackoverflow.com/comment/56155181
comment on: http://stackoverflow.com/a/22517872
type: Comment
has text: I found this class: https://docs.jboss.org/hibernate/validator/5.2/api/org/hibernate/validator/parameternameprovider/ParanamerParameterNameProvider.html which might be equivalent to the one mentioned above.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22490798
score: 1
upvote count: 1
has body: Try and create instead a directory somewhere under your home directory: final Path tmpdir = Paths.get(System.getProperty("user.home"), "tmp"); Files.createDirectories(tmpdir); System.setProperty("java.io.tmpdir", tmpdir.toAbsolutePath().toString()); Then try and Files.createTempFile() in there. Note that if Files.createDirectories() refers to an existing file which is not a directory, you'll get a FileAlreadyExistsException.
downvote count: 0
answers question: http://stackoverflow.com/q/22490625
type: Answer

http://stackoverflow.com/comment/34386112
type: Comment
score: 0
has text: There is no way that you can use `this.name` inside of a static method. Try handling this logic in the class that is invoking this method. Editing my answer to explain
type: AnswerComment
comment on: http://stackoverflow.com/a/22586886

http://stackoverflow.com/comment/34337391
comment on: http://stackoverflow.com/q/22560235
score: 0
type: QuestionComment
type: Comment
has text: `actionPerformed()` runs in the EDT. Whether the actions started there should run in EDT, and how to dispatch them to some other thread in case they shouldn't, is very much dependent on your application design.

http://stackoverflow.com/q/22623566
upvote count: 1
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/34451840
favorite count: 0
has answer: http://stackoverflow.com/a/22623645
type: UnansweredQuestion
tagged with: count
tagged with: loops
has comment: http://stackoverflow.com/comment/34451860
type: Question
has body: If I enter the string "in the win". How would I go with having the program finding the pairs "in" in that string. There are two. I know to find the occurrences of one character in a string, but how about a pair. Thank you.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22623660
has title: How to count the number of pairs in a string
answer count: 2

http://stackoverflow.com/q/22574239
type: Question
has answer: http://stackoverflow.com/a/22603602
has body: I have a JavaFx TableView with each Row having a column with a delete button which when clicked should delete the TableRow, as well as the corresponding entries in the H2 database via Hibernate. So far I'm not getting anything. Nothing happens on button click. Not even if I manually assign the item Primary Key like so: NewBeautifulKiwi toDelete = (NewBeautifulKiwi) session.get(NewBeautifulKiwi.class, 97); Please help me make this work; the button click to delete the TableRow it belongs to as well as the Database items populating that particular TableRow. So far nothing happens at all on ButtonClick. Thank you in advance. Ps. The buttons also get printed where the columns are empty. It would also help if you helped me solve this and only have Buttons on Rows with data The Class Extract: public class HomeController implements Initializable { @FXML public static TableView&lt;NewBeautifulKiwi&gt; KIWI_TABLE; @FXML private TableColumn&lt;NewBeautifulKiwi, Object&gt; KiwiAction; // Initializes the controller class. @Override public void initialize(URL url, ResourceBundle rb) { KiwiAction.setCellValueFactory(new PropertyValueFactory&lt;NewBeautifulKiwi, Object&gt;("KiwiAction")); KiwiAction.setCellFactory(new Callback&lt;TableColumn&lt;NewBeautifulKiwi, Object&gt;, TableCell&lt;NewBeautifulKiwi, Object&gt;&gt;() { @Override public TableCell&lt;NewBeautifulKiwi, Object&gt; call(TableColumn&lt;NewBeautifulKiwi, Object&gt; param) { final Button button; Image image = new Image(getClass().getResourceAsStream("/MediaTools/Error.png")); final ImageView imageView = new ImageView(); imageView.setFitHeight(16); imageView.setFitWidth(16); imageView.setImage(image); button = new Button("", imageView); final TableCell&lt;NewBeautifulKiwi, Object&gt; cell = new TableCell&lt;NewBeautifulKiwi, Object&gt;() { @Override public void updateItem(Object item, boolean empty) { if (item != null) { super.updateItem(item, empty); final VBox vbox = new VBox(0); button.setAlignment(Pos.CENTER); butto…
upvote count: 5
tagged with: hibernate
score: 5
tagged with: tableview
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22603602
favorite count: 0
has title: How to delete a JavaFx TableView Row
type: AnsweredQuestion
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/34341665
type: QuestionComment
has text: Instead of your `<%...%>` (called scriptlet, should -almost- never be used), try `${object.length}` (expression language, EL).
comment on: http://stackoverflow.com/q/22562528
score: 1
type: Comment

http://stackoverflow.com/comment/34449707
type: Comment
comment on: http://stackoverflow.com/q/22622009
has text: There's probably a good reason you didn't get an answer, double posting isn't encouraged or welcome
score: 2
type: QuestionComment

http://stackoverflow.com/comment/34454214
comment on: http://stackoverflow.com/q/22624535
score: 0
type: QuestionComment
type: Comment
has text: I'm not sure why this question has been downvoted and I would really like to know the reason for it. I think that this is a good exercise in computer science. If I can understand the reason for the downvote, I would make sure that I don't make the same mistake in my next post.

http://stackoverflow.com/comment/34397535
type: Comment
has text: I code clearly works fine and nothing change when i put JAVA_HOME in the environment variable
comment on: http://stackoverflow.com/a/22592724
type: AnswerComment
score: 0

http://stackoverflow.com/q/22630643
has comment: http://stackoverflow.com/comment/34464184
has comment: http://stackoverflow.com/comment/34464665
answer count: 2
has comment: http://stackoverflow.com/comment/34463989
has answer: http://stackoverflow.com/a/22631790
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/12535016
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22630872
has comment: http://stackoverflow.com/comment/34464150
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34464577
linked to: http://stackoverflow.com/q/978061
has title: why Spring MVC GET method not set POJO class by json value?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
has body: this error I got during GET method implementation java.io.EOFException: No content to map to Object due to end of input my controller @RequestMapping(value = "/Login.htm", method = RequestMethod.GET,consumes="application/json",produces="application/json") public @ResponseBody Map&lt;String, Object&gt; Login(HttpServletRequest request,@RequestBody UserInput user) { Map&lt;String, Object&gt; modelMap = new HashMap&lt;String, Object&gt;(1); modelMap.put("status",userManagerDAO.LoginUser(user)); return modelMap; } Its working with post but not working with get method. please help me to make this method get my input json. { "cusId":1, "loginId" : "123ASDF", "password": "test123" }

http://stackoverflow.com/q/22593116
upvote count: 6
score: 6
has title: PriorityQueue vs Collections.sort
tagged with: collections
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22596125
has comment: http://stackoverflow.com/comment/34396676
tagged with: java
has answer: http://stackoverflow.com/a/22595644
possible better answer: http://stackoverflow.com/a/22596125
answer count: 2
has body: When would I ever choose Collections.sort() over PriorityQueue, when I know that PQ's would be better in terms of time complexity?
downvote count: 0
favorite count: 0
tagged with: priority-queue
accepted answer: http://stackoverflow.com/a/22595644
has comment: http://stackoverflow.com/comment/34396667

http://stackoverflow.com/q/22491444
upvote count: 1
has body: Is it possible to pass/get values from FXML interface fields in JavaFX without using a controller class?
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22494251
favorite count: 0
type: UnansweredQuestion
has title: How to work with FXML (pass or get values from interface) without using controller class in JavaFX?
tagged with: javafx-2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22529210

http://stackoverflow.com/comment/34304746
type: Comment
type: QuestionComment
score: 2
has text: It's not a limit. It's just the initial capacity, as you said. It gets expanded automatically.
comment on: http://stackoverflow.com/q/22541210

http://stackoverflow.com/comment/96825493
type: QuestionComment
comment on: http://stackoverflow.com/q/22489398
has text: This essentially confirms the answer given in https://stackoverflow.com/questions/10382929/how-to-fix-java-lang-unsupportedclassversionerror-unsupported-major-minor-versi
score: 0
type: Comment

http://stackoverflow.com/comment/34302397
comment on: http://stackoverflow.com/q/22521636
has text: Does it work if you run on Dalvik instead of ART?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22629200
score: 0
type: Answer
has body: toString() is a method found on the Object.class, which all classes you write will extend automatically. Therefore your class will already have this method by default, but it won't return what you expect. You can override this method, and make it do exactly what you want to. If you try and use your class, you'll find that toString() is already available: new Box().toString(); Just write a new method for your class with the same signature and add your own code. public String toString() {}
answers question: http://stackoverflow.com/q/22598051

http://stackoverflow.com/a/22591693
answers question: http://stackoverflow.com/q/22591640
type: Answer
upvote count: 1
score: 1
has body: When you cast, NaN of one type is mapped to NaN of the other type. This is done by the CPU so what you see in Java is what happens at the "Architectural Level"
downvote count: 0

http://stackoverflow.com/q/22556423
linked to: http://stackoverflow.com/q/14248063
upvote count: 37
downvote count: 0
possible better answer: http://stackoverflow.com/a/22556674
has body: All, I have multiple XML templates that I need to fill with data, to allow my document builder class to use multiple templates and insert data correctly I designate the node that I want my class to insert data to by adding an attribute of: id="root" One example of an XML <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> Code expr = xpath.compile("//SiebelMessage[@id='root']"); root = (Element) expr.evaluate(xmlDoc, XPathConstants.NODE); Element temp = (Element) root.cloneNode(true); Using this example: XPath to select Element by attribute value The expression is not working: //SiebelMessage[@id='root'] Any ideas what I am doing wrong?
type: AnsweredQuestion
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has answer: http://stackoverflow.com/a/22556637
type: Question
score: 37
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22556674
has title: XPath search by "id" attribute , giving NPE - Java
accepted answer: http://stackoverflow.com/a/22556637

http://stackoverflow.com/a/22508023
answers question: http://stackoverflow.com/q/22506927
score: 0
has body: Here is the general algorithm: Map each character in the string to the number of times it appears in it. Sort the map keys (characters) by decreasing order of their values (count). Print each character according to the number of times it appears in the string. And here is a coding example: public void Print(String string) { HashMap&lt;Character,Integer&gt; hashMap = new HashMap&lt;Character,Integer&gt;(); TreeMap&lt;Character,Integer&gt; treeMap = new TreeMap&lt;Character,Integer&gt;(new ValueComparator(hashMap)); for (Character key : string.toCharArray()) { Integer value = hashMap.get(key); if (value == null) hashMap.put(key,1); else hashMap.put(key,value+1); } treeMap.putAll(hashMap); for (Character key : treeMap.keySet()) { Integer value = hashMap.get(key); for (Integer i=0; i&lt;value; i++) System.out.print(key); } } private class ValueComparator implements Comparator&lt;Character&gt; { Map&lt;Character,Integer&gt; base; public ValueComparator(Map&lt;Character,Integer&gt; base) { this.base = base; } public int compare(Character a,Character b) { if (base.get(a) &gt;= base.get(b)) return -1; else return +1; } }
type: Answer

http://stackoverflow.com/a/29597537
downvote count: 0
score: 1
has body: ... FX Controller is a java file, so it has to be DialogController and the Controller's path should be included i.e, fx:controller="applicationPackageName.DialogController" The above mentioned fxml code does not work. It results in javafx.fxml.LoadException java.lang.InstantiationException java.lang.NoSuchMethodException Reason: The jvm looks for a class constructor with 0 parameters to build an instance. To overcome the error, the controller file needs to be loaded in the function coded in java: loader.setController(new ControllerName("")); To sum up (Working code): FXML file: Controller file: public class PiPreferenceController { private final String message ; @FXML private Label messageLabel ; @FXML void initialize() { messageLabel.setText(message); } public PiPreferenceController(String message) { this.message = message ; } @FXML public void close() { messageLabel.getScene().getWindow().hide(); } } Function: void dialogPreferences() throws IOException { Stage dialogStage = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource( "PiPreference.fxml")); loader.setController(new PiPreferenceController("")); BorderPane root = (BorderPane) loader.load(); Scene scene = new Scene(root); dialogStage.setScene(scene); dialogStage.showAndWait(); }
upvote count: 1
answers question: http://stackoverflow.com/q/22645067
type: Answer

http://stackoverflow.com/q/22606597
tagged with: java
type: Question
tagged with: onexception
has body: I am trying to use an onException clause within my route that also has an aggregator in it. I was expecting that whenever an exception is thrown within the aggregate() method of my aggregator, the OnException clause should catch it, handle it and redeliver it. However, that doesnt seem to be happening. Can anyone please suggest where I am going wrong. from("jms:queue:start?concurrentConsumers=10").routeId("testRoute") .onException(Exception.class).log("Exception caught").process(new Processor() { @Override public void process(Exchange exchange) throws Exception { logger.debug("****Exception caught***"); } }) .handled(true).maximumRedeliveries(-1).end() .transacted() .aggregate(header("correlationHeader"), new CustomAggregator()) .completionSize(50). to("jms:queue:end"); where CustomAggregator is my aggregator and within its aggregate method I am throwing an Exception to test my exception handling. Any help or suggestion appreciated.
has comment: http://stackoverflow.com/comment/34432579
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/34445889
score: 0
has comment: http://stackoverflow.com/comment/34474214
has title: Using OnException within a route containing aggregator
has comment: http://stackoverflow.com/comment/34475675
has comment: http://stackoverflow.com/comment/34474036
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34504803
answer count: 0

http://stackoverflow.com/a/22493352
score: 0
type: Answer
has body: You should not use i to save "number of bags". See the line i = infile.nextInt();. Use another variable, then you should be fine. Also, you should keep reading until end of file, so you probably wouldn't be able to write a for (int i = 0; i &lt; n; i++)-style of loop.
answers question: http://stackoverflow.com/q/22493259

http://stackoverflow.com/q/22631229
upvote count: 2
tagged with: annotations
type: Question
has comment: http://stackoverflow.com/comment/34466630
tagged with: java
has comment: http://stackoverflow.com/comment/34466230
tagged with: aspectj
has body: Spring aspects annotations (before, after, etc) are not executing. I have no compilation problems, "test!!!" is being printed every time I visit that page, but the methods annotated with @Before, etc are never run. Any help will be greatly appreciated. Controller.java @Controller @RequestMapping("/person/") public class Controller { @Autowired private Content content; @RequestMapping(method=RequestMethod.GET,value="list") public ModelAndView list() { ModelAndView mav = new ModelAndView(); content.test(); mav.addObject("content", content); mav.setViewName("list"); return mav; } } Content.java package com.myfirm.myproject.model; @Component public class Content implements java.io.Serializable { private static final long serialVersionUID = 1L; public Content() { } public void test () { System.out.println("test!!!"); } } ContentAspect.java @Aspect @Component public class ContentAspect { @Pointcut ("execution(* com.myfirm.myproject.model.Content.test(..))") public void performance() { } @Before("performance()") public void takeSeats() { System.out.println("The audience is taking their seats."); } } AppConfig.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://w…
has title: Spring aop aspects not executing
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34471448
accepted answer: http://stackoverflow.com/a/22640283
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22640283

http://stackoverflow.com/a/22524854
type: Answer
has body: The problem might be related to making 0 a special case, but having a data source also have a zero element. The list and adapter are no longer aligned. Putting the ad view in a header might work. See here: https://developer.android.com/reference/android/widget/ListView.html#addHeaderView%28android.view.View,%20java.lang.Object,%20boolean%29
answers question: http://stackoverflow.com/q/22522875
score: 0

http://stackoverflow.com/q/22574678
has comment: http://stackoverflow.com/comment/34364011
tagged with: android
has comment: http://stackoverflow.com/comment/34363700
has answer: http://stackoverflow.com/a/22575031
accepted answer: http://stackoverflow.com/a/22575031
tagged with: sharedpreferences
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has body: I want to change the background colour of an activity using AlertDialog. Here is what I have done: private SharedPreferences prefs; private static final String SELECTED_ITEM = "SelectedItem"; private Editor sharedPrefEditor; btnchangeColor = (ImageButton) findViewById(R.id.btnchangeColor); btnchangeColor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final CharSequence[] items={"Red","Green","Blue", "Yellow", "#EE82EE"}; AlertDialog.Builder builder = new AlertDialog.Builder( ContentView_2.this); builder.setTitle("Pick a Color"); builder.setPositiveButton("ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {} }); builder.setSingleChoiceItems(items, getSelectedItem(), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub wvContent = (WebView) findViewById(R.id.wvContent); //LinearLayout ll=(LinearLayout)findViewById(R.id.wvContent); if("Red".equals(items[which])) { wvContent.setBackgroundColor(Color.RED); } else if("Green".equals(items[which])) { wvContent.setBackgroundColor(Color.GREEN); } else if("Blue".equals(items[which])) { wvContent.setBackgroundColor(Color.BLUE); } else if("Yellow".equals(items[which])) { wvContent.setBackgroundColor(Color.YELLOW); } else if("#EE82EE".equals(items[which])) { wvContent.setBackgroundColor(Color.rgb(184,184,184)); } saveSelectedItem(which); } }); builder.show(); }}); } private int getSelectedItem() { if (prefs == null) { prefs = PreferenceManager .getDefaultSharedPreferences(this); } return prefs.getInt(SELECTED_ITEM, -1); } private void saveSelectedItem(int which) { if (prefs == null) { prefs = PreferenceManager .getDefaultSharedPreferences(this); } sharedPrefEditor = prefs.edit(); sharedPrefEditor.putInt(SELECTED_ITEM, which); sharedPrefEditor.commit(); } I also add this code to OnCreate: wvContent = (WebView) findViewById(R.id.wvContent); wvCo…
answer count: 1
has comment: http://stackoverflow.com/comment/34363763
has title: How to change background colour of an Android activity
has comment: http://stackoverflow.com/comment/34363717

http://stackoverflow.com/a/22503177
answers question: http://stackoverflow.com/q/22503005
type: Answer
score: 0
has body: First of all test weather your split result are there and try to initialize fullname variable String fullname = ""; String[] parts = fullname.split(","); if(parts.length==2){ String lname = parts[0]; String fname = parts[1]; }

http://stackoverflow.com/a/22506548
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22506414
upvote count: 1
has body: Instead of returning a new Boolean(), it will check the parameter and return one of the existing Boolean objects, Boolean.TRUE or Boolean.FALSE.

http://stackoverflow.com/q/22511036
score: 0
tagged with: android
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22511203
type: UnansweredQuestion
has title: Android Data Storage
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34250564
has comment: http://stackoverflow.com/comment/34250489
tagged with: database
has body: Hi im building a project for college at the moment which is a Betting history app basically. It takes user input of different bet made and displays a summary of how much money the user has won/lost . What I am wondering is what would be the best way to store this information ?? Would I use a data base and SQLite or just use a simple text file to store the data?? I would want the total win/loss to be displayed at all times on the home screen of the app.

ftp
tags question: http://stackoverflow.com/q/22591725
type: Tag
tags question: http://stackoverflow.com/q/22597287
tags question: http://stackoverflow.com/q/22634007
tag name: ftp
tags question: http://stackoverflow.com/q/22527333

http://stackoverflow.com/q/22636936
answer count: 1
accepted answer: http://stackoverflow.com/a/22637953
has comment: http://stackoverflow.com/comment/34475513
has comment: http://stackoverflow.com/comment/34475279
has title: How can I return Java arrays from C++ using SWIG?
tagged with: c++
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22637953
tagged with: swig
tagged with: arrays
tagged with: static-array
has body: I want to create a function which will return a static array and wrap this function with SWIG to be able to use it in Java. Say I created my own class and I have a C++ function which looks like myClass* myFunction() { // stuff here } And I want to wrap it with SWIG so as to use it in Java in this way : myClass[] array = myFunction(); I've done some reseach but couldn't find something valuable (many answers say how to create function whose arguments are arrays but none say about arrays being returned). Thank you for taking the time to answer me.

http://stackoverflow.com/q/22491638
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34219343
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/34217884
has answer: http://stackoverflow.com/a/22575695
tagged with: java
has body: it appears that the GA versions of spring-core spring-data-commons spring-data-mongodb as well as the most recent release candidate of spring-boot-starter-web spring-boot-autoconfigure are not compatible. what versions of these artifacts are compatible with each other? I have a very basic Application.java that puts two objects into a MongoDB database and then takes them out and prints them to the screen. import game.acorn.entities.Entity; import game.acorn.mRepositoryInterfaces.EntityRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @ComponentScan @EnableAutoConfiguration public class Application implements CommandLineRunner{ @Autowired private EntityRepository repository; public static void main(String[] args) { SpringApplication.run(Application.class, args); } public void run(String... args) throws Exception { repository.deleteAll(); repository.save(new Entity("Jack", "Skellington")); repository.save(new Entity("Blake", "Yarbrough")); System.out.println("Entities found"); for (Entity entity : repository.findAll()){ System.out.println(entity); } System.out.println(); System.out.println("Entity by first name 'Jack'"); System.out.println(repository.findByFirstName("Jack")); System.out.println(); System.out.println("Entity by first name 'Blake'"); System.out.println(repository.findByFirstName("Blake")); } } When I run this application with spring-core version 4.0.2.RELEASE spring-data-commons version 1.5.0.RELEASE spring-boot-starter-web version 1.0.0.RC4 spring-data-mongodb version 1.4.1.RELEASE spring-boot-autoconfigure version 1.0.0.RC3 I end up getting a java.lang.NoClassDefFoundError at org.springframework.boot.autoconfigure.data.Abst…
type: Question
accepted answer: http://stackoverflow.com/a/22575695
tagged with: mongodb
has title: spring: -boot, -core, data-mongodb, -data-commons dependencies
answer count: 1
has comment: http://stackoverflow.com/comment/34260941
tagged with: spring-mongo
score: 0
tagged with: spring
has comment: http://stackoverflow.com/comment/34218386

http://stackoverflow.com/a/22578515
type: Answer
downvote count: 0
has body: Read their javadoc (Thread.State, for example, inheriting Enum, like all the enums), and you'll see what they're for. name() is an instance method which returns the name of the instance. valueOf() is a static method taking a String and returning the enum instance with that name. values() is a static method returning all the enum instances.
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/22578227

http://stackoverflow.com/comment/34358775
comment on: http://stackoverflow.com/q/22571681
score: 0
type: Comment
type: QuestionComment
has text: The approach for using "Object" worked fine. Thanks!!

http://stackoverflow.com/a/22639443
upvote count: 3
type: Answer
has body: The Arrays collection has a copyOfRange() method for (int i = 0; i &lt; charList.length; i++) { if (charList[i] == 'a') { char[] newCharList = Arrays.copyOfRange(charList,i,charList.length);//put every char in charList between i and the end into a new variable //do stuff break; } } If you need to access the new array outside the for loop, make sure to declare it before entering, i.e. char[] newCharList; for(...
has comment: http://stackoverflow.com/comment/34479467
downvote count: 0
has comment: http://stackoverflow.com/comment/34479343
score: 3
answers question: http://stackoverflow.com/q/22639379
has comment: http://stackoverflow.com/comment/34479287
has comment: http://stackoverflow.com/comment/34479624

http://stackoverflow.com/q/22543314
has comment: http://stackoverflow.com/comment/34308535
has answer: http://stackoverflow.com/a/22543481
answer count: 3
tagged with: string
has comment: http://stackoverflow.com/comment/34308678
favorite count: 0
has answer: http://stackoverflow.com/a/22543452
type: UnansweredQuestion
score: -3
has body: How would I check in java if a string entered match the required format of aa/dddd where a represents a lower or upper-case letter and d represents a number
has title: Check for specific string format
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/22543505
upvote count: 0

http://stackoverflow.com/comment/34477710
score: 0
type: Comment
has text: For future users, this question is also useful: http://stackoverflow.com/questions/12173294/compiling-fully-in-memory-with-javax-tools-javacompiler
comment on: http://stackoverflow.com/a/22637676
type: AnswerComment

http://stackoverflow.com/comment/34286671
comment on: http://stackoverflow.com/q/22531302
type: Comment
type: QuestionComment
score: 1
has text: I think there is some issue with your image `com_facebook_top_button`. Try `android:layout_width="fill_parent"`

http://stackoverflow.com/comment/34469765
has text: Little explanation. To be able to call `m.group` we first need to call `find` OR `matches` on Matcher instance (`m`). Another important thing is that these methods need to have positive results (they have to return true), so `find` need to be able to find match single match for regex, and `matches` need to be able to confirm that entire input can be matched by regex. Otherwise there will be no match, so there will be nothing in `group` so its state would be illegal.
score: 7
comment on: http://stackoverflow.com/a/22634070
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22505040
tagged with: java
has body: I have a code for 1 doc file only .I need to convert multiple doc file in folder into respective textfile. Code for Single doc file Into text file: import java.io.*; import org.apache.poi.xwpf.extractor.XWPFWordExtractor; import org.apache.poi.xwpf.usermodel.XWPFDocument; public class ReadDocFile { public static void main(String[] args) { File file = null; try { // Read the Doc/DOCx file file = new File("document"); FileInputStream fis = new FileInputStream(file.getAbsolutePath()); XWPFDocument doc = new XWPFDocument(fis); XWPFWordExtractor ex = new XWPFWordExtractor(doc); String text = ex.getText(); //write the text in txt file File fil = new File("D:\\wordtotextoutput\\java1new.txt"); Writer output = new BufferedWriter(new FileWriter(fil)); output.write(text); output.close(); } catch (Exception exep) { } } }
accepted answer: http://stackoverflow.com/a/22505261
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34339671
possible better answer: http://stackoverflow.com/a/22505104
has title: How to convert a more than 1 doc file in a folder into text file using java
has answer: http://stackoverflow.com/a/22505104
has answer: http://stackoverflow.com/a/22505261
type: AnsweredQuestion

http://stackoverflow.com/q/22616825
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22616936
downvote count: 2
tagged with: loops
upvote count: 1
possible better answer: http://stackoverflow.com/a/22616936
type: Question
tagged with: do-while
has answer: http://stackoverflow.com/a/22616932
tagged with: message
tagged with: java
accepted answer: http://stackoverflow.com/a/22616988
has body: I'm trying to get my Do..While loop to display an error message to why it is re-asking for the user input again. This is my code for it: do { System.out.println("\nPlease enter the floor you are on: "); current_Floor = in.nextInt(); } // Loop until user input is equal to or less than the maximum floors while( current_Floor &gt; MAX_FLOORS );{ System.out.println("Please enter a floor which is less than 8"); } The problem with this code is that the "Error" message which i've added appears after a correct user input has been entered, when I need it to display before the user input is added in. Any ideas?
has answer: http://stackoverflow.com/a/22616897
has answer: http://stackoverflow.com/a/22616906
has answer: http://stackoverflow.com/a/22616962
has title: Displaying an error message in a Do..While loop in java
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/22616988
score: -1

http://stackoverflow.com/q/22581163
linked to: http://stackoverflow.com/q/6146182
score: 55
has comment: http://stackoverflow.com/comment/34375206
linked to: http://stackoverflow.com/q/13412386
linked to: http://stackoverflow.com/q/504103
has answer: http://stackoverflow.com/a/22582171
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/34378747
has answer: http://stackoverflow.com/a/22604185
has comment: http://stackoverflow.com/comment/34382655
tagged with: scala
has title: Hidden performance cost in Scala?
upvote count: 56
answer count: 4
has comment: http://stackoverflow.com/comment/34375372
type: AnsweredQuestion
tagged with: microbenchmark
tagged with: performance
has answer: http://stackoverflow.com/a/22582067
tagged with: java
has body: I came across this old question and did the following experiment with scala 2.10.3. I rewrote the Scala version to use explicit tail recursion: import scala.annotation.tailrec object ScalaMain { private val t = 20 private def run() { var i = 10 while(!isEvenlyDivisible(2, i, t)) i += 2 println(i) } @tailrec private def isEvenlyDivisible(i: Int, a: Int, b: Int): Boolean = { if (i &gt; b) true else (a % i == 0) &amp;&amp; isEvenlyDivisible(i+1, a, b) } def main(args: Array[String]) { val t1 = System.currentTimeMillis() var i = 0 while (i &lt; 20) { run() i += 1 } val t2 = System.currentTimeMillis() println("time: " + (t2 - t1)) } } and compared it to the following Java version. I consciously made the functions non-static for a fair comparison with Scala: public class JavaMain { private final int t = 20; private void run() { int i = 10; while (!isEvenlyDivisible(2, i, t)) i += 2; System.out.println(i); } private boolean isEvenlyDivisible(int i, int a, int b) { if (i &gt; b) return true; else return (a % i == 0) &amp;&amp; isEvenlyDivisible(i+1, a, b); } public static void main(String[] args) { JavaMain o = new JavaMain(); long t1 = System.currentTimeMillis(); for (int i = 0; i &lt; 20; ++i) o.run(); long t2 = System.currentTimeMillis(); System.out.println("time: " + (t2 - t1)); } } Here are the results on my computer: &gt; java JavaMain .... time: 9651 &gt; scala ScalaMain .... time: 20592 This is scala 2.10.3 on (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_51). My question is what is the hidden cost with the scala version? Many thanks.
downvote count: 1
accepted answer: http://stackoverflow.com/a/22604185
type: Question
possible better answer: http://stackoverflow.com/a/22582067
has comment: http://stackoverflow.com/comment/34379491
has answer: http://stackoverflow.com/a/22582305
linked to: http://stackoverflow.com/q/6265864
has comment: http://stackoverflow.com/comment/34375186

http://stackoverflow.com/comment/34311499
type: QuestionComment
comment on: http://stackoverflow.com/q/22544678
score: 0
has text: Refreshed, still didn't work. :( We first used the texture packer in chapter 4 for the game textures, such as character and coins. Now I'm in Chpater 7 using it for the menus. The location of the files should be fine since when I put the already generated files in there, it works.
type: Comment

http://stackoverflow.com/comment/34440765
type: AnswerComment
score: 0
type: Comment
has text: Ah ok, thanks dude, i've only been learning java for about 20 weeks so still a beginner with it, thanks for the advise
comment on: http://stackoverflow.com/a/22616988

http://stackoverflow.com/comment/34414777
has text: I have verified the reference by putting `System.out.println(ref.getEname());` and it is returning correct employee name
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22602923
score: 0

http://stackoverflow.com/q/22618770
type: Question
tagged with: xwpf
tagged with: image
has comment: http://stackoverflow.com/comment/34462974
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34460362
type: UnansweredQuestion
upvote count: 6
tagged with: http://stackoverflow.com/tag/docx
tagged with: apache-poi
answer count: 0
tagged with: java
score: 6
has body: Let's review the relationship between "docx" and "pictures": As I understand it, *.docx stores original pictures (pictures at the moment when you copy/paste them into Word). And every time when you use that picture, Word makes a "link" to original picture. But if you make some changes to that picture (for example resize, crop or change color) Word remembers your changes, modifying the "link" (add some special tags). That's great, because you will never lose quality of your picture! Let's get a picture from our *.docx file. To do that I use this code snippet: XWPFDocument wordDoc = new XWPFDocument( pathToFile ); for (XWPFParagraph p : wordDoc.getParagraphs()) { for (XWPFRun run : p.getRuns()) { for (XWPFPicture pic : run.getEmbeddedPictures()) { byte [] img = pic.getPictureData().getData() File outputfile = new File ( pathToOutputFile ); BufferedImage image = ImageIO.read(new ByteArrayInputStream(img)); ImageIO.write(image , "png", outputfile); } } } But this way I get the original pictures from *.docx. If, for example, you cropped out a section from your picture and gave me the rest, then I always find the whole image in outputfile. That's not good. Does anyone know how to get the picture with all changes that someone made to it in Word?
has title: How to get picture from *.docx with all changes using POI?

http://stackoverflow.com/q/22487945
has answer: http://stackoverflow.com/a/48808455
tagged with: element
has title: Remove the middle elements from an Array
accepted answer: http://stackoverflow.com/a/48808455
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: I am trying to deal with this problem: "Remove the middle element if the array length is odd, or the middle two elements if the length is even" I have found the "round" way of solving this problem using ArrayList, but I want to do the same using only Arrays. This is my code, using ArrayLists. import java.util.*; public class test{ public static void main (String[]args){ ArrayList&lt;Integer&gt; outputArray = new ArrayList&lt;Integer&gt;(); int [] myArr = {5,8,9,10,11,5}; int midEl = myArr.length/2; int midElMinusOne = myArr.length/2 -1; for(int i=0;i&lt;myArr.length;i++){ outputArray.add(myArr[i]); } outputArray.remove(midEl); outputArray.remove(midElMinusOne); System.out.print(outputArray); } }
has answer: http://stackoverflow.com/a/22488129
type: Question
possible better answer: http://stackoverflow.com/a/22488432
has answer: http://stackoverflow.com/a/22488116
has answer: http://stackoverflow.com/a/22488432
tagged with: arraylist
tagged with: arrays
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/22589737
has title: Java Cipher NoSuchPaddingException
favorite count: 0
tagged with: encryption
score: 5
has answer: http://stackoverflow.com/a/22589951
tagged with: aes
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22589960
possible better answer: http://stackoverflow.com/a/22589951
has body: I'm not very experienced with Java, so this may be a nooby question. I was trying to experiment a bit with Java encryption, but for some reason I can't get an instance of Cipher. I always get a NoSuchPaddingException on this line, changing the padding to something else, like "/NoPadding" doesn't work: Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); Trying to run the code even though Eclipse says it's wrong results in this error: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Unhandled exception type NoSuchAlgorithmException Unhandled exception type NoSuchPaddingException at Encryption.main(Encryption.java:10) What could be the problem? Do I have to import some certain things? In the current code I import javax.crypto.Cipher and javax.crypto.spec.SecretKeySpec. When I use Jython the code works by the way.
type: Question
upvote count: 5
answer count: 2
accepted answer: http://stackoverflow.com/a/22589960
downvote count: 0

http://stackoverflow.com/q/22506998
tagged with: google-cloud-datastore
upvote count: 1
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/34253211
has comment: http://stackoverflow.com/comment/34253067
has comment: http://stackoverflow.com/comment/34251183
has body: We are counting some types of requests in a GAE: for each request the servlet gets the "channel" (counter index), and the increments the counter for this channel and hour. We are using sharded counters https://developers.google.com/appengine/articles/sharding_counters?csw=1 Once an hour a cron job runs, gets the count for each counter, stores it in a more efficient structure, and if the count is much lower than the day before, triggers an alert. This process had run successfully for some time, but recently we had one case with a severe under-count (50% and more under-count on many channels, many of them with count of several thousands). I was able to identify via logs and reference counts that the expected amounts of requests and counter-increments ran at this hour, and the problem is an under-count (either in the get() operation summing the shards or elsewhere). Is there any reasonable scenario, in which such a problem would occur?
downvote count: 0
score: 1
tagged with: java
has title: Reporting / counting error using sharded counters (GAE)
type: Question
has comment: http://stackoverflow.com/comment/34273626

http://stackoverflow.com/q/22606313
upvote count: 1
type: Question
tagged with: gwt
tagged with: libgdx
has comment: http://stackoverflow.com/comment/37290761
has comment: http://stackoverflow.com/comment/34424554
has comment: http://stackoverflow.com/comment/103765916
has comment: http://stackoverflow.com/comment/45375526
has comment: http://stackoverflow.com/comment/34429950
has comment: http://stackoverflow.com/comment/34433268
has title: GWT SuperDev Source Code not Showing
downvote count: 0
has body: I'm following the instructions in this blog post (http://www.badlogicgames.com/wordpress/?p=3073) for trying to debug the GWT version of my LibGDX project. I can compile the GWT project fine, and start the superdev code server using en Eclipse "Run As" profile. I then start Jetty using mvn verify -Phtml, browse to localhost:8080/index.html and enable dev mode as per the blog post. Something of note is that I don't see the dialog box as described in the post ("GWT modile 'blah' may need to be recompiled"). When looking at sources in Chrome's developer tools, I don't see any of my linked Java source under the localhost:9876 tree node; instead I see something like this: localhost:9876 projectname gwt/chrome chrome.css {some long MD5-lookign thing}.cache.js projectname.nocache.js It's be ace if I could figure out how to see my code linked there and put breakpoints in, as at the moment I'm getting a GdxRuntimeException with a message of "Not implemented" thrown somewhere, but I've no idea from where.
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/34420998
has comment: http://stackoverflow.com/comment/34427206
tagged with: gwt-super-dev-mode
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/34452070
type: AnswerComment
has text: I tried converting RGB value to XY, but I seem to be unable to get it just right. Read my [full explanation](http://stackoverflow.com/questions/22623655/rgb-to-philips-hue-algorithm?lq=1)
score: 0
comment on: http://stackoverflow.com/a/22570663
type: Comment

http://stackoverflow.com/comment/34474053
type: Comment
score: 0
type: AnswerComment
has text: I was a little surprised by the speed too. I initially thought your solution was more fast. BTW `result` is lazy and you have to call `length` or `toList()` to get a real time.
comment on: http://stackoverflow.com/a/22636003

http://stackoverflow.com/comment/34335733
comment on: http://stackoverflow.com/q/22557452
score: 0
type: Comment
type: QuestionComment
has text: Any ideas about the problem it self?