http://stackoverflow.com/q/21817936
has comment: http://stackoverflow.com/comment/33019204
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33019405
accepted answer: http://stackoverflow.com/a/21818030
tagged with: persistence
has answer: http://stackoverflow.com/a/21821166
has title: Design strategy for Java web services
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21821166
tagged with: java
tagged with: web-services
has answer: http://stackoverflow.com/a/21818030
type: Question
tagged with: jakarta-ee
has body: When one wants to set up an API for a webservice with Java EE, what is the best procedure to design and realize such an API? Having never used persistence before, I always drew out my UML datamodel and structured a database with a SQL client tool then build my application on top of it. I get the idea that most Java EE applications are built starting from entity classes and services. Or from XSD and WSDL files. Is this true? Is there a difference between how one best creates SOAP and REST apis? Where is the structure decided and what comes first? How are persistence systems best designed? And on what basis? What tools are helpfull? Any extra information and especially reference is desirable here! I just want to get more feeling with the bigger picture.

http://stackoverflow.com/comment/32797485
has text: @keshlam Thank you for your input. I thought it would be better to include all of the questions here so people wouldn't have to read all of the background information on separate questions. If this isn't solved in a bit I will attempt to split it up and/or revise my question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21693078

http://stackoverflow.com/comment/33026727
type: AnswerComment
score: 0
type: Comment
has text: HashMap<S, T> h = new HashMap<S, T>(); This is in package java.util.HashMap.
comment on: http://stackoverflow.com/a/21822214

http://stackoverflow.com/comment/52520400
has text: Well, it answers the question that would be assumed from the title.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22140169
type: AnswerComment

http://stackoverflow.com/q/21835100
accepted answer: http://stackoverflow.com/a/25767415
answer count: 1
downvote count: 0
favorite count: 0
tagged with: sockets
score: 6
has answer: http://stackoverflow.com/a/25767415
tagged with: web-services
tagged with: shared-libraries
upvote count: 6
type: AnsweredQuestion
tagged with: java
has body: I want to add javax.websocket to an Intellij IDEA project to support creating a web socket client. How can I do this? From the screen shot below you can see the project is finding javax.net.ssl, but not javax.websocket: I notice that if I go to Project/Settings/Libraries and click the green + sign, then choose Maven, I get a "download" from Maven repository option, which upon searching for "websocket" comes up with dozens of choices as shown below: Is this the right procedure to use? If so, which of these dozens of choices should I pick?
type: Question
has title: Add javax.websocket to Intellij IDEA project?

http://stackoverflow.com/q/21771971
favorite count: 0
tagged with: java.util.scanner
type: UnansweredQuestion
has body: In Java, I have string like this : String str = "PropertyNameAndStringValue[VERSION,5.3.1.20]],family=kwaas,filesize=939888640,imageType=OVA_SW(10000),name=ISR4451X-WAAS-5.3.1.20.ova,updatedTime=February 13, 2014 3:41:22 PM IST,version=5.3.1.20,instanceId=13325317,authEntityId=13325317,authEntityClass=-72900124,_orderedListOEIndex=&lt;Integer&gt;,_creationOrderIndex=&lt;Integer&gt;,instanceVersion=0]" I need to extract Name : which is next to "name=". I need to find the next immediate word after "next=" which is here in this case "ISR4451X-WAAS-5.3.1.20.ova". How can I do that ? I tried this Scanner sc = new Scanner(str); String nameOVA = sc.next("name="); I'm getting java.util.InputMismatchException. Pls help
answer count: 4
upvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32937418
score: -2
has answer: http://stackoverflow.com/a/21772149
has title: Find next substring after a string/token in a big string
has answer: http://stackoverflow.com/a/21772084
tagged with: substring
has answer: http://stackoverflow.com/a/21772034
downvote count: 2
has answer: http://stackoverflow.com/a/21772203
tagged with: string

http://stackoverflow.com/comment/32980559
comment on: http://stackoverflow.com/q/21796327
type: Comment
type: QuestionComment
score: 1
has text: Did you start the Derby network server on the other computer? Does the other computer's firewall allow connections through that port? Is the other computer reachable in your network at all?

http://stackoverflow.com/comment/32854644
score: 0
type: Comment
type: QuestionComment
has text: Why do you want to do that? Isn't it simpler to state in the javadoc that if the number is mutated the behaviour of the class is undefined in a multi threaded context?
comment on: http://stackoverflow.com/q/21725594

jhipster
tag name: jhipster
tags question: http://stackoverflow.com/q/21755663
tags question: http://stackoverflow.com/q/21728362
tags question: http://stackoverflow.com/q/21745711
type: Tag
tags question: http://stackoverflow.com/q/21745425

http://stackoverflow.com/q/21735857
linked to: http://stackoverflow.com/q/21651519
score: 0
has comment: http://stackoverflow.com/comment/32872710
favorite count: 0
has answer: http://stackoverflow.com/a/21736174
upvote count: 1
tagged with: recursion
type: AnsweredQuestion
has title: Overriding toString method to format Linked List into string recursively
tagged with: linked-list
tagged with: java
has body: I need to turn my linked list into a string recursively. The variable is next Node and variable value is the Node's string value. The String needs to be formated so that there is a semicolon(with a space before and after) between the values. This is what I have so far.. public String toString() { String result = ""; if (this.next == null) {//base case return " ; " + value; } else { result += this.next.toString() ;//reduction step } return result;
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21736174
answer count: 1

http://stackoverflow.com/a/21762419
answers question: http://stackoverflow.com/q/21762375
type: Answer
accepted answer of: http://stackoverflow.com/q/21762375
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32919852
has body: The easiest way would be to just do sourceimage = image; Note that this copies the reference to the array, so both sourceimage and the reference passed into the filter() method will point to the same array. Any changes made to the array will be visible from both references.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/21778452
accepted answer of: http://stackoverflow.com/q/21778401
score: 2
answers question: http://stackoverflow.com/q/21778401
downvote count: 0
has body: You need to handle the exception for Runtime.getRuntime().exec("calc");. Try this: else if(e.getActionCommand().equals("Window Calculator")){ try { Runtime.getRuntime().exec("calc"); } catch(IOException ioe) { ioe.printStackTrace(); } } From OP comments: If i catch the exception,how will it help..the code that i want to use will not be executed by this This will not help you to run your code which has caused exception, but it can help you to run your other parts of program even if exception occurs.
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/21812248
has comment: http://stackoverflow.com/comment/33022697
type: Answer
has comment: http://stackoverflow.com/comment/33032344
has body: You can define an enum that is also a factory: public enum BuildingType { farm(Farm.class), shop(Shop.class), house(House.class); private Class&lt;? extends Building&gt; clazz; private BuildingType(Class&lt;? extends Building&gt; clazz) { this.clazz = clazz; } public Building createBuilding() { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(clazz + " has no default constructor"); } } } Or slightly more code, but avoiding reflection, make the enum class an abstract factory and let the instances be factories: public enum BuildingType { farm() { public Building createBuilding() { return new Farm(); } }, shop() { public Building createBuilding() { return new Shop(); } }, house() { public Building createBuilding() { return new House(); } }; public abstract Building createBuilding(); } Either way, to use: public void addBuilding(BuildingType bType) { Building b = bType.createBuilding(); b.start(); }
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21811665
has comment: http://stackoverflow.com/comment/33017530
accepted answer of: http://stackoverflow.com/q/21811665
has comment: http://stackoverflow.com/comment/33020986
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33022225

http://stackoverflow.com/q/21826937
tagged with: hibernate
tagged with: integration-testing
has comment: http://stackoverflow.com/comment/33040173
has title: Sequences not resetting for mock HSQL db and causing constraint violation between JBehave tests
answer count: 2
has answer: http://stackoverflow.com/a/22115114
score: 0
possible better answer: http://stackoverflow.com/a/21833815
has answer: http://stackoverflow.com/a/21833815
tagged with: hsqldb
accepted answer: http://stackoverflow.com/a/22115114
has comment: http://stackoverflow.com/comment/33040473
has body: I am encountering sequencing issues when writing BDD tests with our API (Spring+Hibernate). We use JBehave as our BDD runner and a HSQL db. Basically I have created the following case to explain the issue I am encountering. I have two stories. Both stories do inserts to a table called DUMMYPRODUCT. We specify that before each scenario we clear all data and reset the schema using the following, "TRUNCATE SCHEMA PUBLIC RESTART IDENTITY AND COMMIT NO CHECK" And then we reinitialise Table Data using a predefined sql script which includes 2 inserts to DUMMYPRODUCT, And Resets the sequence (supposedly) using DROP SEQUENCE DUMMYPRODUCT_SEQ; CREATE SEQUENCE DUMMYPRODUCT_SEQ START WITH 3 INCREMENT BY 10; But I am encountering extremely strange behaviour as the sequences are not reset between both stories and scenarios. Instead they seem to continue on to the next story/scenario and then reset within,i.e. not going into the next block of sequences, causing the constraint violation to occur. exception=java.sql.SQLIntegrityConstraintViolationException: integrity constraint violation: unique constraint or index violation; SYS_PK_10216 table: DUMMYPRODUCT Behaviour experienced inserts into DUMMYPRODUCT for DUMMYPRODUCTID (DUMMYPRODUCTID) First story Scenario 3 4 next story Scenario 5 6 7 8 9 10 11 12 3 4 5 exception 7 exception 9 exception Scenario 11 12 3 4 5 6 7 8 9 10 11 exception 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Scenario 27 28 29 30 31 32 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 exception 29 exception Have you encountered such issues in the past with your HSQL implementations ?
tagged with: spring
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/21808644
score: 4
accepted answer of: http://stackoverflow.com/q/21808630
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33003148
type: Answer
upvote count: 4
has body: Your for loop terminating condition is buggy. This: for(int i = 0; i == Flips; ++i) will terminate on first iteration only, if the value of Flips is anything but 0. It should be replaced with: for(int i = 0; i &lt;= Flips; ++i)
downvote count: 0
answers question: http://stackoverflow.com/q/21808630

http://stackoverflow.com/q/21744297
has body: I'm using HK2 through Jersey, and am looking to get @Immediate services working. In the process, I notice that (as it seems) none of the annotations for my services are getting registered. E.g., after spinning up my ServiceLocator and looking at my descriptor for a service annotated with @Singleton, it is still set as @PerLookup. My code for initiating my application handler is below: ApplicationHandler handler = new ApplicationHandler(resourceConfig, new AbstractBinder() { ... }); My binder registers a service like so: bindAsContract(ShouldHaveSingletonScope.class); Looking at my ServiceLocator immediately after this, I see that the scope is not being pulled from the class (still @PerLookup). Is there something additional I need to specify to tell HK2 to parse class annotations? This seems like a pretty standard use case so I must be missing something.
upvote count: 2
possible better answer: http://stackoverflow.com/a/21745809
has answer: http://stackoverflow.com/a/21745809
tagged with: hk2
has answer: http://stackoverflow.com/a/21764993
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
tagged with: jersey
has title: HK2 annotations not being handled
downvote count: 0
tagged with: jersey-2.0
accepted answer: http://stackoverflow.com/a/21764993
linked to: http://stackoverflow.com/q/23402814
favorite count: 0

http://stackoverflow.com/q/21738174
type: Question
upvote count: 2
tagged with: facebook
accepted answer: http://stackoverflow.com/a/21738645
answer count: 1
downvote count: 1
has body: I am trying to login to my app using Facebook, but i got following errors on logcat. I am using simple Facebook library 02-09 09:34:51.863: E/ActivityThread(4778): Failed to find provider info for com.facebook.katana.provider.PlatformProvider 02-09 09:35:12.074: E/com.sromku.simple.fb.SimpleFacebook(4778): ----- 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): ERROR: SessionStatusCallback: exception= 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): com.facebook.FacebookAuthorizationException: The connection to the server was unsuccessful. 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at com.facebook.Session.handleAuthorizationResult(Session.java:1079) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at com.facebook.Session.onActivityResult(Session.java:554) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at com.sromku.simple.fb.SimpleFacebook.onActivityResult(SimpleFacebook.java:1358) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at com.ajmal.facebooktest.MainActivity.onActivityResult(MainActivity.java:122) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at android.app.Activity.dispatchActivityResult(Activity.java:3908) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at android.app.ActivityThread.deliverResults(ActivityThread.java:2528) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at android.app.ActivityThread.handleSendResult(ActivityThread.java:2574) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at android.app.ActivityThread.access$2000(ActivityThread.java:117) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:961) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at android.os.Handler.dispatchMessage(Handler.java:99) 02-09 09:35:12.093: E/com.sromku.simple.fb.SimpleFacebook(4778): at android.os.L…
tagged with: java
has comment: http://stackoverflow.com/comment/32877224
has comment: http://stackoverflow.com/comment/32877199
has comment: http://stackoverflow.com/comment/32877035
has comment: http://stackoverflow.com/comment/32877037
has title: Getting error when login to android app using facebook
has answer: http://stackoverflow.com/a/21738645
type: AnsweredQuestion
tagged with: android
score: 1
favorite count: 0

http://stackoverflow.com/comment/32959493
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21784149
has text: Unsupported protocol version suggests that your client driver version is incompatible with the server version. What version of the driver and the server are you using?

http://stackoverflow.com/comment/32828861
type: QuestionComment
has text: The fastest method is the [closed form](http://en.wikipedia.org/wiki/Fibonacci_number#Relation_to_the_golden_ratio).
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21710756

http://stackoverflow.com/q/21793414
type: UnansweredQuestion
has title: executeBatch Exception Handling
has body: executeBatch() will throw two exceptions SQLException and BatchUpdateException. Need help on how tohandle this exception. We are executing a 900 batch limit and 150 commit limit for a distributed environment. Handled only the only BatchUpdateException. Below is the code snippet. Can some one guide whether we need to catch SQLException. If the SQLException is not caught what is the result. Throws: SQLException - if a database access error occurs, this method is called on a closed Statement or the driver does not support batch statements. --- What does this statement means. } catch (BatchUpdateException be) { status = "failure"; errorDesc = "BatchUpdateException"; errorCode = "-1"; checkpoint = "12"; log.debug(DealerId + "-&gt;BatchException be:" + be + ", checkpoint: " + checkpoint + ",con: " + con + ",db2con: " + db2Con); int[] updateStatus = be.getUpdateCounts(); if (updateStatus != null) { ArrayList&lt;String&gt; failedList = new ArrayList&lt;String&gt;(); try { verifyUpdateCount(updateStatus, failedList, batchQueryList, queryList); } catch (Exception e) { if (failedList.size() &gt; 0) { log.debug(DealerId + "-&gt;updateStatus Exception queryList size:" + queryList.size()); queryList.clear(); queryList.addAll(failedList); } log.debug(DealerId + "-&gt;updateStatus Exception e:" + e + ", checkpoint: " + checkpoint + "con: " + con + "db2con: " + db2Con); } } break END; } finally { try { log.debug("norecords:" + noRecords); if (!noRecords) { closeStatements(ps, rs, rsShdw, db2Ps, stShdw); } } catch (Exception e) { printCheckpoint(queryList, con, db2Con, "closeStatements Exception e: ", e, checkpoint); } }
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21793437
upvote count: 0
score: -1
tagged with: sql
answer count: 1
tagged with: jdbc
favorite count: 0

http://stackoverflow.com/comment/33054578
has text: @Mani I apologize for mistakenly typing in the wrong save code above. I am doing the save on "MyEntity result = this.myRepo.save(myEntity);" I just incorrectly typed in dtoToUpdate. However, it wasn't working, so when you say in a different transaction what do you mean? I thought I would from the session get the entity from the session using the dto's id passed in, convert the dto to the entity, and then save that entity and that would cause an error if the versions are different. I am clearly missing something and from all the articles I have read this is how it is supposed to be done.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21832573
score: 0

http://stackoverflow.com/q/21688861
has comment: http://stackoverflow.com/comment/32791713
has comment: http://stackoverflow.com/comment/32789379
tagged with: jtable
accepted answer: http://stackoverflow.com/a/21696408
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32926978
answer count: 1
has comment: http://stackoverflow.com/comment/32789352
linked to: http://stackoverflow.com/q/18615089
has title: Adding Rows/Cels to a JTable
type: Question
linked to: http://stackoverflow.com/q/19188307
has comment: http://stackoverflow.com/comment/32791225
tagged with: tablemodel
score: 0
has answer: http://stackoverflow.com/a/21696408
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/33432887
has body: so basically I have a JTable and a DefaultTableModel d to which I've added 5 columns using the d.addColumn() method. The thing is, I don't quite understand how I need to add rows to a JTable, I've tried everything from using setValueAt as well as this: d.addRow(new Object[] { &lt;myArrayListWithCells&gt;.get(i) }); ^ what this does is basically adding all the cells in my array underneath the first column. So how do I make it so that it actually puts the cells in their correct place under the correct column? I tried using a nested for loop inside for the columns but it didn't work. I get a long list with exception errors out of this which looks like this: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0 &gt;= 0 at java.util.Vector.elementAt(Vector.java:470) at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:665) at ListItemListener.mouseClicked(ListItemListener.java:69) at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270) at java.awt.Component.processMouseEvent(Component.java:6508) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4501) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.E…
tagged with: indexoutofboundsexception

http://stackoverflow.com/comment/32973722
has text: @FraK The JLS says "E1 op= E2 is equivalent to E1 = (T) ((E1) op (E2))" [`T` is the type of `E1` but it's not needed here]. Note that it puts parentheses around everything. So `A += B` is equivalent to `A = (A) + (B)` rather than `A = A + B`.
type: AnswerComment
comment on: http://stackoverflow.com/a/21792124
score: 0
type: Comment

http://stackoverflow.com/comment/32837904
comment on: http://stackoverflow.com/q/21702939
score: 0
type: QuestionComment
type: Comment
has text: @Leeor: But in this benchmark this doesn't matter as everything fits in L1 (and the benchmarks starts with warm cache). AFAIK, when accessing L1, the pattern doesn't matter as each L1 access takes the same time. The pattern is very important when accessing other levels because of the [prefetchers](http://software.intel.com/en-us/blogs/2009/08/24/what-you-need-to-know-about-prefetching).

http://stackoverflow.com/comment/32912602
has text: Thank you. I will try reading first about the getter and the setter method. Then I'll try to do this. Our teacher gives us this kind of activity without even teaching us stuffs like getter and setter. @@
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21758407

http://stackoverflow.com/comment/32990449
comment on: http://stackoverflow.com/q/21801005
score: 0
type: Comment
type: QuestionComment
has text: @JBNizet : Hi, Please just correct me if my understanding is wrong, As per your discussion for every object would be store at specific memory location(address) so every reference having it's own address so by that time '==' condition will be false. Am I right ?

http://stackoverflow.com/q/21697368
score: -2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21697681
tagged with: java
type: Question
tagged with: split
has body: How can I split a string in two parts, without a delimiter, but where the first part is a group that fulfills a certain predicate, and the second part is the rest (without a loop)? I want to get the hang of handling string manipulation in Java and write a simple program that transforms a word to a simplified piglatin version of it. So the ruleset for this would be if a word starts with a consonant group, take this group put it on the end of the word and add a "ay", e.g. dog -&gt; ogday if not, add "way" to the end of this word, e.g. egg -&gt; eggway But where there are various examples of "split a string on a delimiter" to be found on the internet - I found none that "conserved" the delimiter. In my favorite language haskell I would use takeWhile or a small parser written with the Parsec-library (Parser combinators). But as I am new to java I looked at the documentation of String, Scanner, Pattern (though this is still a bit a mystery to me) but I didn't find a proper solution. I know I can use a simple for loop to do this, but I rather have a library that handles string manipulation/parsing. Which library would that be? Or do I have to wait for Java8 and all the nice fold/lambda stuff. EDIT - more examples Oxford -&gt; Oxfordway as it starts with a vowel cyberpank -&gt; erpankcybay as it starts with a prank -&gt; ankpray I don't distinguish silent consonants
has comment: http://stackoverflow.com/comment/32804541
upvote count: 0
has answer: http://stackoverflow.com/a/21697681
has title: java - split a string in two parts by a property
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/32804490
favorite count: 0
downvote count: 2

http://stackoverflow.com/a/21835644
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21832945
type: Answer
has body: Java provides Compiler API that can be used to compile java classes programmatically. Here is the link to Good Tutorial using Compiler API You can use JarOutputStream to create jars programmatically. Here is a nice SO Post for Creating Jars using JarOutputStream Hope this helps.
answers question: http://stackoverflow.com/q/21832945
has comment: http://stackoverflow.com/comment/33055174
score: 2
has comment: http://stackoverflow.com/comment/33050732
upvote count: 2

http://stackoverflow.com/a/21788873
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21788530
upvote count: 3
has body: The following function is probably a tiny bit more efficient than yours. Note that this will find a local maximum. public static int findLocalMaximum(int[] arr){ int i = 0; while(i + 1 &lt; arr.length &amp;&amp; arr[i+1] &gt;= arr[i]) { ++i; } return i; } Edit: The following function finds peaks as defined in the question. Note that I removed the boundary check in the while loop, as the loop will only be reached if arr[l-2] &gt; arr[l-1], an so the condition in the while loop will be false and l-2 will be returned. public static int findPeak(int[] arr){ int l = arr.length; if(arr[0] &gt;= arr[1]) { return 0; } if(arr[l-1] &gt;= arr[l-2]) { return l-1; } int i = 1; while(arr[i+1] &gt; arr[i]) { ++i; } return i; }
type: Answer

http://stackoverflow.com/comment/113783343
score: 0
type: Comment
comment on: http://stackoverflow.com/a/56906167
type: AnswerComment
has text: This worked for me too! I though I had broken it with lombook but this was the real issue.

http://stackoverflow.com/comment/32928827
comment on: http://stackoverflow.com/q/21766703
score: 0
type: Comment
type: QuestionComment
has text: My advice would be that you shouldn't do your recreate() in onResume(), it shouldn't be necessary as long as you activity is kept in memory. If it's being killed and you're losing state, you can save important state in onSaveInstance() state and read it again in onCreate(Bundle). You could also use startActivityForResult() to start your activity and your MainActivity will get a call to onActivityResult() rather than just onResume() when it's returned to.

http://stackoverflow.com/q/21780250
type: Question
has comment: http://stackoverflow.com/comment/32951840
answer count: 3
linked to: http://stackoverflow.com/q/685271
has answer: http://stackoverflow.com/a/21780530
score: 0
tagged with: out-of-memory
has title: OutOfMemoryError while attending multiple download requests with Spring
has body: I'm getting an OutOfMemoryException while trying to download several files. All of them are being downloading simultaneously and their size is over 200MB more or less. I'm using Spring 3.2.3 and java 7. This is a call from a REST request. This is the code: @RequestMapping(value = "/app/download", method = RequestMethod.GET, produces = MediaType.MULTIPART_FORM_DATA_VALUE) public void getFile(@PathVariable String param, HttpServletResponse response) { byte[] fileBytes = null; String fileLength = null; try { // Firstly looking for the file from disk Path fileFromDisk = getFileFromDisk(param); InputStream is = null; long fileLengthL = Files.size(fileFromDisk); fileLength = String.valueOf(fileLengthL); // Preparing data for response String fileName = "Some file name.zip"; response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); response.setHeader("Content-Length", fileLength); is = Files.newInputStream(fileFromDisk); IOUtils.copy(is, response.getOutputStream()); response.flushBuffer(); } catch (Exception e) { // Exception treatment } } IOUtils is the library from Apache to work with files. The code works perfectly until we have several requests at a time. I think the problem is the response is filled with all the data from the file and it is not freed from the JVM until the download is completed. I would like to know if there is a way to chunk the response or similar to avoid filling the heap space with all the data at a time. ¿Any ideas? Thank you very much in advance.
tagged with: download
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22036923
tagged with: spring
has answer: http://stackoverflow.com/a/21798404
tagged with: java
tagged with: response

http://stackoverflow.com/comment/32936022
has text: In what way is it broken? Show us some example output.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21771119
score: 0

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/21701096
tags question: http://stackoverflow.com/q/21815478
tags question: http://stackoverflow.com/q/21840448
tag name: jfreechart
tags question: http://stackoverflow.com/q/21798650
tags question: http://stackoverflow.com/q/21718283

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

http://stackoverflow.com/q/21749983
type: Question
tagged with: outlook
has answer: http://stackoverflow.com/a/21767405
downvote count: 0
tagged with: jakarta-mail
tagged with: thunderbird
answer count: 1
tagged with: email
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: What is the importance of Content ID in mail? Is there any difference in the way this value is set across the most popular mail clients say Thunderbird, Microsoft Outlook and so... What are things a developer should have in mind while providing a service that is related to reading mails sent from different clients to provide cross client compatibility, specifically with Content ID? Thanks and Regards,
score: 2
has title: Content ID for mail parts
tagged with: java

http://stackoverflow.com/comment/32982666
comment on: http://stackoverflow.com/q/21797539
has text: I cant see in your code the starting manifest tag but anyway have you tried validating yor file with any xml validation tool?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21730934
type: Question
tagged with: java
has body: I want to get GridView child item, I use code below, but it doesn't work. mAppGridAdapter = new gridadapter(mContext, appPackageInfos); mAppManaGridView.setAdapter(mAppGridAdapter); if(mAppManaGridView.getCount()&gt;0) { mAppManaGridView.setSelection(0); Log.d("adan", "adan&gt;" + mAppManaGridView.getCount()); Log.d("adan", mAppManaGridView.getFirstVisiblePosition() + ", " +mAppManaGridView.getLastVisiblePosition()); for(int visiblePosition = mAppManaGridView.getFirstVisiblePosition(); visiblePosition &lt;= mAppManaGridView.getLastVisiblePosition(); visiblePosition++) { View item = mAppManaGridView.getChildAt(visiblePosition); // make something Log.d("adan", "adan&gt;" + item.getWidth()+"," +item.getHeight() ); } } the debug log message shown, that it can get the child count, but it can't get any child item of the GridView: D/adan (11457): adan&gt;165 D/adan (11457): 0, -1 I also tried this code, but the return item is null, it crashed with nullPointerException. if(mAppManaGridView.getCount()&gt;0) { mAppManaGridView.setSelection(0); Log.d("adan", "adan&gt;" + mAppManaGridView.getCount()); View item = mAppManaGridView.getChildAt(0); // make something Log.d("adan", "adan&gt;" + item.getWidth()+"," +item.getHeight() ); } can you help me to solve this problem? It troubled me a lot.
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21731177
score: 2
tagged with: gridview
upvote count: 2
has answer: http://stackoverflow.com/a/75752517
has title: Android GridView get child item don't work

http://stackoverflow.com/q/21692013
type: Question
tagged with: opencv
has answer: http://stackoverflow.com/a/21692519
tagged with: javacv
score: 0
answer count: 2
tagged with: contour
has title: JavaCV cvInRangeS Error
type: UnansweredQuestion
tagged with: computer-vision
has body: I'm trying to filter out the contours in an image. My code has no syntax errors but I just get a lot of red text when I run my program. I have located the point of failure to be cvInRangeS. cvInRangeS(imghsv,minc,maxc,imgbin); You can see this with the println statments only making it to "thourgh3" square.jpg is in the project directory so that shouldn't be the problem if that helps. The console returnes Through 1 Through 2 Through 3 OpenCV Error: Assertion failed (src1.size == dst.size &amp;&amp; dst.type() == CV_8U) in cvInRangeS, file ..\..\..\..\opencv\modules\core\src\arithm.cpp, line 2972 Exception in thread "main" java.lang.RuntimeException: ..\..\..\..\opencv\modules\core\src\arithm.cpp:2972: error: (-215) src1.size == dst.size &amp;&amp; dst.type() == CV_8U in function cvInRangeS at com.googlecode.javacv.cpp.opencv_core.cvInRangeS(Native Method) at opencv2.OpenCV2.main(OpenCV2.java:50) Java Result: 1 The full code is as follows package opencv2; /*There are import statments here but for the sake of space I have left them out :D*/ public class OpenCV2 { public static void main(String[] args) { IplImage img1; IplImage imghsv; IplImage imgbin; CvScalar minc = cvScalar(95,150,75,0), maxc = cvScalar(145,255,255,0); CvSeq contour1 = new CvSeq(), contour2; CvMemStorage storage = CvMemStorage.create(); double areaMax = 1000, areaC = 0; System.out.println("Through 1"); img1 = cvLoadImage("square.jpg"); imghsv = cvCreateImage(cvGetSize(img1),8,3); imgbin = cvCreateImage(cvGetSize(img1),8,3); System.out.println("Through 2"); cvCvtColor(img1,imghsv,CV_BGR2HSV); System.out.println("Through 3"); cvInRangeS(imghsv,minc,maxc,imgbin); System.out.println("Through 4"); cvFindContours(imgbin,storage,contour1,Loader.sizeof(CvContour.class), CV_RETR_LIST, CV_LINK_RUNS,cvPoint(0,0)); contour2 = contour1; System.out.println("Through 5"); while(contour1 != null &amp;&amp; !contour1.isNull()){ areaC = cvContourArea(contour1,CV_WHOLE_SEQ,1); if(areaC &gt; areaMax){ areaMax = areaC; } …
has answer: http://stackoverflow.com/a/21788814
tagged with: java

http://stackoverflow.com/a/74421775
downvote count: 0
type: Answer
has body: If anyone still wonders, i accomplished this by connecting the class names with dots: Python: time_element = post.find_elements(By.CLASS_NAME, 'MUxGbd.wuQ4Ob.WZ8Tjf')[0].text
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/21713280

http://stackoverflow.com/q/21696253
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32802583
tagged with: ipc
downvote count: 5
score: 3
answer count: 1
has title: What's the relationship between java thread and system thread
favorite count: 0
tagged with: linux
upvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32805722
tagged with: android
has body: Recently, I researched the Handler class in Android System. In my opinion, the Handler mechanism is that the Thread runs a dead loop and retrieves messages from the queue repeatedly in that dead loop, it then sends the message to target handler. But when there aren't message in queue, the thread have to be waited or blocked for a specified time, this can reduce CPU time. My understanding is that in order to wait or block the Thread for a specified time, it uses the linux epoll function to wait specified time in native layer. It then uses a linux pipe to wake the thread when there are messages in queue. So my confusion is why Android systems use Linux process communication functions(IPC) to control the Java Thread to wait or wake up? And what's the relationship between Java Thread and system thread or linux thread? In other words,what I really want to know is why android use linux ipc function to control the java threads to implement so-called Handler which is used to send message between java threads. Here is the relevant code from the Android platform public static void loop() { final Looper me = myLooper(); if (me == null) { throw new RuntimeException("No Looper; Looper.prepare() wasn't called on this thread."); } final MessageQueue queue = me.mQueue; // Make sure the identity of this thread is that of the local process, // and keep track of what that identity token actually is. Binder.clearCallingIdentity(); final long ident = Binder.clearCallingIdentity(); for (;;) { Message msg = queue.next(); // might block if (msg == null) { // No message indicates that the message queue is quitting. return; } // This must be in a local variable, in case a UI event sets the logger Printer logging = me.mLogging; if (logging != null) { logging.println("&gt;&gt;&gt;&gt;&gt; Dispatching to " + msg.target + " " + msg.callback + ": " + msg.what); } msg.target.dispatchMessage(msg); if (logging != null) { logging.println("&lt;&lt;&lt;&lt;&lt; Finished to " + msg.target + " " + msg.ca…
has answer: http://stackoverflow.com/a/21701087
has comment: http://stackoverflow.com/comment/32802970
has comment: http://stackoverflow.com/comment/32802868

http://stackoverflow.com/comment/39097156
type: AnswerComment
has text: Is this in your opinion some sign/clue that we should do better memory management in our code?
type: Comment
comment on: http://stackoverflow.com/a/23633196
score: 0

build-process
tags question: http://stackoverflow.com/q/21746136
type: Tag
tags question: http://stackoverflow.com/q/21757825
tag name: build-process

http://stackoverflow.com/a/21784230
answers question: http://stackoverflow.com/q/21784027
has body: In Eclipse go to File>Export>java>Runnable jar file>Launch conf pick main class. export dest. destination of file after exporting >finish after that you can run jar for example with command line(so you can see your console) type cmd in search and run jar by going into your directory where jar is located ..Command for running jar file java -jar nameofjar.jar
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/21769986
has answer: http://stackoverflow.com/a/21770062
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question
answer count: 2
score: 0
has title: Make a custom JButton that can be customized?
has answer: http://stackoverflow.com/a/21770052
has body: I want to create my own custom buttons (or that is have a template to create mine own custom buttons). What methods do I need to override to make the same sized button that the JButton makes if I want it to look that same. Because I thought that if you extend a JButton to another button class, a custom button, that had the same size and look as the JButton. But when I put my button up and in the form it makes it really tiny and does not look like a normal button. What I want is to have at least the same looking button as the JButton has. But I also want to have the add in borders, text and color to foreground and background? What are all of the methods that I would need to override and does anyone have a simple example? Class: (JButton) -- My Button import javax.swing.JButton; public class DougCustomButton extends JButton { DougCustomButton() { super(); setBorder(BorderFactory.createLineBorder(Color.BLUE)); } @Override public void setPreferredSize(int a, int b) { //What would I put in here, do I need super() } } Class: (JPanel) import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JPanel; public class genericPanel2 extends JPanel { private static final long serialVersionUID = 1L; DougCustomButton b2 = new DougCustomButton(); public genericPanel2() { add(b2); setPreferredSize(new Dimension(50, 30)); } } Class: (JFrame) import java.awt.BorderLayout; import java.awt.Container; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class genericFrame2 { Dimension dimension = new Dimension(450,450); JFrame f = new JFrame("Not resizable"); genericPanel2 genericPanel = new genericPanel2(); public static boolean RIGHT_TO_LEFT = false; public genericFrame2() { initUI(); } public static void addComponentsToPane(Container pane) { } public final void initUI() { f.add(genericPanel); f.setSize(dimension); f.setResizable(true); f.setLocationRelativeTo(null); f.setTitle("Draw Line Test"); //addComponents…

http://stackoverflow.com/q/21771093
type: Question
answer count: 2
has title: showing error on pom.xml while building spring application on STS
tagged with: apache
has answer: http://stackoverflow.com/a/21771410
has comment: http://stackoverflow.com/comment/32935923
score: 0
possible better answer: http://stackoverflow.com/a/21772211
has comment: http://stackoverflow.com/comment/32936568
linked to: http://stackoverflow.com/q/13044628
tagged with: maven
has comment: http://stackoverflow.com/comment/32935981
has comment: http://stackoverflow.com/comment/32935958
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21772211
tagged with: java
accepted answer: http://stackoverflow.com/a/21771410
has body: This is the error I get when I was trying to create my first spring application in STS Error during build of project [SpringDemo] Errors occurred during the build. Errors running builder 'Maven Project Builder' on project 'SpringDemo'. Could not calculate build plan: Failed to parse plugin descriptor for org.apache.maven.plugins:maven-war-plugin:2.1.1 (C:\Users\user\.m2\repository\org\apache\maven\plugins\maven-war-plugin\2.1.1\maven-war-plugin-2.1.1.jar): invalid LOC header (bad signature) Failed to parse plugin descriptor for org.apache.maven.plugins:maven-war-plugin:2.1.1 (C:\Users\user\.m2\repository\org\apache\maven\plugins\maven-war-plugin\2.1.1\maven-war-plugin-2.1.1.jar): invalid LOC header (bad signature) Could not calculate build plan: Failed to parse plugin descriptor for org.apache.maven.plugins:maven-war-plugin:2.1.1 (C:\Users\user\.m2\repository\org\apache\maven\plugins\maven-war-plugin\2.1.1\maven-war-plugin-2.1.1.jar): invalid LOC header (bad signature) Failed to parse plugin descriptor for org.apache.maven.plugins:maven-war-plugin:2.1.1 (C:\Users\user\.m2\repository\org\apache\maven\plugins\maven-war-plugin\2.1.1\maven-war-plugin-2.1.1.jar): invalid LOC header (bad signature) Have error in pom.xml.. Please help i'm new in Spring...
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32936129

http://stackoverflow.com/a/21781809
upvote count: 0
score: -2
answers question: http://stackoverflow.com/q/21781655
has comment: http://stackoverflow.com/comment/33016316
has comment: http://stackoverflow.com/comment/32957803
type: Answer
has comment: http://stackoverflow.com/comment/32954282
downvote count: 2
has comment: http://stackoverflow.com/comment/32954352
has comment: http://stackoverflow.com/comment/32954250
has body: There is a red stop button in the output window. Click that. There is a bug in NB forum. And another forum reply says that Don't bother - found it after making a directory diff : Simply remove the file .netbeans/7.0/config/Preferences/org/netbeans/modules/java/source/BuildArtifactMapperImpl.properties

http://stackoverflow.com/a/37717139
downvote count: 1
score: 3
upvote count: 4
answers question: http://stackoverflow.com/q/21708339
has body: For those who came here looking to find the solution for Apache CXF-based RESTful service, the configuration that fixes it is below: <jaxrs:providers> <property name="mapper" ref="objectMapper"/> </jaxrs:providers> Where HibernateAwareObjectMapper is defined as: public class HibernateAwareObjectMapper extends ObjectMapper { public HibernateAwareObjectMapper() { registerModule(new Hibernate5Module()); } } The following dependency is required as of June 2016 (provided you're using Hibernate5): com.fasterxml.jackson.datatype jackson-datatype-hibernate5 2.7.4
type: Answer

http://stackoverflow.com/q/21766221
linked to: http://stackoverflow.com/q/478804
duplicate of: http://stackoverflow.com/q/3247654
duplicate of: http://stackoverflow.com/q/478804
score: 1
tagged with: java
upvote count: 1
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/32926922
answer count: 2
has body: Just out of curiosity, anyone knows what make people think it would be helpful to allow class definition within a method in Java? For example, I can do this: public void foo() { class Bar { } }
has answer: http://stackoverflow.com/a/21766301
has comment: http://stackoverflow.com/comment/32926960
tagged with: class
has answer: http://stackoverflow.com/a/21766251
downvote count: 0
has title: Why does java allow class definition within method body?
favorite count: 0
linked to: http://stackoverflow.com/q/3247654
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32926952

http://stackoverflow.com/a/21705864
has comment: http://stackoverflow.com/comment/32819116
type: Answer
answers question: http://stackoverflow.com/q/21705821
has body: If you read the line as a String you can use split to split it up for the pipes.
has comment: http://stackoverflow.com/comment/32819460
score: 0

http://stackoverflow.com/a/21831564
type: Answer
answers question: http://stackoverflow.com/q/21831513
has comment: http://stackoverflow.com/comment/33053022
downvote count: 0
score: 2
has body: Never change the value of i in a for-loop! Replace i-- by i-1 and i++ by i+1 and adapt your conditions on i to check the correct range of values.
has comment: http://stackoverflow.com/comment/33057931
upvote count: 2

http://stackoverflow.com/q/21811479
has body: I want to build a form for the user to fill and submit. There is a free text field. How can i check the user didn't enter garbage, like: fhskdjfhjkdshfkjhsd maybe like checking 3 random words are in English dictionary or any other language i choose to check (Hebrew for the moment)
tagged with: android
has answer: http://stackoverflow.com/a/21811517
tagged with: localization
downvote count: 3
upvote count: 1
has title: is there any library that assert text is in English?
type: AnsweredQuestion
score: -2
tagged with: java
linked to: http://stackoverflow.com/q/3227524
accepted answer: http://stackoverflow.com/a/21811517
type: Question
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/32774423
has text: Try with the full path to `GetStatus`. Also, `environment`.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21680580

http://stackoverflow.com/q/21701234
has comment: http://stackoverflow.com/comment/32853091
has comment: http://stackoverflow.com/comment/32810802
has comment: http://stackoverflow.com/comment/32857785
has body: I have Java code that converts CSV to xlsx. It works fine with a small file size. Now I have a CSV file with 2 lakh records (200,000) and on conversion I am getting an out of memory error. I tried changing the workbook to SXSSFWorkbook and increasing the heap size and Java memory size to -Xms8G -Xmx10G. Even this did not work. I tried it on a UNIX box. On searching, I got some code about using BigGridDemo. Can anyone help me in customizing that to reading a .csv file and then using its logic to write to xlsx, or any other solution? try { FileReader input = new FileReader(strFileToConvert); BufferedReader bufIn = new BufferedReader(input); if(strExcel_Typ.equals("-xls")) { wbAll = new HSSFWorkbook(); } else { wbAll = new SXSSFWorkbook(100); wbAll.setCompressTempFiles(true); } sheetAll = wbAll.createSheet(); rowAll = null; cellAll = null; shoRowNumAll = 0; // do buffered reading from a file while ((line = bufIn.readLine()) != null) { intCntr++; //if there is any data in the line if (line.length() &gt; 0) { System.out.println(shoRowNumAll); //create a new row on the spreadsheet rowAll = sheetAll.createRow((int)shoRowNumAll); shoRowNumAll++; if (line.indexOf("\"", 0) &gt; 0) { if (intCntr == 1) { //only issue the message the first time quotes are found System.out.println("Double quotes found. Stripping double quotes from file"); } line = line.replaceAll("\"", ""); } //if its the first row and no delimiters found, there is a problem if (line.indexOf(strDelim, 0) == -1 &amp;&amp; intCntr == 1) { System.exit(1); } processLine(line); ((SXSSFSheet) sheetAll).flushRows(100); } } bufIn.close(); /write the excel file try { String file = strOutPutFile; ExcelOutAll = new FileOutputStream(file); wbAll.write(ExcelOutAll); } catch (IOException e) { System.err.println(e.toString()); } ExcelOutAll.close(); Processline Method: processLine(String line) { //find the first next delimiter starting in position 0 intNxtComma = line.indexOf(strDelim, 0); while (intCurPosInLine &lt; line.trim(…
tagged with: java
has title: How to convert a huge .csv file to excel using POI
downvote count: 0
has comment: http://stackoverflow.com/comment/32857700
has comment: http://stackoverflow.com/comment/32857305
favorite count: 0
has comment: http://stackoverflow.com/comment/32857689
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/32811108
has comment: http://stackoverflow.com/comment/32825629
score: 2
tagged with: apache-poi
answer count: 0
has comment: http://stackoverflow.com/comment/33368259
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32857753
tagged with: excel
type: Question

http://stackoverflow.com/q/21686783
type: UnansweredQuestion
tagged with: dependency-management
score: 3
downvote count: 0
tagged with: java
tagged with: gradle
has answer: http://stackoverflow.com/a/21693412
type: Question
tagged with: intellij-idea
has title: Gradle idea plugin excluded transitive dependency from other sub-project not excluded
answer count: 1
has body: I have a gradle project with the following dependency structure: root +--- module1 | \--- 'some:dependency:1.0' (Maven dependency) | \--- 'some:transitive:2.1' (transitive dep) \--- module2 +--- module1 +--- exclude 'some:transitive:2.1' \--- 'some:other:1.0' \--- 'other:transitive:1.1' Basically module2 excludes the dependency some:transitive:2.1 (which is transitive for module1). This is because it conflicts at runtime with other:transitive:1.1 (I can provide the exact libraries I'm talking about but it's irrelevant to my question) and the group id and artifact id are different so it must be manually excluded: configurations.all { exclude group: 'some', module: 'transitive', version: '2.1' } The dependency is correctly excluded (I can tell by executing the dependencyInsight task). And if I create a test in module2 that uses code from some:other:1.0 that will trigger the runtime conflict, it gets run successfully using Gradle because the jar is excluded: gradle :module2:test -Dtest.single=SomeTest Now I am using IntelliJ 12 (so poor Gradle integration) and I generate the .ipr and .iml files using the Gradle idea plugin. Everything works pretty well. However, if I run SomeTest from the IDE, I will get the runtime conflict triggered by the clash mentioned above. Looking at the IDE test classpath I see that it in fact contains (among others) the excluded jar: -classpath ...:/path/to/jar/some/transitive/2.1/some-transitive-2.1.jar:... So my question is: how do I prevent IntelliJ from adding this transitive dependency when it wasn't supposed to? Just for completeness, here's the conflict I'm talking about (although it's irrelevant to this discussion): java.lang.IncompatibleClassChangeError: Implementing class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URL…
favorite count: 0
upvote count: 3

http://stackoverflow.com/q/21753604
tagged with: apache
answer count: 1
has title: Sending XML http requests in java
favorite count: 0
has body: Does anyone know what I can use instead of StringRequestEntity() as it has been deprecated? PostMethod post = new PostMethod("my endpoint url bla bla bla"); post.setRequestHeader("Content-Type", "text/xml;charset=UTF-8"); String xmlRequest = new String(sw_reg.toString()); log.info("Setting request body to [" + xmlRequest + "]"); //Send the request post.setRequestEntity(new StringRequestEntity(xmlRequest)); httpclient.executeMethod(post);
tagged with: xmlhttprequest
accepted answer: http://stackoverflow.com/a/21753660
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32905467
tagged with: http
downvote count: 1
type: Question
score: -1
has answer: http://stackoverflow.com/a/21753660
upvote count: 0

http://stackoverflow.com/a/21841438
has body: You have a JSON object. It contains exactly one field: getuserhashrate {"getuserhashrate": ... } That field contains another JSON object which has its own fields ("data", "runtime", etc). {"data":1425,"runtime":8.2659721374512, .. } From looking at your stack trace, you're using the basic json.org library (or the Android SDK). You'd parse the JSON and get back the top-level object via: JSONObject root = new JSONObject(myJsonString); Then you'd get the object contained in the getuserhashrate field: JSONObject data = root.getJSONObject("getuserhashrate"); Now you are able to access the fields of that object.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21840802
downvote count: 0
score: 1

http://stackoverflow.com/q/21694021
has comment: http://stackoverflow.com/comment/32798374
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/21694070
favorite count: 0
tagged with: class
has comment: http://stackoverflow.com/comment/32798389
type: Question
has title: Creating a new object from a class error Java
linked to: http://stackoverflow.com/q/2559527
score: -1
tagged with: command-line
duplicate of: http://stackoverflow.com/q/2559527
accepted answer: http://stackoverflow.com/a/21694070
possible better answer: http://stackoverflow.com/a/21694136
answer count: 2
has answer: http://stackoverflow.com/a/21694136
linked to: http://stackoverflow.com/q/15962339
has comment: http://stackoverflow.com/comment/32798406
downvote count: 1
tagged with: tostring
tagged with: object
has body: I'm trying to display my person objects (name, age) using JOptionPane. (Name and age being a string and integer from the commandline argument). However, I'm getting the following error: BasicClass.java:9: error: non-static variable this cannot be referenced from a static context Person person1 = new Person(args[0], age1); ^ BasicClass.java:10: error: non-static variable this cannot be referenced from a static context Person person2 = new Person(args[2], age2); ^ Am I in the right track in initializing the first Person object to commandline input? EDIT Sorry I forgot my code sample: import javax.swing.JOptionPane; public class BasicClass{ public static void main(String[] args){ Integer age1 = Integer.parseInt(args[1]); Integer age2 = Integer.parseInt(args[3]); // Create two Person Objects Person person1 = new Person(args[0], age1); Person person2 = new Person(args[2], age2); // toString() method to display first &amp; second Person Object String firstOutput = person1.toString(); String secondOutput = person2.toString(); JOptionPane.showMessageDialog(null, firstOutput); JOptionPane.showMessageDialog(null, secondOutput); } // Object class Person{ // Data fields that will store each of the objects data private String name; private Integer age; // Constructor public Person(String n1, int a1){ name = n1; age = a1; } public String toString(){ String output = name + " is" + age + " years old."; return output; } } }
tagged with: java

http://stackoverflow.com/q/21765177
has title: Compare an SQL file to an existing database table with Java
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21765432
tagged with: java
accepted answer: http://stackoverflow.com/a/21767210
has answer: http://stackoverflow.com/a/21765432
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21767210
linked to: http://stackoverflow.com/q/660609
tagged with: jdbc
has body: I am writing a bit of Java (1.7) code to test a given database table against a given sql file. What I would like is a way to turn my sql file into a java object, then test the db field names and field types are the same as the file backed object. An example sql file looks like this: create table foo ( id int not null auto_increment, term_id varchar(128) not null, term_name varchar(255) not null, parent_id varchar(128) not null, parent_name varchar(255), top_term_flag varchar(5), primary key (id) ); create index foo_pn on foo ( parent_name ); create index foo_ttf on foo ( top_term_flag ); And the part of my Java program to do this check looks like this: // Step 1, confirm the table exists // Database and table tests DatabaseMetaData dbm = connection.getMetaData(); // check if "this.dbtable" exists. // The ToUpperCase covers Oracle ResultSet tables = dbm.getTables(null, null, this.dbtable.toUpperCase(), null); if (tables.next()) { // Table exists log.info("Table: {} exists!", this.dbtable); // Step 2, get each field and test against the file ResultSet columns = dbm.getColumns(null, null, this.dbtable, null); while ( columns.next()) { String name = columns.getString(4); // this gets the column name -&gt; Now what? &lt;- } } I've looked at Spring JDBCTestUnit and Flyway, but they don't seem to provide the functionality I need. Thank you. Update: I understand I can also use Hibernate to generate my Java classes that represent my sql file and then test the DB table against those. Does any one have a sample for how to get this done?

http://stackoverflow.com/comment/32796522
has text: Anyway .. I think you want `int[] bucket` for an array of integers and not an `ArrayList bucket[]` (which is the same as `ArrayList[] bucket`), an *array of ArrayLists*. When making this change (refer to a [Radix sort pseudo code](http://en.wikipedia.org/wiki/Radix_sort#Example_in_C)) you'll also need to eliminate the other incorrect/needless uses of ArrayList.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21692810
score: 0

http://stackoverflow.com/a/21718617
upvote count: 1
answers question: http://stackoverflow.com/q/21718362
has comment: http://stackoverflow.com/comment/32844402
has comment: http://stackoverflow.com/comment/32844822
downvote count: 0
has body: K here we go : Q1) Why should a method "throws" an exception. What is the benefit we get out of it? A method should mention that it throws an exception when it can't handle the exception that it throws (the method must specify this behavior so that callers of the method can guard themselves against that exception ). Q2) What happens internally when a method "throws" an exception? When a method throws an exception the control is transferred to the caller of the method and its whether the caller has necessary catch block to handle the exception thrown by the method. If the caller has a catch block to deal with the exception the exception will be dealt and the program continues. If the caller doesn't have necessary means to handle the exception that's been thrown at it, the exception will be handled by the default exception handler. For your 3rd question read this block taken from the complete reference book : All exception types are subclasses of the built-in class Throwable. Thus, Throwable is at the top of the exception class hierarchy. Immediately below Throwable are two subclasses that partition exceptions into two distinct branches. One branch is headed by Exception. This class is used for exceptional conditions that user programs should catch. This is also the class that you will subclass to create your own custom exception types. There is an important subclass of Exception, called RuntimeException. Exceptions of this type are automatically defined for the programs that you write and include things such as division by zero and invalid array indexing. The other branch is topped by Error, which defines exceptions that are not expected to be caught under normal circumstances by your program. Exceptions of type Error are used by the Java run-time system to indicate errors having to do with the run-time environment, itself. Stack overflow is an example of such an error. This chapter will not be dealing with exceptions of type Error, because these are typically create…
has comment: http://stackoverflow.com/comment/32844842
has comment: http://stackoverflow.com/comment/32850503
type: Answer
has comment: http://stackoverflow.com/comment/32844396
score: 1

http://stackoverflow.com/q/21751503
accepted answer: http://stackoverflow.com/a/22096315
favorite count: 0
type: AnsweredQuestion
tagged with: https
type: Question
has body: One of my result mapping type is a "redirectAction" in struts.xml which when executed constructs a NON secure link... Why is that? I wanted to constructs secure link using "redirectAction" what should I do? auth_stat
tagged with: java
has title: Struts2 redirectAction is not https?
tagged with: ssl
tagged with: struts
tagged with: struts2
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22096315

junit-runner
tag name: junit-runner
tags question: http://stackoverflow.com/q/21682430
type: Tag
tags question: http://stackoverflow.com/q/21728702

http://stackoverflow.com/a/21683090
answers question: http://stackoverflow.com/q/21682761
type: Answer
has body: String line; String textToDisplay = ""; while((line = br.readLine()) != null) textToDisplay+=line; textArea.setText(textToDisplay); I used setText(String) instead of append(String) because it'll replace what is already is in the JTextArea... From your question I felt that's what you wanted to do.
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/21821398
has comment: http://stackoverflow.com/comment/33025634
has comment: http://stackoverflow.com/comment/33030313
has comment: http://stackoverflow.com/comment/33032189
accepted answer of: http://stackoverflow.com/q/21821140
has comment: http://stackoverflow.com/comment/33025722
has comment: http://stackoverflow.com/comment/33030379
answers question: http://stackoverflow.com/q/21821140
has body: I am assuming you have create some JPanel or JFrame where you add this slider so, final JSlider jSlider1 = new JSlider(); jSlider1.setValue(0); jSlider1.setMaximum(100); jSlider1.setBounds(0, 50, 300, 50); final Timer increaseValue = new Timer(50, new ActionListener() {// 50 ms interval in each increase. public void actionPerformed(ActionEvent e) { if (jSlider1.getMaximum() != jSlider1.getValue()) { jSlider1.setValue(jSlider1.getValue() + 1); } else { ((Timer) e.getSource()).stop(); } } }); panel.add(jSlider1); JButton moveSlider = new JButton("Start"); moveSlider.setBounds(10, 106, 55, 30); moveSlider.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { increaseValue.start(); } }); panel.add(moveSlider);
has comment: http://stackoverflow.com/comment/33032747
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33031855
has comment: http://stackoverflow.com/comment/33032409
has comment: http://stackoverflow.com/comment/33031755
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33031932

http://stackoverflow.com/q/21825820
type: UnansweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/33032930
tagged with: java
tagged with: file
has title: Regarding stitching of files
type: Question
score: -1
has comment: http://stackoverflow.com/comment/33033275
has comment: http://stackoverflow.com/comment/33035313
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21826774
favorite count: 0
has body: I have huge files which have been returned as an answer to a query. I want the aggregated list to be shown to the user. Earlier when the files were small I would read them individually and aggregate the result in a third file but now even the reading means a delay of a few seconds which the users cannot tolerate. Is there any way in which the file can be stitched and the aggregated result be presented to the user ? Earlier I tried a command like "cat file1 fiile2 >> file3" which seemlessly integrates the content of file1 and file2 into file3 but this command does not work when I do Process p=Runtime.getRuntime().exec("cat file1 fiile2 >> file3"); BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));

http://stackoverflow.com/comment/33071855
has text: @BrianRoach So the OP should give some more informations, where he is using this ArrayList and how. But the error message seems like to occure in the main game thread (stage.act() is called in the game.render() method of the gameloop, and calls act() for all Actors and in the Actor.act() he calls this hitOccupants() method) but it think more infos are needed...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21841796
type: AnswerComment

http://stackoverflow.com/comment/33049972
has text: Not only serializable. I want to convert the jaxb object to clob. Is any way to do?
comment on: http://stackoverflow.com/q/21831031
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32954680
has text: Unless you want to use new features introduced in Java 7, I don't see any reason to worry and the code will run just fine.
comment on: http://stackoverflow.com/q/21781965
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32990538
has text: Thanks for the suggestion but adding ManagedBean to the ExceptionMapper did not help.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21799567
type: Comment

http://stackoverflow.com/a/21805368
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21805348
has body: The correct term you are searching for is "anonymous class" - you create a class "on the fly" without naming it and persisting it in a file. In case of abstract classes/interfaces, you have to provide an implementation of all abstract methods as well.
upvote count: 1

http://stackoverflow.com/comment/32941574
comment on: http://stackoverflow.com/a/21774467
score: 0
type: Comment
has text: Hello Kayaman, yeah you are right. I forgotten to mention that how can we re-invent the wheel? I know its not required, but just for the learning purpose.
type: AnswerComment

http://stackoverflow.com/q/21790656
accepted answer: http://stackoverflow.com/a/21821213
linked to: http://stackoverflow.com/q/11708967
tagged with: java
tagged with: hibernate
tagged with: annotations
score: 6
type: Question
has comment: http://stackoverflow.com/comment/32970949
has comment: http://stackoverflow.com/comment/33023705
has comment: http://stackoverflow.com/comment/33024258
has comment: http://stackoverflow.com/comment/32989404
has comment: http://stackoverflow.com/comment/33024484
has body: I looked almost all answers related this problem on the web but could not figure out the problem in my code. Here is my JSP page. <form:form method="POST" commandName="category" modelAttribute="category" action="search_category"> <form:input path="category_name" /> </form:form> When I delete <form:input path="category_name" /> It works fine. I can communicate with my controller. So the problem is related to this line. @Controller public class SearchCategory { @Autowired private CategoryService categoryService; @RequestMapping(value = "/search_category", method = RequestMethod.POST) public @ResponseBody String searchCategoryFromDatabase(@ModelAttribute("category") Category category, BindingResult result){ return "something"; } } Here is my web.xml <?xml version="1.0" encoding="UTF-8"?> appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/servlet-context.xml 1 appServlet / contextConfigLocation /WEB-INF/applicationContext.xml hibernateFilter org.springframework.orm.hibernate4.support.OpenSessionInViewFilter hibernateFilter /* org.springframework.web.context.ContextLoaderListener This is my servlet-context.xml <mvc:view-controller path="/" view-name="index"/> <mvc:resources mapping="/resources/**" location="/, classpath:/META-INF/web-resources/" /> And my applicationContext.xml <mvc:annotation-driven /> <context:annotation-config/> <mvc:view-controller path="/" view-name="index"/> <mvc:resources mapping="/resources/**" location="/, classpath:/META-INF/web-resources/" /> <context:component-scan base-package="com.XXXX"/> classpath:hibernate.cfg.xml com.XXXX hibernate.dialect=org.hibernate.dialect.MySQLDialect <tx:annotation-driven transaction-manager="transactionManager"/> I am probably doing something wrong in my XML files. I am new for this Spring - Hibernate staff so waiting for your help. Thanks.. This is the exception getting thrown Stacktrace:] with root cause java.lang.IllegalStateException: Neither BindingResult nor plain ta…
has comment: http://stackoverflow.com/comment/32988935
has answer: http://stackoverflow.com/a/65523773
has comment: http://stackoverflow.com/comment/32988926
has answer: http://stackoverflow.com/a/40397617
tagged with: spring-form
downvote count: 0
has answer: http://stackoverflow.com/a/39179267
favorite count: 0
has title: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'category' available as request attribute
has comment: http://stackoverflow.com/comment/32970871
has answer: http://stackoverflow.com/a/21821213
possible better answer: http://stackoverflow.com/a/39179267
has comment: http://stackoverflow.com/comment/33024278
tagged with: spring
has comment: http://stackoverflow.com/comment/33023722
upvote count: 6
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/58239705
type: Comment
has text: @KJEjava48 1 - It is not about receiving a request, It is about posting data to a server with POST request to this server (for example after clicking "SUBMIT" button.
type: AnswerComment
comment on: http://stackoverflow.com/a/26882099
score: 0

http://stackoverflow.com/a/21818085
type: Answer
has body: This might not be an issue, but your while loop isn't correct: while ((nRead = bufferedStreamInput.read(dataBuffer)) &gt; 0) outputStream.write(dataBuffer, 0, nRead); The BufferedInputStream.read() returns a -1 when it reaches the end of the stream. Rather, your terminating condition should be: while ((nRead = bufferedStreamInput.read(dataBuffer)) != -1) outputStream.write(dataBuffer, 0, nRead); I hope this helps.
answers question: http://stackoverflow.com/q/21817860
score: 0

http://stackoverflow.com/a/21743750
upvote count: 4
accepted answer of: http://stackoverflow.com/q/21743680
type: AcceptedAnswer
downvote count: 0
has body: There are several "stand alone" or "single user" database engines around. H2 HSQLDB As I understand it, Apache Derby and even Java DB can be configured for "single user" operation, but you would need to verify this. If you don't care about having a Java based database, you could also look at SQLLite Applets have very restrictive security constraints, generally meaning that they can't read or write files to a local disk. You can run a in memory database, but once the applet/database is closed, the data is lost
type: Answer
score: 4
answers question: http://stackoverflow.com/q/21743680

http://stackoverflow.com/comment/33190875
comment on: http://stackoverflow.com/q/21680626
type: Comment
score: 1
type: QuestionComment
has text: The only solution would be to put your test in the same tests class. That's what we do when testing CDI with Arquillian

http://stackoverflow.com/a/21717383
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21717343
answers question: http://stackoverflow.com/q/21717343
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: When you rotate the image, you rotate the corners into negative y (and also X) coordinates. Think about rotating a square 45 degrees about its center. The top and left corners will stick out of the box they were contained by. This is not a problem mathematically, but it is a problem for the Java graphics framework. Do your rotation mathematically, and find the minimum x and y, then translate the rotated shape enough so that X and Y are no longer negative before you set the coordinates in the java graphics framework. Alternatively, just don't plot any points that are less than 0 (X or Y), which will crop parts from your rotated image.

http://stackoverflow.com/comment/32909288
score: 0
type: Comment
type: QuestionComment
has text: is that not the way you figure out triangulation and once the step above is complete you use the third access point??
comment on: http://stackoverflow.com/q/21756058

http://stackoverflow.com/q/21822869
has body: When trying to run the idea plugin for my gradle project, a number of my intellij libraries are in error with Library: 'gradle: unresolved_dependency_blah_blah' has broken classes path. the library itself is marked as "unresolved dependencies" My gradle project is a multi module, I have applied the idea plugin to allprojects. Intellij version is #IU-134.1007 gradle version is 1.11 Any help would be appreciated. UPDATE: these are an example of some of the dependencies i have: apply plugin: 'groovy' dependencies { compile 'org.eclipse.jgit:org.eclipse.jgit:3.2.0.201312181205-r' compile 'org.codehaus.groovy:groovy:2.2.1' testCompile 'org.junit:junit:4.11' } all three have the errors
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33027825
has title: gradle idea plugin: libraries marked as "unresolved dependencies"
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/33028036
tagged with: intellij-idea
favorite count: 0
upvote count: 3
accepted answer: http://stackoverflow.com/a/21823106
answer count: 1
has answer: http://stackoverflow.com/a/21823106
has comment: http://stackoverflow.com/comment/33028003

http://stackoverflow.com/q/21816244
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33016815
tagged with: multithreading
tagged with: java
has comment: http://stackoverflow.com/comment/33016525
has body: I have successfully deployed a java service onto a Linux distribution based on the guide here i.e. the actual simple file IO tick-tock code, and am noticing high CPU usage for such a simple program. Perhaps due to the thread constantly checking... I have built the actual JAR file on CentOS using NetBeans and then deployed onto Arch Linux ARM distribution, and then using a) Oracle's Java SE Embedded JVM (v7) and b) java-7-openjdk JVM. The issue is that CPU usage is constantly rocking between 80 and 95% by jsvc. I wouldn't expect the CPU to go that high. In the actual jsvc call I tried adding the -server parameter for background process - but did not manage to (I get . An example for this would be helpful so that we can rule out whether it is the missing -server parameter or not. I think I may be missing something apart from the -server option. I've been told to look at ScheduledExecutorService - which can make an improvement perhaps? Your thoughts are appreciated - Thanks.
has comment: http://stackoverflow.com/comment/33017583
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21823053
downvote count: 0
has answer: http://stackoverflow.com/a/21824226
favorite count: 0
has title: Performance improvement required for JSVC Java Daemon
tagged with: jsvc
tagged with: daemon
has comment: http://stackoverflow.com/comment/33016715
score: 2
tagged with: scheduledexecutorservice

http://stackoverflow.com/comment/32800934
type: Comment
type: QuestionComment
has text: Are you create beans.xml? Inject annotation doesn't work with out it.
comment on: http://stackoverflow.com/q/21682365
score: 0

http://stackoverflow.com/comment/32789752
type: QuestionComment
comment on: http://stackoverflow.com/q/21689045
score: 1
has text: Look at `Math.sqrt` and `Math.pow`.
type: Comment

http://stackoverflow.com/comment/32978967
score: 0
type: AnswerComment
has text: Seems you deleted the question just as I was replying to you. :) Adding index + 1 to a field, then looping vs. that tends to get you those IndexOutOfBoundsExceptions.
type: Comment
comment on: http://stackoverflow.com/a/21787848

http://stackoverflow.com/q/21817581
answer count: 2
has comment: http://stackoverflow.com/comment/33018524
tagged with: adk
downvote count: 0
accepted answer: http://stackoverflow.com/a/21817632
favorite count: 0
has title: Why is MODE_WORLD_READABLE crossed out?
has answer: http://stackoverflow.com/a/21817669
tagged with: android
has comment: http://stackoverflow.com/comment/33018454
has answer: http://stackoverflow.com/a/21817632
has body: I'm developing an app for android, and I need to write data to a text file to read later in other activities. Here is my body of the code in question. //writes the string "hello android" to file FileOutputStream outFile = openFileOutput("myfile.txt", MODE_WORLD_READABLE); OutputStreamWriter osw = new OutputStreamWriter(outFile); String hello = "hello android."; osw.write(hello); osw.flush(); osw.close(); When I first wrote this code, I was given a warning, so I added the line @SuppressWarnings("deprecation") to the top of my function. However, MODE_WORLD_READABLE is still crossed out in my IDE. Why? Note: the function has try-catch statements where they should be, and a "throws IOException at the top of the function.
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21817669
linked to: http://stackoverflow.com/q/13856757
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33018448

http://stackoverflow.com/q/21728958
score: 0
has comment: http://stackoverflow.com/comment/32859805
has comment: http://stackoverflow.com/comment/32859760
has comment: http://stackoverflow.com/comment/32859839
has comment: http://stackoverflow.com/comment/43033984
has answer: http://stackoverflow.com/a/21729217
tagged with: post-conditions
type: AnsweredQuestion
has title: Java - Method Preconditions and postcondition enforcement
has comment: http://stackoverflow.com/comment/32860002
tagged with: java
type: Question
has body: My question is short. Are method preconditions and postconditions enforced by the compiler?
has answer: http://stackoverflow.com/a/21729121
answer count: 2
accepted answer: http://stackoverflow.com/a/21729217
tagged with: preconditions
possible better answer: http://stackoverflow.com/a/21729121

http://stackoverflow.com/q/21812990
type: Question
tagged with: escaping
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21842429
downvote count: 0
answer count: 1
favorite count: 0
tagged with: operating-system
has title: Java: correct way to escape string for OS-dependent call via Runtime.getRuntime().exec()
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21842429
has body: In my Java app, I need to call another runnable jar. It looks like this: String path_to_jar_file = "/path/to/app.jar"; String some_params = "-par1 -par2 -par3"; //-- perform system call Process pr = Runtime.getRuntime().exec("java -jar " + path_to_jar_file + " " + some_params); //-- echo output BufferedReader input = new BufferedReader( new InputStreamReader(pr.getInputStream()) ); String line = null; while ((line = input.readLine()) != null){ System.out.println(line); } //-- wait until process is finished and get its exit code int exitVal = pr.waitFor(); But path_to_jar_file is actually provided by user, so this path could contain spaces, or whatever. On Windows, I can just quote it, like this: Runtime.getRuntime().exec("java -jar \"" + path_to_jar_file + "\" " + some_params); and it works. But on Linux, surprizingly, it doesn't work. (no exception is thrown, nothing is echoed, just exit code is 1, which indicates error) The strange thing is that if I type this command in the terminal (with quotes), it works! But, if I call it via Runtime.getRuntime().exec() , it works only without quotes. The only solution I came up with is to use Apache Common's SystemUtils.IS_OS_WINDOWS : on windows, quote the path, and on linux escape spaces and other symbols. But probably there is some ready-made solution for that?
upvote count: 1
has comment: http://stackoverflow.com/comment/33022890
has comment: http://stackoverflow.com/comment/33028674

data-structures
tags question: http://stackoverflow.com/q/21794777
tag name: data-structures
tags question: http://stackoverflow.com/q/21750004
tags question: http://stackoverflow.com/q/21756574
tags question: http://stackoverflow.com/q/21736971
tags question: http://stackoverflow.com/q/21801872
tags question: http://stackoverflow.com/q/21816681
tags question: http://stackoverflow.com/q/21691760
tags question: http://stackoverflow.com/q/21746940
tags question: http://stackoverflow.com/q/21690032
tags question: http://stackoverflow.com/q/21794830
tags question: http://stackoverflow.com/q/21809051
type: Tag
tags question: http://stackoverflow.com/q/21727873
tags question: http://stackoverflow.com/q/21789787
tags question: http://stackoverflow.com/q/21694887

http://stackoverflow.com/comment/32833479
type: QuestionComment
has text: Nothing special that I noticed in the Java console, also good point about the manifest... I forgot to mention that I added the must have property (permissions). I did choose not to add the others which are only recommended... can that be the issue, I suppose that recommendation should not affect the behavior that drastically should it?
type: Comment
comment on: http://stackoverflow.com/q/21712656
score: 0

http://stackoverflow.com/a/21762963
has comment: http://stackoverflow.com/comment/32921056
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32921109
has body: You shouldn't be using Object.hashCode() as a key in a Map because it is not guaranteed to be unique. Is there something in your object that uniquely identifies it? If so, then use that as the key. If not, then create a synthetic key (for example, by incrementing a counter and storing the value in the object).
has comment: http://stackoverflow.com/comment/32921128
has comment: http://stackoverflow.com/comment/32920902
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21762754

http://stackoverflow.com/q/21800820
type: Question
has comment: http://stackoverflow.com/comment/32988450
tagged with: algorithm
has comment: http://stackoverflow.com/comment/32991428
score: 0
has title: Coding an exercise and can't get it to work?
answer count: 1
has comment: http://stackoverflow.com/comment/32988405
accepted answer: http://stackoverflow.com/a/21800878
has comment: http://stackoverflow.com/comment/32988455
type: AnsweredQuestion
tagged with: java
has body: This is in chapter 3 of the book we're using for my class, so they haven't introduced much. I've been at this for about 2 hours now and haven't gotten very far unfortunately. This is the problem: Write a class "Bug" that models a bug moving along a horizontal line. The bug moves either to the right or left. Initially, the bug moves to the right, but it can turn to change its direction. In each move, its position changes by one unit in the current direction. Provide a constructor: Public Bug(int initialPosition) and methods: turn, move, getPosition this is a sample of how it should work in a tester class bug bug1 = new bug(10) bug1.move // now the position is 11 bug1.turn // changes direction bug1.move // now the position is 10 this is all I have so far. public class Bug { private int initialPosition; private int currentPosition; public Bug(int initialPosition){ this.initialPosition = initialPosition + 1; } public void turn(){ } public void move(){ currentPosition = initialPosition++; } public int getPosition(){ return currentPosition; } } and my tester class public class BugTester { public static void main(String[] args) { Bug roach = new Bug(10); roach.move(); roach.move(); System.out.println(roach.getPosition()); } } output:12
has answer: http://stackoverflow.com/a/21800878

http://stackoverflow.com/a/51329034
type: Answer
has body: Here is an easier way to create a unique key: @Cacheable(value = "all-coupons", cacheManager="cacheManagerCompany" , key="#root.method + #this.toString()") @Override public List&lt;Coupon&gt; getAllCoupons() { return compDBDAO.getCoupons(); } The solution for this problem is to use key="#root.method + #this.toString().
answers question: http://stackoverflow.com/q/21832243
score: 0

http://stackoverflow.com/a/21686872
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21686600
answers question: http://stackoverflow.com/q/21686600
has body: The most common usage for backreference is checking for repetition of something that is not known beforehand. For example, you want to check whether there are any word being repeated twice in a row. You don't know which word is being repeated - the most you know is the pattern of a word. Backreference allows you to capture a word, then check whether it is followed by another instance of itself. \b(\w+)\b\W+\1\b To know how significant this is, consider the problem where you want to check for repeated character, backreference can do this trivially: (?s)(.)\1 If you were to write a theoretical regular expression for this, you would have to enumerate everything in the alphabet: (aa|bb|cc|....|AA|BB|CC...) Backreference tries to match the same text as matched by a capturing group. The engine always keeps track of the text matched by capturing group (for most engines - the last time some text is captured). Therefore, the content of the capturing group stays in the memory (for Java, in the Matcher object to be precise) until all references to it is terminated (for Java, when you call find(), matches(), ... or when Matcher object falls out of scope).
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32797932
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/32780552
has text: You cannot access APK components as literal files, unless you process the zip file structure of the containing APK file itself. Typically, you store the components of interest in one of the ways Android knows how to deal with and provides APIs for accessing - assets, resources, etc.
comment on: http://stackoverflow.com/q/21683214
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32987857
type: AnswerComment
type: Comment
has text: thanks. i got it. but i still have a line arround edittext of searchview and is not the border. I don't know whats this..do you know?
comment on: http://stackoverflow.com/a/21799171
score: 0

http://stackoverflow.com/q/21831578
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/21832205
has comment: http://stackoverflow.com/comment/33043886
answer count: 1
downvote count: 0
tagged with: jboss7.x
tagged with: jms
favorite count: 0
has title: How to write in a Remote JMS-Queue from JBoss
accepted answer: http://stackoverflow.com/a/21832205
type: AnsweredQuestion
tagged with: activemq-classic
upvote count: 3
has body: I'm using JBoss Wildfly and like to Produce messages in a remote (not embedded) JMS Queue (active-mq-5.9) from a Session Bean. My Bean: @Stateless @ResourceAdapter("activemq-ra.rar") public class FinancialLoggerBean implements FinancialLoggerRemote, ManagedBean { private static final Logger logger = Logger.getLogger(FinancialLoggerBean.class.getName()); @Resource(lookup = "jboss/ConnectionFactory") private ConnectionFactory connectionFactory; @Resource(lookup = "jboss/queue/financialLogQueue") private Destination destination; private Connection connection; @EJB private FinancialLoggerBeanManager ejbManager; ... } I found some examples on the web how to configure the Link between jboss and active-mq via a resource adapter. In my standalone.xml I've configured the adapter like this: <subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"> activemq-rar.rar XATransaction false failover:(tcp://127.0.0.1:61616) <connection-definitions> 10 100 true </connection-definitions> financialLogQueue But the Resources cannot be linked to my bean. Something seems to be missing. JBAS014775: New missing/unsatisfied dependencies: service jboss.naming.context.java.comp."financiallogger-ear-1.0-SNAPSHOT"."financiallogger-ejb-1.0-SNAPSHOT".FinancialLoggerBean.env.jboss.ConnectionFactory (missing) dependents: [service jboss.naming.context.java.comp."financiallogger-ear-1.0-SNAPSHOT"."financiallogger-ejb-1.0-SNAPSHOT".FinancialLoggerBean.env."myBeans.FinancialLoggerBean".connectionFactory] service jboss.naming.context.java.comp."financiallogger-ear-1.0-SNAPSHOT"."financiallogger-ejb-1.0-SNAPSHOT".FinancialLoggerBean.env.jboss.queue.financialLogQueue (missing) dependents: [service jboss.naming.context.java.comp."financiallogger-ear-1.0-SNAPSHOT"."financiallogger-ejb-1.0-SNAPSHOT".FinancialLoggerBean.env."myBeans.FinancialLoggerBean".destination] Any Hints? Thanks, Michel

http://stackoverflow.com/q/21745915
tagged with: hector
accepted answer: http://stackoverflow.com/a/21781562
tagged with: cassandra-cli
upvote count: 2
tagged with: scala
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am new to cassandra and migrating my application from Mysql to cassandra.As i read of cassandra it says it reduces the read and write time compared to Mysql.when i tried a simple example with single node using hector, reading operation is quite faster compared to Mysql,and if i tried to insert a single column it is very fast compared to mysql.But when i tried to insert a single row with multiple columns its taking long time compared to mysql. Is there anyway to improve Write performance or please let me know if i am wrong with my way of coding. My sql code is INSERT into energy_usage(meter_id,reading_datetime,reading_date,reading_time,asset_id,assetid) VALUES('164','2012-12-07 00:30:00','2012-12-07','00:00:00','1','1') " my cassandra code is Mutator&lt;String&gt; mutator = HFactory.createMutator(keyspaceOperator, StringSerializer.get()); mutator.addInsertion("888999", DYN_CF, HFactory.createStringColumn("assetid","1")). addInsertion("888999", DYN_CF, HFactory.createStringColumn("meterid", "164")). addInsertion("888999", DYN_CF, HFactory.createStringColumn("energyusage","10")). addInsertion("888999", DYN_CF, HFactory.createStringColumn("readdate","2012-12-07")). addInsertion("888999", DYN_CF, HFactory.createStringColumn("readdatetime","2012-12-07 00:30:00")); mutator.execute();
type: Question
has answer: http://stackoverflow.com/a/21781562
answer count: 1
has title: cassandra performance and speed with multiple insertion?
favorite count: 0
tagged with: cassandra

http://stackoverflow.com/comment/32883175
comment on: http://stackoverflow.com/q/21741405
score: 0
type: Comment
has text: Ok thanks! So I have to populate the array by going through it and creating objects like in the first example is that correct?
type: QuestionComment

http://stackoverflow.com/a/21750309
type: Answer
has comment: http://stackoverflow.com/comment/32898436
has body: Mine is an educated guess, but the reason is likely to be the fact that the default hashCode method uses the memory location. The memory location of small Integers (and your keys are autoboxed into Integer) are most likely fixed: it would be nonesense to have Integer.valueOf(1) return a different memory location on multiple calls. Finally, most likely these fixed memory locations are in the ascending order. This would explain this coincidence, but well, one would need to dig into the implementation of Integer and HashMap to prove this. Correction: in case of Integer "A hash code value for this object, equal to the primitive int value represented by this Integer object." (JavaDoc). Which, although a different number, confirms the idea.
has comment: http://stackoverflow.com/comment/32898817
has comment: http://stackoverflow.com/comment/32898726
has comment: http://stackoverflow.com/comment/32901061
has comment: http://stackoverflow.com/comment/32898391
score: 0
answers question: http://stackoverflow.com/q/21750004

http://stackoverflow.com/comment/32914799
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21746067
has text: I figured it out, thanks for all of your help and negative feedback, it helped me realize that asking questions is always a bad thing... way to go, guys.
score: 0

http://stackoverflow.com/a/21731004
has comment: http://stackoverflow.com/comment/32864773
type: Answer
answers question: http://stackoverflow.com/q/21730928
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21730928
has comment: http://stackoverflow.com/comment/32864080
has comment: http://stackoverflow.com/comment/32864570
has body: You're comparing comp against pos which is like comparing a Comparable (in this case, a String) with an Integer: int comparison = comp.compareTo(pos); You should, instead, retrieve the element in pos index in the list and use that element to do the comparison: int comparison = comp.compareTo(list.get(pos));
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21819247
score: 0
type: Answer
has body: you can do this by adding two line into your code After printing each number add System.out.print(' '); After printing each line add System.out.println(); For example your code should be like this for (int i = 0; i &lt; m; i++) { for (int j = 0; j &lt; n; j++) { System.out.print(newImage[i][j]); System.out.print(' '); } System.out.println(); }
answers question: http://stackoverflow.com/q/21819206

http://stackoverflow.com/comment/33006352
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21810372
score: 0
has text: @BennX Thanks, but I think that I haven't explained well my problem. The most important part of this is to identify all available tests at run-time and to obtain its data (name, description, etc.) without the need of create an instance of them.

http://stackoverflow.com/q/21837961
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/21838688
has title: JSP include directive, jsp:include action, relative vs. absolute paths
tagged with: jspinclude
type: Question
linked to: http://stackoverflow.com/q/7879906
has comment: http://stackoverflow.com/comment/33054427
tagged with: jsp
tagged with: servlets
has answer: http://stackoverflow.com/a/33473013
answer count: 3
has body: I am doing some basic templating in my JSP-based webapp. For example, I want to have a standard header and footer (basic HTML) that I pull into each of my JSPs. My content JSP is at /WEB-INF/jsp/home.jsp, and I have template JSPs at /WEB-INF/jsp/template/, such as /WEB-INF/jsp/template/Body-Footer.jsp. So now, within home.jsp, I want to pull in my template files. First, I try the jsp:include action: &lt;jsp:include page="template/Body-Footer.jsp"&gt;&lt;/jsp:include&gt; It generates the error javax.servlet.ServletException: File &amp;quot;/template/Body-Footer.jsp&amp;quot; not found Strange to me, considering that Eclipse says that the path is valid. Okay, so then I switch to the include directive: &lt;%@ include file="template/Body-Footer.jsp" %&gt; This works just fine, pulls in my footer HTML. But why does the jsp:include not work? After some experimentation, I find that putting in the absolute path does get it to work: &lt;jsp:include page="/WEB-INF/jsp/template/Body-Footer.jsp"&gt;&lt;/jsp:include&gt; Now it works fine, no errors. So here's my question: why? Why do I (apparently) need to use an absolute path with the jsp:include action, but not with the include directive?
downvote count: 0
has answer: http://stackoverflow.com/a/21838688
favorite count: 0
linked to: http://stackoverflow.com/q/6825907
upvote count: 2
possible better answer: http://stackoverflow.com/a/22476961
tagged with: path
linked to: http://stackoverflow.com/q/1479218
has answer: http://stackoverflow.com/a/22476961
type: AnsweredQuestion

http://stackoverflow.com/comment/32916598
score: 0
type: Comment
type: QuestionComment
has text: Still not clear. Are `FirstThing` and `SecondThing` **inner classes** of `ZeroThing`?
comment on: http://stackoverflow.com/q/21759926

http://stackoverflow.com/q/21682814
tagged with: soap
tagged with: web-services
tagged with: java
tagged with: jax-ws
has answer: http://stackoverflow.com/a/57802145
type: Question
has title: JAX-WS MTOM does not work on Tomcat but works if published by Endpoint
has body: I'm trying to send an attachment from JAX-WS/Metro server to a client. I have a standard Tomcat 7/JDK 6 environment and simple project generated from WSDL with single operation. Many guides say how to configure MTOM, I added base64Binary type to my response and @MTOM anotation to my service implementation. I did not add anything else. When I call public static void main (String args[]){ Endpoint.publish("http://localhost:8080/sampleService", new SampleService()); ; } It works fine and I see attachments coming from the server. Now I want to create a web app that does the same thing. Here is part of my web.xml com.sun.xml.ws.transport.http.servlet.WSServletContextListener SampleService com.sun.xml.ws.transport.http.servlet.WSServlet 1 SampleService /SampleService I downloaded jaxws-ri dependencies and put them inside Tomcat/lib folder. Also created the following sun-jaxws.xml in WEB-INF directory: <?xml version="1.0" encoding="UTF-8"?> <endpoint name="SampleService" implementation="com.example.SampleService" url-pattern="/SampleService" mtom-enabled="true" /> Notice mtom-enabled property. Then I deployed it and it works, but MTOM does not work, responses contain inlined Base64-encoded binary data instead of attachments. The code is exactly the same, the difference is only the way of running it and additional web.xml and sun-jaxws.xml files. Did I miss something?
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/21746827
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32892599
has comment: http://stackoverflow.com/comment/32892437
type: Question
type: AnsweredQuestion
score: 3
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/21795225
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32892436
has comment: http://stackoverflow.com/comment/32892509
has body: I want to write the value of list in JSON File. But it's giving an exception. JSONArray objJsonArray = null; FileWriter objJsonFileWriter = null; try { objJsonArray = (JSONArray) JSONSerializer.toJSON(objList); //&lt;- This line is giving net.sf.json.JSONException: There is a cycle in the hierarchy objJsonFileWriter = new FileWriter("D:\\MyJson.json"); objJsonFileWriter.write(objJsonArray.toString()); objJsonFileWriter.flush(); objJsonFileWriter.close(); } catch (JSONException jse) { jse.printStackTrace(); } Please make me know how to get rid of this exception. I am doing this work using core Java
has comment: http://stackoverflow.com/comment/32892536
has comment: http://stackoverflow.com/comment/32892755
has title: net.sf.json.JSONException: There is a cycle in the hierarchy
has answer: http://stackoverflow.com/a/21795225
has comment: http://stackoverflow.com/comment/32892714
has comment: http://stackoverflow.com/comment/32892581

http://stackoverflow.com/q/21809224
has title: How to fix errors on my Linear equation object oriented program?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33003623
has comment: http://stackoverflow.com/comment/33003836
type: UnansweredQuestion
has body: import java.util.Scanner; public class LinearDrive { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter value for a: "); double a= in.nextDouble(); System.out.print("Enter value for b: "); double b= in.nextDouble(); System.out.print("Enter value for c: "); double c= in.nextDouble(); System.out.print("Enter value for d: "); double d= in.nextDouble(); System.out.print("Enter value for e: "); double e= in.nextDouble(); System.out.print("Enter value for f: "); double f= in.nextDouble(); Linear linear = new Linear(a,b,c,d,e,f); System.out.println("X= "+ linear.getX); System.out.println("Y= "+ linear.getY); } } public class Linear { private double a; private double b; private double c; private double d; private double e; private double f; public Linear(double a, double b, double c, double d, double e, double f) { this.setA(a); this.setB(b); this.setC(c); this.setD(d); this.setE(e); this.setF(f); } public Linear(){ } public double getA() { return a; } public void setA(double a) { this.a = a; } public double getB() { return b; } public void setB(double b) { this.b = b; } public double getC() { return c; } public void setC(double c) { this.c = c; } public double getD() { return d; } public void setD(double d) { this.d = d; } public double getE() { return e; } public void setE(double e) { this.e = e; } public double getF() { return f; } public void setF(double f) { this.f = f; } public boolean isSolvable(){ boolean isSolvable= ((a*d) - (b*c)); if (isSolvable!=0){ isSolvable = true; } return isSolvable; } public double otherCase(){ double otherCase=((a*d) - (b*c)); if(otherCase==0){ otherCase="The equation has no solution"; } } public double getX(){ double x = ((this.e*this.d) - (this.b*this.f)) / ((this.a*this.d) - (this.b*this.c)); return x; } public double getY(){ double y= ((a*f) - (e*c)) / ((a*d) - (b*c)); return y; } } I am new on this about doing object oriented programs with asking user for input. I know I have tons of…
has comment: http://stackoverflow.com/comment/33003545
tagged with: java
has answer: http://stackoverflow.com/a/21809292
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/33003546
has comment: http://stackoverflow.com/comment/33003448

http://stackoverflow.com/a/21686698
answers question: http://stackoverflow.com/q/21686590
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21686590
has body: Your code starts by reading a line, where the user enters "f" or "c" followed by Enter (end of line). nextLine() consumes everything. Then the user enters a number followed by Enter, and the code reads the double using nextDouble(). This consumes the double, but doesn't consume the end of line. So, if you remove nextLine() from the if block, the call to nextLine() at the end of the while loop only reads the end of the line that hasn't been consumed yet, and the input is thus an empty string. And since the empty string is neither "f" nor "c", the loop ends.
type: Answer
score: 3
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/21755067
tagged with: geoip
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32957387
tagged with: classpath
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32939736
has comment: http://stackoverflow.com/comment/32906480
has answer: http://stackoverflow.com/a/21755328
has answer: http://stackoverflow.com/a/21755267
favorite count: 0
downvote count: 1
has title: How to add external jar
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32906595
has comment: http://stackoverflow.com/comment/32911461
has body: I have added an external jar(for jar Visit jarlink) on my java project but I do not have all features of that library. I added jar following this way click left on my project and properties-&gt;Java Build Path-&gt;Libraries tabs-&gt;Add External Jar. Is this the right way ? or I am doing it wrong? for example link Visit mkyong.com/java/java-find-location-using-ip-address I am trying to do this example .I have added that jar on my project but some imports do not work I have added geoip2-0.7.0.jar (import com.maxmind.*) this import is working but (import com.maxmind.geoip.regionName;) this import is not working errors : Exception in thread "main" java.lang.NoClassDefFoundError: ServerLocation at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: ServerLocationenter code here at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more
has comment: http://stackoverflow.com/comment/32906936
tagged with: java

http://stackoverflow.com/q/21746719
type: Question
has title: how jvm stores objects inside the jvm memory
has body: As a result of classloading by the ClassLoader, a Class object (an object of class java.lang.Class) is going to be created on the heap. This is what consists of the plan of the class as its state. Every object created from a class is going to be linked to its Class object (obtainable from the getClass() method available in the Object class - that is available in every object). Also as a result of class loading, the bytecode of the methods defined in a class is going to read into the MethodArea of the internal memory of JVM (Remember that JVM is a program which is given some memory by the OS when it is executed - this memory is compartmentalized to Stack, Heap, Method Area). The Class object contains linkages to the method bytecode of the class in the MethodArea as well. This all the process will happen when the class has been loaded I want to know How JVM will store all the objects by using Hastable and how is our equels() and hashcode() will work with that.
has comment: http://stackoverflow.com/comment/32892613
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/2265503
has answer: http://stackoverflow.com/a/21746829
has comment: http://stackoverflow.com/comment/32892427
has answer: http://stackoverflow.com/a/21747593
tagged with: jvm
has comment: http://stackoverflow.com/comment/32892369
tagged with: classloader
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32892233

http://stackoverflow.com/q/21752940
type: AnsweredQuestion
upvote count: 2
tagged with: layout-gravity
has answer: http://stackoverflow.com/a/21753289
type: Question
possible better answer: http://stackoverflow.com/a/21752987
has title: android Layout_gravity (not gravity) and Layout_marginTop(not marginTop) programmatically
tagged with: java
has answer: http://stackoverflow.com/a/21752987
linked to: http://stackoverflow.com/q/8956326
answer count: 3
score: 2
accepted answer: http://stackoverflow.com/a/21753289
downvote count: 0
has answer: http://stackoverflow.com/a/21753368
favorite count: 0
has body: I need to programmatically create a Toast that use an ImageView and a TextView, and that appears in the middle of the screen, and I have done it. THIS IS THE RENDER I WANT (The black square with the heart is the ImageView image, and the "J'aime" is the TextView) XML Code : &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/toastImage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="1dp" android:src="@drawable/like" /&gt; &lt;TextView android:id="@+id/toastText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="85dp" android:text="J'aime !" android:textColor="#FFFFFF" /&gt; &lt;/FrameLayout&gt; THIS IS THE RENDER I HAVE with JAVA code : JAVA CODE : FrameLayout toastLayout = new FrameLayout(this); LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); toastLayout.setLayoutParams(llp); ImageView toastImg = new ImageView(this); Bitmap toastBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.like); toastImg.setImageBitmap(toastBitmap); TextView toastText = new TextView(this); toastText.setText("J'aime !"); LinearLayout.LayoutParams toastTextLp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL); toastTextLp.setMargins(0, 85, 0, 0); toastText.setLayoutParams(toastTextLp); toastLayout.addView(toastImg); toastLayout.addView(toastText); Toast toast = new Toast(this); toast.setView(toastLayout); I have tried with a relativelayout or a linearlayout, but the framelayout works better for this. So I have a question : What is the JAVA equivalent of : android:layout_gravity="center_horizontal" android:layout_marginTop="85dp" ? Because this is visibly not : LinearLayout.Layout…
tagged with: android

http://stackoverflow.com/comment/32939355
score: 1
has text: You pass the reference to the neighbour node.(for example just pass the position of the neighbor and let the function colour the neighbor by the position) I would not create new nodes/Tiles objects inside of this. its not needed and the new operator reduces the performance and you asign new Memory in local which is bad inside of an recursion.
comment on: http://stackoverflow.com/a/21761869
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32912779
comment on: http://stackoverflow.com/q/21757527
has text: @Simon But isnt it printing out the stack not the reverse string? Its printing PrintStack(sentence) not reverse
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32876468
type: QuestionComment
has text: @chrylis as previously pointed out, a `HashMap` would serve the purpose nicely
comment on: http://stackoverflow.com/q/21737726
score: 0
type: Comment

http://stackoverflow.com/a/21716911
answers question: http://stackoverflow.com/q/21716499
has comment: http://stackoverflow.com/comment/32851722
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32851031
score: 0
has comment: http://stackoverflow.com/comment/32852210
type: Answer
has body: I was able to make it work by changing the layoutParams of a linearlayout and changing its gravity then setting it to the textview. LinearLayout.LayoutParams para=new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT ); para.gravity = Gravity.RIGHT; messageText.setLayoutParams(para); will change the textview's gravity to right.
has comment: http://stackoverflow.com/comment/32839728
accepted answer of: http://stackoverflow.com/q/21716499

http://stackoverflow.com/q/21760930
tagged with: gson
type: AnsweredQuestion
tagged with: class
possible better answer: http://stackoverflow.com/a/21761126
accepted answer: http://stackoverflow.com/a/21761537
type: Question
has answer: http://stackoverflow.com/a/21761126
has title: Gson dynamic class type
has body: I am trying to deserialize JSON objects in my Java application using gson . However, I cant figure how to dynamically apply the class type. I have the class-name in a String User user = gson.fromJson(userJSON, User.class); How can I put String myClass as class type?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21761537
tagged with: java
tagged with: http://stackoverflow.com/tag/json

spring-data-jpa
tags question: http://stackoverflow.com/q/21735957
tags question: http://stackoverflow.com/q/21740241
tags question: http://stackoverflow.com/q/21831721
tags question: http://stackoverflow.com/q/21780117
type: Tag
tag name: spring-data-jpa

http://stackoverflow.com/comment/32849061
type: QuestionComment
score: 1
has text: By "english" you mean ascii chars? It's not translating the text automatically, right? Are you using unicode text encoding?
comment on: http://stackoverflow.com/q/21722660
type: Comment

http://stackoverflow.com/a/21734600
has comment: http://stackoverflow.com/comment/37994916
type: Answer
accepted answer of: http://stackoverflow.com/q/21732602
has body: The problem is that you programmed the chat application for only one computer, as it doesn't create a new Thread for each client, and goes into a while loop until the client disconnects. //connect and have conversation to other client waitForConnection(); //waiting method setupStreams(); //set up output and input stream whileChatting(); //actual chat //The problem is here, this should have been in a new Thread Change your SampleServer.java to: package sampleserver; import java.io.*; import java.net.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.lang.Object.*; public class SampleServer{ private ObjectOutputStream output; //output stream-&gt;flows from my computer to the other computer private ObjectInputStream input; //input stream-&gt;receive stuff private ObjectInputStream name; //input stream-&gt;receive stuff private Socket connection; //socket variable private String user; private String ip; private PrintWriter p; private BufferedReader fromC; private serverTest server; //Saves the server test to append messages. //constructor public SampleServer(Socket c, String username, String userip, serverTest t){ //EDITED!! connection = c; server = t; ip= userip; user= username; setupStreams(); //set up output and input stream } public void run() //This method gets called when Thread starts running { whileChatting(); closeAll(); } //get stream to send and receive data private void setupStreams(){ try{ output = new ObjectOutputStream(connection.getOutputStream()); //computer who we communicate to output.flush(); //bytes of information that is send to other person (leftover) input = new ObjectInputStream(connection.getInputStream()); //receive messages showMessage("\n Streams are now setup! \n"); }catch(IOException ioException){ ioException.printStackTrace(); } } //actual chat conversation private void whileChatting(){ String message = "You are now connected!"; sendMessage(message); do{ try{ message = (String) input.readO…
answers question: http://stackoverflow.com/q/21732602
score: 0
has comment: http://stackoverflow.com/comment/37954261
type: AcceptedAnswer

http://stackoverflow.com/comment/32971498
type: AnswerComment
score: 0
type: Comment
has text: @Serenity Please don't post screenshots; they're hard to read and can't be searched. Just copy and paste your current code into a new box in your question; there should be an "edit" link at the bottom of it. (By the way: *I don't believe you* in this case doesn't mean quite that I think you're lying; it means that I don't think you followed my instructions exactly, and that's why it's not working.)
comment on: http://stackoverflow.com/a/21790875

http://stackoverflow.com/q/21809779
has comment: http://stackoverflow.com/comment/33027570
has comment: http://stackoverflow.com/comment/33040985
type: Question
has body: For performance testing &amp; monitoring, I would like to add a JavaScript in the header tag of a web pages. All pages comes from a Java application running on Tomcat 7. Is that possible? If yes, how do I do that?
has title: Adding JavaScript to the header tag in Tomcat
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/33027229
has comment: http://stackoverflow.com/comment/33011664
has comment: http://stackoverflow.com/comment/33010247
tagged with: header
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33004531
tagged with: java

http://stackoverflow.com/q/21822086
has comment: http://stackoverflow.com/comment/33026545
has comment: http://stackoverflow.com/comment/33026544
accepted answer: http://stackoverflow.com/a/21822300
tagged with: jtable
has body: In this picture the return table head values show in the checkbox . here jtable the values from database I tried it but classcastexception occured because of boolean value cast to string i don't know why that error occured this is my code static Object[][] data; String[] colName = {"Book", "Member", "Issue Date", "Return Date ", "Remark","Return" }; List&lt;Issue&gt;issues=ServiceFactory.getIssueServiceImpl().findAllIssue(); data=new Object[issues.size()][6]; for(Issue issue:issues){ data[i][0]=issue.getMemberId().getName(); data[i][1]=issue.getBookId().getName(); data[i][2]=issue.getIssueDate(); data[i][3]=issue.getReturnDate(); data[i][4]=issue.getRemark(); data[i][5]=issue.getStatus(); i++; } here exception occured DefaultTableModel dtm = new DefaultTableModel(data, colName);{ public Class getColumnClass(int c) { switch (c) { case 0: return Boolean.class; default: return String.class; } } }; retunTable = new JTable(); retunTable.setModel(dtm); retunTable.getTableHeader().setReorderingAllowed(false); return retunTable; if u know about this please share answers here... edit DefaultTableModel dtm = new DefaultTableModel(data, colName);{ public Class getColumnClass(int c) { switch (c) { case 0: return Boolean.class; default: return String.class; } } }; dtm .addRow(data); retunTable = new JTable(); retunTable.setModel(dtm); retunTable.getTableHeader().setReorderingAllowed(false); return retunTable;
possible better answer: http://stackoverflow.com/a/21822289
has answer: http://stackoverflow.com/a/21822300
has comment: http://stackoverflow.com/comment/33026714
has comment: http://stackoverflow.com/comment/33026374
tagged with: swing
tagged with: defaulttablemodel
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33026635
has answer: http://stackoverflow.com/a/21822289
type: Question
score: 0
answer count: 2
tagged with: jcheckbox
has title: how to set jcheckbox inside jtable dynamically

http://stackoverflow.com/q/21685890
accepted answer: http://stackoverflow.com/a/21685952
has comment: http://stackoverflow.com/comment/32783906
has body: Based on the salaries, I need to assign a specific tax rate on my employee objects. The salary is defined by yearlySalary, which is a double, so I couldn't use a switch statement. I instead used if/else: public int getSalaryRank() { if(yearlySalary &lt;= 60000.00) { salaryRank = 1; } else if(yearlySalary &gt; 60000.00 &amp;&amp; yearlySalary &lt;= 80000.00) { salaryRank = 2; } else if(yearlySalary &gt; 80000.00 &amp;&amp; yearlySalary &lt;= 100000.00) { salaryRank = 3; } else if(yearlySalary &gt; 100000.00 &amp;&amp; yearlySalary &lt;= 125000.00) { salaryRank = 4; } else { salaryRank = 5; } return salaryRank; } I will assign tax rates later on based on the rank. Is there a better way to write this?
favorite count: 0
has answer: http://stackoverflow.com/a/21685990
possible better answer: http://stackoverflow.com/a/21685964
has answer: http://stackoverflow.com/a/21685964
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32784401
tagged with: if-statement
upvote count: 3
tagged with: java
has title: Alternative to if else statement when using doubles
has comment: http://stackoverflow.com/comment/32783798
has answer: http://stackoverflow.com/a/21685952
has answer: http://stackoverflow.com/a/21686023
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/32784341
downvote count: 0
has comment: http://stackoverflow.com/comment/32783795
has comment: http://stackoverflow.com/comment/32784548
has comment: http://stackoverflow.com/comment/32783754
has comment: http://stackoverflow.com/comment/32783829
score: 3

http://stackoverflow.com/q/21729520
has comment: http://stackoverflow.com/comment/32873304
has title: Brute Force Recognising English
score: 0
has comment: http://stackoverflow.com/comment/32903147
answer count: 1
tagged with: cryptography
has body: I have written a Java program to Brute force an Encryption algorithm given a chuck of known plain text. I now want it to recognise English text when it sees it so I know the key but I am unsure of a simple algorithm to detect english text. I can calculate the Unicity Distance so know how many characters I need to know to be sure the text is English but just need the algorithm. Any help would be much appreciated EDIT Text is plaintext only
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/32873130
tagged with: java
has answer: http://stackoverflow.com/a/21729665
type: Question

http://stackoverflow.com/comment/32859092
score: 0
comment on: http://stackoverflow.com/q/21728158
type: Comment
type: QuestionComment
has text: @Gorb i tried to use InputMethodTextChanged but nothing happened

http://stackoverflow.com/comment/32873242
type: Comment
has text: Yup, i have done that but this also has its drawbacks since i have to redraw or refresh the UI to reflect the changes.
score: 0
comment on: http://stackoverflow.com/a/21735718
type: AnswerComment

http://stackoverflow.com/a/21702010
has body: Since the class is not known at compile time the only way to access it is by reflection. I don't know how you have written createClass but if you manage to create a class that extends another class known at compile time then you can use polymorphism to access its methods without reflection.
has comment: http://stackoverflow.com/comment/32825225
has comment: http://stackoverflow.com/comment/32813736
downvote count: 0
has comment: http://stackoverflow.com/comment/32815614
type: Answer
has comment: http://stackoverflow.com/comment/32845648
score: 2
answers question: http://stackoverflow.com/q/21701923
upvote count: 2
has comment: http://stackoverflow.com/comment/32850643

http://stackoverflow.com/q/21707840
has comment: http://stackoverflow.com/comment/32822858
has title: How to check if 2 Class instances are the same
linked to: http://stackoverflow.com/q/2132334
has comment: http://stackoverflow.com/comment/32822884
favorite count: 0
has answer: http://stackoverflow.com/a/21708054
has comment: http://stackoverflow.com/comment/32822828
tagged with: equals
answer count: 5
possible better answer: http://stackoverflow.com/a/21710809
has answer: http://stackoverflow.com/a/21710809
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32822966
tagged with: java
has comment: http://stackoverflow.com/comment/32822944
has answer: http://stackoverflow.com/a/21707944
has answer: http://stackoverflow.com/a/21707947
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32822829
score: 3
linked to: http://stackoverflow.com/q/27581
has comment: http://stackoverflow.com/comment/32822936
has comment: http://stackoverflow.com/comment/32822929
has answer: http://stackoverflow.com/a/21708026
has body: For example I have a class Fruit. I create 2 instances: Fruit apple = new Fruit("apple"); Fruit orange = new Fruit("orange"); The value of the 2 instances are not the same thus I am looking for the answer to be false. I override the .equals() method and wrote the following method to do the test: @Override public boolean equals(Object otherObject){ if(otherObject instanceof Fruit){ return true; } return false; } if(apple.equals(orange)) System.out.println("true"); else System.out.println("false"); The above method gives me the answer as true. From my understanding, this is a correct response since this simply tests if they both belongs to the same Class which is true. But I can't get around to testing the values of the instances itself. Please advice. Thanks.
upvote count: 4
has comment: http://stackoverflow.com/comment/32822747
has comment: http://stackoverflow.com/comment/32823301
has comment: http://stackoverflow.com/comment/32822850
accepted answer: http://stackoverflow.com/a/21707944

http://stackoverflow.com/comment/32952431
comment on: http://stackoverflow.com/q/21780709
has text: You are loading the same configuration twice. Both the `ContextLoaderListener` and your `DispatcherServlet` load the same configuration. Basically everything is duplicated. Spring Security uses the stuff from the `ContextLoaderLIstener` you ar using stuff from the `DispatcherServlet` and those aren't the same instances. Solution don't load the same thing twice.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21747061
has comment: http://stackoverflow.com/comment/32893165
tagged with: class
has comment: http://stackoverflow.com/comment/32893214
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32893416
has body: public class Driver { public static void main(String[] args) { //ID, Balance, Annual Interest Rate Account number1 = new Account(); Account number2 = new Account(1122,20000.00,0.045); //Default account System.out.println("The Account ID is: " + number1.getId()); System.out.println("The Account Balance is: "+ number1.getBalance()); //System.out.println("The Account Balance is: "+ number1.getMontlyInterest()); System.out.println(""); //Ask to withdraw 2500 System.out.println("The Account ID is: " + number2.getId()); number2.withdraw(2500.00); number2.deposit(3000.00); System.out.println("Account Balance is "+ number2.getBalance()); System.out.println("The montly interest is : "+ number2.getMontlyInterest()); System.out.println(""); } } public class Account { private int id=0; private double balance=0; private double annualInterestRate=0; public Account(int id, double balance, double annualInterestRate) { this.setId(id); this.setBalance(balance); this.setAnnualInterestRate(annualInterestRate); } public Account() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } public double getAnnualInterestRate() { return annualInterestRate; } public void setAnnualInterestRate(double annualInterestRate) { this.annualInterestRate = annualInterestRate; } public double getMontlyInterest() { //Given Formula double MontlyInterest = this.balance * getMontlyInterestRate(); return MontlyInterest; } public double getMontlyInterestRate(double montlyInterestRate){ //Given Formula montlyInterestRate= this.annualInterestRate/12; return montlyInterestRate; } double withdraw(double amount){ return balance -=amount; } double deposit(double amount){ return balance += amount; } } This is the error Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method getMontlyInterest(double) in the type Account is not applicable for the argu…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32893120
has answer: http://stackoverflow.com/a/21747094
score: -1
has comment: http://stackoverflow.com/comment/32893329
has title: Account class showing error
linked to: http://stackoverflow.com/q/21746201
downvote count: 1
has comment: http://stackoverflow.com/comment/32893031
has comment: http://stackoverflow.com/comment/32892838
has comment: http://stackoverflow.com/comment/32895884
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32893206

http://stackoverflow.com/comment/32924009
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21764528
has text: @rick, why do you think you have an infinite loop? Perhaps the issue is somewhere else? You can use the same strategy here to test a bit of code in a java main line application. (JUnit/TestNG is better, but this will work also).
score: 0

http://stackoverflow.com/a/21715599
has comment: http://stackoverflow.com/comment/32838766
downvote count: 0
answers question: http://stackoverflow.com/q/21715505
has body: I see a clean and a dirty solution: implement the clone() (from the Cloneable interface) method for each of the classes in the hierarchy (clean solution) use instanceof operator to find out which class is the object instance of (dirty solution)
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/32926207
score: 0
type: Comment
has text: You should avoid usage of `Hashtable` class. Instead, use `Map` backed by `HashMap`.
type: AnswerComment
comment on: http://stackoverflow.com/a/21765732

android
tags question: http://stackoverflow.com/q/21839971
tags question: http://stackoverflow.com/q/21818169
tags question: http://stackoverflow.com/q/21813432
tags question: http://stackoverflow.com/q/21691796
tags question: http://stackoverflow.com/q/21791901
tags question: http://stackoverflow.com/q/21728502
tags question: http://stackoverflow.com/q/21701068
tags question: http://stackoverflow.com/q/21797374
tags question: http://stackoverflow.com/q/21810394
tags question: http://stackoverflow.com/q/21716176
tags question: http://stackoverflow.com/q/21753005
tags question: http://stackoverflow.com/q/21800802
tags question: http://stackoverflow.com/q/21835531
tags question: http://stackoverflow.com/q/21787079
tags question: http://stackoverflow.com/q/21823419
tags question: http://stackoverflow.com/q/21817888
tags question: http://stackoverflow.com/q/21703935
tags question: http://stackoverflow.com/q/21795676
tags question: http://stackoverflow.com/q/21832827
tags question: http://stackoverflow.com/q/21764079
tags question: http://stackoverflow.com/q/21698514
tags question: http://stackoverflow.com/q/21730776
tags question: http://stackoverflow.com/q/21811310
tags question: http://stackoverflow.com/q/21742268
tags question: http://stackoverflow.com/q/21696141
tags question: http://stackoverflow.com/q/21707618
tags question: http://stackoverflow.com/q/21779264
tags question: http://stackoverflow.com/q/21719396
tags question: http://stackoverflow.com/q/21716751
tags question: http://stackoverflow.com/q/21700808
tags question: http://stackoverflow.com/q/21807811
tags question: http://stackoverflow.com/q/21706450
tags question: http://stackoverflow.com/q/21722458
tags question: http://stackoverflow.com/q/21734940
tags question: http://stackoverflow.com/q/21788792
tags question: http://stackoverflow.com/q/21734371
tags question: http://stackoverflow.com/q/21683549
tags question: http://stackoverflow.com/q/21730835
tags question: http://stackoverflow.com/q/21701307
tags question: http://stackoverflow.com/q/21761129
tags question: http://stackoverflow.com/q/21832235
tags question: http://stackoverflow.com/q/21800686
tags question: http://stackoverflow.com/q/21693480
tags question: http://stackoverflow.com/q/21713652
tags question: http://stackoverflow.com/q/21756796
tags question: http://stackoverflow.com/q/21720964
tags question: http://stackoverflow.com/q/21822401
tags question: http://stackoverflow.com/q/21805435
tags question: http://stackoverflow.com/q/21682801
tags question: http://stackoverflow.com/q/21756203
tags question: http://stackoverflow.com/q/21748885
tags question: http://stackoverflow.com/q/21770845
tags question: http://stackoverflow.com/q/21811479
tags question: http://stackoverflow.com/q/21815008
tags question: http://stackoverflow.com/q/21736610
tags question: http://stackoverflow.com/q/21714679
tags question: http://stackoverflow.com/q/21804433
tags question: http://stackoverflow.com/q/21696900
tags question: http://stackoverflow.com/q/21732499
tags question: http://stackoverflow.com/q/21723958
tags question: http://stackoverflow.com/q/21729233
tags question: http://stackoverflow.com/q/21801526
tags question: http://stackoverflow.com/q/21764700
tags question: http://stackoverflow.com/q/21686222
tags question: http://stackoverflow.com/q/21713981
tags question: http://stackoverflow.com/q/21746574
tags question: http://stackoverflow.com/q/21811789
tags question: http://stackoverflow.com/q/21839955
tags question: http://stackoverflow.com/q/21792989
tags question: http://stackoverflow.com/q/21778385
tags question: http://stackoverflow.com/q/21705938
tags question: http://stackoverflow.com/q/21739040
tags question: http://stackoverflow.com/q/21695064
tags question: http://stackoverflow.com/q/21746522
tags question: http://stackoverflow.com/q/21836555
tags question: http://stackoverflow.com/q/21834165
tags question: http://stackoverflow.com/q/21834353
tags question: http://stackoverflow.com/q/21758793
tags question: http://stackoverflow.com/q/21779520
tags question: http://stackoverflow.com/q/21801594

http://stackoverflow.com/a/21775905
has body: Got the solution: You can dump the Drools generated java files in two ways. 1) Through command line: -Ddrools.dump.dir="target/dumpDir" e.g. I use maven command to execute the rule so it would be mvn -Ddrools.dump.dir="target/dumpDir" -Dtest=DroolsRuleTest test 2) Through the API public class FileKnowledgeBaseFactory implements KnowledgeBaseFactory { private Log log = LogFactory.getLog(FileKnowledgeBaseFactory.class); public KnowledgeBase load(String drlFullFilename) { KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(); config.setOption(DumpDirOption.get(new File("target/dumpDir"))); KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config); .... .... } }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21762399
upvote count: 11
score: 11

http://stackoverflow.com/a/21748381
downvote count: 0
score: 12
accepted answer of: http://stackoverflow.com/q/21748355
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21748355
has body: You cannot invoke methods on primitive types. n is declared as int. It does not have methods. It does not make sense to think like If i still need to see hascode for int in below program You could create an Integer object and get its hashCode() Integer.valueOf(n).hashCode() Integer#hashCode() is implemented as public int hashCode() { return value; } where value is the int value it's wrapping. Does this means that if int n = 10 then its HashCode will also be 10?? The int doesn't have a hashcode. Its Integer wrapper will however have the value of the int it's wrapping.
type: Answer
upvote count: 12

http://stackoverflow.com/comment/32997523
score: 0
type: Comment
has text: So You haver the abstract class Animal with the abstract method talk() so that all animals can talk. But this abstract class dont really knows how the dog or the cat talk.
comment on: http://stackoverflow.com/a/21805766
type: AnswerComment

http://stackoverflow.com/comment/32963637
has text: No, you need to make war file. You can do war file in Netbeans simply by right clicking your project in Projects section and from the menu click Build. Once build is success it will give you in the console the .war file location. That's the file that you need to upload to your java web hosting.
comment on: http://stackoverflow.com/a/21786666
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21699522
has answer: http://stackoverflow.com/a/21699619
tagged with: browser
has answer: http://stackoverflow.com/a/21699649
possible better answer: http://stackoverflow.com/a/21699619
downvote count: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/32807828
favorite count: 0
has comment: http://stackoverflow.com/comment/32807738
has comment: http://stackoverflow.com/comment/32808189
has title: Can not run Java Applet in the browser
has comment: http://stackoverflow.com/comment/32807797
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21699649
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32807740
has body: When I trying to run Java Applet it prompts Security Block which stops running applet in Firefox. Then I tried it on Chrome, same result. How can I disable security in java?
upvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32807790

http://stackoverflow.com/q/21679486
has body: Creating threads significantly improves the performance of a program, but there is an upper threshold, beyond which if we create any more threads then the performance degrades, due to context switching. Is there any way or formula, using which if all the hard-ware details required are know then one can find out the number of thread which would give the best performance?? It can be done experimentally, but I am looking at something faster, if some way one can have a educated guess, that's all. Thanks,
has comment: http://stackoverflow.com/comment/32772452
has comment: http://stackoverflow.com/comment/32772312
has comment: http://stackoverflow.com/comment/32772623
tagged with: performance
answer count: 0
has comment: http://stackoverflow.com/comment/32772363
tagged with: java
has comment: http://stackoverflow.com/comment/32773245
has comment: http://stackoverflow.com/comment/32772434
tagged with: multiprocessing
type: Question
has comment: http://stackoverflow.com/comment/32772679
has title: How to find optimized number of threads for a multi-threaded application
has comment: http://stackoverflow.com/comment/32772507
score: 0
has comment: http://stackoverflow.com/comment/32798600
has comment: http://stackoverflow.com/comment/32772592
has comment: http://stackoverflow.com/comment/32772254
has comment: http://stackoverflow.com/comment/32772547
has comment: http://stackoverflow.com/comment/32772319
has comment: http://stackoverflow.com/comment/32772508
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13834692
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32772923

http://stackoverflow.com/q/21708013
type: UnansweredQuestion
has title: Java Database Connection Cant Connect To Derby Database Netbeans 7.4
score: 2
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32864522
upvote count: 2
type: Question
tagged with: java
tagged with: database
tagged with: derby
has answer: http://stackoverflow.com/a/22437327
downvote count: 0
answer count: 1
has body: Im trying to connect to a derby database on netbeans but i get this error every time. I have done some research and seen that poeple have resolved this issue by editing the policy file but this has not helped me. Any help would be appreciated. Tue Feb 11 11:49:08 EST 2014 : Security manager installed using the Basic server security policy. Tue Feb 11 11:49:09 EST 2014 : access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:559) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkListen(SecurityManager.java:1134) at java.net.ServerSocket.bind(ServerSocket.java:375) at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:237) at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231) at org.apache.derby.impl.drda.NetworkServerControlImpl.createServerSocket(Unknown Source) at org.apache.derby.impl.drda.NetworkServerControlImpl.access$000(Unknown Source) at org.apache.derby.impl.drda.NetworkServerControlImpl$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown Source) at org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(Unknown Source) at org.apache.derby.drda.NetworkServerControl.main(Unknown Source)
favorite count: 0

http://stackoverflow.com/comment/33008218
comment on: http://stackoverflow.com/a/21811627
type: Comment
score: 1
type: AnswerComment
has text: well if it its not single threaded the OP should have said that in a question.

http://stackoverflow.com/comment/32788030
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21684419
has text: Why not use the supplied (with JRE) utilities? Avoid writing it in code at all.

http://stackoverflow.com/a/21708513
score: 6
downvote count: 0
answers question: http://stackoverflow.com/q/21708430
has body: The advantage of polymorphism comes when you can call play() on any Musician, whether it's a Guitarist, a Drummer, or any other subclass of Musician that you may not have created yet. Musician m1 = new Guitarist(); Musician m2 = new Drummer(); m1.play(); m2.play(); This could output something like Guitarist strumming Drummer drumming if you override the play() method in both of your subclasses. This way, the code that calls play() doesn't need to know which implementation of Musician it really is, just that it's a Musician and it's guaranteed to have a play() method. It is not an advantage of polymorphism to be able to call a subclass method such as strummingStrings from a superclass reference, because the method only exists in the subclass. It's not guaranteed to exist in the superclass. If you need to call a subclass-only method such as strummingString, then you need a subclass reference. You could define strummingStrings in the superclass Musician, and polymorphism would work, but that would be a bad design. Not all musicians can strum strings on a guitar.
upvote count: 6
type: Answer

http://stackoverflow.com/q/21792239
type: Question
has comment: http://stackoverflow.com/comment/32974081
tagged with: ide
has comment: http://stackoverflow.com/comment/32973912
has answer: http://stackoverflow.com/a/21792510
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21792289
accepted answer: http://stackoverflow.com/a/21792289
has comment: http://stackoverflow.com/comment/32973684
has title: Is there any way to get package names for types in Java while compiling from command line? And for types, can i get their available method list?
has comment: http://stackoverflow.com/comment/32973816
has body: I have to write java codes in text editor and then compile and run from command line in a test. As there is no suggestions or help available in text editor, only syntax highlighting can be used, i often could not remember correct package names for types. I won't have access to documentation also. So is there any way to get the possible package names using command line? And is it possible to get available methods for a type from command line too? Edit:By packages i meant built in packages.
has comment: http://stackoverflow.com/comment/32973745
tagged with: command-line
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21792510
tagged with: java

http://stackoverflow.com/comment/33048746
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21826695
has text: I doubt that `value[i] = Integer.valueOf(String.valueOf(value[i]), 16);` works in general. The problem is that you already have a wrong value when you read the XML, sometimes even a `NumberFormatException`. You cannot repair that after the fact.
type: Comment

http://stackoverflow.com/comment/32875024
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21737163
has text: Why you want to do this with regex?

http://stackoverflow.com/comment/53364246
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21840912
has text: I faced the same problem once. I was using `BatchStatement` to write data in Cassnadra. My batch size was 10000. After reducing this batch size, I didn't face the exception. So, maybe you are trying to load to much data into Cassandra in a single request.

http://stackoverflow.com/comment/33076697
comment on: http://stackoverflow.com/q/21841570
has text: I have added now classes and the code of DokumentDao.addDokument(Autor autor, Dokument dokument)
score: 0
type: Comment
type: QuestionComment

spring
tags question: http://stackoverflow.com/q/21828846
tags question: http://stackoverflow.com/q/21837206
tags question: http://stackoverflow.com/q/21786110
tags question: http://stackoverflow.com/q/21804848
tags question: http://stackoverflow.com/q/21707723
tags question: http://stackoverflow.com/q/21705432
tags question: http://stackoverflow.com/q/21831766
tags question: http://stackoverflow.com/q/21702005
tags question: http://stackoverflow.com/q/21754326
tags question: http://stackoverflow.com/q/21728168
tags question: http://stackoverflow.com/q/21796190
tags question: http://stackoverflow.com/q/21700234
tags question: http://stackoverflow.com/q/21826445
tags question: http://stackoverflow.com/q/21779462
tags question: http://stackoverflow.com/q/21804268
tags question: http://stackoverflow.com/q/21755663
tags question: http://stackoverflow.com/q/21743660
tags question: http://stackoverflow.com/q/21783321
tags question: http://stackoverflow.com/q/21837506
tags question: http://stackoverflow.com/q/21783262
tags question: http://stackoverflow.com/q/21708917
tags question: http://stackoverflow.com/q/21820779
tags question: http://stackoverflow.com/q/21704449
tags question: http://stackoverflow.com/q/21695061
tags question: http://stackoverflow.com/q/21827538
tags question: http://stackoverflow.com/q/21699196
tags question: http://stackoverflow.com/q/21698478
tags question: http://stackoverflow.com/q/21734225
tags question: http://stackoverflow.com/q/21793584
tags question: http://stackoverflow.com/q/21709931
tags question: http://stackoverflow.com/q/21767161
tags question: http://stackoverflow.com/q/21826937
tags question: http://stackoverflow.com/q/21735018
tags question: http://stackoverflow.com/q/21707531
tags question: http://stackoverflow.com/q/21798211
tags question: http://stackoverflow.com/q/21743657
tags question: http://stackoverflow.com/q/21699270
tags question: http://stackoverflow.com/q/21714513
tags question: http://stackoverflow.com/q/21833110
tags question: http://stackoverflow.com/q/21837207
tags question: http://stackoverflow.com/q/21832537
tags question: http://stackoverflow.com/q/21727293
tags question: http://stackoverflow.com/q/21783391
type: Tag
tags question: http://stackoverflow.com/q/21701154
tags question: http://stackoverflow.com/q/21708307
tags question: http://stackoverflow.com/q/21763321
tags question: http://stackoverflow.com/q/21834523
tags question: http://stackoverflow.com/q/21687022
tags question: http://stackoverflow.com/q/21826179
tags question: http://stackoverflow.com/q/21752386
tags question: http://stackoverflow.com/q/21746144
tags question: http://stackoverflow.com/q/21835352
tags question: http://stackoverflow.com/q/21811030
tags question: http://stackoverflow.com/q/21833672
tags question: http://stackoverflow.com/q/21713664
tags question: http://stackoverflow.com/q/21831721
tags question: http://stackoverflow.com/q/21758116
tags question: http://stackoverflow.com/q/21778901
tags question: http://stackoverflow.com/q/21832573
tags question: http://stackoverflow.com/q/21743422
tags question: http://stackoverflow.com/q/21795895
tags question: http://stackoverflow.com/q/21696146
tags question: http://stackoverflow.com/q/21726119
tags question: http://stackoverflow.com/q/21750094
tags question: http://stackoverflow.com/q/21711462
tags question: http://stackoverflow.com/q/21829108
tags question: http://stackoverflow.com/q/21826773
tags question: http://stackoverflow.com/q/21814672
tags question: http://stackoverflow.com/q/21707276
tags question: http://stackoverflow.com/q/21696987
tags question: http://stackoverflow.com/q/21780117
tags question: http://stackoverflow.com/q/21758008
tags question: http://stackoverflow.com/q/21826194
tags question: http://stackoverflow.com/q/21830361
tags question: http://stackoverflow.com/q/21813113
tags question: http://stackoverflow.com/q/21704641
tags question: http://stackoverflow.com/q/21721268
tags question: http://stackoverflow.com/q/21764696
tags question: http://stackoverflow.com/q/21723183

http://stackoverflow.com/comment/32920633
comment on: http://stackoverflow.com/q/21762826
type: QuestionComment
type: Comment
has text: You can use an ExecutorCompletionService. See for example: http://stackoverflow.com/a/11578512/829571
score: 3

http://stackoverflow.com/a/21684903
has comment: http://stackoverflow.com/comment/32782501
answers question: http://stackoverflow.com/q/21684572
has comment: http://stackoverflow.com/comment/32782122
score: 0
has body: In your code , it will look for the file ryanair.properties in etc/ folder. And this etc folder should in your current path instead of your .jar's folder Maybe you would like make the property file in your .jar file , you should make the property file as your resource file (in eclipse , right click the file , build path -> add to build path), and then use HtmlParser.class.getResource("/ryanair.properties").getPath() to get the file name. Take care of the root path of the resource. about current path , which is the current path ? In linux , you may use pwd , in windows , you may use echo %cd% .
type: Answer

javac
tags question: http://stackoverflow.com/q/21699574
tags question: http://stackoverflow.com/q/21743104
tags question: http://stackoverflow.com/q/21711020
tags question: http://stackoverflow.com/q/21690464
tag name: javac
tags question: http://stackoverflow.com/q/21738544
type: Tag
tags question: http://stackoverflow.com/q/21714342
tags question: http://stackoverflow.com/q/21782964
tags question: http://stackoverflow.com/q/21832945

http://stackoverflow.com/q/21724304
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21754369
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21725468
accepted answer: http://stackoverflow.com/a/21725468
downvote count: 0
has title: Changing the package name of my Android project
has answer: http://stackoverflow.com/a/21724499
answer count: 3
tagged with: android
has body: I have an Android project in Eclipse that I wish to change the package name. Currently the package name is my.company.simpleapp. Under my src folder, the files are grouped into several sub-packages, namely my.company.simpleappBackend, my.company.simpleappGUI and my.company.simpleappOthers. I wish to change my package name to com.company.simple.app, and the sub-packages to com.company.simple.app.backend, com.company.simple.app.gui and com.company.simple.app.others. I've tried refactoring all the sub-packages to their respective new names, and changing the main package name in AndroidManifest to com.company.simple.app. It builds correctly, however in my java files, I'm still getting "import my.company.simpleapp.R" and changing it to the new naming convention yields a "cannot be resolved" error. Help?
has comment: http://stackoverflow.com/comment/32851718
favorite count: 0
has comment: http://stackoverflow.com/comment/32851688
upvote count: 1
possible better answer: http://stackoverflow.com/a/21724499
type: AnsweredQuestion

http://stackoverflow.com/comment/32800531
has text: thanks PopoFibo.. this works fine.. thanks for help.. now i am getting both... so can i use many number of classes using comma(,) like the sample given above.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21694612
score: 2

http://stackoverflow.com/a/21821863
type: Answer
accepted answer of: http://stackoverflow.com/q/21821751
score: 2
answers question: http://stackoverflow.com/q/21821751
has comment: http://stackoverflow.com/comment/33026127
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33026234
downvote count: 0
has body: With reflection, using Class#getEnumConstants() (quick and dirty demo): package com.stackoverflow.so21821751; public class Test { interface ParentInterface { void someMethod(); } static enum ChildEnum1 implements ParentInterface { FOO, BAR, LOL; @Override public void someMethod() { // something } } static enum ChildEnum2 implements ParentInterface { FOO, BAR; @Override public void someMethod() { // something } } public static void main(final String[] args) { foo(ChildEnum1.BAR); // 3 foo(ChildEnum2.FOO); // 2 } private static void foo(final ParentInterface i) { System.out.println(i.getClass().getEnumConstants().length); } }
upvote count: 2

http://stackoverflow.com/q/21754768
score: 0
answer count: 2
tagged with: variables
accepted answer: http://stackoverflow.com/a/21755151
has body: I have class DnyMesice what creates many instances of JButton. Every instance contains variable poznamkaDne. This class DnyMesice contains actionListener to find poznamkaDne value of pushed JButton. I have class Gui what creates one instance of mentioned class DnyMesice and one instance of JTextArea. How can I refresh value of JTextArea (names poznamkovePole) if some JButton (in class DnyMesice) is pushed? public class DnyMesice extends JPanel { public String poznamkaDne="first note"; jButton tlacitkoDen; public void zobrazMesic(Calendar kalendar){ for (c=1; c&lt;30; c++){ tlacitkoDen = new JButton(Integer.toString(denvMesici)); tlacitkoDen.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent evt) { poznamkaDne="New note"; }; }); add(tlacitkoDen); } } } public class Gui extends JFrame { ... public void zobrazKalendar(){ ... panel3 = new JPanel(); panel3.setLayout(new FlowLayout()); add(panel3); JTextArea poznamkovePole; poznamkovePole = new JTextArea(); poznamkovePole.setColumns(30); poznamkovePole.setRows(5); poznamkovePole.setText(panel2.poznamkaDne); panel3.add(poznamkovePole); } Now the program shows in JTextArea only "first note" (which is defined during creating of instance JButton) but hot to refresh it after ActionListener action?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32906245
tagged with: java
possible better answer: http://stackoverflow.com/a/21755695
tagged with: swing
has answer: http://stackoverflow.com/a/21755695
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/21755151
has title: How to refresh instance of class if some action in another class was done
has comment: http://stackoverflow.com/comment/32906602

http://stackoverflow.com/q/21748078
has comment: http://stackoverflow.com/comment/32895867
has body: I have written some Posix programs that make use of mapped file buffer. One simple scenario is to map a 1GB file into memory and fill up the entire file with content. During the program execution there was little to no disk IO until msync or munmap call happens. On exactly the same system, I wrote down the equivalent program in Java running on Oracle JDK 7, and noticed massive amount of disk IO activities throughout the entire program execution. How is memory mapped file buffer implemented differently in JVM? And is there anyway to delay the massive IO activities? The operating system is a Linux 3.2 x64. Code: import java.io.RandomAccessFile; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; public class Main { public static void main(String[] args) throws Exception { long size = 1024 * 1048576; RandomAccessFile raf= new RandomAccessFile("mmap1g", "rw"); FileChannel fc = raf.getChannel(); MappedByteBuffer buf = fc.map(FileChannel.MapMode.READ_WRITE, 0, size); for(long i = 0; i &lt; size; ++i) buf.put((byte)1); } }
has comment: http://stackoverflow.com/comment/32894594
type: AnsweredQuestion
tagged with: performance
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32896001
tagged with: memory
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/21748826
answer count: 1
accepted answer: http://stackoverflow.com/a/21748826
has comment: http://stackoverflow.com/comment/32896975
favorite count: 0
tagged with: linux
has title: Why does Java memory mapped buffer cause massive unexpected disk IO?
tagged with: file-io
has comment: http://stackoverflow.com/comment/32895917
has comment: http://stackoverflow.com/comment/32897043
has comment: http://stackoverflow.com/comment/32895779
score: 8
has comment: http://stackoverflow.com/comment/32895840

http://stackoverflow.com/q/21835824
tagged with: java
possible better answer: http://stackoverflow.com/a/21835958
accepted answer: http://stackoverflow.com/a/21835895
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/21835958
tagged with: arrays
has answer: http://stackoverflow.com/a/21835895
has body: I am writing a program which lets the user put their own size of columns and rows for an array. I am using doubles so that the user can use decimals. However, I am getting this error that is telling me that I cannot convert doubles to integers. I don't understand why. I am using eclipse. I declare the array before the main method so I can use it freely the methods throughout the program. import java.util.*; public class array { private double themainarray[][]; Scanner input = new Scanner(System.in); private double columnsize; private double rowsize; public static void main(String[] args) { System.out.print("Welcome!"); } //Below on the last line of the method is where I am getting the error from eclipse. public void arrayDimensions() { System.out.println("How many columns would you like?"); columnsize = input.nextDouble(); System.out.println("How many rows would you like?"); rowsize= input.nextDouble(); themainarray= new double [rowsize][columnsize]; } }
has comment: http://stackoverflow.com/comment/33050430
score: 0
has title: Issue declaring double two dimensional array
has comment: http://stackoverflow.com/comment/33050378
has comment: http://stackoverflow.com/comment/33050471
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33050582

http://stackoverflow.com/comment/32979142
type: Comment
type: QuestionComment
has text: this is just for demo after that image is comming from webservice and put in this customdata class
comment on: http://stackoverflow.com/q/21795520
score: 0

http://stackoverflow.com/a/21704668
accepted answer of: http://stackoverflow.com/q/21699492
has comment: http://stackoverflow.com/comment/35035061
has body: The latest version of JD-GUI have an ability to realign line numbers. (Help->Preferences) When the line numbers is aligned correctly there shouldn't be a problem with debugging the source that is attached in your maven project.
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/37687109
score: 5
answers question: http://stackoverflow.com/q/21699492

http://stackoverflow.com/a/21796120
score: 0
answers question: http://stackoverflow.com/q/21699559
has body: Seems that I have to rely on my old idea, which scans the website's meta tags and its URL.
type: Answer

http://stackoverflow.com/q/21749483
tagged with: libgdx
upvote count: 5
tagged with: 3d
tagged with: decal
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21751810
favorite count: 0
score: 5
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21751810
type: Question
has title: Libgdx rendering floor for 3D game
has body: In my first 3D game i now want to render the floor, which is actually a plane (not a libgdx Plane) on y = 0. I want to add a Texture to it, so i can have different floors in each level. Now my question is: What is the best way to create and render this textured floor? I thought about using basic Block Models made with ModelBuilder and then added a Texture, but as i can only see 1 of 6 faces a 2d Texture would be enough, so i thought about a Plane. Can i add a Texture to a Plane, as it is a infinite face in 3D room? The last thing i then thought about were the Decals. Are Decals what i am looking for? And how can i use them? Or do you have an other solution . Any tutorial or other help would be great. Thanks

http://stackoverflow.com/q/21838751
tagged with: spring
type: Question
has body: Does anyone know how the process for getting a bean differs between using @Resource and getBean? Right now I have a situation where this works: @Autowired ApplicationContext applicationContext public void test() { Object x = this.applicationContext.getBean("beanName"); //this returns the object I want } But this doesn't: @Resource(name="beanName") Object x; //"beanName" can't be found I'd like to understand how these two processes differ so I can begin to understand what my error is. The stacktrace for the second example. mainBean is a component-scanned bean with nothing else in it besides the code I posted. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainBean': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'beanName' is defined at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListab…
has answer: http://stackoverflow.com/a/21840445
has comment: http://stackoverflow.com/comment/33057303
tagged with: java
has comment: http://stackoverflow.com/comment/33055797
has comment: http://stackoverflow.com/comment/33057257
answer count: 1
has title: @Resource(name="beanName") vs ApplicationContext#getBean("beanName")
has comment: http://stackoverflow.com/comment/33056926
has comment: http://stackoverflow.com/comment/33057743
has comment: http://stackoverflow.com/comment/33055878
accepted answer: http://stackoverflow.com/a/21840445
score: 0
has comment: http://stackoverflow.com/comment/33056072
has comment: http://stackoverflow.com/comment/33056973
has comment: http://stackoverflow.com/comment/33056673
linked to: http://stackoverflow.com/q/18682486
type: AnsweredQuestion

http://stackoverflow.com/comment/32830775
comment on: http://stackoverflow.com/q/21711752
type: Comment
type: QuestionComment
has text: @dvnrrs They can't run it themselves, since it isn't a complete program, and it is unclear what form the input will take.
score: 0

http://stackoverflow.com/comment/32924069
type: QuestionComment
has text: Zero was included -- it's y's initial state to which everything else is added. I'm sorta confused by why the querant couldn't compute the result manually, though.
comment on: http://stackoverflow.com/q/21764624
score: 0
type: Comment

http://stackoverflow.com/a/21755826
downvote count: 0
has comment: http://stackoverflow.com/comment/32907859
has comment: http://stackoverflow.com/comment/32907757
has body: They are not static. They are instance fields in B. Meaning you need to have an instance of B to get/set them. B is static in A but that does not make those fields of B static. You can create many instances of B without any reference to A. So B is static class in A but the same is not true for B's instance fields.
upvote count: 2
has comment: http://stackoverflow.com/comment/32907809
has comment: http://stackoverflow.com/comment/32907778
type: Answer
answers question: http://stackoverflow.com/q/21755815
has comment: http://stackoverflow.com/comment/32907813
score: 2

http://stackoverflow.com/comment/32864629
comment on: http://stackoverflow.com/a/21715745
type: Comment
score: 0
has text: While it is correct to say that any UTF encoding has invalid sequences (that are used for surrogate in UTF-16 and UTF-32, or to indicate that there are more bytes to come for UTF-8), using a counter-example in UTF-8 to dissuade doesn't really work here, since String class uses UTF-16 to represent string, and 'a' ^ 'æ' happens to produce a valid UTF-16 character.
type: AnswerComment

http://stackoverflow.com/a/21706830
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21706613
score: 1
has body: You can use listener, like that: checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked){ } else { } } });

http://stackoverflow.com/q/21785140
type: AnsweredQuestion
tagged with: hibernate-annotations
has comment: http://stackoverflow.com/comment/32962002
tagged with: java
tagged with: hibernate
type: Question
has body: If I have a table like this... +------------------------------------------------------+ | Code | +------------------------------------------------------+ | id | target_uuid | code | +----+----------------------------------------+--------+ | 1 | "01BE898A-C5A9-4F86-B0AA-4ACCDCE81B8F" | 0 | +----+----------------------------------------+--------+ | 2 | "E139F21E-8C93-492B-9E0F-CC773FAE832D" | 2 | +----+----------------------------------------+--------+ ...and the target_uuid could refer to a Post or User uuid field, how would I map this in Hibernate? Assume uuid is not the primary key for Post or User here. I know, I know. Bad data model, but I'm stuck with it. I have tried this: @Entity @Table(name = "User") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Integer id; @Column(name = "uuid") private String uuid; @OneToOne(mappedBy = "user") @JoinColumn(name = "uuid") private Code code; // getters and setters } @Entity @Table(name = "Post") public class Post { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Integer id; @Column(name = "uuid") private String uuid; @OneToOne(mappedBy = "post") @JoinColumn(name = "uuid") private Code code; // getters and setters } @Entity @Table(name = "Code") public class Code { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Integer id; @Column(name = "code") private Integer code; @Column(name = "target_uuid") private String targetUuid; @OneToOne @JoinColumn(name = "target_uuid", insertable = false, updatable = false) private User user; @OneToOne @JoinColumn(name = "target_uuid", insertable = false, updatable = false) private Post post; // getters and setters } This does not throw an exception and seems to work, but my User and Post objects keep getting NULL values for their code properties. Can anyone shed some light on this?
has comment: http://stackoverflow.com/comment/32960520
has comment: http://stackoverflow.com/comment/32960931
has answer: http://stackoverflow.com/a/21786320
score: 4
upvote count: 4
answer count: 2
has title: Hibernate @OneToOne relationship with multiple objects?
has comment: http://stackoverflow.com/comment/32960196
downvote count: 0
has comment: http://stackoverflow.com/comment/32960333
has comment: http://stackoverflow.com/comment/32960248
favorite count: 0
tagged with: one-to-one
has comment: http://stackoverflow.com/comment/32960413
possible better answer: http://stackoverflow.com/a/21786679
accepted answer: http://stackoverflow.com/a/21786320
has comment: http://stackoverflow.com/comment/32960640
has answer: http://stackoverflow.com/a/21786679

http://stackoverflow.com/q/21747405
has comment: http://stackoverflow.com/comment/32893612
has comment: http://stackoverflow.com/comment/32894237
has answer: http://stackoverflow.com/a/21775568
has comment: http://stackoverflow.com/comment/32894398
has comment: http://stackoverflow.com/comment/32893431
has answer: http://stackoverflow.com/a/21747548
type: AnsweredQuestion
has body: I'm new to coding so while trying to make the an application which accepts values in one Layout "My Profile" and replaces the edittext fields in another layout "Booking form". I.e. at My profile it will store Name, Email, Phone. So at Booking page it should fill in these values from sharedpreference. I am able to store these values to shared preference but unable to display them. The code is as follows , have been at it for over 13hrs not able to get through the NPE at the very first section where it tried to setText. My Activity File package com.buses; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; import javax.mail.AuthenticationFailedException; import javax.mail.MessagingException; import javax.mail.internet.InternetAddress; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.NavUtils; import android.text.format.Time; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; import android.widget.TimePicker; import android.widget.Toast; public class DetailActivity extends FragmentActivity { //Variables for Storing Message & Button objects /*final EditText name= (EditText)findViewById(R.id.prof_uname); final EditText phone= …
has comment: http://stackoverflow.com/comment/32914408
downvote count: 0
has comment: http://stackoverflow.com/comment/32894524
has comment: http://stackoverflow.com/comment/32893384
has comment: http://stackoverflow.com/comment/32894035
score: 1
linked to: http://stackoverflow.com/q/15335456
has comment: http://stackoverflow.com/comment/32894323
tagged with: android-activity
favorite count: 0
has answer: http://stackoverflow.com/a/21755945
possible better answer: http://stackoverflow.com/a/21747548
has comment: http://stackoverflow.com/comment/32893829
type: Question
has comment: http://stackoverflow.com/comment/32894102
tagged with: android
accepted answer: http://stackoverflow.com/a/21775568
tagged with: java
has comment: http://stackoverflow.com/comment/32906596
has comment: http://stackoverflow.com/comment/32894216
tagged with: sharedpreferences
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/32893434
has title: Sharedpreferences throwing Null Pointer while SetText #android
tagged with: android-layout

http://stackoverflow.com/comment/33030202
type: Comment
comment on: http://stackoverflow.com/q/21823479
type: QuestionComment
has text: @user2909717 if my answer is helpful then you select my answer
score: 0

http://stackoverflow.com/comment/33053963
type: Comment
type: QuestionComment
has text: @Mani - MyEntity class here is the entity/table. The MyEntityDTO is what gets passed to the front end and back to be converted back to the MyEntity object to get saved. Why do you think that MyEntity is not needed here?
comment on: http://stackoverflow.com/q/21832573
score: 0

http://stackoverflow.com/q/21779364
has comment: http://stackoverflow.com/comment/32949898
tagged with: opencsv
answer count: 2
tagged with: maven
upvote count: 1
accepted answer: http://stackoverflow.com/a/21780307
tagged with: java
has body: I created a maven war project and added javaEE API and openCSV. in eclipse I can see both jars, import classes and use them without any compilation errors. but when I run the app using tomcat and trying to save a CSV file I get this exception: java.lang.NoClassDefFoundError: au/com/bytecode/opencsv/CSVWriter JavaEE api works fine. I tryed to add compile but it didn't do any good. this is my pom: 4.0.0 com.training DevProject 0.0.1-SNAPSHOT war javax javaee-api 7.0 net.sf.opencsv opencsv 2.3 org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 This is the code that throws the exception: CSVWriter writer = new CSVWriter(new FileWriter("file.csv")); Any ideas?
has comment: http://stackoverflow.com/comment/32955437
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21779545
downvote count: 0
has answer: http://stackoverflow.com/a/21779545
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21780307
has comment: http://stackoverflow.com/comment/32949906
has title: Maven JAR - class not found exception
score: 1

http://stackoverflow.com/a/21769149
has body: IndoKnight, what a perfect wrap up you gave of how Exception semantics within the Java EE framework.. work. Here's the two only lines a "bean provider", that is you and me, need to know about exceptions in Java EE: Your bean is totally free to recover from any type of exception or error as you see fit, with respect to other constraints the bean might be under. If you recovered from an exception, then congratulations - there's no problem anymore =) A relevant constraint could for example be that "enterprise beans that use container-managed transaction demarcation must not use any transaction-management methods that interfere with the container's transaction demarcation boundaries" to quote the Java EE 7 tutorial page 48-2 (would you like to programmatically set the rollback of a container managed transaction, use EJBContext.setRollbackOnly()). You are also discouraged, as with any type of Java application, to handle Throwable or Error thrown from a really low level. RuntimeException is theoretically counted in this category, as it so famously signals a "developer error" that's like "totally totally unexpected" - yet we all know it isn't. Basically, an unexpected exception (runtime exceptions + other shit that we assume originate from someone else) is assumed to be unhandleable by your code and should be handled by the server instead. The server is required to handle the "unhandleable" exception (see the EJB 3.2 specification, page 204) by printing something about it in the log (I'll get into the details a bit later!). More specifically.. You asked (and here is what I believe or hold true): Are all application exceptions described above supposed to be thrown directly by EJB to client? Yes. And the transaction (if one is active) shall not be rolled back unless you explicitly state that it should by using the rollback attribute of the ApplicationException. Java code throwing exceptions is a very natural thing. Java EE has no intention of demolishing this programming mod…
upvote count: 7
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/21766729

http://stackoverflow.com/a/21828848
type: Answer
has body: You should not make different classes for siblings. If tomorrow someone have four siblings then you will be making four classes. This will result in Class Exposion. You can have your design like: Parent Class: public class Parent{ ... } Child Class: public final class Child extends Parent{ private List&lt;Child&gt; siblings; ... }
score: 0
answers question: http://stackoverflow.com/q/21828721
has comment: http://stackoverflow.com/comment/33037857

http://stackoverflow.com/a/21764354
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/32924132
type: Answer
has body: myArray.unshift(obj) corresponds to myList.add(0, obj). A byte array in Java is byte[]. A list of byte arrays would be a List&lt;byte[]&gt;. (That's java.util.List, not java.awt.List, just in case you get the wrong import.) EDIT: Looks like you are trying to create a byte array, not a list of byte arrays. In that case, you should use a java.nio.ByteBuffer, or possibly a java.io.ByteArrayOutputStream. The latter has to be written to sequentially -- you cannot do the equivalent of an unshift.
answers question: http://stackoverflow.com/q/21764244
score: 5

http://stackoverflow.com/comment/108090446
comment on: http://stackoverflow.com/q/21826128
score: 0
type: Comment
type: QuestionComment
has text: Which time zone did you want instead?

http://stackoverflow.com/comment/32890352
has text: nobody has to do anything maaaaan :)
comment on: http://stackoverflow.com/q/21745441
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21825263
downvote count: 0
has body: Is it possible to use the Gson library to produce XML? I am aware the gson-xml can read XML into Gson. Is there a library that lets you go the other way? My motivation is that I have a complex application that needs to serialise to both JSON and XML and I'd ideally like to use a single serialisation library.
has comment: http://stackoverflow.com/comment/45187956
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has comment: http://stackoverflow.com/comment/45188118
score: 5
has title: Can Gson produce XML?
has comment: http://stackoverflow.com/comment/45185321
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: serialization
upvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21825772

http://stackoverflow.com/q/21758612
upvote count: 1
has title: How to add a title tag (tooltip) to an HTML table column using tagx and jstl?
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has body: I have a tagx to create a table with head ... , based on the table.tagx by/of Spring Roo. To get text into the head colums is easy, but when it comes to titles, I'm stuck. This is my current way to fill the table head: <spring:eval var="colCounter" expression="0" /> <c:forTokens items="${columnLabels}" delims="," var="columnHeading"> <c:out value="${columnHeading}" /> <spring:eval var="colCounter" expression="colCounter + 1" /> </c:forTokens> [... some more unimportant code here ...] ... columnLabels is a comma separed string containing the the labels. I generated another string called columnTitles, which is built just the same way. So what I'd like to do now, is to add the titles for each column into the tag like I could probably loop through an array with the colCounter as index like this But this would mean some more effort since I'd need to create the array in a completely different way - plus, I'm not very familiar with tagx/jstl (yet). I still hope, somebody has a solution. I'd be very glad! Regards, Stacky
favorite count: 0
tagged with: tagx
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21762676
type: Question
tagged with: jstl
has answer: http://stackoverflow.com/a/21762676
tagged with: jspx

http://stackoverflow.com/q/21708572
tagged with: generics
possible better answer: http://stackoverflow.com/a/21708664
has body: I'm having trouble adding generics to a piece of code that I'm working on, I've searched around and none of the examples I've seen so far quite capture what I've trying to do so I'm reaching out for help. Currently I have this code which processes a list of UserDTO objects that have only their ID's populated and gets the full details of each User from a restful web-service: //userIds and userDetails declared previously for (UserDTO user : userIds) { UserDTO populatedUser = webResource.path(REST_USER_PATH).path(user.getId(). toString()).type(MediaType.APPLICATION_XML).get(ClientResponse.class). getEntity(UserDTO.class); userDetails.add(populatedUser); } Now this is going to be a pattern for the piece of work I'm currently undertaking, I'll need to be able to convert lists of DTO objects which have just the Id's populated, to lists of fully populated DTO objects by calling a web service. What I'd like to do is create a generic method to let me do this. All the different DTO objects that I need to do this for extend our BaseDTO so I came up with the following, unfortunately it does not compile but hopefully it will show what I'm trying to accomplish: public &lt;T extends BaseDTO&gt; getListOfPopulatedDTOs( List &lt;T extends BaseDTO&gt; unpopulatedDTOs, String restPath) { List&lt;BaseDTO&gt; populatedDTOs = new ArrayList&lt;BaseDTO&gt;(); for (BaseDTO unpopulatedDTO : unpopulatedDTOs) { BaseDTO populatedDTO = webResource.path(restPath).path( unpopulatedDTO.getId().toString()).type(MediaType.APPLICATION_XML). get(ClientResponse.class).getEntity(T.class); populatedDTOs.add(populatedDTO); } return populatedDTOs; } Any help or advice would be gratefully received. Many thanks in advance :)
has answer: http://stackoverflow.com/a/21708655
favorite count: 0
has answer: http://stackoverflow.com/a/21708726
has title: How to use generics in a java method
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32824207
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32824965
accepted answer: http://stackoverflow.com/a/21708655
type: Question
has answer: http://stackoverflow.com/a/21708664
answer count: 3
downvote count: 0

http://stackoverflow.com/q/21716188
has body: I am trying to process audio using VST plugins load via JVST. Roughly speaking, what I am doing is the following: 1 open an audio input stream that takes a wav file 2 until the file is not finished 2.1 read a block of frames and store them as byte[] 2.2 convert byte[] to float[] 2.3 process the float[] with a JVST call to the VST plugin 2.4 convert float[] to byte[] 2.5 push byte[] in the audio output stream What happens, now, is that if I comment out 2.3, the audio is converted from bytes to floats and back, and sounds perfect. If I instead perform the VST processing, borderline white noise comes out. I don't really know how to proceed. My intuition is that something might be wrong with the byte[] to float[] conversion, but I don't know what. I tried changing the endian of the bytes, didn't work. Anybody has suggestions? Here is the actual code file: public class ByteConv { public static void main(String[] args) throws Exception { AEffect effect = VST.load("G:/AnalogDelay"); // Startup the plugin // Ask the plugin to display its GUI using the SWT window handle MiniHost miniHost = new MiniHost(effect); // miniHost.setBlockOnOpen(true); // miniHost.open(); effect.open(); effect.setSampleRate(44100.0f); effect.setBlockSize(512); File file = new File("C:\\Users\\Laimon\\Desktop\\wma-01.wav"); try { AudioFormat format = AudioSystem.getAudioFileFormat(file).getFormat(); System.out.println(format.toString()); AudioInputStream inputStream = AudioSystem.getAudioInputStream(file); SourceDataLine sourceLine = AudioSystem.getSourceDataLine(format); sourceLine.open(); sourceLine.start(); int bytesPerFrame = inputStream.getFormat().getFrameSize(); if (bytesPerFrame == AudioSystem.NOT_SPECIFIED) { // some audio formats may have unspecified frame size // in that case we may read any amount of bytes bytesPerFrame = 1; } // Set an arbitrary buffer size of 512 frames. int numBytes = 512 * bytesPerFrame; byte[] audioBytes = new byte[numBytes]; int numBytesRead = 0; // Try to read numB…
has title: Float conversion for JVST input/output data
score: 0
has comment: http://stackoverflow.com/comment/32848893
has comment: http://stackoverflow.com/comment/32839284
has comment: http://stackoverflow.com/comment/32872978
has comment: http://stackoverflow.com/comment/32858062
tagged with: vst
tagged with: audio
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: floating-point
has comment: http://stackoverflow.com/comment/32872872
has comment: http://stackoverflow.com/comment/32873204
type: Question

http://stackoverflow.com/a/21754957
downvote count: 0
type: Answer
has body: I'm not 100% convinced that while put() operation is in progress for a given key and value, containsKey() for the same key returned true. You're correct - without any synchronization, there's no guarantee that a call to put() in one thread will result in another thread returning true for containsKey(). This is true even if the call to put() has completed. The Java Memory Model allows the memory reads/writes by a thread to be re-ordered. This is often known as out-of-order execution. The result is the internal state of the Map seen by any given thread may be inconsistent, and this can lead to data corruption, crashes, and infinite loops. For your simple example, it looks like you can simply replace HashMap with ConcurrentHashMap, but it's difficult to be sure that's correct without seeing the rest of your program. I suggest reading Java Concurrency in Practice by Brian Goetz to get a better understanding of the Java Memory Model. You might also be interested in this blog post, A Beautiful Race Condition, which shows why sharing a HashMap between threads without synchronization can cause unexpected behaviour. Edit: It's probably worth drawing your attention to this part of the JavaDoc for HashMap: If multiple threads access a hash map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more mappings; merely changing the value associated with a key that an instance already contains is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the map. If no such object exists, the map should be "wrapped" using the Collections.synchronizedMap method. This is best done at creation time, to prevent accidental unsynchronized access to the map: Map m = Collections.synchronizedMap(new HashMap(...));
answers question: http://stackoverflow.com/q/21754098
score: 4
upvote count: 4

http://stackoverflow.com/comment/32929771
type: AnswerComment
has text: You're right, of course. I assumed those were declared in the class and not the method when I first wrote it, and failed to update it. Updated.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21767565

http://stackoverflow.com/q/21837126
answer count: 0
upvote count: 3
tagged with: java
tagged with: authentication
type: Question
has title: How to programatically set up/chain JAAS login realms as if loaded from a login.conf?
tagged with: authorization
tagged with: jaas
has body: I am trying to figure out how I can programatically set up several custom authentication realms and chain the authentication through them. I can't seem to be able to find what actually is parsing the typical login.conf file (in JAAS) and how I can basically achieve the same effect programatically. Is the best way to do this to have sort of a proxy login module which checks what login modules exist, or is there a better way to do this? Another way I can think of is to find what JAAS realms can be found via a ServiceLoader, confguration files, or something along those lines and then generate a login.conf and override the system property for this. None of these look like the proper way to do it. Could somebody recommend something else, maybe? Many thanks for your help!
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 3

http://stackoverflow.com/comment/33083100
comment on: http://stackoverflow.com/q/21832567
score: 0
type: Comment
type: QuestionComment
has text: For some reason, I am unable to run eclipse for EMF developers... But I already fixed it (see my answer)

http://stackoverflow.com/comment/32890721
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21693868
has text: I don't usually think of insecurity with lack of type safety but rather sql injection or unsanitized evaluation. It was an interesting paper.

http://stackoverflow.com/q/21757180
linked to: http://stackoverflow.com/q/2472376
type: Question
has title: Maven export of 3rd party jar's are not exported with mvn install
tagged with: java
tagged with: eclipse
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21757361
has comment: http://stackoverflow.com/comment/32910517
type: UnansweredQuestion
has body: Wenn i do in eclipse a maven build with maven install no 3rd party jar is delivered. in my poms i have the dependency added, e.g: org.apache.poi poi 3.9 mysql mysql-connector-java 5.1.29 but after running the main.jar of my maven projects i get java.sql.SQLException: No suitable driver found for jdbc:mysql: What I'm doing wrong.
has comment: http://stackoverflow.com/comment/32911101
tagged with: mysql
tagged with: maven

http://stackoverflow.com/comment/32792755
has text: It could be okay. That is, perhaps the caller that is doing the wrapping (in some cases) has some context to distinguish unchecked and checked exceptions. The rule of thumb is that unchecked exceptions should be the the result of a programming error by the caller, as opposed to environmental problems or data-driven problems. If these custom unchecked exceptions don't fit that criterion, I'd be a lot more suspicious.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21688753

http://stackoverflow.com/a/21840471
has body: You're essentially losing time. Here's a snipped version of your function: while (isRunning) { now = System.nanoTime(); delta = (double)(now - lastUpdateTime) / 1000000000; //problem line //snip 1 lastUpdateTime = System.nanoTime(); //snip 2 } Over time, if you sum up all the deltas, you'll be increasing at a rate slightly below realtime. How much below depends on how long the operations between "now" and "lastUpdateTime" being set take. If, for example, the operations in "snip1" and "snip2" took approximately the same amount of time, you'd see a rate of ~1/2 realtime. For a concrete example, assuming your update method takes ~15 microseconds and your "render" method takes ~10: On iteration 1, "now" is initially set to some time X. "lastUpdateTime" then gets set to X+15000. On iteration 2, "now" is set to X + 25000. The delta you're passing in is therefore 10000, even though the change in "now" between the two iterations is actually 25000. The reason you're having to change your divisor on the "problem line" when you add/remove that printout is that I/O is slow, so it changes the ratio of time spent in snip1 and snip2 rather dramatically. What you probably actually want to do is: while (isRunning) { now = System.nanoTime(); delta = (double)(now - lastUpdateTime) / 1000000000; //problem line //snip 1 lastUpdateTime = now; //snip 2 } This will guarantee that if gamePanel.update(delta) were to keep an ongoing sum of the passed-in deltas, it would match up fairly precisely with elapsed wall-clock time over the long run.
score: 0
answers question: http://stackoverflow.com/q/21840006
type: Answer

http://stackoverflow.com/comment/32872385
type: Comment
has text: Yeah, actually i am using them. So, this is normal execution and i should not worry about it right?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21735718

http://stackoverflow.com/a/21789961
has comment: http://stackoverflow.com/comment/32969702
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32969501
answers question: http://stackoverflow.com/q/21789571
has body: The thing to understand here is that in Java, generic specializations are a compile time construct, and not a run time construct. During the compilation process, the specializations are "erased" - this is called "type erasure" - and the generated byte code does not know what the specialization is. You can't determine a class at runtime - which is what the getClass() function does - and use it at compile time. The "extends" keyword is generally more useful for defining generics than for instantiating them. In this case, what you probably want is for actionGroup to be ActionGroup, and assign to it new ActionGroup&lt;BaseAction&gt;() - or in Java 7, just new ActionGroup&lt;>() - since you are instantiating an instance rather than defining the generic. You can still stick objects that are a subclass of BaseAction in there, since they still "are" instances of BaseAction. You can then drop the action.getClass() call.
downvote count: 0
type: Answer

socketexception
tags question: http://stackoverflow.com/q/21806524
type: Tag
tag name: socketexception

http://stackoverflow.com/q/21733925
has body: This is my Class 1 // This class reads in integers and puts the values into a set 2 3 import java.util.ArrayList; 4 import java.util.*; 5 6 class Set { 7 8 private ArrayList&lt;Integer&gt; members; 9 private static int quantity = 0; 10 11 // Constructors 12 public Set() { 13 new ArrayList&lt;Integer&gt;(); 7 8 private ArrayList&lt;Integer&gt; members; 9 private static int quantity = 0; 10 11 // Constructors 12 public Set() { 13 new ArrayList&lt;Integer&gt;(); 14 } 15 16 public Set(int member){ 17 new ArrayList&lt;Integer&gt;(); 18 addMember(member); 19 quantity++; 20 } 21 // Accessors 22 public static int getQuantity() { 23 return quantity; 24 } 25 26 // Mutators 27 public void addMember(int member) { 28 members.add(member); 29 } 30 // toString() method 31 public String toString() { 32 int i; 33 String str = "["; 34 System.out.print("["); 35 for(i=0; i&lt;getQuantity(); i++){ 36 str += members.get(i); 37 if(i+1 == getQuantity()) 38 str += "]"; 39 else 40 System.out.print(", "); 41 str += ", "; 42 } 43 return str; 44 } 45 46 // Return true if 'this' is a subset of 'set', 47 // otherwise return false. 48 public boolean isSubset(Set set) { 49 if(this.members.contains(set)) 50 return true; 51 else 52 return false; 53 } 54 // Return true if 'this' is equals to 'obj', 55 // Otherwise return false 56 public boolean equals(Set set) { 57 return (members.contains(set) &amp;&amp; set.members.contains(this)); 58 } 59 } And this is my Test case. 1 // This program reads two sets of integers A and B, and determines 2 // if A is a subset of B, and if A is same as B. 3 4 import java.util.Scanner; 5 import java.util.ArrayList; 6 7 public class TestSet { 8 9 public static void main(String[] args) { 10 Scanner sc = new Scanner(System.in); 11 int i, setAnum, setBnum; 12 13 System.out.print("Enter number of elements in set A: "); 14 setAnum = sc.nextInt(); 15 ArrayList&lt;Integer&gt; list1 = new ArrayList&lt;Integer&gt;(); 16 17 System.out.print("Enter elements for set A: "); 18 for(i=0;…
has answer: http://stackoverflow.com/a/21733992
type: Question
has comment: http://stackoverflow.com/comment/32869205
answer count: 1
has title: arraylist in self-designed class errors. please help me
tagged with: syntax
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32869234
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32869651
tagged with: arraylist
linked to: http://stackoverflow.com/q/147454
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/32869371

java
tags question: http://stackoverflow.com/q/21687681
tags question: http://stackoverflow.com/q/21750365
tags question: http://stackoverflow.com/q/21729755
tags question: http://stackoverflow.com/q/21686127
tags question: http://stackoverflow.com/q/21686424
tags question: http://stackoverflow.com/q/21826046
tags question: http://stackoverflow.com/q/21746253
tags question: http://stackoverflow.com/q/21685187
tags question: http://stackoverflow.com/q/21796141
tags question: http://stackoverflow.com/q/21713784
tags question: http://stackoverflow.com/q/21698202
tags question: http://stackoverflow.com/q/21757312
tags question: http://stackoverflow.com/q/21771276
tags question: http://stackoverflow.com/q/21734841
tags question: http://stackoverflow.com/q/21828143
tags question: http://stackoverflow.com/q/21795451
tags question: http://stackoverflow.com/q/21757773
tags question: http://stackoverflow.com/q/21730285
tags question: http://stackoverflow.com/q/21690438
tags question: http://stackoverflow.com/q/21710112
tags question: http://stackoverflow.com/q/21719164
tags question: http://stackoverflow.com/q/21698073
tags question: http://stackoverflow.com/q/21707934
tags question: http://stackoverflow.com/q/21807210
tags question: http://stackoverflow.com/q/21697537
tags question: http://stackoverflow.com/q/21799324
tags question: http://stackoverflow.com/q/21789616
tags question: http://stackoverflow.com/q/21838871
tags question: http://stackoverflow.com/q/21790021
tags question: http://stackoverflow.com/q/21831031
tags question: http://stackoverflow.com/q/21762054
tags question: http://stackoverflow.com/q/21707053
tags question: http://stackoverflow.com/q/21694887
tags question: http://stackoverflow.com/q/21779371
tags question: http://stackoverflow.com/q/21709219
tags question: http://stackoverflow.com/q/21803634
tags question: http://stackoverflow.com/q/21785700
tags question: http://stackoverflow.com/q/21820588
tags question: http://stackoverflow.com/q/21771335
tags question: http://stackoverflow.com/q/21699467
tags question: http://stackoverflow.com/q/21826379
tags question: http://stackoverflow.com/q/21801754
tags question: http://stackoverflow.com/q/21721846
tags question: http://stackoverflow.com/q/21739266
tags question: http://stackoverflow.com/q/21803908
tags question: http://stackoverflow.com/q/21808033
tags question: http://stackoverflow.com/q/21771233
tags question: http://stackoverflow.com/q/21755815
tags question: http://stackoverflow.com/q/21751615
tags question: http://stackoverflow.com/q/21733303
tags question: http://stackoverflow.com/q/21741418
tags question: http://stackoverflow.com/q/21822159
tags question: http://stackoverflow.com/q/21721401
tags question: http://stackoverflow.com/q/21782861
tags question: http://stackoverflow.com/q/21691551
tags question: http://stackoverflow.com/q/21775320
tags question: http://stackoverflow.com/q/21738543
tags question: http://stackoverflow.com/q/21818625
tags question: http://stackoverflow.com/q/21716052
tags question: http://stackoverflow.com/q/21723766
tags question: http://stackoverflow.com/q/21799873
tags question: http://stackoverflow.com/q/21702533
tags question: http://stackoverflow.com/q/21730926
tags question: http://stackoverflow.com/q/21813516
tags question: http://stackoverflow.com/q/21818380
tags question: http://stackoverflow.com/q/21744443
tags question: http://stackoverflow.com/q/21813434
tags question: http://stackoverflow.com/q/21711620
tags question: http://stackoverflow.com/q/21699745
tags question: http://stackoverflow.com/q/21837899
tags question: http://stackoverflow.com/q/21734139
tags question: http://stackoverflow.com/q/21835709
tags question: http://stackoverflow.com/q/21832275
tags question: http://stackoverflow.com/q/21837350
tags question: http://stackoverflow.com/q/21765257
tags question: http://stackoverflow.com/q/21757251
tags question: http://stackoverflow.com/q/21680291
tags question: http://stackoverflow.com/q/21741832
tags question: http://stackoverflow.com/q/21769175
tags question: http://stackoverflow.com/q/21829901

http://stackoverflow.com/a/56253445
score: 0
type: Answer
has body: It basically translated to creation of LinkedList object which adheres to Queue operations. All the nodes will be connected with each other but you can add/remove/size on the list.
answers question: http://stackoverflow.com/q/21727873

http://stackoverflow.com/comment/32866294
score: 1
comment on: http://stackoverflow.com/q/21732357
has text: What does `o22.getHandledDate()` return? If it doesn't return `String`, then the code shouldn't compile. And if it returns `String`, and the method name is a bit inappropriate.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21802566
upvote count: 1
has body: The Games APIs doc points to this method in the BaseGameUtils library in the Android Samples project as well as similar methods such as getApiClientBuilder(): "If your game wants to add additional Google Play services APIs or scopes to the GoogleApiClient managed by BaseGameActivity, it can do this by calling getApiClientBuilder() on the GameHelper object" in BaseGameUtils. I don't yet see those methods in BaseGameUtils on github and am guessing that they will be updated at some point. UPDATE: Looks like a GameHelper update in BaseGameUtils is on its way.
answers question: http://stackoverflow.com/q/21798257
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/21691906
downvote count: 0
has comment: http://stackoverflow.com/comment/32795319
has body: You're adding the list to the container, not the listScroller. JScrollPane listScroller = new JScrollPane(); listScroller.setViewportView(list); list.setSize(10, 10); setLayout(new FlowLayout(FlowLayout.LEFT,10,10)); add(list); You should try using something like... JScrollPane listScroller = new JScrollPane(); listScroller.setViewportView(list); setLayout(new FlowLayout(FlowLayout.LEFT,10,10)); //add(list); add(listScroller); I think you will also find list.setSize(10, 10); is pointless, as the JScrollPane (actually the viewport, but lets keep it simple) has it's own layout manager. You should take a look at Jlist#setVisibleRowCount if you want to affect the number of visible rows a JList will show before it needs to be scrolled. The actual width and height of each row is determined by the ListCellRenderer, but you can use JList#setPrototypeCellValue to affect how these might be calculated.
accepted answer of: http://stackoverflow.com/q/21691884
has comment: http://stackoverflow.com/comment/32800185
answers question: http://stackoverflow.com/q/21691884
type: Answer
has comment: http://stackoverflow.com/comment/32799770
has comment: http://stackoverflow.com/comment/32800266
has comment: http://stackoverflow.com/comment/32799789
upvote count: 5
has comment: http://stackoverflow.com/comment/32795241
has comment: http://stackoverflow.com/comment/32795266
score: 5
has comment: http://stackoverflow.com/comment/32795339
type: AcceptedAnswer

http://stackoverflow.com/comment/33015590
type: QuestionComment
has text: "Create a maze" is an awfully broad question. A "maze" does not have a clear mathematical definition, I think. You'll need to be more specific. If any maze-like structure is fine, I'm sure you can whip up something very simple, which still would allow you to test the solving algorithm.
score: 0
comment on: http://stackoverflow.com/q/21815839
type: Comment

http://stackoverflow.com/a/21781304
type: Answer
has body: Quick and dirty Install maven on the linux server and a JDK. Then copy the source code of your project to the linux server (e.g. clone the source repository or zip the directory and scp it). Run: mvn clean test A bit more complex but nicer Using the Selenium Grid. The Grid allows selenium to start a browser from remote nodes. First download the selenium server from the Google Code download page. Start the hub on your windows machine: java -jar selenium-server-standalone-2.39.0.jar -role hub Go to http://localhost:4444/grid/console to check that the hub has correctly started. Then on the linux server start a node: java -jar selenium-server-standalone-2.7.0.jar -role webdriver -hub http://&lt;hub_ip_or_hostname&gt;:4444/grid/register -port 5556 -browser browserName=firefox In your test code, instantiate a RemoteWebDriver object with the Firefox capability. The remote webdriver object will automatically contact the hub to find a remote node with the requested capabilities (and here there is only one single node). Then the hub will forward the selenium commands to the remote node. DesiredCapabilities capability = DesiredCapabilities.firefox(); WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability); driver.go("http://www.myWebsiteToBeTested/"); Then you can add to the hub as many nodes as you wish, using different platforms and browsers (Firefox on Linux, IE on Windows, Safari on iOS...). The official documentation is here.
has comment: http://stackoverflow.com/comment/32963796
accepted answer of: http://stackoverflow.com/q/21775039
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21775039
score: 0

http://stackoverflow.com/comment/32888920
comment on: http://stackoverflow.com/q/21744744
score: 0
type: Comment
type: QuestionComment
has text: Single-character strings, or Character. Or implement a non-object stack and use chars. Pick one.

http://stackoverflow.com/a/21812877
downvote count: 0
type: Answer
upvote count: 1
has body: import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import java.awt.event.*; class View extends JFrame { private static final long serialVersionUID = 1L; int width = 400; int height = width / 16 * 9; String title = "View all Cars"; public View() { setLayout(null); setLocationRelativeTo(null); setTitle(title); setSize(width, height); setResizable(false); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setVisible(true); JLabel background = new JLabel(new ImageIcon("res\\background2.jpg")); add(background); background.setSize(width, height); WindowListener listener = new WindowAdapter() { public void windowClosing(WindowEvent w) { new Main(); } }; addWindowListener(listener); } } please run the program view.java i add Windows Adapter to get Windows Events when window close then main() windows shows
score: 1
answers question: http://stackoverflow.com/q/21812698
has comment: http://stackoverflow.com/comment/33010772

http://stackoverflow.com/q/21722979
has body: I am using java for my project. I have a page include many textbox. When the user type arabic string and push the save button the string be destroyed For example: input: السلام after push button: %645D5$64%64f&amp;%DF I used this code for using UTF-8 on top of jsp page: &lt;%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %&gt; but it's not working. And this is my ajax code: var name = document.getElementById('LineTitle').value ; var category = document.getElementById("LineCategory").value; var lineDirection = document.getElementById("LineDir").value; markerLayer.clearMarkers(); $.ajax({ data: '{"feature": ' + str + ', "name": "' + name + '", "category": "' + category + '", "LineDirection": "' + lineDirection + '"}', type: "POST", url: "../SaveLine", beforeSend: function(x) { if (x &amp;&amp; x.overrideMimeType) { x.overrideMimeType("application/json;charset=UTF-8"); } },
has comment: http://stackoverflow.com/comment/32849807
has title: Send arabic characters by ajax - java
has answer: http://stackoverflow.com/a/21723396
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21723803
tagged with: java
tagged with: character-encoding
possible better answer: http://stackoverflow.com/a/21723396
type: Question
answer count: 2
tagged with: ajax
accepted answer: http://stackoverflow.com/a/21723803
score: 0
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/32849740

http://stackoverflow.com/q/21833212
favorite count: 0
has body: I would like to use GraphViz to generate some graphs in my program. There is just a problem : I don't want to generate any temporary file. Here is what I got from here : public class GraphBuilder{ /* Some code generating a DOT formatted String representing my graph */ /* Generation the graph using the plain format */ Runtime runtime = Runtime.getRuntime(); Process p = null; try { p = runtime.exec("neato -Tplain c:\\users\\tristan\\desktop\\test1"); } catch (IOException e) { System.err.println(e.getMessage()); } BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); StringBuilder builder = new StringBuilder(); String line = null; try{ while ( (line = br.readLine()) != null) { builder.append(line); builder.append(System.getProperty("line.separator")); } } catch(IOException e){ } String result = builder.toString(); System.out.println(result); Ok so, from now, my program is reading a file but I want the neato program to read my String that had been generated earlier by the program. How should I do ? Thanks in advance !
has title: Creating a GraphViz graph in Java without any intermediate file
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33046038
has comment: http://stackoverflow.com/comment/33045827
type: Question
has answer: http://stackoverflow.com/a/21834686
has comment: http://stackoverflow.com/comment/33045778
accepted answer: http://stackoverflow.com/a/21834686
tagged with: graphviz
has comment: http://stackoverflow.com/comment/33046238
has comment: http://stackoverflow.com/comment/33074121
upvote count: 3
answer count: 2
possible better answer: http://stackoverflow.com/a/74619705
has answer: http://stackoverflow.com/a/74619705

http://stackoverflow.com/comment/33054077
type: Comment
type: QuestionComment
has text: @NPE Agreed. I retracted my close vote then :)
comment on: http://stackoverflow.com/q/21837750
score: 0

apache-tiles
tags question: http://stackoverflow.com/q/21820651
type: Tag
tag name: apache-tiles

http://stackoverflow.com/q/21753220
has answer: http://stackoverflow.com/a/62165975
score: 12
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32905432
has title: Orika - list to list conversion
tagged with: java
has body: This is probably an easy one, but I cant find it in the docs. I have a person class class BasicPerson { private String name; private int age; private Date birthDate; // getters/setters omitted } and a list of it ArrayList&lt;Person&gt; I want to change them to change them to ArrayList&lt;PersonDTO&gt; but with out an explicit loop. Is there a way to use MapperFacade.map for a list to list one line conversion ?
type: Question
upvote count: 12
downvote count: 0
has answer: http://stackoverflow.com/a/21756340
favorite count: 0
linked to: http://stackoverflow.com/q/55141817
linked to: http://stackoverflow.com/q/7383624
answer count: 3
has comment: http://stackoverflow.com/comment/32905463
tagged with: orika
has comment: http://stackoverflow.com/comment/32903580
has answer: http://stackoverflow.com/a/53826139

http://stackoverflow.com/a/21723057
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21704449
has body: It was like you said guys , in the url for the JDBC driver class it is org.postgresql.com and not com.postgresql.com

http://stackoverflow.com/q/21827216
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21827399
tagged with: java
tagged with: authentication
has title: HTTPS Login using Java
tagged with: https
type: Question
answer count: 2
has body: I've a problem to login to a website via https. I wrote this code (it works) for http access: String user = user; String password = psw; String authString = user + ":" + password; byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); String authStringEnc = new String(authEncBytes); URLConnection connection= url.openConnection(); connection.setRequestProperty("Authorization", "Basic " + authStringEnc); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.connect(); I'd like to do the same things but via https. Is it possible?
has answer: http://stackoverflow.com/a/21828123
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38742874
type: UnansweredQuestion

http://stackoverflow.com/a/21806219
score: 12
has comment: http://stackoverflow.com/comment/32998406
has body: The problem here is that you can't subtract the colors direcly. Each pixel is represented by one int value. This int value consists of 4 bytes. These 4 bytes represent the color components ARGB, where A = Alpha R = Red G = Green B = Blue (Alpha is the opacity of the pixel, and always 255 (that is, the maximum value) in BMP images). Thus, one pixel may be represented by (255, 0, 254, 0) When you subtract another pixel from this one, like (255, 0, 255, 0), then the third byte will underflow: It would become -1. But since this is part of ONE integer, the resulting color will be something like (255, 0, 254, 0) - (255, 0, 255, 0) = (255, 255, 255, 0) and thus, be far from what you would expect in this case. The key point is that you have to split your color into the A,R,G and B components, and perform the computation on these components. In the most general form, it may be implemented like this: int argb0 = image0.getRGB(x, y); int argb1 = image1.getRGB(x, y); int a0 = (argb0 &gt;&gt; 24) &amp; 0xFF; int r0 = (argb0 &gt;&gt; 16) &amp; 0xFF; int g0 = (argb0 &gt;&gt; 8) &amp; 0xFF; int b0 = (argb0 ) &amp; 0xFF; int a1 = (argb1 &gt;&gt; 24) &amp; 0xFF; int r1 = (argb1 &gt;&gt; 16) &amp; 0xFF; int g1 = (argb1 &gt;&gt; 8) &amp; 0xFF; int b1 = (argb1 ) &amp; 0xFF; int aDiff = Math.abs(a1 - a0); int rDiff = Math.abs(r1 - r0); int gDiff = Math.abs(g1 - g0); int bDiff = Math.abs(b1 - b0); int diff = (aDiff &lt;&lt; 24) | (rDiff &lt;&lt; 16) | (gDiff &lt;&lt; 8) | bDiff; result.setRGB(x, y, diff); Since these are grayscale images, the computations done here are somewhat redundant: For grayscale images, the R, G and B components are always equal. And since the opacity is always 255, it does not have to be treated explicitly here. So for your particular case, it should be sufficient to simplify this to int argb0 = image0.getRGB(x, y); int argb1 = image1.getRGB(x, y); // Here the 'b' stands for 'blue' as well // as for 'brightness' :-) int b0 = argb0 &amp; 0xFF; int b1 = argb1 &amp; …
type: AcceptedAnswer
type: Answer
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/33003957
has comment: http://stackoverflow.com/comment/32998437
has comment: http://stackoverflow.com/comment/32998317
accepted answer of: http://stackoverflow.com/q/21806062
has comment: http://stackoverflow.com/comment/33010244
answers question: http://stackoverflow.com/q/21806062

http://stackoverflow.com/a/21752699
upvote count: 1
answers question: http://stackoverflow.com/q/21747895
downvote count: 1
has body: I found the below example in a website, thought this refers to exactly your question http://www.journaldev.com/1973/servlet-exception-and-error-handling-example-tutorial Java Code: package com.journaldev.servlet.exception; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/AppExceptionHandler") public class AppExceptionHandler extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processError(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processError(request, response); } private void processError(HttpServletRequest request, HttpServletResponse response) throws IOException { // Analyze the servlet exception Throwable throwable = (Throwable) request .getAttribute("javax.servlet.error.exception"); Integer statusCode = (Integer) request .getAttribute("javax.servlet.error.status_code"); String servletName = (String) request .getAttribute("javax.servlet.error.servlet_name"); if (servletName == null) { servletName = "Unknown"; } String requestUri = (String) request .getAttribute("javax.servlet.error.request_uri"); if (requestUri == null) { requestUri = "Unknown"; } // Set response content type response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.write(" Exception/Error Details "); if(statusCode != 500){ out.write(" Error Details "); out.write("Status Code:"+statusCode+" "); out.write("Requested URI:"+requestUri); }else{ out.write(" Exception Details "); out.write(" Servlet Name:"+servletName+" "); out.write(" Exception Name:"+throwable.getClass().getName()+" "); out.write(" Requested URI:…
has comment: http://stackoverflow.com/comment/32905388
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32905445

http://stackoverflow.com/comment/32831308
type: Comment
comment on: http://stackoverflow.com/a/21686187
score: 0
type: AnswerComment
has text: what param's i need write here?

http://stackoverflow.com/q/21686930
tagged with: java
has comment: http://stackoverflow.com/comment/59762225
upvote count: 10
has comment: http://stackoverflow.com/comment/59780441
tagged with: gradle
type: Question
tagged with: intellij-idea
score: 10
answer count: 2
has answer: http://stackoverflow.com/a/21711589
has body: How does IntelliJ know if a directory is a 'source' or a 'test source'? How can I consistently mark a directory as a 'test source'? build.gradle 1 apply plugin: 'java' apply plugin: 'idea' idea { module { sourceDirs += file('src/main/java') testSourceDirs += file('src/awesome-test/java') } } Using "build.gradle 1" file, src/awesome-test/java is marked as a 'test source'. build.gradle 2 apply plugin: 'java' apply plugin: 'idea' idea { module { sourceDirs += file('src/main/java') testSourceDirs += file('src/awesome-test/java') } } sourceSets { 'awesome-test' { java { srcDir 'src/awesome-test/java' } compileClasspath += sourceSets.main.runtimeClasspath } } However as soon as you add a source set that references this directory ("build.gradle 2") then src/awesome-test/java is marked as a 'source'. build.gradle 3 apply plugin: 'java' apply plugin: 'idea' idea { module { sourceDirs += file('src/main/java') testSourceDirs += file('src/awesome-test/java') } } sourceSets { 'awesome-test' { java { srcDir 'src/awesome-test/java' } compileClasspath += sourceSets.main.runtimeClasspath } } task awesomeTest(type: Test) { testClassesDir = sourceSets.'awesome-test'.output.classesDir classpath += sourceSets.'awesome-test'.runtimeClasspath } And just to confuse things beyond any hope of understanding, if I add a Test type task then src/awesome-test/java is once again marked as 'test source'. Notes: IntelliJ 13.0.2, Gradle 1.9
downvote count: 0
has title: How does IntelliJ know if a directory is a 'source' or a 'test source'?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/59791020
has comment: http://stackoverflow.com/comment/59780475
has answer: http://stackoverflow.com/a/21687746

http://stackoverflow.com/comment/32818442
comment on: http://stackoverflow.com/q/21705428
has text: You should change your Java 1.4 tag then.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21821090
has body: I have a method in java to execute a shell script in ubuntu. String[] cmd = {"/bin/sh", "startdomain.sh"}; Process proc = Runtime.getRuntime().exec(cmd); startdomain.sh is as follows: #!/bin/sh gksudo -P "/home/priyatam/glassfish-4.0/glassfish/bin/asadmin start-domain domain1" I need to pass the domain name (here domain1) as parameter from java class. How to achieve this.
upvote count: 1
downvote count: 0
answer count: 1
tagged with: shell
favorite count: 0
has title: Passing parameter to sh file from java class
duplicate of: http://stackoverflow.com/q/16893929
tagged with: sh
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16893929
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21821312
accepted answer: http://stackoverflow.com/a/21821312

http://stackoverflow.com/comment/48057145
type: QuestionComment
score: 0
has text: @trashgod it is a good starting point, but soon you will realize that using `sortKeys.add()` method is not gonna solve the issue OP is having. Because, one of the core methods (toggleSortOrder) will reorganize the sortKeys list and destroy your modification.
comment on: http://stackoverflow.com/q/21809959
type: Comment

http://stackoverflow.com/comment/32997870
type: AnswerComment
has text: Hi thanks for replying, Actually I am using two loops you'll see when you read it. and in the way I am deleting nodes so that the outer loop doesn't counts the deleted elements.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21805973

http://stackoverflow.com/a/21717734
answers question: http://stackoverflow.com/q/21717681
has body: The line: System.out.println(three); just prints the value of the variable three. If you remove the line it will no longer print the variable, but the manipulation of the variable will not change. If you want to keep the line while make the code inactive create a comment with two // characters in front of any given line.
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/33585036
type: AnswerComment
comment on: http://stackoverflow.com/a/21745568
type: Comment
score: 0
has text: sorry, I didn't mean that.. It was my fault, that I haven't seet it

http://stackoverflow.com/comment/33057080
score: 0
type: Comment
has text: It's only working now in 2 directions... Getting closer to the answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/21837999

openldap
tags question: http://stackoverflow.com/q/21776458
tag name: openldap
type: Tag

validation
tags question: http://stackoverflow.com/q/21836108
tags question: http://stackoverflow.com/q/21823268
tags question: http://stackoverflow.com/q/21841202
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/21765257
tags question: http://stackoverflow.com/q/21700234
tags question: http://stackoverflow.com/q/21776578
tags question: http://stackoverflow.com/q/21793584

http://stackoverflow.com/a/21762587
answers question: http://stackoverflow.com/q/21762434
score: 0
has body: You can have the same ImageViews in different layout files (I don't know why you would name them the same) and then access them from within your code as long as you have set the right layout inside onCreate or wherever you want to access those components. So, yes, just copy the ImageView to the second.xml and it should work.
type: Answer

http://stackoverflow.com/comment/32887045
score: 0
type: AnswerComment
type: Comment
has text: if the item is dynamically generated, so how to get the item size of the GridView?
comment on: http://stackoverflow.com/a/21731177

http://stackoverflow.com/a/21729345
has comment: http://stackoverflow.com/comment/32860848
has comment: http://stackoverflow.com/comment/32863787
score: -2
has comment: http://stackoverflow.com/comment/32863637
has comment: http://stackoverflow.com/comment/32863751
upvote count: 0
has body: An instance of an Object can only have one type. In the case of an instance of B extends A then this will always be a B, even inside methods of A. However you can always use an object of type B as thought it is an an object of type A so even though getClass will return a B all the methods within A can use this as though it were a A. For example its completely valid to do: A a = new B(); // Valid as B extends A a.test(); If B declares a method test() then that version of the method will be called, even though you are referring to it as though it were an A. This is also how things like over-riding methods can be used to change the behavior of a base class from a sub class. When you have a method test() in A, and then override the method in B then whenever code in A calls this.test() it will actually call the over-ridden method in B. Your mistake comes from the assumption that Overriding is resolved at compile time. It's not, it's resolved at run time Over load ed methods are resolved at compile time. Over ride n methods are resolved at run time. Overloading and Overriding are very different things.
has comment: http://stackoverflow.com/comment/32863598
type: Answer
has comment: http://stackoverflow.com/comment/32863954
has comment: http://stackoverflow.com/comment/32864867
downvote count: 2
answers question: http://stackoverflow.com/q/21729279
has comment: http://stackoverflow.com/comment/32863434

http://stackoverflow.com/comment/32955061
type: AnswerComment
comment on: http://stackoverflow.com/a/21781826
score: 0
type: Comment
has text: If I wanted to populate the list with the data from your example, shall I really just cycle through the items one-by-one from results and adress components?

http://stackoverflow.com/comment/32821177
comment on: http://stackoverflow.com/q/21698939
has text: Correct, but it properly specifies the owner of the relationship
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32954366
type: QuestionComment
comment on: http://stackoverflow.com/q/21781920
score: 0
has text: Is this MySQL or SQL Server? And what have you tried so far? Please share some code.
type: Comment

recursion
type: Tag
tags question: http://stackoverflow.com/q/21820279
tags question: http://stackoverflow.com/q/21800032
tags question: http://stackoverflow.com/q/21798202
tags question: http://stackoverflow.com/q/21694887
tags question: http://stackoverflow.com/q/21809139
tags question: http://stackoverflow.com/q/21735432
tags question: http://stackoverflow.com/q/21735857
tag name: recursion
tags question: http://stackoverflow.com/q/21738467
tags question: http://stackoverflow.com/q/21836814
tags question: http://stackoverflow.com/q/21691017
tags question: http://stackoverflow.com/q/21748687
tags question: http://stackoverflow.com/q/21695946
tags question: http://stackoverflow.com/q/21716162
tags question: http://stackoverflow.com/q/21708867
tags question: http://stackoverflow.com/q/21690492
tags question: http://stackoverflow.com/q/21813586
tags question: http://stackoverflow.com/q/21783914
tags question: http://stackoverflow.com/q/21792330
tags question: http://stackoverflow.com/q/21742894
tags question: http://stackoverflow.com/q/21791886
tags question: http://stackoverflow.com/q/21786920
tags question: http://stackoverflow.com/q/21716405
tags question: http://stackoverflow.com/q/21739767
tags question: http://stackoverflow.com/q/21734631
tags question: http://stackoverflow.com/q/21836452
tags question: http://stackoverflow.com/q/21701989
tags question: http://stackoverflow.com/q/21817301
tags question: http://stackoverflow.com/q/21710756
tags question: http://stackoverflow.com/q/21719251
tags question: http://stackoverflow.com/q/21823944

http://stackoverflow.com/q/21826024
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33038600
type: Question
has comment: http://stackoverflow.com/comment/33036876
has comment: http://stackoverflow.com/comment/33039357
has comment: http://stackoverflow.com/comment/33038988
score: 0
has comment: http://stackoverflow.com/comment/33039612
tagged with: sql
has title: Stateless hibernate session insert table which contains assosiation to another table
type: UnansweredQuestion
has body: For insertion of bulk records into the database i used the stateless session because it is fast with no caching and interceptors of hibernate don't get called with stateless session.But since stateless session doesn't take care of the associations. In my table i have the mapping to another table so how to i do the insert ? I wanted to use HQL to insert , or what is the other availible option for the insertion of the rows on both the mapped tables also. Please let me know the format for the inserts to the tables in HQL .Thanks in advance.
answer count: 0

http://stackoverflow.com/comment/32889538
score: 0
has text: Your Linux image cannot be completely correct. When using JNI, one can make use of both the stack and heap of the host process from within a jclass method. There is some overlap. Though i expect you're safe in the assumption that the old, new, and permanent generations are all stored in the heap.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21745044

http://stackoverflow.com/q/21765821
accepted answer: http://stackoverflow.com/a/21803826
has title: ExpandableListView holder is becoming null
tagged with: expandablelistview
type: AnsweredQuestion
has body: Here's my getChildView : public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { View v = convertView; ViewHolderChild h; if (v == null) { h = new ViewHolderChild(); switch (groupPosition) { case GROUP_OVERVIEW: v = inflater .inflate(R.layout.adapter_show_child_overview, null); h.wv_overview = (WebView) v .findViewById(R.id.wv_adapter_show_child_overview); h.tv_title = (TextView) v .findViewById(R.id.tv_adapter_show_overview_title); h.tv_date = (TextView) v .findViewById(R.id.tv_adapter_show_overview_date); h.tv_year = (TextView) v .findViewById(R.id.tv_adapter_show_overview_year); h.tv_network = (TextView) v .findViewById(R.id.tv_adapter_show_overview_network); h.tv_title.setTypeface(font_bold); h.tv_date.setTypeface(font_thin); h.tv_year.setTypeface(font_thin); h.tv_network.setTypeface(font_bold); v.setTag(h); break; case GROUP_SEASONS: v = inflater.inflate(R.layout.adapter_shows_child_seasons, null); h.siv = (SmartImageView) v.findViewById(R.id.siv_adapter_show_child_seasons); h.tv_seasons = (TextView) v.findViewById(R.id.tv_adapter_show_child_seasons); v.setTag(h); break; } } else { h = (ViewHolderChild) v.getTag(); } switch (groupPosition) { case GROUP_OVERVIEW: OverView overview = groups.get(groupPosition).getOverview(); FunctionUtils.loadHtml(h.wv_overview, overview.getOverview(), FunctionUtils.FONT_ROBOTO_THIN, 14); h.tv_date.setText("" + overview.getAirDay() + "/" + overview.getAirTime()); h.tv_title.setText(overview.getTitle()); h.tv_year.setText("" + overview.getYear()); h.tv_network.setText("" + overview.getNetwork()); break; case GROUP_SEASONS: SeasonObject season = groups.get(groupPosition).getSeasons().get(childPosition); if(season.getImages().getPoster() != null){ h.siv.setImageUrl(season.getImages().getPoster()); } h.tv_seasons.setText("Season : "+season.getSeason()+" Episode : "+season.getEpisodes()); break; } return v; } But when i start to scroll down, there is a problem on this li…
tagged with: java
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21803826
tagged with: android

http://stackoverflow.com/q/21692710
has answer: http://stackoverflow.com/a/21697151
score: 1
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32799116
upvote count: 1
tagged with: applet
tagged with: jdialog
has answer: http://stackoverflow.com/a/21697404
favorite count: 0
has title: Hide/Simply close Jdialog on click of X
type: UnansweredQuestion
tagged with: swing
has body: I am trying to set the default close operation on close of Jdialog. However, my progressbar code is overriding the closing event. I wasn't sure of a place to write the dialog.setVisible(true); and dialog.setDefaultCloseOperation(HIDE_ON_CLOSE); statements. Below is my init() method and and my Jdialog. Please review and suggest. @Override public void init() { dialog = new JDialog(new JFrame(), "Progress", true); dialog.setSize(300, 75); dialog.setDefaultCloseOperation(HIDE_ON_CLOSE); } public void updateProgressBar(final int progress) { dialog.setAlwaysOnTop(true); for (i = 0; i &lt;= 100; i = i + 1) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { progressBar.setValue(progress); dialog.setVisible(true); } }); } if(progressBar.getValue()==100){ dialog.dispose(); System.out.println("File uploaded successfully!"); } What is not working here is - the dialog.setDefaultCloseOperation(). Why is it not working is - because I have the dialog.setVisible(true) in my updateProgessBar() method, to show the updating progress of my fileupload. Each time there is a progress, the dialog.setVisible becomes true, thereyby overriding the setDefaultCloseOperation written in the init() method. If I place the dialog.setVisible(true) present in my updateProgressBar() elsewhere, the jdialog progress bar would not update and appear as expected. So, my question is how would I adjust these two statements within the code, so that, I will also be able to perform the default close operation ?
has comment: http://stackoverflow.com/comment/32799827
downvote count: 0

http://stackoverflow.com/q/21739325
has comment: http://stackoverflow.com/comment/32879461
has body: I want to write a java program that asks the user for information like name, age , etc. Then take that information and make an HTML document on my computer with the information in it. I don't know where to start with making it a web page. Here is my code so far: import javax.swing.JOptionPane; public class WritesHTML{ public static void main(String[] args){ String firstName = JOptionPane.showInputDialog("Enter first name:"); String lastName = JOptionPane.showInputDialog("Enter last name:"); String age = JOptionPane.showInputDialog("Enter age:"); String occupation = JOptionPane.showInputDialog("occupation:"); int numAge = Integer.parseInt(age); } }
answer count: 1
has title: How do i make an html document with html in it with java code
linked to: http://stackoverflow.com/q/2885173
has answer: http://stackoverflow.com/a/21739499
tagged with: http://stackoverflow.com/tag/html
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32879545
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32879518

http://stackoverflow.com/q/21754274
has comment: http://stackoverflow.com/comment/32905155
downvote count: 0
tagged with: tomcat
favorite count: 0
has title: How to correct delete catalina.out?
has body: I couldn't restart Tomcat webserver. But catalina.out get very big. I have tried delete on test server and created new empty. But Tomcat doesn't write anymore in new catalina.out. How correct delete/create empty new one ?
tagged with: delete-file
tagged with: size
possible better answer: http://stackoverflow.com/a/34130572
has answer: http://stackoverflow.com/a/34130572
has answer: http://stackoverflow.com/a/72150051
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21754400
tagged with: java
tagged with: catalina.out
type: Question
score: 22
has answer: http://stackoverflow.com/a/21754398
accepted answer: http://stackoverflow.com/a/21754400
upvote count: 22

http://stackoverflow.com/q/21775237
has answer: http://stackoverflow.com/a/21776584
tagged with: java
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/32943190
downvote count: 0
has body: Also, how does having a static variable affect things? (If at all) For example: class MyClass{ static int[][] data; static { data = new int[some number][some number]; /*read data into array*/ } static void run() { /*now use data here*/ } } Is this put on the heap? Comparing that example with class MyClass{ static void run() { int[][] data = new int[some number][some number]; /*now use data here*/ } } How much difference is there between these two code examples? Please shed any insight.
score: 4
has title: In Java, is a global variable always put on the heap?
possible better answer: http://stackoverflow.com/a/21775409
answer count: 4
has answer: http://stackoverflow.com/a/21775409
favorite count: 0
has answer: http://stackoverflow.com/a/21775434
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/32942987
has comment: http://stackoverflow.com/comment/32943198
has comment: http://stackoverflow.com/comment/32943093
accepted answer: http://stackoverflow.com/a/21775434
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21775449

http://stackoverflow.com/a/21830859
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33043174
accepted answer of: http://stackoverflow.com/q/21830841
has comment: http://stackoverflow.com/comment/33043414
answers question: http://stackoverflow.com/q/21830841
has comment: http://stackoverflow.com/comment/33043305
has body: Try this out. Paths in web application works relative to /WEB-INF and not WEB-INF String file = System.getProperty("file.separator")+"WEB-INF" + System.getProperty("file.separator") + "classes" + System.getProperty("file.separator") + "log4j.properties";
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33041546
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33043037

stack
tags question: http://stackoverflow.com/q/21792330
tags question: http://stackoverflow.com/q/21709015
tags question: http://stackoverflow.com/q/21768246
tags question: http://stackoverflow.com/q/21841545
tags question: http://stackoverflow.com/q/21763542
tags question: http://stackoverflow.com/q/21812554
tags question: http://stackoverflow.com/q/21698620
tags question: http://stackoverflow.com/q/21767127
tags question: http://stackoverflow.com/q/21744744
tags question: http://stackoverflow.com/q/21728729
tags question: http://stackoverflow.com/q/21801872
type: Tag
tag name: stack
tags question: http://stackoverflow.com/q/21757527
tags question: http://stackoverflow.com/q/21716830
tags question: http://stackoverflow.com/q/21784638
tags question: http://stackoverflow.com/q/21764943

http://stackoverflow.com/a/71429977
has body: Although JDK version 8 can be added into IntelliJ IDEA version 2017.2.6, I couldn't add JDK version 11.0.14 into and got the same error. Because of this, I downloaded new version of IntelliJ IDEA version (2021.3.2) and I could add JDK 11.0.14 into IntelliJ easily without any error. Using newer release of IntelliJ than JDK release can be reasonable recommendation for people who meet this kind of problems.
score: 0
answers question: http://stackoverflow.com/q/21713414
type: Answer

http://stackoverflow.com/q/21791371
tagged with: java
tagged with: noclassdeffounderror
answer count: 1
favorite count: 0
has title: Error Compiling Report: java.lang.NoClassDefFoundError: javax/servlet/ServletOutputStream
score: 0
has answer: http://stackoverflow.com/a/21791385
type: UnansweredQuestion
has body: I have an error while compiling report the error is: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/servlet/ServletOutputStream this is the code: Map parameter = new HashMap(); parameter.put("customerId", notification_table.getValueAt(r, 0).toString()); ReportV sd = new ReportV(); sd.showReport(parameter); this is the class I used: import java.sql.*; import java.util.Map; import javax.swing.*; import static javax.swing.JFrame.EXIT_ON_CLOSE; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.swing.JRViewer; public class ReportV { Connection conn = null; void showReport(Map parameters) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn = DriverManager.getConnection("jdbc:odbc:pcn"); JasperReport report = JasperCompileManager.compileReport("recipt.jrxml"); JasperPrint print = JasperFillManager.fillReport(report, parameters, conn); JRViewer viewer = new JRViewer(print); viewer.setOpaque(true); viewer.setVisible(true); //make your JFrame visible this.add(viewer); this.setSize(300, 200); this.setVisible(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); } catch (Exception ex) { System.out.println("CAUSE: " + ex.getCause()); System.out.println("MESSAGE" + ex.getMessage()); System.out.println("LOCAL MESSAGE" + ex.getLocalizedMessage()); ex.printStackTrace(); } } }
upvote count: 1
downvote count: 1
type: Question
tagged with: jasper-reports

http://stackoverflow.com/comment/32840348
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21715634
has text: Thanks was able to solve this problem after your help.
score: 0

http://stackoverflow.com/q/21751703
score: 0
answer count: 2
has body: I work for a start-up, where we have a requirement to automatically navigate to a given web application and find out information about all the objects contained within a page (inclusive of any iframes inside). We are supposed to code this module in Java. So, I used Selenium WebDriver and was successful. However, due to some reasons, we've been asked not to use Selenium, but rather Core Java to do this. So here's my question. Let's say I want to open "http://www.google.co.in" on my Firefox browser, and I have to get the attribute values for the Search Textbox, Search button and I'm feeling Lucky button. I have to do this using Java. Where do I start? I had an idea, which was to actually navigate to a page, read its HTML source and build an xpath query to find each element and get its attributes. But how do I accomplish this navigation using Java (or jQuery as well, if that's possible)? It may sound as if I'm trying to build an automation tool from the scratch, but I'm just considering all possibilities. Please help.
tagged with: web
has comment: http://stackoverflow.com/comment/32900829
has title: Navigate to and learn all the web objects on a page using Java (without Selenium)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32901723
has answer: http://stackoverflow.com/a/21752163
accepted answer: http://stackoverflow.com/a/21752163
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/32902614
possible better answer: http://stackoverflow.com/a/21753077
type: Question
has answer: http://stackoverflow.com/a/21753077
tagged with: automation
has comment: http://stackoverflow.com/comment/32902460

http://stackoverflow.com/q/21727187
score: 0
tagged with: classnotfoundexception
answer count: 1
has comment: http://stackoverflow.com/comment/32858154
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32857612
tagged with: android
tagged with: java
has title: GIFDecoder showing error while running
has comment: http://stackoverflow.com/comment/32858095
type: Question
has comment: http://stackoverflow.com/comment/32858228
has body: I tried to use the GIF Decoder class to animate GIF file. I followed this tutorial. Now the code is not showing any error but at runtime its crashing saying java.lang.RuntimeException exception. Here is my code: MainActivity.java public class MainActivity extends Activity { InputStream stream = null; { try { stream = getAssets().open("piggy.gif"); } catch (IOException e) { e.printStackTrace(); } } } GIFDecoderView.java public class GifDecoderView extends ImageView { public GifDecoderView(Context context, InputStream stream) { super(context); playGif(stream); } private boolean mIsPlayingGif = false; private GifDecoder mGifDecoder; private Bitmap mTmpBitmap; final Handler mHandler = new Handler(); final Runnable mUpdateResults = new Runnable() { public void run() { if (mTmpBitmap != null &amp;&amp; !mTmpBitmap.isRecycled()) { GifDecoderView.this.setImageBitmap(mTmpBitmap); } } }; private void playGif(InputStream stream) { mGifDecoder = new GifDecoder(); mGifDecoder.read(stream); mIsPlayingGif = true; new Thread(new Runnable() { public void run() { final int n = mGifDecoder.getFrameCount(); final int ntimes = mGifDecoder.getLoopCount(); int repetitionCounter = 0; do { for (int i = 0; i &lt; n; i++) { mTmpBitmap = mGifDecoder.getFrame(i); final int t = mGifDecoder.getDelay(i); mHandler.post(mUpdateResults); try { Thread.sleep(t); } catch (InterruptedException e) { e.printStackTrace(); } } if(ntimes != 0) { repetitionCounter ++; } } while (mIsPlayingGif &amp;&amp; (repetitionCounter &lt;= ntimes)); } }).start(); } } And the 3rd class is GifDecoder.java. Do we have to mention these classes in Manifest also.? I have done nothing. Here is Manifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.giftester" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /&gt; &lt;application android:allowBackup="true" androi…
tagged with: http://stackoverflow.com/tag/gif
has comment: http://stackoverflow.com/comment/32858173
has answer: http://stackoverflow.com/a/21727519

http://stackoverflow.com/comment/32820022
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21706151
type: AnswerComment
has text: You need to use `getPassword()`. Check it out [here](http://docs.oracle.com/javase/7/docs/api/javax/swing/JPasswordField.html). Always check documentation.

http://stackoverflow.com/a/21774168
answers question: http://stackoverflow.com/q/21771745
type: Answer
has body: I'm pretty sure you cannot do this. It would be better to determine first in which situations you would take a different path through your web application. Based on that you can put together a test plan with Switch/Interleave/Random controllers so you can take a different path. Also there are post processors that you can use to parse responses and script your own functions so you can base your input for the next request on that. I don't see why you would have to put together a test plan at runtime?
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/64036325
downvote count: 0

http://stackoverflow.com/q/21786478
tagged with: jcomponent
type: Question
score: -2
answer count: 2
has body: java.util.Date tempin = pLabIn.getDate(); System.out.println(tempin); java.util.Date tempout = pLabOut.getDate(); java.sql.Date labIn = new java.sql.Date(tempin.getTime()); System.out.println(labIn); java.sql.Date labOut = new java.sql.Date(tempout.getTime()); The first System.out shows "Thu Feb 27 22:50:06 PKT 2014" and the second "2014-02-27" So it miss time. I want to take time as well.
upvote count: 0
favorite count: 0
has title: When i convert java.util.Date to java.sql.Date i mis the time, can i do that convergance with time?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21786549
has answer: http://stackoverflow.com/a/21786554
tagged with: java
downvote count: 2

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

http://stackoverflow.com/comment/32903501
type: Comment
has text: it worked thanks very much :D , but i wounder what will happen it subtracts from Zero ... it will return an sql exception or so right !
comment on: http://stackoverflow.com/a/21744377
type: AnswerComment
score: 0

http://stackoverflow.com/a/21829925
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21789787
downvote count: 0
has body: Here is a solution with a list: import java.util.LinkedList; class Solution { public int solution(String S) { LinkedList&lt;Character&gt; stack = new LinkedList&lt;&gt;(); for (int i = 0; i &lt; S.length(); i++) { char c = S.charAt(i); if (c == '{' || c == '[' || c == '(') { stack.push(c); } else { if (stack.isEmpty()) { return 0; } char preceding = stack.pop(); if (c == ')' &amp;&amp; preceding != '(') { return 0; } if (c == ']' &amp;&amp; preceding != '[') { return 0; } if (c == '}' &amp;&amp; preceding != '{') { return 0; } } } return stack.isEmpty() ? 1 : 0; } }

http://stackoverflow.com/comment/32993117
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21802181
has text: First thing to do is try it against a 5.10-SNAPSHOT build, we've been working hard to make AMQP better for the next release.

http://stackoverflow.com/comment/33018206
has text: Using a fix FrameTime 1.0f/60.0f still didnt work so there must be something wrong with my code.
comment on: http://stackoverflow.com/q/21796986
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32899734
has text: Try to replace the [Postgres-specific (`::`) type cast](http://www.postgresql.org/docs/current/static/sql-expressions.html#SQL-SYNTAX-TYPE-CASTS) with a SQL-standard one - `CAST ('2013-01-01' AS DATE)` (or `DATE '2013-01-01'`).
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21750708

http://stackoverflow.com/comment/33011991
type: Comment
comment on: http://stackoverflow.com/a/21813885
score: 0
type: AnswerComment
has text: Your code seems way to complicated for this task, I have thought of something like for (int i = startIndex; i > 0; i++) { if (!string.charAt(i).equals(" ") { endIndex = i; break; } } int numSpaces = startIndex - endIndex;

http://stackoverflow.com/q/21735940
favorite count: 0
has comment: http://stackoverflow.com/comment/32872737
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/32872875
tagged with: http
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32873850
has answer: http://stackoverflow.com/a/21736193
type: Question
tagged with: apache
has title: Upload a file from java client to a apache http server
downvote count: 3
has body: I'm trying to upload a "myfile.txt" file into the apache server(WAMP) as "uploaded.txt" using apache HttpClient api but i'm getting "404 not found" status. public class Httpupload1 { public static void main(String[] args) throws Exception { String url = "http://username:password@localhost/uploaded.txt"; DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); MultipartEntity entity = new MultipartEntity(); ContentBody body = new FileBody( new File("C:/Users/username/Desktop/myfile.txt"), ContentType.APPLICATION_OCTET_STREAM ); entity.addPart("file", body); httppost.setEntity(entity); HttpResponse response = httpclient.execute(httppost); System.out.println(response.getStatusLine()); } }
answer count: 1

http://stackoverflow.com/comment/95443044
type: Comment
comment on: http://stackoverflow.com/a/45587003
score: 0
type: AnswerComment
has text: Very useful. This is discussed in more details at https://stackoverflow.com/questions/11484353/gson-throws-malformedjsonexception

http://stackoverflow.com/comment/33058565
has text: This is bizarre, as String most certainly has a compareTo(String) method. Have you tried compiling from the command line with javac?
type: Comment
comment on: http://stackoverflow.com/q/21839989
score: 0
type: QuestionComment

http://stackoverflow.com/q/21731099
tagged with: try-catch
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32864357
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/32863907
accepted answer: http://stackoverflow.com/a/21731164
has body: I know that for many of you this can be a stupid question, but I'm learning android/java and I still have some concepts unclear. In this case, I'm not sure on what is the best way to use the return statement within a try/catch block. This is how I have declared my method where I need to use this: public JSONArray parseXmlResponse(String response) { JSONArray addressComp = null; JSONObject jsonObject = new JSONObject(); try { jsonObject = new JSONObject(response); addressComp = jsonObject.getJSONArray("results").getJSONObject(0).getJSONArray("address_components"); }catch (JSONException e) { e.printStackTrace(); } return addressComp; } As far as I know, here the method is always returning "addressComp", even if it is null. But I've seen that other people would do it in this other way: public JSONArray parseXmlResponse(String response) { JSONArray addressComp = null; JSONObject jsonObject = new JSONObject(); try { jsonObject = new JSONObject(response); addressComp = jsonObject.getJSONArray("results").getJSONObject(0).getJSONArray("address_components"); return addressComp; }catch (JSONException e) { e.printStackTrace(); } return null; } But this makes me a bit confused. By setting the return null here won't set the value to return always as null even if addressComp has a real value?
has comment: http://stackoverflow.com/comment/32863916
tagged with: return
has title: Return statement with try/catch
upvote count: 1
possible better answer: http://stackoverflow.com/a/21731305
has answer: http://stackoverflow.com/a/21731305
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32863844
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32864403
has answer: http://stackoverflow.com/a/21731164
type: Question

http://stackoverflow.com/q/21733963
has comment: http://stackoverflow.com/comment/32869636
has comment: http://stackoverflow.com/comment/32869664
has comment: http://stackoverflow.com/comment/32869700
downvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/21734168
upvote count: 0
has body: I'm making a grade book that asks what user wants to do, then asks for a selected name, then asks what grades they want to enter. It's coming out nicely, but I cannot get it to store and add the numbers that the users enter. It asks them to enter a number then enter -1 to quit. Then it should add the numbers together and display them, but everytime the program outputs: "The total of the numbers is -1" It doesn't seem to be storing any numbers except for the last number entered, which is -1 because that's what they type at the end. Help? import java.util.Scanner; public class Assignment3 { public static void main( String[] args ) { Scanner input = new Scanner( System.in ); int homeworkGrades; int quizGrades; int testGrades; int choice; int total; double average; String name; total = 0; homeworkGrades = 0; System.out.println( "Enter 1 or 2: \n 1 - Average grades \n 2 - Quit" ); choice = input.nextInt(); if ( choice == 1 ) { System.out.println( "Enter the students name" ); name = input.next(); System.out.println( " What would you like to do? \n 1 - Homework grades \n 2 - Quiz grades \n 3 - Test grades " ); choice = input.nextInt(); while ( choice != -1 ) { System.out.println( "Enter a homework grade. Press -1 when finished" ); homeworkGrades += input.nextInt(); } if ( choice == -1 ) System.out.println("Total for homework grades is " + homeworkGrades ); total = total + homeworkGrades ; } else if ( choice == 2 ) { System.out.println( "Exiting program" ); } else { System.out.println( "Invalid response, exiting program." ); } } }
favorite count: 0
has comment: http://stackoverflow.com/comment/32869450
has comment: http://stackoverflow.com/comment/32869494
has comment: http://stackoverflow.com/comment/32870242
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21734168
tagged with: java
has comment: http://stackoverflow.com/comment/32869224
possible better answer: http://stackoverflow.com/a/21734115
score: -4
has answer: http://stackoverflow.com/a/21734115
has title: User-enter values are not being stored properly
type: Question
has comment: http://stackoverflow.com/comment/32869483
has answer: http://stackoverflow.com/a/21734152

http://stackoverflow.com/comment/32940687
has text: I guess I misunderstood the usage a bit. I will look at Spring MVC test framework without Rest Assured and try some of your examples.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21686584

http://stackoverflow.com/comment/32992898
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21802801
has text: I know you can ask it if it is a Directory or a File. Though I am not sure how to ask it if there is any readable file in a folder or if I can access the folder itself.

http://stackoverflow.com/a/32459685
score: 0
type: Answer
has body: try this. String myData= "{ ... }"; Object json = new JSONTokener(myData).nextValue(); if (json instanceof JSONObject) //This is object else if (json instanceof JSONArray) //This is array It will work fine
answers question: http://stackoverflow.com/q/21811110

http://stackoverflow.com/q/21726932
has comment: http://stackoverflow.com/comment/32856230
tagged with: java
has comment: http://stackoverflow.com/comment/32857179
has body: I'm reading a book about OPENGL ES development. I came across to this sentence. A float in Java has 32 bits of precision, while a byte has 8 bits of precision. This might seem like an obvious point to make, but there are 4 bytes in every float. What exactly does that mean? Is this important to know in Android game development?
has title: 32-bit of precision, what does it mean?
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/75855248
has comment: http://stackoverflow.com/comment/32856119
has answer: http://stackoverflow.com/a/75855248
has comment: http://stackoverflow.com/comment/32857906
tagged with: precision
has comment: http://stackoverflow.com/comment/32856104
favorite count: 0
has answer: http://stackoverflow.com/a/21727431
has comment: http://stackoverflow.com/comment/32856124
type: AnsweredQuestion
score: 1
tagged with: floating-point
upvote count: 1
accepted answer: http://stackoverflow.com/a/21727431
type: Question
tagged with: ieee-754
has comment: http://stackoverflow.com/comment/32856082

http://stackoverflow.com/a/21730951
score: 0
answers question: http://stackoverflow.com/q/21727346
has body: use # if you want to ignore 0 new DecimalFormat("###,#0.00").format(d)
type: Answer

http://stackoverflow.com/comment/32957312
type: AnswerComment
score: 0
type: Comment
has text: hm that will just print <type xmlns=""> not <type>
comment on: http://stackoverflow.com/a/21781471

http://stackoverflow.com/q/21723183
possible better answer: http://stackoverflow.com/a/22567567
tagged with: spring
score: 18
has answer: http://stackoverflow.com/a/22567567
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32891558
has comment: http://stackoverflow.com/comment/32854833
has answer: http://stackoverflow.com/a/26882099
tagged with: java
tagged with: resttemplate
has comment: http://stackoverflow.com/comment/32865717
type: Question
upvote count: 18
has title: Spring RestTemplate to POST request with Custom Headers and a Request Object
accepted answer: http://stackoverflow.com/a/26882099
answer count: 3
downvote count: 0
has body: In Spring RestTemplate is there a way to send Custom Headers together with a POST Request Object. I have already tried out the exchange method which is available. It seems that we can send key value pairs together with a custom headers but not a request object itself attached to the HttpEntity. The following code illustrates the attempt and it seems to be 400 BadRequest for the server. HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setContentType(MediaType.APPLICATION_JSON); HttpEntity&lt;?&gt; httpEntity = new HttpEntity&lt;Object&gt;(requestDTO, requestHeaders); RestTemplate restTemplate = new RestTemplate(); restTemplate.exchange(URL, HttpMethod.POST, httpEntity, SomeObject.class); Anyone aware about this situation ? Or is it something which is not possible that Im trying to do ?
favorite count: 0
has answer: http://stackoverflow.com/a/22762451
tagged with: rest
has comment: http://stackoverflow.com/comment/32891595

http://stackoverflow.com/comment/33009496
comment on: http://stackoverflow.com/q/21812554
score: 0
has text: What does synchronizing have to do with it?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21801110
answer count: 1
has answer: http://stackoverflow.com/a/21801764
tagged with: network-programming
tagged with: java
has body: So I'm building a fairly simple file transfer server/client but having a hard time to figure out a good design for processing different commands and states within the protocol.. Say that you have 3 different commands upload, remove, download, you could use 3 different if-statements and keep track of states with additional if-statements, but that wont scale and will be impossible to maintain.. The Chain Of Responsibility design pattern could be used for sequential stuff such as encryption and compression, but it wont take care of the logic for commands. I know that this is a quite broad question, but does anyone have any suggestions?
type: UnansweredQuestion
has title: Design patterns for network protocols?
has comment: http://stackoverflow.com/comment/32989085
downvote count: 0
score: 1
favorite count: 0
tagged with: protocols
type: Question
upvote count: 1
tagged with: design-patterns

http://stackoverflow.com/a/21788930
has comment: http://stackoverflow.com/comment/33026867
has comment: http://stackoverflow.com/comment/32968057
type: Answer
has body: I don't think you're missing anything. There are no APIs in that list that return a single bucket. The Ruby SDK seems to do what you want. http://docs.aws.amazon.com/AWSRubySDK/latest/frames.html Before you can upload files to S3, you need to create a bucket. s3 = AWS::S3.new bucket = s3.buckets.create('my-bucket') If a bucket already exists, you can get a reference to the bucket. bucket = s3.buckets['my-bucket'] # no request made
answers question: http://stackoverflow.com/q/21760739
score: 0

http://stackoverflow.com/comment/32853453
has text: Simply take a look at http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains :-)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21725123

http://stackoverflow.com/a/21808342
has body: You can't really use modulo division here because you aren't keeping track of the number of times you have printed a number. Simply add a counter, and place a new line every time that counter is equal to 10. For example: int counter=0; for(int i=100;i&lt;=1000; i++) { if(i % 5==0 &amp;&amp; i % 6==0) { System.out.print(i +" "); counter++; } if(counter==10) { System.out.println(); counter=0; } Corrected for cross system compatibility Version without counter (wont work for all sets of numbers) for(int i=100;i&lt;=1000; i++) { if(i % 5==0 &amp;&amp; i % 6==0) System.out.print(i +" "); if(i!=100 &amp;&amp; (i - 100) % 300 == 0) System.out.println(); }
has comment: http://stackoverflow.com/comment/33002246
accepted answer of: http://stackoverflow.com/q/21808315
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33002141
answers question: http://stackoverflow.com/q/21808315
score: 8
type: Answer
has comment: http://stackoverflow.com/comment/33002162
downvote count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/33002131

http://stackoverflow.com/comment/32907388
type: AnswerComment
has text: Use * for example /items/*
comment on: http://stackoverflow.com/a/21735312
type: Comment
score: 0

http://stackoverflow.com/a/21767699
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32932936
has comment: http://stackoverflow.com/comment/32934360
type: Answer
accepted answer of: http://stackoverflow.com/q/21767292
score: 6
upvote count: 6
has body: Your Tester class actually has an implicit parameter (because of the [T : Manifest] type boundary. The syntax you use is sugar for // Scala Class class Tester[T](someData: String, initValue: T)(implicit man: Manifest[T]){...} When that gets compiled, the two argument lists are condensed to one, so you end up with the java equivalent of //Java Constructor public Tester(String someData, T initValue, Manifest&lt;T&gt; man){...} You can see the type signature by running the javap command on the Tester.class file that gets generated by the scala compiler. So if you are trying to use the Tester class from Java, you have to explicitly figure out the parameter that scala's compiler would normally figure out for you. Looking at the scaladocs, it looks like ManifestFactory is where you need to go to create Manifest instances. So your java code would look something like Manifest&lt;Integer&gt; man = ManifestFactory$.MODULE$.classType(Integer.class); Tester&lt;Integer&gt; tester = new Tester&lt;Integer&gt;("data", 123, man);
answers question: http://stackoverflow.com/q/21767292
has comment: http://stackoverflow.com/comment/32930702

http://stackoverflow.com/q/21806642
has title: Messaging service between Android devices
score: 0
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21806764
tagged with: java
has body: I want to develop an application where multiple android devices share the same application if (let's say) one device writes a message and stores it, it get's updated on all the other devices sharing the application. The details of what the app does doesn't matter, I only want to know how this would be implemented. My idea would be for a socket from each device connected to a mutual server and each device constantly updating and waiting. Would this be the correct approach? Thanks! Any other information would be great :D
type: Question
answer count: 1

http://stackoverflow.com/comment/33706003
has text: Can you kick out that SimpleModule-stuff and try it with the `ObjectMapper#getSerializationConfig()` and `ObjectMapper#getDeserializationConfig()`? I tried that before but it simply doesn't work on the first try. Where do you register that SimpleModule?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22043703

http://stackoverflow.com/a/26237478
has comment: http://stackoverflow.com/comment/41175860
has comment: http://stackoverflow.com/comment/41161907
has comment: http://stackoverflow.com/comment/41248535
has body: ShapeRenderer has a method called rectLine() that draws a line with a specified thickness. It is exactly what you're looking for with your line thickness question. You will also want to change sr.begin(ShapeType.Line) to sr.begin(ShapeType.Filled) if (Gdx.input.isTouched()) { ShapeRenderer sr = new ShapeRenderer(); sr.setColor(Color.BLACK); sr.setProjectionMatrix(camera.combined); sr.begin(ShapeType.Filled); sr.rectLine(player.getLeft().x, player.getLeft().y, Global.game_touch_position.x, Global.game_touch_position.y, desired_thickness); sr.rectLine(player.getRight().x, player.getRight().y, Global.game_touch_position.x, Global.game_touch_position.y, desired_thickness); sr.end(); }
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/41156703
answers question: http://stackoverflow.com/q/21835062
type: Answer
has comment: http://stackoverflow.com/comment/41175878
score: 1

http://stackoverflow.com/q/21691785
has comment: http://stackoverflow.com/comment/32795967
answer count: 1
has answer: http://stackoverflow.com/a/21692849
downvote count: 0
has comment: http://stackoverflow.com/comment/32795969
tagged with: layout-manager
favorite count: 0
has body: So I'm adding this code to a JFrame which has other layout managers and components in them. private JPanel testing123() { JPanel j = new JPanel(new FlowLayout()); jbtOk = new JButton("OK"); jbtOk.setMnemonic('K'); jbtExit = new JButton("Exit"); jbtExit.setMnemonic('x'); add(jbtOk); add(jbtExit); j.add(jbtOk); j.add(jbtExit); return j; } Without this code, the JFrame looks fine, but when I add it, it adds a large amount of empty space under these two buttons. Why is this happening? This replicates it: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.TitledBorder; public class Test extends JFrame implements ActionListener, KeyListener { JButton jbtOk, jbtExit; JPanel p = new JPanel(new GridLayout(0,1)); JPanel gui = new JPanel(new BorderLayout(2,2)); public Test() { super("t"); //setSize(300,300); setVisible(true); JPanel test = test(); JPanel testing = testing(); JPanel testing123 = testing123(); p.add(test); p.add(testing); p.add(testing123); this.getContentPane().add(p); pack(); } private JPanel test() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel labelFields = new JPanel(new BorderLayout(2,2)); labelFields.setBorder(new TitledBorder("m")); p.add(gui); p.add(labelFields); JPanel labels = new JPanel(new GridLayout(0,1,1,1)); labels.setBorder(new TitledBorder("a")); JPanel fields = new JPanel(new GridLayout(0,1,1,1)); fields.setBorder(new TitledBorder("b")); p.add(labels); p.add(fields); add(fields); add(p); return gui; } private JPanel testing() { JPanel guiCenter = new JPanel(new FlowLayout(FlowLayout.CENTER)); guiCenter.setBorder(new TitledBorder("n")); guiCenter.add(new JScrollPane(new JTextArea(5,30))); gui.add(guiCenter, BorderLayout.CENTER); return guiCenter; } private JPanel testing123() { JPanel j = new JPanel(new FlowLayout()); jbtOk = new JButton("OK"); jbtOk.setMnemonic('K'); jbtExit = new JButton("Exit"); jbtExit.setMnemonic('x'); //add(jbtOk); //add(jbtExit); j.add(jbtOk); j.add(jbtExit); return…
has comment: http://stackoverflow.com/comment/32795857
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21692849
upvote count: 2
has comment: http://stackoverflow.com/comment/32796428
has comment: http://stackoverflow.com/comment/32796349
tagged with: swing
has comment: http://stackoverflow.com/comment/32795810
has title: Why is extra space being added to the frame?
type: Question
has comment: http://stackoverflow.com/comment/32799576
has comment: http://stackoverflow.com/comment/32794855
tagged with: java
has comment: http://stackoverflow.com/comment/32795789
has comment: http://stackoverflow.com/comment/32795028
has comment: http://stackoverflow.com/comment/32794978
score: 2

http://stackoverflow.com/comment/32906507
comment on: http://stackoverflow.com/q/21754462
score: 0
type: Comment
type: QuestionComment
has text: @MarounMaroun: You're right, but I also want the result to be a float. I wasn't clear about it when posting the question, but I've made an edit to make it explicit.

http://stackoverflow.com/comment/33023917
has text: Sorry forgot to include that let me edit the question for clarification
comment on: http://stackoverflow.com/q/21820476
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32805722
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21696253
score: 0
has text: I really want to know what's the relationship between the thread in jvm and linux thread or system thread and what's the corresponding to java thread in linux system?Why the Android can use linux IPC and epoll to control java thread to be waited or blocked in native by JNI.

http://stackoverflow.com/q/21767103
has comment: http://stackoverflow.com/comment/32929288
tagged with: motionevent
possible better answer: http://stackoverflow.com/a/21767353
has answer: http://stackoverflow.com/a/21767353
has body: I have one EditText and one FrameLayout. I made it in a way where if the user drags within the FrameLayout, the background changes the color (RGB) based on the pixel from (X,Y) coordinate and also updates the EditText with the Hex value converted from the RGB values. Here is the Pastebin link for my entire code: http://pastebin.com/7P3QSmb4 The issue I am having is with the following code: if (s.length() == 6) { int color = Integer.parseInt(etHexVal.getText().toString(), 16); int r = (color &gt;&gt; 16) &amp; 0xFF; int g = (color &gt;&gt; 8) &amp; 0xFF; int b = (color &gt;&gt; 0) &amp; 0xFF; getXY(r, g, b); hexToRGB(); InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(etHexVal.getWindowToken(), 0); } I want to call the function getXY(r, g, b) only when the text of the EditText is changed and I am not dragging within the FrameLayout, because otherwise it would make my app lag. How can I modify my existing code?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21767908
has title: How to call a function only certain time
type: Question
tagged with: android-framelayout
tagged with: android
has comment: http://stackoverflow.com/comment/32929018
accepted answer: http://stackoverflow.com/a/21767908
score: 0
tagged with: java
answer count: 2

http://stackoverflow.com/a/21719362
has body: Using getApplicationVersion() as mentioned by khmarbaise has been deprecated, getMavenVersion() is the recommended function to be used. You need to include maven-core 3.0.2 or higher as a dependency to use the RuntimeInformation class. here is the complete usage example, Required pom dependency org.apache.maven maven-core 3.0.2 Package import import org.apache.maven.rtinfo.RuntimeInformation; Usage /** * * @component */ private RuntimeInformation runtime; public void execute() { String version = runtime.getMavenVersion(); getLog().info("Maven Version: " + version); ... } @khmarbaise, Thanks for pointing me in the right direction
type: Answer
accepted answer of: http://stackoverflow.com/q/21697359
downvote count: 0
answers question: http://stackoverflow.com/q/21697359
score: 1
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/q/21713724
tagged with: java
has comment: http://stackoverflow.com/comment/32834789
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/2888508
tagged with: eclipse
has answer: http://stackoverflow.com/a/21714125
has comment: http://stackoverflow.com/comment/32834273
has comment: http://stackoverflow.com/comment/32834342
has body: I am new to Android, so please dont be very harsh, I am writing an application that simply displays a triangle on the android emulator screen, I have written a Triangle class and tested the picture in eclipse console! and it displayed perfectly however when I launch it in the emulator my triangle is off! I have tried using various layouts, but nothing seems to solve the problem. Please help layout &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/text1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; Activity class protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView text = (TextView) this.findViewById(R.id.text1); Triangle triangle = null; try { triangle = new Triangle (20); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } text.setText(triangle.toString()); // text.setText("HERE SHOULD BE A TRIANGLE"); }
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32834471
has comment: http://stackoverflow.com/comment/32835869
favorite count: 0
has comment: http://stackoverflow.com/comment/32834254
tagged with: android
accepted answer: http://stackoverflow.com/a/21714125
has title: Strings displayed differently in android and eclipse console
has comment: http://stackoverflow.com/comment/32834718
has comment: http://stackoverflow.com/comment/32834380
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32834213
has comment: http://stackoverflow.com/comment/32834431
score: 1

http://stackoverflow.com/a/21688412
downvote count: 0
has body: Your problem is that you're creating a new MenuApp object for each person, and each MenuApp object has its own tableTotal field. Possible solutions: Create just one MenuApp object and change its state, perhaps the text on a JLabel, for each new person. Or if you absolutely have to create a new MenuApp for each person, then do so, place it in a modal JDialog, not a JFrame, and when the dialog completes have the calling code query it for its total and then add it to a tableTotal field.
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32790626
answers question: http://stackoverflow.com/q/21688332
type: Answer
accepted answer of: http://stackoverflow.com/q/21688332
score: 3

http://stackoverflow.com/comment/32903580
type: Comment
type: QuestionComment
has text: You could you Guava and Lists.transform. [link](http://stackoverflow.com/questions/7383624/how-to-transform-listx-to-another-listy)
score: 0
comment on: http://stackoverflow.com/q/21753220

http://stackoverflow.com/q/21717566
has body: We have an application running on weblogic. For some reason after "hooking" on a monitoring tool the web application stop responding with a 404 when an url is invalid. Is not a big problem but we would like to understand what could cause the issue in terms of settings? What should we look out for. 404 Not Found The requested resource could not be found but may be available again in the future.[2] Subsequent requests by the client are permissible. weblogic log ####&lt;Jan 30, 2014 12:13:24 PM CST&gt; &lt;Debug&gt; &lt;Http&gt; &lt;xxxx.xxx.xxx&gt; &lt;advisors-ext-1&gt; &lt;ExecuteThread: '3' for queue: 'weblogic.socket.Muxer'&gt; &lt;&lt;WLS Kernel&gt;&gt; &lt;&gt; &lt;&gt; &lt;1391105604570&gt; &lt;BEA-000000&gt; &lt;[HTTP:101147]HttpServer (defaultWebserver) name: advisors-ext-1 Found no context for "/". This request does not match the context path for any installed Web applications, and there is no default Web application configured.&gt; ####&lt;Jan 30, 2014 12:13:24 PM CST&gt; &lt;Debug&gt; &lt;Http&gt; &lt;xxxx.xxx.xxx&gt; &lt;advisors-ext-1&gt; &lt;[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'&gt; &lt;&lt;WLS Kernel&gt;&gt; &lt;&gt; &lt;&gt; &lt;1391105604571&gt; &lt;BEA-000000&gt; &lt;HttpRequest@590351528 - /: Writing headers for HttpRequest@590351528 - /&gt; ####&lt;Jan 30, 2014 12:13:24 PM CST&gt; &lt;Debug&gt; &lt;Http&gt; &lt;xxxx.xxx.xxx&gt; &lt;advisors-ext-1&gt; &lt;[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'&gt; &lt;&lt;WLS Kernel&gt;&gt; &lt;&gt; &lt;&gt; &lt;1391105604571&gt; &lt;BEA-000000&gt; &lt;HttpRequest@590351528 - /: Writing headers for HttpRequest@590351528 - /&gt;
has answer: http://stackoverflow.com/a/21717815
type: Question
tagged with: http-status-code-404
has title: What will cause an 404 error to be consumed?
answer count: 1
score: 0
tagged with: java
tagged with: weblogic
type: UnansweredQuestion

http://stackoverflow.com/a/21836998
answers question: http://stackoverflow.com/q/21836891
has body: Your nextPrime method returns num whether or not it is prime. Your code is effectively: if(isPrime(num)) return num; } return num;
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21706215
tagged with: java.util.scanner
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32819916
has comment: http://stackoverflow.com/comment/32830937
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/67830504
has title: Scanner inputs messing up with the chat client
has comment: http://stackoverflow.com/comment/119916834
has comment: http://stackoverflow.com/comment/32832341
has body: I am trying to make a very simple console chat with a server and multiple clients using RMI, just for fun. For the client a menu is shown and an input is expected. Meanwhile, there's a thread running in a loop listening for petitions. If some other client wants to chat with this one, he will receive a notification and he has to decide whether to chat with this other client or not to. And here is the problem. The menu is waiting for an input, and now the notification is waiting for a different one. So we have two, but I just want to give a response to the second one, I want to ignore the first one and whatever input I type goes to the notification choice. How can I "destroy" the first waiting input so the client can just respond to that notification?
has comment: http://stackoverflow.com/comment/32832237
answer count: 2
has answer: http://stackoverflow.com/a/67844006
has comment: http://stackoverflow.com/comment/32831246
has comment: http://stackoverflow.com/comment/119916870
favorite count: 0
has comment: http://stackoverflow.com/comment/32820041

http://stackoverflow.com/comment/32935465
has text: Yes I did the same thing. But I am getting duplicate values in my key.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21748197
type: AnswerComment

http://stackoverflow.com/comment/32873743
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21736007
has text: if the button is disable, and the user clicks on the button nothing happens
score: 0

http://stackoverflow.com/comment/33162702
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21888704
has text: I got the API from AddToTree class as guiPackage.getTreeModel().addComponent(testelement, parentnode)
score: 0

http://stackoverflow.com/q/21733974
tagged with: android
has answer: http://stackoverflow.com/a/21734083
has answer: http://stackoverflow.com/a/21734228
has title: Null Pointer Exception JsonArray Size
has body: While retrieving objects from a Json file for an Android App, I am getting a NullPointerException when I try to access to the size of a Json Array. Here is one Json Object of the "results" array: results: [ { aliases: null, api_detail_url: "http://www.giantbomb.com/api/game/3030-26559/", date_added: "2009-05-22 10:03:31", date_last_updated: "2014-01-14 08:27:36", deck: "All three Metroid Prime titles in one package. Metroid Prime and Metroid Prime 2: Echoes are reworked to include 480p widescreen, motion controls, and achievements.", description: " Overview Metroid Prime Trilogy is a single-disc compilation for the Nintendo Wii consisting of Metroid Prime, Metroid Prime 2: Echoes, and Metroid Prime 3: Corruption. The first two games in the series, originally released for the Nintendo GameCube, have been updated with 480p widescreen support, improved graphic effects, and motion controls similar to those found in Metroid Prime 3.", expected_release_day: null, expected_release_month: null, expected_release_quarter: null, expected_release_year: null, id: 26559, image: {}, name: "Metroid Prime Trilogy", number_of_user_reviews: 3, original_game_rating: [], original_release_date: "2009-08-24 00:00:00", platforms: [ { api_detail_url: "http://www.giantbomb.com/api/platform/3045-36/", id: 36, name: "Wii", site_detail_url: "http://www.giantbomb.com/wii/3045-36/", abbreviation: "WII" } ], site_detail_url: "http://www.giantbomb.com/metroid-prime-trilogy/3030-26559/", resource_type: "game" } I'm trying to get the size of "platforms", just because a game can be played, for example, both on PC and MAC: if (response != null && response.length() > 0) { Log.d(com.example.ludos2_0.MainActivity.TAG, "Response: " + response); JsonObject jsonObject = (JsonObject) parser.parse(response); JsonArray items = jsonObject.getAsJsonArray("results"); String id = null; String title = null; String thumbnail = null; String description = null; String image = null; String platform = null; //ArrayList<S…
accepted answer: http://stackoverflow.com/a/21734062
has comment: http://stackoverflow.com/comment/32869320
has comment: http://stackoverflow.com/comment/32869447
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/21734083
has answer: http://stackoverflow.com/a/21734062
type: Question
answer count: 3
score: 0

http://stackoverflow.com/a/21705953
has comment: http://stackoverflow.com/comment/32821325
type: Answer
answers question: http://stackoverflow.com/q/21705769
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32820187
has body: First, you have no choice but to wrap below lines into a try-catch: w.write("Test string"); w.newLine(); as they are both capable of throwing IOExceptions (you can alternatively declare a throws clause though). In Eclipse, I don't see any reason that the IDE will complain that w can be null, as you've already explicitly initialized it.
has comment: http://stackoverflow.com/comment/32819738
downvote count: 0
has comment: http://stackoverflow.com/comment/32819559
has comment: http://stackoverflow.com/comment/32821741

http://stackoverflow.com/comment/32933772
comment on: http://stackoverflow.com/a/21763234
type: AnswerComment
score: 0
type: Comment
has text: well you can use loop but I wrote it just to simplify. :) Doesn't matter if you want integers, string or any other input array. the solution holds.

http://stackoverflow.com/q/21793422
has answer: http://stackoverflow.com/a/21793449
accepted answer: http://stackoverflow.com/a/21793449
tagged with: android
tagged with: sqlite
possible better answer: http://stackoverflow.com/a/21793447
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21793447
score: 1
tagged with: java
has body: I am struggling with some SQLite stuff. Pretty much, 'value' is a string value that contains the column I want to select in 'CompletedRow'. When I set the value of 'status' (a textview) to the cursor, it returns the text 'CompletedRow'. This is my code: Cursor indexCursor = db.rawQuery("SELECT 'CompletedRow' FROM MyChallenges WHERE ChalName = '" + value + "';", null); indexCursor.moveToFirst(); String val = indexCursor.getString(0); status.setText(val);
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has title: Android SQL - Using a cursor to select a value error

http://stackoverflow.com/a/27977926
answers question: http://stackoverflow.com/q/21700565
score: -1
upvote count: 0
type: Answer
has body: Use spring with annotation , You do not need to provides beans explicitly ,You just need to specify the component scan tag in dispatcher-servlet.xml Also add related jars in your pom.xml , Your project will start working , Its nothing to related netbean. Thanks, himanshu
downvote count: 1

http://stackoverflow.com/comment/32997529
score: 0
comment on: http://stackoverflow.com/q/21805824
type: Comment
type: QuestionComment
has text: What would it mean if you had `Collection<name of class>`? It means the exact same thing.

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/21689021
tags question: http://stackoverflow.com/q/21758203
tags question: http://stackoverflow.com/q/21756252
tags question: http://stackoverflow.com/q/21815623
tags question: http://stackoverflow.com/q/21729953
type: Tag
tags question: http://stackoverflow.com/q/21785557
tags question: http://stackoverflow.com/q/21831965
tags question: http://stackoverflow.com/q/21809188
tags question: http://stackoverflow.com/q/21820073
tags question: http://stackoverflow.com/q/21783601
tags question: http://stackoverflow.com/q/21800466
tags question: http://stackoverflow.com/q/21820644
tags question: http://stackoverflow.com/q/21805787
tags question: http://stackoverflow.com/q/21704189
tags question: http://stackoverflow.com/q/21801074
tags question: http://stackoverflow.com/q/21716349
tags question: http://stackoverflow.com/q/21710323

http://stackoverflow.com/comment/32795758
score: 0
type: AnswerComment
has text: Still will not solve the problem. 110% of zero is still zero.
comment on: http://stackoverflow.com/a/21692358
type: Comment

http://stackoverflow.com/a/21771541
type: Answer
answers question: http://stackoverflow.com/q/21771003
has body: Got it here. http://www.careerbless.com/samplecodes/java/beginners/socket/SocketBasic1.php Here server always listen to client. Thank you guys for help.
score: 0

http://stackoverflow.com/comment/32957214
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21783191
type: Comment
has text: @BrianS Then that doesn't solve my problem, I need the state for each service type to be unique, otherwise all my listeners for `Register.LOADED, Login.LOADED, FAQ.LOADED` etc will be fired anytime any service's status is set to `LOADED`

http://stackoverflow.com/comment/33029041
comment on: http://stackoverflow.com/q/21823455
type: QuestionComment
type: Comment
has text: you should use session id to implement lock in that case.
score: 0

http://stackoverflow.com/a/21754450
accepted answer of: http://stackoverflow.com/q/21753267
score: 19
has comment: http://stackoverflow.com/comment/138723059
has comment: http://stackoverflow.com/comment/32907051
has comment: http://stackoverflow.com/comment/32906937
type: AcceptedAnswer
upvote count: 19
type: Answer
answers question: http://stackoverflow.com/q/21753267
downvote count: 0
has body: @RunWith(Cucumber.class) @CucumberOptions( monochrome = true, tags = "@tags", features = "src/test/resources/features/", format = { "pretty","html: cucumber-html-reports", "json: cucumber-html-reports/cucumber.json" }, dryRun = false, glue = "fr.tlasnier.cucumber" ) public class RunCucumber_Test { //Run this }

http://stackoverflow.com/q/21806249
score: 0
tagged with: java
has title: I'm writing pizza order program and I'm supposed to use enum for my crust class?
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/21806275
answer count: 2
accepted answer: http://stackoverflow.com/a/21806275
possible better answer: http://stackoverflow.com/a/21806282
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21806282
has body: I'm writing a pizza order program, which takes pizza orders. This is my Crust class for my pizza program. We were told to use enum, but I've tried this, but I don't think so it works. Crust.java:19: error: incompatible types return crust; ^ required: Crust found: CrustType Crust.java:27: error: cannot find symbol crust = CrustType.type; ^ symbol: variable type location: class CrustType 2 errors public class Crust { private enum CrustType {thin,hand,pan}; //check crust type?? private char size;` `//enum (crustType)` private CrustType crust; public Crust() { size = 'S'; crust = CrustType.thin; } public char getSize() { return size; } //instead of enum public Crust getType() { return crust; } public void setSiz(char size) { this.size = size; } //This class sets the crust (enum) type what the user wants I'm not sure //I'm not sure what type of should I pass to this method? public void setType(int type) { CrustType = type; } }

http://stackoverflow.com/comment/32987943
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21794948
has text: Thanks a lot for the hint, the vector is not void anymore, now!

http://stackoverflow.com/q/21828099
has body: I wish to enter one int and another long ex: 1 and 1000000000, and now I wish to create an array of size 1000000000. And then at each index of array, store int val, ex: arr[100000000] = 4. When I'm trying to do this Netbeans shows me an error in this line: arr = new long[y+1]` and `arr[j] = 0` "Possible Lossy conversion from long to int". Here's my code:- public static void main(String[] args) throws IOException { BufferedReader s = new BufferedReader(new InputStreamReader(System.in)); String[] xe = s.readLine().split(" "); int x = Integer.parseInt(xe[0]); long y = Long.parseLong(xe[1]); long []arr; arr = new long[y+1]; for(long j=0;j&lt;=y;j++) arr[j] = 4; }
accepted answer: http://stackoverflow.com/a/21828177
has answer: http://stackoverflow.com/a/21831739
duplicate of: http://stackoverflow.com/q/51632152
has answer: http://stackoverflow.com/a/65397710
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3038392
has title: Possible Lossy conversion from long to int
possible better answer: http://stackoverflow.com/a/21828225
upvote count: 7
has answer: http://stackoverflow.com/a/21828225
type: Question
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/21828177
answer count: 6
has comment: http://stackoverflow.com/comment/33038864
has answer: http://stackoverflow.com/a/21828214
has answer: http://stackoverflow.com/a/21828284
duplicate of: http://stackoverflow.com/q/3038392
tagged with: long-integer
tagged with: arrays
downvote count: 0
duplicate of: http://stackoverflow.com/q/31382531
favorite count: 0

http://stackoverflow.com/comment/32930314
comment on: http://stackoverflow.com/q/21767982
type: Comment
score: 0
type: QuestionComment
has text: @SotiriosDelimanolis That's another part of the problem... :/

http://stackoverflow.com/a/21743563
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21743473
accepted answer of: http://stackoverflow.com/q/21743473
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32886917
has body: Try something like this: String text = "Its a sunny day today Its not gonna rain today"; Map&lt;String,Integer&gt; map = new HashMap&lt;String, Integer&gt;(); for( String word : text.split(" ")) { Integer i = map.get(word); if( i == null ) { map.put(word, 1); } else { map.put(word, i+1); } }
type: Answer

http://stackoverflow.com/a/21815126
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21815102
accepted answer of: http://stackoverflow.com/q/21815102
has comment: http://stackoverflow.com/comment/33014335
type: AcceptedAnswer
has body: Don't forget indexes are 0 based. So the first element is at index 0 and last is at lenght -1 You could also check for the index being >= 0 in that loop, in case the specified name is invalid.

http://stackoverflow.com/comment/32814572
has text: Does your child blocks contain some images?
score: 0
comment on: http://stackoverflow.com/q/21702971
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21798434
has answer: http://stackoverflow.com/a/21798490
has comment: http://stackoverflow.com/comment/32984047
has answer: http://stackoverflow.com/a/21798725
has comment: http://stackoverflow.com/comment/32992439
tagged with: arrays
has answer: http://stackoverflow.com/a/21798614
has body: To compare two strings in java I used following code String ary[]={"man","john","su"}; String ary1[]={"john","man","su"}; if(Arrays.equals(ary,ary1)) { System.out.println("equal"); } else { System.out.println("not equal"); } It prints "not equal",But this two arrays are having same values. Indeed here the both arrays are same but values positions change. How can I tell that this kind of arrays are same.
score: -1
has comment: http://stackoverflow.com/comment/32984041
duplicate of: http://stackoverflow.com/q/10154305
has comment: http://stackoverflow.com/comment/32984210
has comment: http://stackoverflow.com/comment/32984036
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32984473
accepted answer: http://stackoverflow.com/a/21798814
linked to: http://stackoverflow.com/q/10154305
has comment: http://stackoverflow.com/comment/32984144
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32984348
upvote count: 0
has title: comparing two arrays in java
has answer: http://stackoverflow.com/a/21798814
tagged with: java
possible better answer: http://stackoverflow.com/a/21798490
type: Question

http://stackoverflow.com/q/21726119
upvote count: 17
tagged with: spring-mvc
possible better answer: http://stackoverflow.com/a/21752776
type: AnsweredQuestion
tagged with: java
has title: How to access system properties in Thymeleaf template?
score: 17
type: Question
has comment: http://stackoverflow.com/comment/32901684
tagged with: thymeleaf
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21752776
tagged with: spring-el
tagged with: spring
has answer: http://stackoverflow.com/a/27802117
has body: I need to access system properties in a Thymeleaf template. It would be nice if this was possible so that I don't have to populate the spring mvc model explicitly with properties. I'm trying to use SPEL for this purpose but it's not working. Service name Service name Both of these give me: Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1012E:(pos 17): Cannot index into a null value Even if I try to access a jdk property it gives the same error so I know it's not the fact that the property is missing. What am I doing wrong or is there another way to do this?
accepted answer: http://stackoverflow.com/a/27802117
linked to: http://stackoverflow.com/q/10529229
has comment: http://stackoverflow.com/comment/32893642

http://stackoverflow.com/q/21704189
downvote count: 0
tagged with: swing
tagged with: graphics
type: AnsweredQuestion
score: 1
has title: Java2D Alpha Mapping images
tagged with: java
has body: Using Graphics2D, how can I take a black and white image, and use to define what should and what shouldn't rendered on another image? E.g if I had an image of say, a field, and on that field is a cow, and on another image of the same dimensions I draw a white box on a black background, at the same coordinates of the cow, when rendered in Java the image would be all black, apart from the cow where I had the white box?
has comment: http://stackoverflow.com/comment/32819936
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/32947833
answer count: 1
accepted answer: http://stackoverflow.com/a/21778759
favorite count: 0
has answer: http://stackoverflow.com/a/21778759
linked to: http://stackoverflow.com/q/23966914

http://stackoverflow.com/a/21862945
has body: I had 2 columns with the same name. After fixing that, everything worked fine. ORMLite is wonderful.
accepted answer of: http://stackoverflow.com/q/21809185
upvote count: 1
answers question: http://stackoverflow.com/q/21809185
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/21773175
has comment: http://stackoverflow.com/comment/32939759
type: Answer
answers question: http://stackoverflow.com/q/21772852
has body: There are at least two issues: Provide a full path to mysqldump.exe (e.g. C:\Program Files\MySQL\bin\mysqldump.exe) -p parameter without a password value forces mysqldump to prompt for it. And you don't want it since you running it in a batch mode. Therefore either provide a password -p"your password" or better (and more secure) use an option file to avoid giving the password on the command line. Read more on this End-User Guidelines for Password Security
score: 0

http://stackoverflow.com/comment/32992723
score: 0
comment on: http://stackoverflow.com/q/21802451
type: Comment
type: QuestionComment
has text: Actually I have the code that works, but it is just to different that I can't add just a part of the new code. I think I edited it too much at once

http://stackoverflow.com/comment/32996032
score: 0
type: Comment
type: QuestionComment
has text: Awesome! it works now. Thanks! What made the difference?
comment on: http://stackoverflow.com/q/21804982

http://stackoverflow.com/q/21696579
has comment: http://stackoverflow.com/comment/32806256
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21696691
upvote count: 0
tagged with: java
has title: What is the difference between a static object and static field?
type: Question
has body: I know that a static variable is shared by all the objects of the class. But what about a static object? What is meant by a static object? And what is the difference b/w static object and static field? class B { int a; int b; }; class A { public static void main(String args[]) { static B b=new B(); //what does this statement mean?? } } Any explanation is highly appreciated. if Static B b =new B(); is outside the method then it is compiling....
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/32802813
answer count: 1
has comment: http://stackoverflow.com/comment/32803289
favorite count: 0

jdbc
tags question: http://stackoverflow.com/q/21752386
tags question: http://stackoverflow.com/q/21822268
tags question: http://stackoverflow.com/q/21723963
tags question: http://stackoverflow.com/q/21701078
tags question: http://stackoverflow.com/q/21733300
tags question: http://stackoverflow.com/q/21682374
tags question: http://stackoverflow.com/q/21832619
tags question: http://stackoverflow.com/q/21730939
tags question: http://stackoverflow.com/q/21764700
tags question: http://stackoverflow.com/q/21840798
tags question: http://stackoverflow.com/q/21826352
tags question: http://stackoverflow.com/q/21778657
tags question: http://stackoverflow.com/q/21795119
tags question: http://stackoverflow.com/q/21743680
tags question: http://stackoverflow.com/q/21804982
tags question: http://stackoverflow.com/q/21752156
tags question: http://stackoverflow.com/q/21836087
tags question: http://stackoverflow.com/q/21788443
type: Tag
tags question: http://stackoverflow.com/q/21826724
tags question: http://stackoverflow.com/q/21787035
tags question: http://stackoverflow.com/q/21833573
tags question: http://stackoverflow.com/q/21698344
tags question: http://stackoverflow.com/q/21809185
tags question: http://stackoverflow.com/q/21690747
tags question: http://stackoverflow.com/q/21795451
tags question: http://stackoverflow.com/q/21813084
tags question: http://stackoverflow.com/q/21716839
tags question: http://stackoverflow.com/q/21772901
tags question: http://stackoverflow.com/q/21737884
tags question: http://stackoverflow.com/q/21827474
tags question: http://stackoverflow.com/q/21793414
tags question: http://stackoverflow.com/q/21813069
tags question: http://stackoverflow.com/q/21696619
tags question: http://stackoverflow.com/q/21800518
tags question: http://stackoverflow.com/q/21745313
tags question: http://stackoverflow.com/q/21679585
tags question: http://stackoverflow.com/q/21779161
tags question: http://stackoverflow.com/q/21835981
tags question: http://stackoverflow.com/q/21753904
tags question: http://stackoverflow.com/q/21683212
tags question: http://stackoverflow.com/q/21769224
tags question: http://stackoverflow.com/q/21704544
tags question: http://stackoverflow.com/q/21705677
tags question: http://stackoverflow.com/q/21759739
tags question: http://stackoverflow.com/q/21782821
tags question: http://stackoverflow.com/q/21727925
tags question: http://stackoverflow.com/q/21757191
tags question: http://stackoverflow.com/q/21837462
tags question: http://stackoverflow.com/q/21765177
tags question: http://stackoverflow.com/q/21762748
tags question: http://stackoverflow.com/q/21751906
tags question: http://stackoverflow.com/q/21711085
tag name: jdbc
tags question: http://stackoverflow.com/q/21802152
tags question: http://stackoverflow.com/q/21707689
tags question: http://stackoverflow.com/q/21733072
tags question: http://stackoverflow.com/q/21786573
tags question: http://stackoverflow.com/q/21767230
tags question: http://stackoverflow.com/q/21750429
tags question: http://stackoverflow.com/q/21711309
tags question: http://stackoverflow.com/q/21792332
tags question: http://stackoverflow.com/q/21770137

http://stackoverflow.com/comment/32819046
has text: Don't you mean `T getResultType()` rather than `Command<T> getResultType()` ?
comment on: http://stackoverflow.com/a/21705359
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33094510
has text: Never mind. I've discovered the problem. When I saved my image files, I didn't notice that Photoshop didn't put an extension on their filenames for me, like I thought it would be smart enough to do. Without extensions, Eclipse has no idea what those files are. Give them extensions (.png, in this case) and—surprise!—it all works as advertised. Sorry for my stupid mistakes.
comment on: http://stackoverflow.com/q/21787733
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32938489
score: 1
has text: @user230137 Mind if you say that in the question? Aside from that comment, the question really reads like you're trying to get us to show you how to parse the dates *period*. Judging from that comment, you already know of one way, but are wondering whether it's possible to do it using a different approach. A title like "Is it possible to parse these dates using SimpleDateFormat" with description something along the lines of "I have these dates, and am currently using <approach> to parse them. Is there a different way with SimpleDateFormat" is much more likely to be better received.
comment on: http://stackoverflow.com/q/21756505
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21778759
has comment: http://stackoverflow.com/comment/32954293
has comment: http://stackoverflow.com/comment/32951959
has comment: http://stackoverflow.com/comment/32953961
has comment: http://stackoverflow.com/comment/32954553
has comment: http://stackoverflow.com/comment/65249317
accepted answer of: http://stackoverflow.com/q/21704189
type: Answer
has comment: http://stackoverflow.com/comment/65247975
has comment: http://stackoverflow.com/comment/32954396
has comment: http://stackoverflow.com/comment/65248860
upvote count: 4
answers question: http://stackoverflow.com/q/21704189
score: 4
has comment: http://stackoverflow.com/comment/32954466
has body: EDIT: Based on a long discussion in the chat, it became clear that there was a misunderstanding about the intention, and the original question suffered from the XY-Problem: The question of how to compose an image with a masking image was only about one solution attempt for the actual problem - namely painting some shadow/light effects on a tile map. The original versions of the post can be seen in the revision history. The actual goal was obviously to add a "light effect" over the image. Here is an example of how this can be achieved: The original image is painted in the background A "shadow image" is painted over the image. The "shadow image" is initially a nearly opaqe, nearly black image. The lights are painted into this image, with a RadialGradientPaint. The colors for this paint are chosen so that they make the shadow image less opaque and less black at the places where the lights should be. This causes these areas to appear lighted, while the other parts remain dark. import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.MultipleGradientPaint.CycleMethod; import java.awt.Point; import java.awt.RadialGradientPaint; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.awt.geom.Point2D; import java.awt.image.BufferedImage; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class LightEffectTest2 { public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { public void run() { new LightEffectTest2(); } }); } public LightEffectTest2() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new LightEffectPanel2()); f.setSize(600,600); f.setVisible(true); } } class LightEffectPanel2 extends JPanel implements MouseMotionListener { private Point point = new Point(0,0); private BufferedImage image; private BufferedImage shadow; …
has comment: http://stackoverflow.com/comment/32952397
has comment: http://stackoverflow.com/comment/65246278
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/65247250
has comment: http://stackoverflow.com/comment/65246966

http://stackoverflow.com/q/21685497
has comment: http://stackoverflow.com/comment/32783715
has title: Desktop programming languages with the ability to interact deeply with other programs?
tagged with: programming-languages
tagged with: delphi
has comment: http://stackoverflow.com/comment/32783068
has comment: http://stackoverflow.com/comment/32785138
has comment: http://stackoverflow.com/comment/32803111
favorite count: 0
has comment: http://stackoverflow.com/comment/32783917
answer count: 0
type: UnansweredQuestion
tagged with: reverse-engineering
downvote count: 2
has comment: http://stackoverflow.com/comment/32783188
tagged with: python
has comment: http://stackoverflow.com/comment/32857630
has comment: http://stackoverflow.com/comment/33676691
has comment: http://stackoverflow.com/comment/33712580
score: 2
has comment: http://stackoverflow.com/comment/32867680
has comment: http://stackoverflow.com/comment/32784491
has comment: http://stackoverflow.com/comment/32818781
has comment: http://stackoverflow.com/comment/32784195
tagged with: java
has comment: http://stackoverflow.com/comment/33706046
has comment: http://stackoverflow.com/comment/33703256
type: Question
upvote count: 4
has body: The title doesn't address my question entirely. I have always used Cheat Engine as a child and now as a junior programmer, I'm fascinated by it's ability to read an EXE's machine code so smoothly and can be able to modify it. People who don't know about it see this: Wikipedia. I have also used Resource Tuner to tweak some programs to my liking. I have tested many many minor disassemblers using PEiD and found that most of these types of programs were written in Delphi. When I searched this topic, I found minimal information, but I learned my best bets were Delphi or Python. Java was also mentioned. I use minimal desktop programming languages and I will still start learning. I just want to know what language has the best interaction with other software in the way above? If I would use any desktop language, I would use it to deeply interact with other software. Kind of like reverse engineering software. Note that a version of Cheat Engine was written in Delphi. Thanks, Abdullah
has comment: http://stackoverflow.com/comment/32784131
has comment: http://stackoverflow.com/comment/32783149

http://stackoverflow.com/comment/32824499
score: 0
comment on: http://stackoverflow.com/q/21708591
has text: is there a setFlightBisDomainService() method?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33021897
comment on: http://stackoverflow.com/a/21817934
type: AnswerComment
score: 0
has text: If you post the code raw, I can edit it and format it for you.
type: Comment

http://stackoverflow.com/q/21697217
has title: How to convert the below SQL to JPQL?
has answer: http://stackoverflow.com/a/21697295
type: UnansweredQuestion
tagged with: oracle-database
has body: How to convert the below SQL to JPQL? SELECT * FROM SSSRC.NAME_TEST nameTest LEFT JOIN TTREFERENCE.LOCATION location ON nameTest.place= location.location_name WHERE nameTest.gender = 'Male' AND nameTest.age= '50' AND nameTest.name IS NOT NULL ORDER BY nameTest.sortby ,location.location_order; I convert like this "SELECT nameTest FROM NameTest nameTest, LEFT JOIN Location location ON nameTest.place = location.location_name WHERE nameTest.age= '50' and nameTest.gender = 'Male' and nameTest.name IS NOT NULL ORDER BY nameTest.sortby ,location.location_order"; but Its not working its giving below error Exception in thread "main" &lt;openjpa-2.0.0-r422266:935683 nonfatal user error&gt; org.apache.openjpa.persistence.ArgumentException: "Encountered "location" at character 66, but expected: [",", "GROUP", "HAVING", "INNER", "JOIN", "LEFT", "ORDER", "WHERE", &lt;EOF&gt;]." while parsing JPQL "SELECT nameTest FROM PrintRequest nameTest, LEFT JOIN LOCATION location ON nameTest.place = location.location_name WHERE nameTest.age= '50' and nameTest.gender = 'Male' and nameTest.name IS NOT NULL ORDER BY nameTest.sortby ,location.location_order";. See nested stack trace for original parse error. at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:51) at org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:150) at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:670) at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:652) at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:618) at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:680) at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:587) at org.apache.openjpa.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:985)
score: -1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/5220211
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/32804194
tagged with: sql
upvote count: 0
has answer: http://stackoverflow.com/a/21737148
tagged with: jpql
favorite count: 0

http://stackoverflow.com/comment/32950709
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21779535
type: QuestionComment
has text: Yes, it does. You would expect any implementer to follow the expected behaviour, but the author of the interface can hardly guarantee it.

http://stackoverflow.com/a/21792120
has body: It's because charAt() returns char value, instead of String. Therefore + operator here doesn't stand for concatenation, but it's a simple addition of two numbers. This works if both operands of + are a number. If one of them is s String, + does not peform addition anymore, but both operands are casts to String and concatenation is performed instead. Therefore if you include res into the mix, the result of res + str.charAt(0) will be a String and using the same logic, the whole thing res += str.charAt(0) + str.charAt(2); will also be evaluated to String.
score: 0
answers question: http://stackoverflow.com/q/21792084
type: Answer

http://stackoverflow.com/q/21719817
has title: How to assign json string contents and keep formatting?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21719838
accepted answer: http://stackoverflow.com/a/21719838
type: Question
duplicate of: http://stackoverflow.com/q/878573
has body: I have a block of json that I want to initialize a string with and I want to keep the formatting but this doesn't work. The json will be much larger than this but just looking for possibilities for assigment w/formatting? private static final String whateverXXX ='{ "phonetype":"N95", "cat":"WP" }';
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
linked to: http://stackoverflow.com/q/878573
score: 0

http://stackoverflow.com/comment/32891281
score: 0
has text: Sorry..i did not put my exception previously..now edited the question..pleas have a look.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21746144

http://stackoverflow.com/a/21761805
score: 4
accepted answer of: http://stackoverflow.com/q/21761667
type: Answer
has body: The problem is that you are using multiple ?s and in Java they aren't guaranteed to be the same. Make this method generic, so that you have a generic type parameter to reference and to be the same throughout the method. public &lt;T extends SerializableForLayout&gt; void loadLayoutList(ArrayList&lt;SerializableForLayout&gt; preparedList, ConcurrentHashMap&lt;String, T&gt; layoutObjectList) Then you should be able to properly define your set variable, using T. Set&lt;Map.Entry&lt;String, T&gt;&gt; set = layoutObjectList.entrySet();
answers question: http://stackoverflow.com/q/21761667
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32939334
score: 2
has text: not related to your question, but you're comparing String with == operator in this line `if(j!=i && result==directory.get(j) &&j<i)`, you should use equals() instead
comment on: http://stackoverflow.com/q/21772966
type: Comment
type: QuestionComment

jrebel
tags question: http://stackoverflow.com/q/21763457
type: Tag
tags question: http://stackoverflow.com/q/21782940
tag name: jrebel

http://stackoverflow.com/q/21749741
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32897451
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21749907
has title: Though my class was loaded, Class.forName throws ClassNotFoundException
favorite count: 0
tagged with: classloader
tagged with: urlclassloader
has body: The code is as follows what it does is it loads all the classes inside a jar file which I placed inside my home directory . import java.io.File; import java.util.jar.JarFile; import java.util.jar.JarEntry; import java.net.URLClassLoader; import java.net.URL; import java.util.Enumeration; import java.lang.ClassLoader; public class Plugin extends ClassLoader { public static void main(String[] args) throws Exception { File file = new File(System.getProperty("user.home") + "/HelloWorld.jar"); URLClassLoader clazzLoader = URLClassLoader.newInstance(new URL[]{file.toURI().toURL()}); JarFile jarFile = new JarFile(file); Enumeration&lt;JarEntry&gt; entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry element = entries.nextElement(); if (element.getName().endsWith(".class")) { try { Class c = clazzLoader.loadClass(element.getName().replaceAll(".class", "").replaceAll("/", ".")); c.newInstance(); // this proves that class is loaded } catch (Exception e) { e.printStackTrace(); } } } Class cls = Class.forName("HelloWorld"); cls.newInstance(); Plugin p = new Plugin(); p.checkIfLoaded(); } public void checkIfLoaded() { System.out.println("coming in"); if (findLoadedClass("HelloWorld") != null){ System.out.println("Yepee, HelloWorld class is loaded !"); } } } My HelloWorld is as in https://github.com/HarishAtGitHub/doc/blob/master/makeExecutableJar/HelloWorld.java and the jar is got using the instructions in my github account mentioned above . c.newInstance() works . How did I confirm ? the static block got executed ... but Class.forName("HelloWorld") throws ClassNotFoundException also findLoadedClass("HelloWorld") is null .. I cannot understand why this strange behaviour ? Please guide ...
has comment: http://stackoverflow.com/comment/32897631
possible better answer: http://stackoverflow.com/a/21749907
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21749908
accepted answer: http://stackoverflow.com/a/21749908

http://stackoverflow.com/a/21767088
downvote count: 0
upvote count: 2
has body: If you know the size of the expected reply in advance you should use DataInputStream.readFully(); otherwise DataInputStream.read(byte[]), which will return to you the number of bytes actually read.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21764079

http://stackoverflow.com/comment/32914237
comment on: http://stackoverflow.com/q/21759286
type: Comment
has text: @PeterLawrey not if you let an IOC container manage them (eg spring)
score: 0
type: QuestionComment

http://stackoverflow.com/a/21750059
type: Answer
has body: Finally block exception will mask the original exception. When an new exception is thrown in a catch block or finally block that will propagate out of that block, then the current exception will be aborted (and forgotten) as the new exception is propagates outward. Check here and here for more details
score: 5
has comment: http://stackoverflow.com/comment/32897919
answers question: http://stackoverflow.com/q/21750038
upvote count: 5
has comment: http://stackoverflow.com/comment/32898390
downvote count: 0
has comment: http://stackoverflow.com/comment/32898102

http://stackoverflow.com/comment/32849914
type: QuestionComment
score: 0
has text: @Fildor Sanjeev's link is of php and mysql, but i have to work with java and mysql
comment on: http://stackoverflow.com/q/21722660
type: Comment

http://stackoverflow.com/comment/116973481
score: 1
type: AnswerComment
has text: The .tar/.zip files mentioned are not directly executable. You extract them and run the script bundled within.
comment on: http://stackoverflow.com/a/21743527
type: Comment

http://stackoverflow.com/comment/33005995
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21810221
has text: Yes, you can: see [this](http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList) for reference
score: 0

http://stackoverflow.com/a/21730772
has body: SimpleDateFormat is very unforgiving. It expects you to pass a String that exactly matches the format string you initialized it with. If you pass "HH:mm" as its format string, it will not be able to handle any other format - it cannot handle a date with a year in it, etc. It will handle "3:56" (in which case you'll get Jan 1, 1970 at 03:56AM in your Date).
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21730638

http://stackoverflow.com/comment/33019554
has text: NetBeans is an IDE. Maven is a build management tool. I'm guessing you are using Ant as your build management tool. In any case as others mentioned. You will need to use the J2EE libraries to get the ServletOutputStream class.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21791385

http://stackoverflow.com/comment/33003602
type: AnswerComment
comment on: http://stackoverflow.com/a/21805973
score: 0
type: Comment
has text: I am using flags to check whether its the first node in pointer variable or next. And sorry I didn't get what you mean by 'Count'.? Could you be more specific

http://stackoverflow.com/comment/32811647
type: QuestionComment
type: Comment
has text: Use the `setText` method and `String.valueOf`?
comment on: http://stackoverflow.com/q/21701820
score: 0

http://stackoverflow.com/comment/32866610
has text: Ah yeah I wasn't thinking about the padding.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21732176
type: AnswerComment

http://stackoverflow.com/comment/33048972
score: 0
comment on: http://stackoverflow.com/q/21834527
type: Comment
type: QuestionComment
has text: Could you explain what are the keys and values of your maps? Please provide an example

http://stackoverflow.com/comment/32879485
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21738669
type: Comment
has text: Where does your assumption that they need a method reference come from? Especially when they've specifically stated `Method fooMethod = A.getMethod("foo");`.

http://stackoverflow.com/q/21691007
has body: I'm in the beginning of Java 7 Software design learning switch() and do...while () and what not. When I compile and run the program in Intelli J IDEA 13, it compiles and runs fine but nothing will break when the statements are complete. For example, when the program is run, on case 2, when I enter -1 after I input 3 grades (90, 90, 90, -1) it gives me the average (270) but then it repeats... It should break and go back to the beginning of the switch menu. Even when I enter 3 at the menu, it just displays "No Code Here... " to infinity, even with a break statement (even though break statements are outdated). import java.util.Scanner; public class TestingPlatform { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter 1 to set percentage of total for new grades, 2 to enter new grades, 3 to get average, and 4 to quit: "); int choice = input.nextInt(); do { switch (choice) { case 1: System.out.println("Enter percent to multiply by: "); double percent = input.nextDouble(); System.out.println("You entered " + percent); break; case 2: int total; int gradeCounter; int grade; double average; total = 0; gradeCounter = 0; System.out.println("Enter grade or -1 to quit: "); grade = input.nextInt(); while (grade != -1) { total = total + grade; gradeCounter = gradeCounter + 1; System.out.println("Enter grade or -1 to quit: "); grade = input.nextInt(); } if (gradeCounter != 0) { average = (double) total / gradeCounter; System.out.printf("\nTotal of the %d grades is %d\n", gradeCounter, total); System.out.printf("Class average is %.2f\n", average); } else System.out.println("No grades were entered."); break; case 3: System.out.println("No code here yet...."); break; } } while (choice != 4); } }
has answer: http://stackoverflow.com/a/21691098
has answer: http://stackoverflow.com/a/21691032
possible better answer: http://stackoverflow.com/a/21691098
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32793552
tagged with: java
tagged with: switch-statement
type: Question
tagged with: do-while
answer count: 2
has title: Switch statement won't break
has comment: http://stackoverflow.com/comment/32793855
accepted answer: http://stackoverflow.com/a/21691032
score: 0
has comment: http://stackoverflow.com/comment/32793635

http://stackoverflow.com/a/21761864
score: 0
type: Answer
has body: If you want to match only the no sodium then its as usual. But if you want to match only sodium not having no before, then it will be (?&lt;!no) sodium
answers question: http://stackoverflow.com/q/21761788

http://stackoverflow.com/comment/32834635
comment on: http://stackoverflow.com/q/21713866
score: 0
type: Comment
has text: @Rated Are you using a `ListModel` to add elements to the JList?
type: QuestionComment

http://stackoverflow.com/a/21737576
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21736062
answers question: http://stackoverflow.com/q/21736062
has body: What's going on is this: finalize() overrides a method in the Object class. The javadoc explains when this is called. When an object is no longer referenced anywhere, it may then be garbage-collected; but when it's garbage-collected isn't defined by the language. The finalize() method will be called on each Finalize object when it's garbage-collected. Of course, the code you posted also calls finalize() explicitly. In this example, the loop will call new Finalize() 100,000 times to create new Finalize objects. Each time a new object is created, it's used to call finalize() explicitly, but then it's no longer used, so it could be garbage-collected right away. The consequence of this is that by the time we get to the System.gc() call, we don't know how many Finalize objects are still around waiting to be garbage-collected, but it could be anywhere from 0 to 100,000. (On my machine, it seems to be 1. That is, it's already garbage-collected all but one of the objects, and called finalize() on them.) During the first loop, x will go from 0 to 999,999 (the finalize() method won't modify x), and therefore you should see false x for every x that is a multiple of 10,000. (Note that finalize() could also be called by the runtime for objects that are garbage-collected early, so in theory it's possible to see false x for the same x more than once.) After the first loop, if N is the number of objects still to be garbage-collected, then System.gc() should cause them all to be garbage-collected at that point (it's not guaranteed); since x has been reset to 0 and finalize() will increment it, that means x will go from 1 to N. (Note that the first finalize() will increment x from 0 to 1 before the x % 10000 test.) You should see true x for every x in the range 1 to N that is a multiple of 10,000. But since N could be anything from 0 to 100,000, that means that we may or may not see any true outputs--we can't tell. That's why neither A nor B is "always true". If we do see any true ou…
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/33032611
has text: Haha, and if I was him, I were you also :)
type: Comment
comment on: http://stackoverflow.com/a/21825688
score: 1
type: AnswerComment

http://stackoverflow.com/q/21707053
type: UnansweredQuestion
tagged with: java
has body: I have a simple Java program that starts a oclHashcat (actually cudaHashcat) process and tries to communicate with the started process. Reading of output from the process works fine however I can't seem to write to the process. Demo code that shows what I'm trying to do: (Pressing s in the program is supposed to show a status of the current operation, however nothing happens public class CudaHashcat { public static void main(String[] args) throws IOException { ProcessBuilder builder = new ProcessBuilder("cudaHashcat64.exe", "-m", "0", "-b"); builder.redirectErrorStream(true); builder.redirectInput(Redirect.PIPE); builder.redirectOutput(Redirect.INHERIT); final Process process = builder.start(); new Thread() { @Override public void run() { try { Thread.sleep(2000); System.out.println("Writing to hashcat process"); // this shows up just fine process.getOutputStream().write('s'); process.getOutputStream().flush(); } catch (InterruptedException | IOException e) { e.printStackTrace(); } }; }.start(); } } Thank you for your help!
tagged with: process
has comment: http://stackoverflow.com/comment/32822700
type: Question
has title: Why can't I send "keys" to oclHashcat process started from java
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32822534
has comment: http://stackoverflow.com/comment/32822081
tagged with: processbuilder
has comment: http://stackoverflow.com/comment/32822311
score: 2
answer count: 0
upvote count: 2

http://stackoverflow.com/q/21767834
downvote count: 0
has body: Input (fullInput) Imagine I have the following as an InputStream (or as a String in memory read from that stream): <?xml version="1.0" ?> <x /><y /> <y /> <x /><x /> <z /><y /> How I want to use the solution (bridgeXml) IProprietaryUnmarshaller UNMARSHALLER = ...; List parseFullXml(String fullInput) throws UnmarshallException { List<String> inputs = bridgeXml(fullInput); List outputs = new ArrayList(); for(String input : inputs) { Element e = UNMARSHALLER.unmarshall(input); outputs.add(e); } return outputs; } What I'm looking for I'm looking for an implementation of/idea for bridgeXml where the input String/*Stream is split up into smaller chucks of Strings which are well-formed XML documents (without XML declaration) by themselves. The trivial implementation I want to avoid The below implementation is error prone, inflexible and should not be used, I'm looking for a proper one using some kind of a library or XML parser! List<String> bridgeXml(String input) { // strip anything up to the opening root element, and LTrim the remainder input = input.replaceAll("(?s)^.*<root.*?>\\s*", ""); // strip anything after the closing root element, and RTrim the remainder input = input.replaceAll("(?s)\\s*</root.*$", ""); // split at closing tags, not removing them (?<= does the magic) return Arrays.asList(input.split("(?<= )")); } Restrictions The XML input can't be changed and is a fully valid XML. The proprietary unmarshaller must be used and cannot be modified. I'm looking for a solution where the file is not XML unmarshalled, XML marshalled, proprietary unmarshalled. (Don't pick at XML/Java code style, formatting, visibility modifiers, etc.! These are simplified codes for easier communication.) Solution (edit) I ended up writing this piece... I ended up double-parsing the XML (see getOuterXml), because it was premature to assume that it's slow. I have a huge DB query following this which is way slower. protected <T> List<T> read(InputStream inputStream, String tagName) throws…
tagged with: unmarshalling
answer count: 1
has answer: http://stackoverflow.com/a/21768153
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 2
tagged with: stax
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21768153
tagged with: java
has comment: http://stackoverflow.com/comment/32930253
tagged with: jaxb
type: Question
has title: How to parse an XML partially (only 1 level deep)

http://stackoverflow.com/q/21819962
has body: Error : Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 3, Size: 2 at java.util.LinkedList.checkElementIndex(LinkedList.java:553) at java.util.LinkedList.get(LinkedList.java:474) at InterfacePackage.Main.main(Main.java:116) Java Result: 1 Code (shortened) : if(input.length() &gt; 0) { if(command.size() == 1) { switch(command.get(0).toLowerCase()) { case "exit": case "qqq": active = false; break; default: System.out.println("invalid input, for complete list of commands enter 'help'..."); break; } } else if(command.size() &gt; 1) { if(command.get(0).equalsIgnoreCase("shutdown") &amp;&amp; command.size()==3) { Shutdown shutdown = new Shutdown(); shutdown.Start(command); } else if(((command.get(0).equalsIgnoreCase("scan") &amp;&amp; command.get(1).equalsIgnoreCase("ips")) || command.get(3).equalsIgnoreCase("/e")) &amp;&amp; (command.size()&gt;=2 || command.size()&lt;4)) { SystemsIPs sips = new SystemsIPs(); sips.Start(command); } else { System.out.println("invalid input, for complete list of commands enter 'help'..."); } } } The error occurs when the users enters two string within a line that doesn't exist in the else if(command.size() &gt; 1) loop. For example, if the user would enter : hello world the program produces this error. So this is a program that does various things based on user input to a console. I've been getting this error and and wanting to know what is causing it. I know I can just catch it, but I really want to know what causing this error.
has answer: http://stackoverflow.com/a/21820090
tagged with: java
has comment: http://stackoverflow.com/comment/33022883
has comment: http://stackoverflow.com/comment/33022839
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21820090
score: -1
has answer: http://stackoverflow.com/a/21820016
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21819976
has answer: http://stackoverflow.com/a/21819985
has title: Java LinkedList problems
possible better answer: http://stackoverflow.com/a/21819976
has comment: http://stackoverflow.com/comment/33022831
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/21826413
upvote count: 2
answers question: http://stackoverflow.com/q/21826369
type: Answer
score: 2
downvote count: 0
has body: you can implement using CountDownLatch. It is a synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes.A CountDownLatch is a versatile synchronizati on tool and can be used for a number of purposes. A CountDownLatch initialized with a count of one serves as a simple on/off latch, or gate: all threads invoking await wait at the gate until it is opened by a thread invoking countDown(). A CountDownLatch initialized to N can be used to make one thread wait until N threads have completed some action, or some action has been completed N times. Code snippet - CountDownLatch doneSignal = new CountDownLatch(1); // Share the same object between two thread Thread T1{ public void run(){ doneSignal.await(); //T1 will wait untill T2 finshed ... } } ... Thread T2{ public void run(){ ... doneSignal.countDown(); // sending signal that T2 is over } }

http://stackoverflow.com/a/21844580
answers question: http://stackoverflow.com/q/21826046
has body: Please I can't understand your question, deselect or unselect. this one is make different, like unselected mean's not choose the value, deselected mean's particular person or part should disqualified. following codes are general for like ognl and list, As these are following as: But, create a radio button via OGNL expression and preselect the “2″ as the default value. <s:radio label="Answer" name="yourAnswer" list="#{'1':'Yes','2':'No'}"value="2"/> It will generate the following HTML code… Yes No In Java code, create a List to return the values for the radio button. List<String> genders = new ArrayList<String>(); genders.add("male"); genders.add("female"); genders.add("unknown"); public List<String> getGenders() { return genders; } public String getDefaultGenderValue(){ return "unknown"; } In result page, tag, the list=”genders” will call the getGenders() method to return a list of the keys and values for the radio button. And the value=”defaultGenderValue” will call the getDefaultGenderValue() method to preselect the “unknown” value as a default value for the radio button. <s:radio label="Gender" name="yourGender" list="genders" value="defaultGenderValue" /> It will generate the following HTML code… male female unknown
has comment: http://stackoverflow.com/comment/33083431
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33083746
has comment: http://stackoverflow.com/comment/33083571
score: 1
upvote count: 1

http://stackoverflow.com/a/21858628
has body: I found the solution to this mysterious issue. I modified the create session statement in HelloWorldBean as: Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); I found following reference in Oracle API Documentation It says: If transacted is set to true then the session will use a local transaction which may subsequently be committed or rolled back by calling the session's commit or rollback methods. The argument acknowledgeMode is ignored. If transacted is set to false then the session will be non-transacted. In this case the argument acknowledgeMode is used to specify how messages received by this session will be acknowledged. The permitted values are Session.CLIENT_ACKNOWLEDGE, Session.AUTO_ACKNOWLEDGE and Session.DUPS_OK_ACKNOWLEDGE. For a definition of the meaning of these acknowledgement modes see the links below. Hope this solution will help others. [Note: I still receive the warning saying that Channel end notification received. But as mikemil pointed out this message is harmless. Thanks mikemil for your co-operation.]
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33094101
downvote count: 0
answers question: http://stackoverflow.com/q/21803299
type: Answer
accepted answer of: http://stackoverflow.com/q/21803299
upvote count: 3
score: 3

http://stackoverflow.com/a/21720737
upvote count: 2
answers question: http://stackoverflow.com/q/21720706
downvote count: 0
has body: setContentView(Id); is missing in your code.So it is giving you NullPointerException Set some of the view to your Activity like setContentView(R.layout.layout);
type: Answer
score: 2

http://stackoverflow.com/q/21758934
linked to: http://stackoverflow.com/q/2361863
has answer: http://stackoverflow.com/a/21758943
upvote count: 1
has title: Restrict a class to be instantiated not more than five times
linked to: http://stackoverflow.com/q/2323814
has comment: http://stackoverflow.com/comment/32913379
has comment: http://stackoverflow.com/comment/32913353
type: Question
tagged with: object
duplicate of: http://stackoverflow.com/q/2361863
has answer: http://stackoverflow.com/a/21759610
has answer: http://stackoverflow.com/a/21759183
has answer: http://stackoverflow.com/a/21759052
downvote count: 0
accepted answer: http://stackoverflow.com/a/21759183
has body: I want to create maximum five objects of a class. If more than times object are created it will throw an exception. Please help.
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32913464
has comment: http://stackoverflow.com/comment/32913406
tagged with: exception
answer count: 5
has answer: http://stackoverflow.com/a/21759091
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21758943
tagged with: java

http://stackoverflow.com/comment/33329769
has text: Can you help me on that post if possible? I am still stuck on it and not able to figure out a solution for that.. Any help will be appreciated..
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21793727
type: Comment

http://stackoverflow.com/q/21750429
downvote count: 0
has comment: http://stackoverflow.com/comment/32900064
has title: Hibernate, JDBC: Error calling Driver#connect
favorite count: 0
tagged with: jdbc
has comment: http://stackoverflow.com/comment/32900283
has comment: http://stackoverflow.com/comment/32900129
type: UnansweredQuestion
upvote count: 1
type: Question
has body: I try to use Hibernate to connect to my database. But when I build my SessionFactory, it always throws a JDBCCOnnectionException: Error calling Driver#connect Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:132) at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator$1$1.convert(BasicConnectionCreator.java:118) at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:140) at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:58) at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:75) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:106) at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94) at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178) at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885) at org.hiberna…
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/38812908
answer count: 1

http://stackoverflow.com/comment/100672285
has text: Show the stacktrace
comment on: http://stackoverflow.com/a/21744150
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21745130
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: android
has body: I keep getting that error message "error:Error parsing XML: not well-formed" when I try to run my code of a virtual device. I don't know what the problem is. <?xml version="0.03" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> > <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER" />
tagged with: java
type: Question
tagged with: manifest
score: 0
has title: error:Error parsing XML: not well-formed?
has answer: http://stackoverflow.com/a/21745188
answer count: 1
tagged with: parsing

http://stackoverflow.com/comment/33034391
has text: A similar alternative might also be using type classes, although those are not so natural to use in Java (you have to use converter methods and so on), this intro might be useful to get the idea: http://typeclassopedia.bitbucket.org/
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21825368
type: Comment

http://stackoverflow.com/comment/33027486
score: 0
has text: @MarounMaroun: It will run "forever", instead of running out of stack space.
type: Comment
comment on: http://stackoverflow.com/a/21822635
type: AnswerComment

http://stackoverflow.com/comment/32903147
score: 0
comment on: http://stackoverflow.com/q/21729520
type: Comment
type: QuestionComment
has text: I am now moving away from known plaintext

http://stackoverflow.com/comment/32937823
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21754590
has text: There's nothing "wrong" with doing more than one thing per line of code, it just makes your code easier to read - and code is read more often than it's written (so take your time, and use clear variable and method names). On the unused code, it just makes sense not to include stuff that doesn't directly relate to your question - see here for some good ideas http://stackoverflow.com/help/mcve

http://stackoverflow.com/comment/33033937
type: QuestionComment
comment on: http://stackoverflow.com/q/21826167
has text: @user2357112: It will take up space man! A lot of space!
score: 0
type: Comment

http://stackoverflow.com/comment/33044186
score: 1
type: QuestionComment
has text: Since you suspect the problem is in your C++ code, why did you only post the Java code? Can we see the C++ too?
comment on: http://stackoverflow.com/q/21832206
type: Comment

http://stackoverflow.com/comment/33190280
type: AnswerComment
score: 0
type: Comment
has text: my english is not good :P I mean that I have MySQL installed in the C drive it takes about 1.5 GB and I see lots of other Java Or C ++ programs that Have a small File named *.db and have the data needed I want to know How to do something Like that (have a small size of some KB and can be transferred on a USB withing the Jar) instead of re installing my SQL and copying the data on any computer I want to use my program with I think It's Clear now .. ?
comment on: http://stackoverflow.com/a/21799487

http://stackoverflow.com/comment/32923907
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21762650
has text: Instead of forwarding the same request object, create a new request object and froward that. The fact that the original request object is multipart/form-data could possibly be causing the problem.

http://stackoverflow.com/comment/32926005
type: Comment
type: QuestionComment
score: 0
has text: Is tuple a data structure in Java libraries?
comment on: http://stackoverflow.com/q/21765675

http://stackoverflow.com/q/21722060
score: 1
tagged with: java
downvote count: 1
type: Question
answer count: 2
has body: Consider this base class: public abstract class TestGenericList&lt;T&gt; { public TestGenericList() { } protected abstract void doSomething(); } Now, two derived classes: public class DerivedA extends TestGenericList&lt;DerivedA&gt; { @Override protected void doSomething() { // } } public class DerivedB extends TestGenericList&lt;DerivedB&gt; { @Override protected void doSomething() { // } } Application class: public class TestListMain { public static void main(String[] args) { DerivedA dA = new DerivedA(); DerivedB dB = new DerivedB(); List&lt;TestGenericList&gt; genericList = new ArrayList&lt;TestGenericList&gt;(); genericList.add(dA); genericList.add(dB); } } The line with the list creation gives this warning: TestGenericList is a raw type. References to generic type TestGenericList&lt;T&gt; should be parameterized How can I generate a list of derivatives of a generic abstract base class?
has answer: http://stackoverflow.com/a/21722256
accepted answer: http://stackoverflow.com/a/21722256
has title: Creating a list of instances of derivatives from a generic abstract class
possible better answer: http://stackoverflow.com/a/21722334
upvote count: 2
tagged with: abstract-class
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/21722334
type: AnsweredQuestion

http://stackoverflow.com/comment/32934555
has text: Worked perfectly. Thank you (also, your confidence is reassuring)!
type: AnswerComment
comment on: http://stackoverflow.com/a/21770326
score: 0
type: Comment

http://stackoverflow.com/a/21761942
upvote count: 4
has body: A simple approach that assumes Length of A is given as A.size() Array A can be accessed by A.get(index) and A.set(index, value) If your array is not even, the last element is left as-is Is to swap values in pairs - like this: for (int index = 1; index &lt; A.size(); index += 2) { // Swap on even indices. // Swap values at positions index-1 and index. Object temp = A.get(index-1); // Save value before overwrite. A.set(index-1, A.get(index)); // First half of swap. A.set(index, temp); // Final operation for swap. } Edit: Changed int to Object, and used A.size, A.get and A.set instead of [] indexers as suggested by comments.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21761708
answers question: http://stackoverflow.com/q/21761708
type: Answer
has comment: http://stackoverflow.com/comment/32918992
score: 4
has comment: http://stackoverflow.com/comment/32919753
has comment: http://stackoverflow.com/comment/32919373
has comment: http://stackoverflow.com/comment/32919026

http://stackoverflow.com/comment/32872154
has text: I'll be downvoting this since it's a duplicate of more than two. Here's a second one: https://stackoverflow.com/questions/20552223/socket-inputstream-blocks-on-available-read
comment on: http://stackoverflow.com/q/21735427
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32794537
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21691017
score: 0
has text: Well, one thing I've noticed is you haven't said what problem you're running into.

http://stackoverflow.com/a/21731899
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/32895725
downvote count: 0
answers question: http://stackoverflow.com/q/21730990
has body: I really don't get why IDEA must break up one test run's console outs to so many places in the tree, seems kind of silly. The intent is so you can see output relevant to a specific test. This way, when running dozens, or hundreds, of tests, you can focus on the relevant output and not a lot of "noise" that is irrelevant to the the particular test you are focusing on. However I don't see a post anywhere explaining how to actually log all of this to one log file. This is typically done via your logging framework, not the IDE. (But there is a way to do this in IDEA w/o a logging framework, which I discuss below.) As an aside, Logback is ideal for this since it automatically looks for a test specific configuration file. Of course, with other frameworks, you can set a test specific configuration file. If you create a run/debug configuration for running your test, you can add the log file's output to a tab in the run output tool window. In your run/debug configuration, click on the Logs tab and add the log that your logging framework writes to. You can also set it up so that only new/fresh output is shown in the tab preventing you from seeing logging from previous runs. You can also select the "Save Console Output to File" option. Finally, you can combine the above two settings, so that console output is logged to a file, and the output is shown in a second tab. If you want either of the settings to to be the default, you can set it in the default "unit test" configuration. Expand the "Default" section in the Run/Debug configuration window (Run > Edit Configurations). When set there, any new run/debug unit test configurations (even temporary ones created on the fly via Ctrl+Shift+F10) will have those settings. Note that defaults only apply to the current project. If you want to make the setting a global default for all future projects, From the Welcome Screen (i.e. close all projects) go to "Configure" > "Project Defaults" > "Run Configurations" and make the setting there…
has comment: http://stackoverflow.com/comment/32895744
type: Answer

http://stackoverflow.com/q/21809091
has answer: http://stackoverflow.com/a/21809113
type: AnsweredQuestion
has body: I've got following method: public Iterator&lt;Item&gt; iterator() { return new ListIterator(); } and it's used in following code: Deque&lt;Integer&gt; deque = new Deque&lt;Integer&gt;(); // ... Iterator&lt;Integer&gt; iter1 = deque.iterator(); Iterator iter2 = deque.iterator(); The question is - why does java compiler accept both lines (iter1 &amp; iter2)? Especially the iter2 is strange for me. When I create my former object (deque) I need to specify the type on both sides. Anyway, if I put Deque deque2 = new Deque(); then compiler is fine with this too. Confusing...
type: Question
tagged with: java
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21809113
tagged with: generics
has title: java iterator - why is generic type optional
linked to: http://stackoverflow.com/q/2770321

http://stackoverflow.com/comment/32814177
comment on: http://stackoverflow.com/q/21702819
type: QuestionComment
has text: above code i'm writing in jsp but it will give an error
score: 0
type: Comment

http://stackoverflow.com/a/21744765
accepted answer of: http://stackoverflow.com/q/21736716
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21736716
has body: I think I just had to cleanup references and location of the do-while. Thanks for the help.! Output Enter word and I will tell you if it has the property of a palindrome: Palindrome Palindrome does not have a Palindrome property Enter another word. Or enter "quit" to end uneven uneven has a Palindrome property Enter another word. Or enter "quit" to end banana banana has a Palindrome property Enter another word. Or enter "quit" to end dresser dresser has a Palindrome property Enter another word. Or enter "quit" to end quit Revised code below. import java.util.*; public class Palin{ public static void main(String args[]) { String original,input; Scanner sc=new Scanner(System.in); System.out.println("Enter word and I will tell you if it has the property of a palindrome: "); original = sc.nextLine(); do{ char firstLetter = original.charAt(0); input = original.substring(1); input = input + firstLetter; StringBuilder input2=new StringBuilder(input).reverse(); String s2=new String(input2); if(original.equals(s2)) System.out.println(original + " has a Palindrome property"); else System.out.println(original + " does not have a Palindrome property"); System.out.println("Enter another word. Or enter \"quit\" to end"); original = sc.nextLine(); } while (!(original.equalsIgnoreCase("quit"))); } }
type: Answer
score: 0

http://stackoverflow.com/comment/130587991
has text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/73920066
type: AnswerComment

http://stackoverflow.com/a/27562737
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21803908
type: Answer
has body: This works for me. Simply to identify whether a String is a primitive or a number. private boolean isPrimitive(String value){ boolean status=true; if(value.length()&lt;1) return false; for(int i = 0;i&lt;value.length();i++){ char c=value.charAt(i); if(Character.isDigit(c) || c=='.'){ }else{ status=false; break; } } return status; }

http://stackoverflow.com/comment/32947429
type: Comment
comment on: http://stackoverflow.com/a/21777993
has text: If an instance of MyClass is published through a data race `myObject` may be seen in a partially constructed state.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21717814
has answer: http://stackoverflow.com/a/22913071
type: UnansweredQuestion
tagged with: memory-leaks
upvote count: 4
has comment: http://stackoverflow.com/comment/32884098
has comment: http://stackoverflow.com/comment/32843227
has answer: http://stackoverflow.com/a/22287495
has comment: http://stackoverflow.com/comment/32876353
has answer: http://stackoverflow.com/a/22160015
downvote count: 0
has title: Memory leak with SocksSocketImpl finalize method
tagged with: java
has comment: http://stackoverflow.com/comment/32884241
type: Question
has body: We have been having OutOfMemory in one of our Web Applications. This application is running on Tomcat on Aamzon EC2 behind an Elastic Load Balancer. From heap dump, most the memory was consumed by SocksSocketImpl objects. Yourkit shows 99% of these objects are in Pending Finalization state. However, somehow they are NOT being finalized and GC'ed. The same application with same setup (same tomcat version and JDK version) on other regions and doesn't have issues. Has anyone seen this kind of behavior before? Any pointers will be helpful. Thanks for your time.
has comment: http://stackoverflow.com/comment/32988019
has comment: http://stackoverflow.com/comment/32896334
score: 4
answer count: 3
tagged with: amazon-ec2
has comment: http://stackoverflow.com/comment/32844843
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/q/21732592
has comment: http://stackoverflow.com/comment/32866831
has title: How to set text of a button randomly?
has answer: http://stackoverflow.com/a/21732660
downvote count: 0
accepted answer: http://stackoverflow.com/a/21732737
possible better answer: http://stackoverflow.com/a/21732663
has answer: http://stackoverflow.com/a/21732663
tagged with: random
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/32866574
type: AnsweredQuestion
score: 1
favorite count: 0
has body: is it possible to set a button / buttons text randomly e.g. case 1; I have 1 button and 3 text and I want to randomly set the text of the button to one of the three text, when a the button is pressed. String text1 = "Lucky", text2 = "Not lucky", text3 = "BadLuck, press the button again"; JButton button = new Jbutton(""); // I want this button to have one of the text from above randomly. case 2; I have 3 buttons and 1 text and I want to randomly give the text to one of the three buttons String text = "I was chosen"; JButton button = new Jbutton("Press me"); // when this button is pressed, I want at randomly for one of the buttons below to get the text "I was chosen". JButton button1 = newJbutton(""); JButton button2 = newJbutton(""); JButton button3 = newJbutton(""); Thanks in advance! edited: String text = "text"; JButton[] arr = {button1, button2, button3}; Random r = new Random(); arr[r.nextInt(arr.length)].setText(text);
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/21732737
has comment: http://stackoverflow.com/comment/32866648
tagged with: java

http://stackoverflow.com/a/21779166
has comment: http://stackoverflow.com/comment/36884108
score: -1
answers question: http://stackoverflow.com/q/21779136
downvote count: 1
type: Answer
has body: When you run the command line java it is running the one configured in your system bin path. The other one in system preferences must be being picked up from a different location elsewhere in your system.
upvote count: 0

http://stackoverflow.com/comment/32945978
has text: And indeed this is an other solution when you can know the redirect or not.
comment on: http://stackoverflow.com/a/21752717
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/32951831
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21779840
has text: For Christ sake, why do you ask questions if you don't read answers. The query you must use is `SELECT composicao FROM Composicao composicao`. Once again: the query you must use is `SELECT composicao FROM Composicao composicao`. I told you that once in the answer to your previous question, twice in the answer to this question, and now twice again in this comment. Will that be enough?

http://stackoverflow.com/q/21841419
has comment: http://stackoverflow.com/comment/33060660
type: Question
accepted answer: http://stackoverflow.com/a/21842239
has title: Using List, how would I change this code as using List
tagged with: arrays
possible better answer: http://stackoverflow.com/a/21842579
has answer: http://stackoverflow.com/a/21842579
has answer: http://stackoverflow.com/a/21841513
score: 0
has comment: http://stackoverflow.com/comment/33060816
has answer: http://stackoverflow.com/a/21841532
has body: So I have this code at the bottom, and I have to Instantiate myArray to a new array. Copy all data from int[] data to myArray. Set numMoves equal to 0. data Array holding the values input from the user. So this code I have here is done by just using int and just = signs and new, But now I need to change this Using "List" and I do not know what list is and how to use it. So what I need help on is What is List on java and how would I do this using List. Thanks, and i prefer telling me how it works thank you! public class Deletions { private int[] myArray; private int numMoves; public Deletions(int[] data) { myArray = new int [data.length] ; for(int n = 0; n &lt; data.length; n++) { myArray[n] = data[n]; } numMoves = 0; }
tagged with: collections
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33060681
tagged with: java
has answer: http://stackoverflow.com/a/21842239

http://stackoverflow.com/a/22262466
accepted answer of: http://stackoverflow.com/q/21837506
answers question: http://stackoverflow.com/q/21837506
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: I sent pull request that exposes this functionality via configuration option in undertow subsystem. you can now add &lt;servlet-container name="default" eager-filter-initialization="true"&gt; to enable this.
has comment: http://stackoverflow.com/comment/33885253

http://stackoverflow.com/comment/32946484
comment on: http://stackoverflow.com/a/21777005
score: 0
type: AnswerComment
has text: Thanks for pointing me in the right direction! Will keystore.setCertificateEntry add the certificate temporarily (only while this program is running) and locally (only for this application) or will this add the given certificate to my cacerts and thus it will forever be accepted?
type: Comment

hadoop
tags question: http://stackoverflow.com/q/21730212
tags question: http://stackoverflow.com/q/21700133
tag name: hadoop
tags question: http://stackoverflow.com/q/21839318
tags question: http://stackoverflow.com/q/21722173
tags question: http://stackoverflow.com/q/21724818
type: Tag
tags question: http://stackoverflow.com/q/21702950
tags question: http://stackoverflow.com/q/21713531
tags question: http://stackoverflow.com/q/21825044
tags question: http://stackoverflow.com/q/21698344
tags question: http://stackoverflow.com/q/21741832
tags question: http://stackoverflow.com/q/21785712
tags question: http://stackoverflow.com/q/21829775
tags question: http://stackoverflow.com/q/21747009
tags question: http://stackoverflow.com/q/21718356
tags question: http://stackoverflow.com/q/21738823
tags question: http://stackoverflow.com/q/21834219
tags question: http://stackoverflow.com/q/21685189
tags question: http://stackoverflow.com/q/21706133
tags question: http://stackoverflow.com/q/21828516
tags question: http://stackoverflow.com/q/21761021
tags question: http://stackoverflow.com/q/21836825
tags question: http://stackoverflow.com/q/21744665
tags question: http://stackoverflow.com/q/21681168
tags question: http://stackoverflow.com/q/21798292
tags question: http://stackoverflow.com/q/21718900
tags question: http://stackoverflow.com/q/21768376
tags question: http://stackoverflow.com/q/21679504

http://stackoverflow.com/a/26745630
has body: I think it is because you are using wrapper classes, i.e. Integer instead of int, which means that inside the class field you are only storing the reference. That means that in your constructor you are actually linking each class' currentMovieNumber to the static movieNumber so that when you increment the movieNumber, since all the instances' numbers point to it, every Ticket will have the same incremented number. Using int instead of Integer should solve this.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21708765

random
tags question: http://stackoverflow.com/q/21745852
tags question: http://stackoverflow.com/q/21736986
tags question: http://stackoverflow.com/q/21762954
tags question: http://stackoverflow.com/q/21822622
tags question: http://stackoverflow.com/q/21712919
tags question: http://stackoverflow.com/q/21714188
tags question: http://stackoverflow.com/q/21779331
tags question: http://stackoverflow.com/q/21825887
tags question: http://stackoverflow.com/q/21682667
tags question: http://stackoverflow.com/q/21709364
tags question: http://stackoverflow.com/q/21835975
tags question: http://stackoverflow.com/q/21761961
tags question: http://stackoverflow.com/q/21771911
tags question: http://stackoverflow.com/q/21795784
tags question: http://stackoverflow.com/q/21728502
tags question: http://stackoverflow.com/q/21773887
tags question: http://stackoverflow.com/q/21726033
tags question: http://stackoverflow.com/q/21717082
tag name: random
tags question: http://stackoverflow.com/q/21799872
type: Tag
tags question: http://stackoverflow.com/q/21703867
tags question: http://stackoverflow.com/q/21714533
tags question: http://stackoverflow.com/q/21732592
tags question: http://stackoverflow.com/q/21733945

http://stackoverflow.com/comment/33026743
has text: You have to install ODBC drivers for mac. Google it.
comment on: http://stackoverflow.com/q/21822268
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32794779
score: 0
has text: Does this answer help? http://stackoverflow.com/a/3653640/2958164
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21691551

http://stackoverflow.com/q/21680151
tagged with: eclipse
has body: I wrote a plugin which does some bulk changes to legacy code. The changes are done in a loop over a Collection of ICompilationUnits, which are processed one by one. Run multiple times, it is possible that the same compilation units are changed again. The command works fine, if run for the first time. After that, when I run the command again I get a JavaModelException. org.eclipse.jdt.core.JavaModelException: Update conflict at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:784) ~[na:na] at org.eclipse.jdt.internal.core.CompilationUnit.commitWorkingCopy(CompilationUnit.java:391) ~[na:na] ... What can I do to avoid this exception? My code handling the code changes looks like this: public void process(ICompilationUnit cu, SubMonitor monitor) throws CoreException { monitor.setWorkRemaining(7); try { cu.becomeWorkingCopy(monitor.newChild(1)); CompilationUnit unit = EclipseUtil.parseAst(cu, monitor.newChild(1)); ASTRewrite rewrite = ASTRewrite.create(unit.getAST()); ImportRewrite importRewrite = ImportRewrite.create(unit, true); // Do the Work processSearchResults(unit, rewrite, importRewrite, monitor.newChild(1)); cu.applyTextEdit(rewrite.rewriteAST(), monitor.newChild()); TextEdit importEdit = importRewrite.rewriteImports(monitor.newChild(1)); cu.applyTextEdit(importEdit, monitor.newChild(1)); if (monitor.isCanceled()) cu.discardWorkingCopy(); else cu.commitWorkingCopy(false, monitor.newChild(1)); } catch (Exception e) { cu.discardWorkingCopy(); throw e; } finally { monitor.done(); } } All instances are freshly read. The plugin itself does not cache anything. Is there something I forgot to do, like refreshing or closing a resource? Maybe the unit AST itself?
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has title: How to avoid "org.eclipse.jdt.core.JavaModelException: Update conflict"
type: UnansweredQuestion
tagged with: java
tagged with: eclipse-jdt
upvote count: 1
has answer: http://stackoverflow.com/a/21680767
type: Question

http://stackoverflow.com/q/21747057
has title: Java Geocoding - convert latitude and longitude into an address
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/21747139
has body: I need for my Android App the name of the city where my car is located in the moment. I have the latitude and longitude and want to convert this with the geocoder in the address and want to get the city. I read some blocks but because I'm new to this I dont get the clue. Please can anyone help me how to do this? EDIT: I dont use this geocoding in my app. I want to use it in my Java web service and I think I have to this with HTTPRequest, is it? and with the google api url.
tagged with: java
upvote count: 1
answer count: 1
tagged with: google-geocoder
has answer: http://stackoverflow.com/a/21747139
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32892979
favorite count: 0

http://stackoverflow.com/a/21802529
answers question: http://stackoverflow.com/q/21802195
type: Answer
has comment: http://stackoverflow.com/comment/32991714
upvote count: 0
has comment: http://stackoverflow.com/comment/32991807
score: -1
has comment: http://stackoverflow.com/comment/32991524
downvote count: 1
has body: I think you got quite some things wrong. First of all, when you use LinkedList all of the functionality you tried to implement already exists. Furthermore your style is relatively bad. For example, why do you use the WrapperClass Boolean for lookup? Combining functionality like contains with something like get in one method is not a good idea. Split this up in two methods, let contains just return a boolean and test if an element exists in the list. Let get search and return for an element. In addition to this you try to compare the Objects via equal. If you have not overwritten equals you can not delete anything ever, because equals needs reference equality which is not given most times. I would highly recommend that you buy a java book or something to improve your overall knowledge..

http://stackoverflow.com/a/21837832
answers question: http://stackoverflow.com/q/21837724
has body: No, don't store them in array- create a separate table instead and let your profileId be the foreign key for this table. table images( profileId int, image varchar )
score: 0
type: Answer

http://stackoverflow.com/q/21696784
favorite count: 0
accepted answer: http://stackoverflow.com/a/21696844
has title: How to declare an ArrayList with values?
linked to: http://stackoverflow.com/q/12321177
has body: ArrayList or List declaration in Java has questioned and answered how to declare an empty ArrayList but how do I declare an ArrayList with values? I've tried the following but it returns a syntax error: import java.io.IOException; import java.util.ArrayList; public class test { public static void main(String[] args) throws IOException { ArrayList&lt;String&gt; x = new ArrayList&lt;String&gt;(); x = ['xyz', 'abc']; } }
has answer: http://stackoverflow.com/a/21696850
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21696844
tagged with: java
has answer: http://stackoverflow.com/a/21696848
type: Question
score: 258
has answer: http://stackoverflow.com/a/21696869
possible better answer: http://stackoverflow.com/a/21696855
tagged with: declare
linked to: http://stackoverflow.com/q/1005073
has answer: http://stackoverflow.com/a/21696855
has answer: http://stackoverflow.com/a/35743150
answer count: 6
tagged with: arraylist
duplicate of: http://stackoverflow.com/q/1005073
downvote count: 2
upvote count: 260
tagged with: initialization

http://stackoverflow.com/a/21717893
answers question: http://stackoverflow.com/q/21713508
has comment: http://stackoverflow.com/comment/32847364
score: 0
has body: if you want to get the headers of request, here is a example snippet taking from netty's source code: HttpSnoopServerHandler.java public class HttpSnoopServerHandler extends SimpleChannelInboundHandler&lt;Object&gt; { @Override protected void messageReceived(ChannelHandlerContext ctx, Object msg) { if (msg instanceof HttpRequest) { HttpRequest request = this.request = (HttpRequest) msg; HttpHeaders headers = request.headers(); if (!headers.isEmpty()) { for (Map.Entry&lt;String, String&gt; h: headers) { String key = h.getKey(); String value = h.getValue(); buf.append("HEADER: ").append(key).append(" = ").append(value).append("\r\n"); } buf.append("\r\n"); ... } ... } } }
type: Answer

http://stackoverflow.com/a/21769798
upvote count: 2
has body: You could use low level JSONObject or create your own Class to accept the json parameter. The following is the example with JSONObject. ``` @Path("/rest") public class JerseyService { @POST @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") @Consumes(MediaType.APPLICATION_JSON) @Path("authenticate.svc") @Transactional(readOnly = true) public Response authenticate(final JSONObject login) throws IOException { System.out.println(login.getString("user")); System.out.println(login.getString("pwd")); //^^^^^^^^^^^^^^^^^ Response.ResponseBuilder responseBuilder = Response.ok(); responseBuilder.entity(JsonSerializer.serialize(Status.SUCCESS)); return responseBuilder.build(); } } ```
has comment: http://stackoverflow.com/comment/33038794
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21762888
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21762888

http://stackoverflow.com/q/21718213
has comment: http://stackoverflow.com/comment/32861875
tagged with: java
type: Question
answer count: 1
tagged with: logback
has comment: http://stackoverflow.com/comment/32869998
has comment: http://stackoverflow.com/comment/32842453
tagged with: slf4j
has comment: http://stackoverflow.com/comment/32870579
has comment: http://stackoverflow.com/comment/32862678
has answer: http://stackoverflow.com/a/21732627
score: 0
has body: I am trying to find the best way to address the issue of redundant string concatenation caused by using code of the following form: logger.debug("Entering loop, arg is: " + arg) // @1 In most cases the logger.level is higher than debug and the arg.toString() and the string concatenation are a waste that user up cpu cycles and briefly use up memory. Before the introduction of varargs the recommended approach was to test the logger level first: if (logger.isDebugEnabled()) logger.debug("Entering loop, arg is: " + arg); // @2 But now the preferred form is logger.debug("Entering loop, arg is: {}", arg); // @3 It is not very difficult to prefix each logger.debug with if (logger.isDebugEnabled()) (and its equivalent for the other methods) in a script, but I am trying to find the best way to convert the first form to the third. Any suggestions? The challenge is to insert the correct number brace pairs {} in the format string. I wish logback would append the remaining arguments not covered by the placeholder at the end but I cannot find a reference that it does that. As an alternative, I am thinking to write a class Concatenator as pasted at end and convert the first form to logger.debug(new Concatenator("Entering loop, arg is: ", arg)); // @4 The Concatenator class delays the call to arg.toString() and string concatenation until the logger calls toString(), thereby avoiding both if the logger is at a higher filter level. It does add the overhead of creating an Object[] and a Concatenator but that should be cheaper than the alternative. Questions: I think this conversion (@1-&gt;@4 -- replace + with , and enclose in new Contatenator(...)) is much easier. Is there something I am missing? Am I correct that @4 is much better than @1? public class Concatenator { final Object[] input; String output; public Concatenator(Object... input) { this.input = input; } public String toString() { if (output == null) { StringBuffer b = new StringBuffer(); for (Object s : input) b.append(s.t…
linked to: http://stackoverflow.com/q/355089
has comment: http://stackoverflow.com/comment/32871325
type: UnansweredQuestion
tagged with: logging
has title: Convert logger.debug("message: " + text) to logger.debug(message: {}", text)
has comment: http://stackoverflow.com/comment/32842149
has comment: http://stackoverflow.com/comment/32842531
has comment: http://stackoverflow.com/comment/32870133
has comment: http://stackoverflow.com/comment/32842309

http://stackoverflow.com/comment/32802717
comment on: http://stackoverflow.com/q/21696461
has text: the error message is that dbhand .Add_Temple() accepts arguments of type kovil not of type string...
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21721710
type: Answer
has body: As a general rule of thumb, if you need high availability (you want to have more than one machine to execute the task so that tasks are run even when a machine or app. instance fails), then use Quartz. Otherwise use ScheduledExecutorService.
answers question: http://stackoverflow.com/q/21721527
score: 0

http://stackoverflow.com/q/21733811
has comment: http://stackoverflow.com/comment/32869452
has comment: http://stackoverflow.com/comment/32869963
answer count: 3
has comment: http://stackoverflow.com/comment/32882775
has comment: http://stackoverflow.com/comment/32869505
has comment: http://stackoverflow.com/comment/32868959
has answer: http://stackoverflow.com/a/21733995
linked to: http://stackoverflow.com/q/16859973
has comment: http://stackoverflow.com/comment/32870041
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/32868868
has answer: http://stackoverflow.com/a/21734404
has title: How to make a new Object of type T
has body: I'm trying to make a new Object of type T. I tried: T h = new T(); T h = T.newInstance(); Those don't work. I also tried: T h = (T)(new Object()); That works, but then h.getClass().getName() returns java.lang.Object Is there any way to make a default object of this class without knowing the class name? EDIT (from comments): T is a generic. Like Class&lt;T&gt;.
possible better answer: http://stackoverflow.com/a/21734324
has comment: http://stackoverflow.com/comment/32868861
has answer: http://stackoverflow.com/a/21734324
has comment: http://stackoverflow.com/comment/32869692
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21733995
tagged with: java
linked to: http://stackoverflow.com/q/1090458
downvote count: 1
type: Question
upvote count: 5
score: 4

http://stackoverflow.com/comment/32935981
has text: Google for `invalid LOC header (bad signature)`.
comment on: http://stackoverflow.com/q/21771093
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21799248
has title: Run multiple classes in the same time?
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: import
type: Question
has comment: http://stackoverflow.com/comment/32985638
has answer: http://stackoverflow.com/a/21799692
has body: hi i am new to android encoding , i need a sample program that read data from the accelerometer and send them via wifi to my pc i have the accelerometer program that works fine and also a program that send data via wifi to my pc so the problem is that i dont know how to combine this two programs as a result i hope that the accelerometer class run in the background and return x and y values to the main program that send them accelerometer class public class MainActivity extends Activity implements SensorEventListener { private SensorManager mSensorManager; private Sensor mAccelerometer; TextView title,tv,tv1,tv2; RelativeLayout layout; @Override public final void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); //get layout layout = (RelativeLayout)findViewById(R.id.relative); //get textviews title=(TextView)findViewById(R.id.name); tv=(TextView)findViewById(R.id.xval); tv1=(TextView)findViewById(R.id.yval); tv2=(TextView)findViewById(R.id.zval); } @Override public final void onAccuracyChanged(Sensor sensor, int accuracy) { // Do something here if sensor accuracy changes. } @Override public final void onSensorChanged(SensorEvent event) { // Many sensors return 3 values, one for each axis. float x = event.values[0]; float y = event.values[1]; float z = event.values[2]; //display values using TextView title.setText(R.string.app_name); tv.setText("X axis" +"\t\t"+x); tv1.setText("Y axis" + "\t\t" +y); tv2.setText("Z axis" +"\t\t" +z); } @Override protected void onResume() { super.onResume(); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); } @Override protected void onPause() { super.onPause(); mSensorManager.unregisterListener(this); } } wifi communication class package net.client; import eneter.messaging.diagnostic…
score: 0
answer count: 1

http://stackoverflow.com/a/21713069
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21712998
has body: You are defining "int losses = 0" everytime you enter your if-statement, it is getting overwritten by 0, then you add 1 again, which results in 1 everytime. so defining int losses = 0; before if (game.getGameStatus() == GameStatus.Lost) { ... would fix the problem, like this: int losses = 0; if (game.getGameStatus() == GameStatus.Lost) { ... but be careful, this solution is just to show you, what the problem is, to actually make it correct, you should use a member-variable, and not pollute the global name-space
answers question: http://stackoverflow.com/q/21712998
upvote count: 1

http://stackoverflow.com/comment/33061907
has text: No create makes a copy of the details of the `Graphics` context, they still share the same output, but all you are changing is the underlying properties which are used to draw to that output...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21841683
type: AnswerComment

http://stackoverflow.com/a/21827666
has comment: http://stackoverflow.com/comment/33039995
has comment: http://stackoverflow.com/comment/33037827
has comment: http://stackoverflow.com/comment/33039494
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21827531
has comment: http://stackoverflow.com/comment/33037626
type: Answer
has body: Use this when you run your code on a local machine: private WebDriver driver = null; public void open() throws Exception { driver = new FirefoxDriver(); } And this when you run your code on a remote server: private WebDriver driver = null; public void openHeadless() throws Exception { FirefoxBinary binary = new FirefoxBinary(new File("/usr/local/bin/firefox")); binary.setEnvironmentProperty("DISPLAY",System.getProperty("lmportal.xvfb.id",":99")); driver = new FirefoxDriver(binary,null); }
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/33039270
has comment: http://stackoverflow.com/comment/37146099
accepted answer of: http://stackoverflow.com/q/21827531
score: 1
has comment: http://stackoverflow.com/comment/69710871

http://stackoverflow.com/comment/33025875
type: QuestionComment
type: Comment
has text: @fge: My enums have static methods, but interface cannot have a static `size()` method.
comment on: http://stackoverflow.com/q/21821751
score: 0

http://stackoverflow.com/q/21774943
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32942646
tagged with: reflection
linked to: http://stackoverflow.com/q/19740885
tagged with: java
has body: I am trying to retrieve count of voicemail .For this I am trying to call getMessageWaitingIndicator method of PhoneBase.java. My Code is as given below Class&lt;?&gt; class2=Class.forName("com.android.internal.telephony.PhoneBase"); Method method=class2.getMethod("getMessageWaitingIndicator"); Boolean returnValue=(Boolean) method.invoke(class2); But Everytime I am getting an exception as mentioned below : java.lang.IllegalArgumentException: expected receiver of type com.android.internal.telephony.PhoneBase, but got java.lang.class&lt;com.android.internal.telephony.PhoneBase&gt; I don't understand it. How can I fix this issue?
type: Question
has answer: http://stackoverflow.com/a/21775203
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32942666
has comment: http://stackoverflow.com/comment/32942521
has comment: http://stackoverflow.com/comment/32942695
has title: Invoke getMessageWaitingIndicator count of PhoneBase.java

http://stackoverflow.com/comment/32871017
comment on: http://stackoverflow.com/a/21733640
score: 0
type: Comment
has text: Exactly! But there is no common way to "access" the method from child class without this method in parent class.
type: AnswerComment

http://stackoverflow.com/comment/33003870
comment on: http://stackoverflow.com/q/21802440
score: 0
type: Comment
type: QuestionComment
has text: ok..I will post my approach here with the stacktrace...please see if you can help

http://stackoverflow.com/a/21836391
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33051656
upvote count: 3
has comment: http://stackoverflow.com/comment/33051619
has comment: http://stackoverflow.com/comment/33051644
answers question: http://stackoverflow.com/q/21836366
accepted answer of: http://stackoverflow.com/q/21836366
has body: Change to @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_sounds, container, false); Button button1=(Button)rootView.findViewById(R.id.button_1); Button button2=(Button)rootView.findViewById(R.id.button_2); button1.setOnClickListener(this); button2.setOnClickListener(this); return rootView; } Remove this private Button findViewById(int button1) { // TODO Auto-generated method stub return null; } And private void setContentView(int activityMain) { // TODO Auto-generated method stub } And setContentView(R.layout.fragment_sounds); in onCreate

http://stackoverflow.com/comment/32846693
has text: Why won't the 2nd case work?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21721271

http://stackoverflow.com/comment/33292979
has text: Awesome, thanks! The first idea with an array of mouse listeners completely took care of the issue. I'll keep the others in mind once the program gets more complicated. (And now I can start making it more complicated!)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21762148

http://stackoverflow.com/comment/33743355
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21838523
has text: Missing constructors in your Obstacle.java and PlayerCharacter.java classes
score: 0

http://stackoverflow.com/q/21764784
has comment: http://stackoverflow.com/comment/32924322
upvote count: 0
has comment: http://stackoverflow.com/comment/32924412
type: UnansweredQuestion
has body: I'm trying to use this library https://github.com/axet/vget I can't seem to figure out how to get a .jar file out of that so I can use it.
has answer: http://stackoverflow.com/a/21764813
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/32924353
answer count: 1
favorite count: 0
downvote count: 3
has title: How to use this library with Eclipse
score: -3

http://stackoverflow.com/comment/33101564
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21838833
has text: Did some googling myself out of curiosity, and no -- you're right. Seems like OpenGL is the way to go -- you can adopt the same concept of interpolation and really smooth animations, but the logic in "how" to setup the active rendering loop needs to be done differently. http://stackoverflow.com/questions/8522566/best-way-to-separate-game-logic-from-rendering-for-a-active-game-over-android-wi
type: AnswerComment

http://stackoverflow.com/q/21790912
upvote count: 2
answer count: 2
tagged with: garbage-collection
linked to: http://stackoverflow.com/q/407855
has answer: http://stackoverflow.com/a/21790950
has title: Java array of objects linked to each other
duplicate of: http://stackoverflow.com/q/407855
tagged with: java
possible better answer: http://stackoverflow.com/a/21790950
has answer: http://stackoverflow.com/a/21791041
has body: Suppose that, in Java, you have an array of objects that can point to each other. When the array goes out of scope, is the whole thing garbage collected, even though the elements reference each other?
has comment: http://stackoverflow.com/comment/32971222
score: 2
type: AnsweredQuestion
tagged with: arrays
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/21791041

http://stackoverflow.com/comment/32966400
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21787967
has text: Some [examples](http://stackoverflow.com/search?q=%5Bjava%5D+ProcessBuilder).
score: 0

http://stackoverflow.com/q/21745974
has body: How to use the JColorChooser to change the font color in java swing?
tagged with: java
type: Question
answer count: 2
tagged with: event-handling
score: 0
has answer: http://stackoverflow.com/a/21746008
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32894247
tagged with: swing
has answer: http://stackoverflow.com/a/21746290
tagged with: jcolorchooser
has title: JColorChooser to change the font color in Java

http://stackoverflow.com/comment/32810397
type: AnswerComment
comment on: http://stackoverflow.com/a/21698272
has text: I cant seem to locate the RuntimeInformation class, what package is it part of?
type: Comment
score: 0

http://stackoverflow.com/q/21792768
has comment: http://stackoverflow.com/comment/32974713
has answer: http://stackoverflow.com/a/21792919
answer count: 4
has comment: http://stackoverflow.com/comment/32974626
has title: Fastest way to check if a number is summable from two lists of integers?
has comment: http://stackoverflow.com/comment/32974614
has comment: http://stackoverflow.com/comment/32974607
has comment: http://stackoverflow.com/comment/32974672
has answer: http://stackoverflow.com/a/21792987
upvote count: 1
accepted answer: http://stackoverflow.com/a/21792919
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32974596
score: 1
tagged with: math
tagged with: java
tagged with: loops
possible better answer: http://stackoverflow.com/a/21792886
has comment: http://stackoverflow.com/comment/32974658
has answer: http://stackoverflow.com/a/21792886
type: Question
has answer: http://stackoverflow.com/a/21792922
has body: So, I have a list of integers. I need to find out if a specific number can be added by any two numbers from a list(non-unique numbers). What I have so far: boolean cs = false; t: for(Integer i1 : primes) { for(Integer i2 : primes) { if(i1 + i2 == i) { cs = true; break t; } } } Unfortunately, as this list gets higher(because each time there are no two sums, it must find and create a new sum to keep the sequence going), this function takes exponentially longer to execute. Are there any ways to prevent such an issue? As this function gets into the thousands, it more or less just stops due to how long it takes.
downvote count: 0
has comment: http://stackoverflow.com/comment/32974630
has comment: http://stackoverflow.com/comment/32974978
has comment: http://stackoverflow.com/comment/32974613
has comment: http://stackoverflow.com/comment/32974637
favorite count: 0

http://stackoverflow.com/a/21818967
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33022029
accepted answer of: http://stackoverflow.com/q/21818824
answers question: http://stackoverflow.com/q/21818824
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33035976
has comment: http://stackoverflow.com/comment/33021847
has body: Your dialog is recreated automatically, so pauseMenu.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); is not called. So, try to call this set in your onCreate() after calling super.onCreate()

http://stackoverflow.com/comment/33165329
comment on: http://stackoverflow.com/q/21838950
type: Comment
type: QuestionComment
has text: use case is a normal site behavior like Facebook different users cand log in with their accounts in the same time , , my developed site see that for example if you logged before me and I tried to log in I see that someone is logged in my app allows that .. ! The memory isn't cleaned or the session isn't created for new access to the app I dont know ! :(
score: 0

http://stackoverflow.com/a/21714235
answers question: http://stackoverflow.com/q/21713531
has body: The problem is likely not with your Murmur3 hashing, but rather with the native library and how it allocates memory. I'm not experienced with JNI-calls, but they are problematic when it comes to memory use (every such call allocates stack and heap-space). One can not be sure that the GC can trigger correctly (read the horror stories about GZipInputStream). You say you have 22*100 threads created, each one likely allocating some stack for JNI-calls, and just 4Gb memory in the box. The machine seems to be quite crowded, and I guess it's CPU/memory access that is the constraint here, not long external waits (where only few threads are really active in parallell)? What happends when you lower the amount of threads radically? How is the SimStrings library meant to be used? Does it have an internal threading model which should be respected (ie just letting one thread make it's queries at once?). I'm afraid the JNI is quite singlethreaded. Read more about how native calls allocate memory.
score: 0
type: Answer

http://stackoverflow.com/comment/33009702
comment on: http://stackoverflow.com/a/21812654
score: 0
type: AnswerComment
has text: or all the commas! So just copy paste the content of your list `USA,UK` and replace all `,` with `","`
type: Comment

http://stackoverflow.com/a/21761930
has body: Assuming you are programming in Java, this works: if (90 &gt;= angle &amp;&amp; angle &lt;= 180 ) { (don't you mean 90 is less than angle? If so: 90 &lt;= angle)
has comment: http://stackoverflow.com/comment/32919000
has comment: http://stackoverflow.com/comment/32925258
has comment: http://stackoverflow.com/comment/32921897
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21761875
has comment: http://stackoverflow.com/comment/32927769
has comment: http://stackoverflow.com/comment/32921399
has comment: http://stackoverflow.com/comment/32924678

http://stackoverflow.com/comment/126199191
score: 0
has text: You saved me a livetime, thanks
type: Comment
comment on: http://stackoverflow.com/a/69410018
type: AnswerComment

http://stackoverflow.com/comment/33058736
type: QuestionComment
score: 0
has text: There is nothing wrong with the code snippet you're showing. `delta` will accurately hold the number of seconds between `now` and `lastUpdateTime` represented as a `double`
comment on: http://stackoverflow.com/q/21840006
type: Comment

http://stackoverflow.com/comment/32852585
type: Comment
score: 1
type: QuestionComment
has text: Is `muggle` an English word? Is `hobbit` an english word, or just something that J.R.R. Tolkien made up? Are `peking` or `beijing` english words, or just english transcriptions of a Chinese name? For that matter, is "john" an English *word*?
comment on: http://stackoverflow.com/q/21715354

http://stackoverflow.com/a/42834492
type: Answer
has body: In my case we added the @Profile annotation newly in order to ignore the TestApplication class in production mode and the Application class in test mode. Unfortunately, we forgot to add the following line into the application.properties files: spring.profiles.active=test or spring.profiles.active=production Without these config no profile was loaded which caused the not-so-much saying Spring Error.
answers question: http://stackoverflow.com/q/21783391
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/88936741
upvote count: 1

http://stackoverflow.com/q/21801136
tagged with: class
accepted answer: http://stackoverflow.com/a/21802188
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32989154
has comment: http://stackoverflow.com/comment/32989583
has comment: http://stackoverflow.com/comment/32989004
favorite count: 0
has comment: http://stackoverflow.com/comment/32989056
has comment: http://stackoverflow.com/comment/32989648
has comment: http://stackoverflow.com/comment/32989484
tagged with: void
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21802188
tagged with: java
has comment: http://stackoverflow.com/comment/32988958
upvote count: 1
tagged with: methods
downvote count: 1
type: Question
has title: How to run everything in a method in one class?
has comment: http://stackoverflow.com/comment/32989602
tagged with: arrays
has body: So Here's my question... I have a java program for checkers, I want to initialize the checkers in a different class, as a method (I Think), and then create all of them. Here's my code: http://pastebin.com/ansERKjv So how do I call the method DoCreate() in my main class? Also if I want to do what I've stated above, but put Create in a different file, and then call the method public void DoCreate() how would I do that? Would I have to import class Checker. ThankS import java.util.logging.*; //Jake Sylvestre public class Checkers { public static void main (String[] args) { //Creates all the checkers } } class Checker { int x; int y; int id; boolean white; boolean king; } class Create { public void DoCreate()//Creates all the pieces and gives them starting values { //YES writing an algorithm to skip every other space would be more effecient for me, but would slow down code //intalizing checker //checker create code starts //WHITE BELOW Checker checker1 = new Checker();//Creates the checker object checker1.x=1;//starting x value checker1.y=1;//starting y value checker1.id=1;//Checker Id checker1.king=false;//Is it a king //checker create code end //intalizing checker 2 //checker 2 create code starts Checker checker2 = new Checker();//Creates the checker object checker2.x=2;//starting x value checker2.y=1;//starting y value checker2.id=2;//Checker Id checker2.king=false;//Is it a king //checker 2 create code end //intalizing checker //checker create code starts Checker checker3 = new Checker();//Creates the checker object checker3.x=5;//starting x value checker3.y=1;//starting y value checker3.id=3;//Checker Id checker3.king=false;//Is it a king //checker create code end //intalizing checker //checker create code starts Checker checker4 = new Checker();//Creates the checker object checker4.x=7;//starting x value checker4.y=1;//starting y value checker4.id=4;//Checker Id checker4.king=false;//Is it a king //checker create code end //intalizing checker //checker create code…
has comment: http://stackoverflow.com/comment/32989540

http://stackoverflow.com/comment/32973304
comment on: http://stackoverflow.com/q/21792030
score: 0
has text: @cHao - i was generalizing. yes, just throwing synchronized around does not make your code thread-safe. how about "synchronization is a mechanism for making code thread-safe, but not all thread-safe code uses synchronization".
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33036629
score: 1
has text: See http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.1 - the compiler is doing exactly what it's meant to...
comment on: http://stackoverflow.com/q/21828206
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21686574
has comment: http://stackoverflow.com/comment/32784944
has answer: http://stackoverflow.com/a/21686710
tagged with: java
has comment: http://stackoverflow.com/comment/32785001
type: Question
has body: I have a double array like this: double[] darr = new double[50]; and I have some elements in it. How can I convert it to a List double array like: List&lt;double[]&gt; x = new ArrayList&lt;double[]&gt;();
has title: Convert double array to double List array
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32785039
has answer: http://stackoverflow.com/a/21686737
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21686724

http://stackoverflow.com/a/21765277
upvote count: 2
has body: Short Answer The type safe interfaces are all Deprecated, you have to do the lookup/tree walking manually. As of 9.0, the MBeanHome interface and all type-safe interfaces for WebLogic Server MBeans are deprecated. Instead, JMX applications that interact with WebLogic Server MBeans should use standard JMX design patterns in which clients use the javax.management.MBeanServerConnection interface to discover MBeans, attributes, and attribute types at runtime. Long Answer private InitialContext ctx; private MBeanServer domain; private ObjectName domainObjectName; In the constructor: ctx = new InitialContext(); this.domain = (MBeanServer) ctx.lookup("java:comp/env/jmx/domainRuntime"); this.domainObjectName = new ObjectName("com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean"); In your method: final ObjectName dr = (ObjectName) this.domain.getAttribute(domainObjectName, "DomainRuntime"); final ObjectName dm = (ObjectName) this.domain.getAttribute(dr, "DeploymentManager"); final ObjectName[] adrs = (ObjectName[]) this.domain.getAttribute(dm, "AppDeploymentRuntimes"); for (final ObjectName on : adrs) { if (this.domain.getAttribute(on, "ApplicationName").equals(appName)) { this.domain.invoke(on, "stop", null, null); break; } } Of course now I have to write my own convenience classes that are typesafe to wrap all this verbose non-sense!
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21761738
answers question: http://stackoverflow.com/q/21761738
type: Answer

http://stackoverflow.com/q/21799464
has body: I've been trying set custom ListView adapter for navigation drawer it derived from BaseAdapter so when I set OnItemClickListener it doesn't work on either ListView.OnItemClickListener and AdapterView.OnItemClickListener. Googled around but all examples derive from ArrayAdapter since BaseAdapter desired. Can anyone help me on this? NavigationDrawer fragment onCreateView drawerItems = new ArrayList&lt;DrawerItem&gt;(); drawerItems.add(DrawerItem.create(1, getString(R.string.ideas), getDrawable(R.drawable.ic_action_diamond))); drawerItems.add(DrawerItem.create(2, getString(R.string.categories), getDrawable(R.drawable.ic_action_categories))); drawerItems.add(DrawerItem.create(3, getString(R.string.priorities), getDrawable(R.drawable.ic_action_priorities))); mDrawerListAdapter = MenuAdapter.newInstance(getActivity(), drawerItems); mDrawerListView.setItemsCanFocus(true); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Log.d(TAG, String.valueOf(position)); selectItem(position); } }); mDrawerListView.setAdapter(mDrawerListAdapter); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); My custom adapter public class MenuAdapter extends BaseAdapter { private static final String TAG = "AD:MENU"; private final LayoutInflater mLayoutInflater; private List&lt;DrawerItem&gt; items; private Context context; public MenuAdapter(Context ctx, List&lt;DrawerItem&gt; items) { this.items = items; this.context = ctx; this.mLayoutInflater = LayoutInflater.from(ctx); } public static MenuAdapter newInstance(Context ctx, List&lt;DrawerItem&gt; items) { return new MenuAdapter(ctx, items); } @Override public int getCount() { return items == null ? 0 : items.size(); } @Override public Object getItem(int position) { return items.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View …
linked to: http://stackoverflow.com/q/19508480
has comment: http://stackoverflow.com/comment/32987914
tagged with: android-listview
downvote count: 0
has comment: http://stackoverflow.com/comment/32987166
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32987456
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32987804
has comment: http://stackoverflow.com/comment/32985911
tagged with: navigation-drawer
type: Question
has title: Android: navigation drawer with custom adapter onItemClickListener
has comment: http://stackoverflow.com/comment/32985878
has comment: http://stackoverflow.com/comment/32987424

http://stackoverflow.com/a/21800237
has comment: http://stackoverflow.com/comment/32987684
answers question: http://stackoverflow.com/q/21799804
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33044480
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32987490
accepted answer of: http://stackoverflow.com/q/21799804
has body: Create a public static method in any class (but probably one that is intuitive to find*) that populates the spinner. It can take context, database, etc. as inputs, as well as the Spinner itself. Then you can call this same method from any fragment or activity and always get the same thing. Just create your layout (such as with setContentView), get a reference to the spinner from the layout, and pass it to your populater method. Example: //in Activity public void onCreate(Bundle bundle){ super.onCreate(bundle); DatabaseHelper myDataBaseHelper = ...;// setContentView(R.layout.my_layout); Spinner spinner = (Spinner)findViewById(R.id.my_spinner); Util.populateStandardSpinner(myDataBaseHelper, spinner, getApplicationContext()); //... } //Another class public class Util{ public static void populateStandardSpinner(DatabaseHelper dbHelper, Spinner spinner, Context context) { //Get cursor from dbHelper //Create adapter for cursor data and apply it to spinner } I suppose you could also extend the Spinner class, but my preference is to avoid coding the data directly into the widget. That would break the model-view-controller design pattern. *I sometimes just create a class called Util where I put convenient static methods like this. Or if you have a database helper class, that might be an intuitive place to put it.

http://stackoverflow.com/comment/32969045
has text: @Takendarkk.. thanks for directing to the right place.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21789787

http://stackoverflow.com/comment/32808123
type: QuestionComment
has text: I have added the code below check in the answers section.
score: 0
comment on: http://stackoverflow.com/q/21698038
type: Comment

http://stackoverflow.com/comment/32783715
score: 0
type: Comment
type: QuestionComment
has text: @MasonWheeler It's easy enough to do this in Python and Java
comment on: http://stackoverflow.com/q/21685497

http://stackoverflow.com/q/21826128
score: 0
has comment: http://stackoverflow.com/comment/33033583
has answer: http://stackoverflow.com/a/61088063
has body: I am getting the system current timezone: Calendar calendar = new GregorianCalendar(); TimeZone systemTimeZone = calendar.getTimeZone(); If I run from the Java main method, it gives the correct system timezone. If I run from the web application (from REST web services) it gives Asia/Irkutsk as a timezone. But it is wrong, why?
answer count: 1
has comment: http://stackoverflow.com/comment/108090446
tagged with: time
tagged with: timezone
has title: Why the timezone vary from main method and form web application in java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33033461
tagged with: java
has comment: http://stackoverflow.com/comment/33033607
type: Question

http://stackoverflow.com/q/21828476
type: Question
tagged with: gwt
tagged with: javascript
score: 0
has title: I want to give communication between two html's in gwt
has comment: http://stackoverflow.com/comment/33044784
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33047869
answer count: 0
tagged with: java
has body: I want to add a widget from one html to another html using RootPanel onlyin onemodule otherwise i need to maintain state between two html this is entry point in one html public void onModuleLoad() { Button button=new Button("click me"); button.addClickHandler((ClickHandler) this); RootPanel rootPanel=RootPanel.get("id_html1"); rootPanel.add(button); } this is for another html i want to add this widget here using RootPane public void onClick(ClickEvent event) { String url="http://localhost:9090/HelloWorld/"+"HelloWorld2.html"; Window.open(url, "_blank", ""); Button button=new Button("finish it!"); //button.addClickHandler((ClickHandler) this); RootPanel rootPanel=RootPanel.get("id_html2"); rootPanel.add(button);

http://stackoverflow.com/q/21834286
tagged with: java
has title: search an element in a string using Pattern and matcher in Java
has body: I am trying to search an element in a string using Pattern and matcher in Java. i have a node variant-items and need to get all the characters coming between these nodes. i tried the below regex but it is skipping this line altogether. however if i search using the same regex in Notepad++ i am getting the desired resulted selected. please advice. &lt;variant-items&gt;((.|\n)*)&lt;/variant-items&gt; Below is my implemenation String patternSourceComponent = "&lt;variant-items&gt;((.|\n)*)&lt;/variant-items&gt;"; String result=this.isMatched(patternSourceComponent, xml); public String isMatched(String patternSourceComponent,String xml) { String varientItem=""; try{ Pattern patternComponent = Pattern.compile(patternSourceComponent); Matcher matcherComponent = patternComponent.matcher(xml); System.out.println("matcherComponent Find : "+matcherComponent.find()); while (matcherComponent.find()) { varientItem=matcherComponent.group(0).trim(); System.out.println("varientItem : "+varientItem); } } catch (Exception e) { System.out.println("Exception : "+e); } return varientItem; }
type: Question
has comment: http://stackoverflow.com/comment/33047779
answer count: 1
linked to: http://stackoverflow.com/q/1732348
score: 0
has answer: http://stackoverflow.com/a/21834537
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33047763

http://stackoverflow.com/comment/32941198
type: Comment
type: QuestionComment
has text: Yes, as I wrote in my answer bellow, this was exactly the problem.
score: 0
comment on: http://stackoverflow.com/q/21732407

http://stackoverflow.com/q/21758008
has answer: http://stackoverflow.com/a/54561980
has title: How to use a JTA transaction with two databases?
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21759629
downvote count: 0
tagged with: jta
favorite count: 0
linked to: http://stackoverflow.com/q/9795677
tagged with: distributed-transactions
tagged with: jboss5.x
score: 1
linked to: http://stackoverflow.com/q/434950
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/21759629
has body: App1 interacts with App2(EJB application) using some client api exposed by App2.Uses CMT managed JTA transaction in Jboss.We are getting the UserTransaction from App2(Jboss) using JNDI look up. App1 makes a call to App2 to insert data into DS2 using UserTransaction's begin() and commit(). App1 makes a call to DS1 using Hibernate JPA to insert data into DS1 using JPATransaction Manager. Is it possible to wrap above both DB operations in a single transaction(Distributed transaction) PFB the image which describes requirement
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/54561980
tagged with: java

http://stackoverflow.com/q/21691330
has title: java generics runtime type
downvote count: 2
has comment: http://stackoverflow.com/comment/32822054
type: Question
has answer: http://stackoverflow.com/a/21716738
tagged with: java
score: 4
has comment: http://stackoverflow.com/comment/32795400
answer count: 2
has body: A post I found by Ian Robertson has a great utility method for determining the runtime class for a Java class type parameter. It goes a few steps beyond the quick version: ParameterizedType pt = (ParameterizedType)this.getClass().getGenericSuperclass(); Class&lt;?&gt; c = (Class&lt;?&gt;) pt.getActualTypeArguments()[0] Either method works like a charm for parameterized children inheriting from an abstract parameterized parent (class Foo&lt;T&gt; extends Bar&lt;T&gt;), or an anonymous instance of a parameterized abstract class (new Foo&lt;Bar&gt;() {}), and instantiated with a concrete type. Where I fail is in trying to do the same for some other object instantiated via type parameter. Relevant class objects are: public class Foo {/* code omitted for brevity */} public class MyFoo extends Foo {/* code omitted for brevity */} public abstract class AbstractLoader&lt;T extends Foo&gt; {/* code omitted for brevity */} public abstract class AbstractReader&lt;T extends Foo&gt; {/* code omitted for brevity */} public class MyReader&lt;T extends Foo&gt; extends AbstractReader&lt;T&gt; {/* code omitted for brevity */} public class Loader&lt;T extends Foo&gt; extends AbstractLoader&lt;T&gt; { /* code omitted for brevity */ public MyReader&lt;T&gt; getReader() { // Parameterized type "T" doesn't seem to carry through here return new MyReader&lt;T&gt;(); } } Sample Code: static void main(String... s) { Loader&lt;MyFoo&gt; loader = new Loader&lt;&gt;(); // new Loader&lt;MyFoo&gt;() for Java &lt; 1.7 MyReader&lt;MyFoo&gt; = loader.getReader(); ParameterizedType pt = (ParameterizedType)loader.getClass().getGenericSuperclass(); System.out.println("LoaderType = " + pt.getActualTypeArguments()[0]); // Prints: LoaderType = MyFoo pt = (ParameterizedType)reader.getClass().getGenericSuperclass(); System.out.println("ReaderType = " + pt.getActualTypeArguments()[0]); // Prints: ReaderType = T } Intuition tells me this "should" be possible somehow, but I can't seem to discover the right answ…
tagged with: runtime
favorite count: 0
has answer: http://stackoverflow.com/a/21711302
has comment: http://stackoverflow.com/comment/32830366
type: UnansweredQuestion
tagged with: generics
upvote count: 6
tagged with: reflection

http://stackoverflow.com/q/21835098
accepted answer: http://stackoverflow.com/a/21835141
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has title: Java: Adding the same object in a NavigableSet rejected
has answer: http://stackoverflow.com/a/21835141
tagged with: java
tagged with: set
has body: Here's my code: import java.util.*; public class AnotherBackedCollectionsTest{ public static void main(String... args){ Shape square = new Shape("square"); Shape circle = new Shape("circle"); Shape triangle = new Shape("triangle"); NavigableSet<Shape> shapes = new TreeSet<Shape>(); shapes.add(square); shapes.add(circle); shapes.add(triangle); System.out.println("New shape added? " +shapes.add(new Shape("square"))); for(Shape s : shapes){ System.out.println(s.getName()); } Set<Shape> shapes2 = new HashSet<Shape>(); shapes2.add(square); shapes2.add(triangle); shapes2.add(circle); System.out.println("New shape added? " +shapes2.add(new Shape("square"))); for(Shape s : shapes2){ System.out.println(s.getName()); } } } class Shape implements Comparable<Shape>{ private String name; public Shape(String name){ this.name = name; } public String getName(){ return this.name; } public int compareTo(Shape shape){ return this.name.compareTo(shape.getName()); } } And I get this output: New shape added? false circle square triangle New shape added? true triangle square square circle As you can see, I did not override the equals() method on the Shape object. What I found weird here was when I tried to add another Shape object with the name "square" in the NavigableSet, it rejected it somehow. Is is because Shape implements Comparable<T> so it used the overriden compareTo() method to determine method equality? Basically, what I'm trying to ask is how did the NavigableSet determine that I was trying to add a duplicate object where, in fact, I did not override the equals() method.
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/33034868
comment on: http://stackoverflow.com/a/21826422
type: Comment
has text: I'm still getting the NullPointerException. In my MainActivity, I did the above (calling the function I mean). But the App doesn't even start. It crashes immediately. When debugged, the debug window shows Source Not Found in ContextWrapper
score: 0
type: AnswerComment

http://stackoverflow.com/a/21704486
has body: The normal approach would be to throw an exception at this point. So your code would look like: public int computeFac(int input) { if (input &lt; 0) { throw new IllegalArgumentException("Negative numbers are not allowed"); } for ( a = 1 ; a &lt;= input ; a++ ) { result = result*a; } return result; } Also, note, that it's a good idea to always use braces for loops and conditionals, even if they only have one line.
accepted answer of: http://stackoverflow.com/q/21704350
answers question: http://stackoverflow.com/q/21704350
has comment: http://stackoverflow.com/comment/32819879
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/comment/33021549
type: Comment
has text: Ah, I should have checked there first :) Not sure - did you explicitly load the jar as a library in your project by referencing the external jar under the plugins dir? If so, then you would need to attach the source as you normally would for libraries like that.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21819196

http://stackoverflow.com/q/21751830
accepted answer: http://stackoverflow.com/a/21754005
tagged with: typing
downvote count: 0
has comment: http://stackoverflow.com/comment/32902843
has title: Can't rely on target typing when chaining methods
type: AnsweredQuestion
tagged with: generics
has comment: http://stackoverflow.com/comment/32904995
favorite count: 0
type: Question
answer count: 1
tagged with: java-8
has comment: http://stackoverflow.com/comment/32903694
score: 4
tagged with: java
has comment: http://stackoverflow.com/comment/32902620
has answer: http://stackoverflow.com/a/21754005
has comment: http://stackoverflow.com/comment/32902592
upvote count: 4
has body: In Java 8, type inference has been extended to target typing which enables to write: Comparator&lt;String&gt; ascending = comparingInt(String::length); without having to use a type witness (Comparator.&lt;String&gt; comparingInt). However the last statement below does not compile. Is there a reason? Is there a workaround? Comparator&lt;String&gt; ascending = comparingInt(String::length); //ok Comparator&lt;String&gt; descending = ascending.reversed(); //ok Comparator&lt;String&gt; descending = reverseOrder(comparingInt(String::length)); //ok Comparator&lt;String&gt; descending = Comparator.&lt;String&gt;comparingInt(String::length) .reversed(); //ok Comparator&lt;String&gt; descending = comparingInt(String::length).reversed(); //error

http://stackoverflow.com/q/21735487
has answer: http://stackoverflow.com/a/21735546
upvote count: 3
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
has title: JUnit testing method containing Thread.sleep
type: UnansweredQuestion
has body: I have a system under test which is simulating elevators. I am testing whether the elevator arrives at a particular floor. This is the code of my test: int chosenFloor=r.nextInt(6)+6; lc.moveLift(0, chosenFloor); //moving lift 0 to the chosen floor open=false; floor=chosenFloor; moving=false; assertEquals(floor, lc.getLifts()[0].getFloor()); Now the method moveLift calls this piece of code: lift.setMoving(true); int fromFloor = lift.getFloor(); setLiftFloor(fromFloor); lift.setMoving(true); if (toFloor &gt; fromFloor) { for (int i = fromFloor; i &lt; toFloor; i++) { animateUp(i); lift.setFloor(i); } } else { for (int i = fromFloor; i &gt; toFloor; i--) { animateDown(i); lift.setFloor(i); } } And animateUp calls this method: int lower = currentFloor * animationStepsPerFloor; int upper = lower + animationStepsPerFloor - 1; for (int i = 0; i &lt; animationStepsPerFloor; i++) { try { Thread.sleep(50); } catch (Exception e) { e.printStackTrace(); } lower++; upper++;} So as you can see, time plays an important factor. Right now, with my current test, the lift does not move. It is obvious that I have to wait for the lift to move, how can I do it in a test case. I have tried placing Thread.sleep in my test case, but it's futile.
tagged with: java
tagged with: multithreading
type: Question
score: 3

http://stackoverflow.com/a/21788645
has comment: http://stackoverflow.com/comment/36727798
has comment: http://stackoverflow.com/comment/32966655
has comment: http://stackoverflow.com/comment/32966960
has comment: http://stackoverflow.com/comment/32968100
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32966688
has comment: http://stackoverflow.com/comment/32968060
has comment: http://stackoverflow.com/comment/32967507
type: Answer
has comment: http://stackoverflow.com/comment/32967617
upvote count: 3
score: 1
downvote count: 2
accepted answer of: http://stackoverflow.com/q/21788530
has comment: http://stackoverflow.com/comment/32967277
answers question: http://stackoverflow.com/q/21788530
has comment: http://stackoverflow.com/comment/32969215
has body: A binary search-like algorithm should work. That employs divide and conquer strategy. since you are interested in single peak, the best you can do is O(log n). But if you want to find all peaks, it will be O(n) atleast. Here is the divide-and conquer algorithm: public static int peak1D(int[] arr, int start, int end){ //edge cases if (end-start==1){ if (start==0) return start; else return end; } int i = start+end&gt;&gt;&gt;1; if (arr[i]&lt;arr[i-1]) return peak1D(arr,start,i); if (arr[i]&lt;arr[i+1]){ return peak1D(arr, i, end); } else return i; } I tested with a couple of inputs and it seems to work. my handling of edge cases is not great. though it is simple reasoning
has comment: http://stackoverflow.com/comment/32967201

http://stackoverflow.com/comment/32888841
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21744679
has text: First off, that `if` statement is monstrous. You've ***got*** to think of better ways to express that. Second, unless `Tile` is an `enum`, `==` isn't going to work the way you expect it to. Third, enumerate which conditions you want to be true - where specifically do you care that the wood is?
score: 3

http://stackoverflow.com/comment/32919725
type: QuestionComment
comment on: http://stackoverflow.com/q/21762328
score: 2
has text: `userId` needs to be of type `User` with a `@OneToOne`/`@JoinColumn` on it. Also note you have a typo (contentId/userId)
type: Comment

http://stackoverflow.com/comment/32859013
type: AnswerComment
score: 0
type: Comment
has text: The edited explanation is quite enlightening...I think pseudo code need to be updated according to explanation and I think it can be done in O(log n)...
comment on: http://stackoverflow.com/a/21722977

http://stackoverflow.com/comment/32930017
has text: Could you clarify what you mean by you "can't display them in a table"? Clarification of the question may help me figure out what you really want. Are you trying to say you need the ResultSet data to be a List so that you can iterate over the list with .next()? I don't know if ResultSet extends the Iterable class or not.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21767762
type: QuestionComment

http://stackoverflow.com/q/21733765
tagged with: fonts
has answer: http://stackoverflow.com/a/21733983
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21733941
has title: How to change font size of all private JLabels
type: Question
has comment: http://stackoverflow.com/comment/32868847
linked to: http://stackoverflow.com/q/1966296
downvote count: 0
accepted answer: http://stackoverflow.com/a/21734043
has body: I have seen similar questions such as this, but in my case I have 25+ private JLabels that I give a value for when I declare it. I use a GridBagLayout in my constructor to add these JLabels to a JPanel. If I use something along the lines of the answer given in the link, it will only change JLabels that were added in the constructor. So it seems to me that if I want to change the font size of my private JLabels, I would have to either define the font size for them individually, or change the default in my constructor and then add my JLabels. However, I am sure that there must be another, simpler way, but I just don't have the experience or understanding to figure it out, or to make proper adjustments from answers to other similar questions. I don' think that this really requires me to show my code, but if it helps I can do so. public class LaborRecordPanel implements Printable, ActionListener { private Color shade = new Color(201,201,201); private ImageIcon logoIcon = new ImageIcon("Images/fici_logo1.jpg"); private JLabel logoLabel = new JLabel(logoIcon); private JLabel authorizedBy = new JLabel("AUTHORIZED BY:"); private JLabel toCertify = new JLabel("THIS IS TO CERTIFY THAT THE ABOVE LABOR HAS BEEN PERFORMED."); private JLabel laborRecordNO = new JLabel("NO."); private JLabel nameOfJob = new JLabel("NAME OF JOB:"); private JLabel customerPO = new JLabel("CUSTOMER PO #:"); private JLabel contractNO = new JLabel("CONTRACT NO."); private JLabel weekEnding = new JLabel("WEEK ENDING"); private JComboBox laborRateDescription = new JComboBox(); //... JPanel rp = new JPanel(); JScrollPane scrollPane = new JScrollPane(rp); LaborRecordPanel(){ //Font oldLabelFont = UIManager.getFont("Label.font"); //UIManager.put("Label.font",oldLabelFont.deriveFont(Font.PLAIN)); //UIManager.put("Label.font", UIManager.getFont("Label.font").deriveFont(40)); //SwingUtilities.updateComponentTreeUI(rp); rp.setPreferredSize(new Dimension(1295,1830 )); scrollPane.getVerticalScrollBar().setUnitInc…
answer count: 3
score: 3
favorite count: 0
tagged with: jlabel
tagged with: swing
has comment: http://stackoverflow.com/comment/32868823
has answer: http://stackoverflow.com/a/21734043
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21733941

http://stackoverflow.com/comment/32881765
has text: +1yep, makes sense; your logic for using table is explained well above, but the recursive one lacks explanation; especially for the last two return statements..
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21740441

http://stackoverflow.com/q/21693721
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/21693892
accepted answer: http://stackoverflow.com/a/21694122
has body: how to get non resizable frame in gui i confused about this because i am using setLayout(new FlowLayout()); so if i drag the size of the frame the location of my button is going to disarrange . here is my code so far import java.awt.*; import javax.swing.*; public class aw extends JFrame { private JTextField aw1; private JLabel aww; private JButton aw2; public aw() { setLayout(new FlowLayout()); aww = new JLabel("Enter Your Password"); add(aww); aw1 = new JTextField(15); add(aw1); aw2 = new JButton("Enter"); add(aw2); } public static void main(String args []) { aw v = new aw(); v.setSize(200,200); v.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); v.setVisible(true); } }
tagged with: swing
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21694122
linked to: http://stackoverflow.com/q/18031704
tagged with: layout-manager
has title: Resizable frame in Gui
has answer: http://stackoverflow.com/a/21693892
answer count: 2
duplicate of: http://stackoverflow.com/q/18031704

http://stackoverflow.com/a/21810056
answers question: http://stackoverflow.com/q/21810044
has comment: http://stackoverflow.com/comment/33005068
has comment: http://stackoverflow.com/comment/33005549
has comment: http://stackoverflow.com/comment/33005149
has body: Loop doesn't end upon entering negative number until user finish entering all values. Because that's exactly what you're doing. If you want to terminate after one negative value, put if right after you ask for each input: heightOne = Integer.parseInt(JOptionPane.showInputDialog("Enter Height of First Tower")); if(heightOne &lt; 0) { displayError(); //return; ? } heightTwo = ... if(heightTwo &lt; 0) { displayError(); } ... Please follow Java Naming Conventions and change HeightOne to heightOne.
has comment: http://stackoverflow.com/comment/33005351
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33005265
score: 4
has comment: http://stackoverflow.com/comment/33005325
has comment: http://stackoverflow.com/comment/33005044
has comment: http://stackoverflow.com/comment/33005451
accepted answer of: http://stackoverflow.com/q/21810044
has comment: http://stackoverflow.com/comment/33005143
has comment: http://stackoverflow.com/comment/33005519
type: Answer

http://stackoverflow.com/a/21808948
type: Answer
has body: if(IP != null &amp;&amp; IP.getHostAddress().equals("192.168.0.69")) { System.out.println("The address is matched"); } IP.getHostAddress() method return the value in `String` so you can check the IP address using `equals` method.
score: 0
answers question: http://stackoverflow.com/q/21808909

http://stackoverflow.com/q/21809649
has comment: http://stackoverflow.com/comment/33005304
has comment: http://stackoverflow.com/comment/33004324
has comment: http://stackoverflow.com/comment/33004248
has title: I am trying to connect to local sql server using java code
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/33004283
tagged with: java
has answer: http://stackoverflow.com/a/21809730
type: Question
answer count: 2
downvote count: 4
has body: I am getting the following error message when I try to connect to local sql server: ')' expected &lt;identifier&gt; expected ---- (Alt-Enter shows hints) the code thus giving me the error is : String connectionUrl2=("jdbc:odbc:life","taf","taf4");
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21810543

http://stackoverflow.com/comment/43632269
comment on: http://stackoverflow.com/q/21821819
type: Comment
has text: Have you tried to rename it to any other subdirectory of the same folder or any other folder in the same file system?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32918962
type: QuestionComment
has text: Nevermind that is what XMLAttribute is for. Silly me.
comment on: http://stackoverflow.com/q/21760609
score: 0
type: Comment

http://stackoverflow.com/q/21706613
favorite count: 0
has comment: http://stackoverflow.com/comment/32820541
has body: I've written this code, please, tell me what should I do to make the Button do something depending on which CheckBox is checked. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_costi_di_impianto); } public void CalcolaC(View view) { double Onorario1,SpeseD1,CostI1,Iva1,Deb1,Rit1,ccp1,Netto1; // Onorario1 = 0; SpeseD1 = 0; ccp1 = 0; // EditText Onorario = (EditText) findViewById(R.id.Onorario); EditText SpeseD = (EditText) findViewById(R.id.SpeseD); TextView CostI = (TextView) findViewById(R.id.CostI); TextView Iva = (TextView) findViewById(R.id.Iva); TextView Deb = (TextView) findViewById(R.id.Deb); TextView Rit = (TextView) findViewById(R.id.Rit); TextView ccp = (TextView) findViewById(R.id.ccp); TextView Netto = (TextView) findViewById(R.id.Netto); final CheckBox checkBox1=(CheckBox)findViewById(R.id.checkBox1); final CheckBox checkBox2=(CheckBox)findViewById(R.id.checkBox2); // try{ Onorario1 = Math.round(Double.parseDouble(Onorario.getText().toString())*100.0)/100.0; SpeseD1 = Math.round(Double.parseDouble(SpeseD.getText().toString())*100.0)/100.0; } catch (NumberFormatException e){ ErrorMsg(); Pulisci(view); return; } if(checkBox1.isChecked()) ccp1 = Onorario1 * 2 / 100; Iva1 = (Onorario1 + ccp1)*22/100; Rit1 = (Onorario1+ccp1+Iva1+SpeseD1)*20/100; CostI1 = (Onorario1+ccp1+SpeseD1); Deb1 = (Onorario1+ccp1+Iva1+SpeseD1); Netto1 = (Onorario1+ccp1+Iva1+SpeseD1) - Rit1; // ccp.setText(Double.toString(round(ccp1,2))); Iva.setText(Double.toString(round(Iva1,2))); Rit.setText(Double.toString(round(Rit1,2))); CostI.setText(Double.toString(round(CostI1,2))); Deb.setText(Double.toString(round(Deb1,2))); Netto.setText(Double.toString(round(Netto1,2))); if(checkBox2.isChecked()) ccp1 = Onorario1 * 4 / 100; Iva1 = (Onorario1 + ccp1)*22/100; Rit1 = (Onorario1+ccp1+Iva1+SpeseD1)*20/100; CostI1 = (Onorario1+ccp1+SpeseD1); Deb1 = (Onorario1+ccp1+Iva1+SpeseD1); Netto1 = (Onorario1+ccp1+Iva1+Spese…
has answer: http://stackoverflow.com/a/21706830
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32820654
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21707131
has comment: http://stackoverflow.com/comment/32820760
has answer: http://stackoverflow.com/a/21717435
has title: Make a Button do something, depending on which CheckBox is checked
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/33004129
type: Comment
has text: It would work fine with root user. Like I said, its not advisable, I didn't say that it wont work.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21809124

http://stackoverflow.com/comment/32988084
type: AnswerComment
comment on: http://stackoverflow.com/a/21797937
type: Comment
score: 1
has text: @MartinAsenov But that just displays a date, I need something to counting down like: `You have 3 hours and 30 minutes to die`, or `You have 210 minutes to die` where first using `You have #h# hours and #m# minutes to die` and second using `You have #m# minutes to die` pattern.

http://stackoverflow.com/q/21837360
has comment: http://stackoverflow.com/comment/33053289
has title: Find a String and return the words after it
has comment: http://stackoverflow.com/comment/33053667
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21838036
has comment: http://stackoverflow.com/comment/33053236
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/33053367
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21837823
score: -2
has comment: http://stackoverflow.com/comment/33053570
has comment: http://stackoverflow.com/comment/33053662
answer count: 2
has comment: http://stackoverflow.com/comment/33053626
has body: I have this method which receive as parameters pdfText(which is a String containing text from a pdf file after parsing) and fileName which is the file where i want to write that text But now I need to find the word "Keywords" in this text and extract only the words after it,which are in the same line(until the newline character). For example I have one text which contains somewhere the following line Title:Something. "Keywords : Computers, Robots, Course" Tags:tag1,tag2,tag3. And the result should be the following list ["Computers","Robots", "Course"]. Solved Question So I've searched how to solve my question..here is a solution,not very smart but it works: //index of first appearence of the word int index = pdfText.indexOf("Keywords"); //string from that to the end String subStr = pdfText.substring(index); //index of first appearence of the new line in the new string int index1 = subStr.indexOf("\n"); //the string we need String theString = subStr.substring(9,index1); System.out.println(theString); //write in the file..use true as parameter for appending text,not overwrite it FileWriter pw = new FileWriter(fileName,true); pw.write(theString); pw.close();
has comment: http://stackoverflow.com/comment/33053322
favorite count: 0

http://stackoverflow.com/a/21708590
has comment: http://stackoverflow.com/comment/32824482
has comment: http://stackoverflow.com/comment/32824679
answers question: http://stackoverflow.com/q/21708380
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32824815
type: Answer
has comment: http://stackoverflow.com/comment/32824891
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21708380
has comment: http://stackoverflow.com/comment/32824611
has body: Just set your frame to a GridLayout. Also note just set the size of JTextArea using this constructor JtextArea(rows, columns) and just pack() your frame. No need to set size to anything. TheGridLayout will handle the size of the JButton for you, based on the size of the JTextArea Also Swing apps should be run from the Event Dispatch Thread. See Initial Threads. Also see Laying out Components within a Container to learn more about layout managers. Here's a running example import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Main { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame.setDefaultLookAndFeelDecorated(true); final JFrame frame = new JFrame("Lingvo frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JButton showResultButton = new JButton(); final JTextArea textArea = new JTextArea(20, 60); frame.setLayout(new GridLayout(2, 1)); frame.add(textArea); frame.add(showResultButton); frame.pack(); frame.setVisible(true); showResultButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { showResultButton.setText("translation"); } }); } }); } }
score: 2
has comment: http://stackoverflow.com/comment/32824761

http://stackoverflow.com/a/21813002
accepted answer of: http://stackoverflow.com/q/21812671
has comment: http://stackoverflow.com/comment/33010746
answers question: http://stackoverflow.com/q/21812671
upvote count: 1
has comment: http://stackoverflow.com/comment/33010461
has comment: http://stackoverflow.com/comment/33010533
has body: Your first error android.os.NetworkOnMainThreadException is coming because you parsing your Json in main thread. Try to use Asnync Class for that. If you don't want to use Async class than paste this code in your onCreate. if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); }
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33010933
type: Answer
has comment: http://stackoverflow.com/comment/33012799

http://stackoverflow.com/a/21817869
type: Answer
accepted answer of: http://stackoverflow.com/q/21817819
has body: Here's a for loop. for(int x = 4; x &gt;0; x--) { myFinch.setWheelVelocities(255,255,1000); myFinch.setWheelVelocities(255,0,800); } You need to explain your objective more though. This code will set the wheel velocities to 255,255,1000, then immediately change them back to 255,0,800, and do that four times. Aren't you instead trying to switch between them, which would require some kind of pause, timer, or test? In the meantime, you really should peruse the Oracle documentation for Java, and in particular the control structures: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html If you are new to Java, Exceptions and Threads are probably a bit of a harsh takeoff, but bear with me: Thread.sleep(4000); This instruction will make your code pause for 4 seconds (it takes milliseconds as an argument). In order to use that "pause" code, you'll need to declare that your method, here, main: throws InterruptedException Why? Because, if you had several "Threads" in your application, another Thread might interrupt yours while it is sleeping. Basically, say "hey, I need to calculate something, since you're asleep I'm going to borrow the processor, I'll give it back later" Since you only have one Thread, you don't bother, you just declare that it might theorically happen, and you're good to go. In the event that you wanted to switch the speeds and see it happen, the code becomes: package Code.simpleOutput; import edu.cmu.ri.createlab.terk.robot.finch.Finch; public class GeoPattern { public static void main(final String[] args) throws InterruptedException // because it contains a sleep call { Finch myFinch = new Finch(); for(int x = 4; x &gt;0; x--) { Thread.sleep(1000); // sleep a second myFinch.setWheelVelocities(255,255,1000); Thread.sleep(1000); // sleep another second myFinch.setWheelVelocities(255,0,800); } myFinch.quit(); System.exit(0); } }
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21817819
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32851184
comment on: http://stackoverflow.com/q/21723938
type: QuestionComment
type: Comment
has text: Can you add the stacktrace, please?
score: 0

http://stackoverflow.com/a/21826922
has body: Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_YEAR, 34); System.out.println(cal.get(Calendar.MONTH)); Will return 1 (as Months start with 0).
accepted answer of: http://stackoverflow.com/q/21826783
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33037325
type: Answer
answers question: http://stackoverflow.com/q/21826783
has comment: http://stackoverflow.com/comment/33035872
upvote count: 3
score: 3

http://stackoverflow.com/comment/32829328
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21711309
score: 0
has text: What do you mean by transfer: saving the data in the Vector in your local database or what?

import
tags question: http://stackoverflow.com/q/21754540
type: Tag
tags question: http://stackoverflow.com/q/21801840
tag name: import
tags question: http://stackoverflow.com/q/21691373
tags question: http://stackoverflow.com/q/21799248
tags question: http://stackoverflow.com/q/21828226
tags question: http://stackoverflow.com/q/21795784
tags question: http://stackoverflow.com/q/21835043
tags question: http://stackoverflow.com/q/21818214
tags question: http://stackoverflow.com/q/21708330
tags question: http://stackoverflow.com/q/21738487
tags question: http://stackoverflow.com/q/21742575
tags question: http://stackoverflow.com/q/21783301
tags question: http://stackoverflow.com/q/21756978

http://stackoverflow.com/q/21778733
type: Question
tagged with: java
tagged with: jax-ws
has answer: http://stackoverflow.com/a/21816458
score: 0
answer count: 2
tagged with: axis
tagged with: wsdl
has answer: http://stackoverflow.com/a/21836195
has title: WSDL parsing error in JAX-WS
type: UnansweredQuestion
tagged with: web-services
has body: I have a WSDL which was generated using Apache Axis 1.2.1. Now i am trying to create the stubs using JAX-WS 2.1 web service framework. While generating the stubs, i am getting the validation errors. Due to this issues, it is unable to create the stubs. !WSDL Validation Error Image I tried to create the stubs through many tools like MyEclipse IDE, SOAP UI Tool &amp; Java's native wsimport.bat files. Above all three scenarios i had failed to create the stubs due to the unsupported format. But when i had tryied to create the stubs using SOAP UI tool with Apache Axis 1.2.1 libraries, then it was created the stubs. But those are different. My query is, WSDL is a W3C standard format. so, any JAVA API should fallow this standard, then why this WSDL is unable to create the stubs?? and So, I need to create the stubs using the JAX-WS 2.1 instead of Apache Axis 1.2.1. Please suggest me the possible answer... Click here for WSDL

http://stackoverflow.com/comment/33050691
has text: You might be right, but this isn't the immediate problem the OP is facing. The program doesn't get far enough for this to be an issue.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21833276
type: Comment

http://stackoverflow.com/a/21731362
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21731302
has body: In your for loop, shouldn't it be i = phrase.length() instead of i ==? i == is doing comparison instead of setting i equal to (i = sets it equal to something instead of comparing)

http://stackoverflow.com/q/21682485
has body: The below code details an id read when a serial event happens,an id is generated every fews seconds when the device is powered on(Serial Event), and no serial data is received when it is powered off .problem is i need a url call to be sent once when the id is received and once when not visible(powered down). I believe im close but cannot seem to get it right.I would be very grateful if someone could help with this and how to set flags and scheduler to achieve the above case and possibly explain where im going wrong. int numberOfEmptyIds = 0; int maxNumberOfAttempts = 5; boolean urlSent = false; long timeoutInMillis = 10000; // let's say 10000 millis, equivalent to 10 seconds Timer timer = null; public void connect(String portName) throws Exception { ... scheduleTimer(); } public void serialEvent(SerialPortEvent evt) { if(evt.getEventType() == SerialPortEvent.DATA_AVAILABLE) { try { while(in.read(buffer) &gt; -1) { String asHexStr = DatatypeConverter.printHexBinary(buffer); if(asHexStr.contains("FB1")) { scheduleTimer(); numberOfEmptyIds = 0; } else { numberOfEmtyIds++; if(numberOfEmptyIds == maxNumberOfAttempts &amp;&amp; !urlSent) { // send the url here } } } } catch (IOException ex) { // Log the exception here } } } private void scheduleTimer() { timer = new Timer("Timeout"); TimerTask task = new TimerTask() { @Override public void run() { if(!urlSent) { // send the url here } } }; timer.schedule(task, timeoutInMillis); }
tagged with: serial-port
tagged with: java
type: Question
tagged with: event-handling
has title: Java Serial Data Event Processing
score: 0
answer count: 1
tagged with: events
has answer: http://stackoverflow.com/a/21685781
linked to: http://stackoverflow.com/q/21647723
type: UnansweredQuestion

http://stackoverflow.com/comment/32834151
comment on: http://stackoverflow.com/q/21712919
score: 0
type: QuestionComment
type: Comment
has text: @turbo sadly no this was an assignment spoken to us at the end of class today. There is no written documentation only what he verbally told us what we couldn't do to solve it.

http://stackoverflow.com/comment/32844842
has text: (4) point in simple words in java ERROR refers to problems that arise beyond the control of the user or the programmer. Errors are typically ignored in your code because you can rarely do anything about an error. For example, if a stack overflow occurs, an error will arise. They are also ignored at the time of compilation.
type: Comment
comment on: http://stackoverflow.com/a/21718617
type: AnswerComment
score: 0

http://stackoverflow.com/a/21879602
has body: From what I know, MyBatis will substitute your foreach before the SQL is sent to the database to process. It first substitutes all params that you provide and process all the foreach, if etc. tags and then sends the complete SQL to the database
downvote count: 0
answers question: http://stackoverflow.com/q/21830313
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/21772121
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21771911
score: 1
upvote count: 1
has body: Some thing like this : public static void main(String[] args) { toss(); System.out.println(); } private static void toss() { Scanner get = new Scanner(System.in); System.out.println("Enter the limit ..."); int limit = get.nextInt(); for (int i = 0; i &lt; limit; i++) { int benito1 = (int) (Math.random() * 2); int benito2 = (int) (Math.random() * 2); System.out.println(benito1 + " " + benito2); } System.out.println("would you like to continue&gt;"); String ans = get.next(); if(ans.equalsIgnoreCase("y") || ans.equalsIgnoreCase("yes")) { toss(); } }

http://stackoverflow.com/comment/137657657
score: 0
type: AnswerComment
has text: It potentially disables batch processing. I was testing it with Oracle and Hibernate 6+ and the DynamicInsert annotation was disabling the batch processing.
type: Comment
comment on: http://stackoverflow.com/a/43040605

http://stackoverflow.com/comment/32919026
score: 2
comment on: http://stackoverflow.com/a/21761942
type: AnswerComment
type: Comment
has text: User mentioned the values can be anything, so instead of int, an Object could be used. Also, the length can be determined by calling .size(). Should also mention it would be prudent to check the size of the array and make sure it's either even, or you make provisions for handling the odd leftover.

http://stackoverflow.com/q/21826945
score: 1
tagged with: java
tagged with: pdfbox
type: Question
has comment: http://stackoverflow.com/comment/33047570
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21827157
tagged with: string
favorite count: 0
has body: I am having formatting issues with PDF Box. My goal is to print a PDF in table style format as a report. The content format will be similar to Name Code Description Value I retrieve my DB result set and have a List of Java objects. I extract the required information and I format them as as a list of strings as below. I cycle thru the objects, construct a string and add to an arrayList. The idea being I create a list of Strings of the exact same length/style to enforce formatting in pdf. Code Reference for(MyObject obj: dbresults){ //format as below and add to list } StringBuilder sb = new StringBuilder(); Formatter formatter = new Formatter(sb); formatter.format("%-25.25s", "This is some text with more than 25 characters."); formatter.format("%-25.25s", "Some text with less."); formatter.format("%-25.25s", "Some other text."); System.out.println(formatter.toString()); Output: |This is some text with mo|Some text with less. |Some other text. | I print out this list multiple times to screen :) and via System.out or logger the format is exactly as I expect, even blocks. However when I send to PDFBox to print to file the format gets 'corrupted' and the 'table format' is not honoured. I pass in 100 and 700 as x,y co-ords. Code Reference private void printMultipleLines( PDPageContentStream contentStream, List&lt;String&gt; lines, float x, float y) throws IOException { if (lines.size() == 0) { return; } final int numberOfLines = lines.size(); final float fontHeight = getFontHeight(); contentStream.beginText(); contentStream.appendRawCommands(fontHeight + " TL\n"); contentStream.moveTextPositionByAmount( x, y); for (int i = 0; i &lt; numberOfLines; i++) { contentStream.drawString(lines.get(i)); if (i &lt; numberOfLines - 1) { contentStream.appendRawCommands("T*\n"); } } contentStream.endText(); } To get the height of the font you can use this command: fontHeight = font.getFontDescriptor().getFontBoundingBox().getHeight() / 1000 * fontSize; Sample List for printing: This is …
has title: Table/Report Format Using PDFBox
tagged with: http://stackoverflow.com/tag/pdf
linked to: http://stackoverflow.com/q/21805953
accepted answer: http://stackoverflow.com/a/21827157
upvote count: 1
linked to: http://stackoverflow.com/q/7598099
type: AnsweredQuestion

http://stackoverflow.com/a/21707944
has comment: http://stackoverflow.com/comment/32823486
answers question: http://stackoverflow.com/q/21707840
has comment: http://stackoverflow.com/comment/32832313
has body: You should have included your Fruit class, but here is one way static class Fruit { private String name; public Fruit(String name) { this.name = name; } @Override public boolean equals(Object otherObject) { // check for reference equality. if (this == otherObject) { return true; } if (otherObject instanceof Fruit) { Fruit that = (Fruit) otherObject; // Check for name equality. return (name == null &amp;&amp; that.name == null) || name.equals(that.name); } return false; } } public static void main(String[] args) { Fruit apple = new Fruit("apple"); Fruit apple2 = new Fruit("apple"); Fruit orange = new Fruit("orange"); if (apple.equals(orange)) System.out.println("true"); else System.out.println("false"); // You can also use the shorter System.out.println(apple.equals(apple2)); } Outputs false true
score: 9
accepted answer of: http://stackoverflow.com/q/21707840
upvote count: 9
has comment: http://stackoverflow.com/comment/32832505
has comment: http://stackoverflow.com/comment/32823036
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/23068587
has body: Late answer, this did not get on my radar before: Any company should do this. You generate a key pair and create a certificate request. Then they sign your request and give you a certificate. Where you store the private key is normally not their concern. For higher end certificates your identity is though. If you just need to sign and you have an RSA or ECDSA private key then you can use the Java PKCS#11 provider. You then simply use the standard Signature class after configuration. To configure the HSM right is an art in it's own though. You can normally export your certificate again, otherwise right click and download. The way it is handled is because of the MIME type. You could also use e.g. wget, which would just download using the link you provide.
upvote count: 1
has comment: http://stackoverflow.com/comment/35269299
answers question: http://stackoverflow.com/q/21829531
downvote count: 0
has comment: http://stackoverflow.com/comment/35253018
type: Answer
has comment: http://stackoverflow.com/comment/35280660
score: 1

http://stackoverflow.com/comment/32981627
comment on: http://stackoverflow.com/q/21797051
type: Comment
type: QuestionComment
score: 2
has text: You don't get a JSON response, but an error page (HTML), which can of course not be parsed. So it's not necessarily your program which is broken.

http://stackoverflow.com/q/21831031
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/33065007
tagged with: jaxb
has title: JAXB Object to Clob
type: Question
has comment: http://stackoverflow.com/comment/33049972
downvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/1513972
has comment: http://stackoverflow.com/comment/33044705
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/8189686
tagged with: clob
has body: How to create jaxb Object to Clob. When i tried the following not serializable error coming. public static void createClob(TestTo testTo){ PreparedStatement pst = null; Connection con = null; //Clob studentListClob = null; try { con = openOASDBcon(false); pst = con.prepareCall(INSERT_Clob); pst.setBytes(1, getByteArrayObject(testTo)); pst.setString(2, ""); pst.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { close(con, pst); } } private static byte[] getByteArrayObject(TestTo testTo){ byte[] byteArrayObject = null; try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(testTo); oos.close(); bos.close(); byteArrayObject = bos.toByteArray(); } catch (Exception e) { e.printStackTrace(); return byteArrayObject; } return byteArrayObject; } It's not possible to implement serializable. Is there any best way to implement jaxb object to clob.
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21858540

http://stackoverflow.com/comment/32987781
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21800442
has text: yes, i do everything by hand
type: Comment

http-status-code-415
tags question: http://stackoverflow.com/q/21681183
tag name: http-status-code-415
type: Tag

http://stackoverflow.com/q/21772221
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32937992
has answer: http://stackoverflow.com/a/21772641
has title: Java to json String ignore null values
has body: I am creating this json string from the server as shown below and I was able to parse the string too. But when creating the json some fields like errormessage,createdDate,priority are null values. I dont want to show them in the string how can I do that? Json Strin { "errormessage": null, "createdDate": null, "list": [{ "type": "app1", "alternateId": "AlternateID", "priority": null, "description": "app for desc", }], "locationName": null, "facilityManagerName": null, "codeName": null, "sourceKey": null, "tablename": null, "path": "list", "service": "listserver", "license": null, "key": null, } expected String { "list": [{ "type": "app1", "alternateId": "AlternateID", "description": "app for desc", }], "path": "list", "service": "listserver", } Generic Java Bean For creating the json: public class AppObject&lt;T&gt; implements Serializable { private String errormessage; private Date createdDate; private List&lt;T&gt; list; private String locationName; private String facilityManagerName; private String codeName; private Long sourceKey; private String tablename; private String path; private String service; private String license; private Long key; public AppObject() { list = new ArrayList&lt;T&gt;(); } public AppObject(List&lt;T&gt; list) { this.list = list; } @XmlAnyElement(lax = true) public List&lt;T&gt; getList() { return list; } public void setList(List&lt;T&gt; list) { this.list = list; } public String getLicense() { return license; } public void setLicense(String license) { this.license = license; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public String getService() { return service; } public void setService(String service) { this.service = service; } public String getTablename() { return tablename; } public void setTablename(String tablename) { this.tablename = tablename; } public String getErrormessage() { return errormessage; } public void setErrormessage(String errormessage) { this.errormessage = errorme…
has comment: http://stackoverflow.com/comment/32938340
possible better answer: http://stackoverflow.com/a/21772641
answer count: 2
has answer: http://stackoverflow.com/a/21772704
has comment: http://stackoverflow.com/comment/32938205
linked to: http://stackoverflow.com/q/3140563
favorite count: 0
has comment: http://stackoverflow.com/comment/32938135
accepted answer: http://stackoverflow.com/a/21772704
has comment: http://stackoverflow.com/comment/32937971
tagged with: web-services
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/21825405
type: Answer
answers question: http://stackoverflow.com/q/21796705
score: 0
has body: Seems that I did something similar. Will try to explain what I did: Env: TestNg + Spring + XMLBeans There was only one DataProvider (org.testng.annotations.DataProvider) for all tests. It received an xml document which had parameters definitions e.g. bean_id 1 true The test method looks like this @Test(dataProvider = "MyProvider") public void test1(MyBean beanObj, int intParam, Boolean boolParam) { … } So, the only thing I had is to implement a “convert” method. The method which creates Object[][] based on input xml. The “bad” thing is that “convert” method should be aware of all types you need. So, I my case it was rather big. The “good” thing is that there is only one data provider and you don’t need to cast objects in your tests.

http://stackoverflow.com/comment/32821217
has text: No placing the listview inside frame layout isnt helping
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21706928
type: AnswerComment

http://stackoverflow.com/comment/32989150
has text: at first, thank you for your anwser. let me try to explain what i want: with the code above i dont use grizzle, thats right. these is only for building up the tls channel with a tls handshake. after the handshake is complete, i want to build up a http server on the client side of the tls handshake and i dont know, how to use that tls secured channel with grizzly and how i use that ssl class. can you tell me, how i can use it with the existing tls channel?
type: QuestionComment
comment on: http://stackoverflow.com/q/21798329
score: 0
type: Comment

http://stackoverflow.com/comment/32795252
comment on: http://stackoverflow.com/q/21691888
score: 0
type: Comment
type: QuestionComment
has text: What type does `parser.getValue()` return?

http://stackoverflow.com/comment/33051816
score: 2
type: Comment
has text: Only when they update Jetty.
type: QuestionComment
comment on: http://stackoverflow.com/q/21834318

loops
tags question: http://stackoverflow.com/q/21806599
tags question: http://stackoverflow.com/q/21773448
tags question: http://stackoverflow.com/q/21758920
tags question: http://stackoverflow.com/q/21770405
tags question: http://stackoverflow.com/q/21743306
tags question: http://stackoverflow.com/q/21712919
tags question: http://stackoverflow.com/q/21779331
tags question: http://stackoverflow.com/q/21821114
tags question: http://stackoverflow.com/q/21788613
tags question: http://stackoverflow.com/q/21820488
tags question: http://stackoverflow.com/q/21691305
tags question: http://stackoverflow.com/q/21760286
tags question: http://stackoverflow.com/q/21771911
tags question: http://stackoverflow.com/q/21791822
tags question: http://stackoverflow.com/q/21815551
tags question: http://stackoverflow.com/q/21740537
type: Tag
tags question: http://stackoverflow.com/q/21792768
tags question: http://stackoverflow.com/q/21734139
tags question: http://stackoverflow.com/q/21770177
tags question: http://stackoverflow.com/q/21791078
tags question: http://stackoverflow.com/q/21787970
tags question: http://stackoverflow.com/q/21704193
tags question: http://stackoverflow.com/q/21832695
tags question: http://stackoverflow.com/q/21834235
tag name: loops
tags question: http://stackoverflow.com/q/21736716
tags question: http://stackoverflow.com/q/21685098
tags question: http://stackoverflow.com/q/21820588
tags question: http://stackoverflow.com/q/21691551
tags question: http://stackoverflow.com/q/21693544
tags question: http://stackoverflow.com/q/21795183
tags question: http://stackoverflow.com/q/21709976
tags question: http://stackoverflow.com/q/21764624
tags question: http://stackoverflow.com/q/21691776
tags question: http://stackoverflow.com/q/21719220
tags question: http://stackoverflow.com/q/21771809
tags question: http://stackoverflow.com/q/21811192
tags question: http://stackoverflow.com/q/21836814
tags question: http://stackoverflow.com/q/21746715
tags question: http://stackoverflow.com/q/21788190
tags question: http://stackoverflow.com/q/21759939

http://stackoverflow.com/comment/32981805
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21796986
has text: It's called every frame to get the frametime then divided by 1000 to get frametime in seconds

http://stackoverflow.com/q/21689665
has comment: http://stackoverflow.com/comment/32791374
accepted answer: http://stackoverflow.com/a/21748525
has comment: http://stackoverflow.com/comment/32800132
tagged with: utf-8
has comment: http://stackoverflow.com/comment/32801950
has title: MySQL latin1 to UTF-8 using Java & Hibernate & JPA
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/32791820
downvote count: 0
tagged with: latin1
has answer: http://stackoverflow.com/a/21748525
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32810729
has comment: http://stackoverflow.com/comment/32802821
has body: I have a database that is in charset=latin1 and collation latin1_swedish_ci. The user has entered UTF-8 characters in this connection ( Greek characters ) and in PHP he can read everything just fine. But when I try to read the database using JAVA + JPA + Hibernate ( all Latest versions ) the characters are totally broken. Note that I have already tried my jdbc string with: ...?useUnicode=true&amp;amp;characterEncoding=latin1&amp;amp;connectionCollation=latin1_swedish_ci ...?useUnicode=true&amp;amp;characterEncoding=UTF-8&amp;amp;connectionCollation=utf8_general_ci ...?characterSetResults=ISO8859_1 ...and combinations of those but still I can't read the characters. The best I have managed is to use: byte ptext[] = myString.getBytes(windows-1252); String fixed = new String(ptext, UTF_8); with: ?useUnicode=true&amp;amp;characterEncoding=UTF-8&amp;amp;connectionCollation=utf8_general_ci But still there are many characters that in eclipse's output are "?" and in log4j output everything is broken. Any suggestions?
tagged with: java
tagged with: character-encoding
possible better answer: http://stackoverflow.com/a/21702558
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21702558
answer count: 2
has comment: http://stackoverflow.com/comment/32791733

http://stackoverflow.com/comment/32783500
score: 0
type: QuestionComment
has text: Would you like to tag this question with JSF/PrimeFaces?
type: Comment
comment on: http://stackoverflow.com/q/21684178

http://stackoverflow.com/comment/43832286
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21748445
has text: thanks man, but i dont have this info any more.

http://stackoverflow.com/comment/32903492
comment on: http://stackoverflow.com/q/21751588
type: Comment
type: QuestionComment
score: 1
has text: your clean target removes the source files. Your compile target tries to compile the deleted files and therefore does not produce any class files.

http://stackoverflow.com/comment/33038864
type: QuestionComment
score: 0
has text: one billion can be stored as an `int` as the limit is ~2.1 billion. Note: one billion `long` values uses 8 GB of memory. Perhaps a `Map<Integer, Long>` will work better if you only have a few values to set.
comment on: http://stackoverflow.com/q/21828099
type: Comment

http://stackoverflow.com/q/21798687
has body: I know that two threads in the same process can communicate with wait and notify. How can two threads from different processes communicate with each other?
answer count: 1
has title: Interprocess Communication in Java
linked to: http://stackoverflow.com/q/2527847
type: UnansweredQuestion
tagged with: multithreading
duplicate of: http://stackoverflow.com/q/2527847
tagged with: java
has answer: http://stackoverflow.com/a/21799404
type: Question
score: 0

http://stackoverflow.com/q/21736971
has comment: http://stackoverflow.com/comment/32874680
has comment: http://stackoverflow.com/comment/32874891
tagged with: data-structures
answer count: 1
has comment: http://stackoverflow.com/comment/32874694
has answer: http://stackoverflow.com/a/21737122
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/32874951
has body: This is the method I'm calling from another class like 10 times: new ScribbleInput().getString("Call", getUiDevice()); How can I call it from a singleton class?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21737122
tagged with: java
has title: code to access the singleton class file instead of calling the method every time
downvote count: 1
type: Question
upvote count: 0

http://stackoverflow.com/comment/32855442
has text: What is the output of `System.out.println(urlServlet);` ?
comment on: http://stackoverflow.com/q/21719379
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/21747517
has body: Your loop is incorrect. To solve the problem, you can use a Set to eliminate duplicated words. If the problem must be solved by O(n^2) loops, the following code will work: public class Duplicatestring { public static void main(String[] args) { String[] ip = { "mani", " manivannan", "raghv ", "mani" }; for (int i = 0; i &lt; ip.length; i++) { boolean duplicated = false; //search back to check if a same word already exists for (int j = i - 1; j &gt;= 0; j--) { if(ip[i].equals(ip[j])) { duplicated = true; break; } } if(!duplicated) { System.out.println(ip[i]); } } } }
has comment: http://stackoverflow.com/comment/32894005
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21747310
score: 1

http://stackoverflow.com/q/21825403
tagged with: listview
type: Question
has comment: http://stackoverflow.com/comment/33041173
linked to: http://stackoverflow.com/q/541966
has comment: http://stackoverflow.com/comment/33032196
has body: I've been searching and searching for answers and tutorials but I can't find one. So here's my problem.. I am a newbie in android and web development. I want to create an android app for my website. I want to fetch image and text from my website using json and make it as a listview in android (See photo below). I know now how to create xml's for the android. The problem is what I will do in the java code and php code for the images and texts to be retrieve. I find some tutorials but they didn't really have the solutions because they all retrieve the image from the res/drawable. I want to retrieve mine from the server of my database like http//example.com/example.php Another thing is to make it clickable so when I click it, it will go to another xml/activity. I hope to find good tutorials for this.
has answer: http://stackoverflow.com/a/21825819
has title: Android ListView with image and text using json
score: 0
linked to: http://stackoverflow.com/q/3075637
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/33032239
linked to: http://stackoverflow.com/q/3520019
accepted answer: http://stackoverflow.com/a/21825819
tagged with: php
has comment: http://stackoverflow.com/comment/33042712
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33042613
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/32962436
has text: I haven't checked that, actually. I am working on a dataset scraped from several news websites, so there needs to be a lot of preprocessing done before I can feed this data to the NLP module. Thank you for correcting my mistake. Is [this answer on SO](http://stackoverflow.com/questions/88838/how-to-convert-strings-to-and-from-utf8-byte-arrays-in-java) what I should be doing?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21786310

http://stackoverflow.com/q/21738397
favorite count: 0
answer count: 5
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4203646
has answer: http://stackoverflow.com/a/21741791
has answer: http://stackoverflow.com/a/21739771
has answer: http://stackoverflow.com/a/21738587
has comment: http://stackoverflow.com/comment/32877473
has comment: http://stackoverflow.com/comment/32877661
linked to: http://stackoverflow.com/q/104254
score: 1
has title: Console class java
upvote count: 1
has answer: http://stackoverflow.com/a/21738649
type: Question
has answer: http://stackoverflow.com/a/21738737
tagged with: java
has comment: http://stackoverflow.com/comment/32877470
has comment: http://stackoverflow.com/comment/32877595
has body: import java.io.Console; public class Talk { public static void main(String[] args) { Console c = System.console(); String pw; System.out.print("password: "); pw = c.readLine(); System.out.println("got " + pw); } } Why am I getting exception in above code? password: Exception in thread "main" java.lang.NullPointerException at Talk.main(Talk.java:8) Can anyone help me out?
downvote count: 0

http://stackoverflow.com/q/21776261
tagged with: android
has answer: http://stackoverflow.com/a/21776409
possible better answer: http://stackoverflow.com/a/21776409
has answer: http://stackoverflow.com/a/21776727
has answer: http://stackoverflow.com/a/21776422
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21776760
type: Question
upvote count: 4
has title: Repeated replacement of characters in String
downvote count: 0
has body: I'm trying to create an Android app which converts normal hex code to inverted one which is used in smali. Everything works perfectly except for that when I use the replace or replaceAll method on String, it even replaces the already replaced characters For example, String stringInvert = string.replace("F", "0") .replace("E" , "1") .replace("D" , "2") .replace("C" , "3") .replace("B" , "4") .replace("A" , "5") .replace("9" , "6") .replace("8" , "7") .replace("7" , "8") .replace("6" , "9") .replace("5" , "A") .replace("4" , "B") .replace("3" , "C") .replace("2" , "D") .replace("1" , "E") .replace("0" , "F"); As you can see that first F is changed to 0, and similarly other letters are also changed, but later 0 is changed to F, which also changes the already changed F back to F. So, all in all, only the letters/numbers that are before 7 get inverted(as they are replaced after in the code) and others remain same due to dual inversion. I even tried replaceAll method, it gives the same result. So is there any other way or a work around to this problem? Full code is here - http://pastebin.com/dB23JmQG Sorry if the code is ugly, I did it in AIDE Thanks
tagged with: string
accepted answer: http://stackoverflow.com/a/21776422
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/21776553
answer count: 5

http://stackoverflow.com/comment/32910272
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21757068
has text: `TABLE_COLUMN_ONE + "= '" + str + "'"` should work fine. Note that concatenating strings this way is usually not a great idea, since it opens you up to SQL injection attacks. It might be ok here, just something to keep in mind.
type: Comment

http://stackoverflow.com/comment/33002853
type: QuestionComment
type: Comment
has text: @trutheality Thank you, that was the problem, i.e. using current size instead of "capacity". By the way, what you mean that "capacity" is not actually a max size and that the array can grow bigger than that? I have read somewhere that it is good to specify the max size of an arraylist, if it is known beforehand, in order to avoid overcoming that size, which internally means that a copy of the array will be created which in turn means slower performance and greater storage space demands.
comment on: http://stackoverflow.com/q/21808736
score: 0

http://stackoverflow.com/q/21720964
has title: How to use extended webview class in activity
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32846254
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21721067
answer count: 2
has answer: http://stackoverflow.com/a/21749121
tagged with: webview
upvote count: 1
has body: I am new to android and now im doing a webview app in which I have to disable double tap zooming but keep setwideviewport(true). I got a solution by searching but Im not able to implement that class to my activity.please help.Here is my activity. User_reg.java package com.example.samworkshops; import android.os.Bundle; import android.os.SystemClock; import android.annotation.SuppressLint; import android.app.Activity; import android.content.res.Configuration; import android.graphics.Color; import android.graphics.Point; import android.view.Display; import android.view.GestureDetector; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; public class User_reg extends Activity { private WebView webView; final Activity activity = this; @SuppressLint("SetJavaScriptEnabled") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getWindow().requestFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.activity_user); webView = (WebView)findViewById(R.id.webView1); webView.requestFocusFromTouch(); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setUseWideViewPort(true); webView.getSettings().setBuiltInZoomControls(false); webView.setHorizontalScrollBarEnabled(false); webView.loadUrl("http://app.samworkshops.org/User_Reg.aspx"); webView.setVisibility(View.INVISIBLE); webView.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { activity.setTitle("Loading..."); activity.setProgress(progress * 100); if(progress == 100) activity.setTitle(R.string.title_activity_user_reg); } }); webView.setBackgroundColor(Color.parseColor("black")); webView.setWebViewClient(new WebViewClient() { @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ha…
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/comment/138274953
type: AnswerComment
score: 0
type: Comment
has text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
comment on: http://stackoverflow.com/a/78411999

http://stackoverflow.com/comment/73576666
has text: if someone like me came here to find just the opposite: how to get that popup shown, I've found it, activate `Compile on save` in project settings.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21781655
score: 0

http://stackoverflow.com/a/21857944
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/33125732
downvote count: 0
answers question: http://stackoverflow.com/q/21810322
has body: I think the problem might be that you need to specify who the vCard you created belongs to: for the user currently logged in, use vcard.load(conn) for any user of your service, use vcard.load(conn, username) where username should be the full username, i.e. login@host.tld I tested this code and everything works fine: // Load vCard of logged in user private void loadVCard(XMPPConnection conn) { VCard vcard = new VCard(); vcard.load(conn); vcard.setFirstName("Foo"); vcard.setAvatar(imageBytes("http://example.com/avatarjpg"), "image/jpeg"); vcard.save(conn); } // Load vCard of give user // username: ex mylogin@chat.myservice.com private void loadVCard(XMPPConnection conn, String username) { VCard vcard = new VCard(); vcard.load(conn, username); byte[] avatarBytes = vcard.getAvatar(); OutputStream out = new FileOutputStream(username + ".jpg"); out.write(avatarBytes); out.close(); }
has comment: http://stackoverflow.com/comment/33100370
type: Answer

http://stackoverflow.com/q/21798952
downvote count: 0
possible better answer: http://stackoverflow.com/a/21800770
answer count: 3
linked to: http://stackoverflow.com/q/4856298
tagged with: moxy
has title: Spring MVC - set JAXB marshaller property when using @ResponseBody
favorite count: 0
has answer: http://stackoverflow.com/a/22489326
score: 2
upvote count: 2
tagged with: spring
has answer: http://stackoverflow.com/a/21800657
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has body: I am trying to return a object from my controller which should be parsed to xml by spring. But I used the @XmlNamedObjectGraph (from moxy eclipselink) annotation in my class to customize the returned object. So I have to set the property MarshallerProperties.OBJECT_GRAPH from the marshaller. How can I access the marshaller, which is used by spring to parse my object, in my controller? ie: @RequestMapping(value = "/xml/", method = RequestMethod.GET, produces = "application/xml") @ResponseBody public ResponseEntity&lt;Customer&gt; getXml() { Customer customer = _customerService.getById(12); ... marshaller.setProperty(MarshallerProperties.OBJECT_GRAPH, "default"); ... return new ResponseEntity&lt;&gt;(customer, HttpStatus.OK); } Thanks for your help in advance.
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/22489326
type: Question
has answer: http://stackoverflow.com/a/21800770

http://stackoverflow.com/q/21734371
has answer: http://stackoverflow.com/a/22125644
accepted answer: http://stackoverflow.com/a/22014091
has comment: http://stackoverflow.com/comment/32871940
tagged with: java
upvote count: 16
answer count: 6
possible better answer: http://stackoverflow.com/a/35058790
has answer: http://stackoverflow.com/a/22141857
has answer: http://stackoverflow.com/a/35058790
has title: Change color of Switch in Android
tagged with: android
has answer: http://stackoverflow.com/a/22140169
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-styles
has body: I'm trying to change the color of my switch in Android. I realize that I will need new 9patches. I went over to http://android-holo-colors.com/ and selected my color and selected (Switch Jelly Bean). To use Switch Jelly Bean I had to use: https://github.com/BoD/android-switch-backport. To import it into my project I had to add: @style/Widget.Holo.CompoundButton.Switch to my styles, and then in xml I have to use the switch like so: <org.jraf.android.backport.switchwidget.Switch android:layout_width="wrap_content" android:layout_height="wrap_content" /> Now everything with the switch works fine. Next, I took everything that was output from the android holo color generator and put it into the proper files: drawable (2 selector files) drawable-hdpi (9patch files) drawable-xhdpi (9patch files) drawable-xxhdpi (9patch files) then I added to my xml: <org.jraf.android.backport.switchwidget.Switch android:layout_width="wrap_content" android:layout_height="wrap_content" android:thumb="@drawable/apptheme_switch_inner_holo_light" android:track="@drawable/apptheme_switch_track_holo_light" /> but it is still the original blue color. I believe I'm doing everything correctly. Everything compiles (xml, java). Note: I AM importing org.jraf.android.backport.switchwidget.Switch in my java also. Any ideas?
downvote count: 0
has comment: http://stackoverflow.com/comment/32871480
linked to: http://stackoverflow.com/q/10118050
score: 16
tagged with: android-theme
has answer: http://stackoverflow.com/a/70165648
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22014091

http://stackoverflow.com/comment/32883436
comment on: http://stackoverflow.com/a/21713859
score: 0
type: AnswerComment
has text: Thank you so much. That got rid of the majority of the error messages. One thing that still seems to persist is in my Drawable code. Any idea what could be wrong here: mAllTruthsImage.setImageResource(R.Drawable.ball_animation); AnimationDrawable ballAnimation = (AnimationDrawable) mAllTruthsImage.getDrawable(); if (ballAnimation.isRunning()) { ballAnimation.stop(); } ballAnimation.start(); }
type: Comment

http://stackoverflow.com/q/21780570
linked to: http://stackoverflow.com/q/9560600
favorite count: 0
answer count: 3
has title: How to call inner class method inside the main method?
has body: I am creating a class Perfect inside the main class and in Perfect class i am creating a method perf() and i want to call this method in the main method..how to do it? My code is here public class Fib { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } class Perfect { void perf(){ int sum = 0; int count = 0; for(int i=6; i&lt;=10000; i++){ for(int j=1; j&lt;=i/2; j++){ if(i%j==0){ sum+=j; } } if(sum==i){ count=count+1; System.out.println(i); } sum=0; } System.out.println("Total perfect number is : "+count); } } }
has answer: http://stackoverflow.com/a/21780954
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32951885
upvote count: 1
has answer: http://stackoverflow.com/a/21780650
has comment: http://stackoverflow.com/comment/32951873
score: 1
has comment: http://stackoverflow.com/comment/32952319
tagged with: java
has answer: http://stackoverflow.com/a/21780593
type: Question
downvote count: 0

http://stackoverflow.com/q/21822168
downvote count: 0
has comment: http://stackoverflow.com/comment/33026700
tagged with: class
accepted answer: http://stackoverflow.com/a/21822192
answer count: 3
score: 1
has body: I am new to Android development. I am trying to call a method of one of my classes when a button on my main activity is pressed. On my Main Activity I have this button: public void buttonTest(){ Button b = (Button) findViewById(R.id.test); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { String s = "changeText:myText"; Intent in = new Intent(PlusActivity.this, Test.class); in.putExtra("method",s); startActivity(in); } }); } And here is is the class (without imports) which that intent above is calling to. public class Test extends Activity { static String text = "test"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); TextView mTextView = (TextView) findViewById(R.id.textView); mTextView.setText(text); } public void changeText(String s){ this.text = s; } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); String[] array = intent.getStringExtra("method").split(":"); if(array[0].equals("changeText")){ changeText(array[1]); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.test, menu); return true; } } Basically I want to know if it is possible to change the value of that String text, before onCreate(). Basically each button will have a correspondent text, and I want to be able to modify that text based on which button. If it is, what should I do/change? Thanks in advance.
favorite count: 0
tagged with: android
has title: Android - Change class variable before onCreate
possible better answer: http://stackoverflow.com/a/21822245
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21822245
has answer: http://stackoverflow.com/a/21822192
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33026546
type: Question
has answer: http://stackoverflow.com/a/21822421

http://stackoverflow.com/comment/33090595
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21854413
has text: You will not need to recompile playn jars. You can use your own java namespace for the playn core and implementation parts.

http://stackoverflow.com/a/21809113
type: AcceptedAnswer
downvote count: 0
has body: why does java compiler accept both lines That is there for backward compatibility. Generics were included only in Java 1.5. So, if it wasn't allowed to use raw types (that's what they are called), then all the previous code would have failed to compile. However, even though you're allowed, you shouldn't use them in newer code. Wherever you use raw type, the compiler will give you an Unchecked Warning.
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/33003748
has comment: http://stackoverflow.com/comment/33003670
accepted answer of: http://stackoverflow.com/q/21809091
answers question: http://stackoverflow.com/q/21809091
score: 3

http://stackoverflow.com/comment/33024939
score: 0
type: AnswerComment
type: Comment
has text: I can't set the Locale explicitly like that for this app. The user's default Locale is respected for the currency symbol, but I have to control the decimal and grouping separators directly. My app mimic's HP's 10bii Financial Calculator which has a button that swaps from period to comma, so I need to mimic that functionality.
comment on: http://stackoverflow.com/a/21821185

http://stackoverflow.com/a/21821185
answers question: http://stackoverflow.com/q/21821057
upvote count: 3
score: 3
has body: If you change DecimalFormatSymbols decimalFormatSymbols = decimalCurrencyWorld.getDecimalFormatSymbols(); to DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(Locale.GERMAN); (or some other Locale) you will find that the separators work properly. decimalFormatSymbols.setDecimalSeparator(','); apparently does not change the format (although setGroupingSeparator() does, as you have discovered).
has comment: http://stackoverflow.com/comment/33025301
has comment: http://stackoverflow.com/comment/33024939
downvote count: 0
has comment: http://stackoverflow.com/comment/33025040
has comment: http://stackoverflow.com/comment/33025295
type: Answer
has comment: http://stackoverflow.com/comment/33025103
has comment: http://stackoverflow.com/comment/33026124
has comment: http://stackoverflow.com/comment/33025006
has comment: http://stackoverflow.com/comment/33063708

http://stackoverflow.com/a/21768806
score: 1
answers question: http://stackoverflow.com/q/21768761
type: AcceptedAnswer
downvote count: 0
has body: By using new String[] {KEY_ROWID, KEY_NAME, KEY_CUSTOMER} in your query method call, you are limiting yourself to only returning those columns. To get all columns, you should instead pass null as the second parameter instead of the array.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21768761

http://stackoverflow.com/comment/32987337
comment on: http://stackoverflow.com/a/21685503
score: 0
type: AnswerComment
type: Comment
has text: @DarRay I updated the answer with an **EDIT**, but it might be tricky due to a method being inherited with different return types...

http://stackoverflow.com/a/21705850
answers question: http://stackoverflow.com/q/21705594
has body: java has no native concept of "ranges", let alone support for them in case statements. usually, when faced with this kind of logic i personally would do one of 2 things: just have a chain of if-else statements. doesnt even habe to be a chain: public static double calculateCopyPrice(int copies) { if (copies &gt; 1000) return 0.25; if (copies &gt;= 750) return 0.26; //etc } this code has no "else" branches and is just as much typing as the switch syntax you'd like. possibly even less (i only check a single bound every time) you could use an enum, say: public enum Division {UNDER_100, 100_to_500, ... } and then : Division division = categorize(copies); switch (division) { case UNDER_100: //etc } but this is serious overkill for what youre trying to do. i'd use that if this division is also useful elsewhere in your code.
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/21715833
type: AcceptedAnswer
has body: You are right. Create another Java file lets say Utility.java, have all those functions as static. Then call those functions as Utility.functionName(String params) in other java files. Eg: public class Utility{ public static boolean functionName(){ //.... return true; } // and so on... } In other files import the class Utility and access the functions like: boolean var = Utility.functionName();
has comment: http://stackoverflow.com/comment/32838234
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21715738
has comment: http://stackoverflow.com/comment/32838260
type: Answer
answers question: http://stackoverflow.com/q/21715738
downvote count: 0
has comment: http://stackoverflow.com/comment/33108705
score: 5

http://stackoverflow.com/q/21729069
type: UnansweredQuestion
tagged with: android
tagged with: php
tagged with: java
type: Question
tagged with: broadcastreceiver
score: 0
answer count: 1
has body: In my android application i am using android push notification everything works fine until the user forces the application close(It happens always nowadays especially with the task monitoring application available in the play store).No more notifications are visible or possible.After some googling i found that From android 3.1, if the user force closes an app, it will stop to be notified of any broadcast until the user does not start your the again. Is there any solution to prevent the broadcast receiver killing or any other possible (like making a Que of messages that aren't received by the device and send them later)?
has answer: http://stackoverflow.com/a/21730298
has title: Google Cloud Messaging listening broadcast receiver

http://stackoverflow.com/comment/32972663
has text: You are also losing the first few bytes of the file with `new char[fis.read()]. You should create the char array and the StringBuilder with a fixed size - 4096 or 8192 are usually good sizes.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21791732

scenegraph
tags question: http://stackoverflow.com/q/21839302
type: Tag
tag name: scenegraph

http://stackoverflow.com/q/21823315
has comment: http://stackoverflow.com/comment/33028671
has comment: http://stackoverflow.com/comment/33113252
upvote count: 3
has comment: http://stackoverflow.com/comment/33163151
has body: What is the difference between the class declarations public abstract class Super1&lt;T extends Super1&lt;T&gt;&gt; {...} and public abstract class Super2&lt;T extends Super2&lt;? super T&gt;&gt; {...} Using the 1st method, I was able to create a sub classes (similar to Enum types in Java) public class Sub1 extends Super1&lt;Sub1&gt; {...} but I wanted to know if a super class declaration like 2nd is possible at all.., is there any meaning to it, but I was not able to create a sub class like public class Sub2 extends Super2&lt;Object&gt; {...} I thought Object can be used as super type for T?? Also another form I can think of is public abstract class Super3&lt;T extends Super3&lt;? extends T&gt;&gt; I am trying to learn generics and any help is appreciated.
answer count: 1
has comment: http://stackoverflow.com/comment/33072610
has comment: http://stackoverflow.com/comment/33113550
has comment: http://stackoverflow.com/comment/33152993
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21823536
has comment: http://stackoverflow.com/comment/33060365
downvote count: 0
has comment: http://stackoverflow.com/comment/33101850
favorite count: 0
has comment: http://stackoverflow.com/comment/33129052
type: Question
score: 3
has title: Java Generic with bounded wildcards
tagged with: generics
has comment: http://stackoverflow.com/comment/33072515

http://stackoverflow.com/q/21780953
has comment: http://stackoverflow.com/comment/32953430
tagged with: java
has title: How to edit snapshot dependencies
score: 0
has answer: http://stackoverflow.com/a/21781869
has body: I am very new to the industry, so apologies in advance for the very likely stupidity of the question. In the team, we work with Intellij IDEA 13 as IDE, and use Maven 3 for our projects. We provide a few online services and portals, and I'm just starting to work on one: the project has several dependencies that are shared by other older projects, some are JAR archives, some are WARs... To my questions re: how to edit those dependencies locally (e.g. editing a resources.properties was the case I had in mind) my tutor suggested turning the dependencies into snapshots and work with those. What I managed to do was create a copy of the appropriate folders in my local repository and change wherever the version of the dependency was in the name or in the files, then modify my pom.xml files. Now, this works perfectly if I open the JAR/WAR and edit some file, but I'd like to be able to do it from my IDE, also cause not being able to suggests I'm probably doing this in a wrong way. Do I need to somehow unpack the dependency to be able to do so? Is my entire approach wrong? P.S.: I would ask someone in my office, but oddly enough none of those who could help are at work today anymore!
tagged with: intellij-idea
answer count: 1
tagged with: maven-3
tagged with: snapshot
accepted answer: http://stackoverflow.com/a/21781869
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32957260
tagged with: maven
type: Question

http://stackoverflow.com/q/21820161
downvote count: 0
score: 1
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/21867472
accepted answer: http://stackoverflow.com/a/21867472
type: Question
tagged with: cardlayout
answer count: 2
has title: Change Frame and Focus in Card Layout
has answer: http://stackoverflow.com/a/21820242
upvote count: 1
favorite count: 0
tagged with: jframe
has body: I'm nearing the final development stages of my first game, but have run into a problem. I've constructed 4 different levels and allow the user to select the level they want to play from a central JPanel in a Card Layout system. My problem is that once a level is completed, I can't switch the JPanel which is displayed to start the next level, since I don't know how to access the original JPanel which acts as a driver for the other panels. Any help is appreciated, and my code is posted bellow. import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Font; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class MainFrame extends JFrame implements ActionListener { JPanel bodyPanel; JPanel panel1,panel2,panel3,panel4,panel5; JButton button1,button2,button3,button4,button5; JLabel title; Container con; CardLayout clayout; public MainFrame() { clayout=new CardLayout(); bodyPanel=new JPanel(clayout); button1=new JButton("Level 1"); button3= new JButton("Level 2"); button4 = new JButton("Level 3"); button2=new JButton("Exit"); button5 = new JButton("Level 4"); button1.addActionListener(this); button2.addActionListener(this); button3.addActionListener(this); button4.addActionListener(this); button5.addActionListener(this); panel1=new JPanel(); title = new JLabel("Space Adventure"); panel1.add(title); title.setFont(new Font("Serif", Font.PLAIN, 110)); panel1.add(button1); panel1.add(button3); panel1.add(button4); panel1.add(button5); panel1.add(button2); panel1.setBackground(Color.pink); panel2=new PrizePanel(); panel2.setBackground(Color.gray); bodyPanel.add(panel1,"one"); bodyPanel.add(panel2,"two"); setLayout(new BorderLayout()); setSize(800,400); add(bodyPanel,BorderLayout.CENTER); bodyPanel.setBounds(0,100, 600, 500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setV…
tagged with: swing
possible better answer: http://stackoverflow.com/a/21820242
type: AnsweredQuestion

http://stackoverflow.com/comment/32887610
comment on: http://stackoverflow.com/q/21743999
score: 0
type: Comment
type: QuestionComment
has text: You should look at this: http://stackoverflow.com/questions/2832472/how-to-return-2-values-from-a-java-function it looks similar to your question.

http://stackoverflow.com/a/21761751
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21761455
has comment: http://stackoverflow.com/comment/32952205
accepted answer of: http://stackoverflow.com/q/21761455
upvote count: 1
has body: If your predict String is always piped(|) the numbers then you can easily split them using pipe and then keep track of the counts on a HashMap. For example 1234 = 2 1344 = 1 4411 = 5 But if not, then you have to modify the Longest Repeated Substring algorithm. As you need to have all repeated substrings so keep track of all instead of only the Longest one. Also, you have to put a checking for minimum length of substring along with overlapping substring. By searching google you'll find lot of reference of this algorithm.

http://stackoverflow.com/a/21796648
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21796497
answers question: http://stackoverflow.com/q/21796497
has comment: http://stackoverflow.com/comment/32981407
score: 5
type: AcceptedAnswer
has body: Use java.text.SimpleDateFormat and java.util.TimeZone Which timezone the date string is in? Replace the below UTC timezone with that timezone SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = sdf.parse("2014-02-15 05:18:08"); SimpleDateFormat sdf2 = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss a"); sdf2.setTimeZone(TimeZone.getTimeZone("IST")); String dateStr = sdf2.format(date); // Output: 15-02-2014 10:48:08 AM Note: In which format the hour is in (24 hour/ 12 hour) in your input string? The above example assumes that it is in 24 hour format because there in no AM/PM info in the input string. If the input string is also in 12 hour format then your input string should mention AM/PM info also such as 2014-02-15 05:18:08 PM. In that case, modify the sdf to new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a") ======================== Edited: ===================== To answer your next question in comment "How to extract date and time separately"... SimpleDateFormat sdfDate = new SimpleDateFormat("dd-MM-yyyy"); sdfDate.setTimeZone(java.util.TimeZone.getTimeZone("IST")); SimpleDateFormat sdfTime = new SimpleDateFormat("hh:mm:ss a"); sdfTime.setTimeZone(java.util.TimeZone.getTimeZone("IST")); String dateStr = sdfDate.format(date); String timeStr = sdfTime.format(date);
upvote count: 5
has comment: http://stackoverflow.com/comment/32981292

http://stackoverflow.com/q/21753267
tagged with: cucumber
tagged with: cucumber-jvm
tagged with: intellij-idea
upvote count: 23
has answer: http://stackoverflow.com/a/21754450
accepted answer: http://stackoverflow.com/a/21754450
favorite count: 0
has body: I can't execute a simple test with cucumber for a project. I am on Intellij 13 Community, with cucumber plugin. I wrote my feature file in my features directory, I have also implemented my steps, creating them with the help of the plugin. And my steps in the feature files are recognized by intellij, which can navigate and go to the step implementation. But when I try to run my scenario, it always fails because for each step, it says "Undefined step : ". Here is how is organized my project : And as I said before, you can see that my steps are recognized by Intellij : How is that possible, and how can I correct this? Any help would be great! EDIT Now that I added options to my runner : @CucumberOptions( monochrome = true, features = "src/test/resources/features/", format = { "pretty","html: cucumber-html-reports", "json: cucumber-html-reports/cucumber.json" }, dryRun = false, glue = "fr.tlasnier.cucumber" ) It works! Yet, I noticed that before that, I had two scenario outline. One worked perfectly, the other one could not find step definition! Really weird, since there were some steps in both scenario.
has title: Cucumber JVM undefined step
has answer: http://stackoverflow.com/a/40700291
answer count: 4
downvote count: 0
tagged with: java
score: 23
possible better answer: http://stackoverflow.com/a/70896760
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/70896760
has answer: http://stackoverflow.com/a/45096261

http://stackoverflow.com/a/67551639
has body: The transformer you create with Transformer transformer = tFactory.newTransformer(); is initialized with a default stylesheed that implements the identity transformation. That means it will simply serialize your DOM to a well-formed XML document. Output escaping is automatically applied where necessary. If you want better control over the output, and possibly generate something that does not adhere to XML document structures, you can use a custom stylesheet that switches the output method to text. This way you control more of the structure but can do more mistakes in the XML area. More information at https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/javax/xml/transform/TransformerFactory.html#newTransformer() https://www.w3.org/TR/xslt20/#element-output
answers question: http://stackoverflow.com/q/21808477
type: Answer
score: 0

http://stackoverflow.com/q/21827877
score: 0
accepted answer: http://stackoverflow.com/a/21829747
has comment: http://stackoverflow.com/comment/33037276
has comment: http://stackoverflow.com/comment/33037622
tagged with: web-services
has comment: http://stackoverflow.com/comment/33037953
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33038775
has comment: http://stackoverflow.com/comment/33036448
type: Question
has title: compress base64 encoded string data into decode format
answer count: 1
has answer: http://stackoverflow.com/a/21829747
tagged with: tomcat
has body: Hi im decoding the base64 string data and saving into the database like url format with time stamp so i need to compress the decoded data and my compression like if the coming data is less than 100kb then no need to compress otherwise compress the data into 50% off. try { String FileItemRefPath = propsFPCConfig.getProperty("fileCreationReferencePath"); String imageURLReferncePath = propsFPCConfig.getProperty("imageURLReferncePath"); File f = new File(FileItemRefPath+"/"+"productimages"+"/"+donorId); String strException = "Actual File "+f.getName(); if(!f.exists()) { if (!f.mkdirs()) { System.out.println("direction creation failed"); return null; } } else { boolean isdirCreationStatus = f.mkdirs(); } String strDateTobeAppended = new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()); String fileName = strImageName+strDateTobeAppended; savedFile = new File(f.getAbsolutePath()+"/"+fileName); strException=strException+" savedFile "+savedFile.getName(); Base64 decoder = new Base64(); byte[] decodedBytes = decoder.decode(strImageBase64); if( (decodedBytes != null) &amp;&amp; (decodedBytes.length != 0) ) { System.out.println("Decoded bytes length:"+decodedBytes.length); fos = new FileOutputStream(savedFile); System.out.println(new String(decodedBytes) + "\n") ; int x=0; { fos.write(decodedBytes, 0, decodedBytes.length); } fos.flush(); } if(fos != null) { fos.close(); System.out.println("file output stream"+savedFile.getName()); return savedFile.getName(); } else { return null; } } catch(Exception e) { e.printStackTrace(); } finally { try { if( fos!= null) { fos.close(); } else { savedFile = null; } } catch (IOException e) { e.printStackTrace(); } } return savedFile.getName(); }

http://stackoverflow.com/comment/32972028
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21791366
has text: This should not be posted as an answer, since it is a question. Please post as a comment.
score: 0

http://stackoverflow.com/q/21806714
has comment: http://stackoverflow.com/comment/32999407
score: -3
has comment: http://stackoverflow.com/comment/32999151
has comment: http://stackoverflow.com/comment/32999612
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21806769
downvote count: 3
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/32999168
accepted answer: http://stackoverflow.com/a/21806777
answer count: 3
has title: Trimming a string before substring
has answer: http://stackoverflow.com/a/21806769
has answer: http://stackoverflow.com/a/21806777
favorite count: 0
has answer: http://stackoverflow.com/a/21806793
has body: /** * Shortens input by only having one letter in the output. *If user inputs blank answer, default is size Small. */ if (!burgerSize.isEmpty()) { burgerSize = burgerSize.trim().toUpperCase(); burgerSize = burgerSize.substring(0, 1); } When I did this in my project, the command line said: Exception in thread "main" java.lang.StringIndexOutOfBoundsException... String index out of range: 1 at java.lang.String.substring(String.java:1...) at BurgerOrder.main(BurgerOrder.java:66)" If I switch the lines around, it doesn't do that...but my teacher told me to trim the string before the substring. if (!burgerSize.isEmpty()) { burgerSize = burgerSize.substring(0, 1); burgerSize = burgerSize.trim().toUpperCase(); } This is what I had originally and it had no errors. Should I just keep it the way it is and accept the points I lost? UPDATE: Let me clarify. If the user inputs the letter S like this "ssss", it will shorten and capitalize to "S". Same thing for M like "mmmmm" and so on. I know what I'm doing with my code. I'm just wondering if what my professor suggested was wrong (he was reading my code that I printed out).
has comment: http://stackoverflow.com/comment/32999176

http://stackoverflow.com/a/27283043
has body: Though this was asked long time back, this is what worked for me Try creating a package in your workspace like com.eclipse.jdt.internal.jarinjarloader and place all the files JarRsrcLoader.java, RsrcURLConnection.java , RsrcURLStreamHandler.java and RsrcURLStreamHandlerFactory.java which can be downloaded from google. Then wrote the Manifest as shown Build-Jdk: 1.7.0_55 Class-Path: . Rsrc-Main-Class: com.abc.Master Main-Class: com.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader Rsrc-Class-Path: ./ lib/xyz.jar
downvote count: 0
answers question: http://stackoverflow.com/q/21761664
type: Answer
has comment: http://stackoverflow.com/comment/63832051
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/63827605

http://stackoverflow.com/q/21738690
has title: Strange JIT pessimization of a loop idiom
accepted answer: http://stackoverflow.com/a/21795713
has comment: http://stackoverflow.com/comment/32879356
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32879033
tagged with: cpu
linked to: http://stackoverflow.com/q/21702939
type: Question
tagged with: microbenchmark
has body: While analyzing the results of a recent question here, I encountered a quite peculiar phenomenon: apparently an extra layer of HotSpot's JIT-optimization actually slows down execution on my machine. Here is the code I have used for the measurement: @OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(Mode.AverageTime) @OperationsPerInvocation(Measure.ARRAY_SIZE) @Warmup(iterations = 2, time = 1) @Measurement(iterations = 5, time = 1) @State(Scope.Thread) @Threads(1) @Fork(2) public class Measure { public static final int ARRAY_SIZE = 1024; private final int[] array = new int[ARRAY_SIZE]; @Setup public void setup() { final Random random = new Random(); for (int i = 0; i < ARRAY_SIZE; ++i) { final int x = random.nextInt(); array[i] = x == 0? 1 : x; } } @GenerateMicroBenchmark public int normalIndex() { final int[] array = this.array; int result = 0; for (int i = 0; i < array.length; i++) { final int j = i & array.length-1; final int entry = array[i]; result ^= entry + j; } return result; } @GenerateMicroBenchmark public int maskedIndex() { final int[] array = this.array; int result = 0; for (int i = 0; i < array.length; i++) { final int j = i & array.length-1; final int entry = array[j]; result ^= entry + i; } return result; } @GenerateMicroBenchmark public int normalWithExitPoint() { final int[] array = this.array; int result = 0; for (int i = 0; i < array.length; i++) { final int j = i & array.length-1; final int entry = array[i]; result ^= entry + j; if (entry == 0) break; } return result; } @GenerateMicroBenchmark public int maskedWithExitPoint() { final int[] array = this.array; int result = 0; for (int i = 0; i < array.length; i++) { final int j = i & array.length-1; final int entry = array[j]; result ^= entry + i; if (entry == 0) break; } return result; } } The code is quite subtle so let me point out the important bits: the "normal index" variants use the straight variable i for array index. HotSpot can easily determine the range of i throughout the loop and e…
has comment: http://stackoverflow.com/comment/32878570
score: 18
has comment: http://stackoverflow.com/comment/32878816
upvote count: 18
has comment: http://stackoverflow.com/comment/32878928
has answer: http://stackoverflow.com/a/21795713
tagged with: jmh
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32878658
favorite count: 0
has comment: http://stackoverflow.com/comment/32878454
has comment: http://stackoverflow.com/comment/32878461
tagged with: intel
has comment: http://stackoverflow.com/comment/32878984
has comment: http://stackoverflow.com/comment/32879824

http://stackoverflow.com/a/21742078
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32891145
accepted answer of: http://stackoverflow.com/q/21702776
answers question: http://stackoverflow.com/q/21702776
has comment: http://stackoverflow.com/comment/32897561
has body: This is caused by PDFBox not following the PDF Reference to the letter :) Tokens in a PDF token stream may be delimited by white space (as usual for most programming language), but also implicitly: because the next character is a delimiter of its own, since it introduces a special function. Therefore, it's totally valid -- and certainly not unusual -- to encounter constructions such as /A[123/B(C)] which is entirely equivalent to the slightly longer /A [ 123 /B (C) ] From ISO "PDF 32000-1:2008", 7.2.2 Character Set: The PDF character set is divided into three classes, called regular, delimiter, and white-space characters. This classification determines the grouping of characters into tokens. The rules defined in this sub-clause apply to all characters in the file except within strings, streams, and comments. The White-space characters shown [...] The delimiter characters (, ), <, >, [, ], {, }, /, and % are special [..] The original code shows the current implementation (taken from http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java): /** 1681 * This method is used to read a token by the {@linkplain #readInt()} method and the {@linkplain #readLong()} method. 1682 * 1683 * @return the token to parse as integer or long by the calling method. 1684 * @throws IOException throws by the {@link #pdfSource} methods. 1685 */ 1686 protected final StringBuilder readStringNumber() throws IOException 1687 { 1688 int lastByte = 0; 1689 StringBuilder buffer = new StringBuilder(); 1690 while( (lastByte = pdfSource.read() ) != 32 && 1691 lastByte != 10 && 1692 lastByte != 13 && 1693 lastByte != 60 && //see sourceforge bug 1714707 1694 lastByte != 0 && //See sourceforge bug 853328 1695 lastByte != -1 ) 1696 { 1697 buffer.append( (char)lastByte ); 1698 } 1699 if( lastByte != -1 ) 1700 { 1701 pdfSource.unread( lastByte ); 1702 } 1703 return buffer; 1704 } The 'next character' is tested against the whitespace characters from T…

http://stackoverflow.com/comment/32928861
type: AnswerComment
has text: @StormeHawke If i am trying to push something into it, this gives me an error, but isnt it correct for array lists?? public void push(T value) {value = values.add(size); size++;}
comment on: http://stackoverflow.com/a/21765010
type: Comment
score: 0

http://stackoverflow.com/a/21766610
has comment: http://stackoverflow.com/comment/32945959
has comment: http://stackoverflow.com/comment/32946924
upvote count: 1
has comment: http://stackoverflow.com/comment/32943907
has comment: http://stackoverflow.com/comment/32943861
has comment: http://stackoverflow.com/comment/32945576
has comment: http://stackoverflow.com/comment/32945240
has comment: http://stackoverflow.com/comment/32946024
has body: I suppose that the onclick of your button calls a method called calculateKfactor Make your method public, or it won't find it. Remember that without setting a visibility modifier you're on package visibility and not public visibility EDIT You say you go to the second activity (where your method resides) doing this: public void Sheetmetal (View view){ if (view == mbtnSheetmetal){ setContentView(R.layout.activity_sheetmetal); } } This is changing the layout of the main activity, so when you see your button you are still in the first activity, and when you click he searches your method in mainActivity. To start another activity follow these steps: Intent intent = new Intent(this, YourSecondActivity.class); startActivity(intent);
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32929065
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32946538
has comment: http://stackoverflow.com/comment/32930259
type: Answer
has comment: http://stackoverflow.com/comment/32942673
accepted answer of: http://stackoverflow.com/q/21766488
answers question: http://stackoverflow.com/q/21766488

http://stackoverflow.com/q/21808255
has comment: http://stackoverflow.com/comment/33001959
tagged with: java
has body: i know how to send all files from one directory to another in one time. but how can i want send files (.txt) from one directory to another one by one with a delay of 60s. import java.io.File; public class MoveFilesJavaExample { public static void main(String[] args) { try { File oldFile = new File("C:\\source\\File.txt"); if (oldFile.renameTo(new File("C:\\destination"+ oldFile.getName()))) { System.out.println("The file was moved successfully to the new folder"); } else { System.out.println("The File was not moved."); } } catch (Exception e) { e.printStackTrace(); } } } I can use the following code but it only do the same job every 5s. import java.util.Timer; import java.util.TimerTask; public class UtilTimerDemo { public static void main(String[] argv) throws Exception { int delay = 5000; // delay for 5 sec. int period = 1000; // repeat every sec. Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { System.out.println("doing"); } }, delay, period); } } Thank you
accepted answer: http://stackoverflow.com/a/21808333
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33001929
tagged with: scheduler
score: 0
possible better answer: http://stackoverflow.com/a/21808490
has title: How to move files one by one using java
favorite count: 0
has answer: http://stackoverflow.com/a/21808333
has answer: http://stackoverflow.com/a/21808490
has comment: http://stackoverflow.com/comment/33001960
has comment: http://stackoverflow.com/comment/33001999
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/21821884
answer count: 1
has title: How to register SIP Client with Asterisk PBX through java
has answer: http://stackoverflow.com/a/21821987
type: UnansweredQuestion
tagged with: asterisk
tagged with: java
type: Question
has body: I have done example programs prescribed in http://www.asterisk-java.org/development/tutorial.html successfully. Now I would like to register SIP client by passing their extension's credentials like extension ID, secret, domain and so on. How we can do these tasks by using Asterisk java? Or do we need another framework like SIP Client lib to establish connection between client and asterisk?
score: 0

http://stackoverflow.com/q/21825390
has comment: http://stackoverflow.com/comment/33060044
has comment: http://stackoverflow.com/comment/33032231
downvote count: 0
tagged with: api
has answer: http://stackoverflow.com/a/21825724
has comment: http://stackoverflow.com/comment/33032150
has body: I’m interested to know this as they are part of Java api [J2SE]. Generally it a convention to use "_" in variables name to indicate that they're instance variable or for some other special purpose [but defiantly it depends on programmer’s taste]. But there are few classes listed in Java API [J2SE], whose names are starting with underscore ("_"). Really Oracle have any special meaning/purpose for this underscore? [If yes,] Why kind of difference these classes have when compared with other classes in same API? http://docs.oracle.com/javase/7/docs/api/ _BindingIteratorImplBase _BindingIteratorStub _DynAnyFactoryStub _DynAnyStub _DynArrayStub _DynEnumStub _DynFixedStub _DynSequenceStub _DynStructStub _DynUnionStub _DynValueStub _IDLTypeStub _NamingContextExtStub _NamingContextImplBase _NamingContextStub _PolicyStub _Remote_Stub _ServantActivatorStub _ServantLocatorStub
favorite count: 0
possible better answer: http://stackoverflow.com/a/21825724
has answer: http://stackoverflow.com/a/21841087
tagged with: classname
answer count: 4
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/44735377
has comment: http://stackoverflow.com/comment/33033230
upvote count: 3
tagged with: java
type: Question
has title: Java api - Class names starting with _ [underscore]
has answer: http://stackoverflow.com/a/21825510
accepted answer: http://stackoverflow.com/a/21841087

http://stackoverflow.com/a/21760001
score: 2
has comment: http://stackoverflow.com/comment/32916448
has body: Here is an optional solution for you: Iterate all the links, and save the values of their &lt;href&gt; attributes in a list. Iterate the list generated on the previous step, and navigate you browser to each URL. Doing it this way will ensure that your code does not depend on the WebElement objects that you read from the DOM of the original web-page, and once you've collected all the URLs, you no longer need to remain on this web-page. Step #1: Before iterating lis, add ArrayList&lt;String&gt; urls = new ArrayList&lt;String&gt;(); Step #2: Replace driver.findElement(By.xpath(xpathOfElement)).click(); With urls.add(driver.findElement(By.xpath(xpathOfElement)).getAttribute("href")); Step #3: After iterating lis, navigate to each URL: for (String url : urls) driver.get("http://www.flipkart.com"+url);
has comment: http://stackoverflow.com/comment/32917944
accepted answer of: http://stackoverflow.com/q/21759479
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21759479
upvote count: 2
type: Answer

http://stackoverflow.com/q/21763542
has body: I am making a Deck class in Java. I only want the top Card to be accessible. I'm considering making Deck extend Stack, but Stack inherits from Vector, which has a method add(int, E). Why does Stack allow you to add an element anywhere in it? Is there a way to remove/disallow calls to this method? On the other hand, maybe I am completely thinking about this wrong. Is there a better way to make a Deck class? Should I make it extend and/or implement a different class and/or interface(s)?
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21763681
type: UnansweredQuestion
upvote count: 1
has title: Why does java.util.Stack allow .add(int, E)?
has answer: http://stackoverflow.com/a/21763673
score: 1
tagged with: stack
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21763595
downvote count: 0

http://stackoverflow.com/q/21702971
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21704197
has body: Imagine we have some parent container. We add children to it, one by one. Children widgets are placed according to some CSS: may be as block elements, may be as inline elements. A question is: Can we calculate the supposed parent height and width BEFORE adding next child and manage to insert "SHOW MORE" widget instead of adding next child? I tried to add ResizeEvent handler to my container. It catches the event, but only at the very moment when child widget is added, but CSS rules are not applied yet! That means that ResizeEvent is caught when all the children widgets are placed one on top of another as block elements, but in fact they should be placed as inline elements. After ResizeEvent Handler runs CSS rules are applied and child-widgets are reordered as inline elements, but this is not causing new ResizeEvents to parent container, which height is small again.. So in fact I want to catch the moment of resizing of my parent container before it happens.. a kind of a "if you add this child - parent needs resize" or "if you add this child - parent size is bigger than ... px" trigger. So is it possible to solve this task?
has title: GWT: is it possible to check parent size BEFORE adding next child but AFTER CSS rules are applied to that child?
type: Question
possible better answer: http://stackoverflow.com/a/21704197
has comment: http://stackoverflow.com/comment/32814572
tagged with: resize
has comment: http://stackoverflow.com/comment/32817150
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21832764
has answer: http://stackoverflow.com/a/21704237
tagged with: gwt
accepted answer: http://stackoverflow.com/a/21832764

http://stackoverflow.com/a/48878570
upvote count: 1
answers question: http://stackoverflow.com/q/21681620
downvote count: 0
score: 1
has body: Try this to store mail into sentbox for Outlook. Store store = session.getStore("imaps"); store.connect("imap-mail.outlook.com", "username", "password"); Folder folder = store.getFolder("Sent Items"); folder.open(Folder.READ_WRITE); message.setFlag(Flag.SEEN, true); folder.appendMessages(new Message[] {message}); store.close();
type: Answer

http://stackoverflow.com/a/21683109
downvote count: 2
has body: It is not so hard to write the add method on your own. This add does what students in 1st, 2nd, 3rd grades do. Actually adults do the same for long numbers. public class BigStringNumber { private int[] digit; // private String str; public BigStringNumber(String str) { // this.str = str; this.digit = new int[str.length()]; for (int i = 0; i &lt; str.length(); i++) { digit[i] = str.charAt(i) - '0'; } } public String toString() { StringBuilder sb = new StringBuilder(); for (int i=0; i&lt;digit.length; i++){ sb.append((char) ('0' + digit[i])); } return sb.toString(); } public BigStringNumber add(BigStringNumber d) { StringBuilder sb = new StringBuilder(); int i1 = this.digit.length - 1; int i2 = d.digit.length - 1; int dgt = 0; int carry = 0; while (i1 &gt;= 0 &amp;&amp; i2 &gt;= 0) { dgt = this.digit[i1] + d.digit[i2] + carry; carry = dgt / 10; dgt = dgt % 10; i1--; i2--; sb.append((char) ('0' + dgt)); } while (i1 &gt;= 0) { dgt = this.digit[i1] + carry; carry = dgt / 10; dgt = dgt % 10; i1--; sb.append((char) ('0' + dgt)); } while (i2 &gt;= 0) { dgt = d.digit[i2] + carry; carry = dgt / 10; dgt = dgt % 10; i2--; sb.append((char) ('0' + dgt)); } sb = sb.reverse(); return new BigStringNumber(sb.toString()); } public static void main(String[] args) { BigStringNumber a = new BigStringNumber("2020202029"); BigStringNumber b = new BigStringNumber("4040404046"); System.out.println(a.add(b).toString()); } }
has comment: http://stackoverflow.com/comment/32778777
score: 1
answers question: http://stackoverflow.com/q/21682549
has comment: http://stackoverflow.com/comment/32779060
has comment: http://stackoverflow.com/comment/32778848
has comment: http://stackoverflow.com/comment/32778752
has comment: http://stackoverflow.com/comment/32779115
type: Answer
has comment: http://stackoverflow.com/comment/32781115
upvote count: 3

http://stackoverflow.com/a/21780758
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/32955383
has body: You can add an XmlAdapter on an abstract super class (see http://blog.bdoughan.com/2012/01/jaxb-and-inhertiance-using-xmladapter.html). It is important to note that the XmlAdapter will only be applied to mapped fields/properties that reference the class and not when an instance of that class is marshalled as the root object. You will also not be able to include that class in the array of classes passed in to bootstrap the JAXBContext.
upvote count: 1
answers question: http://stackoverflow.com/q/21778400
downvote count: 0

http://stackoverflow.com/q/21813231
tagged with: android
tagged with: reference
linked to: http://stackoverflow.com/q/15076763
tagged with: memory-management
has comment: http://stackoverflow.com/comment/33011335
accepted answer: http://stackoverflow.com/a/21813955
has comment: http://stackoverflow.com/comment/33013064
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33010810
tagged with: java
type: Question
has title: android memory use and object references
has body: I'm sure this question (or something similar) has been asked elsewhere, but I couldn't find it, so this is the (slightly simplified) flow for my android app: Actvity A: Parses a json file and stores resulting objects in a List (let's call it "raw"). Once done, runs Activty B. Activity B: A search screen. Button click runs Activity C Activity C: Filters the list made in Activity A according to search parameters from Activity B. Adds the filtered objects to another list (for use in Activity D - let's call that "filtered") and creates another object based on their values (for use in Activity E - let's call that bigObj). Just in case how bigObj is created is relevant, say I start with objects like this: filtered = [{"name":"Dave", "age":"32", "job":"boss"}, {"name":"Dave", "age":"32", "job":"worker"}, {"name":"Dave", "age":"24", "job":"boss"}, {"name":"James", "age":"26", "job":"boss"}, {"name":"James", "age":"26", "job":"boss"}, {"name":"James", "age":"65", "job":"boss"}] then I end up with an object like this: bigObj = {"Dave":{"32":[{"name":"Dave", "age":"32", "job":"boss"}, {"name":"Dave", "age":"32", "job":"worker"}], "24":[{"name":"Dave", "age":"24", "job":"boss"}] }, "James":{"26":[{"name":"James", "age":"26", "job":"boss"}, {"name":"James", "age":"26", "job":"boss"}], "65":[{"name":"James", "age":"65", "job":"boss"}] } } And all three of these get saved via setters on the application activity. Later, depending on user interaction in either Activity D or E, the contents of the smaller object - say for example {"name":"Dave", "age":"32", "job":"boss"} - get displayed to the user in Activity F. Which all works fine. But there's obvious repetition. If an object makes it through the filter, it appears in all 3 places. And being that the objects contain alot more information than is actually needed in Activities D or E, there seems to be alot of data getting passed around needlessly. Which brings me to my question: Say that "raw" has 100 objects in it, and 50 pass the…
answer count: 1
has answer: http://stackoverflow.com/a/21813955
score: 0
has comment: http://stackoverflow.com/comment/33011123

http://stackoverflow.com/a/21756984
has body: Just add in the Manifest for your activity: android:windowSoftInputMode="stateHidden". For example: &lt;activity android:name="com.proj.activity.MainActivity" android:windowSoftInputMode="stateHidden" /&gt;
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21756796

http://stackoverflow.com/q/21795690
tagged with: java
type: Question
tagged with: jersey
tagged with: tomcat
upvote count: 3
answer count: 1
has title: How to call RESTful web service remotely
favorite count: 0
has answer: http://stackoverflow.com/a/21795720
tagged with: rest
accepted answer: http://stackoverflow.com/a/21795720
has body: I have been reading tutorials on how to build REST web services using Jersey and Tomcat. I have made a small test web service in Eclipse, deployed it on a Tomcat server and when I call the URI http://localhost:8080/TestService/rest/HelloWorld/ from browser it works fine. My question is how do I make a call to this web service from another PC. I tried replacing 'localhost' with the public IP (168.58.x.x) and call it via browser of another PC, I am not getting a response. I am not sure if I am missing to do something here or I am doing something wrong.
tagged with: web-services
type: AnsweredQuestion
score: 3
downvote count: 0

http://stackoverflow.com/comment/32969200
comment on: http://stackoverflow.com/q/21789191
type: Comment
type: QuestionComment
score: 1
has text: I think you may be asking the question at the wrong level of abstraction. Instead of asking how you can have a static method in the enums, you might want to ask how you can find the right enum based on a string (e.g., "side effects" vs. "adverse effects"). But you'll need to provide more information on what you're actually trying to accomplish. Enums may not be the right tool.

http://stackoverflow.com/q/21771831
type: Question
tagged with: gwt
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21772233
answer count: 1
tagged with: listbox
has body: I have an arrayList as: final List&lt;User&gt; users = new ArrayList&lt;User&gt;(); I want to add the outcome users of this arrayList to the GWT ListBox. ListBox is like : private ListBox test; test = new ListBox(); // Here i want to add the users as additem
has title: How to add ArrayList to the GWT ListBox
tagged with: arraylist
score: 0
accepted answer: http://stackoverflow.com/a/21772233

http://stackoverflow.com/q/21703831
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/21705673
accepted answer: http://stackoverflow.com/a/21705673
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32817676
has comment: http://stackoverflow.com/comment/32882463
has title: Selenium Webdriver with Java vs. c#
has body: We have a Selenium WebDriver Framework developed using Java, TestNG and Jenkins. Now we got a new project developed by c# .net and the client also interested to restructure the same framework with c# instead of Java, but we don't have any knowledge on c# . Is there any limitation doing the same thing on c# or like any pros/cons on Selenium WebDriver with c# compared to java?
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32870300
comment on: http://stackoverflow.com/q/21734508
type: Comment
type: QuestionComment
has text: Did you try googling? The first thing that pops up is the `File` API. See [here](http://docs.oracle.com/javase/tutorial/essential/io/fileio.html); there is a link to the older File I/O API from Java 6 as well.
score: 0

http://stackoverflow.com/comment/32988606
score: 0
comment on: http://stackoverflow.com/a/21800891
has text: ah you want it the other way round :-P
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21686414
score: 2
tagged with: symbols
answer count: 1
downvote count: 0
tagged with: utf-8
favorite count: 0
tagged with: http://stackoverflow.com/tag/docx
has body: I'm developing a JAVA program which processes the XML content of docx files and converts it to a specific format. It's working quite well, but I have problems if the Word file contains Symbol characters e.g. greek letters. In this case I see only little squares. I checked the source and see something like this: &lt;w:r w:rsidRPr="008E65F6"&gt;&lt;w:rPr&gt;&lt;w:rFonts w:ascii="Symbol" w:hAnsi="Symbol"/&gt;&lt;/w:rPr&gt;&lt;w:t&gt;ďˇ&lt;/w:t&gt;&lt;/w:r&gt; Or if I set the encoding to UTF-8: &lt;w:r w:rsidRPr="008E65F6"&gt;&lt;w:rPr&gt;&lt;w:rFonts w:ascii="Symbol" w:hAnsi="Symbol"/&gt;&lt;/w:rPr&gt;&lt;w:t&gt;&lt;/w:t&gt;&lt;/w:r&gt; When I view as Hexa, it seems that the greek characters are encoded as EF 81 A1 for alpha, EF 81 A2 for beta and so on. I also tried val.getBytes(Charset.forName("utf8")) where val is the value of the &lt;w:t&gt; tag. The result is e.g. [-17, -127, -95]. The negative values are quite surprising for me. So my question is, what is a safe and reliable way to covert these symbols to regular UTF-8 characters?
has answer: http://stackoverflow.com/a/23633432
type: AnsweredQuestion
tagged with: openxml
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32810117
type: Question
has title: Extract symbol characters from docx
accepted answer: http://stackoverflow.com/a/23633432
has comment: http://stackoverflow.com/comment/99841917
has comment: http://stackoverflow.com/comment/32799680
has comment: http://stackoverflow.com/comment/99881982

http://stackoverflow.com/comment/32900250
has text: Tried with above suggestion, but this captures only pop-up window that appears on top of Parent Browser(window). The requirement is that both parent browser and popup window should be captured.
comment on: http://stackoverflow.com/a/21749455
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32893366
type: Comment
has text: can u provide me the path from where i can download the jar of javax.speech.synthesis ?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21747126

http://stackoverflow.com/comment/33867479
type: AnswerComment
type: Comment
has text: yes is is in org.apache.commons.lang.StringUtils. I am using it for my string and printing it and there i can still see the space.
comment on: http://stackoverflow.com/a/21679517
score: 0

http://stackoverflow.com/comment/33124589
comment on: http://stackoverflow.com/a/21789679
score: 0
type: AnswerComment
has text: True, but also irrelevant with respect to my question.
type: Comment

http://stackoverflow.com/q/21681914
type: Question
tagged with: jframe
has answer: http://stackoverflow.com/a/21681970
tagged with: datetime
tagged with: jformattedtextfield
has title: Beginner... stuck on how to use FormattedFields in java for inserting dates
has comment: http://stackoverflow.com/comment/32786906
has body: I know the below code is supposed to format the FormattedTextField but it doesn't seem to do anything to the form (shown in the picture below). I was wanting, when the form loaded: the text field to look something like this 00/00/2014 - 00:00 am Where the user is able to enter datelike information around the symbol separators (/ or :) But where the user could not remove these symbol separators Code: package datefield; import javax.swing.JFormattedTextField; import javax.swing.text.DateFormatter; public class NewJFrame extends javax.swing.JFrame { public NewJFrame() { initComponents(); JFormattedTextField dateField = new JFormattedTextField(new DateFormatter(/*...*/)); } Screenshot: I'm not able to show picture as I need 10 reputation, but link to picture is below https://i.sstatic.net/sO3em.png
tagged with: java
linked to: http://stackoverflow.com/q/79662
upvote count: 1
tagged with: swing
answer count: 1
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0

http
tags question: http://stackoverflow.com/q/21758258
tags question: http://stackoverflow.com/q/21793869
tags question: http://stackoverflow.com/q/21829391
tags question: http://stackoverflow.com/q/21838348
tags question: http://stackoverflow.com/q/21683732
tags question: http://stackoverflow.com/q/21753604
tags question: http://stackoverflow.com/q/21763652
tag name: http
tags question: http://stackoverflow.com/q/21682448
tags question: http://stackoverflow.com/q/21805670
tags question: http://stackoverflow.com/q/21752670
tags question: http://stackoverflow.com/q/21764533
type: Tag
tags question: http://stackoverflow.com/q/21768685
tags question: http://stackoverflow.com/q/21735940
tags question: http://stackoverflow.com/q/21698003
tags question: http://stackoverflow.com/q/21686424
tags question: http://stackoverflow.com/q/21767945
tags question: http://stackoverflow.com/q/21769551
tags question: http://stackoverflow.com/q/21741092
tags question: http://stackoverflow.com/q/21776176
tags question: http://stackoverflow.com/q/21818242
tags question: http://stackoverflow.com/q/21744084
tags question: http://stackoverflow.com/q/21808700

http://stackoverflow.com/a/21806331
answers question: http://stackoverflow.com/q/21805953
has body: Apache Commons provides easy to use API to work with Strings: name = StringUtils.substring(name, 0, 25); name = StringUtils.leftPad(name, 25, ' ');
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/21787373
has comment: http://stackoverflow.com/comment/32964440
has comment: http://stackoverflow.com/comment/32964306
upvote count: 7
answers question: http://stackoverflow.com/q/21787289
has comment: http://stackoverflow.com/comment/32964350
has comment: http://stackoverflow.com/comment/32964349
downvote count: 0
has comment: http://stackoverflow.com/comment/32964491
has body: The JVM utilizes some daemon thread (e.g. garbage collector, finalizer, etc...). However, in this case, attaching a debugger has actually created a few more threads to handle the debuggers connection.
has comment: http://stackoverflow.com/comment/32964450
type: Answer
has comment: http://stackoverflow.com/comment/32964830
score: 7

http://stackoverflow.com/comment/32834283
type: QuestionComment
type: Comment
has text: A tak z ciekawości :-) Nie ma tu zbyt dużo Polaków :(
comment on: http://stackoverflow.com/q/21713544
score: 0

http://stackoverflow.com/comment/33050529
type: Comment
has text: Thank you all for the help, and I have learn't adding things to string :) works great now!! Stay Blessed ^_^
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21785129

http://stackoverflow.com/q/21690851
possible better answer: http://stackoverflow.com/a/21692595
accepted answer: http://stackoverflow.com/a/21692888
has body: I'm getting a LazyInitializationException and am not sure why. I'm storing an entity (BaseEntity with id) as data on a primefaces tree node in order to make it dynamic (i.e. onNodeExpand event handler that fetches expanded node children from db). I'm aware that the entity becomes detached after the render which is why I do the following in the onNodeExpand to add the child nodes: Product parentProduct = productService.findById(entity.getId()); This is returning an entity which I presumed would be "attached", but when I iterate over a lazy loaded OneToMany relationship I get the LazyInitializationException: for (Module module: parentProduct.getModules()) { What I am not understanding here? Edit: ProductService is a @Stateless EJB injected as follows into a ViewScoped Bean: @Named @ViewScoped public class MasterBean implements Serializable { private static final long serialVersionUID = 3153934047649103375L; TreeNode root; @EJB ProductRepo productService; findById is in a generic CrudRepository: public E findById(final K id) { return em.find(entityClass, id); }
type: Question
has title: Old "org.hibernate.LazyInitializationException ... could not initialize proxy - no Session": don't understand why
has comment: http://stackoverflow.com/comment/32819314
answer count: 2
has answer: http://stackoverflow.com/a/21692888
has answer: http://stackoverflow.com/a/21692595
type: AnsweredQuestion
tagged with: jsf
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32796946

http://stackoverflow.com/a/21780234
type: Answer
score: 3
downvote count: 0
has body: Because static belongs to class rather than any instance. When it is static single copy shared across all the instances. Where as instance member have the individual copy. consider you need to increase/decrease game score (count), in each stage (Stage class) of your game.
upvote count: 3
answers question: http://stackoverflow.com/q/21780195

http://stackoverflow.com/a/28088117
answers question: http://stackoverflow.com/q/21801605
downvote count: 0
has body: I've managed this that way: Spring database configuration class: @Bean @DependsOn("hibernateInterceptor") public LocalContainerEntityManagerFactoryBean entityManagerFactory( DataSource dataSource, JpaVendorAdapter jpaVendorAdapter, HibernateInterceptor hibernateInterceptor) { LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean(); ... Properties props = new Properties(); props.put("hibernate.ejb.interceptor", hibernateInterceptor); emfb.setJpaProperties(props); return emfb; } Hibernate interceptor class: @Component public class HibernateInterceptor extends EmptyInterceptor { ... @Autowired private MyRepository myRepository; ... }
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/21749862
tagged with: elevated-privileges
has comment: http://stackoverflow.com/comment/32898493
has answer: http://stackoverflow.com/a/21750062
tagged with: linux
has comment: http://stackoverflow.com/comment/32898165
type: Question
has comment: http://stackoverflow.com/comment/32897673
has comment: http://stackoverflow.com/comment/32898235
has comment: http://stackoverflow.com/comment/32898119
has comment: http://stackoverflow.com/comment/32899777
has answer: http://stackoverflow.com/a/21750102
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32897720
answer count: 3
has title: How to run superuser commands on Linux through Java code?
linked to: http://stackoverflow.com/q/10813608
has body: My application has multiple users and 1 superuser. I am trying to write and store a file in Linux through Java code but i get permission denied error. I used the following code: Process process = Runtime.getRuntime().exec("/usr/bin/tiff2pdf -o /tmp/tiff_dir/temp.pdf /tmp/tiff_dir/image.tiff"); int returnCode = process.waitFor(); I get following error: java.io.FileNotFoundException: image.tiff (Permission denied) From my analysis, it seems that because the user does not have root permissions, i am getting this error. What is the solution to this?
has comment: http://stackoverflow.com/comment/32898545
has answer: http://stackoverflow.com/a/21750864
linked to: http://stackoverflow.com/q/4662574
has comment: http://stackoverflow.com/comment/32980447
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32898553
has comment: http://stackoverflow.com/comment/32898136
has comment: http://stackoverflow.com/comment/32898418
has comment: http://stackoverflow.com/comment/32900252
score: 3
has comment: http://stackoverflow.com/comment/32898080
has comment: http://stackoverflow.com/comment/32899652
downvote count: 0
has comment: http://stackoverflow.com/comment/32898070
tagged with: exec
has comment: http://stackoverflow.com/comment/32900950
favorite count: 0

http://stackoverflow.com/q/21775451
type: Question
tagged with: debugging
has title: Debugging maven projects with eclipse
tagged with: eclipse
score: 0
answer count: 1
has body: Hello I'm trying to debug my Maven Projects (multi module project with parent pom) according this post: Right click project Debug as -> Maven build ... In the goals field put -Dmaven.surefire.debug test In the parameters put a new parameter called forkMode with a value of never (Maven build debug in Eclipse) The maven build starts and after building all projects it stops. The application does not start and nothing happens. Do I have to setup anything in the parent pom.xml?
type: UnansweredQuestion
tagged with: maven
linked to: http://stackoverflow.com/q/12598261
has answer: http://stackoverflow.com/a/21775528
tagged with: java

http://stackoverflow.com/a/21806016
has comment: http://stackoverflow.com/comment/32999071
has comment: http://stackoverflow.com/comment/32999438
has comment: http://stackoverflow.com/comment/32997949
has body: Try this code will help you to append new View to your layout try this code clarify the idea for you and feel free to feed me back in any not obvious thing the layout code : &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/yourlayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; and in your OnCreate method add this code LinearLayout yourlayout= (LinearLayout) findViewById(R.id.yourlayout); for (int i = 0; i &lt; arraylist.size(); i++) { Button btn = new Button (ActivityName.this); btn.setWidth(40); btn.setHeight(20); btn.setText(arrylist.get(i).gettext()); yourlayout.addView(btn); }
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21805950
has comment: http://stackoverflow.com/comment/32998010
answers question: http://stackoverflow.com/q/21805950
type: Answer
has comment: http://stackoverflow.com/comment/32998401
has comment: http://stackoverflow.com/comment/32998761
has comment: http://stackoverflow.com/comment/32998894
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32998526
has comment: http://stackoverflow.com/comment/32998763

http://stackoverflow.com/q/21735160
has body: I have a very basic BankAccount class and tester. /** A bank account that has a balance that can be changed by depositing and withdrawals also deducts a fee for each withdrawal and deposit. * * @author lapenta1 * */ public class BankAccount { private double balance; private double feeCharge; /** Contructs a bank account with a balance of zero * */ public BankAccount() { balance = 0; feeCharge = 2.50; } /**Constructs a bank account with a given balance * * @param initialBalance the initial balance */ public BankAccount(double initialBalance) { balance = initialBalance; } /** Deposits money into the bank account * * @param amount the amount to deposit */ public void deposit(double amount) { balance = balance + amount - feeCharge; } /**Withdrawals money from the bank account * * @param amount the amount to withdrawal */ public void withdraw(double amount) { balance = balance - amount - feeCharge; } /**Gets the current balance of the bank account * * @return the current balance */ public double getBalance() { return balance; } public void deductMonthlyCharge() { } } This is the tester class public class BankAccountTester { public static void main(String[] args) { BankAccount myWallet = new BankAccount(); myWallet.deposit(200); System.out.println(myWallet.getBalance()); BankAccount otherWallet = new BankAccount(); otherWallet.deposit(200); System.out.println(otherWallet.getBalance()); } } now I am trying to make it work so there is basically a set amount of withdrawals/deposits that can be used before the 2.50 fee is taken away every month. The only hint I have is to use math.max(actual transaction count, free transaction count) I am lost! any help?
has title: Programming my bankAccount program to deduct a set number of fees every month how?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/73920066
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21735289
answer count: 2
accepted answer: http://stackoverflow.com/a/21735289
has comment: http://stackoverflow.com/comment/32871837
score: 0
has answer: http://stackoverflow.com/a/73920066
linked to: http://stackoverflow.com/q/12716097

http://stackoverflow.com/q/21803247
answer count: 2
has title: Comparable Class equals function works on private variable?
downvote count: 0
accepted answer: http://stackoverflow.com/a/21803354
favorite count: 0
tagged with: private
possible better answer: http://stackoverflow.com/a/21803285
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16354728
tagged with: equals
has answer: http://stackoverflow.com/a/21803285
upvote count: 2
has answer: http://stackoverflow.com/a/21803354
type: Question
tagged with: java
tagged with: comparable
has body: Well my code works, but I just can't understand why a private variable works in this case, inside function equals(). Or is it just a trick that if you call another object from inside the same kind of object structure then the private identifier doesn't count? public class TestClass implements Comparable &lt;TestClass&gt; { private final String name; public TestClass(String name) { this.name = name; } @Override public int hashCode() { return name.hashCode(); } @Override public boolean equals(Object obj) { if (obj instanceof TestClass) { return ((TestClass) obj).name.equals(name); //&lt;- how does this work, isn't name private? } else { return false; } } @Override public int compareTo(TestClass test) { int thisValue = hashCode(); int otherValue = test.hashCode(); if (thisValue &lt; otherValue) { return -1; } else if (thisValue &gt; otherValue) { return 1; } else { return 0; } } @Override public String toString() { return name; } }

http://stackoverflow.com/q/21773954
downvote count: 0
type: UnansweredQuestion
type: Question
tagged with: spring-mvc
has body: Is there any way to lock user edit row when other user editing this row. I used spring mvc, hibernate and mysql database. Please help me. Thanks
tagged with: java
tagged with: hibernate
upvote count: 2
answer count: 1
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/21775316
has title: spring mvc hibernate lock row of table

http://stackoverflow.com/comment/33024063
type: AnswerComment
has text: Or use `int` or `long` if it is known that the value doesn't get larger than `Integer.MAX_VALUE` or `Long.MAX_VALUE`
comment on: http://stackoverflow.com/a/21820624
type: Comment
score: 0

http://stackoverflow.com/comment/33061709
has text: You're correct. I mistakenly read that the original code had a .remove() before issuing it's .next(), which (at least in the past) would cause this error. But the code is in the correct order.
comment on: http://stackoverflow.com/a/21841753
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33050778
comment on: http://stackoverflow.com/a/21835895
type: Comment
score: 0
type: AnswerComment
has text: I changed it, but now it's telling me that my array is not being used, am I changing the index correctly?

http://stackoverflow.com/comment/32857154
type: AnswerComment
score: 1
has text: Have a look at http://stackoverflow.com/questions/2893815/hello-webview-tutorial-opens-the-requested-address-in-android-browser-and-not#2893868
type: Comment
comment on: http://stackoverflow.com/a/21722734

http://stackoverflow.com/a/21859469
type: Answer
answers question: http://stackoverflow.com/q/21827708
has comment: http://stackoverflow.com/comment/33092251
has body: It is my downloadfile() code. I'm using zehon library. public static int downloadFile() { //upload do serwera SFTP String sftpFolder = "/Kursy"; String nameOfFile = "Kursy.txt"; String toLocalFolder = "C:/DATA/work_dir"; int status = -1; String test=null; if (localfileExists()&lt;sftpfileExists()) { try { SFTPClient sftpClient = new SFTPClient("127.0.0.1", "test", "test"); //polaczenie do servera SFtp status = sftpClient.getFile(nameOfFile, sftpFolder, toLocalFolder); System.out.println("downloaded"); } catch (Exception e) { e.printStackTrace(); } } else { System.out.println("Daty sa takie same"); } return status; }
score: 0

http://stackoverflow.com/comment/32787931
type: QuestionComment
comment on: http://stackoverflow.com/q/21684419
has text: @EJP: My text was not clear enough. I hope I made it a bit clearer now. Bottom line: I don't want to write these kind of classes myself because it is hard (for me) to prove their correctness.
score: 0
type: Comment

http://stackoverflow.com/a/21794269
has body: You can use Class.forName(..) to have your class initialized and get a reference to its Class object. Class&lt;?&gt; classB = Class.forName("ClassB"); The javadoc states A call to forName("X") causes the class named X to be initialized. Related: What purpose does Class.forName() serve if you don&#39;t use the return value?
upvote count: 2
has comment: http://stackoverflow.com/comment/32976947
has comment: http://stackoverflow.com/comment/32976954
has comment: http://stackoverflow.com/comment/32976973
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21794234
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21794234

http://stackoverflow.com/comment/32830776
type: Comment
has text: I fix the `No Session found for current thread`. Add `<import resource="classpath:META-INF/spring/dao-application-context.xml"/>` in [here](http://goo.gl/bsvxaA) but why we don't see my `SessionFactory` in this file.
comment on: http://stackoverflow.com/a/21711574
type: AnswerComment
score: 0

http://stackoverflow.com/q/21698917
has title: Error with AWTView draggingEnded
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32810692
tagged with: drag-and-drop
tagged with: macos
answer count: 0
type: UnansweredQuestion
has body: I have a problem when I drag &amp; drop in eclipse with swing in mac OS X. Sometimes when I drag my object, the application freezes and crashes. Tested with Java version: 1.7.0_51, 1.6.0_65 and 1.8.0 and Mac OS X: 10.7.5 and 10.9.1 Some people have already this problem 2 years ago 2014-02-11 10:45:16.982 java[716:707] -[AWTView draggingEnded:]: unrecognized selector sent to instance 0x7fbc6d84a1e0 2014-02-11 10:45:17.017 java[716:707] -[AWTView draggingEnded:]: unrecognized selector sent to instance 0x7fbc6d84a1e0 2014-02-11 10:45:17.096 java[716:707] ( 0 CoreFoundation 0x00007fff90648f56 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x00007fff93f7dd5e objc_exception_throw + 43 2 CoreFoundation 0x00007fff906d51be -[NSObject doesNotRecognizeSelector:] + 190 3 CoreFoundation 0x00007fff90635fa4 ___forwarding___ + 756 4 CoreFoundation 0x00007fff90635c38 _CF_forwarding_prep_0 + 232 5 liblwawt.dylib 0x000000011754aec2 -[AWTView draggingEnded:] + 136 6 AppKit 0x00007fff8cfe0f48 NSCoreDragCompletionProc + 497 7 HIServices 0x00007fff93d9ecc8 DoTrackingMessage + 448 8 CoreFoundation 0x00007fff905d5666 __CFDictionaryApplyFunction_block_invoke_1 + 22 9 CoreFoundation 0x00007fff905b7121 CFBasicHashApply + 113 10 CoreFoundation 0x00007fff905d5644 CFDictionaryApplyFunction + 212 11 HIServices 0x00007fff93da2098 CoreDragStartDragging + 915 12 AppKit 0x00007fff8cfe06c0 -[NSCoreDragManager _dragUntilMouseUp:accepted:] + 885 13 AppKit 0x00007fff8cfdfd8c -[NSCoreDragManager dragImage:fromWindow:at:offset:event:pasteboard:source:slideBack:] + 1455 14 AppKit 0x00007fff8d2d8cc6 -[NSWindow(NSDrag) dragImage:at:offset:event:pasteboard:source:slideBack:] + 132 15 liblwawt.dylib 0x00000001175556f2 -[CDragSource doDrag] + 501 16 CoreFoundation 0x00007fff9063870d -[NSObject performSelector:withObject:] + 61 17 Foundation 0x00007fff95e05d70 __NSThreadPerformPerform + 214 18 CoreFoundation 0x00007fff905b74f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 19 CoreFoundation 0x00007…
upvote count: 1
tagged with: swing
type: Question
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12881600

http://stackoverflow.com/comment/32861271
has text: I have a follow-up question - is there a tool out there that would allow me to visualise the current state of the JVM? Like, can I see what threads currently exist, how much stack memory they have allocated, what the heap looks like, what's in the classloader etc?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21728835
type: Comment

http://stackoverflow.com/comment/32802845
score: 0
type: Comment
has text: i've been download and put tomcat4-coyote-4.1.36 into common->lib and copy your configuration into `server.xml`. when i start my tomcat, it said `error initializing endpoint, socket bind failed`
comment on: http://stackoverflow.com/a/21695654
type: AnswerComment

http://stackoverflow.com/comment/32816545
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21704081
has text: The problem is that the `JProgressBar` is in the `ListCellRenderer`

http://stackoverflow.com/a/31355357
answers question: http://stackoverflow.com/q/21746399
type: Answer
has body: @Developer SuRu it is right And this link explain easily how can do this Java was started but returned exit code=13 [FIXED] Or see this Answer : Add the java 32-bit version path to AptanaStudio3.ini
score: 0

http://stackoverflow.com/a/21783982
answers question: http://stackoverflow.com/q/21781161
downvote count: 0
has body: As @BennX said you can sum up the delta time you have in your render method or get it by calling Gdx.graphics.getDeltaTime();. If it is bigger then 1 (delta is a float, giving the seconds since the last frame has been drawn), you can execute your task. Instead of reseting your timer by using timer = 0; you could decrement it by using timer -= 1, so your tasks get executed more accurate. So if 1 task starts after 1.1 seconds, cause of a really big delta the next time it gets executed after arround 0.9 seconds. If you don't like the delta time solution you can use Libgdx timer, instead of java.util.Timer. An example of it: Timer.schedule(new Task(){ @Override public void run() { doWhatEverYouWant(); } } , delay // (delay) , amtOfSec // (seconds) ); This executes the doWhatEverYouWant() method after a delay of delay and then every seconds seconds. You can also give it a 3rd parameter numberOfExecutions, telling it how often the task should be executed. If you don't give that parameter the task is executed "forever", till it is canceled.
score: 26
upvote count: 26
type: Answer

http://stackoverflow.com/q/21698038
answer count: 4
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32808123
upvote count: 1
has comment: http://stackoverflow.com/comment/32806455
type: Question
tagged with: do-while
has answer: http://stackoverflow.com/a/21698053
has comment: http://stackoverflow.com/comment/32805331
tagged with: arrays
has answer: http://stackoverflow.com/a/21698208
has answer: http://stackoverflow.com/a/21699026
has comment: http://stackoverflow.com/comment/32805381
has comment: http://stackoverflow.com/comment/32805236
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/21698148
has body: How do I exit this loop when user presses ENTER. This is part of the codes I have done. I am having problems in how to code when user presses ENTER. static String[] itemList = new String[10]; do { System.out.print("Enter item (press ENTER to exit) " + (count + 1) + ": "); String item = input.next(); itemList[count] = item; if (item == "") count = itemList.length;
downvote count: 0
has comment: http://stackoverflow.com/comment/33805928
favorite count: 0
has title: How to exit loop with ENTER
type: UnansweredQuestion

http://stackoverflow.com/a/26888229
answers question: http://stackoverflow.com/q/21771225
type: Answer
score: 2
has body: you should run standlone.bat or .sh with -c standalone-full.xml switch may be work.
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/76155688
type: AnswerComment
type: Comment
score: 0
has text: I'm not doing exactly the same thing but your point is correct, is just an inheritance stuff.
comment on: http://stackoverflow.com/a/21827909

http://stackoverflow.com/comment/32784272
has text: With the exception of the attempt to return a `double` at the end of a method which is declared as `void ...`, your code looks pretty good for a beginner.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21686036
score: 0

http://stackoverflow.com/a/21710821
has body: There are many wrong facts in your understanding. Exceptions and thread abortions don't cause memory leaks. Memory leaks only happen when you keep references to objects for too long. A memory leak is thus caused by a bug in your code (or in a library that you're using), but not by the JVM. A GC collects objects when the object is not reachable from any chain of references from a root object (variable on a thread stack or static variable). An object which still has references to other objects is not a problem at all. An object which is still referenced by other objects, but not reachable anymore is eligible to GC as well. That's what allows building complex graphs of objects with cyclic references without any problem. Calling gc explicitly may cause GC to execute immediately, later, or not have any effect. If the GC was buggy, it would be useless. It's not buggy. If it reclaims an object, then this object is not used anymore by the application. To make an object not perishable, just make sure it's always reachable through a chain of references from a root. It could b referenced from a static variable, or by a local variable from a thread that never ends.
answers question: http://stackoverflow.com/q/21710370
downvote count: 0
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/21796588
has comment: http://stackoverflow.com/comment/37405959
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/51484308
downvote count: 0
has title: How to find "Cursor" position in webpage with Selenium Webdriver?
favorite count: 0
type: UnansweredQuestion
has body: I just started learning Selenium Webdriver using java Script, the question what I have asked might me a silly one. But still wanted to know whether it is possible or not. As per my question, please go through the below example In any Login page, enter valid "Username" and click on "signin" button, it throws an error message "Please enter password" and the "cursor" will be located in "Password" field So, we can get the error message via code. Now, how can we locate or identify the "Cursor" position in the webpage via code?
upvote count: 5
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/36138512
type: Question

http://stackoverflow.com/q/21793033
tagged with: jsf-2.2
tagged with: glassfish
has comment: http://stackoverflow.com/comment/55288498
has body: I have a problem with p:fileUpload. In my Bean it retrieve null value when i up load file. I use PrimeFaces3.5 this is my .xhtml xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:p="http://primefaces.org/ui"> <h:head> Facelet Title </h:head> <h:body> <h:form enctype="multipart/form-data"> <p:messages showDetail="true"/> <p:panelGrid columns="2"> <h:outputLabel for="image" value="Select Picture" /> <p:fileUpload value="#{uploadImage.file}" mode="advance" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/> <p:commandButton value="Submit" ajax="false" action="#{uploadImage.test1()}"/> </p:panelGrid> </h:form> </h:body> And this is UploadImage.java package AS_2; import java.io.Serializable; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; import org.primefaces.event.FileUploadEvent; import org.primefaces.model.UploadedFile; /** * * @author Mac */ @ManagedBean @SessionScoped public class UploadImage implements Serializable{ private UploadedFile file; public UploadedFile getFile() { return file; } public void setFile(UploadedFile file) { this.file = file; } /** * Creates a new instance of UploadImage */ public void test1() { try { if (file != null) { FacesMessage msg = new FacesMessage("Succesful is uploaded."); FacesContext.getCurrentInstance().addMessage(null, msg); } else { FacesMessage msg = new FacesMessage("failure to upload"); FacesContext.getCurrentInstance().addMessage(null, msg); } } catch (Exception e) { e.printStackTrace(); } } public UploadImage() { } } web.xml is like is: <?xml version="1.0" encoding="UTF-8"?> javax.faces.PROJECT_STAGE Development javax.faces.CONFIG_FILES /WEB-INF/faces-config.xml Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet /faces/* Faces Servlet *.xhtml 30 faces/mainPage.xhtml PrimeFaces FileUpload Filter org.primefaces.webapp.filter.FileUploadFilter PrimeFaces FileUpload Filter Faces Servlet FORWARD Extensions Filter org.apac…
has answer: http://stackoverflow.com/a/21794264
linked to: http://stackoverflow.com/q/8588687
tagged with: file-upload
type: UnansweredQuestion
type: Question
has title: p:fileUpload return null value
has answer: http://stackoverflow.com/a/21840304
tagged with: primefaces
tagged with: java
score: 0
answer count: 2

http://stackoverflow.com/q/21750116
tagged with: jaxb
has body: I have a Jersey2 service with a POST method handler @Path("register") public class RegisterResource { @XmlRootElement class PostUserParams { String username; String password; public PostUserParams() {} } @POST @Consumes(MediaType.APPLICATION_JSON) public postData(PostUserParams user) { ... } } But I can't get the POST request to work - I already get 415 Unsupported Media Type. I'm pretty sure that I have the correct Content-Type in the request moxy, jaxb and all the jars and dependencies are properly deployed I even tried to add some moxy configuration for jersey, but that doesn't seem to be necessary according to the docs other requests not involving JSON to Java conversion work fine the JSON in the request is correct What gives?
tagged with: jersey
has answer: http://stackoverflow.com/a/21750117
upvote count: 1
answer count: 1
tagged with: moxy
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has title: Moxy JAXB json mapping in Jersey returns 415
type: Question
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/32942695
has text: How to pass instance of Phonebase ? can you guide me please. I never used reflection. Also PhoneBase is a abstract class how to get it's instance.
type: QuestionComment
comment on: http://stackoverflow.com/q/21774943
score: 0
type: Comment

http://stackoverflow.com/q/21720613
type: Question
answer count: 2
downvote count: 1
tagged with: conditional-statements
tagged with: java
has answer: http://stackoverflow.com/a/21720667
has comment: http://stackoverflow.com/comment/32845709
has body: I need to call different functions according to the size of the array list. ie, something like List&lt;String&gt; lsNextPages = new ArrayList&lt;String&gt;(); if(lsNextPages.size() == 0){ lsNextPages = fuction1(parentLink); } if(lsNextPages.size() == 0){ lsNextPages = function2(parentLink); } if(lsNextPages.size() == 0){ lsNextPages = function3(parentLink); } for avoiding if loop checking after each function call, i tried while(lsNextPages.size() == 0){ lsNextPages = function1(parentLink); lsNextPages = function2(parentLink); lsNextPages = function3(parentLink); } But this is not working. What is the reason for that and how can i do this? Thanks. With your permision, i am adding one more example: public static void main(String []args) { List&lt;String&gt; lsNextPages = new ArrayList&lt;String&gt;(); while(lsNextPages.size() == 0){ lsNextPages = function1(); lsNextPages = function2(); lsNextPages = function3(); } System.out.println(lsNextPages); } static public List&lt;String&gt; function1(){ List&lt;String&gt; list = new ArrayList&lt;String&gt;();; return list; } static public List&lt;String&gt; function2(){ List&lt;String&gt; list = Arrays.asList("1","2"); return list; } static public List&lt;String&gt; function3(){ List&lt;String&gt; list = Arrays.asList("1","2","3"); return list; } What i need is if the first function gives a non empty list, do not call the following function. ie,function2 gives a non empty list.so do not call function3. i need a output like [1,2]. But here the output is [1,2,3]. The output is same if i change the while loop with if loop.
has comment: http://stackoverflow.com/comment/32845871
has answer: http://stackoverflow.com/a/21720701
tagged with: if-statement
upvote count: 0
has comment: http://stackoverflow.com/comment/32845630
type: UnansweredQuestion
tagged with: arraylist
tagged with: while-loop
has comment: http://stackoverflow.com/comment/32845663
has comment: http://stackoverflow.com/comment/32859148
has title: process while loop according to the size of the list
favorite count: 0
score: -1

http://stackoverflow.com/q/21837199
has answer: http://stackoverflow.com/a/21837746
tagged with: java
type: Question
answer count: 2
has title: Play 2.1 application as scala project in eclipse (instead of java project)
score: 0
has answer: http://stackoverflow.com/a/21897211
tagged with: scala
type: UnansweredQuestion
tagged with: playframework-2.1
has body: How can you configure a playframework-2.1 application build.scala file to generate an eclipse project with scalanature and not javanature? I found this code (https://github.com/playframework/playframework/blob/2.1.x/framework/src/sbt-plugin/src/main/scala/play/Project.scala) val mainLang = if (dependencies.contains(javaCore)) JAVA else SCALA This suggests that if I have javaCore in dependencies i will get a JAVA project. I tried to remove the dependencies on javaCore but I've got compilation errors. Any suggestions?
tagged with: sbt

http://stackoverflow.com/q/21708339
has answer: http://stackoverflow.com/a/57709849
score: 101
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32824243
has answer: http://stackoverflow.com/a/25474428
has answer: http://stackoverflow.com/a/67726588
has answer: http://stackoverflow.com/a/61423496
has answer: http://stackoverflow.com/a/25623219
has answer: http://stackoverflow.com/a/42392195
has answer: http://stackoverflow.com/a/21760361
has answer: http://stackoverflow.com/a/37717139
has answer: http://stackoverflow.com/a/54192969
has answer: http://stackoverflow.com/a/39164608
has answer: http://stackoverflow.com/a/28179906
has answer: http://stackoverflow.com/a/78686978
tagged with: jackson
answer count: 17
possible better answer: http://stackoverflow.com/a/37840526
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/60580456
has comment: http://stackoverflow.com/comment/32916094
upvote count: 101
tagged with: spring
has title: Avoid Jackson serialization on non fetched lazy objects
linked to: http://stackoverflow.com/q/4362104
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/37155331
downvote count: 0
linked to: http://stackoverflow.com/q/42395831
has body: I have a simple controller that return a User object, this user have a attribute coordinates that have the hibernate property FetchType.LAZY. When I try to get this user, I always have to load all the coordinates to get the user object, otherwise when Jackson try to serialize the User throws the exception: com.fasterxml.jackson.databind.JsonMappingException: could not initialize proxy - no Session This is due to Jackson is trying to fetch this unfetched object. Here are the objects: public class User{ @OneToMany(fetch = FetchType.LAZY, mappedBy = "user") @JsonManagedReference("user-coordinate") private List<Coordinate> coordinates; } public class Coordinate { @ManyToOne @JoinColumn(name = "user_id", nullable = false) @JsonBackReference("user-coordinate") private User user; } And the controller: @RequestMapping(value = "/user/{username}", method=RequestMethod.GET) public @ResponseBody User getUser(@PathVariable String username) { User user = userService.getUser(username); return user; } There is a way to tell Jackson to not serialize the unfetched objects? I've been looking other answers posted 3 years ago implementing jackson-hibernate-module. But probably it could be achieved with a new jackson feature. My versions are: Spring 3.2.5 Hibernate 4.1.7 Jackson 2.2
has answer: http://stackoverflow.com/a/34293357
has comment: http://stackoverflow.com/comment/32908833
has answer: http://stackoverflow.com/a/37840526
type: Question
has comment: http://stackoverflow.com/comment/32909694
accepted answer: http://stackoverflow.com/a/21760361
has answer: http://stackoverflow.com/a/77326268
has comment: http://stackoverflow.com/comment/90549279

http://stackoverflow.com/q/21737708
has comment: http://stackoverflow.com/comment/32878915
answer count: 0
has title: Add textView to relativeLayout which is inside scrollView Dynamically
score: 0
type: UnansweredQuestion
has body: I have RelativeLayout inside ScrollView.. and I am trying to add TextView 'tv' below textView22 ... item : is an object. When I run the program, I don't see the new textView though there are NO errors in my code. Any suggestions? RelativeLayout s = (RelativeLayout) findViewById(R.id.RL) ; RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); TextView tv = new TextView(Post.this); tv.setText(item.getString("comment")); p.addRule(RelativeLayout.BELOW , R.id.textView22 ); tv.setTextSize(18) ; tv.setTextColor( 0xaaaaff ); s.addView(tv , p ); EDIT 2 You can see there is a value of this textView (in the left, look at 'mtext' in the table) but I don't see it in screen!
tagged with: java
has comment: http://stackoverflow.com/comment/32876988
type: Question
has comment: http://stackoverflow.com/comment/32877305
has comment: http://stackoverflow.com/comment/32877934
has comment: http://stackoverflow.com/comment/32877677
tagged with: android-relativelayout
tagged with: android

http://stackoverflow.com/comment/32805315
has text: He means you have to use `String#equals` to compare strings, not `==`: `item.equals("")`. `==` compares references, not content. Please read some Java tutorial about strings.
comment on: http://stackoverflow.com/a/21698053
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32895791
has text: Manual Id, no version column, just single entities. The use case is that a 3rd party system sends a json containing updated and new records to my REST app, and I need to mark the new and updated records because this app needs to keep in sync with yet another server. I have a new, update, delete columns in every table, so I need to set new to true if the record was inserted or update to true if it was updated.
comment on: http://stackoverflow.com/a/21748293
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21797412
has body: Call initControls inside the oncreate method like this @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_plus); initControls(); }
has comment: http://stackoverflow.com/comment/32982486
upvote count: 1
has comment: http://stackoverflow.com/comment/32982614
score: 1
has comment: http://stackoverflow.com/comment/32982501
downvote count: 0
answers question: http://stackoverflow.com/q/21797374
type: Answer

http://stackoverflow.com/comment/32987155
type: AnswerComment
has text: Is this Worker can not use other methods writing in itself? Example; I use method for getStartDate from GUI's startdatebox. But When program launched and fired Worker with button. Worker succesfully working in backround and create excel file. But when i control the excel file i see excel file creating first GUI screen values instead my selected values before press the button. Any idea ?
type: Comment
comment on: http://stackoverflow.com/a/21779987
score: 0

http://stackoverflow.com/comment/32913273
comment on: http://stackoverflow.com/q/21758254
type: QuestionComment
has text: Maybe a resource loading problem? Right now the image needs to be located in the same package/folder as GordonsWindow or in a folder directly on the classpath...
type: Comment
score: 0

http://stackoverflow.com/q/21732507
has title: Android Autobahn Error "WebSockets protocol violation"
downvote count: 0
tagged with: websocket
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
tagged with: autobahn
tagged with: jetty
score: 2
answer count: 0
tagged with: java
type: Question
has body: I use Jetty - on server, Android Autobahn - on client. When i try send from server large data (most 150 000 bytes), I receive error in client: "WebSockets protocol violation". But server call "writeSuccess()" handler. If i send less 150 000 bytes, then works. How to send large data?

http://stackoverflow.com/q/21777214
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21777460
has answer: http://stackoverflow.com/a/21777508
type: Question
has title: How to add java class folders instead of jar's in linux shell script
answer count: 2
tagged with: linux
type: UnansweredQuestion
has body: Below is my existing script. for f in $( find $CATALINA_HOME/webapps/myapp/WEB-INF/lib/ -name "*.jar" ); do CLASSPATH="$CLASSPATH:$f" done The above one is working fine until the java classes wrapped with .jar. But now there is now more jars, and all java classes maintained in the readable folders(means packages). So I want to add my all java class folders to the class path. Any help appreciated. Thanks in advance Ashok

http://stackoverflow.com/a/21762823
answers question: http://stackoverflow.com/q/21762754
has body: If you need your program to have a single instance of a given class, you should implement a Singleton pattern. The recommended way to do this since java 5 is to define an enum type with only one element, something like: public enum MyEnum { MY_SINGLETON_INSTANCE; // business logic, etc. } This is (at least according to Josh Bloch ;) ) the easiest and safest way to ensure your object instance is unique, doesn't matter what you do. Here is a broader and more complete discussion on this topic: Implementing the singleton pattern in Java
score: 0
has comment: http://stackoverflow.com/comment/32920655
type: Answer
has comment: http://stackoverflow.com/comment/32920864

http://stackoverflow.com/q/21759739
favorite count: 0
has comment: http://stackoverflow.com/comment/32926809
tagged with: postgresql
has comment: http://stackoverflow.com/comment/32932674
type: UnansweredQuestion
tagged with: jdbc
linked to: http://stackoverflow.com/q/21706858
answer count: 0
has body: I managed in the end to reproduce the serialization problem in this SO question to an SSCCE (Shortest Self-Contained Complete Example). I am using the jdbc and java tags although I believe this is not Java or JDBC-specific. So, I am having two tables MASTERTABLE and DETAILTABLE. Rows in DETAILTABLE hang under rows in the MASTERTABLE: CREATE TABLE public.MASTERTABLE(typename VARCHAR, i INTEGER); ALTER TABLE public.MASTERTABLE ADD PRIMARY KEY (typename, i); CREATE TABLE public.DETAILTABLE(typename VARCHAR, i INTEGER, j INTEGER); ALTER TABLE public.DETAILTABLE ADD PRIMARY KEY (typename, i, j); ALTER TABLE public.DETAILTABLE ADD CONSTRAINT detail_2_master FOREIGN KEY (typename, i) REFERENCES public.MASTERTABLE(typename, i); Then I have code (appended in the end) which does the following in an endless loop: inserts a row in the master table with a given typename inserts 100 rows in the detail table under the master table row added in step #1. When I launch the code in two separate instances, running concurrently, with different typename parameters (say one is using type-a and the other type-b) after a few minutes I get the "could not serialize access due to read/write dependencies among transactions" message (trace at the end). What I don't get is why is PostgreSQL confused about the two concurrent transactions since they are obviously accessing different "slices" of the table: One instance is reading and writing rows with a typename value of "type-a" The other instance is reading and writing rows with a typename value "type-b" Furthermore, PostgreSQL knows that the typename is part of the primary key of both master and detail tables so the sets of rows accessed are guaranteed to be disjoint. I append below the code, a typical invocation that causes the error, and the trace thrown. code If the code below is modified to use a transaction isolation level of Connection.TRANSACTION_REPEATABLE_READ instead of Connection.TRANSACTION_SERIALIZABLE the erroneous condition is not …
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32927016
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/32924145
has title: could not serialize access due to read/write dependencies among transactions
downvote count: 0

http://stackoverflow.com/q/21810783
accepted answer: http://stackoverflow.com/a/21810911
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question
has body: I am trying to Understand the difference between Handler &amp; Scheduler What I know:: IN - JAVA(Not Android) Java uses JVM In Java Scheduler takes care of switching the control back and forth between main-thread and the worker-threads It quickly happens and so its called multi-threading. The developer has no access to scheduler and only he can influence the scheduler, JVM takes care of scheduler functionality IN - ANDROID Android uses JVM A scheduler is called a Handler in android Advantage is that developer has access to Handler through which he can control the scheduling of threads My Questions:: Are my explanations correct ? Are both handler and scheduler functionality wise the same ? If my explanations are not correct what are the difference between Handler and scheduler ? Advantages of using handler in android w.r.t Scheduler in Java ? Thanks !
tagged with: scheduler
upvote count: 2
tagged with: handler
answer count: 1
downvote count: 0
favorite count: 0
has title: Difference between handler and Scheduler
has answer: http://stackoverflow.com/a/21810911

http://stackoverflow.com/q/21769224
has title: MySQL JDBC loadbalance and failover
downvote count: 0
has comment: http://stackoverflow.com/comment/32934509
answer count: 1
tagged with: jdbc
has answer: http://stackoverflow.com/a/21773697
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32932645
has comment: http://stackoverflow.com/comment/32932643
score: 2
type: AnsweredQuestion
has body: i am using jdbc:mysql:loadbalance://... in my Java application. jdbc url is like this. jdbc:mysql:loadbalance://xxx.xxx.xxx.xx,yyy.yyy.yyy.yyy.../database?zeroDateTimeBehavior=convertToNull&amp;autoReconnect=true I can get a connection equally from this url when all DB servers are alive and mysqlds are running. Moreover, I can also do this when all DB servers alive(ping reachable) and one mysqld is not running(i.e. mysqld has some problem or crashed) and the others are running. But there is a problem when one of the servers is not alive. For example, i shut down yyy server and attempt to get a connection. Failover mechanism seemed to work correctly and I could get a connection finally. However it took too long(about 75 - 85 seconds). How can i shorten this waiting time?
accepted answer: http://stackoverflow.com/a/21773697
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/32932621

http://stackoverflow.com/a/21732896
has body: Your web.xml contains already contains a DelegatingFilterProxy for the Spring Security chain. You are reregistering another one due to the use of java based configuration (the exception comes from the SpringServletContainerInitializer). Remove the one from your web.xml. Although it is strange as your web.xml specifies that your application is a 2.5 and not a 3.0 servlet api application. So it, according to the spec if I recall correctly, shouldn't even detect those classes.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/32911381
score: 2
has comment: http://stackoverflow.com/comment/32893152
has comment: http://stackoverflow.com/comment/32911097
downvote count: 0
answers question: http://stackoverflow.com/q/21730010

http://stackoverflow.com/comment/41582860
type: QuestionComment
has text: Same problem. In my case I'm looking up a PoolingDataSource, and when the lookup fails I attempt to create a new connection pool. It fails because it has the same name as a pool that exited in the last context (although I can't look it up). I'm using JBoss 7.
comment on: http://stackoverflow.com/q/21827729
score: 0
type: Comment

http://stackoverflow.com/comment/32903694
type: QuestionComment
comment on: http://stackoverflow.com/q/21751830
type: Comment
has text: @MattEckert Confirmed. That's weird.
score: 0

http://stackoverflow.com/q/21767414
has comment: http://stackoverflow.com/comment/32930820
upvote count: 1
has body: Ok, here is the issue. We are using an old version of Tomcat (6.0.35) because our version of linux (ubuntu 12.04) doesn't have a repository with a newer version of it. Unfortunately, there is a bug in 6.0.35 that is affecting us ( https://issues.apache.org/bugzilla/show_bug.cgi?id=53725 ). IT doesn't want to/can't change tomcat versions. They want to use the package management system, they don't want to rebuild tomcat. They can't maintain something like this on a whole bunch of servers and we don't particularly want to disable Gzip. We can deal with the corruption until we can finally upgrade. So with that background, the real question. The changes which fix this bug reside in one single class. We came up with a crazy solution (which will probably never see production, but was more of a "this would be so terrible, lets try it!" sort of idea), How about we compile the fixed version of the class and hotswap it in. After all, tomcat and our project use the same JVM. Is this doable/possible/more than a little crazy? Some hurdles. We are using Java 6. The new class adds methods and fields. I'm not sure that tomcat keeps it around.
tagged with: java
has answer: http://stackoverflow.com/a/21767640
has answer: http://stackoverflow.com/a/21768042
type: Question
answer count: 2
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32929723
has comment: http://stackoverflow.com/comment/32942642
has title: Can I override a class in the classpath?
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21726392
has title: Jersey client creation in a REST service
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32898087
tagged with: design-patterns
has answer: http://stackoverflow.com/a/21732146
score: 1
tagged with: java
upvote count: 1
tagged with: web-services
type: Question
has body: i am creating a http REST service that consumes other http REST services. I am using Jersey Client to call other services and i have many doubt about which creation pattern of the http client is the best. Currently i am using EJB with injection of the client that is a Singleton shared by every methods, but i would like to remove java ee dependency and use Jetty as embedded application server. I see from the doc that Client creation is an expensive operation so i cannot create one every time i need it. I think about creating 1 in the constructor of every Servlet/Rest class is the simpler solution but i am not sure about the lifecycle of the servlet (if an instance is created for every request, this method is quite the same as the previous) Or maybe is better to create a Singleton shared by every Servlet/Rest class Or maybe better a pool of N client. About this last two solution i need some advice... What do you think it's the better solution? Thanks
tagged with: servlets
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/32823808
has text: You can say text.toUpperCase();
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21708412

http://stackoverflow.com/q/21837726
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/33054674
has title: Is there any way to configure hibernate Transactions with only annotations from the Jersey API
tagged with: transactions
tagged with: java
tagged with: hibernate
tagged with: jersey
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33085046
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: I want to use something similar to org.springframework.transaction.annotation.Transactional that configures a Transaction. But I want to use only the Jersey API. I would like to have some code that looks like the following: @Resource private SessionFactory factory; private Class&lt;E&gt; entity; private String tableName; public DataProvider(Class e) { this.entity = e; this.tableName = entity.getAnnotation(Table.class).name(); } @Transactional(readOnly = true) public E get(final Long ID) { return (E)factory.getCurrentSession().get(entity, ID); } @Transactional(readOnly = true) public List&lt;E&gt; getAll() { Session s = factory.getCurrentSession(); return s.createQuery("FROM " + tableName ).list(); } Is it possible?

http://stackoverflow.com/a/21810239
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21809139
answers question: http://stackoverflow.com/q/21809139
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: I think the standard solution for Fibonacci would look like the following: public class Fibonacci { public long fibo(long n){ if(n == 0) return 0; if(n == 1) return 1; else return fibo(n-1) + fibo(n-2); } public static void main(String...args){ int n = 20; Fibonacci f = new Fibonacci(); for(int i = 0; i &lt; n; i++){ System.out.println(f.fibo(i)); } } } In a recursive method you always need a break condition. In the case of this fibonacci method this would be the 0th and 1st fibonacci number as you can recognize above. There is no other way to calculate the fibonacci number recursively. You simply need the break condition. If you don't need the recursive character of your method you can calculate the number via the Binet's formula. For further information about this one click here. EDIT: I change my method. It's now counting up till the nth Fibonacci number.

http://stackoverflow.com/comment/32792035
has text: There is probably nothing wrong with `isMp3`. Please include the compilation error and more details as to where the `isMp3` method is defined.
score: 0
comment on: http://stackoverflow.com/q/21690220
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32839708
has text: @emecas I am using mysql-connector-java version 5.1.18. MySQL version is 5.7 as i intend to use InnoDB Cache plugin that came up with mysql in mysql version 5.7
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21716839

http://stackoverflow.com/comment/32966472
type: Comment
comment on: http://stackoverflow.com/a/21788142
score: 0
type: AnswerComment
has text: `size` isn't a variable, it's a field.

primefaces
tags question: http://stackoverflow.com/q/21681014
tags question: http://stackoverflow.com/q/21753639
tags question: http://stackoverflow.com/q/21823859
tags question: http://stackoverflow.com/q/21689074
tags question: http://stackoverflow.com/q/21793033
tag name: primefaces
tags question: http://stackoverflow.com/q/21761155
tags question: http://stackoverflow.com/q/21793676
tags question: http://stackoverflow.com/q/21785344
tags question: http://stackoverflow.com/q/21831099
type: Tag
tags question: http://stackoverflow.com/q/21782427
tags question: http://stackoverflow.com/q/21779255
tags question: http://stackoverflow.com/q/21681547

http://stackoverflow.com/a/21798614
has comment: http://stackoverflow.com/comment/32984512
has comment: http://stackoverflow.com/comment/32984437
score: 0
has comment: http://stackoverflow.com/comment/32984465
has body: Use Sets: if (ary.length == ary1.length &amp;&amp; new HashSet&lt;&gt;(Arrays.asList(ary)).equals(new HashSet&lt;&gt;(Arrays.asList(ary1))) Test code: String ary[] = { "man", "john", "su" }; String ary1[] = { "john", "man", "su" }; Set&lt;String&gt; set1 = new HashSet&lt;&gt;(Arrays.asList(ary)); Set&lt;String&gt; set2 = new HashSet&lt;&gt;(Arrays.asList(ary1)); System.out.println(ary.length == ary1.length &amp;&amp; set1.equals(set2)); Output: true
answers question: http://stackoverflow.com/q/21798434
type: Answer
has comment: http://stackoverflow.com/comment/32984378
has comment: http://stackoverflow.com/comment/32984464

http://stackoverflow.com/a/21803581
has body: I think Netflix's feign is one of the simplest java http clients out there: https://github.com/Netflix/feign If you don't want to use such libs and just want to build something which works, check this out: HTTP Json requests in Java?
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21803563
upvote count: 2

http://stackoverflow.com/a/21781865
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/32954722
type: AcceptedAnswer
downvote count: 0
has body: I think any class which "extends Fragment implements IMyItem" MUST be ok Any such classes are a valid substitute for the type parameter T, that is where the problem is. Now suppose you have another class: class AnotherFragment extends Fragment implements IMyItem { } And then you call that method like: AnotherFragment anotherFragment = createFragment(); This invocation would pass at compile time. But suppose it compiler allowed you to return new MyPageFragmentImpl(); from your method, the assignment would fail at runtime with a ClassCastException, as a MyPageFragmentImpl is not an AnotherFragment. You must return a result of type T from that method, and the type parameter T will be inferred from the type of reference you are assigning the result to. So, the point is, how would you create an instance of T? You can't directly do that. One possibility is to pass a Class instance to that method, and change the signature to: @Override &lt;T extends Fragment &amp; IMyItem&gt; T createFragment(Class&lt;T&gt; clazz) { return clazz.newInstance(); } Now, whatever instance you want that method to return, just pass a Class instance for that class to this method, like so: MyPageFragmentImpl pageFragment = createFragment(MyPageFragmentImpl.class); In this case, the type parameter T will be inferred as MyPageFragmentImpl, and the assignment like above would be safe now. This might fail if your class doesn't have a 0-arg constructor. For that, you can get the appropriate constructor for the class using Class#getConstructor() method, and then return the instance using Constructor#newInstance() method.
type: Answer
answers question: http://stackoverflow.com/q/21781748
accepted answer of: http://stackoverflow.com/q/21781748

http://stackoverflow.com/a/21830663
has body: Associations in Apache ACE allow you to create many to many relations between artifacts, features, distributions and targets using filter expressions. If you use the Web UI, you create associations whenever you drag and drop between any of the columns. Under the cover, that always creates one to one relationships with filter conditions that are an exact match of the entities involved in the drag and drop. However, as soon as you start using the GoGo shell or REST API, you can create more powerful associations. Each one has a left and right hand side, and for each side you can specify a filter condition. Those filters are almost exactly like the examples you mention. An example (run the server-allinone.bndrun from Eclipse) and in the shell type: w = (cw) To create a workspace to work with, and then: $w cd dist-1 $w ct target-1 $w ct target-2 To create a distribution and two targets. And then create an association: $w cd2t "(name=dist-1)" "(id=target-*)" 1 n This creates an association between a distribution that matches the first expression and targets that match the second one. The left side can match only one entity, the right side can match 'n' (multiple). Finally: $w commit To commit the workspace. If you now log into the Web UI, retrieve the latest version and select 'dist-1' you will see it is associated with both targets. Try adding a third target, also starting with 'target-' and see it is automatically associated as well. Add a fourth target with a different name to confirm that this one is not matched. Filter conditions, like in OSGi, can also be more complex so you can also use attributes (user defined too, if you want) to create way more complex associations.
type: Answer
answers question: http://stackoverflow.com/q/21772299
has comment: http://stackoverflow.com/comment/33041467
accepted answer of: http://stackoverflow.com/q/21772299
upvote count: 2
has comment: http://stackoverflow.com/comment/33043224
has comment: http://stackoverflow.com/comment/33042816
has comment: http://stackoverflow.com/comment/33042948
score: 2
has comment: http://stackoverflow.com/comment/33042881
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33043141

http://stackoverflow.com/comment/32811463
has text: Shouldn't `addresses` be `vadresses` in your Java code?
score: 0
comment on: http://stackoverflow.com/q/21701593
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21719958
upvote count: 1
has title: Why isn't XStream generating xml header
downvote count: 0
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1211624
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32844865
has comment: http://stackoverflow.com/comment/32844768
answer count: 0
score: 1
type: Question
tagged with: xstream
tagged with: java
has body: I'm using XStream to generate xml files of my objects. However, the version and encoding header is being omitted from the xml file, and I'm not sure why. Here is my method that prints out the xml file: public static void personsToXML(ArrayList&lt;Person&gt; persons) throws FileNotFoundException { PrintWriter pw = new PrintWriter(new File("someFilePath")); XStream xstream = new XStream(); for (Person i : persons) pw.print(xstream.toXML(i)); pw.close(); } It outputs the xml just fine, but there is no header present, as in &lt;?xml version="1.0"?&gt; is not present. Thanks!

http://stackoverflow.com/q/21721268
tagged with: java
type: Question
has title: property placeholder in class attribute of a bean
has comment: http://stackoverflow.com/comment/32847584
answer count: 3
has comment: http://stackoverflow.com/comment/32846923
upvote count: 1
has comment: http://stackoverflow.com/comment/32847797
has body: A colleague of mine and I are playing around with the following spring configuration: &lt;beans&gt; &lt;context:property-placeholder location='classpath:/configuration.properties'/&gt; &lt;bean id="myBean" class="${type}" /&gt; &lt;/beans&gt; We want to be able to provide a environment specific implementation of myBean. On a developers system the value of type would be a lightweight implementation of whatever myBean does. And in a production environment we would use a full-blown version. When my colleague runs the code, everything works. When I run the code, I get a ClassNotFoundException, because spring tries to instantiate ${type}.class. And it is not like it sometimes works and sometimes does not. On my machine it always fails and on my colleagues machine it always works. Does anybody knows what the problem is? Thx in advance, Yevgeniy UPDATE as requested, here is how we load the application context: ClassPathXmlApplicationContext("application-configuration.xml"); the content of the properties file is pretty simple: type=foobar.TestServiceImpl
favorite count: 0
has answer: http://stackoverflow.com/a/21722264
has comment: http://stackoverflow.com/comment/32847268
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32847359
tagged with: spring
has answer: http://stackoverflow.com/a/21721476
has answer: http://stackoverflow.com/a/21721456
has comment: http://stackoverflow.com/comment/32847947
downvote count: 0
score: 1

http://stackoverflow.com/comment/33021188
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21819064
has text: It would help to see your web.xml and a code snippet from your Servlet.
score: 0

http://stackoverflow.com/comment/32933587
comment on: http://stackoverflow.com/q/21769196
score: 0
has text: If you get a `NullPointerException` on `con.prepareStatement` it means that `con` is null, which means that there was an error in `Pool.getConnection()`. Show us that stack trace.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/73627371
comment on: http://stackoverflow.com/a/35431416
has text: I fixed it for you :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21814237
downvote count: 0
has title: The APK won't run on the android emulator. (Unfortunately the app has stopped)
favorite count: 0
has comment: http://stackoverflow.com/comment/33012570
has body: I am new to android app development. I wrote an android code for a simple app that on clicking the Add one button, adds 1 to the total in the text field that's supposed to be above the button and on clicking subtract one button, subtracts 1 from the Text field above. Here is the code for it. package com.example.ocrtransbybee; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.*; public class StartingPoint extends Activity { int counter; Button add, sub; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_starting_point); counter = 0; add = (Button) findViewById(R.id.bAdd); sub = (Button) findViewById(R.id.bSub); display = (Button) findViewById(R.id.tvDisplay); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub counter++; display.setText("Your total is " + counter); } }); sub.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.starting_point, menu); return true; } } And the layout xml code is: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".StartingPoint" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hey" android:textSize="50sp" android:layout_gravity="center" android:gravity="center" android:id="@+id/tvDisplay" /&gt; &lt;Button android:layout_width="fill_parent" and…
tagged with: android
possible better answer: http://stackoverflow.com/a/21814323
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21814285
has answer: http://stackoverflow.com/a/21814323
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33012607
type: Question
has comment: http://stackoverflow.com/comment/33012942
has comment: http://stackoverflow.com/comment/33012588
accepted answer: http://stackoverflow.com/a/21814285
has answer: http://stackoverflow.com/a/21814325
answer count: 3

http://stackoverflow.com/comment/32839134
type: QuestionComment
has text: ohh, I guess the text is getting set in the right matter. but i want the whole textview to start from right to left, instead of left to right.
comment on: http://stackoverflow.com/q/21716499
score: 0
type: Comment

http://stackoverflow.com/q/21716943
tagged with: java
type: Question
tagged with: intellij-idea
tagged with: jar
tagged with: export
score: 0
has comment: http://stackoverflow.com/comment/32839832
answer count: 1
has title: How to have IntelliJ automatically overwrite files when exporting jar
has answer: http://stackoverflow.com/a/21719492
tagged with: overwrite
has body: In eclipse it does it anyway when exporting jars, and will only give a warning unless you tell it not to. However in IntelliJ, it refuses to delete the file when building a new version, and I have to go through and manually delete the jar myself for IntelliJ to export properly. Is there a way I force IntelliJ to overwrite jars when it exports?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32839929

http://stackoverflow.com/q/21716802
tagged with: java
has body: class Quadrilateral { private Point TL; private Point TR; private Point BR; private Point BL; public Quadrilateral(Point p1, Point p2, Point p3, Point p4) { TL = p1; TR = p2; BR = p3; BL = p4; } } class Point { public double x; public double y; Point(double a, double b) { x = a; y = b; } } class trapezoid extends Quadrilateral { public trapezoid(Point p1, Point p2, Point p3, Point p4) { super(p1,p2,p3,p4); } public double areaofTrapezoid() { return ((((TR.x-TL.x)+(BR.x-BL.x))/2)*(TL.y-BL.y)); } } I am trying to access the x and y values in TR,TL,BR and BL, but i do not wanna make functions like getxofTL, getyofTL, getxofBR...etc in class quadrilateral. how else can i access those value in my subclass without changing the access specifier for the variables.
type: Question
has answer: http://stackoverflow.com/a/21716836
has title: Inheritance on private members
tagged with: inheritance
upvote count: 2
answer count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/32839467
favorite count: 0
has comment: http://stackoverflow.com/comment/32839443
has comment: http://stackoverflow.com/comment/32839551
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32839476
has answer: http://stackoverflow.com/a/21716824
has comment: http://stackoverflow.com/comment/32839451
score: 1

http://stackoverflow.com/comment/32987925
has text: you put it where .java files are. you generally don't put anything where .class files are because that is done by compiler. if you have java class in org/someorg/app/AwesomeClass.java you should put mypdf.pdf in org/someorg/app directory and then call above code from AwesomeClass
comment on: http://stackoverflow.com/a/21799343
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33021215
type: QuestionComment
has text: Is the web.xml deployed to the correct location? Does it have any errors repotered at startup?
score: 1
comment on: http://stackoverflow.com/q/21819064
type: Comment

http://stackoverflow.com/comment/33050493
type: Comment
has text: I added the product file in my newest edit.
comment on: http://stackoverflow.com/q/21834222
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32843368
comment on: http://stackoverflow.com/a/21718891
has text: adding static to the method, variable queue and making synchronized(crawler.class) solved the problem. thanks all!!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21749626
has answer: http://stackoverflow.com/a/21782134
answer count: 3
has comment: http://stackoverflow.com/comment/32936440
downvote count: 0
has body: I am using a java application to control my notes client to send email. some code: session = NotesFactory.createSession(); db = session.getDatabase("mail01/xxx", "aaa.nsf"); "mail01/xxx" is remote server name. the code is right? I am not sure. but I got error: NotesException: Database open failed (%1) at lotus.domino.local.Database.Nopen(Native Method) at lotus.domino.local.Database.open(Unknown Source) at test.TestLocal.runNotes(TestLocal.java:67) at lotus.domino.NotesThread.run(Unknown Source) I have configured path and classpath. And I have installed notes client on my computer. This is my problem. Thanks!
has answer: http://stackoverflow.com/a/54766705
score: 1
has answer: http://stackoverflow.com/a/21762851
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32898904
has comment: http://stackoverflow.com/comment/85230945
has comment: http://stackoverflow.com/comment/32955802
has comment: http://stackoverflow.com/comment/32932418
has comment: http://stackoverflow.com/comment/33021668
has comment: http://stackoverflow.com/comment/32899166
tagged with: lotus-domino
upvote count: 1
has comment: http://stackoverflow.com/comment/32937365
type: Question
has comment: http://stackoverflow.com/comment/32898557
tagged with: java
has comment: http://stackoverflow.com/comment/32901670
has title: Database open failed while useing notes API
has comment: http://stackoverflow.com/comment/32900451

http://stackoverflow.com/comment/79591003
comment on: http://stackoverflow.com/a/21743399
type: Comment
has text: It is not working for me. Could you please let me know is there any other option
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32934558
comment on: http://stackoverflow.com/a/21769843
type: Comment
type: AnswerComment
has text: I change: ImageIO.write(tempImg, "jpg", storeFile); //item.write(tempImg);
score: 0

http://stackoverflow.com/comment/32839733
type: Comment
has text: Then you can pass a variable containing the user input
comment on: http://stackoverflow.com/a/21713930
type: AnswerComment
score: 0

http://stackoverflow.com/a/21683609
upvote count: 1
has body: The JDK documentation reasonably tells you how to do this, but it does involve jumping through some hoops, so here's some sample code to get you started. If you're going to be doing this a lot you probably want to wrap it up in some utility classes to drastically simplify this. NOTE: I'm not sure this code is perfect, but it gives you all the correct things to google. Best of luck! MessageFactory messageFactory = MessageFactory.newInstance(); TransformerFactory transformerFactory = TransformerFactory.newInstance(); SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance(); Document document = null; // load your document from somewhere // make your request message SOAPMessage requestMessage = messageFactory.createMessage(); /// copy your message into the soap message Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(document); DOMResult result = new DOMResult(requestMessage.getSOAPBody()); transformer.transform(source, result); requestMessage.saveChanges(); // make the SOAP call URL endpoint = new URL("http://example.com/endpoint"); SOAPConnection connection = sfc.createConnection(); SOAPMessage responseMessage = connection.call(requestMessage, endpoint); // do something with the response message ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); responseMessage.writeTo(outputStream); System.out.println(new String(outputStream.toByteArray()));
score: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21683284
answers question: http://stackoverflow.com/q/21683284
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/32995772
has text: Look at [`CardLayout`](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html)
type: QuestionComment
comment on: http://stackoverflow.com/q/21804676
score: 0
type: Comment

http://stackoverflow.com/q/21683298
possible better answer: http://stackoverflow.com/a/21683353
type: Question
has body: How do I tell eclipse on my desktop to open projects that are saved on my laptop without importing the project? I want to be able to save on one machine and pick up where I left off on the other. Thanks.
has answer: http://stackoverflow.com/a/21683369
tagged with: java
has answer: http://stackoverflow.com/a/21683508
has title: Where does Eclipse store projects / packages etc?
tagged with: eclipse
has answer: http://stackoverflow.com/a/21683489
score: 3
downvote count: 0
answer count: 7
favorite count: 0
accepted answer: http://stackoverflow.com/a/21683369
has answer: http://stackoverflow.com/a/21683492
has answer: http://stackoverflow.com/a/21683353
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/28779010
has answer: http://stackoverflow.com/a/21683471

http://stackoverflow.com/comment/32866235
type: QuestionComment
has text: posted..needs something else?
comment on: http://stackoverflow.com/q/21732164
score: 0
type: Comment

http://stackoverflow.com/comment/32953230
type: AnswerComment
comment on: http://stackoverflow.com/a/21781054
type: Comment
score: 1
has text: No, R.java references things in the res folder, activity_main being on of them, it builds automatically based on what is in the res folders. What you imported was android.R. This is for some of android default references such as their defaults icons and text. It was trying to look for activity_main in there when it is not there. Please mark an answer as correct if it worked.

http://stackoverflow.com/q/21838348
upvote count: 3
type: UnansweredQuestion
tagged with: intercept
tagged with: java
has body: What is the best way to do this? I tried to use a ServerSocket and change my proxy setting port to send all traffic to my Java program. Well, it connects but I can't seem to read the request with clientSocket.readLine(). I don't want to know how to make my code work though, which is why I won't post the code. I want to know what the best way would be to intercept the HTTP request for reading. I'm guessing I will take an approach changing the proxy port to redirect traffic to my app (Like programs like Burp Suite and WebScarab do). So in other words, can someone give me an example or pseudo code on how Burp Suite/WebScarab would read HTTP requests just by changing the proxy port?
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/33055208
score: 3
has comment: http://stackoverflow.com/comment/49847821
has title: Java Intercept HTTP Request
answer count: 1
downvote count: 0
favorite count: 0
tagged with: proxy
has comment: http://stackoverflow.com/comment/33059828
has answer: http://stackoverflow.com/a/32652422
tagged with: readline
has comment: http://stackoverflow.com/comment/33055322
has comment: http://stackoverflow.com/comment/33055144

http://stackoverflow.com/comment/32813072
type: AnswerComment
has text: @user1884155 ... https://git-wip-us.apache.org/repos/asf/struts/repo?p=struts.git;a=blob;f=core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java;h=df45347b0f9d452f1430fe69b9e6174b71a3a906;hb=HEAD
comment on: http://stackoverflow.com/a/21702509
type: Comment
score: 0

http://stackoverflow.com/comment/32943730
has text: @Funtik equals() and hashCode() of Set are specified to have a behavior that makes overriding them unnecessary in this case: Two sets are equal if they have the same size and contain the same elements (regardless of the order) EDIT: Kayaman: +1 for that - it was already the correct answer!
type: Comment
comment on: http://stackoverflow.com/a/21774467
score: 0
type: AnswerComment

http://stackoverflow.com/q/21759078
has comment: http://stackoverflow.com/comment/32913812
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/21759156
favorite count: 0
has title: Saving sharedPreference file
tagged with: android
has body: I successfully saved preferences in SharedPreferences. How can I save the preference file in sdcard and vice-versa ??? {I want to give option to the user to backup, so that he can save and load preferences across re-intallations}
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32913752
has comment: http://stackoverflow.com/comment/32914349
has comment: http://stackoverflow.com/comment/32913670
downvote count: 0
score: 1
tagged with: java
tagged with: sharedpreferences
type: Question
possible better answer: http://stackoverflow.com/a/22117468
has answer: http://stackoverflow.com/a/22117468
has comment: http://stackoverflow.com/comment/32914376
accepted answer: http://stackoverflow.com/a/21759156

http://stackoverflow.com/comment/32942323
type: Comment
comment on: http://stackoverflow.com/a/21746500
has text: Let me clarify this, Are u creating a seperate "scr/main/java folder or are you adding "/main/java" to the existing src folder?
type: AnswerComment
score: 0

http://stackoverflow.com/q/21804848
answer count: 1
has answer: http://stackoverflow.com/a/21804880
accepted answer: http://stackoverflow.com/a/21804880
upvote count: 1
tagged with: junit
favorite count: 0
has body: I am working through the below tutorial: http://docs.spring.io/docs/Spring-MVC-step-by-step/part4.html I am trying to test the validate method in the class below: public class PriceIncreaseValidator implements Validator { public void validate(Object obj, Errors errors) { PriceIncrease pi = (PriceIncrease) obj; if (pi == null) { errors.rejectValue("percentage", "error.not-specified", null, "Value required."); } ........ } Below is my JUnit test case: private PriceIncreaseValidator priceIncreaseValidator; private PriceIncrease priceIncrease; private Errors errors; public void testEmptyPriceIncrease() { priceIncreaseValidator.validate(priceIncrease, errors); // This is where I get NPE assertTrue(errors.hasErrors()); } So I get the NPE when invoking the validate method in my JUnit test case. The test and class all compiles fine. I have tried converting priceIncrease into an object as per below, but still no luck: Object obj = priceIncrease; //validate priceIncreaseValidator.validate(obj, errors); Any ideas? As you can see I am trying to test that if no price increase has been set, that an error is returned when calling validate.
tagged with: spring
has title: JUnit test failing with NPE when testing validator method
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/32822850
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21707840
has text: You should compare the data in the object references as well to stand that they are, in fact, equals.
score: 0

http://stackoverflow.com/q/21703458
answer count: 1
has answer: http://stackoverflow.com/a/21705420
linked to: http://stackoverflow.com/q/6641962
has comment: http://stackoverflow.com/comment/32817434
type: UnansweredQuestion
tagged with: input
has body: i created this robot: try { // Create class Robot robot = new Robot(); // Wait 2 sec robot.delay(2000); // Get mouse on "texteditor"-symbol robot.mouseMove(920, 840); // Press it robot.mousePress( InputEvent.BUTTON1_MASK ); robot.delay( 100 ); robot.mouseRelease( InputEvent.BUTTON1_MASK ); // Wait 2 sec robot.delay( 2000 ); // Write "Hello" in "texteditor" robot.keyPress(KeyEvent.VK_H); robot.delay( 1000 ); robot.keyPress(KeyEvent.VK_E); robot.delay( 1000 ); robot.keyPress(KeyEvent.VK_L); robot.delay( 1000 ); robot.keyPress(KeyEvent.VK_L); robot.delay( 1000 ); robot.keyPress(KeyEvent.VK_O); } catch (AWTException e) { e.printStackTrace(); } ok what happens, when i launch programm? : Robot waits 2 sec. => good Mouse is moved on texteditor-symbol => good It is pressed => texteditor opens => good Robot wait´s 2 sec => good Robot writes "l" in the texteditor, the rest of the word can be found in the source code of the robot => not good ! Any advices what i did wrong or how i could do this? greetings and thanks!!
type: Question
duplicate of: http://stackoverflow.com/q/6641962
tagged with: java
score: 0
has title: Java => robot execute´s false order

http://stackoverflow.com/q/21683347
has comment: http://stackoverflow.com/comment/32779374
has comment: http://stackoverflow.com/comment/32792969
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32779529
tagged with: swing
downvote count: 1
tagged with: jbutton
tagged with: java
has answer: http://stackoverflow.com/a/21683684
score: -1
type: Question
linked to: http://stackoverflow.com/q/21676920
has body: I need to have 1.the JButton open the JTable in the Journal class 2.transfer the ints in the JTextFields to the variables a and b in the Journal Class I used netbeans to create the Main class and my own methods to create the table class please help! Thanks! This is the part of the Main class Netbeans tells me to edit when I right click > Events > Action > Action Performed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int data1 = Integer.parseInt(jTextField1.getText()); int data2 = Integer.parseInt(jTextField2.getText()); } Here is my Code: package Components; /** * * @author dustinpx2014 */ import java.awt.*; import java.util.*; import javax.swing.*; import javax.swing.table.*; public class Journal extends JPanel { private JTable table; private int a;//Number of Students private int b;// Length of Trip public Journal() { String colN1 = "Date"; String colN2 = "Student"; int c = a*2/b; // Determining # of Journals int col = c*2; // Creating two columns for every journal(Day and Student) String[] columnNames = new String[col]; //For Loop: inserting column names for(int colF = 0; colF &lt; col; colF++) { if(colF%2 == 0) { columnNames[colF] = colN1; } else { columnNames[colF] = colN2; } } int row = b; //row = number of days int d = 1; //day number int s = 1; //student number int x = 0; //counter for the # of times students write int z = 1; // student number(no limit) int z1 = a/2; // student number 2 int x1 = 0; // counter for the # of times students write 2 int x2 = 0; int w = 1; Object[][] data = new Object[row][col]; for (int col1 = 0; col1 &lt; data[0].length; col1++) { for (int row1 = 0; row1&lt;data.length; row1++)//goes through the table by column { if(d &gt; b) //reseting the date { d = 1; } if(s &gt; a &amp;&amp; x &lt;= 2) //reseting student number and adds count { s = 1; x++; } if(z &gt; a) { z = 1; } if(z1 &gt; a &amp;&amp; x1 &lt;= 2) { z1 = 1; x1++; } if (w&gt;a) { w++; } if(col1%2 == 0) //inserts the day { data[row1][col1]= "Day " …
upvote count: 0
tagged with: jpanel
has title: How do you use JButton to open a new JPanel + Transfer integer variables to the JPanel?
duplicate of: http://stackoverflow.com/q/21676920
answer count: 1

http://stackoverflow.com/q/21709410
has answer: http://stackoverflow.com/a/21715565
has title: How can I get eclipse and the ecj java genetics system to work together nicely?
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/21710106
type: Question
score: 0
answer count: 2
has body: Note: this post is not about the eclipse compiler for java created by eclipse -- just to make sure there's no confusion. I'm trying to get the ecj genetics programming system to build on eclipse kepler on windows. ecj can be found here: http://cs.gmu.edu/~eclab/projects/ecj/ The file structure has a base folder ec. It has import references to it, like this one from tutorials1 (MaxOnes.java) found in the ec.app.tutorials1 folder. package ec.app.tutorial1; import ec.*; import ec.simple.*; import ec.vector.*; I've built a new project called ecj using, Use project folder as root for source and class files when creating the project, and added ec as a folder under that to store everything. The imports give an error of, the import ec cannot be resolved and that the package does not match. Eclipse recommends a fix to create a project folder called ec, but there already is one at ecj.ec :/ Removing ec. package app.tutorial1; import ec.*; &lt;--- ??? import simple.*; import vector.*; fixes the reference issue for imports (as if the project is referenced to ec already) but does not find a java file in the ec.simple folder which should have been imported. I'm sure this is just a simple setup issue that I've just never come across before. I've also tried created a project called ec with the same issues. The ecj codebase is designed for a unix environment with a normal java hierarchy. On linux I would set the CLASSPATH to resolve these issues, but have never had to deal with this issue in eclipse. What I want to do is to get the tutorials and other code to compile as written for unix, so no special projects or file location swaps. Apparently Robert Baruch's YouTube videos explained all this, but they're gone from YouTube. I'm waiting for a reply on the ecj mail list and will update here when I get an answer. This post then can serve as a reference to help others when they can't find an answer to set up ecj genetics on eclipse, in case Baruch's YouTube videos go missing again.
type: UnansweredQuestion
tagged with: genetic-algorithm

http://stackoverflow.com/q/21799761
score: 0
has body: String[] columns = {"nume", "compozitie", "indicatii", "contraindicatii", "administrare", "pret", "compensabil"}; Object[][] data = null; try { File file = new File("medicamente.txt"); FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); BufferedReader reader = new BufferedReader(new FileReader("medicamente.txt")); int lines = 0; while (reader.readLine() != null) { lines++; } reader.close(); data = new Object[lines][]; String line; int numLines = 0; while ((line = bufferedReader.readLine()) != null) { data[numLines] = line.split(","); numLines++; } fileReader.close(); } catch (IOException e) { e.printStackTrace(); } final DefaultTableModel model = new DefaultTableModel(data, columns) { @Override public Class getColumnClass(int column) { Class returnValue; if ((column &gt;= 0) &amp;&amp; (column &lt; getColumnCount())) { returnValue = getValueAt(0, column).getClass(); } else { returnValue = Object.class; } return returnValue; } }; JTable table = new JTable(model) { public boolean isCellEditable(int row, int column) { switch (column) { case 5: return true; default: return false; } } }; final TableRowSorter&lt;TableModel&gt; sorter = new TableRowSorter&lt;TableModel&gt;(model); table.setRowSorter(sorter); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setPreferredSize(new Dimension(1000, 500)); mainPanel.add(scrollPane); scrollPane.setBounds(0, 240, 995, 510); as you can see i made one of the columns editable, the others are not. I read somewhere that the only solution is to clear the text file and than load the modified JTable in the text file. what would be the best option here ?
answer count: 1
has title: I have a text file loaded in a JTable, i want that the changes i make in the JTable to be made in in the text file as well, how can i do that?
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/21799935
tagged with: java
type: Question
tagged with: jtable

http://stackoverflow.com/comment/32960071
comment on: http://stackoverflow.com/a/21785105
type: AnswerComment
type: Comment
score: 1
has text: quoted from the question **I need for test 10 threads writing to the same hash (really not a hash but very similar thing i need to prove it synchronization for write**. He's not using a java HashMap.

multithreading
tags question: http://stackoverflow.com/q/21828275
tags question: http://stackoverflow.com/q/21791102
tags question: http://stackoverflow.com/q/21716232
tags question: http://stackoverflow.com/q/21788676
tags question: http://stackoverflow.com/q/21727235
tags question: http://stackoverflow.com/q/21744848
tags question: http://stackoverflow.com/q/21817373
tags question: http://stackoverflow.com/q/21724101
type: Tag
tags question: http://stackoverflow.com/q/21835101
tags question: http://stackoverflow.com/q/21737549
tags question: http://stackoverflow.com/q/21800550
tags question: http://stackoverflow.com/q/21711435
tags question: http://stackoverflow.com/q/21683171
tags question: http://stackoverflow.com/q/21826369
tags question: http://stackoverflow.com/q/21776495
tags question: http://stackoverflow.com/q/21835453
tags question: http://stackoverflow.com/q/21777067
tags question: http://stackoverflow.com/q/21764152
tags question: http://stackoverflow.com/q/21691638
tags question: http://stackoverflow.com/q/21832206
tags question: http://stackoverflow.com/q/21689174
tags question: http://stackoverflow.com/q/21718042
tags question: http://stackoverflow.com/q/21718692
tags question: http://stackoverflow.com/q/21733548
tags question: http://stackoverflow.com/q/21721401
tags question: http://stackoverflow.com/q/21813516
tags question: http://stackoverflow.com/q/21699128
tags question: http://stackoverflow.com/q/21787413
tags question: http://stackoverflow.com/q/21767945
tags question: http://stackoverflow.com/q/21735487
tags question: http://stackoverflow.com/q/21815848
tags question: http://stackoverflow.com/q/21840094
tags question: http://stackoverflow.com/q/21786548
tags question: http://stackoverflow.com/q/21785925
tags question: http://stackoverflow.com/q/21731560
tags question: http://stackoverflow.com/q/21821988
tags question: http://stackoverflow.com/q/21699227
tags question: http://stackoverflow.com/q/21779296
tags question: http://stackoverflow.com/q/21791058
tags question: http://stackoverflow.com/q/21744510
tags question: http://stackoverflow.com/q/21771809
tags question: http://stackoverflow.com/q/21819964
tags question: http://stackoverflow.com/q/21760962
tags question: http://stackoverflow.com/q/21729187
tags question: http://stackoverflow.com/q/21714886
tags question: http://stackoverflow.com/q/21763604
tags question: http://stackoverflow.com/q/21840929
tags question: http://stackoverflow.com/q/21743974
tags question: http://stackoverflow.com/q/21759404
tags question: http://stackoverflow.com/q/21792517
tags question: http://stackoverflow.com/q/21836211
tags question: http://stackoverflow.com/q/21703970
tags question: http://stackoverflow.com/q/21730620
tags question: http://stackoverflow.com/q/21679486
tags question: http://stackoverflow.com/q/21789964
tags question: http://stackoverflow.com/q/21815262
tags question: http://stackoverflow.com/q/21816244
tags question: http://stackoverflow.com/q/21717130
tags question: http://stackoverflow.com/q/21829921
tags question: http://stackoverflow.com/q/21725410
tags question: http://stackoverflow.com/q/21779327
tags question: http://stackoverflow.com/q/21737726
tags question: http://stackoverflow.com/q/21815690
tags question: http://stackoverflow.com/q/21752747
tags question: http://stackoverflow.com/q/21697737
tags question: http://stackoverflow.com/q/21678686
tags question: http://stackoverflow.com/q/21798687
tags question: http://stackoverflow.com/q/21744412
tags question: http://stackoverflow.com/q/21803545
tags question: http://stackoverflow.com/q/21759451
tags question: http://stackoverflow.com/q/21772414
tags question: http://stackoverflow.com/q/21792741
tags question: http://stackoverflow.com/q/21770394
tags question: http://stackoverflow.com/q/21680737
tags question: http://stackoverflow.com/q/21743486
tags question: http://stackoverflow.com/q/21770288
tags question: http://stackoverflow.com/q/21812995
tags question: http://stackoverflow.com/q/21777892
tags question: http://stackoverflow.com/q/21746522

http://stackoverflow.com/q/21812276
has comment: http://stackoverflow.com/comment/33008979
has comment: http://stackoverflow.com/comment/33009232
has body: hi sir i am confused about my program in terms how can i locate and size my JList and etc. i am using now FlowLayout(); but i cant resize and locate the JList and etc here is my code so far . anybody who suggest public static void main(String args []) { brie t1 = new brie(); t1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); t1.setSize(300,200); t1.setVisible(true); t1.setLocationRelativeTo(null); t1.setResizable(false); } String namep [] = {"Chocolate", "Cake", "Candy", "Ice Cream", "Snacks"}; int pricep [] = {1, 2, 3, 4, 5}; JPanel panel2 = new JPanel(); JLabel l = new JLabel("Enter your payment"); JTextField f = new JTextField(15); JButton tru = new JButton("Yes"); JFrame w = new JFrame("pay"); JList lst = new JList(namep); JLabel l2 = new JLabel("Enter Quantity"); JTextField t1 = new JTextField(10); JLabel l3 = new JLabel(); JButton b2 = new JButton("Exit"); JButton b1 = new JButton("Compute"); double tet; Container cong = getContentPane(); String namep1,totallist; double otpc; int paym,tot = 0; int quan,pricep1; int x,grandtotal,change; public brie(){ totallist = ""; namep1 = ""; // t1.setEditable(false); t1.setText(""); cong.setLayout(new FlowLayout()); new JScrollPane(lst).setSize(30,30); cong.add(new JScrollPane(lst)); cong.add(l2); cong.add(t1); cong.add(b1); cong.add(b2); cong.add(l3); b1.addActionListener(this); b2.addActionListener(this); tru.addActionListener(this); lst.setSelectedIndex(0); lst.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lst.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { t1.setEditable(true); x = lst.getSelectedIndex(); } });
has comment: http://stackoverflow.com/comment/33009015
has comment: http://stackoverflow.com/comment/33009090
has comment: http://stackoverflow.com/comment/33009056
score: 0
tagged with: java
answer count: 0
type: UnansweredQuestion
has title: location and size of jlist
tagged with: user-interface
type: Question

http://stackoverflow.com/comment/32917468
has text: Imagine you have a method just like searchstudent but called searchAndEditStudent... What do you want to edit? Every field?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21757158

http://stackoverflow.com/q/21818694
downvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/21819072
has answer: http://stackoverflow.com/a/21818834
tagged with: launcher
linked to: http://stackoverflow.com/q/3906984
favorite count: 0
score: 0
has title: Java - Downloader, Launcher and Updater
has body: I am making a very simple Java game using Pure Java! The game part is coming along very well. I have some people who are playing the game to test it for me. When ever there is an update I send them an email to download it. The whole game is just one jar file that you run straight off your desktop. This means that you are downloading the whole game in one file which takes quite a bit of time and that is not the first impression that I would like to give. And this brings me to my first question which is how to make a downloader! I want the player to download a Jar that is small in size and then run that to download a bigger Jar (That holds the game) in there appdata. From there I want the player to be able to run the Jar that they used to download the file and it will bring up a launcher. From the launcher they will be able to press the start game button and it will run the Game or the other Jar in the players appdata. I also want the player to be able to hit a button that will check for an update online and if there is one download the Jar and put it into the players appdata. A Quick Summary: How do I make a jar that will download another jar How do I make a button that will run another jar How do I make a button that will check for updates and install them I use net beans to make my softwares! Thanks For The Help!
tagged with: download
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/4033555
type: Question
upvote count: 2

http://stackoverflow.com/comment/32864347
score: 0
type: AnswerComment
has text: After this, you need to give authorizations/permissions to put messages to the queue. You can use setmqaut or the new AUTHREC commands from MQSC console (runmqsc) or the explorer.
comment on: http://stackoverflow.com/a/21729758
type: Comment

http://stackoverflow.com/comment/32853275
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21725136
has text: Thanks Boris please see my edit, more than one comp_id is possible.

http://stackoverflow.com/a/21757778
upvote count: 2
answers question: http://stackoverflow.com/q/21757562
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33033164
downvote count: 0
has body: The best way to do this str.matches("^[A-Da-d].+");
has comment: http://stackoverflow.com/comment/32912214

http://stackoverflow.com/comment/33004019
comment on: http://stackoverflow.com/a/21806929
type: Comment
has text: Thanks, may i ask what "val" does? Also was i anywhere near having it work before you helped me?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32956790
type: QuestionComment
has text: @Softey check the update on my answer where I tried to cover all the stuff JBNizet talks about. Also, there's another Q/A about all this at the bottom line.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21782789

http://stackoverflow.com/q/21685353
type: Question
has title: How to find the exact version of a maven dependency programmatically when version is inherited?
tagged with: maven-dependency-plugin
score: 0
answer count: 1
tagged with: pom.xml
has answer: http://stackoverflow.com/a/21687476
type: UnansweredQuestion
tagged with: maven
tagged with: parent-pom
tagged with: java
has body: I have a maven project where many of the version of child pom's dependencies are listed under tag of the parent pom. This pom tree can have any depth. My problem is, when a pom.xml is given how can I resolve the exact(inherited) version of it's dependencies using java? The desired output is what is given when we run mvn dependency:resolve -DincludeTransitive=false on a pom.xml file For an example, let's say parent pom has following dependencies defined in it under group-a artifact-a 1.0 group-a artifact-b 1.0 bar runtime and child pom.xml has following dependencies group-a artifact-a group-a artifact-b How can i retrieve the versions of group-a:artifact-a and group-b:artifact-b using Java programmatically? Thanks.

http://stackoverflow.com/q/21771808
tagged with: torque
favorite count: 0
has title: How to check the fate of a qsub job
upvote count: 2
type: UnansweredQuestion
has body: I've run a qsub job (.jar file) on a torque cluster and seen it complete. However the output is not what was expected. How can I view any error messages that were thrown by this .jar file (I would see them locally through terminal - i want to see this type of message to diagnose the issue). Error messages such as a RuntimeException or a particular System.out.println or System.out.err
score: 2
tagged with: qsub
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21787746
answer count: 1
downvote count: 0
tagged with: pbs
tagged with: ubuntu

http://stackoverflow.com/comment/32874694
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21736971
type: QuestionComment
has text: Make it static the getString method

http://stackoverflow.com/q/21690030
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32792644
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21690281
favorite count: 0
has title: Unable to instantiate activity Android
has comment: http://stackoverflow.com/comment/32792084
has body: Hello I am just getting started in Android. Help please, read all posts about this, nothing cant help. Tried all combinations naming activities in manifest. This app showing lifecycle of the app. Log 02-11 01:07:36.538: W/dalvikvm(20921): threadid=1: thread exiting with uncaught exception (group=0x40ab6228) 02-11 01:07:36.558: E/AndroidRuntime(20921): FATAL EXCEPTION: main 02-11 01:07:36.558: E/AndroidRuntime(20921): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.lab1/com.example.lab1.MainActivity}: java.lang.NullPointerException 02-11 01:07:36.558: E/AndroidRuntime(20921): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 02-11 01:07:36.558: E/AndroidRuntime(20921): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2240) 02-11 01:07:36.558: E/AndroidRuntime(20921): at android.app.ActivityThread.access$600(ActivityThread.java:139) 02-11 01:07:36.558: E/AndroidRuntime(20921): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262) 02-11 01:07:36.558: E/AndroidRuntime(20921): at android.os.Handler.dispatchMessage(Handler.java:99) 02-11 01:07:36.558: E/AndroidRuntime(20921): at android.os.Looper.loop(Looper.java:156) 02-11 01:07:36.558: E/AndroidRuntime(20921): at android.app.ActivityThread.main(ActivityThread.java:4977) 02-11 01:07:36.558: E/AndroidRuntime(20921): at java.lang.reflect.Method.invokeNative(Native Method) 02-11 01:07:36.558: E/AndroidRuntime(20921): at java.lang.reflect.Method.invoke(Method.java:511) 02-11 01:07:36.558: E/AndroidRuntime(20921): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 02-11 01:07:36.558: E/AndroidRuntime(20921): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 02-11 01:07:36.558: E/AndroidRuntime(20921): at dalvik.system.NativeStart.main(Native Method) 02-11 01:07:36.558: E/AndroidRuntime(20921): Caused by: java.lang.NullPointerException 02-11 01:07:36.558: E/AndroidRuntime(20921)…
tagged with: android
tagged with: android-activity
type: AnsweredQuestion
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21690281
tagged with: java

http://stackoverflow.com/comment/33021763
comment on: http://stackoverflow.com/a/21819396
score: 0
type: AnswerComment
has text: so basically, this code creates an instance variable of type string instead of instance variable of type private?
type: Comment

http://stackoverflow.com/q/21723663
has comment: http://stackoverflow.com/comment/33184693
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33208569
has comment: http://stackoverflow.com/comment/33169923
has comment: http://stackoverflow.com/comment/33106973
type: UnansweredQuestion
answer count: 0
tagged with: java
has body: I'm aware that Spring AOP is limited to certain numbers of pointcut designators. Is there a way out to achieve withincode? Right now I'm inspecting the stacktrace to to check where it was called. Is there a more decent/cleaner way?
upvote count: 1
has title: How to Achieve AspectJ "withincode" in Spring AOP
type: Question
linked to: http://stackoverflow.com/q/6500399
tagged with: spring-aop
tagged with: aspectj

http://stackoverflow.com/q/21698781
has comment: http://stackoverflow.com/comment/32809302
has answer: http://stackoverflow.com/a/21702427
type: Question
has comment: http://stackoverflow.com/comment/32806929
has title: Passing PageParameters From WicketPanel
tagged with: image
has answer: http://stackoverflow.com/a/21699181
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21763363
tagged with: mount
tagged with: panel
tagged with: wicket
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21763363
has body: How could I use PageParameters on a Wicketpanel? I'm willing to load images from filesystem on a WicketPanel, and I found a tutorial for that, but they are using a Page, and in my case, I want to mount the images on a Panel. What should I change in this class or do I HAVE to implement a PageClass for this usecase? http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ https://github.com/martin-g/blogs/blob/master/request-mappers/src/main/java/com/wicketinaction/requestmappers/resources/images/ImageResourcesPage.java public class ImageResourcesPage extends WebPage { /** * The image names for which dynamic images will be generated */ private static final String[] IMAGE_NAMES = new String[] {"one", "two", "three"}; public ImageResourcesPage(final PageParameters parameters) { super(parameters); final ResourceReference imagesResourceReference = new ImageResourceReference(); final PageParameters imageParameters = new PageParameters(); ListView&lt;String&gt; listView = new ListView&lt;String&gt;("list", Arrays.asList(IMAGE_NAMES)) { @Override protected void populateItem(ListItem&lt;String&gt; item) { String imageName = item.getModelObject(); imageParameters.set("name", imageName); // generates nice looking url (the mounted one) to the current image CharSequence urlForWordAsImage = getRequestCycle().urlFor(imagesResourceReference, imageParameters); ExternalLink link = new ExternalLink("link", urlForWordAsImage.toString()); link.setBody(Model.of(imageName)); item.add(link); } }; add(listView); } } Thanks
possible better answer: http://stackoverflow.com/a/21702427

http://stackoverflow.com/a/21821957
has body: From Customizing Formats ¤ currency sign; replaced by currency symbol; if doubled, replaced by international currency symbol; if present in a pattern, the monetary decimal separator is used instead of the decimal separator So: decimalFormatSymbols.setMonetaryDecimalSeparator(','); Will do it.
upvote count: 3
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21821057
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21821057

http://stackoverflow.com/comment/33032189
comment on: http://stackoverflow.com/a/21821398
type: AnswerComment
has text: I put the veriable sliderUnitVal, for time. But then method is not workin properly. But I put the exact value, then it works properly
score: 0
type: Comment

http://stackoverflow.com/comment/32956250
score: 0
type: Comment
type: QuestionComment
has text: @Eric I would ;-) but I have still not found whether leap seconds are captured by the time zone data ...
comment on: http://stackoverflow.com/q/21782785

http://stackoverflow.com/comment/32870681
comment on: http://stackoverflow.com/a/21733584
score: 0
type: AnswerComment
has text: Very strange... try downloading this audio file: http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Samples/SoundCardAttrition/stereol.wav. The conversion of this file definitely works on my computer.
type: Comment

http://stackoverflow.com/q/21709160
type: UnansweredQuestion
tagged with: model-view-controller
has body: I created a Java application that kept basketball stats for a team of players. The first time I made the program, the GUI elements created actions that were dealt with in the same class, then the players were modified. I am interested in rewriting the program following an MVC model. I assume I will need a view or GUI, then a model (Player), and a controller. The controller is hard to understand for me. How do I pass what happened in the GUI to the controller? For instance, in the old program, I had 5 JComboBoxes and I would have an Array of int in order to keep track of the active players. The currently selected player would have his stats updated if an event was recorded under his name. How would I go about this using the MVC model, would I need an instance of Controller for each Player? Here is a picture of the old GUI so that you can visualize how the program works. Thank you for any suggestions.
has comment: http://stackoverflow.com/comment/32825342
type: Question
linked to: http://stackoverflow.com/q/8693815
has answer: http://stackoverflow.com/a/21709488
tagged with: java
has comment: http://stackoverflow.com/comment/32825583
score: 0
has title: MVC Model with GUI Application
tagged with: user-interface
answer count: 1
tagged with: model
tagged with: controller
has comment: http://stackoverflow.com/comment/32825563
has comment: http://stackoverflow.com/comment/32825279

http://stackoverflow.com/comment/33045883
type: QuestionComment
has text: The method in that link didn't work for me on Cygwin, but the --ipv4 curl option did
score: 0
comment on: http://stackoverflow.com/q/21784016
type: Comment

jenkins
tags question: http://stackoverflow.com/q/21778124
tag name: jenkins
tags question: http://stackoverflow.com/q/21829523
tags question: http://stackoverflow.com/q/21696212
tags question: http://stackoverflow.com/q/21698330
tags question: http://stackoverflow.com/q/21718357
tags question: http://stackoverflow.com/q/21758392
tags question: http://stackoverflow.com/q/21747220
tags question: http://stackoverflow.com/q/21794010
tags question: http://stackoverflow.com/q/21756309
tags question: http://stackoverflow.com/q/21696970
type: Tag

http://stackoverflow.com/q/21823942
has answer: http://stackoverflow.com/a/21824473
has title: is there anyway to know server file directory structure in java?
type: UnansweredQuestion
tagged with: remote-access
tagged with: java
type: Question
tagged with: security
score: 0
has answer: http://stackoverflow.com/a/21824656
answer count: 2
has body: I am trying to access a remote file on a server just for study purposes. My server is simple like below: It is a basic SpringMVC Project It shows an index.html which prints "HelloWorld" and the current server time What I am trying to do is below: Access URL(for instance, http://192.168.0.1:8080/test) Find absolute path of index.html which is somewhere on the server (remote file) Open and edit "HelloWorld" to "Hi, John!" I already tried with HttpUrlConnection, but the methods of that class do not match my purposes. Second try was with File class. I put URI instance in File, but URI treats only "file://" protocol. How can I change that text on the remote server computer?

http://stackoverflow.com/comment/32971865
has text: @BrianRoach yeah, I thought the same too, but Im required to build a Linked List instead
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21791194

http://stackoverflow.com/comment/32887771
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21744114
type: Comment
has text: This problem would best be solved, IMHO, with [`LinkedHashMap`s](http://docs.oracle.com/javase/7/docs/api/java/util/LinkedHashMap.html). A couple of the answers to [this StackOverflow question](http://stackoverflow.com/questions/12967896/converting-integers-to-roman-numerals-java) use it well.

http://stackoverflow.com/comment/33000157
type: Comment
comment on: http://stackoverflow.com/q/21806778
type: QuestionComment
has text: You added the /x86 files, but did you add the /armeavi ones?
score: 0

http://stackoverflow.com/comment/32971213
type: Comment
type: QuestionComment
has text: What is the definition of "correct nesting"?
comment on: http://stackoverflow.com/q/21789787
score: 0

http://stackoverflow.com/comment/32829372
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21711332
score: 1
has text: How do you know there's nothing wrong? You're explicitly ignoring any exception thrown.

log4j
tags question: http://stackoverflow.com/q/21705859
tags question: http://stackoverflow.com/q/21834772
tags question: http://stackoverflow.com/q/21781026
tags question: http://stackoverflow.com/q/21710493
tags question: http://stackoverflow.com/q/21733425
tags question: http://stackoverflow.com/q/21841549
tags question: http://stackoverflow.com/q/21739578
tags question: http://stackoverflow.com/q/21782103
tags question: http://stackoverflow.com/q/21789066
tag name: log4j
tags question: http://stackoverflow.com/q/21768299
tags question: http://stackoverflow.com/q/21810274
tags question: http://stackoverflow.com/q/21837206
tags question: http://stackoverflow.com/q/21773861
tags question: http://stackoverflow.com/q/21830841
tags question: http://stackoverflow.com/q/21694799
tags question: http://stackoverflow.com/q/21765979
type: Tag
tags question: http://stackoverflow.com/q/21771440

http://stackoverflow.com/a/21736849
has body: Based on the code you've pasted, you don't appear to ever be associating your InetAddress with your DatagramSocket. Try: DatagramSocket socket = new DatagramSocket(portNumber, iadd); to specify the address and port of where the datagrams should be going. Your client should be listening on the same port on the other end.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21736760
answers question: http://stackoverflow.com/q/21736760
score: 0
type: Answer

http://stackoverflow.com/q/21783046
favorite count: 0
has answer: http://stackoverflow.com/a/21783191
answer count: 5
has answer: http://stackoverflow.com/a/21783386
has answer: http://stackoverflow.com/a/21785136
upvote count: 11
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21784281
has body: I want to define some enums for the various ajax services that I have available in my web application, like: Enum Service { REGISTER, LOGIN, NEWS, FAQ } However, each of these enums will also have a certain state like Failed, Loaded, etc. So I want to be able to use REGISTER.LOADED, LOGIN.LOADED etc, to fire up events on my event bus. However each state enum must be unique. I.e Register.LOADED must be different from FAQ.LOADED, and so on. Edit: Also, I must be able to store all states in the same hashmap, e.g Register.LOADED and Login.LOADED must be storable in the same hashmap. And the parent service enums, i.eLOGIN, REGISTER etc must be storable in the same hashmap as well. What's the best way to accomplish this?
tagged with: java
has answer: http://stackoverflow.com/a/21783184
type: Question
tagged with: enums
accepted answer: http://stackoverflow.com/a/21785136
score: 11
downvote count: 0
has title: Nested enums in Java?
possible better answer: http://stackoverflow.com/a/21783191

http://stackoverflow.com/comment/32937744
score: 0
comment on: http://stackoverflow.com/q/21762650
type: QuestionComment
has text: Yes I save the value from a servlet in the database, but what I needed was to get the value of the variable fileName in Upload.jsp then send it to another jsp to thereafter submit the form and save the data from a servlet. And the problem which does not work the setAttribute () is because it is being submitted from javascript and it does not work from a third party.
type: Comment

http://stackoverflow.com/comment/33051164
comment on: http://stackoverflow.com/q/21836036
score: 0
type: Comment
type: QuestionComment
has text: Show out what have you tried so far

http://stackoverflow.com/q/21767982
answer count: 4
has answer: http://stackoverflow.com/a/21768584
has comment: http://stackoverflow.com/comment/32930300
has answer: http://stackoverflow.com/a/21789608
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32930336
has title: How can I tell if an item in an array is also an array?
type: Question
has body: I tried to write the following method: public static long[] deepDoubleToLong(double... original) { long[] ret = new long[original.length]; for(int i = 0; i &lt; ret.length; i++) if (original[i] instanceof double[]) ret[i] = deepDoubleToLong((double[])original[i]); else ret[i] = (long)original[i]; return ret; } bit I get this compile error: Uncompilable source code - unexpected type required: reference found: double at ArrayConversion.deepDoubleToLong(ArrayConversion.java:5) How else, if not this way, can I tell if an item is an array?
tagged with: java
tagged with: arrays
has answer: http://stackoverflow.com/a/21768374
has comment: http://stackoverflow.com/comment/32930314
has comment: http://stackoverflow.com/comment/32930331
tagged with: type-conversion
score: 0
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/21768297

http://stackoverflow.com/q/21739139
has title: Is something special required to launch JavaFX applications on OSX?
has answer: http://stackoverflow.com/a/21742241
answer count: 1
downvote count: 0
tagged with: macos
has comment: http://stackoverflow.com/comment/32879255
favorite count: 0
has body: I have an application that I wrote, using JavaFX, that runs normally on Windows and Linux. On OSX, however, the application starts (is listed in the process list), but the GUI never appears. It is launched from another application that ensures that it is up to date, using the standard convention of "java -cp &lt;all of the required libraries, including the jfxrt.jar&gt; &lt;main-class&gt; &lt;args&gt;" Is there something I'm missing that OSX needs to make JavaFX work correctly?
type: UnansweredQuestion
tagged with: javafx-2
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32883075
has comment: http://stackoverflow.com/comment/32879464
type: Question
linked to: http://stackoverflow.com/q/9436219
has comment: http://stackoverflow.com/comment/32884272

http://stackoverflow.com/comment/32969495
type: Comment
has text: synchronize part where you are printing out reseived resources and see what happen than
comment on: http://stackoverflow.com/q/21789964
score: 0
type: QuestionComment

http://stackoverflow.com/q/21722176
has comment: http://stackoverflow.com/comment/32848223
has title: JTextField simply doesn't respond
answer count: 1
has comment: http://stackoverflow.com/comment/32849720
has body: I have gone through the other question with same title but that isn't much helpful. I am using GridBagLayout to build a form. But the JTextFields in my form simply doesn't respond. I click in it but it doesn't show the cursor. Thus i cant enter anything in it. Code snippet is as follows: //textfields weighttf = new JTextField(20); go = new JButton("Get my Ideal Weight"); go.setFont(centerpanelfont); centerpanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx=0.5; c.weighty=0.5; c.gridx=0; c.gridy=1; centerpanel.add(weighttf,c);
has comment: http://stackoverflow.com/comment/32848643
type: UnansweredQuestion
tagged with: swing
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/32848665
tagged with: java
has answer: http://stackoverflow.com/a/21722200
score: 0
has comment: http://stackoverflow.com/comment/32850776

http://stackoverflow.com/comment/32986132
type: AnswerComment
comment on: http://stackoverflow.com/a/21799323
type: Comment
score: 0
has text: When you call `charAt()`, you're not changing anything - you're just obtaining a character. If you don't do anything to that character (e.g. store it in a variable or pass it to another function) the method does literally nothing.

http://stackoverflow.com/comment/32896865
type: Comment
has text: How you have added your jar files??
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21747038

http://stackoverflow.com/comment/33147788
type: Comment
has text: So, I can open all of comboboxes in all of applications and move their windows away, but popups of comboboxes remain "seated". If I open popups of comboboxes by moved windows again - the popups have previous locations immediately! It seems horrible! Unfortunately I cannot show screenshots here. So, JavaFX developers confirm the problem, but when it will be resolved they don’t know. What a pity, that we cannot show a prototype for customers with such errors, and we cannot use JavaFX for our rebuilding now, obvious we need other technologies...
score: 0
comment on: http://stackoverflow.com/q/21838909
type: QuestionComment

http://stackoverflow.com/comment/32875881
score: 0
has text: Nized. I cant see the full code you provided. what has after List<Object[]> itemProdutoLista = ...;
type: Comment
comment on: http://stackoverflow.com/a/21737252
type: AnswerComment

http://stackoverflow.com/a/21808305
has body: There are many many tuts, docos and q/as for catching key events, e.g. How can I capture keyboard events are from which keys?
answers question: http://stackoverflow.com/q/21808288
score: 0
type: Answer

parsing
tags question: http://stackoverflow.com/q/21826548
tags question: http://stackoverflow.com/q/21827002
tags question: http://stackoverflow.com/q/21789413
tags question: http://stackoverflow.com/q/21683463
tags question: http://stackoverflow.com/q/21780900
tags question: http://stackoverflow.com/q/21717104
tag name: parsing
tags question: http://stackoverflow.com/q/21834286
tags question: http://stackoverflow.com/q/21680559
tags question: http://stackoverflow.com/q/21745130
tags question: http://stackoverflow.com/q/21799775
tags question: http://stackoverflow.com/q/21681137
tags question: http://stackoverflow.com/q/21779520
tags question: http://stackoverflow.com/q/21684715
type: Tag
tags question: http://stackoverflow.com/q/21703474
tags question: http://stackoverflow.com/q/21791577
tags question: http://stackoverflow.com/q/21821289
tags question: http://stackoverflow.com/q/21796414
tags question: http://stackoverflow.com/q/21678633
tags question: http://stackoverflow.com/q/21821616
tags question: http://stackoverflow.com/q/21744930
tags question: http://stackoverflow.com/q/21807770
tags question: http://stackoverflow.com/q/21813505

http://stackoverflow.com/q/21725581
has comment: http://stackoverflow.com/comment/32854164
has comment: http://stackoverflow.com/comment/32887069
has comment: http://stackoverflow.com/comment/32854218
has comment: http://stackoverflow.com/comment/32855835
score: 0
linked to: http://stackoverflow.com/q/3129608
has comment: http://stackoverflow.com/comment/32854056
has body: I am currently decide what kind of communication method/network protocol I am going to use for a new project. What I can tell you about this project is that: - It is Android/java based, using X amount of Android devices - These devices should be able to send strings to each other over a local network. We are talking about small strings here. Small as in less than 100 characters. - The amount of packages/transmissions being sent can vary "A LOT". I can't say how much unfortunately, but the network protocol needs to be as scalable as possible. I have researched different kinds of possible solutions and is now deciding wether to use "Sockets" or "RMI" As I have understood about RMI: It is easier than Java sockets to implement and maintain (smaller amount of code) It is "a bit slower" than sockets, as it is a new "layer" build on top of Sockets There may be some scalability issues (if this is true, how "serious" is it?) as it creates a lot of new sockets, resulting in Exceptions. Obviously the system needs to run as smooth as possible, but the main objective is to make it scalable so it can handle more Android devices. EDIT: The system the system is not "peer-to-peer". All of the android devices should be able to be configured as the server.
has comment: http://stackoverflow.com/comment/32860144
has comment: http://stackoverflow.com/comment/32855739
has comment: http://stackoverflow.com/comment/32886180
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/32854634
has answer: http://stackoverflow.com/a/21725887
tagged with: network-programming
has title: Sockets or RMI - perfomance and scalability
has answer: http://stackoverflow.com/a/21725681
tagged with: rmi
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32854338
has comment: http://stackoverflow.com/comment/32853967
has comment: http://stackoverflow.com/comment/32855740

http://stackoverflow.com/comment/33051649
type: Comment
comment on: http://stackoverflow.com/q/21836087
has text: Concatenating an SQL query in this way implies SQL attacks. Use prepared statements to mitigate them.
score: 5
type: QuestionComment

http://stackoverflow.com/comment/32900165
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21751053
has text: i tried plugin with an editor.. again i have doubts actualy i create xml files and give some tags.. but its not have any color change

http://stackoverflow.com/comment/33017262
type: Comment
comment on: http://stackoverflow.com/a/21816468
score: 1
has text: `0b` is only support in Java 7 and later
type: AnswerComment

http://stackoverflow.com/comment/32980420
type: QuestionComment
comment on: http://stackoverflow.com/q/21795515
has text: Yes they are. It is just that their elements are of type `Map.Entry`. No mystery here ;)
score: 2
type: Comment

http://stackoverflow.com/comment/32835266
score: 0
type: Comment
type: QuestionComment
has text: `TreeMap<?,?>` works fine for me. Of course you need to make both the declaration and the cast have that form.
comment on: http://stackoverflow.com/q/21713573

http://stackoverflow.com/comment/33211683
has text: That would be much easier to test if your class used a builder; this way you could pass mocks of {de,}serializers and even test that they serialize to what you expect.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21706415

http://stackoverflow.com/q/21729187
tagged with: java
has title: Android MultiThread SpeedTest have performances problems
tagged with: multithreading
has body: I've started to do a speedtest application recently. The method is simple : I instanciate multiple threads all downloading the same uncompressible file, then i calculate the average download speed. But I've got some performances problems I think. When i start the test with more than one thread, i see a lot of GC_CONCURRENT freed and WAIT_FOR_CONCURRENT_GC in the logCat. I don't understand where's that comming from. Habitually these problems seems to appear in certain circumpstances, like instanciating too much objects, or huge objects, but i don't think it's the case here... Here is my code (simplified - without speed calculation): public class SpeedTest extends Activity{ private final int NB_THREADS = 2; private long bytesIn; private long downloadTime; private List&lt;Downloader&gt; downloaders = new ArrayList&lt;Downloader&gt;(); @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.speed_test); bytesIn = 0; for (int i = 0; i &lt; NB_THREADS; i++){ downloaders.add(new Downloader()); downloaders.get(i).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, i); } } private synchronized void addBytes(){ bytesIn++; } private class Downloader extends AsyncTask&lt;Integer, Void, Void&gt;{ @Override protected Void doInBackground(Integer... params){ Log.d("eduine", "Downloader " + params[0] + " started"); try{ InputStream stream = new URL("http://test-de-vitesse.ariase.com/ariasetool/1mb_random.bin").openConnection().getInputStream(); while((stream.skip(1)) != 0){ addBytes(); } stream.close(); }catch (MalformedURLException e){ e.printStackTrace(); Log.e("eduine", "malformed url : " + e.getMessage()); }catch (IOException e){ e.printStackTrace(); Log.e("eduine", "io error : " + e.getMessage()); } Log.d("eduine", "Downloader " + params[0] + " terminated"); return null; } } } So I'd like to know if someone already experienced this problem, or have any idea why is there these performances problems, because it disto…
type: Question
upvote count: 2
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/21729760
score: 2

http://stackoverflow.com/a/21810512
answers question: http://stackoverflow.com/q/21809922
score: 1
has comment: http://stackoverflow.com/comment/33008236
has body: The JVM stores meta data in the object header. Any object with a sub-classes finalize() is called, even if empty. Placing in the queue doesn't take long, but it can wait in the queue for a long time.
has comment: http://stackoverflow.com/comment/61565630
downvote count: 0
has comment: http://stackoverflow.com/comment/33009633
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32883843
type: Comment
comment on: http://stackoverflow.com/a/21741558
score: 0
type: AnswerComment
has text: @ImGone98: For reference, many of these valuable guidelines are seen in the example cited [here](http://stackoverflow.com/a/10326636/230513).

http://stackoverflow.com/comment/33003928
type: Comment
has text: @DownVoter, I dont mind crticism, but atleast explain the reason for the downvote
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21809259

http://stackoverflow.com/a/21729121
score: 3
answers question: http://stackoverflow.com/q/21728958
downvote count: 0
type: Answer
has body: No. Java doesn't have explicit support for design-by-contract pre/postconditions like (for instance) Ada does. See the java docs
upvote count: 3

http://stackoverflow.com/q/21815468
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: binary-tree
type: Question
has comment: http://stackoverflow.com/comment/33015727
favorite count: 0
tagged with: binary-search-tree
has title: BinaryTreeLUT , tree deletion
upvote count: 1
tagged with: algorithm
tagged with: java
has body: I have the following binary search tree as below, and am trying to delete a node using the method illustrated in this wiki http://en.wikipedia.org/wiki/Binary_search_tree#Deletion The main idea is to modify lrMerge (method in below code) when both subtrees are present. Then the node to be deleted is replaced by the rightmost node in the left tree (which itself is deleted). There is a test file at the end of the code below. I tried to change IrMerge to be like the wiki deletion code - but have not been succesful. class KeyNotFoundInTableException extends Exception { } public class BinaryTreeLUT { /** * The member class Key is used for the indexing keys of the LUT. It * is a String with basic comparative methods added. */ protected class Key { public Key(String s) { kString = s; } public boolean equals(Key k) { return kString.equals(k.toString()); } public boolean lessThan(Key k) { return (kString.compareTo(k.toString()) &lt; 0); } public boolean greaterThan(Key k) { return (kString.compareTo(k.toString()) &gt; 0); } public String toString() { return kString; } private String kString; } /** * The member class Entry encapsulates an entry of the LUT and contains * a {key, value} pair. */ protected class Entry { public Entry(Key k, Object v) { key = k; value = v; } protected Key key; protected Object value; } /** * The member class BSTreeNode encapsulates node of the binary search * tree, which contains a LUT entry and links to left and right * subtrees. */ protected class BSTreeNode { public BSTreeNode(Entry e) { kvPair = e; left = null; right = null; } public BSTreeNode(Entry e, BSTreeNode l, BSTreeNode r) { kvPair = e; left = l; right = r; } protected Entry kvPair; protected BSTreeNode left; protected BSTreeNode right; } //Single protected data member - the LUT is stored in a sequence. protected BSTreeNode root; /** * Default constructor - no need to specify capacity of LUT. */ public BinaryTreeLUT() { root = null; } /** * Inserts a new key-value pair into the look-up…

http://stackoverflow.com/q/21743194
type: Question
has answer: http://stackoverflow.com/a/21757672
accepted answer: http://stackoverflow.com/a/21745815
tagged with: jackson
has comment: http://stackoverflow.com/comment/32886188
answer count: 2
has comment: http://stackoverflow.com/comment/32891480
downvote count: 0
has comment: http://stackoverflow.com/comment/33107365
has body: I have the following controller: @RequestMapping(value = "/test/inst/", method = RequestMethod.POST) public @ResponseBody ResponseDTO&lt;InstDTO&gt; testPostREST(@RequestBody RequestDTO&lt;InstDTO&gt; instDTO) { RequestDTO&lt;InstDTO&gt; dto = new RequestDTO&lt;InstDTO&gt;(); ResponseDTO&lt;InstDTO&gt; responseDto = new ResponseDTO&lt;InstDTO&gt;(); responseDto.setPayload(instDTO.getPayload()); return responseDto; } with the following request object: @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) public class RequestDTO&lt;T&gt; { private List&lt;T&gt; payload; public RequestDTO() { System.out.println("constructor"); } public RequestDTO(List&lt;T&gt; payload) { this.payload = payload; } public List&lt;T&gt; getPayload() { return payload; } public void setPayload(List&lt;T&gt; payload) { this.payload = payload; } } When the POST comes through and I look the object I get, the payload list has LinkedHashMap objects instead of objects of my DTO type. How can I make spring+jackson convert the JSON into my DTO object. Bear in mind that I plan to reuse the wrapper ResponseDTO for other lists of objects and that's why I'm using a generic list (List). Here's the JSON I'm trying. { "payload": [ { "d": "Test 0", "id": "abcde", "c": "Test 0" }, { "d": "Test 1", "id": "123", "c": "Test 1" } ] }
favorite count: 0
linked to: http://stackoverflow.com/q/21867545
has comment: http://stackoverflow.com/comment/32913385
tagged with: rest
tagged with: spring
has answer: http://stackoverflow.com/a/21745815
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32888089
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Spring + Jackson + Deserializing List of Generic Objects
upvote count: 1
has comment: http://stackoverflow.com/comment/32891447
possible better answer: http://stackoverflow.com/a/21757672

serialization
tags question: http://stackoverflow.com/q/21799873
tags question: http://stackoverflow.com/q/21810356
tags question: http://stackoverflow.com/q/21810034
tags question: http://stackoverflow.com/q/21712380
tags question: http://stackoverflow.com/q/21788434
tags question: http://stackoverflow.com/q/21825263
tags question: http://stackoverflow.com/q/21706415
tags question: http://stackoverflow.com/q/21791872
tags question: http://stackoverflow.com/q/21747238
tag name: serialization
tags question: http://stackoverflow.com/q/21763805
tags question: http://stackoverflow.com/q/21696070
tags question: http://stackoverflow.com/q/21686159
type: Tag
tags question: http://stackoverflow.com/q/21708339
tags question: http://stackoverflow.com/q/21712194
tags question: http://stackoverflow.com/q/21736293
tags question: http://stackoverflow.com/q/21726778
tags question: http://stackoverflow.com/q/21817348
tags question: http://stackoverflow.com/q/21805311

http://stackoverflow.com/comment/32899776
type: Comment
has text: if you have oAuth 2 then go for this : http://developer.android.com/google/play-services/auth.html or user rest libs to send request to server and get authentication done
type: AnswerComment
comment on: http://stackoverflow.com/a/21750960
score: 0

http://stackoverflow.com/comment/33064603
type: QuestionComment
comment on: http://stackoverflow.com/q/21832947
score: 0
has text: Are you sure it is `SetActive` not `setActive` (note the case)? The first seems wrong [Java naming convention](http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#73307) for a method name.
type: Comment

http://stackoverflow.com/q/21808315
score: 1
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/21808342
type: Question
has comment: http://stackoverflow.com/comment/33002003
has body: Write a program that displays all the numbers from 100 to 1000, ten per line, that are divisible by 5 and 6. this is my program: for (int i =100; i&lt;= 1000; i++){ if(i % 5==0 &amp;&amp; i % 6==0) System.out.print(i +" "); if (i %10==0){ System.out.println(); }
has title: Write a program that displays all the numbers from 100 to 1000, ten per line, that are divisible by 5 and 6
has comment: http://stackoverflow.com/comment/33002037
answer count: 1
accepted answer: http://stackoverflow.com/a/21808342
has comment: http://stackoverflow.com/comment/33002004
favorite count: 0
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/comment/33006117
has text: If you want it to be Java, JSP servlets seems perfect to archieve your goals.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21810616

http://stackoverflow.com/q/21735110
type: UnansweredQuestion
tagged with: maximo
score: 3
downvote count: 0
tagged with: java
type: Question
answer count: 2
upvote count: 3
has answer: http://stackoverflow.com/a/23832223
has body: Is it possible to write a pure sql statement for Maximo using Java? At the moment I use myObj.setWhere("employee = 'brian'"); But I'd like to do: myObj.xxx("select * from employee where name = 'brian'"); is there such a function?
tagged with: sql
has title: Using SQL statements in IBM Maximo, using Java
favorite count: 0
has answer: http://stackoverflow.com/a/21735457

http://stackoverflow.com/comment/33054220
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21833137
type: QuestionComment
has text: System.out.println("Get passed Array Value " + GUIsidearray.get(0)); // Shown in console -> Get passed Array Value // [sun.jdbc.odbc.JdbcOdbcResultSet@1adc30] //

http://stackoverflow.com/comment/32856338
type: QuestionComment
score: 0
has text: Are the last `Name` and `Patient` tags in the first bit supposed to be end tags?
type: Comment
comment on: http://stackoverflow.com/q/21724468

http://stackoverflow.com/q/21813245
linked to: http://stackoverflow.com/q/14402382
has answer: http://stackoverflow.com/a/21813469
accepted answer: http://stackoverflow.com/a/21813469
answer count: 1
score: 4
favorite count: 0
tagged with: android
has title: how can I flip an android dialog on click?
upvote count: 4
downvote count: 0
tagged with: animation
has body: I have an android dialog I saw this tutorial for swiping a dialog in and out. how can I filp a dialog when the user clicks on the dialog. I want to actually show the user two dialog with different content and trasit with flip between them
type: Question
type: AnsweredQuestion
tagged with: android-animation
tagged with: java

http://stackoverflow.com/comment/32837948
has text: Does it appear in your GUI?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21715880
score: 0

http://stackoverflow.com/comment/33002162
has text: Wouldn't `if(i != 100 && (i - 100) % 10 == 0) System.out.println();` work as well?
type: AnswerComment
comment on: http://stackoverflow.com/a/21808342
type: Comment
score: 0

http://stackoverflow.com/q/21744551
tagged with: inheritance
has answer: http://stackoverflow.com/a/21744648
score: 0
accepted answer: http://stackoverflow.com/a/21744648
has comment: http://stackoverflow.com/comment/32888485
answer count: 1
tagged with: instanceof
tagged with: extends
has title: Java: If this is instanceof Something, display a variable that belongs only to Something?
tagged with: instance-variables
type: AnsweredQuestion
tagged with: java
has body: Everything here is renamed and simplified. I have a parent class (normalThing) with a method that displays some data about the instance, and another class (specialThing) extending the parent to include another instance variable (addedPrice). I want my display method to say whether or not the instance is a specialThing, and if it is, to display the addedPrice. But because addedPrice belongs only to specialThing, I can't figure out how to code it! void displayInfo(){ StringBuilder d = new StringBuilder("Am I special? "); if(this instanceof specialThing){ d.append("Yes, so I cost an extra " + this.addedPrice); //No, I didn't expect that to work, but I had hope } else d.append("Nope."); JOptionPane.showMessageDialog(null, d); } Is there any way to do this without essentially making a "could-be-addedPrice" variable in the normalThing class?
has comment: http://stackoverflow.com/comment/32888654
type: Question
has comment: http://stackoverflow.com/comment/32888680

http://stackoverflow.com/comment/32909104
comment on: http://stackoverflow.com/a/21756582
type: Comment
score: 2
has text: What is about the numerals that the OP asked for ?
type: AnswerComment

http://stackoverflow.com/a/21689885
upvote count: 1
has body: I use the below to add markers. mMap = getMap(); mMap.addMarker(new MarkerOptions().position(new LatLng(lat, lng)).title(tit).draggable(true).snippet(String.valueOf(id)) I think you just need to initialise mMap before adding the marker
answers question: http://stackoverflow.com/q/21689341
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/21768314
score: 1
has answer: http://stackoverflow.com/a/21779564
has body: I've developed a simple custom TableCell to enable the edition of the values in a table. The behaviour of the component is show a BigDecimalTextField no matter if the user is editing or not that cell, it should enable the edition all the time. The component is working fine, there is only a strange problem: when the table is rendered, instead of show only a single line, three lines are shown: The code of the component is this: public class BigDecimalEditingCell extends TableCell { private BigDecimalField spinner = new BigDecimalField(new BigDecimal("0.00")); private ObjectProperty&lt;BigDecimal&gt; campoLigado = null; public BigDecimalEditingCell() { this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); createField(); } private void createField() { spinner.setStepwidth(new BigDecimal("0.01")); spinner.setMinValue(new BigDecimal("0.00")); spinner.setFormat(NumberFormat.getInstance()); spinner.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); } @Override public void updateItem(Object item, boolean empty) { super.updateItem(item, empty); criarBind(); setGraphic(spinner); setText(null); } private void criarBind() { ObservableValue&lt;BigDecimal&gt; valor = getTableColumn().getCellObservableValue(getIndex()); if (valor != null) { ObjectProperty&lt;BigDecimal&gt; propriedade = (ObjectProperty&lt;BigDecimal&gt;) valor; if (campoLigado == null) { spinner.numberProperty().bindBidirectional(propriedade); campoLigado = propriedade; } else if (campoLigado != propriedade) { spinner.numberProperty().unbindBidirectional(campoLigado); spinner.numberProperty().bindBidirectional(propriedade); campoLigado = propriedade; } } } } If I use the default TextFieldTableCell, the table is rendered correctly. I have another component (like this) that uses JavaFX's DatePicker and the same problem happens. What I'm doing wrong? ADDED Here is the usage of this component: public class ControladorPainelFormaPagamento extends ControladorPainelSubmeter { @FXML private TableView&lt;ParcelaBea…
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/32932003
favorite count: 0
accepted answer: http://stackoverflow.com/a/21779564
upvote count: 1
tagged with: tablecell
type: AnsweredQuestion
tagged with: java
type: Question
has title: JavaFX 8 Custom TableCell implementation is rendering three times
answer count: 1
downvote count: 0

http://stackoverflow.com/a/21696669
type: Answer
has comment: http://stackoverflow.com/comment/32833175
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21695689
has comment: http://stackoverflow.com/comment/32804400
has comment: http://stackoverflow.com/comment/32808699
has comment: http://stackoverflow.com/comment/32803904
has comment: http://stackoverflow.com/comment/32804004
upvote count: 1
has body: You can get the number of dates in between the 2 dates and compare with your days parameter. Using Joda-Time API it is relatively an easy task: How do I calculate the difference between two dates?. Code: SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy", Locale.GERMAN); Date startDate = format.parse("1.1.2013"); Date endDate = format.parse("3.1.2013"); Days d = Days.daysBetween(new DateTime(startDate), new DateTime(endDate)); System.out.println(d.getDays()); Gives, 2 This is possible using Calendar class as well: Calendar cal = Calendar.getInstance(); cal.setTime(startDate); System.out.println(cal.fieldDifference(endDate, Calendar.DAY_OF_YEAR)); Gives, 2 This 2 can now be compared to your actual value (20).

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

http://stackoverflow.com/comment/32914050
type: QuestionComment
comment on: http://stackoverflow.com/q/21759316
type: Comment
has text: That could be the answer.
score: 0

http://stackoverflow.com/comment/32798406
type: QuestionComment
has text: @KugathasanAbimaran thanks for that, completely forgot!
comment on: http://stackoverflow.com/q/21694021
score: 0
type: Comment

http://stackoverflow.com/q/21760531
has answer: http://stackoverflow.com/a/21760649
upvote count: 1
has answer: http://stackoverflow.com/a/21760767
linked to: http://stackoverflow.com/q/383947
downvote count: 10
type: Question
score: -9
has comment: http://stackoverflow.com/comment/32916650
has comment: http://stackoverflow.com/comment/32916456
linked to: http://stackoverflow.com/q/38922754
has comment: http://stackoverflow.com/comment/32916617
has comment: http://stackoverflow.com/comment/32916575
has comment: http://stackoverflow.com/comment/32916542
has answer: http://stackoverflow.com/a/21760620
accepted answer: http://stackoverflow.com/a/21760767
has comment: http://stackoverflow.com/comment/32916491
possible better answer: http://stackoverflow.com/a/21760633
has comment: http://stackoverflow.com/comment/32917293
favorite count: 0
has answer: http://stackoverflow.com/a/21760633
answer count: 5
has comment: http://stackoverflow.com/comment/32917076
has body: The following code gives the wrong information: import java.text.SimpleDateFormat; import java.util.GregorianCalendar; public class test { public static void main(String[] args) { GregorianCalendar fmt = new GregorianCalendar(2000, 7, 3); SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy"); String result = df.format(fmt.getTime()); System.out.println("fmt: " + result); } } It outputs: fmt: 03-Aug-2000 While I need the Month to be July, as I have set the month to 7?
has title: Why does SimpleDateFormat() return wrong month?
has comment: http://stackoverflow.com/comment/32917177
has comment: http://stackoverflow.com/comment/32916552
has comment: http://stackoverflow.com/comment/32917685
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32916610
has answer: http://stackoverflow.com/a/48654601
tagged with: java
has comment: http://stackoverflow.com/comment/32916457

http://stackoverflow.com/comment/33005755
type: AnswerComment
comment on: http://stackoverflow.com/a/21810424
type: Comment
score: 1
has text: can we have a snippet of how is myservlet.java is mapped to the url in your deployment descriptor like web.xml file. as there you may have to map the url pattern `/FirstServlet` to the fully qualified classpath of myservlet.java And that should be good to go :)

http://stackoverflow.com/a/21687053
downvote count: 0
has body: Make sure they are in the same package so that you can directly call on the constructor and methods of the SalesAnaylzer class. Then just create a SalesAnalyzer object like you would any other: SalesAnaylzer sA = new SalesAnaylzer(filename); System.out.println(sA); etc...
accepted answer of: http://stackoverflow.com/q/21686970
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21686970
type: AcceptedAnswer

java-native-interface
tags question: http://stackoverflow.com/q/21734086
tags question: http://stackoverflow.com/q/21769655
tags question: http://stackoverflow.com/q/21776970
tags question: http://stackoverflow.com/q/21837071
tags question: http://stackoverflow.com/q/21745544
tags question: http://stackoverflow.com/q/21719346
tags question: http://stackoverflow.com/q/21741826
type: Tag
tags question: http://stackoverflow.com/q/21691221
tag name: java-native-interface
tags question: http://stackoverflow.com/q/21794703
tags question: http://stackoverflow.com/q/21679004
tags question: http://stackoverflow.com/q/21758498
tags question: http://stackoverflow.com/q/21688867
tags question: http://stackoverflow.com/q/21788821
tags question: http://stackoverflow.com/q/21684717
tags question: http://stackoverflow.com/q/21743792

http://stackoverflow.com/a/21684528
has body: I have 2 solutions for above problem Using extra space i.e. Map to store unique value. Complexity O(n) + Space(N) [N= #unique value] No extra space. Sorts the input and counts values. Complexity nLog(n) + n First Solution Create a map to store each unique value as key and its count as value Iterate over input array If value exists as key then increment counter ELSE if value does exist in map, then put value and set counter as 1 private static void UniqueValueUsingMap(int[] a){ //Map with // key: unique values // Value: count as each value (key) Map&lt;Integer, Integer&gt; store = new HashMap&lt;Integer, Integer&gt;(); for (int i : a) { Integer key = Integer.valueOf(i); Integer count = null; if(store.containsKey(key)){ count = store.get(key); }else{ count = 0; } count++; store.put(key, count); } } Second solution Sort the given Array nlog(n). All same values will be together after sort. Iterate over sorted array Maintain 2 variable i.e. previous value and counter for current value When value change, print the value/count and reset the counter Note: : int defaults to 0 inital value. Need to add additional check for it. private static void CountValueUsingSort(int[] a){ //Sort the input array Arrays.sort(a); int currentValue = 0; int counter =0; for (int curr : a) { if(curr != currentValue){ System.out.println("Value: " + currentValue + " Count:" + counter); //Reset counter counter = 0; } currentValue = curr; //increment Count counter++; } }
answers question: http://stackoverflow.com/q/21683747
score: 0
type: Answer

http://stackoverflow.com/a/21711828
type: AcceptedAnswer
downvote count: 0
has body: You actually have two PropertyPlaceHolderConfigurers defined here. One via the context namespace and one explicitly. Spring is probably picking the one created via the context namespace. You could either set 'ignore-unresolvable' on the context tag and remove your propertyConfigurer bean like so: &lt;context:property-placeholder ignore-unresolvable="true"/&gt; Or if you need more control over PropertyPlaceHolderConfigurer go the other way and remove the context:property-placeholder tag.
has comment: http://stackoverflow.com/comment/32859699
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21708123
accepted answer of: http://stackoverflow.com/q/21708123
score: 3

http://stackoverflow.com/comment/32947383
has text: Thanks for your reply! Well, for me works both in CKEditor (3.6.6.1) value attribute in a li tag and start attribute in tag. But what doesnt work is the export to pdf with itextpdf and its xmlworker. it just ignores value and also start attribute
comment on: http://stackoverflow.com/q/21696426
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32817200
score: 0
type: AnswerComment
has text: This would allow the number to start with zeroes, but beyond that it's the best solution. Edit: if you don't want it to start with zeroes, you could change it to: `"^([1-9]\d*|0)\.?\d*$"`
type: Comment
comment on: http://stackoverflow.com/a/21704856

http://stackoverflow.com/a/21727617
type: Answer
accepted answer of: http://stackoverflow.com/q/21725476
answers question: http://stackoverflow.com/q/21725476
downvote count: 0
score: 1
has body: Since you are referencing the interface on your web project, your Javadocs should be placed in the interface method. If your implementation method needs a more specific documentation, you could also inherit Javadocs from the interface and add the specifics. Just use {@inheritDoc} inside your Javadoc block. Example: /** * {@inheritDoc} * &lt;p&gt; * For this specific implementation of the interface, you're better off * calling the more efficient {@link foo} method, provided you have the * additional arguments! * &lt;/p&gt; */ @Override public void methodX() { // Your code here } Remember that the specific docs will only appear if you're explicitly referencing this class. BeanRemote bean = new Bean(); When you put your mouse cursor over BeanRemote it will show you the docs from BeanRemote whereas when you put it over Bean it'll show the specific docs.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/21683306
possible better answer: http://stackoverflow.com/a/21683373
favorite count: 0
accepted answer: http://stackoverflow.com/a/21683375
has title: Java Implementing math log function properly?
tagged with: logging
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21683375
has answer: http://stackoverflow.com/a/21683409
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21683373
type: Question
tagged with: math
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32779116
has body: so i have just this Math.log function in Java at this link http://www.tutorialspoint.com/java/lang/math_log.htm On its example : Math.log(60984.1) = 11.018368453441132 I tried it on a calculator (i was actually just using windows scientific calculator) and typed in 60984.1 then log, which shows that it is equivalent to log(60984.1). But then the result was 4.785216618906530669507 instead of the the 11.018368 of math.log function in java. What causes this inconsistency? I am not really good at math an i am trying to implement an algorithm which uses a log sig function and a simple log. I don't even know how to do a simple log. The equation i am basing upon has no base. Just simple log. What is the right equivalent of log in Java? Thank you :)

http://stackoverflow.com/q/21706078
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21706242
tagged with: rest
has answer: http://stackoverflow.com/a/61185520
score: 14
has title: PUT and POST getting 405 Method Not Allowed Error for Restful Web Services
has answer: http://stackoverflow.com/a/51725583
has comment: http://stackoverflow.com/comment/32819930
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21706232
upvote count: 14
has answer: http://stackoverflow.com/a/21710780
has body: I am trying to set up a simple Restful Web-Service which returns either JSON or XML according to the Accept header. I am using Spring, Maven and WebLogic Server. I took the example from this post http://software.sawano.se/2012/03/combining-json-and-xml-in-restful-web.html and tried to improve on it. GET and DELETE is working for both JSON and XML.But PUT and POST gives a "405 Method Not Allowed" Error. I am trying to test this with the Chrome Extension Advanced Rest Client. below is the Response headers. Status 405 Method Not Allowed Show explanation Loading time: 327 Request headers Accept: Application/json Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36 Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Response headers Connection: close Date: Tue, 11 Feb 2014 15:17:24 GMT Content-Length: 34 Content-Type: text/html Allow: GET, DELETE X-Powered-By: Servlet/2.5 JSP/2.1 Raw Parsed the request body that i give is below: { id: 1 name: "manga" } My Controller Class is as shown below: import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.HashSet; import java.util.Set; @Controller @RequestMapping("/users") public class RESTController { Userlist obj2; boolean flag=false; private Logger logger = LoggerFactory.getLogger(getClass()); @RequestMapping(value = "/{id}",method = RequestMethod.GET) @ResponseBody public User getUser(@PathVariable int id, @RequestHeader("Accept") String acceptHeader) { User temp = new User(); if(obj2==null) { temp= new User(0, "Null"); } else { Set&lt;User&gt; set1= obj2.getUsers(); for(User a:set1) { if(id==a.getId()) temp=a; } } logger.trace("Serving resource for Accept header: {}", acceptHeade…
has answer: http://stackoverflow.com/a/21706232
has answer: http://stackoverflow.com/a/51277658
tagged with: web-services
type: Question
tagged with: spring-mvc
tagged with: restful-url
tagged with: java
answer count: 6
accepted answer: http://stackoverflow.com/a/21710780

http://stackoverflow.com/a/21733584
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32878131
has comment: http://stackoverflow.com/comment/32884116
accepted answer of: http://stackoverflow.com/q/21732090
has comment: http://stackoverflow.com/comment/32868811
has comment: http://stackoverflow.com/comment/32870681
type: Answer
answers question: http://stackoverflow.com/q/21732090
downvote count: 0
has comment: http://stackoverflow.com/comment/32870350
has body: I have just tested your code with different audio files and everything seems to work just fine. I can only guess, that you are either testing your code with an empty audio file (bytes == 0) or, that the file you try to convert is not supported by the Java Audio System. Try using another input file and/or convert your input file to a compatible file, and it should work. Here is the main method, that worked for me: public static void main(String[] args) throws InterruptedException, UnsupportedAudioFileException, IOException { File file = ...; File output = ...; AudioInputStream ais; AudioInputStream eightKhzInputStream = null; ais = AudioSystem.getAudioInputStream(file); AudioFormat sourceFormat = ais.getFormat(); if (ais.getFormat().getSampleRate() == 22050f) { AudioFileFormat sourceFileFormat = AudioSystem.getAudioFileFormat(file); AudioFileFormat.Type targetFileType = sourceFileFormat.getType(); AudioFormat targetFormat = new AudioFormat( sourceFormat.getEncoding(), 8000f, sourceFormat.getSampleSizeInBits(), sourceFormat.getChannels(), sourceFormat.getFrameSize(), 8000f, sourceFormat.isBigEndian()); if (!AudioSystem.isFileTypeSupported(targetFileType) || ! AudioSystem.isConversionSupported(targetFormat, sourceFormat)) { throw new IllegalStateException("Conversion not supported!"); } eightKhzInputStream = AudioSystem.getAudioInputStream(targetFormat, ais); int nWrittenBytes = 0; nWrittenBytes = AudioSystem.write(eightKhzInputStream, targetFileType, output); System.out.println("nWrittenBytes: " + nWrittenBytes); } }
score: 1
has comment: http://stackoverflow.com/comment/32869533
upvote count: 1
has comment: http://stackoverflow.com/comment/32868729

http://stackoverflow.com/comment/33049321
comment on: http://stackoverflow.com/q/21834661
type: Comment
type: QuestionComment
has text: See problem is i need to put data in xls format , after fetching data from DB, so currently i am using single thread to do this. Its very time taking. What i think , i need to distribute the task among workers , and then finally i need to send the xls sheet to client. with single thread model , its very time consuming.
score: 0

http://stackoverflow.com/comment/33015161
has text: Try setting another meaningless (`X-`) header and see if that gets sent.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21815612

http://stackoverflow.com/a/42836810
type: Answer
has body: This should be caused by dependency issue, in general, you need to check the dependency.
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21783391

http://stackoverflow.com/q/21681014
tagged with: jsf
tagged with: primefaces
tagged with: java
has comment: http://stackoverflow.com/comment/49280109
has title: javax.el.PropertyNotFoundException with p:selectBooleanCheckbox component
has body: I'm having some problems with a simple primefaces component. I have a p:dialog with a p:selectBooleanCheckbox inside: &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"&gt; &lt;h:body&gt; &lt;ui:composition template="/templates/template_geral.xhtml"&gt; &lt;ui:define name="page_content"&gt; &lt;h:form id="form"&gt; &lt;p:dataTable resizableColumns="true" var="infoAssinaturas" value="#{mBConsulta_assinaturas.listInfoAssinaturas}" id="infoAssinaturasList" editable="true" rendered="true"&gt; &lt;p:column headerText="Ações" style="width:3%"&gt; &lt;p:panelGrid columns="2" style=".ui-panelgrid td, .ui-panelgrid tr{border: none !important}"&gt; &lt;p:commandLink update=":form:infoAssinaturasEdit" oncomplete="PF('infoAssinaturas_editDialog').show()" title="Editar"&gt; &lt;h:outputText styleClass="ui-icon ui-icon-pencil" style="margin:0 auto;" /&gt; &lt;f:setPropertyActionListener value="#{infoAssinaturas}" target="#{mBConsulta_assinaturas.selectedInfoAssinatura}" /&gt; &lt;/p:commandLink&gt; &lt;/p:panelGrid&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; &lt;p:outputPanel id="infoAssinaturasEdit" style="text-align:center;"&gt; &lt;p:dialog widgetVar="infoAssinaturas_editDialog" header="Editar: #{mBConsulta_assinaturas.selectedInfoAssinatura.nomeevento}" resizable="false" modal="true" appendToBody="true"&gt; &lt;h:panelGrid columns="2" style="margin-bottom:10px"&gt; &lt;h:outputLabel value="Habilitada: *" for="habilitada" /&gt; &lt;p:selectBooleanCheckbox value="#{mBConsulta_assinaturas.selectedInfoAssinatura.habilitadaBoolean}" /&gt; &lt;/h:panelGrid&gt; &lt;p:commandButton value="Salvar" styleClass="ui-priority-primary" icon="ui-icon-disk"/&gt; &lt;p:commandButton value="Cancelar" styleClass="ui-priority-primary" icon="ui-icon-cancel"/&gt; &lt;/p:dialog&gt; &lt;/p:outputPanel&gt; &…
type: Question
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/32776749
score: 0
linked to: http://stackoverflow.com/q/30128395
has comment: http://stackoverflow.com/comment/32780238
answer count: 0
duplicate of: http://stackoverflow.com/q/30128395
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33088346
tagged with: components

http://stackoverflow.com/comment/32896459
comment on: http://stackoverflow.com/q/21748767
type: Comment
type: QuestionComment
has text: An HashMultimap ensures there are no duplicate key-value pairs. But a single key can have `1..*` values. You could store that in a single table, but to reduce redudancy in your database model I'd advice using 2 tables: See my answer below.
score: 0

http://stackoverflow.com/q/21815302
has body: I have written some code that retrieves a video from a database. This video is stored as a BLOB file. I have retrieved it in package edu.jay.fyp.featureextractor.database; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import oracle.jdbc.OracleConnection; import oracle.jdbc.OracleResultSet; import oracle.ord.im.OrdVideo; public class OracleConnector { private static final String dbUrl = "jdbc:oracle:thin:@jay_tank-pc:1521:fyp"; private static final String user = "SYSTEM"; private static final String pwd = "xyz"; public static void main(String[] args) { try { Class.forName("oracle.jdbc.OracleDriver"); OracleConnection connection = (OracleConnection) DriverManager.getConnection(dbUrl,user,pwd); System.out.println("Connected"); String query = "select video_name, video_content from system.videos where sr_no = '1'"; PreparedStatement ps = connection.prepareStatement(query); OracleResultSet rs = (OracleResultSet) ps.executeQuery(); OrdVideo videoProxy = null; if(rs.next()){ rs.getORAData("video_content", OrdVideo.getORADataFactory()); } //System.out.println(videoProxy.getBitRate()); } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } I used code similar to the code given in Oracle's documentation, but when I run my code, I get the following exceptions: Exception in thread "main" java.lang.ClassCastException: oracle.sql.BLOB cannot be cast to oracle.sql.STRUCT at oracle.ord.im.OrdVideo.create(OrdVideo.java:1797) at oracle.ord.im.OrdVideo$1.create(OrdVideo.java:1786) at oracle.jdbc.driver.Accessor.getORAData(Accessor.java:1387) at oracle.jdbc.driver.OracleResultSetImpl.getORAData(OracleResultSetImpl.java:1408) at oracle.jdbc.driver.OracleResultSet.getORAData(OracleResultSet.java:632) at edu.jay.fyp.featureextractor.database.OracleConnector.main(OracleConnector.java:28)
score: 0
answer count: 1
has title: Error in casting of objects in oracle multimedia
linked to: http://stackoverflow.com/q/8445960
has answer: http://stackoverflow.com/a/21830330
tagged with: oracle-database
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21830330
has comment: http://stackoverflow.com/comment/33025360
tagged with: java
tagged with: multimedia
type: Question
has comment: http://stackoverflow.com/comment/33015048
tagged with: database

http://stackoverflow.com/comment/33020702
type: Comment
comment on: http://stackoverflow.com/a/21817857
score: 0
type: AnswerComment
has text: Very nice solution but would fail if I pass text="A Luke Johnston" and query="luke j", because in the for loop, it will fail for i=2 as it will be comparing johnston with luke j.

http://stackoverflow.com/comment/33078894
has text: Do you get these errors on a specific device? multiple devices?
score: 0
comment on: http://stackoverflow.com/q/21826670
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32936440
comment on: http://stackoverflow.com/q/21749626
score: 0
has text: The database mail\aaa.nsf has an Access Control List (aka "ACL"). If you have "no access", then somebody who has Manager level access (typically the Domino administrators) must give you access. Note, however, that this new information conflicts with what you said earlier -- that you can send emial with the Notes client. If that is true, then you must have been accessing some mail database to do that, so apparently aaa.nsf is not the correct database.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21737122
answers question: http://stackoverflow.com/q/21736971
has comment: http://stackoverflow.com/comment/32875510
has comment: http://stackoverflow.com/comment/32876571
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/32875893
type: Answer
has comment: http://stackoverflow.com/comment/32875377
has comment: http://stackoverflow.com/comment/32875084
has comment: http://stackoverflow.com/comment/32876225
has comment: http://stackoverflow.com/comment/32876529
has comment: http://stackoverflow.com/comment/32875700
has body: I'm guessing here because you didn't provide much in the way of details. You could do this: class ScribbleInput { private static ScribbleInput INSTANCE = new ScribbleInput(); private ScribbleInput() {} public static String getString(String foo, String bar) { return INSTANCE.getString(foo, bar); } } If you don't have access to the class itself, you could wrap it with another object that acts as a proxy. If you give me more detail I should be able to give you a better answer.
accepted answer of: http://stackoverflow.com/q/21736971
has comment: http://stackoverflow.com/comment/32875962

http://stackoverflow.com/q/21826685
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/21829340
downvote count: 0
tagged with: egit
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33036525
score: 2
has title: How do I break down a large merge with conflicts into more manageable chunks?
has body: I maintain a large git repository with 50,000 files in it. The mainline development branch is called "develop". I have a branch called "feature" that has been worked on almost independently for 5 months. It hasn't been possible to merge from "develop" due to the complexity of the work which but now it is near completion it wants to resync with "develop". Typically that means doing commit merge from "origin/develop" into "feature", fixing the conflicts, testing, committing, and pushing. but there are a very large number of conflicts in this merge point. I count ~4000 merged changes and ~450 unmerged changes. Some of these conflicts are trivial enough (e.g. .gitignore files and so forth) but many are substantial rewrites and hard to resolve In addition these conflicts cross over various software domains. Developers from each domain will have to resolve conflicts in their own areas. It's going to take several days at least of concerted effort to remove the conflicts and commit it. Is there a way I can break this down so domain owners can merge their own conflicts in parallel while preserving the commit merge point? Is there such a thing as a partial commit merge where I commit the merged stuff and not the unmerged? My main other thought is that "feature" could merge from some intermediate tags within "develop", e.g. we have release tags "a", "b", "c", "d" during the last 5 months. So if they merge up to "a" and then "b" and so on, each merge will be less complex, however there might be more conflicts over all. Are there any other things I could try?
favorite count: 0
type: Question
upvote count: 2
answer count: 1
tagged with: git

http://stackoverflow.com/comment/33042833
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21831577
has text: Well, you said you are using JDK 1.4, but the format method in the description says "since 1.5"
score: 6

http://stackoverflow.com/q/21762890
has comment: http://stackoverflow.com/comment/32920856
tagged with: java
has body: Initially i just initialize an array like Integer[] array = new Integer[10]; and iam using this array in a adapter , so if we re-initialize using new the adapter need to be recreated. Is there any way to allocate additional memory to the created array? as well as to cut down object? eg: if i have 5 more elements can i extend the array to a size of 15 ? Note: Using Collections like ArrayList or Vectors is a way but its operations require complex management for my use. So is there any array operation to do the above work?
has title: Is it possible to cut down or add up an initialized array?
tagged with: arrays
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/32920746
duplicate of: http://stackoverflow.com/q/13197702
answer count: 0
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/21858204
downvote count: 0
score: 1
has body: There's an example on the FOP website that explains exactly this. The SAX events emitted from the XSLT transformation are directly fed into FOP. No buffering in a file or in memory.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21832275
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21832275
type: Answer

http://stackoverflow.com/comment/33137741
has text: I know, but what it can be? I'm not doing any interprocess job when/where this error occurs.
type: AnswerComment
score: 6
type: Comment
comment on: http://stackoverflow.com/a/21826802

excel
tags question: http://stackoverflow.com/q/21728168
tags question: http://stackoverflow.com/q/21829062
tag name: excel
tags question: http://stackoverflow.com/q/21732244
tags question: http://stackoverflow.com/q/21720661
tags question: http://stackoverflow.com/q/21687672
tags question: http://stackoverflow.com/q/21724192
tags question: http://stackoverflow.com/q/21822268
tags question: http://stackoverflow.com/q/21833615
tags question: http://stackoverflow.com/q/21721011
type: Tag
tags question: http://stackoverflow.com/q/21771711
tags question: http://stackoverflow.com/q/21730285
tags question: http://stackoverflow.com/q/21786589
tags question: http://stackoverflow.com/q/21828403
tags question: http://stackoverflow.com/q/21808864
tags question: http://stackoverflow.com/q/21701234
tags question: http://stackoverflow.com/q/21708516
tags question: http://stackoverflow.com/q/21817839
tags question: http://stackoverflow.com/q/21704402

http://stackoverflow.com/q/21787035
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/21787217
has answer: http://stackoverflow.com/a/21787217
has answer: http://stackoverflow.com/a/21787206
downvote count: 1
has body: I always read the blog Java Revisited and today I was reading the article Why use PreparedStatement in Java JDBC - Example Tutorial. At one point the author writes about parameterization of queries, that is better, safer and more performative use the parameterization provided by the API than to concatenate strings and uses the examples below: SQL Query 1: PreparedStatement with String concatenation String loanType = getLoanType(); PreparedStatement pstmt = conn.prepareStatement("select banks from loan where loan_type=" + loanType); SQL Query 2: Parameterized query using PreparedStatement PreparedStatement pstmt = conn.prepareStatement("select banks from loan where loan_type=?"); pstmt.setString(1, loanType); The author explains that by using the parameterization, JDBC driver will check the data and with concatenated String the driver doesn't, it will just run the sent SQL, i.e., if we have that famous OR 1 = 1 the query will always return true and there's the classic SQL Injection case. What was not clear to me is why one is more performative than the other, plus, in case I have a value that is always the same, is this true too? PreparedStatement pstmt = conn.prepareStatement(select * from users where active = 'S'); Or is it more performative use as below: PreparedStatement pstmt = conn.prepareStatement(select * from users where active = ?); pstmt.setString(1, "S"); Another question, in this case I think the security issue is the same, because as there is no parameter passing through the user there is no attack, right?
has answer: http://stackoverflow.com/a/21787278
type: AnsweredQuestion
score: 1
tagged with: java
has title: Is it better to parameterize your PreparedStatement even if the value is always the same?
type: Question
has comment: http://stackoverflow.com/comment/33042399
accepted answer: http://stackoverflow.com/a/21787206
has answer: http://stackoverflow.com/a/21787240
tagged with: sql
tagged with: sql-injection
tagged with: jdbc
answer count: 4

http://stackoverflow.com/comment/33032435
score: 0
type: Comment
has text: Sorry this does not help in my condition. Mine other data are in database. And the image has to change automatically when the condition changes in the list. The condition is startTraining().
type: AnswerComment
comment on: http://stackoverflow.com/a/21823999

http://stackoverflow.com/comment/32776772
has text: I first did a try catch block but that would require one extra cycle every time there is a number format exception. So I was hoping to get a regular expression, as I was told these are pretty efficient.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21681825

http://stackoverflow.com/comment/33006826
score: 0
type: AnswerComment
type: Comment
has text: changed the answer to a possible solution. Its java 7 based else you need to create a kind of enum with the possible names and use the `enum.valueOf(e.getName())` If you want it more dynamic you need to create a document where all allowed classes are contained and check the `e.getName()` against the allowed classes. Maybe use Java reflections to get the right constructor just by the name of the class. But this does have a bad performance! Moreover with this solution you can fast write an editor for it with java Swing and jdom2.
comment on: http://stackoverflow.com/a/21810767

http://stackoverflow.com/a/72974818
downvote count: 0
answers question: http://stackoverflow.com/q/21746294
type: Answer
has body: Go to Windows &gt;&gt; Preferences » Java » Editor » Content Assist. Then Check the Auto activation triggers for java, Add this in the text box .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
upvote count: 5
score: 5

http://stackoverflow.com/q/21759479
tagged with: java
has comment: http://stackoverflow.com/comment/32914348
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21760001
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/32915338
type: Question
upvote count: 2
has body: Ima trying to click all the elements present in the Html http://www.flipkart.com/ Under this Electronics -> Shop by Categories -> below is the sample part of the Html Samsung All Brands All Brands iam clicking using below WebElement ul = driver.findElement(By.id("menu-electronics-tab-0-content")); List<WebElement> lis = ul.findElements(By.tagName("li")); System.out.println(""+lis.size()); String[] linksText = new String[lis.size()]; int index = 0; for(WebElement element : lis){ linksText[index] = element.getText(); String string = linksText[index]; if(string.contains(" ")){ linksText[index]= string.substring(0, string.indexOf(" ")); } index++; } for(index =0; index < linksText.length; index++){ String xpath = "//*[contains(@href,'%s')]"; String y = linksText[index]; String xpathOfElement = String.format(xpath, String.valueOf(y)); System.out.println("Name 1 "+driver.findElement(By.xpath(xpathOfElement)).getText()); driver.manage().timeouts().implicitlyWait(50000, TimeUnit.MILLISECONDS); driver.findElement(By.xpath(xpathOfElement)).click(); When iam running the code it is proceeding till i = 12 till HP after that it is throwing an error. there are 83 Elements present. i need to click and navigate back Name 1 Mobiles Name 1 Bluetooth Headsets Name 1 Laptops Name 1 Apple Name 1 FAILED: Electronic org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Command duration or timeout: 50.20 seconds Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15' System info: host: 'VALUED-8JGOG5PH', ip: '192.168.1.4', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_45' Session ID: 7d9304d9-fe1a-444d-b6b6-4669bfc46a33 Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, browserConnectionEnabled=true, webStorageEn…
answer count: 1
tagged with: selenium-webdriver
has title: How to Click a Link in Selenium Webdriver
has answer: http://stackoverflow.com/a/21760001

http://stackoverflow.com/a/49203073
type: Answer
score: 2
has body: You can also try DeltaHex Editor plugin for IntelliJ based IDEs which can show window with typical hex + text preview for byte array in debugger. Plugin is available in Settings/Plugins/Browse repositories/Search for DeltaHex
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/21771305

http://stackoverflow.com/q/21765969
upvote count: 1
possible better answer: http://stackoverflow.com/a/21766038
downvote count: 1
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/32927231
has body: I am learning to program Java. My objective is to create client server application based on Java and MySQL. That would have following. Server Application where all admin controls would be available to configure. server application will be the only to have access rights to MySQL. Server will have all functions and objects that clients will require and call and get that functionality. (Reason for that is "I don't want to share MySQL credentials to client apps or rather i don't want MySQL credentials to be transmitted on the network to clients"). As it would increase maintenance tough and it could be a security loop hole. An analogy of functionality could be: client calls to server telling to add an Order such addOrder(order_id, payment,..,...,..) and so on. What are the method in practice for such kind of application these days? A example code/or material to get in right direction would suffice
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21766038
has comment: http://stackoverflow.com/comment/32926764
has comment: http://stackoverflow.com/comment/32926677
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32926621
has title: How to create objects in server application and be able to call them from client application
answer count: 2
has answer: http://stackoverflow.com/a/21766560
accepted answer: http://stackoverflow.com/a/21766560

http://stackoverflow.com/a/21764731
accepted answer of: http://stackoverflow.com/q/21763096
type: Answer
upvote count: 1
downvote count: 1
has body: Please take a look at this page: http://mojo.codehaus.org/gwt-maven-plugin/run-mojo.html There you can find all properties you can set for you gwt:run target. This is how you define the module in you pom.xml: org.codehaus.mojo gwt-maven-plugin ${gwtVersion} com.google.gwt gwt-user ${gwtVersion} com.google.gwt gwt-dev ${gwtVersion} compile index.html com.yourcompany.YourModule INFO true true -Xms512m -Xmx8g -XX:MaxPermSize=512m 8 true <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> By the way, you should use the latest GWT and GWT Maven Plugin (currently 2.7.0).
has comment: http://stackoverflow.com/comment/43680346
score: 0
answers question: http://stackoverflow.com/q/21763096
type: AcceptedAnswer

http://stackoverflow.com/comment/33147014
type: QuestionComment
has text: @Leo I'm using an embedded amq over an oracle db. I finally found out what the problem was, it had to do with the oracle drivers I had been using.
score: 0
comment on: http://stackoverflow.com/q/21760679
type: Comment

http://stackoverflow.com/comment/33041912
comment on: http://stackoverflow.com/a/21831089
score: 0
type: AnswerComment
type: Comment
has text: or a sorted arraylist with binary search

http://stackoverflow.com/q/21750913
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21750987
tagged with: java
accepted answer: http://stackoverflow.com/a/21750987
type: Question
tagged with: annotation-processing
answer count: 1
score: 0
has title: AnnotationProcessing - create ExecutableElement
has body: I'm using Elements.getElementValuesWithDefaults to retrieve annotationvalues. Key of the returned Map is something extending ExecutableElement. I can iterate over the entrySet and check the name of each key but this leads to ugly if-else-cascades. Map&lt;? extends ExecutableElement, ? extends AnnotationValue&gt; annotationValues = elementUtils.getElementValuesWithDefaults(annotationMirror); for (Map.Entry&lt;? extends ExecutableElement, ? extends AnnotationValue&gt; entry : annotationValues.entrySet()) { if (entry.getKey().getSimpleName().contentEquals("method1")) { // do something with value of method1 } else if (entry.getKey().getSimpleName().contentEquals("method2")) { // do something with value of method2 } else if (entry.getKey().getSimpleName().contentEquals("method3")) { // do something with value of method3 } } I did not find an easy way to create an ExecutableElement as key to get the value. Anyone knows one?

http://stackoverflow.com/a/21737609
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/21737549
has body: This piece of code: for(int i=0;i&lt;100;i++){ new EvenCheckerThread(even).run(); } does not run the code in new Thread, so everything gets properly executed in one single sequence. You created an instance of the class Thread, but the run() method simply executes on the current Thread. Instead, try to call the start() method to actually start a new Thread.: for(int i=0;i&lt;100;i++){ new EvenCheckerThread(even).start(); }
answers question: http://stackoverflow.com/q/21737549
type: Answer
has comment: http://stackoverflow.com/comment/32876410
has comment: http://stackoverflow.com/comment/32876296
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/32967798
has text: I edited the question to take this also into consideration. Although my first version does not consider those peaks, it will still return a valid peak as defined by you. I assume that you don't care which peak will actually be returned. The second version should give the same results as your implementation.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21788530
score: 0

http://stackoverflow.com/comment/32816081
comment on: http://stackoverflow.com/a/21702427
has text: much better with your answers.. but I'm not really done! I wanted to try with a jpg file now, but I have 2 problems: 1) I'm getting the link displayed on the panel, and not the image, 2) when I click on it, it getting me to a white page and i'm not getting the image displayed at least on that page. I tried `private static final String[] IMAGE_NAMES = new String[] {"C:\\Users\\Public\\Pictures\\Sample Pictures\\Desert.jpg"};` and it is changed on the browser address tab to: `THE_PATH_GIVEN_IN_THE_MOUNT_RESOURCE_METHOD/**C:%5CUsers%5CPublic%5CPictures%5CSample%20Pictures%5CDesert.jpg**`
type: AnswerComment
score: 0
type: Comment

event-dispatch-thread
tags question: http://stackoverflow.com/q/21704379
tag name: event-dispatch-thread
type: Tag

http://stackoverflow.com/a/64786642
score: 2
downvote count: 0
has body: Here is the solution I tried with Gradle 6.7 Runnable fat Jar (with all dependent libraries copied to the jar) task fatJar(type: Jar) { manifest { attributes 'Main-Class': 'com.example.gradle.App' } from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } with jar } Runnable jar with all dependencies copied to a directory and adding the classpath to the manifest def dependsDir = &quot;${buildDir}/libs/dependencies/&quot; task copyDependencies(type: Copy) { from configurations.compile into &quot;${dependsDir}&quot; } task createJar(dependsOn: copyDependencies, type: Jar) { manifest { attributes('Main-Class': 'com.example.gradle.App', 'Class-Path': configurations.compile.collect { 'dependencies/' + it.getName() }.join(' ') ) } with jar } How to use ? Add the above tasks to build.gradle Execute gradle fatJar //create fatJar Execute gradle createJar // create jar with dependencies copied. More details : https://jafarmlp.medium.com/a-simple-java-project-with-gradle-2c323ae0e43d
answers question: http://stackoverflow.com/q/21721119
upvote count: 2
type: Answer

http://stackoverflow.com/a/21757542
has comment: http://stackoverflow.com/comment/32911649
has comment: http://stackoverflow.com/comment/32911938
answers question: http://stackoverflow.com/q/21757309
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32910996
has comment: http://stackoverflow.com/comment/32912047
has comment: http://stackoverflow.com/comment/32911239
has comment: http://stackoverflow.com/comment/32911071
type: Answer
accepted answer of: http://stackoverflow.com/q/21757309
has comment: http://stackoverflow.com/comment/32911825
upvote count: 3
has comment: http://stackoverflow.com/comment/32911156
has comment: http://stackoverflow.com/comment/32911297
score: 3
has comment: http://stackoverflow.com/comment/32912108
has body: I assume that you want the String "FF FF FF FF FF FF FF FF" as an array of ints and not as an single int, because its to big for int and -1 as long. String hexString = "FF FF FF FF FF FF FF FF"; String[] hexNumbers = hexString.split(" "); //split the string int[] ints = new int[hexNumbers.length]; for(int i = 0; i&lt;hexNumbers.length; i++) { ints[i] = Integer.parseInt(hexNumbers[i], 16); //convert from hexString to int } for(int i = 0; i&lt;ints.length; i++) { System.out.println(ints[i]); } Output: 255 255 255 255 255 255 255 255 There are two reasons for your NumberFormatException. First there are whitespaces in the String and secound, if you remove them it is "FFFFFFFFFFFFFFFF" much bigger than 2^31-1 (max size of an positive int).
has comment: http://stackoverflow.com/comment/32911383

http://stackoverflow.com/comment/32930342
comment on: http://stackoverflow.com/q/21767963
type: Comment
has text: `static` variables.... ?
score: 0
type: QuestionComment

http://stackoverflow.com/q/21695896
linked to: http://stackoverflow.com/q/14314692
has answer: http://stackoverflow.com/a/21696420
tagged with: mongodb-query
has answer: http://stackoverflow.com/a/21696452
type: AnsweredQuestion
tagged with: java
tagged with: mysql
possible better answer: http://stackoverflow.com/a/21696420
type: Question
tagged with: mongodb
has title: Sort the values by Date in mongodb
score: 4
accepted answer: http://stackoverflow.com/a/21696452
upvote count: 4
answer count: 2
downvote count: 0
favorite count: 0
has body: I am new to mongodb and I am trying to sort all my rows by date. I have records from mixed sources and I trying to sort it separately. I didn't update the dateCreated while writing into db for some records. Later I found and I added dateCreated to all my records in the db. Say I have total of 4000 records, first 1000 I don't have dateCreated. Latest 3000 has that column. Here I am trying to get the last Updated record using dateCreated column. Here is my code. db.person.find({"source":"Naukri"}&amp;{dateCreated:{$exists:true}}).sort({dateCreated: 1}).limit(10) This code retruns me some results (from that 1000 records) where I can't see that dateCreated column at all. Moreover if I change (-1) here {dateCreated: -1} I am getting results from some other source, but not Naukri. So I need help this cases, How do I sort by dateCreated to get the latest updated record and by sources also. I am using Java API to get the records from Mongo. I'd be grateful if someone helps me to find how I will use the same query with java also. Hope my question is clear. Thanks in advance.
has comment: http://stackoverflow.com/comment/32802514

http://stackoverflow.com/a/21852594
has comment: http://stackoverflow.com/comment/33081648
has body: To trigger the workflow from your applet, consider running KNIME in CLI mode, as described here. Make use of some workflow variables to set the input/output file path to your workflow as described in the given FAQ. A potential issue I see might be some latency caused by the startup time of the application. [edit] After thinking for a second time, I have some doubts that it's at all possible to start a local application from an applet. In fact, I strongly assume, it's not possible :) If you want to stick to your applet, you could add some intermediate REST service though, with which the applet interacts. After submitting the input data, the server side triggers the workflow and returns the result. Or you switch to some standard Swing application instead.
score: 0
has comment: http://stackoverflow.com/comment/33081726
type: Answer
has comment: http://stackoverflow.com/comment/33081783
answers question: http://stackoverflow.com/q/21831466

http://stackoverflow.com/comment/32883516
comment on: http://stackoverflow.com/q/21741619
type: QuestionComment
score: 1
has text: @JustinC ... I know you're trying to be funny, and I appreciate the effort. Questions need to be *good* questions, regardless of their complexity. This isn't a good, there are a few reasons why, and these reasons are documented. Probably the same reason you took the time to be sarcastic and miss the point.
type: Comment

http://stackoverflow.com/comment/32813518
comment on: http://stackoverflow.com/q/21701398
score: 0
type: Comment
type: QuestionComment
has text: No, with the nice help of the SO community it is all there now. I hope you get the help you need.

http://stackoverflow.com/a/21705908
has body: JConsole is good tool, but i prefer to use visualVM, its free and more powerful tool to track the J2EE performance application, some of its features: Provide a CPU profiling. Provide all info about Threads. Provide the JVM Heap and the memory states. Provide Info about the GC activities. And its not creating any issue, it maybe has some performance impact in the load test, but you will not notice that.
score: 1
answers question: http://stackoverflow.com/q/21705816
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32783919
has text: Ah, I see what my problem was! I had no idea you could directly interact with the frame that way. I thought it had to be (FrameName).setText and such. Thank you for your help!
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21684634

http://stackoverflow.com/comment/47726351
type: Comment
has text: Please stop commenting that it doesn't work for you. I didn't said my comment is always a solution. It is a solution sometimes. My comment was just a heads up for checking this, and I thought it may be handy. As I said : "It's not always a bug. I actually had the wrong provider configured." Maybe it's a common mistake.
comment on: http://stackoverflow.com/a/26698752
type: AnswerComment
score: 2

http://stackoverflow.com/comment/32952868
comment on: http://stackoverflow.com/a/21781054
has text: None. Remove it and clean you project. Then tell us if you have any errors. Project > Clean in Eclipse.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21706415
tagged with: serialization
score: 12
answer count: 2
possible better answer: http://stackoverflow.com/a/21891112
has comment: http://stackoverflow.com/comment/33311163
has comment: http://stackoverflow.com/comment/33309390
tagged with: java
has comment: http://stackoverflow.com/comment/33309165
has answer: http://stackoverflow.com/a/22009950
tagged with: testing
has comment: http://stackoverflow.com/comment/33211683
upvote count: 12
downvote count: 0
tagged with: jackson
type: Question
type: AnsweredQuestion
has title: Jackson ObjectMapper using custom Serializers and Deserializers
has body: I've got a class that configures a Jackson ObjectMapper. It adds in some custom serializers and deserializers for my object types as follows: public class JsonMapperFactory { public static ObjectMapper createObjectMapper() { final SimpleModule module = new SimpleModule("customerSerializationModule", new Version(1, 0, 0, "static version")); addCustomDeserializersTo(module); addCustomSerializersTo(module); final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(module); return objectMapper; } private static void addCustomSerializersTo(final SimpleModule module) { module.addSerializer(DateTime.class, new DateTimeSerializer()); } private static void addCustomDeserializersTo(final SimpleModule objectMapper) { objectMapper.addDeserializer(DateTime.class, new DateTimeDeserializer()); } } I've tested my customer serializers within their own test classes, so in my test of this JsonMapperFactory class, I'm trying to simply check that the ObjectMapper created has the expected serializers (or deserializers) This could be achieve by introspecting the ObjectMapper, but it doesn't seem to have any mechanisms to do this. Does anyone know of a nice way to test that? For deserializers, I have the following: private void assertThatObjectMapperUsesCorrectDeserializer(final Class&lt;?&gt; typeClazz, final Class&lt;?&gt; deserializerClazz) throws JsonMappingException { final DeserializationConfig deserializationConfig = this.objectMapper.getDeserializationConfig(); final JsonDeserializer&lt;Object&gt; deserializer = this.objectMapper.getDeserializerProvider().findTypedValueDeserializer(deserializationConfig, javaTypeFor(typeClazz), null); assertThat(deserializer, is(instanceOf(deserializerClazz))); } private JavaType javaTypeFor(final Class&lt;?&gt; clazz) { return TypeFactory.type(clazz); //deprecated method :( } Which is quite verbose and uses deprecated methods. I'm yet to find a way to do a similar test for the serializers. So I've currently resorted to seri…
tagged with: deserialization
accepted answer: http://stackoverflow.com/a/22009950
has answer: http://stackoverflow.com/a/21891112
favorite count: 0

http://stackoverflow.com/comment/32978595
has text: its working but its not saving the value of qual of the last row..this problem is happening if i am keeping the last qual selected. If i click on any other column after entering the last qual then its adding everything in the data..y its happening..help
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21794814
type: Comment

http://stackoverflow.com/a/50996088
type: Answer
answers question: http://stackoverflow.com/q/21713631
score: 0
has body: Here is a recursive solution, just for fun. import java.util.Arrays; public class PizzaDistributor { public int[] distributePizzaToEatersEvenly(int numSlices, int[] eaters) { if (eaters == null || eaters.length == 0) { return null; } if (eaters.length &gt; numSlices) { for (int i = 0; i &lt; numSlices; i++) { eaters[i] += 1; } } else { int slices = numSlices / eaters.length; for (int i = 0; i &lt; eaters.length; i++) { eaters[i] = slices; } //If there is a remainder to distribute, distribute it evenly, recursively. if ((numSlices % eaters.length) &gt; 0) { distributePizzaToEatersEvenly(numSlices % eaters.length, eaters); } } return eaters; } public static void main(String[] args){ PizzaDistributor pizzaDistributor = new PizzaDistributor (); System.out.println("0 slices, 1 eater:" +Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(0,new int[1]))); System.out.println("0 slices, 2 eaters:" +Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(0,new int[2]))); System.out.println("0 slices, 0 eaters:" +Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(0,new int[0]))); System.out.println("10 slices, 0 eaters:"+Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(10,new int[0]))); System.out.println("10 slices, 1 eater:" +Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(10,new int[1]))); //lucky guy! System.out.println("10 slices, 3 eaters:" +Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(10,new int[3]))); System.out.println("10 slices, 5 eaters:" +Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(10,new int[5]))); System.out.println("10 slices, 7 eaters:" +Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(10,new int[7]))); System.out.println("10 slices, 10 eaters:" +Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(10,new int[10]))); System.out.println("10 slices, 13 eaters:" +Arrays.toString(pizzaDistributor.distributePizzaToEatersEvenly(10,new int[13]))); S…

http://stackoverflow.com/a/21931180
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21726221
answers question: http://stackoverflow.com/q/21726221
has body: This was a system issue - the vm hung. You can catch this kind of condition in one of two ways: monitor the java jvm process monitor the wrapper.log file for errors

http://stackoverflow.com/a/21855801
type: Answer
downvote count: 0
score: 1
has body: There are two patterns that will help you here. The first is the Publisher/Subscriber pattern. This will allow you define subscribers for specific events. The second one, is the Strategy pattern. This pattern will give you a way of structuring message handlers without falling in big if-else cascades or large switch-case statements. You can create objects that subscribe to a particular subset of events. Inside those subscribers, you can create strategies for handling each particular event. This solution is scalable and maintainable, you can add new subscribers and new strategies to each subscriber without big modifications. Also, strategies and subscribers can be unitary tested. For example, you can have game events related with the game play, and chat events. In your server side you would create an publisher object, that gets events from the websocket connection, and then you would create a subscriber than handles the chat events, and a subscriber that handles the actual game play events. Inside of the chat subscriber, you would create different strategies for handling messages like 'chat.start', 'chat.message', 'chat.close', etc... You could add later on a strategy for a new event type, or a subscriber for a new feature easily.
upvote count: 1
answers question: http://stackoverflow.com/q/21831124

http://stackoverflow.com/comment/32835133
type: Comment
has text: @AnthonyGrist ... or more exactly "..., but the caller of the method decides which one".
comment on: http://stackoverflow.com/a/21705238
type: AnswerComment
score: 0

http://stackoverflow.com/a/21741075
has body: You could pass arrays or lists, one type of String and one of JButton. public void testing(String[] strArray, JButton[] btnArray) { }
has comment: http://stackoverflow.com/comment/32882885
upvote count: 8
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/32883060
has comment: http://stackoverflow.com/comment/32882536
has comment: http://stackoverflow.com/comment/32882732
has comment: http://stackoverflow.com/comment/32882485
accepted answer of: http://stackoverflow.com/q/21741048
has comment: http://stackoverflow.com/comment/32882933
has comment: http://stackoverflow.com/comment/32882507
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21741048
has comment: http://stackoverflow.com/comment/32882567
has comment: http://stackoverflow.com/comment/32882584

http://stackoverflow.com/a/21772074
upvote count: 3
has body: Try this public class Main { public static void main(String[] args) { String text = "the quick brown fox jumps fox fox over the lazy dog brown"; String[] keys = text.split(" "); String[] uniqueKeys; int count = 0; System.out.println(text); uniqueKeys = getUniqueKeys(keys); for(String key: uniqueKeys) { if(null == key) { break; } for(String s : keys) { if(key.equals(s)) { count++; } } System.out.println("Count of ["+key+"] is : "+count); count=0; } } private static String[] getUniqueKeys(String[] keys) { String[] uniqueKeys = new String[keys.length]; uniqueKeys[0] = keys[0]; int uniqueKeyIndex = 1; boolean keyAlreadyExists = false; for(int i=1; i&lt;keys.length ; i++) { for(int j=0; j&lt;=uniqueKeyIndex; j++) { if(keys[i].equals(uniqueKeys[j])) { keyAlreadyExists = true; } } if(!keyAlreadyExists) { uniqueKeys[uniqueKeyIndex] = keys[i]; uniqueKeyIndex++; } keyAlreadyExists = false; } return uniqueKeys; } } Output: the quick brown fox jumps fox fox over the lazy dog brown Count of [the] is : 2 Count of [quick] is : 1 Count of [brown] is : 2 Count of [fox] is : 3 Count of [jumps] is : 1 Count of [over] is : 1 Count of [lazy] is : 1 Count of [dog] is : 1
score: 3
has comment: http://stackoverflow.com/comment/32937993
has comment: http://stackoverflow.com/comment/32938223
downvote count: 0
has comment: http://stackoverflow.com/comment/32937853
type: Answer
answers question: http://stackoverflow.com/q/21771566

http://stackoverflow.com/comment/32791508
score: 0
type: AnswerComment
type: Comment
has text: I am a bit confused, how would the method signature look after compilation. will it hold type information or not?
comment on: http://stackoverflow.com/a/21689808

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

http://stackoverflow.com/q/21785557
upvote count: 1
type: Question
tagged with: graphics
score: 1
tagged with: java
has title: how to add icon in JFXPanel
downvote count: 0
answer count: 1
has body: Hello i am a bit new on JavaFx , i get a source code on oracle website and i want to add an icon in JFXPanel.How to insert an icon in the JFXPanel.The icon should be position. Here is the code: public class Test { private static void initAndShowGUI() { // This method is invoked on the EDT thread JFrame frame = new JFrame("Swing and JavaFX"); final JFXPanel fxPanel = new JFXPanel(); JScrollPane pane = new JScrollPane(fxPanel,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); frame.add(pane); frame.setSize(300, 200); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Platform.runLater(new Runnable() { @Override public void run() { initFX(fxPanel); } }); } private static void initFX(JFXPanel fxPanel) { // This method is invoked on the JavaFX thread Scene scene = createScene(); fxPanel.setScene(scene); } private static Scene createScene() { ImageIcon icon=new ImageIcon ( "icon/filter.jpg" ); // add icon here return (scene); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { initAndShowGUI(); } }); } }
favorite count: 0
has answer: http://stackoverflow.com/a/21786261
type: UnansweredQuestion
tagged with: javafx-2
tagged with: javafx

http://stackoverflow.com/comment/33023861
has text: I downvoted your original answer, "You need to set an initial value for the checksCost variable" because it wasn't particularly educational. After your edit, I undownvoted.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21820494
type: AnswerComment

http://stackoverflow.com/comment/32906950
type: Comment
has text: If you are defining class in C#, then you can append the keyword static and you won't need to implement a private constructor.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21703737

http://stackoverflow.com/comment/32790037
type: Comment
has text: Thank you for the comment but I have not created my ActorSystem with ExecutionContext. And second question executionContext is implicit variable, how should I pass it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21688848

http://stackoverflow.com/a/21686710
downvote count: 0
answers question: http://stackoverflow.com/q/21686574
has body: double[] darr = new double[50]; If you want a List of double array then you could user Arrays.asList(T...) List&lt;double[]&gt; darrList = Arrays.asList(darr); If you want a list of double then you have to create a list, loop over the elements of the array and add each to the list List&lt;Double&gt; dList = new ArrayList&lt;Double&gt;(darr.length); for(double d : darr) { dList.add(d); }
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/21805287
tags question: http://stackoverflow.com/q/21682386
type: Tag
tags question: http://stackoverflow.com/q/21734397
tag name: csv
tags question: http://stackoverflow.com/q/21814830
tags question: http://stackoverflow.com/q/21785700
tags question: http://stackoverflow.com/q/21699231
tags question: http://stackoverflow.com/q/21701234
tags question: http://stackoverflow.com/q/21802719
tags question: http://stackoverflow.com/q/21733699
tags question: http://stackoverflow.com/q/21827958
tags question: http://stackoverflow.com/q/21794050

http://stackoverflow.com/comment/33033942
type: QuestionComment
has text: This question appears to be off-topic because the question doesn't even show the minimal effort of googling the problem.
comment on: http://stackoverflow.com/q/21825887
score: 3
type: Comment

http://stackoverflow.com/a/21820826
type: Answer
has comment: http://stackoverflow.com/comment/33026205
accepted answer of: http://stackoverflow.com/q/21820779
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33089516
answers question: http://stackoverflow.com/q/21820779
has body: This depends on how you build your project, but in the end the message.validation.properties file should up on the classpath, ie. WEB-INF/classes. If it is directly in there, you would specify classpath:messages.validation I'll assume that your src folder is a source folder in your IDE. As such, anything under it will be compiled/copied so that it ends up in the classpath directory. As such, you should be using classpath:resources/messages.validation Again, if /src/resources is the source folder, then you need classpath:messages.validation
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33089734

http://stackoverflow.com/comment/32828937
has text: "But this method returns a very long string" yes, that's because image files are generally large. That's just the nature of the beast. It doesn't help that you're specifying a quality value of 100...
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21711094

http://stackoverflow.com/q/21725594
downvote count: 0
possible better answer: http://stackoverflow.com/a/21725686
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/21725686
has body: Please consider the following example: public final class ImmutableWrapper&lt;T extends Number&gt; { private final T value; public ImmutableWrapper(T value) { // a subclass of Number may be mutable // so, how to defensively copying the value? this.value = value; } public T getValue() { // the same here: how to return a copy? return value; } } In order to make this class immutable, I must defensively copy any mutable parameter passed to the constructor and create copies of internal mutable objects returned by public methods. Is this possible? If not, is there any workaround?
has answer: http://stackoverflow.com/a/21725698
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32859538
score: 7
tagged with: java
upvote count: 7
type: Question
accepted answer: http://stackoverflow.com/a/21725698
has comment: http://stackoverflow.com/comment/32859084
has comment: http://stackoverflow.com/comment/32854644
answer count: 2
has title: Defensive copying of Number subclass

http://stackoverflow.com/a/21780224
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21779995
has body: I'm pretty sure the regex is only added to make sure nothing "illegitimate" remains. The normalizer does the heavy lifting. According to the javadoc, you can check "http://www.unicode.org/reports/tr15/tr15-23.html" for more information regarding the NFD normalization.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32845054
has text: if( pos <= fruits.length){ return fruits[pos-1]; }
comment on: http://stackoverflow.com/q/21720243
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21712919
has comment: http://stackoverflow.com/comment/32832611
has comment: http://stackoverflow.com/comment/32834151
answer count: 2
downvote count: 2
tagged with: random
has comment: http://stackoverflow.com/comment/32835569
has comment: http://stackoverflow.com/comment/32832728
has comment: http://stackoverflow.com/comment/32832633
favorite count: 0
has comment: http://stackoverflow.com/comment/32832704
has comment: http://stackoverflow.com/comment/32832666
type: AnsweredQuestion
upvote count: 0
has body: So I have been searching everywhere for a way to do this and I can't find a method that would satisfy what my professor wants. He wants us to create a random number with a random seed, that is then tested to see if it is a any number in a set of numbers, then change until it is any number that is not one of that set of numbers. The catch is we are not allowed to use loops of any form other than if statements nor or allowed to use recursions in the process of doing this. Please help.
tagged with: numbers
has comment: http://stackoverflow.com/comment/32835701
tagged with: java
accepted answer: http://stackoverflow.com/a/21714386
tagged with: loops
has comment: http://stackoverflow.com/comment/32835826
has comment: http://stackoverflow.com/comment/32832579
has comment: http://stackoverflow.com/comment/32833110
possible better answer: http://stackoverflow.com/a/21713133
type: Question
has comment: http://stackoverflow.com/comment/32833040
has title: Random Number Issue Java
has answer: http://stackoverflow.com/a/21713133
has comment: http://stackoverflow.com/comment/32832825
has comment: http://stackoverflow.com/comment/32832612
score: -2
has answer: http://stackoverflow.com/a/21714386
has comment: http://stackoverflow.com/comment/32832555

http://stackoverflow.com/comment/32774361
score: 1
has text: Why do you need to wait for a couple of seconds before starting the activity?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21680608

http://stackoverflow.com/a/52273003
answers question: http://stackoverflow.com/q/21783391
has body: An other cause of this problem is corruption of maven repository jars so you can use the following command to solve the problem : mvn dependency:purge-local-repository
type: Answer
score: 0

http://stackoverflow.com/q/21802323
score: 0
tagged with: java
has body: I need to query the DB but the parameter values from that query need to come from a file, here is the code... BufferedReader reader = new BufferedReader(new FileReader("C:/DBMigrations/empIDs.txt")); String line = null; String query = "select name, address from Employee where id in ("; while ((line = reader.readLine()) != null) { // the value of line needs to be plugged into query inside the in clause } I am using Spring's SimpleJdbcTemplate. Thanks in advance for any help.
answer count: 1
has answer: http://stackoverflow.com/a/21802413
has comment: http://stackoverflow.com/comment/32991322
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/326390
type: Question
tagged with: file-io
accepted answer: http://stackoverflow.com/a/21802413
tagged with: spring-jdbc
has title: How to dynamically add parameter values to JdbcTemplate query?

http://stackoverflow.com/comment/113874305
comment on: http://stackoverflow.com/a/59548080
has text: Oh man, I don't say this often, but I love you man. I would've kept searching for hours if not days. They need to put it in docs
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/21800495
upvote count: 4
possible better answer: http://stackoverflow.com/a/31603316
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/31603316
has comment: http://stackoverflow.com/comment/32988110
has answer: http://stackoverflow.com/a/21800675
type: AnsweredQuestion
score: 3
has body: I want to know why does this code not execute? I'm trying to send my data from my device via POST method but there is no error. The app just finishes by itself on my device by communicating "My app was stopped.: Here is execution: KlientNameValue kn = new KlientNameValue(getApplicationContext()); kn.new MyAsyncTask().execute(zam.klient.getNazwa(),zam.klient.getNip(),zam.klient.getAdres()); And here is code: public class KlientNameValue { List&lt;NameValuePair&gt; KlientNameValuePairs = new ArrayList&lt;NameValuePair&gt;(); Context context; public KlientNameValue(Context context) { super(); this.context=context; } public class MyAsyncTask extends AsyncTask&lt;String, Void, Void&gt; { @Override protected Void doInBackground(String... params) { // TODO Auto-generated method stub postData(params[0], params[1], params[2]); return null; } @Override protected void onPostExecute(Void result) { Toast.makeText(context , "Zlecenie zostało wysłane", Toast.LENGTH_LONG).show(); } void postData(String nazwa, String nip, String adres) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("here is my default link :)"); try { // Add your data KlientNameValuePairs = new ArrayList&lt;NameValuePair&gt;(); KlientNameValuePairs.add(new BasicNameValuePair("Kli_imie", nazwa)); KlientNameValuePairs.add(new BasicNameValuePair("Kli_adres", adres)); KlientNameValuePairs.add(new BasicNameValuePair( "Kli_nr_telefonu", nip)); httppost.setEntity(new UrlEncodedFormEntity( KlientNameValuePairs)); HttpResponse response = httpclient.execute(httppost); //httppost.setEntity(new UrlEncodedFormEntity( // ZamowienieNameValuePairs)); // HttpResponse response1 = } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } Error: 02-15 17:45:24.695: E/AndroidRuntime(21890): at android.widget.Toast.&lt;init&gt;(Toast.java:94) 02-15 17:47:19.343: W/SingleClientConnManager(22288): Invalid use of SingleClientConnManager: connection still allocated. 02-15 1…
tagged with: java
has comment: http://stackoverflow.com/comment/32987889
type: Question
answer count: 2
has title: Invalid use of SingleClientConnManager: connection still allocated
favorite count: 0
has comment: http://stackoverflow.com/comment/32988014
tagged with: android
has comment: http://stackoverflow.com/comment/32987737
downvote count: 1
accepted answer: http://stackoverflow.com/a/21800675

http://stackoverflow.com/q/21776742
upvote count: 1
has title: Why capturing binary data in Filter Servlet fails in the following code?
favorite count: 0
type: UnansweredQuestion
tagged with: servlet-filters
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/22799121
downvote count: 0
score: 1
tagged with: java
tagged with: servlets
type: Question
has body: I have a java servlet application where I want to capture the response body and then do some processing. I am using servlet filter for capturing the response. The problem I am facing is that I am not sure how to capture the binary response (sorry I am new to servlets and all). Following is the implementation: Filter Code public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest)req; HttpServletResponse response = (HttpServletResponse)res; //If I change CharResponseWrapper by ByteResponseWrapper then I get 0 length content CharResponseWrapper wrappedResponse = new CharResponseWrapper((HttpServletResponse)response); if ( null != filterChain){ filterChain.doFilter(request, wrappedResponse); } response.getOutputStream().write(wrappedResponse.toString().getBytes()); } ByteResponseWrapper import java.io.ByteArrayOutputStream; import java.io.PrintWriter; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; public class ByteResponseWrapper extends HttpServletResponseWrapper { private ByteArrayOutputStream output; public ByteResponseWrapper(HttpServletResponse response) { super(response); output = new ByteArrayOutputStream(); } public String toString() { System.out.println(output.size()); return new String(output.toByteArray()); } public PrintWriter getWriter() { return new PrintWriter(output); } } CharResponseWrapper import javax.servlet.http.*; import java.io.*; public class CharResponseWrapper extends HttpServletResponseWrapper { private StringWriter output; public CharResponseWrapper(HttpServletResponse response) { super(response); output = new StringWriter(); } public String toString() { return output.toString(); } public PrintWriter getWriter() { return new PrintWriter(output); } } Any idea why using ByteResponseWrapper gives zero body response? Please suggest if I am missing something or not doing correctl…
answer count: 1
tagged with: binary-data

http://stackoverflow.com/comment/32811088
has text: No, there times when you want to split a public method into private methods for readability and you want to mutate a list without the overhead of copying it into a new list every time. As I have said, I try to avoid it but sometimes I think it's ok in a private method. And this list cannot be a parameter to a public method (ie it must have been created somewhere in the method).
comment on: http://stackoverflow.com/a/21700657
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/50527269
type: Answer
answers question: http://stackoverflow.com/q/21706664
has body: In social API you have ability just to fetch the image binary file: byte[] profileImage = facebook.userOperations().getUserProfileImage(imageType); To get URL you need to have something custom (as mentioned in the post above). I took the part of code from Facebook Social API (see Facebook template source code for fetchImage) and the following utility class: public final class FacebookUtils { private static final String PICTURE_PATH = "picture"; private static final String TYPE_PARAMETER = "type"; private static final String WIDTH_PARAMETER = "width"; private static final String HEIGHT_PARAMETER = "height"; private FacebookUtils() { } public static String getUserProfileImageUrl(Facebook facebook, String userId, String width, String height, ImageType imageType) { URIBuilder uriBuilder = URIBuilder.fromUri(facebook.getBaseGraphApiUrl() + userId + StringUtils.SLASH_CHARACTER + PICTURE_PATH); if (imageType != null) { uriBuilder.queryParam(TYPE_PARAMETER, imageType.toString().toLowerCase()); } if (width != null) { uriBuilder.queryParam(WIDTH_PARAMETER, width.toString()); } if (height != null) { uriBuilder.queryParam(HEIGHT_PARAMETER, height.toString()); } URI uri = uriBuilder.build(); return uri.toString(); } }
score: 0

http://stackoverflow.com/q/21836036
type: UnansweredQuestion
has body: I didn't see a similar question and I apologize if this question is not specific enough. I will start out with that I am new to Java, I coded in it about 10+ years ago (basic stuff), but don't remember any of it. I am working on a program that listens on a socket and can receive multiple data types, I.E. Text, receive FTP file, receive http post file. I would like to be able analyze the incoming data type and then process each type differently. I have found several articles on how to do everything on separate ports, but wanted to find out if there is a better way to do so. The problem I have with some of the solutions is that I don't want a full ftp or http server, I just want to receive files via ftp put or http post. Edit: When I say I don't need a server, I mean I don't need to handle anything outside of receiving the file. Additional Clarity: Take something simple like this(example purposes only) BufferedReader br = null; in = new BufferedReader( new InputStreamReader(socket.getInputStream())); while (true) { String input; while((input = br.readLine()) != null){ System.out.println(input); } in.close(); } That will just print whatever text I send the listener. I'm wondering if there is a way to check the input stream for type. This might be beyond my skills, but would like someplace to read up on it. Everything I read is type(FTP, HTTP, custom client) specific, so ideally I would check the input stream and then do something. if(socket.getInputStream() == HTTP || FTP){ //receive file } else if(stream == text){ //parse text } else { //unsupported format } or String streamType = getStreamType(inputStream) //returns input stream type. Up til this point, my coding experience has all been what to do with data I get. This is my first time working with sockets and listeners. Thanks
answer count: 0
has comment: http://stackoverflow.com/comment/33051682
has comment: http://stackoverflow.com/comment/33051377
type: Question
has comment: http://stackoverflow.com/comment/33051164
has comment: http://stackoverflow.com/comment/33052204
has comment: http://stackoverflow.com/comment/33051915
score: 0
tagged with: java
tagged with: fileoutputstream
tagged with: inputstream
has comment: http://stackoverflow.com/comment/33050896
has title: Java: Receive files of multiple types

http://stackoverflow.com/q/21837640
tagged with: jtextfield
tagged with: gettext
type: Question
linked to: http://stackoverflow.com/q/218384
score: -2
has title: Error in .getText() in a parseInt in Java
tagged with: java
has answer: http://stackoverflow.com/a/21838002
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/33054004
answer count: 2
upvote count: 0
tagged with: parseint
has comment: http://stackoverflow.com/comment/33053791
has answer: http://stackoverflow.com/a/21838058
favorite count: 0
has comment: http://stackoverflow.com/comment/33053641
has comment: http://stackoverflow.com/comment/33053699
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/33053917
has body: I know the title might not be that helpful. I do apologize. My problem is that I am trying to create a simple MPG application to help me get used to GUI. I have a gallons and a miles JTextField. I also have an ueditable JTextField to display the MPG. I am trying to convert the user input to an integer then divide the gallons and miles input for the result of the miles per gallon, which will be displayed. I have the parseInt as displayed below: int mil = Integer.parseInt(miles1.getText()); int gal = Integer.parseInt(gallons1.getText()); then the MPG: int mpg = gal / mil; It shows no error in the code, but once I go to run the application I get these errors: java.lang.NullPointerException at app.&lt;init&gt;(app.java:40) at app$1.run(app.java:26) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Does anybody know what is causing this?
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/comment/33016316
has text: You already got your explanation. You are explaining to the main how to stop an application that has semantic errors and is executed. The user knows how to stop the application, but he wants to re-enable the option in the IDE to automatically deny (or at least ask what to do) when the application has this kind of serious error. That is a very useful check because programmers make all kinds of mistakes and in a large code base almost every aid is very valuable. You added wanted answer later, when you saw your mishap. You would be better deleting the original and writing a new one.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21781809
type: Comment

http://stackoverflow.com/comment/32847979
has text: I agree with @JonSkeet. It is NOT clear from your example what you are hoping to achieve. I've just made some assumptions and covered some obvious possibilities.
comment on: http://stackoverflow.com/a/21721940
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/33853375
comment on: http://stackoverflow.com/a/21909443
score: 0
type: Comment
has text: tikione is for apps and maven based projects and the only code coverage plugin available for nb 7. Maybe you should try JaCoCoverage in nb 6 versions. Your welcome and good luck ..
type: AnswerComment

http://stackoverflow.com/q/21679386
upvote count: 3
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/32772283
has title: String compare function equals not giving correct result
type: Question
tagged with: eclipse
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21679517
favorite count: 0
has answer: http://stackoverflow.com/a/21679419
type: UnansweredQuestion
has body: I am using eclipse with java I am trying to compare two string removing all the space between them. Here is my code First I am removing whitespace within the Strings. System.out.println("["+StringUtils.deleteWhitespace(s4)+"]"); System.out.println("["+StringUtils.deleteWhitespace(s3)+"]"); // comparing Strings if(s4.equals(s3)) { System.out.println("Text Match");' } Below is the output from lines 1 and 2 that is displaying on Eclipse console: [gnarlyadj.Somethingthatisgnarlyhasmanyknotsandbumpyareasonitssurface.nudosoadj.Algonudosotienemuchosnudosyunasuperficiellenadebultos.] [gnarlyadj.Somethingthatisgnarlyhasmanyknotsandbumpyareasonitssurface.nudosoadj.Algonudosotienemuchosnudosyunasuperficiellenadebultos.] From what I can see, there is no difference between two string yet it is displaying string as a mismatch.

http://stackoverflow.com/comment/32884327
comment on: http://stackoverflow.com/a/21742000
score: 0
has text: I tried to Implement that exactly and I got an error: Inventory.java:19: error: cannot find symbol List <String> s_name = new ArrayList<String>() ; ^ symbol: class List location: class Inventory Inventory.java:19: error: cannot find symbol List <String> s_name = new ArrayList<String>() ; ^ symbol: class ArrayList location: class Inventory Inventory.java:85: error: non-static variable s_name cannot be referenced from a static context System.out.format("%s\t%11d\t%9.2f\t%11.2f\n", s_name, s_quantity[i],
type: Comment
type: AnswerComment

http://stackoverflow.com/q/21825959
tagged with: libgdx
tagged with: camera
score: 6
answer count: 3
has body: I just started playing arround with 3D in libgdx. I allready know how to draw basic Models and i tryed to play arround with the CameraController. Now i want to create a FirstPersonCamera or FirstPersonCameraController. I thought about extending PerspectiveCamera and adding a MyMovingObject target to it. The MyMovingObject would hold a x, y, z position, where y is a constant value, cause i can't move up/down at the moment. So my movement is basicly in 2D. The MyMovingObject would also store the left/right rotation, needed for its moving direction/ xSpeed, zSpeed. But the Player should also be able to look up and down, and this up/down rotation is not really needed for the MyMovingObject, as it only changes the view and no other properties. So i am not sure if i go the right way. I want to be able to go forward, left, right, backward by using W,A,S,D and rotate left right by using the mouse. Also i want to look up and down by using the mouse, like in most First Person games. Should i use another way, not creating my own camera by extending PerspectiveCamera? Or is this approach good and i just have to store the up/down rotation in the MyMovingObject to, also if it is only needed for the view? Or would it be better to controll the camera with W,A,S,D and mouse and update the MyMovingObjects position, depending on cameras position and rotation? I hope you understand what I mean. It seems a bit complicated to explain it (at least for me). EDIT: I am now using Vector3 direction, Vector3 position and Vector3 size for my NPCs and the player. I calculate the speed by doing: xSpeed = direction.x / (direction.x + direction.z) * speed; the same for zSpeed. By doing this i "filter" the y value out of it and i get only the percent of x and y. The only problem is, that when i look straight up x and z are 0. I could fix this by using an UpVecotr, which gets rotated when i do a "Pitch-rotation". But how do i rotate him? I need to rotate it arround the sideway Vector. Thanks EDIT: Th…
has title: Libgdx first person camera controll
downvote count: 0
has answer: http://stackoverflow.com/a/34058580
favorite count: 0
has answer: http://stackoverflow.com/a/21925383
upvote count: 6
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21875770
accepted answer: http://stackoverflow.com/a/21925383
has answer: http://stackoverflow.com/a/21875770
tagged with: java
type: Question

http://stackoverflow.com/comment/32986126
comment on: http://stackoverflow.com/a/21799468
has text: that's really made me aware of the difference of using JFrame directly
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/30071569
upvote count: 3
type: Answer
score: 3
downvote count: 0
has body: You can simply use save which returns a Serializable object that actually is the last insert id. Sample code: Session session=this.getSessionFactory().getCurrentSession(); int result = -1; try { Serializable ser = session.save(paper); if (ser != null) { result = (Integer) ser; } } catch (Exception e) { e.printStackTrace(); } return result; A testing run: int result = paperService.save(paper); System.out.println("The id of the paper you just added is: "+result); and here is the output: The id of the paper you just added is: 3032
answers question: http://stackoverflow.com/q/21829023

http://stackoverflow.com/a/21684100
downvote count: 0
has body: You can use Desktop class. the Desktop API (java.awt.Desktop) API, which allows Java applications to interact with default applications associated with specific file types on the host platform. Read more here How to integrate with the desktop class
has comment: http://stackoverflow.com/comment/32782021
upvote count: 8
answers question: http://stackoverflow.com/q/21683904
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21683904
type: Answer
score: 8

http://stackoverflow.com/comment/33034377
score: 1
has text: Have you tried searching the internet for "java converting integer to string"?
comment on: http://stackoverflow.com/q/21826695
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21800455
type: Answer
has comment: http://stackoverflow.com/comment/32987758
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32987723
has comment: http://stackoverflow.com/comment/32987750
has comment: http://stackoverflow.com/comment/32987763
has comment: http://stackoverflow.com/comment/32987775
downvote count: 0
has comment: http://stackoverflow.com/comment/32987785
has body: When do you instantiate these? MonthRequirementInformation[] list=null; AdditiveInformation[] list1=null; You never create the array, so when you call length on the objects, it throws an NPE. NOTE: A NullPointerException is one of the most common exceptions I see on here. In future, try to observe where the exception is occurring, what object is throwing the exception, and if that object has been intanciated. This helps to rule out the obvious situation, which is what has happened now.
answers question: http://stackoverflow.com/q/21800427
has comment: http://stackoverflow.com/comment/32987815

http://stackoverflow.com/comment/32891753
comment on: http://stackoverflow.com/q/21746367
has text: I agree, I'm talking about the length of code in terms of the number of characters used to produce it. Overly lengthy kind of code.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21716400
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/316265
score: 4
has comment: http://stackoverflow.com/comment/32838962
has comment: http://stackoverflow.com/comment/32838756
has comment: http://stackoverflow.com/comment/32890397
has answer: http://stackoverflow.com/a/21720048
has comment: http://stackoverflow.com/comment/32839605
has comment: http://stackoverflow.com/comment/32839089
downvote count: 1
has title: Eclipse Kepler freezes when saving
type: Question
has comment: http://stackoverflow.com/comment/32838918
has answer: http://stackoverflow.com/a/21821759
has comment: http://stackoverflow.com/comment/32838770
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/32839059
has body: I have recently had a problem with Eclipse. I am developing a java application. It suddenly freezes whenever I try to save a file. Indeed, it happens to some files in my project while it works fine with the others. I have checked the .log file in my workspace and there is no error message! I tried to disconnect my project from GIT, but the problem persisted. It drives me crazy. I have to restart Eclipse many times everyday. Any solution would be greatly appreciated.
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32864418
answer count: 2

http://stackoverflow.com/q/21741418
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21741668
type: Question
has body: The problem Im having is with the onItemSelected method. Whenever I try to change a Views value, Example: TextView, EditView it throws an error. What Im trying to do is get the when I click on something on the spinner it will display something on the text (anything currently). I hope you can help! Thanks. Here is my code so you can look at it: public class MainActivity extends Activity implements OnItemSelectedListener { Spinner spinner; String[] paths = {"Rectangle", "Circle", "Triangle"}; String selected; Button equals; TextView parm1, parm2; EditText value1, value2; CheckBox checkArea, checkPerm; Boolean checkedArea = true, checkedPerm = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(MainActivity.this, android.R.layout.simple_spinner_item, paths); spinner = (Spinner) findViewById(R.id.spinner); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); } @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { int index = arg0.getSelectedItemPosition(); if(paths[index] == "Rectangle"){ //Does work Toast.makeText(getBaseContext(), "You selected Rectangle", Toast.LENGTH_LONG).show(); //Doesn't work parm1.setText("Hello"); } } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { // TODO Auto-generated method stub } } Here is the error that pops up when I run the program. The virtual device will run the program all the way up to when i open it, then it will say Unfortunately *"Programs_name"* has stopped working. Here is the error log: 02-12 17:26:41.395: D/dalvikvm(1478): GC_FOR_ALLOC freed 45K, 4% free 3331K/3444K, paused 47ms, total 51ms 02-12 17:26:41.985: D/AndroidRuntime(1478): Shutting down VM 02-12 17:26:41.985: W/dalvikvm(1478): threadid=1: thread exiting with uncaught exception (group=0xb1aadba8) 02-12 17:26:41.995: E/AndroidR…
tagged with: android
score: 0
has answer: http://stackoverflow.com/a/21741668
answer count: 1
tagged with: java
has title: Java Android Spinner onItemSelected
has comment: http://stackoverflow.com/comment/32882998

http://stackoverflow.com/comment/32980459
score: 2
has text: Have you tried to run cmd.exe, go to the right directory, and then type `java -jar myjar.jar` or `java -cp myjar.jar my.main.Class` ? What happened?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21796238

http://stackoverflow.com/comment/32967910
type: Comment
score: 2
has text: More of a work around than an answer... but typically in these situations I build a JPanel which contains all of the elements I wish to enclose inside of a JScrollPane, then I add that single JPanel to the JScrollPane.
type: QuestionComment
comment on: http://stackoverflow.com/q/21789190

http://stackoverflow.com/comment/32786594
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21687465
has text: You are not calling the method in main.

http://stackoverflow.com/a/21827143
score: 0
has body: Re-inventing wheel :-( package com.test; public class FindMonthByTotalNumberOfDays { public static void main(String[] args) { int input = 89; int monthDigit = extractMonthDigit(input); System.out.println("Total number of days " + input + " lies in month " + monthDigit + "."); } private static int extractMonthDigit (int totalNumberOfDays) { int result = -1; if(isInBetween(1, 31, totalNumberOfDays)) result = 0; else if(isInBetween(32, 59, totalNumberOfDays)) result = 1; else if(isInBetween(60, 90, totalNumberOfDays)) result = 2; else if(isInBetween(91, 120, totalNumberOfDays)) result = 3; else if(isInBetween(121, 151, totalNumberOfDays)) result = 4; else if(isInBetween(152, 181, totalNumberOfDays)) result = 5; else if(isInBetween(182, 212, totalNumberOfDays)) result = 6; else if(isInBetween(213, 243, totalNumberOfDays)) result = 7; else if(isInBetween(244, 274, totalNumberOfDays)) result = 8; else if(isInBetween(275, 304, totalNumberOfDays)) result = 9; else if(isInBetween(305, 335, totalNumberOfDays)) result = 10; else if(isInBetween(336, 366, totalNumberOfDays)) result = 11; return result; } private static boolean isInBetween(int min, int max, int days) { boolean isInBetween = false; if(days &gt;= min &amp;&amp; days &lt;= max) { isInBetween = true; } return isInBetween; } }
has comment: http://stackoverflow.com/comment/33035215
has comment: http://stackoverflow.com/comment/33035036
type: Answer
answers question: http://stackoverflow.com/q/21826783

http://stackoverflow.com/comment/32826213
comment on: http://stackoverflow.com/a/21708276
has text: Ok. In that case it boils down to the exists() checking after the mkdirs() call?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21732951
answers question: http://stackoverflow.com/q/21732950
upvote count: 3
has body: Main method never calls databaseCon() method, so dbConnection is still null when you try to dbConnection.createStatement();.
score: 3
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32935557
has text: Ok now the sorting algorithm needs work. It doesn't seem to calculate properly... :I
type: AnswerComment
comment on: http://stackoverflow.com/a/21770392
score: 0
type: Comment

http://stackoverflow.com/a/21741200
upvote count: 10
score: 10
downvote count: 0
answers question: http://stackoverflow.com/q/21741168
has body: You cannot override fields, you can only hide them. Your Child1.x field is hiding the Parent.x field. Fields are resolved based on the declared type on the reference they are accessed on, so public void printX() { System.out.println(x); // equivalent to System.out.println(this.x); where this's declared type is Parent } is referring to Parent's field.
type: Answer

http://stackoverflow.com/comment/32860524
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21729279
has text: In a method of class B, `this` is a reference to an object of class B. If, however, one is in a method of class A that is inherited by B, `this` references an A.
score: 0

http://stackoverflow.com/a/21716808
answers question: http://stackoverflow.com/q/21716423
type: Answer
upvote count: 1
score: 1
has body: This is pretty easy to do, but I'd suggest to use an existing method: checkElementIndex(index, this.info.length) from Guava's Preconditions.
downvote count: 0

http://stackoverflow.com/comment/32921128
comment on: http://stackoverflow.com/a/21762963
has text: Can you reliably reproduce the problem?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21774865
has body: The Spring Documentation is very well for this theme: 17.8 Using locales You need two things: A LocalResolver - that is holds the local for an user and when the user send a request, it add the local to the request context (available via RequestContext.getLocale()) - often the SessionLocalResolver or CookieLocaleResolver is used for a normal web page based application - it is important that the bean id/name is localeResolver (DispatcherServlet.LOCALE_RESOLVER_BEAN_NAME="localeResolver") - (if the name is different, then DispatcherServlet will not find the locale resolver ! A LocaleChangeInterceptor that change the locale when the user add ?lang=de to its request. example configuration &lt;bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" name="localeResolver"&gt; &lt;property name="defaultLocale" value="en"/&gt; &lt;/bean&gt; &lt;mvc:interceptors&gt; &lt;bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" p:paramName="lang"&gt; &lt;/bean&gt; ... &lt;/mvc:interceptors&gt; For your problem, it is likely that something with the LocalResolver is wrong, maybe you just forget to set its id/name* to localeResolver or you use a AcceptHeaderLocaleResolver (that always "fall back" the the request header locale) * see this answer for the difference between Id and Name
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21773578
answers question: http://stackoverflow.com/q/21773578
type: Answer

http://stackoverflow.com/q/21813279
type: Question
accepted answer: http://stackoverflow.com/a/21813353
answer count: 2
has body: I've just taken up playing with GUIs, and I'm experimenting with getting text input from the user, and assigning it to a variable for later use. Easy, I thought. Wrong, I was. I wanted my frame to look something like: public class firstFrame extends JFrame { JTextField f1 = new JTextField(); String text; public firstFrame(String title) { super(title); setLayout(new BorderLayout()); Container c = getContentPane(); c.add(f1); text = f1.getText(); System.out.println(text); } } Where the variable text would get whatever text the user typed in, then print it out to the console. Simple. I've got a feeling I'm missing something pretty fundamental here, and would appreciate it if anyone could fill me in on what that something is.
tagged with: variables
score: 0
tagged with: user-interface
has answer: http://stackoverflow.com/a/21813353
tagged with: jframe
has title: JTextField's getText() to printable variable
has comment: http://stackoverflow.com/comment/33011011
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21813342
has comment: http://stackoverflow.com/comment/33010822
tagged with: jtextfield
has answer: http://stackoverflow.com/a/21813342
has comment: http://stackoverflow.com/comment/33010791

http://stackoverflow.com/comment/33351509
score: 0
type: Comment
has text: Get null mean you have to debug your code, & for that try catch will help you
type: AnswerComment
comment on: http://stackoverflow.com/a/21930743

http://stackoverflow.com/a/52995601
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/21747089
downvote count: 0
has body: Even after including all the jar files, in your code, you ought to set property for dictionary and set engine as well. You can do this by including this block of code inside try: System.setProperty("freetts.voices","com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory"); Central.registerEngineCentral("com.sun.speech.freetts.jsapi.FreeTTSEngineCentral");
score: 2

http://stackoverflow.com/a/21806178
has comment: http://stackoverflow.com/comment/117312480
answers question: http://stackoverflow.com/q/21781026
type: Answer
has body: UPDATE 2014/9/12: From version 2.1, Log4j 2 contain a JUL bridge that does not require SLF4J. No custom code is required. Two things: put the following jars in the classpath: log4j-api-2.x, log4j-core-2.x and log4j-jul-2.x. set the system property java.util.logging.manager to org.apache.logging.log4j.jul.LogManager before any calls are made to LogManager or Logger The Log4J2 FAQ page shows the dependencies visually: http://logging.apache.org/log4j/2.x/faq.html#which_jars
upvote count: 37
score: 37
has comment: http://stackoverflow.com/comment/33008842
downvote count: 0
has comment: http://stackoverflow.com/comment/117378726

http://stackoverflow.com/a/21730698
has comment: http://stackoverflow.com/comment/32895475
has comment: http://stackoverflow.com/comment/32871905
answers question: http://stackoverflow.com/q/21730349
has body: I guess employee id (empid) is unique for each emplyee, yes? If so, use a hash instead where empid is the key and employee object is the value. Map&lt;Long, Employee&gt; empmap = new HashMap&lt;Long, Employee&gt;(); empmap.put(currentEmployee.getEmpid(), currentEmployee)
score: 0
type: Answer

http://stackoverflow.com/a/21828609
has body: You can always read input and save it as a new file at desired destination
type: Answer
answers question: http://stackoverflow.com/q/21828516
score: 0

http://stackoverflow.com/q/21834340
answer count: 3
linked to: http://stackoverflow.com/q/20176545
tagged with: jpa
downvote count: 0
has body: I finally got Maven and JPA working but now I am experiencing another error: javax.persistence.PersistenceException: Invalid persistence.xml. Error parsing XML (line-1 : column -1): cvc-elt.1: Declaration of the element "persistence" could not be found. org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:147) org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:171) org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:325) org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:71) javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) com.gamerbud.model.GameController.getEntityManager(GameController.java:31) com.gamerbud.model.GameController.getGames(GameController.java:37) com.gamerbud.SessionBean.updateGames(SessionBean.java:41) com.gamerbud.SessionBean.<init>(SessionBean.java:36) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:526) java.lang.Class.newInstance(Class.java:374) org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider.newInstance(Tomcat7AnnotationLifecycleProvider.java:60) org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:156) org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:333) org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:296) javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67) org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:179) org.apache.el.parser.…
has comment: http://stackoverflow.com/comment/33052920
tagged with: persistence
has answer: http://stackoverflow.com/a/21834446
favorite count: 0
has title: JPA - Invalid persistence.xml
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/33047880
has answer: http://stackoverflow.com/a/46825827
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/19322827
has answer: http://stackoverflow.com/a/27514893

http://stackoverflow.com/comment/32803248
has text: Caught the exception and I System.out.println(fileIn) and it gave me this: delimiters=\p{javaWhitespace}+
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21696698

http://stackoverflow.com/a/21837823
downvote count: 0
has body: Honestly, this question is too situation specific. Regardless :) Writing to file String pdfText = "pdfText"; String fileLocation = "fileLocation"; Writer writer = null; try { writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(fileLocation), "utf-8")); writer.write(pdfText); // String you want to write (i.e. pdfText) } catch (IOException ioe) { ioe.printStackTrace(); } finally { try {writer.close();} catch (Exception ex) { ex.printStackTrace(); } } It's always a good idea to specify the encoding type. ("utf-8"). It might not matter for your assignment though. You might also need to append to the file, and not re-write it completely, in which case, you should use a different constructor for the FileOutputStream, new FileOutputStream(getFileLocation(), true) . As for the many try/catch blocks, don't follow my example. It's how I manage to close my resource, as eclipse recommends haha. Parsing the String If you have a line such as "Keywords : Computers, Robots, Course", String str = "Keywords : Computers, Robots, Course"; String[] array = str.substring(indexOf(':') + 1).split(","); //this array = ["Computers", "Robots", "Course"] Now you have an array which you can loop through and write/print out however you'd like.
upvote count: 2
answers question: http://stackoverflow.com/q/21837360
type: Answer
score: 2

http://stackoverflow.com/comment/32968472
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21788821
type: QuestionComment
has text: Sorry, too late to edit the comment, thats System.mapLibraryName(String)

http://stackoverflow.com/comment/32967500
comment on: http://stackoverflow.com/a/21789010
type: AnswerComment
type: Comment
has text: Will look into these tutorials. Thank you.
score: 0

http://stackoverflow.com/comment/33115821
type: Comment
has text: String [] dummyarray = dummy.toArray(new String[dummy.size()]); context.write(new Text(""), new ArrayWritable(dummyarray)); But showing java.lang.RuntimeException: java.lang.NoSuchMethodException: org.apache.hadoop.io.ArrayWritable.<init>()
comment on: http://stackoverflow.com/a/21828262
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32869953
has text: Yes, it is output I want.
type: AnswerComment
comment on: http://stackoverflow.com/a/21732844
score: 0
type: Comment

google-plus
tags question: http://stackoverflow.com/q/21771568
tag name: google-plus
type: Tag
tags question: http://stackoverflow.com/q/21790651
tags question: http://stackoverflow.com/q/21715151

http://stackoverflow.com/comment/33037157
has text: He means that he doesn't want numbers where the letters are in front of it, not behind like an unit.
score: 0
comment on: http://stackoverflow.com/q/21828466
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32779115
score: 0
type: AnswerComment
type: Comment
has text: sorry but i dont want to copy code i dont undertand can you comment your code so it will be more helpfull
comment on: http://stackoverflow.com/a/21683109

http://stackoverflow.com/comment/32891584
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21746292
has text: Try running the app with the onclicklistner code. What error do you get?
score: 0

http://stackoverflow.com/q/21768229
has title: JFX8 Mixed 2D and 3D, Scene Subscene incorrect drawing 3ds-file
favorite count: 0
tagged with: javafx-8
tagged with: 3ds
has answer: http://stackoverflow.com/a/21786989
type: AnsweredQuestion
upvote count: 1
tagged with: java-8
type: Question
score: 1
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/21786989
answer count: 1
downvote count: 0
has body: Have some problems with using mixed 2D and 3D when i'm implementing a SubScene to my Scene. You can see the problem by clicking the links. Im using the Interactivemesh-Modelimporter. http://s3.postimg.org/nsef8o1f3/without_Subscene.png http://s3.postimg.org/y16wehpgv/with_Subscene.png import com.interactivemesh.jfx.importer.ImportException; import com.interactivemesh.jfx.importer.tds.TdsModelImporter; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Camera; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.PerspectiveCamera; import javafx.scene.Scene; import javafx.scene.SubScene; import javafx.scene.control.Button; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.scene.transform.Rotate; import javafx.scene.transform.Translate; import javafx.stage.Stage; public class JavaFX7 extends Application { HBox hBoxControls; Group model3D; double y_Axis; double x_Axis; double rotate; public Rotate cameraXRotate; public Rotate cameraYRotate; public Translate cameraPosition2; Camera camera; public void controls() { ... ... } public void model () { // // importing 3ds Modell // TdsModelImporter myModel = new TdsModelImporter(); try { String path = "C:/Users/Corvin/Downloads/DUC916_L.3DS/DUC916_L.3DS"; myModel.read(path); } catch (ImportException e) { System.out.println("Error importing 3ds model: "+e.getMessage()); return; } final Node[] myMesh = myModel.getImport(); myModel.close(); model3D = new Group(myMesh); } public static void main(String[] args) { launch(); } @Override public void start(Stage stage) throws Exception { y_Axis = 0.0; controls(); model(); Camera camera = new PerspectiveCamera(); //------------------- cameraXRotate = new Rotate(-5,Rotate.X_AXIS); cameraYRotate = new Rotate(-50,Rotate.Y_AXIS); cameraPosition2 = new Translate(0,-1900,-14000); camera.getTransform…

http://stackoverflow.com/a/21790480
has body: Your first problem (which you may or may not have noticed) is your array of JCheckBoxes only contains null elements: // check boxes are null here private JCheckBox americano, espresso, doubleEspresso, latte; // array created with only null elements JCheckBox[] boxes = new JCheckBox[]{americano, espresso, doubleEspresso, latte}; So you need to create the array after instantiating the actual check boxes. ... americano = new JCheckBox("Americano", false); checkPanel.add(americano); americano.addActionListener(this); espresso = new JCheckBox("Espresso", false); checkPanel.add(espresso); espresso.addActionListener(this); doubleEspresso = new JCheckBox("Double Espresso", false); checkPanel.add(doubleEspresso); doubleEspresso.addActionListener(this); latte = new JCheckBox("Latte", false); checkPanel.add(latte); boxes = new JCheckBox[] { americano, espresso, doubleEspresso, latte }; Then the assignment is suggesting to use arrays because you can create another parallel array of prices (which you did). But since you need these prices in parallel you cannot use a for each loop. You need the index. Then you need to recalculate the entire cost every time anything is selected or deselected. final double[] prices = { 3.75, 4.00, 4.50, 3.50 }; ... double total = 0.0; for(int i = 0; i &lt; boxes.length; i++) { if(boxes[i].isSelected()) { total += prices[i]; } } There's two other notes that seem to be outside the scope of the assignment: You should always make a class for this kind of association. You should never use double for money. Use BigDecimal or something like it. Using a class makes logic simpler and not using double makes the calculation not incur error for this decimal addition. class PricePair { JCheckBox jCheckBox; BigDecimal price; } BigDecimal total = new BigDecimal("0.00"); for(PricePair option : options) { if(option.jCheckBox.isSelected()) { total = total.add(option.price); } }
answers question: http://stackoverflow.com/q/21790021
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21790021

http://stackoverflow.com/comment/33034466
type: Comment
has text: That's right.. You have reason.. I edit my anser, you do: Person oldest = new Person();
comment on: http://stackoverflow.com/a/21816320
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32983181
comment on: http://stackoverflow.com/a/21797653
has text: Check this [link](http://en.allexperts.com/q/Java-1046/2009/2/Difference-Scanner-Method-Buffered.htm)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21791508
has comment: http://stackoverflow.com/comment/32973115
has comment: http://stackoverflow.com/comment/32973204
has comment: http://stackoverflow.com/comment/32973025
has comment: http://stackoverflow.com/comment/32973196
has body: No, iterators always only iterate once even if you call remove(). Removing an item from a linked list updates the relevant pointers without requiring any further iterations.
answers question: http://stackoverflow.com/q/21791472
score: 0
has comment: http://stackoverflow.com/comment/32973305
has comment: http://stackoverflow.com/comment/32973244
has comment: http://stackoverflow.com/comment/32973274
type: Answer

http://stackoverflow.com/comment/32901061
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21750309
score: 0
has text: What is your point? This JavaDoc doesn't mention memory locations.

http://stackoverflow.com/comment/32827146
type: QuestionComment
comment on: http://stackoverflow.com/q/21710168
score: 1
has text: Why did you choose to create a new Scanner each iteration? I believe the problem is that when you call `keyboard.close` you are closing the `System.in`. If you just make one scanner and close it after all iterations are done you should be ok.
type: Comment

http://stackoverflow.com/comment/32981993
comment on: http://stackoverflow.com/a/21797036
has text: Fine.I did that what you have posted here. But even then Java says: "Remove argument to match StringEntity(String)". So is it a constructor issue? In my code I am using StringEntity(String string, ContentType contentType). Kindly update. Thanks
score: 0
type: AnswerComment
type: Comment

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/21803299
tags question: http://stackoverflow.com/q/21756059

http://stackoverflow.com/q/21714964
has comment: http://stackoverflow.com/comment/32836575
has answer: http://stackoverflow.com/a/21715211
downvote count: 2
has comment: http://stackoverflow.com/comment/32836488
has title: Decrementing month from january to december last year in java
has answer: http://stackoverflow.com/a/59261957
upvote count: 1
has comment: http://stackoverflow.com/comment/32836490
favorite count: 0
has body: I'm have a problem going from January back to December I tried various things but I'm getting the nullexception. I'm using a button and put a mouselistener so every time I click it, it decrements by a month. But after January, it won't decrement to December even if I change the year before check the month. Here's what I did: Button btnNewButton = new Button(composite, SWT.NONE); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { moveCalendar("down"); } }); then here's my moveCalendar.. public void moveCalendar(String move) { Calendar cal = GregorianCalendar.getInstance(); resetBox(); if(move.equals("down") ) { dummyMonth--; if(dummyMonth < 0) { dummyMonth = 11; dummyYear--; } } else { dummyMonth++; if(dummyMonth > 11) { dummyMonth = 0; dummyYear++; } } cal.set(Calendar.YEAR,dummyYear); setYear(dummyYear); cal.set(Calendar.MONTH,dummyMonth); setMonth(dummyMonth); int dy = getFirstDay(cal.get(Calendar.MONTH),cal.get(Calendar.YEAR)); int daysMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH); populateCalendar(dy-1,daysMonth,cal.get(Calendar.DAY_OF_MONTH),dummyMonth); } I get nullexception.. any suggestion what's happening?
has answer: http://stackoverflow.com/a/21715027
accepted answer: http://stackoverflow.com/a/21715027
has comment: http://stackoverflow.com/comment/32836509
tagged with: datetime
answer count: 4
has answer: http://stackoverflow.com/a/59232095
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21715211
has comment: http://stackoverflow.com/comment/32836508
type: Question
tagged with: java
score: -1

http://stackoverflow.com/comment/41175878
has text: Btw, i think your answer is wrong, shapetype.filled will draw any filled shapes like circles, rectangles, not lines, really, you can't fill a line.
type: Comment
comment on: http://stackoverflow.com/a/26237478
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33037643
has text: Use map, *key* is each string and *value* is how many times it appears.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21828805

http://stackoverflow.com/comment/93831011
type: AnswerComment
has text: Worked for me as well on Spring Boot 2.1. Was beginning to drive me crazy.
comment on: http://stackoverflow.com/a/37840526
type: Comment
score: 1

http://stackoverflow.com/comment/32774829
type: Comment
type: QuestionComment
score: 1
has text: You should specify what kind of DB you are using. Some DBs have dedicated solutions to enhance insert speed.
comment on: http://stackoverflow.com/q/21680832

http://stackoverflow.com/comment/34926348
comment on: http://stackoverflow.com/q/21697341
has text: I used to use Swing to develop GUIs (nothing professional, just for myself). The latest thing I'm doing, I realized how much of a pain it was going to be and started to use JavaFX, but then realized, why use that when I can just use CSS and Javascript (things like JQuery). I honestly am beginning to think that a WebApp is probably the best method for deployment (and it's not complicated to use Java for the backend) nor is it complicated to get the frontend talking to Java (i.e. servlets and JSPs) and it's extremely portable (the user only needs a browser)--just my two cents.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32900451
type: QuestionComment
has text: I got a window with title named "open application". The default database is names.nsf on my computer. Then I change to mail01/xxx, the default database is not aaa.nsf.
comment on: http://stackoverflow.com/q/21749626
score: 0
type: Comment

http://stackoverflow.com/comment/32962779
has text: my code sucks, I know :-) let me try to improve it. I always try to help poor people like me
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21785926

http://stackoverflow.com/q/21757825
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32912119
has comment: http://stackoverflow.com/comment/32912272
has answer: http://stackoverflow.com/a/21759480
tagged with: ant
tagged with: build-process
has comment: http://stackoverflow.com/comment/32927639
has comment: http://stackoverflow.com/comment/32913639
has body: I have an Apache Ant build file for a java project that contains a javac command to compile my source code. This project has some particular constraints and it is is composed by small sub-projects. Most of these sub-projects have the following folder structure: /docroot ----/WEB-INF --------/lib --------/src -----------A.java ----------- ... (more java classes) --------/service -----------B.java ----------- ... (more java classes) Both src and service are source folders. A.java imports some classes that are in the /service folder, for example B.java. In eclipse everything works fine, A.java imports B.java without any error or problem, so I assume that classpath is right. If I run the javac command from Ant, when he tries to compile A.java it gives me an error saying: cannot find symbol B.java In my javac command I'm setting a single source directory = docroot/WEB-INF/src. It works if I also set the docroot/WEB-INF/service as a source directory. But here's the problem of this solution: Some sub-projects only have a single source folder, "docroot/WEB-INF/src". This means that if I set two source directories for the javac command, for the projects with a single source directory "docroot/WEB-INF/src", it will throw an error saying that the sub-project has no folder "docroot/WEB-INF/service". How can I solve this problem? <reference refid="plugin-lib.classpath" torefid="plugin-lib.classpath" /> <src path="${javac.srcdir}"/> <fileset dir="${javac.srcdir}" excludes="**/*.java" />
answer count: 2
has comment: http://stackoverflow.com/comment/32914070
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32913872
has title: Ant javac source directory not working
has comment: http://stackoverflow.com/comment/32911463
has comment: http://stackoverflow.com/comment/32912266
has answer: http://stackoverflow.com/a/21775725
has comment: http://stackoverflow.com/comment/32911469
score: 0

http://stackoverflow.com/comment/32835384
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21714159
has text: I'd suggest reading into AABB Collison strategies, or for more complex purposes, separating axis theorem (SAT). There are no entity Collison detection methods built into slick.

http://stackoverflow.com/a/36587514
downvote count: 0
type: Answer
has body: You're sending data from one ACTIVITY to another ACTIVITY! is that what you teacher asked? Or he asked to send data from one APPLICATION to another APPLICATION? if it's from one app to another app,you should implement Service and Broadcast Receiver. if it's from one activity to another activity within one application then @Sam already answered
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21708702

http://stackoverflow.com/comment/32781445
has text: I have a lot of entity fields to use in pdf generator. NOt only two ones as in the sample.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21684344
type: AnswerComment

http://stackoverflow.com/comment/32891366
has text: just edited my code to your implementation, the rate of constancy has been reduced to 6
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21745921

http://stackoverflow.com/comment/32867089
type: Comment
has text: but still, each app runs in the same JVM of the appserver right? Because the appserver manages some objects life cycles of the webapp. And that's also why JEE states that you must not use threads in your webapp, since it may break the JEE contract.
comment on: http://stackoverflow.com/a/21732798
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32775838
type: QuestionComment
comment on: http://stackoverflow.com/q/21680478
score: 0
type: Comment
has text: I saw that and I am not sure as well why does Play think its int when I set the field as long.. I wonder if anyone knows how to force it to use Long.

http://stackoverflow.com/q/21690032
has answer: http://stackoverflow.com/a/21690114
type: Question
has body: My use case is following: I have a file which contains columns placeName and country. Now given an input place name, I want to find the country. Since place name that might be passed won't be exact match, I wanted to use %LIKE% kind of matching. Sample data in file: PlaceName,Country Los Angeles,US Las Vegas,US Portland,US Input file: Place1 place2 Input file which has around 50 million place names. Iterating one by one on that input and then another loop on above mapping in file 1 and doing string matching will be very inefficient. It is O(n*m) where n is number of input palces and m is places in mapping file. One obvious way is to load this data into database and use it from there. But list of input places is very big (~50 million) so querying database again and again would be very inefficient. Second approach that I was thinking of - Implement some data structure which will load all data from file and allow 'like' operations in memory. But I don't seem to be able to find it. Last option I can think of is to - use database only as in approach 1 but use caching. Is there a way to tell framework like Hibernate to load all data from table in cache and do all 'like' operation there? Any suggestions on possible solutions?
has comment: http://stackoverflow.com/comment/32792159
has comment: http://stackoverflow.com/comment/32791876
has comment: http://stackoverflow.com/comment/32792216
has comment: http://stackoverflow.com/comment/32791757
has comment: http://stackoverflow.com/comment/32792251
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/32792270
has comment: http://stackoverflow.com/comment/32791743
has comment: http://stackoverflow.com/comment/32791808
has comment: http://stackoverflow.com/comment/32792292
type: UnansweredQuestion
tagged with: data-structures
has comment: http://stackoverflow.com/comment/32791991
has comment: http://stackoverflow.com/comment/32792093
linked to: http://stackoverflow.com/q/898405
has comment: http://stackoverflow.com/comment/32792141
has title: Efficiently implement %LIKE% in Java with complexity better than O(n*m)
tagged with: pattern-matching
has comment: http://stackoverflow.com/comment/32791882
duplicate of: http://stackoverflow.com/q/898405

http://stackoverflow.com/a/21825495
has comment: http://stackoverflow.com/comment/33034256
has comment: http://stackoverflow.com/comment/33032430
type: Answer
score: 1
has body: For measuring the performance of any request on a Java Web app, you may use a filter, like on this example: http://blog.actuanceconsulting.com/servlet-filter-java-performance-logging/ For measuring the performance of any method, you may use System.currentTimeMillis embedded on the method, but it would be better if you use an aspect, to decouple time measures from business code. Also, you can remove it and add it by configuration. For more information, take a look at this: http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/aop.html In case the database connection is the cause, you may set a timeout on the connection. I would also suggest you to take a look at perf4j: http://perf4j.codehaus.org/
upvote count: 1
has comment: http://stackoverflow.com/comment/33032486
has comment: http://stackoverflow.com/comment/33032363
has comment: http://stackoverflow.com/comment/33032337
has comment: http://stackoverflow.com/comment/33032463
answers question: http://stackoverflow.com/q/21825402
has comment: http://stackoverflow.com/comment/33032522
downvote count: 0

http://stackoverflow.com/comment/32832555
comment on: http://stackoverflow.com/q/21712919
type: QuestionComment
type: Comment
score: 3
has text: I don't think he wants you find a method, but to write one. [hint hint]

http://stackoverflow.com/a/21810695
score: 0
answers question: http://stackoverflow.com/q/21810187
type: Answer
has body: @suufang: you can pass only tag parameters to Servlet but if you want to pass data then firstly you will have to get the data of the tag and then you will have to pass that data by appending in the URL. Code is attached below: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> my 4 Click to execute Try the above solution and see how it goes.

http://stackoverflow.com/a/21723231
accepted answer of: http://stackoverflow.com/q/21723125
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/21723125
has comment: http://stackoverflow.com/comment/32850549
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32850392
type: Answer
has body: add this plugin to your pom: org.codehaus.mojo exec-maven-plugin 1.2.1 java ...
has comment: http://stackoverflow.com/comment/32850290

http://stackoverflow.com/comment/32918641
type: Comment
comment on: http://stackoverflow.com/a/21754471
score: 0
type: AnswerComment
has text: OK, both Java and gcc use the shift, but I can't see any gain there: 3 simple instructions instead of 1 `imul`.

http://stackoverflow.com/q/21686352
has title: non-static method getHostServices() cannot be referenced from a static context
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/32786506
has answer: http://stackoverflow.com/a/21686670
has answer: http://stackoverflow.com/a/21687474
favorite count: 0
has answer: http://stackoverflow.com/a/21686612
type: UnansweredQuestion
answer count: 4
tagged with: javafx-2
has answer: http://stackoverflow.com/a/33492764
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32784709
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32784747
has comment: http://stackoverflow.com/comment/32786367
has body: I have this JavaFX code which calls e-mail client MenuItem ri = new MenuItem("Report Issue"); // Start E-Mail Client with E-Mail template and send E-Mail ri.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent e) { Application.getHostServices().showDocument("mailto:"+textField.getText()); } }); I get message in Netbeans non-static method getHostServices() cannot be referenced from a static context Can you tell me how I can solve this? P.S this is the solution that I can managed to create: ri.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent e) { Application a = new Application() { @Override public void start(Stage stage) { } }; final TextField textField = new TextField("help@example.com"); a.getHostServices().showDocument("mailto:"+textField.getText()); } }); Any better proposals?

http://stackoverflow.com/q/21681595
tagged with: android
has title: Saving data on android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21681731
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32776102
has comment: http://stackoverflow.com/comment/32776103
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/32776153
has answer: http://stackoverflow.com/a/21681731
answer count: 1
favorite count: 0
has body: I want to know how to make an app for android so that an user will sign in and his/her information will be saved. I need to know what and where is the best way to save this data. I want to save it that way that a friend could "find" me. How to make a database like this? Somebody else like his friend need to get his name. I mean like this: You sign in. Program gives you a unique name. That name need to save on something. A friend want to connect to somebody so he write that name in search tab and he get his info. That needs to be done through wi-fi connection.

http://stackoverflow.com/comment/32983779
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21798168
has text: Thanks mark,But the number of files defined in the properties file keeps changing.And there is no key holder like file1= or file2= in the properties file it just has contents like src/a.java
score: 0

http://stackoverflow.com/comment/32893406
score: 0
comment on: http://stackoverflow.com/q/21741469
type: QuestionComment
type: Comment
has text: why do you need negative heights and widths?

android-viewpager
tag name: android-viewpager
type: Tag
tags question: http://stackoverflow.com/q/21836462
tags question: http://stackoverflow.com/q/21833345
tags question: http://stackoverflow.com/q/21838425

http://stackoverflow.com/comment/103591435
type: Comment
has text: My point is that C# was created by people coming from Borland, and they used a lot of principles from Object Pascal, as they created previously Borland Delphi. Object Pascal had the same requirement with the virtual keyword, and more or less the same use of the virtual method table.
score: 2
comment on: http://stackoverflow.com/a/21784232
type: AnswerComment

http://stackoverflow.com/comment/33015288
type: AnswerComment
has text: I get: "Type mismatch: cannot convert from element type capture#2-of ? to Class<?>" on the for loop line
score: 0
comment on: http://stackoverflow.com/a/21815699
type: Comment

http://stackoverflow.com/a/21778268
has comment: http://stackoverflow.com/comment/33026025
type: Answer
has body: Red Hat documentation says the maximum size of the bean pool. Also, if you go to admin panel of EAP and go to Profile -> Container -> EJB3 -> Bean Pools -> "Need Help?" it says Max Pool Size: The maximum number of bean instances that the pool can hold at a given point in time I would interpret that to mean that pool will go only up to 20 instances. Edit: in retrospect, answer by Sergey Kosarev saying it is per instance seems convincing enough that you should probably believe that instead.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21777299
answers question: http://stackoverflow.com/q/21777299
has comment: http://stackoverflow.com/comment/58898791
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33028097

http://stackoverflow.com/a/21732798
has body: Yes if the application server is not clustered. Otherwise it could work on different host machine and jvm.
score: 0
answers question: http://stackoverflow.com/q/21732611
type: Answer
has comment: http://stackoverflow.com/comment/32882966
has comment: http://stackoverflow.com/comment/32867089
has comment: http://stackoverflow.com/comment/32874053
has comment: http://stackoverflow.com/comment/32880829
has comment: http://stackoverflow.com/comment/32872471

http://stackoverflow.com/comment/33092182
comment on: http://stackoverflow.com/a/21747790
type: AnswerComment
type: Comment
has text: Keep in mind that every use of this feature will make transitioning to ANTLR 4 more difficult, where the use of user-specified arguments and return values in the grammar is "discouraged" at best.
score: 1

http://stackoverflow.com/a/21778992
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21778799
has comment: http://stackoverflow.com/comment/32950697
type: Answer
accepted answer of: http://stackoverflow.com/q/21778799
has body: Using indexOf() makes the code much easier: public static int startingRepeats(final String haystack, final String needle) { String s = haystack; final int len = needle.length(); // Special case... if (len == 0) return 0; int count = 0; while (s.startsWith(needle)) { count++; s = s.subString(len); } return count; }
score: 1
has comment: http://stackoverflow.com/comment/32949508
upvote count: 1

http://stackoverflow.com/q/21684717
type: UnansweredQuestion
has body: I developed my Java application, but suddenly got stuck with JNI. I try to compile and run most simple JNI application ever (just to figure out what's wrong). I have Win7 x64, JDK 7 32-bit, MinGW. Here is my Java class with a single native method. package my.pack; public class Foo { static { try { System.loadLibrary("foo"); } catch (UnsatisfiedLinkError e) { System.out.println("Could not load native library"); } } public static void main(String[] args) { Foo foo = new Foo(); foo.foo(); } public native void foo(); } I run javah my.pack.Foo to generate my_pack_Foo.h /* DO NOT EDIT THIS FILE - it is machine generated */ #include &lt;jni.h&gt; /* Header for class my_pack_Foo */ #ifndef _Included_my_pack_Foo #define _Included_my_pack_Foo #ifdef __cplusplus extern "C" { #endif /* * Class: my_pack_Foo * Method: foo * Signature: ()V */ JNIEXPORT void JNICALL Java_my_pack_Foo_foo (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif Then I implement it in my_pack_Foo.cpp #include &lt;jni.h&gt; #include &lt;cstdio&gt; #include "my_pack_Foo.h" JNIEXPORT void JNICALL Java_my_pack_Foo_foo(JNIEnv *env, jobject obj) { puts("HELLO WORLD!"); } Then I compile cpp file: g++ -shared -o foo.dll my_pack_Foo.cpp -I c:/JDK/include -I c:/JDK/include/win32 I try to run compiled Foo.java with 32-bit JVM but get error (foo.dll is on system path): Exception in thread "main" java.lang.UnsatisfiedLinkError: my.pack.Foo.foo()V at my.pack.Foo.foo(Native Method) at my.pack.Foo.main(Foo.java:20) Everything seems to be right, but what's wrong?
type: Question
has comment: http://stackoverflow.com/comment/32784426
tagged with: java-native-interface
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21687323
has comment: http://stackoverflow.com/comment/32781937
has title: Got stuck with JNI - help needed

http://stackoverflow.com/q/21818824
has body: When onPause is called, the Dialog is shown and it's background it's transparent so application behind is visible. So if I press Home button while Dialog is shown and then navigate back to application it shows Dialog with black background, if I dismiss Dialog application continuous normally. So how do I make background visible after navigating to application. Black background only happens when I press Home button so application is not visible. I'm guessing that something strange happens in onStop method... This is how I call my Dialog: pauseMenu = new PauseMenu(); pauseMenu.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); pauseMenu.show(); And onCreate from Dialog class: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.pause_menu); }
score: 0
has title: Navigating to activity after onStop() is called
answer count: 1
accepted answer: http://stackoverflow.com/a/21818967
tagged with: android
has comment: http://stackoverflow.com/comment/33020957
has answer: http://stackoverflow.com/a/21818967
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33021876
type: Question

http://stackoverflow.com/comment/33054986
comment on: http://stackoverflow.com/q/21838302
type: Comment
type: QuestionComment
score: 0
has text: Correct. Either replace input with sales, or use input as your variable in your if statement.

http://stackoverflow.com/comment/32818951
comment on: http://stackoverflow.com/q/21705171
type: Comment
type: QuestionComment
has text: The vertices are renumbered after the vertices are merged (merging removes a verticy). I should've mentioned that this renumbering is important and a big reason why solving this is difficult for me
score: 0

http://stackoverflow.com/comment/32835869
score: 0
type: QuestionComment
has text: @Jenny: I get that a lot ;-)
type: Comment
comment on: http://stackoverflow.com/q/21713724

http://stackoverflow.com/a/21777334
answers question: http://stackoverflow.com/q/21777139
type: Answer
upvote count: 1
score: 1
has body: The problem is that what you are doing here with the (T) is not really a cast, behind the scenes it is using autoboxing and calling T.valueOf() - which generics doesn't know about. For a good example of generics you are much better off using things like collections (since they are also the place people are most likely to use them).
downvote count: 0

http://stackoverflow.com/q/21706103
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21706151
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/32819608
has title: Action Button and if statment
upvote count: 0
tagged with: java
has body: Something weird is going with my code. I have a small form (not designed well, but will do for now). The user type username and password, and then press submit. I added an action listener method for the button. At first, the only thing in it was: dispose(); and indeed, when pressed, the window closed. Now when I add an if statement like you see in the code, it does nothing if the value is the correct, however, if it is wrong, it does what I wrote in the else part.... if I am trying to add another condition with &amp;&amp; and the passwordfield, it give me error message: the method is deprecated, and Eclipse puts a line over the getText method for the password... I don't get it, how can it work without an 'if', doesn't work with 'if', and give me warning with &amp;&amp;....thanks... package HR; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.JFormattedTextField; import javax.swing.JButton; import java.awt.GridLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class SignIn extends JFrame { /** * */ private static final long serialVersionUID = 1L; public SignIn() { this.setTitle("HR SYSTEM LOGIN SCREEN"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setBounds(100, 100, 308, 179); JPanel contentPane = new JPanel(new GridLayout(3,3,1,15)); this.getContentPane().add(contentPane); JLabel userName = new JLabel("User Name"); contentPane.add(userName); JLabel spaces2 = new JLabel(""); contentPane.add(spaces2); final JFormattedTextField userText = new JFormattedTextField(); contentPane.add(userText); JLabel password = new JLabel("Password"); contentPane.add(password); JLabel spaces3 = new JLabel(""); contentPane.add(spaces3); final JPasswordField passwordText = new JPasswordField(); contentPane.add(passwordText); JLabel spaces1 = new JLabel(""); contentPane.add(spaces1); JButton signButton = new JButton("Sign In"); contentPane.add(signButton)…
downvote count: 3
type: Question
duplicate of: http://stackoverflow.com/q/513832
tagged with: dispose
has comment: http://stackoverflow.com/comment/32819612
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/comment/34177068
type: Comment
type: QuestionComment
has text: @Hugo I would say comb through your xml files and make sure that all reference resources and values actually exist (values, strings,dimens etc).
comment on: http://stackoverflow.com/q/21784551
score: 0

http://stackoverflow.com/comment/32992938
has text: Sure it is. I see it above in the question and use it without think about it:
comment on: http://stackoverflow.com/a/21802832
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21678598
score: 6
has comment: http://stackoverflow.com/comment/32770678
has answer: http://stackoverflow.com/a/21678798
type: AnsweredQuestion
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/21489289
has comment: http://stackoverflow.com/comment/32770513
type: Question
has title: Normalize a String to create a safe URL in Java
tagged with: normalization
possible better answer: http://stackoverflow.com/a/21678754
upvote count: 6
answer count: 2
tagged with: url
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/21678798
has answer: http://stackoverflow.com/a/21678754
has body: I'm writing a library in Java which creates the URL from a list of filenames in this way: final String domain = "http://www.example.com/"; String filenames[] = {"Normal text","Ich weiß nicht", "L'ho inserito tra i princìpi"}; System.out.println(domain+normalize(filenames[0]); //Prints "http://www.example.com/Normal_text" System.out.println(domain+normalize(filenames[1]); //Prints "http://www.example.com/Ich_weib_nicht" System.out.println(domain+normalize(filenames[2]); //Prints "http://www.example.com/L_ho_inserito_tra_i_principi" Exists somewhere a Java library that exposes the method normalize that I'm using in the code above? Literature: Which special characters are safe to use in url? Safe characters for friendly url
linked to: http://stackoverflow.com/q/695438

http://stackoverflow.com/comment/32914827
has text: Now, I can't find out any more cause.
type: AnswerComment
comment on: http://stackoverflow.com/a/21759043
score: 0
type: Comment

http://stackoverflow.com/a/21684344
has comment: http://stackoverflow.com/comment/32782184
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21684178
has body: What about do something like this. interface Pdfeable{ String writeToPDF();} class Primary implements Pdfeable { String name; String age } class Second impleaments Pdfeable { String dept; String hour } Just override with the statements you want to send data to the PDF. class Primary implements Pdfeable { String name; String age; public String writeToPDF(){ return getName() + "" + getAge(); } } And write your code using the interface definition not concrete classes.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21684178
has comment: http://stackoverflow.com/comment/32822127
has comment: http://stackoverflow.com/comment/32781445

http://stackoverflow.com/q/21732357
has body: I came across this old code in the process of adding java generics and I do not understand what is going on here and what needs to be changed. static void sortByDate( List list) throws Exception { class MyComparator implements Comparator { public int compare(Object o1, Object o2) { RQEntry o11 = (RQEntry) o1; RQEntry o22 = (RQEntry) o2; int cc = ((String)o11.getHandledDate() ).compareTo(o22.getHandledDate() ); return (cc &lt; 0 ? -1 : cc &gt; 0 ? 1 : 0); } }; Collections.sort(list, new MyComparator()); } Question 1: Could someone explain how this method performs comparison? Question 2: What generic type parameters should be passed to comply with Java 5 standards? Question 3: How is compare method called just by creating a new instance of MyComparator? Update: Just found this link which finally helped me understand this code: http://www.digizol.com/2008/07/java-sorting-comparator-vs-comparable.html
has answer: http://stackoverflow.com/a/21732587
tagged with: generics
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32866200
tagged with: parameterized-types
has answer: http://stackoverflow.com/a/21732468
has answer: http://stackoverflow.com/a/21732589
type: Question
has comment: http://stackoverflow.com/comment/32866512
tagged with: java
has title: Need help understanding this method
has comment: http://stackoverflow.com/comment/32866232
accepted answer: http://stackoverflow.com/a/21732468
has answer: http://stackoverflow.com/a/21732665
has comment: http://stackoverflow.com/comment/32866380
score: 0
possible better answer: http://stackoverflow.com/a/21732587
has comment: http://stackoverflow.com/comment/32866294

http://stackoverflow.com/q/21815271
tagged with: image
downvote count: 0
linked to: http://stackoverflow.com/q/9864267
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22012353
has title: Pictures are not shown in JLabel in running time
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33015302
has body: Welcome to you all I have a slight problem with adding pictures ta JFrame , I'm trying to add a picture to a JLable. It works fine in the simulater, when I'm using Swing Packet in Eclipcs program. However, when I try to run the program, the image disappear completely?!! see the pic here : http://im33.gulfup.com/yf7PH.jpg Here is part of my code : JLabel Pic1 = new JLabel(""); Pic1.setIcon(new ImageIcon("C:\\Users\\Al- Yamani\\Downloads\\DSC_0243.bmp")); Pic1.setHorizontalAlignment(SwingConstants.CENTER); Pic1.setBounds(290, 11, 75, 42); contentPane.add(Pic1); I do not know what is the problem?! Also, when I try to add an icon on the title bar, it did not show as well! setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\user\\Pictures\\gifts-icon.png")); ^^ Both codes are in my constracter body: public JFrameName(){.....}
has answer: http://stackoverflow.com/a/21815503
tagged with: icons

http://stackoverflow.com/q/21713631
has answer: http://stackoverflow.com/a/21726947
has answer: http://stackoverflow.com/a/21713878
tagged with: math
answer count: 6
has answer: http://stackoverflow.com/a/21713678
has answer: http://stackoverflow.com/a/21718457
has body: Say I want to distribute y items to x buckets evenly. If x is a multiple of y this distribution will be even, if not I can end up with 0 items in each bucket. For ex: For ex: I have 3 buckets and I want to distribute 2 items each. Since doing the division (2/3) will lead to 0 items per bucket. How can I achieve, a distribution of 1, 1, 0?
possible better answer: http://stackoverflow.com/a/21713878
upvote count: 7
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/50996088
score: 6
has comment: http://stackoverflow.com/comment/32834002
accepted answer: http://stackoverflow.com/a/21713909
tagged with: distribution
type: AnsweredQuestion
tagged with: java
has title: Distribute 'items' in buckets equally (best effort)
has comment: http://stackoverflow.com/comment/32834725
type: Question
has answer: http://stackoverflow.com/a/21713909
tagged with: algorithm

http://stackoverflow.com/a/21753443
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32905760
has comment: http://stackoverflow.com/comment/32909712
has comment: http://stackoverflow.com/comment/32905453
type: AcceptedAnswer
downvote count: 0
has body: After loading class it appears in your class loader, and can be accessed like any other class. There is a simple tutorial [here], that show how to load class from string. In simplest case, you can load class, and hold it's Class object, using it to create objects dynamically. For field access or method invokation you can rely on Groovy dynamic nature. There is no "cached source" or smth like that behind the scene and you can forget, from where your class is loaded. You can also cache classes, that are already compiled, and save them somewhere, as described [here]. It will drastically improve performance, if you need to load same class often. But it will be better, to dig down in topic, because dynamic class loading is advanced Java/Groovy technique, it's whole infrastructure of chained classloaders, so it's better to refer documentation about them. Links below may be helpful. http://javarevisited.blogspot.ru/2012/12/how-classloader-works-in-java.html How to use URLClassLoader to load a *.class file?
accepted answer of: http://stackoverflow.com/q/21752809
answers question: http://stackoverflow.com/q/21752809
has comment: http://stackoverflow.com/comment/32910146
type: Answer
has comment: http://stackoverflow.com/comment/32907431

http://stackoverflow.com/a/21798988
score: 2
downvote count: 0
upvote count: 2
has body: That is an interesting question. So may I introduce another fork of JSqlParser (https://github.com/JSQLParser/JSqlParser). I used it so far for metadata analysis of SQLs and till now evaluation had not to be done. Here now my two cents. The operator precedence is forged partly within JSqlParsers grammer. (@jbaliuka: I looked into your fork and I think it was based on an older version of JSqlParser. The latest developments at sourceforge (2010?) introduced operator precedence for addition and multiplication. Additional your analytic expression parsing triggered some changes at my fork. It would be kind if you could give it a try.) Here is a very simple expression evaluator for addition and multiplication using JSqlParser V0.8.8. First JSqlParser delivers a parse tree or more precise a from this tree inherited object hierarchy which I traverse using the visitor structure of JSqlParser. Sure for a complete version much work still has to be done. This is more a prove of concept. It was interesting to see for me, that even parenthesis precedence is correctly done for my examples. import java.util.Stack; import net.sf.jsqlparser.JSQLParserException; import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.LongValue; import net.sf.jsqlparser.expression.operators.arithmetic.Addition; import net.sf.jsqlparser.expression.operators.arithmetic.Multiplication; import net.sf.jsqlparser.parser.CCJSqlParserUtil; import net.sf.jsqlparser.util.deparser.ExpressionDeParser; public class SimpleEvaluateExpr { public static void main( String[] args ) throws JSQLParserException { //examples evaluate("4+5*6"); evaluate("4*5+6"); evaluate("4*(5+6)"); evaluate("4*(5+6)*(2+3)"); } static void evaluate(String expr) throws JSQLParserException { //here is the stack you mentioned ;) final Stack&lt;Long&gt; stack = new Stack&lt;Long&gt;(); System.out.println("expr=" + expr); Expression parseExpression = CCJSqlParserUtil.parseExpression(expr); //Deparser traverses the comp…
type: Answer
answers question: http://stackoverflow.com/q/21789413

http://stackoverflow.com/comment/127680723
has text: In Kotlin, this looks like this: `val map = Gson().fromJson(json.toString(), HashMap<String, Object>().javaClass)`
type: AnswerComment
comment on: http://stackoverflow.com/a/62835727
type: Comment
score: 4

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/21826945
tags question: http://stackoverflow.com/q/21735767
tags question: http://stackoverflow.com/q/21702776
type: Tag

http://stackoverflow.com/a/21699191
has comment: http://stackoverflow.com/comment/32817312
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21698979
has body: You can use onLoad function &lt;h:body onload="#{app.initilize()}"&gt; where the code goes @ManagedBean(name = "app", eager = true) @SessionScoped public class MyApp { public void initilize() { .... }
score: 1
accepted answer of: http://stackoverflow.com/q/21698979
type: AcceptedAnswer

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/21770893
tags question: http://stackoverflow.com/q/21775112

http://stackoverflow.com/comment/33047965
has text: Thank you! I wasn't aware that libGDX had moved on to version 1.0.0, as I've been using 0.9.9 since I started using the library. It turns out that 1.0.0-SNAPSHOT is available in maven central, and using that solves the problem completely.
comment on: http://stackoverflow.com/a/21823757
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21818169
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/21818227
tagged with: android-networking
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21818227
has answer: http://stackoverflow.com/a/21818775
downvote count: 0
tagged with: httpclient
has body: What is the purpose of consumeContent() of class or org.apache.http.HttpEntity in Android? When should one use it ane can it have side effects? I'm trying to fix a bug in an app which makes requests to a server using HttpClient and sometimes if one particular request fails it will subsequently fail despite the fact that internet is OK. The app calls this method at the end of input stream read.
tagged with: android
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/21818775
has title: Usage of consumeContent() of HttpEntity
type: AnsweredQuestion

http://stackoverflow.com/a/21780283
has body: It is certainly possible to declare non-static finals: class Employee { final String empId; public Employee(String empId) { this.empId = empId; } } In other cases you want the field to be constant across all instances of the class: class Color { final static int BLACK = 0xFFFFFF; } As to why you want to declare them final at all instead of just not changing them ever, It increases program readability, it tells the reader of program something about its behavior that would otherwise have to be in documentation Compiler reminds if you attempt to change it by mistake
score: 4
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/21780195
downvote count: 0

http://stackoverflow.com/q/21838164
possible better answer: http://stackoverflow.com/a/30342282
tagged with: regex
upvote count: 6
tagged with: scala
has body: I want to detect words of Unicode Letters (\p{L}). Scala's REPL gives back false for the following statement, while in Java it's true (which is the right behaviour): java.util.regex.Pattern.compile("\\p{L}").matcher("ä").matches() Both Java and Scala are running in JRE 1.7: System.getProperty("java.version") gives back "1.7.0_60-ea" What could be the reason for that?
score: 6
tagged with: read-eval-print-loop
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30342282
tagged with: java
linked to: http://stackoverflow.com/q/5315330
type: Question
answer count: 2
downvote count: 0
has title: Unicode Regex in Scala REPL
tagged with: unicode
has comment: http://stackoverflow.com/comment/33055230
favorite count: 0
has answer: http://stackoverflow.com/a/21838339
accepted answer: http://stackoverflow.com/a/21838339

http://stackoverflow.com/a/56017111
answers question: http://stackoverflow.com/q/21698737
score: 0
has body: I was also facing the same issue: I tried with the below setting in Gmail Account: Click in 9 Dots menu option, on the right top corner of Gmail. Open "Account" On the Account page, there you will get the Option "Security", click on it. Scroll down and find "Less secure app access". For me, it was OFF. ON it and my access is working fine.
type: Answer

http://stackoverflow.com/a/21702247
type: AcceptedAnswer
downvote count: 0
has body: I'm not sure what you want, but the answer is most probably: Yes, but it makes little sense. You can use FluentIterable&lt;Object&gt; it = FluentIterable.from(Lists.newArrayList(obj1, obj2, obj3)); boolean allNull = it.allMatch(Predicates.isNull()); boolean anyNull = it.anyMatch(Predicates.isNull()); but be assured that it's both much less readable and much slower than doing it the normal way.
answers question: http://stackoverflow.com/q/21700655
type: Answer
accepted answer of: http://stackoverflow.com/q/21700655
score: 4
upvote count: 4

http://stackoverflow.com/comment/32794852
type: AnswerComment
score: 0
type: Comment
has text: While now wholly true, it's not the clearest wording, and is somewhat ambiguous.
comment on: http://stackoverflow.com/a/21691756

http://stackoverflow.com/comment/32841273
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21717751
has text: i did that but it wouldnt work when i put it in myself but when I used user input it finds the file
type: AnswerComment

http://stackoverflow.com/comment/32852969
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21724769
has text: The one problem is what you don't know at first how many rows you have in file. One, not so good, solution is to stores all rows in one `List` then using its number create array which have `array.length` lines. Something like this` new `double[n][]`.

http://stackoverflow.com/comment/32784341
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21685890
has text: `return 1 + new TreeSet(Arrays.asList(60000.00, 80000.00, 100000.00, 125000.00)).headSet(yearlySalary, true).size();`
score: 1

http://stackoverflow.com/comment/33017609
type: Comment
type: QuestionComment
score: 0
has text: http://www.java2s.com/Tutorial/Java/0261__2D-Graphics/ReadanImagefrominputStream.htm
comment on: http://stackoverflow.com/q/21817099

http://stackoverflow.com/comment/32857493
comment on: http://stackoverflow.com/q/21727629
type: Comment
type: QuestionComment
has text: Try doing public ResultSet my_rs1 =null; in dataCollection class ,it might be possible you are trying to access private member outside the scope
score: 0

http://stackoverflow.com/comment/32791374
has text: `latin1` does not support Greek characters, so whatever the database stores now is totally broken. If the characters appear correctly when the PHP application reads the database, it must be a case of two wrongs making a right.
type: QuestionComment
comment on: http://stackoverflow.com/q/21689665
type: Comment
score: 0

http://stackoverflow.com/a/21719930
answers question: http://stackoverflow.com/q/21719878
score: 1
has comment: http://stackoverflow.com/comment/32845020
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21719878
type: Answer
has body: Either Change TabHost th = (TabHost) findViewById(android.R.id.tabhost); to TabHost th = (TabHost) findViewById(com.example.R.id.tabhost); or &lt;TabHost android:id="@+id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" &gt; to &lt;TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" &gt;
has comment: http://stackoverflow.com/comment/32845043
upvote count: 1

http://stackoverflow.com/q/21812505
has comment: http://stackoverflow.com/comment/33010475
tagged with: java
has comment: http://stackoverflow.com/comment/33010809
type: Question
has title: JScrollPane wont appear alone
tagged with: jscrollpane
answer count: 1
has answer: http://stackoverflow.com/a/21812627
score: 0
type: UnansweredQuestion
has body: I want to add a jscroll pane in a jframe that is not alone with the something it scrolls through because whenever I add a JScrollPane I must make JScrollPane p = new JScrollPane(); p.createVerticalScrollBar(); fr.setContentPane(p); fr.revalidate(); if I just added it It doesn't appear like: fr.add(p); that doesn't appear.. I don't want the scrollpane to appear alone in the frame but with other things maybe a button and a textfield.. any help would be much appreciated
tagged with: swing

http://stackoverflow.com/a/21831739
has body: I think you have some misconception about typecasting here. In Java down casting is allowed as already mentioned you can down cast it to integer arr = new long[(int)(y+1)]; But here the main problem is that array allocation should takes integer value so that the same number of homogeneous space can be allocated. If you want more space than an integer range then you should use ArrayList which is dynamically grow-able array because if we give that much liability to a user to declare a large amount array memory then our system may run out of the memory as array is a static memory allocation data structure. The same stands true for arr[j]=4; It should be: arr[(int)j]=4;
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21828099
upvote count: 2

http://stackoverflow.com/a/21749243
score: 0
answers question: http://stackoverflow.com/q/21738226
type: Answer
has body: Just removed the remaining onClick from xml file... sometimes i feel like so blind! But it was stupid to detect, when running on my phone and no compiling errors :( Thanks for the help! :) Since i can`t mark a comment as Solution, i just answered, thank you a lot ZouZou and 2Dee :)

http://stackoverflow.com/a/21737885
downvote count: 0
score: 1
has body: If your selection mode is SINGLE, use public E getSelectedValue() - Returns the value for the smallest selected cell index; the selected value when only a single item is selected in the list. When multiple items are selected, it is simply the value for the smallest selected index. Returns null if there is no selection. This is a convenience method that simply returns the model value for getMinSelectionIndex. If your selection mode is MULTIPLE, use public List&lt;E&gt; getSelectedValuesList() - Returns a list of all the selected items, in increasing order based on their indices in the list. See JList API
answers question: http://stackoverflow.com/q/21736324
upvote count: 1
type: Answer

http://stackoverflow.com/a/21755952
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21698578
accepted answer of: http://stackoverflow.com/q/21698578
score: 0
has body: Thanks for availability to help. To resolve the issue follow the steps on this website click here to create the keystore and all file necessary to client and server, and used the bcprov-jdk16-1.45.jar to create keystore (bks) and used this command on client(wget): wget https://myserver:port --certificate=client.pem --no-check-certificate --private-key=client_key.pem

apache
tags question: http://stackoverflow.com/q/21792237
tag name: apache
tags question: http://stackoverflow.com/q/21826862
tags question: http://stackoverflow.com/q/21792746
tags question: http://stackoverflow.com/q/21727606
tags question: http://stackoverflow.com/q/21726759
tags question: http://stackoverflow.com/q/21727208
tags question: http://stackoverflow.com/q/21710037
tags question: http://stackoverflow.com/q/21700896
tags question: http://stackoverflow.com/q/21758509
tags question: http://stackoverflow.com/q/21760240
tags question: http://stackoverflow.com/q/21763501
tags question: http://stackoverflow.com/q/21825013
tags question: http://stackoverflow.com/q/21806403
tags question: http://stackoverflow.com/q/21798292
tags question: http://stackoverflow.com/q/21725687
tags question: http://stackoverflow.com/q/21809013
tags question: http://stackoverflow.com/q/21753604
tags question: http://stackoverflow.com/q/21727038
tags question: http://stackoverflow.com/q/21808586
tags question: http://stackoverflow.com/q/21727604
tags question: http://stackoverflow.com/q/21821819
tags question: http://stackoverflow.com/q/21684041
tags question: http://stackoverflow.com/q/21764533
type: Tag
tags question: http://stackoverflow.com/q/21735940
tags question: http://stackoverflow.com/q/21710112
tags question: http://stackoverflow.com/q/21769551
tags question: http://stackoverflow.com/q/21771093
tags question: http://stackoverflow.com/q/21819981
tags question: http://stackoverflow.com/q/21696651

http://stackoverflow.com/comment/32975761
comment on: http://stackoverflow.com/q/21791838
has text: http://stackoverflow.com/questions/4755871/how-to-set-image-button-backgroundimage-for-different-state maybe this can help you?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33049991
comment on: http://stackoverflow.com/a/21835457
has text: +1 Since the OP entered only 15 digits, it's not surprising that only 14 digits of accuracy are observed on output.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21697348
tagged with: java
has comment: http://stackoverflow.com/comment/32812393
type: Question
has comment: http://stackoverflow.com/comment/32804938
downvote count: 0
tagged with: jsp
score: 1
favorite count: 0
tagged with: struts2
has comment: http://stackoverflow.com/comment/32805125
has comment: http://stackoverflow.com/comment/32805443
has comment: http://stackoverflow.com/comment/32804765
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: Check if an object exists in a list of objects in jsp in struts2
has body: FeatureDetail.java public class FeatureDetail{ private String featureId; private String featureName; // Their getter and setter methods. @Override public int hashCode() { return featureId.hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FeatureDetail other = (FeatureDetail) obj; if (featureId == null) { if (other.featureId != null) return false; } else if (!featureId.equals(other.featureId)) return false; return true; } } I have the following class (IndexAction.java) class IndexAction extends ActionSupport { private List&lt;FeatureDetail&gt; selectedFeatures; private List&lt;FeatureDetail&gt; features; // Getter and setter methods for features and selectedFeatures } features is a list of all the features. selectedFeatures is a list of all the selected features. Both the lists have FeatureDetail objects. In my jsp index.jsp &lt;s:iterator value="features" var="feature"&gt; &lt;label&gt;&lt;s:property value="#feature.featureName"/&gt;&lt;/label&gt; &lt;s:if test="#feature in selectedFeatures"&gt; &lt;input type="checkbox" checked="checked"/&gt; &lt;/s:if&gt; &lt;s:else&gt; &lt;input type="checkbox"/&gt; &lt;/s:else&gt; &lt;/s:iterator&gt; My problem is, only one checkbox is checked even though selectedFeatures list has two objects(FeatureDetail objects) which are in features. Actual requirement is, i want the checkboxes to be checked for the values that are in selectedFeatures list.
has comment: http://stackoverflow.com/comment/32804826

http://stackoverflow.com/q/21800018
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21800059
tagged with: arrays
downvote count: 0
tagged with: variables
has answer: http://stackoverflow.com/a/21800059
tagged with: class
has answer: http://stackoverflow.com/a/21800052
has answer: http://stackoverflow.com/a/21800080
answer count: 3
score: 1
has title: Why am I getting an ArrayIndexOutOfBounds exception when array size defined in class?
has body: For my project, a user must define the size of an array, and I created a set method to do this. The variable being changed is the class variable, arraySize. But, when someone sets the array size, and I try adding an array, I receive an indexoutofbounds error. Here's the snippet of code //Size of the array private int arraySize; //initializes elemnt count of array private int arrayElementCount; //Gets count of SID in array public int getSIDArrayCount() { //returns private variable return arrayElementCount; } //Sets SID Array public void setArraySize(int setArraySize) { //Array size int //checks array if array size is greater than 0 if (setArraySize &gt; 0) { //sets array size //SIDArray arraySize = setArraySize; } } //SIDArray private String[] SIDArray = new String[arraySize]; EDIT: I can't initialize the array in the 'setArraySize' method because I need an accessor method for the array. here's the rest of the class: /* * 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. */ package com.ahellhound.pkg202sidproject; import java.util.Arrays; import java.util.regex.Pattern; /** * * @author Colby Leclerc */ public class SIDArrayTest { //Size of the array private int arraySize; //initializes elemnt count of array private int arrayElementCount; //Gets count of SID in array public int getSIDArrayCount() { //returns private variable return arrayElementCount; } //Sets SID Array public void setArraySize(int setArraySize) { //Array size int //checks array if array size is greater than 0 if (setArraySize &gt; 0) { //sets array size //SIDArray arraySize = setArraySize; } } //SIDArray private String[] SIDArray = new String[arraySize]; //Gets SID Array public String[] getSIDArray() { //returns array return SIDArray; } //Validates SID; returns true if SID entry is valid public boolean validateSID(String SIDEntry) { //checks if sid entry is 7, and if starts with s…
favorite count: 0
accepted answer: http://stackoverflow.com/a/21800052

http://stackoverflow.com/comment/33006936
has text: further, for setting the sql.. in the constructor of MyJdbcReader I have done super.setSql(sql) to set the sql..and its working fine..
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21810362
type: Comment

http://stackoverflow.com/q/21749900
type: UnansweredQuestion
has title: Current Hibernate Session
tagged with: spring
has body: I am upgrading Hibernate 3 to 4.2 and Spring 2.5.6 to 3.2. I have made some changes which I think may contribute the error I got today. I also changed spring config for using Hiberante 4 transactionManager and LocalSessionFactoryBean instead of Hiberante 3's and web.xml HibernateFilter. Before upgrade old HiberanteDaoSupport getSession method (SessionFacotryUtils is from Hibernate 3). public Session getSession( boolean create ) { return SessionFactoryUtils.getSession( this.m_SessionFactory, create ); } After upgrade HibernateDaoSupport getSession method (SessionFactoryUtils in Hibernate 4 does not provide getSession() so I have to change above to below) public Session getSession( boolean create ) { if (create) { return this.m_SessionFactory.openSession(); }else { return this.m_SessionFactory.getCurrentSession(); } } Spring application context xml: <!-- <!-- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> --> classpath:META-INF/oracle/hibernate.cfg.xml <tx:annotation-driven transaction-manager="transaction.manager" /> Web.xml change (before upgrade we use org.springframework.orm.hibernate3.support.OpenSessionInViewFilter) hibernateFilter org.springframework.orm.hibernate4.support.OpenSessionInViewFilter sessionFactoryBeanName session.factory Most code in the application calls getSession(false) to keep the existing session. After upgrade, I got below error. org.hibernate.HibernateException: collection is not associated with any session at org.hibernate.collection.internal.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:676) at org.hibernate.engine.internal.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:1030) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:346) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:311) at org.hibernate.loader.Loader.loadEntity(Loader.java:2111) at org.hibernate.loader.entity.Abstr…
tagged with: spring-mvc
answer count: 0
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/32899665
score: 0
has comment: http://stackoverflow.com/comment/32903057
has comment: http://stackoverflow.com/comment/32898813

http://stackoverflow.com/q/21747349
accepted answer: http://stackoverflow.com/a/21758209
score: 0
has body: I'm in the early stages of learning how to use Neo4J, and have just begin experimenting with the Neo4J REST server. In particular, I'm interested in creating server plugins, but the documentation here has left me with quite a few questions. Firstly: They give the following example: @Description( "An extension to the Neo4j Server for getting all nodes or relationships") public class GetAll extends ServerPlugin { @Name( "get_all_nodes" ) @Description( "Get all nodes from the Neo4j graph database" ) @PluginTarget( GraphDatabaseService.class ) public Iterable&lt;Node&gt; getAllNodes( @Source GraphDatabaseService graphDb )....{ and say: Make sure that the discovery point type in the @PluginTarget and the @Source parameter are of the same type. a) What is a discovery point ? b) What do the @PluginTarget and @Source annotations designate, and what should they point to?
answer count: 1
tagged with: neo4j
has answer: http://stackoverflow.com/a/21758209
type: AnsweredQuestion
tagged with: java
type: Question
has title: Understanding Neo4j server plugins

http://stackoverflow.com/a/21837782
answers question: http://stackoverflow.com/q/21837695
downvote count: 0
score: 1
type: Answer
has body: You should declare your own adapter for ListView by extending BaseAdapter, ArrayAdapter, etc. And there you can write your own implementation of getView() method which is responsible for the view of every item in your ListView. Inside getView() method you can just inflate view from your XML with layout and populate it with the needed data.
upvote count: 1

db2
tags question: http://stackoverflow.com/q/21704544
tag name: db2
tags question: http://stackoverflow.com/q/21753904
type: Tag

http://stackoverflow.com/q/21782517
downvote count: 0
has title: Load config file from a war
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3861989
tagged with: war
linked to: http://stackoverflow.com/q/1108434
score: 1
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/21782715
type: Question
has answer: http://stackoverflow.com/a/21782594
has answer: http://stackoverflow.com/a/21783141
tagged with: java
has body: I have a Maven project that I'm trying to package as both a war and a jar. As part of my application / servlet initialisation (depending on whether I'm running the jar or the war), I need to read a file called server.ini. I've put the file in src/main/resources/server.ini and am trying to load it like so: System.class.getResourceAsStream("server.ini"); However, this always results in null. What am I doing wrong?
answer count: 3

http://stackoverflow.com/comment/32954191
comment on: http://stackoverflow.com/a/21781422
has text: I must use regex. In a better world maybe I could follow your line of reasoning but i can't...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21746833
has answer: http://stackoverflow.com/a/21746924
has answer: http://stackoverflow.com/a/21746883
tagged with: java
has answer: http://stackoverflow.com/a/21747117
type: Question
score: 0
answer count: 3
tagged with: android
has body: I am trying to create an android client and java server application using socket programming. I need to retrieve the file send from java server but i dont want to write that content into another file in client side. Instead i want to create a listbox with the contents in the received file. I can find code for write these contents in a file but I dont know how to access the contents as strings. Here is the code i tried: Android client client=new Socket("10.0.2.2", 7575); writer=new PrintWriter(client.getOutputStream(),true); writer.write(mMsg); writer.flush(); writer.close(); InputStream is=client.getInputStream(); bytesread=is.read(mybytearray,0,mybytearray.length); I changed my code as follws but it is not working. InputStream is=client.getInputStream(); BufferedReader bf=new BufferedReader(new InputStreamReader(is)); String value=bf.readLine();
has title: How to access data in InputStream as String?
type: UnansweredQuestion
tagged with: sockets

http://stackoverflow.com/a/60809382
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21681094
type: Answer
has body: In java, everything is represented as an object except a few cases. When you are about to instantiate the class (A blueprint), you must know the exact size of the class member variables, member methods, and the constructors. Since some/all of the methods are abstract, and JVM doesn't know the size. Hence allocating memory is useless. But We can implement something to overcome this problem If we take the memory allocation part away from the JVM and assign this ownership to the USER.
score: 1

http://stackoverflow.com/q/21825029
tagged with: amazon-simpledb
upvote count: 1
downvote count: 0
tagged with: cryptography
has comment: http://stackoverflow.com/comment/33031930
has comment: http://stackoverflow.com/comment/33031842
has comment: http://stackoverflow.com/comment/33031582
has answer: http://stackoverflow.com/a/21830030
has comment: http://stackoverflow.com/comment/33032147
favorite count: 0
has comment: http://stackoverflow.com/comment/33031723
has comment: http://stackoverflow.com/comment/33032312
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33031480
has comment: http://stackoverflow.com/comment/33032194
has comment: http://stackoverflow.com/comment/33113735
has comment: http://stackoverflow.com/comment/33031861
score: 1
tagged with: java
type: Question
has title: Secure way to store and use Amazon Access key for Android
answer count: 2
has body: I am trying to build an application for android that uses Amazon SimpleDB. I have viewed the source code of the example code provided by Amazon. However in the demo, the credentials are just stored in a Constants.java and I believe this method is not secure at all as potentially there are people that could decompile the apk to expose the credentials even with Proguard on. Therefore i went to read up on Amazon article regarding this and I could not quite understand as I am not very familiar with cryptography in android/java. How am I supposed to actually allow access to Amazon SimpleDB from my application while keeping the access key safe from external parties? Edit 1: I want to use the application to retrieve data from the SimpleDB, showing in listview. For example like a simple review on food and other users will be able to retrieve the same review that other users posted. Maybe if the user wants to post a review, they would require to sign up an account and log in.
has comment: http://stackoverflow.com/comment/33032436
has answer: http://stackoverflow.com/a/21839911
linked to: http://stackoverflow.com/q/12826984
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/33032395
linked to: http://stackoverflow.com/q/21646688
has comment: http://stackoverflow.com/comment/33031903

http://stackoverflow.com/q/21721401
answer count: 5
tagged with: multithreading
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21721551
downvote count: 0
accepted answer: http://stackoverflow.com/a/21721502
tagged with: java
favorite count: 0
has answer: http://stackoverflow.com/a/21724028
type: Question
has answer: http://stackoverflow.com/a/21721502
upvote count: 2
possible better answer: http://stackoverflow.com/a/21721467
has answer: http://stackoverflow.com/a/21721467
has body: I know, that we use this idiom for waiting for notification to handle spurious wakeups: synchronized (obj) { while(somecond) obj.wait(); } If a spurious wake up arises, we'll just check the state and return back to waiting. But, consider the situation: We begin waiting, and obj.wait() releases lock on obj. Waiting thread is spuriously notified by OS We return to checking condition (with obj lock released due to wait) obj.notify() is called right in that moment. Yes, condition checking is extremely fast and chances, that we can be in condition checking and not in obj.wait(), are negligibly small. In that case we can loose obj.notify() call. Am I misunderstanding something, or we really can loose notification using this pattern?
has answer: http://stackoverflow.com/a/21721547
has title: while(condition) { Object.wait() } idiom

http://stackoverflow.com/comment/32916610
type: Comment
comment on: http://stackoverflow.com/q/21760531
has text: try `new GregorianCalendar(1975, 6, 3);` then. Years start with 0, and so do months. For some random reason (**read the documentation**) days start at 1 though.
score: 0
type: QuestionComment

http://stackoverflow.com/q/21706320
has answer: http://stackoverflow.com/a/21706508
has comment: http://stackoverflow.com/comment/32820213
has comment: http://stackoverflow.com/comment/32820326
has comment: http://stackoverflow.com/comment/32820063
has comment: http://stackoverflow.com/comment/32820039
has answer: http://stackoverflow.com/a/21706631
has comment: http://stackoverflow.com/comment/32820236
has title: Constructing Map from Set<Map.Entry> in Java 7?
has body: java.util.Map comes with entrySet() method that... Returns a Set view of the mappings contained in this map. Is there a single method call or a series of API calls to reconstruct a set out of the set using the Java 7 API as marked what do I need to put here? in the following code sample? package so; import java.util.HashMap; import java.util.Map; import java.util.Set; public class SetMapExample { public static void main(String[] args) { Map&lt;String, String&gt; m = new HashMap&lt;String, String&gt;(); m.put("k1", "v1"); m.put("k2", "v2"); Set&lt;Map.Entry&lt;String, String&gt;&gt; s = m.entrySet(); Map&lt;String, String&gt; ms = s... // what do I need to put here? } } I don't want to use for loop if possible and expect a similar method to entrySet on Map, but I can't seem to find one.
has comment: http://stackoverflow.com/comment/32820008
possible better answer: http://stackoverflow.com/a/21706508
has answer: http://stackoverflow.com/a/21706564
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32819979
has comment: http://stackoverflow.com/comment/32820161
answer count: 4
accepted answer: http://stackoverflow.com/a/21706631
has answer: http://stackoverflow.com/a/21706456
has comment: http://stackoverflow.com/comment/32820375
type: AnsweredQuestion
type: Question

http://stackoverflow.com/q/21750556
has answer: http://stackoverflow.com/a/21750587
tagged with: generics
has body: i wrote simple class: public class Report&lt;T&gt; implements Iterable { private ObservableList&lt;T&gt; items = FXCollections.observableArrayList(); // ... public ObservableList&lt;T&gt; getItems() { return items; } public Iterator&lt;T&gt; iterator { return items.iterator(); } // ... } But when i try to use foreach loop like this i get Incompatible types error: Report&lt;FinRecord&gt; report = new Report&lt;&gt;() for (FinRecord r : report) { // ... } This code works fine, but i wanted cleaner code and i don't understand why previous code returns Object. for (FinRecord r : report.getItems()) { // ... } Is it java's peculiarity, so it creates Iterator not Iterator&lt;T&gt; or i am missing something?
upvote count: 3
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/21750587
tagged with: java
type: Question
tagged with: iterator
answer count: 1
downvote count: 0
favorite count: 0
has title: Iterator<T> returns Object

http://stackoverflow.com/comment/32867756
has text: `"i value is"` will already be in existence before the statement runs.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21725978

http://stackoverflow.com/a/21770749
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21770621
has body: Change to this, 1). anotherScanner.hasNext("q") || anotherScanner.hasNext("Q") 2). anotherScanner.hasNExt("q|Q"); Implemenet anyone.
type: Answer

http://stackoverflow.com/comment/85974376
score: 3
has text: While it's true that TAF is only supported in the JDBC-OCI driver, starting in 12.2.0.1 the JDBC thin supports a more complete replay capability called Application Continuity (AC). We encourage all customers to use AC instead of TAF.
comment on: http://stackoverflow.com/a/47684810
type: AnswerComment
type: Comment

arrays
tags question: http://stackoverflow.com/q/21797639
tags question: http://stackoverflow.com/q/21836319
tags question: http://stackoverflow.com/q/21731365
tags question: http://stackoverflow.com/q/21809131
tags question: http://stackoverflow.com/q/21689550
tags question: http://stackoverflow.com/q/21768496
tags question: http://stackoverflow.com/q/21837724
tags question: http://stackoverflow.com/q/21838379
tags question: http://stackoverflow.com/q/21795723
tags question: http://stackoverflow.com/q/21783857
tags question: http://stackoverflow.com/q/21754540
tags question: http://stackoverflow.com/q/21683783
tags question: http://stackoverflow.com/q/21836646
tags question: http://stackoverflow.com/q/21826695
tags question: http://stackoverflow.com/q/21725225
type: Tag
tags question: http://stackoverflow.com/q/21807400
tags question: http://stackoverflow.com/q/21745455
tags question: http://stackoverflow.com/q/21708925
tags question: http://stackoverflow.com/q/21742757
tags question: http://stackoverflow.com/q/21733705
tags question: http://stackoverflow.com/q/21806283
tags question: http://stackoverflow.com/q/21703867
tags question: http://stackoverflow.com/q/21815754
tags question: http://stackoverflow.com/q/21727140
tags question: http://stackoverflow.com/q/21774960
tags question: http://stackoverflow.com/q/21704742
tags question: http://stackoverflow.com/q/21816582
tags question: http://stackoverflow.com/q/21741405
tags question: http://stackoverflow.com/q/21832990
tags question: http://stackoverflow.com/q/21807296
tags question: http://stackoverflow.com/q/21711864
tags question: http://stackoverflow.com/q/21798523
tags question: http://stackoverflow.com/q/21798202
tags question: http://stackoverflow.com/q/21820588
tags question: http://stackoverflow.com/q/21765257
tags question: http://stackoverflow.com/q/21788530
tags question: http://stackoverflow.com/q/21724769
tags question: http://stackoverflow.com/q/21811667
tags question: http://stackoverflow.com/q/21770875
tags question: http://stackoverflow.com/q/21767982
tags question: http://stackoverflow.com/q/21763442
tags question: http://stackoverflow.com/q/21790137
tags question: http://stackoverflow.com/q/21723042
tags question: http://stackoverflow.com/q/21697533
tags question: http://stackoverflow.com/q/21832715
tags question: http://stackoverflow.com/q/21717321
tags question: http://stackoverflow.com/q/21691044
tags question: http://stackoverflow.com/q/21769060
tags question: http://stackoverflow.com/q/21721820
tags question: http://stackoverflow.com/q/21802238
tags question: http://stackoverflow.com/q/21841416
tags question: http://stackoverflow.com/q/21764704
tags question: http://stackoverflow.com/q/21798434
tags question: http://stackoverflow.com/q/21811872
tags question: http://stackoverflow.com/q/21802719
tags question: http://stackoverflow.com/q/21815032
tags question: http://stackoverflow.com/q/21762890
tags question: http://stackoverflow.com/q/21719220
tags question: http://stackoverflow.com/q/21683434
tags question: http://stackoverflow.com/q/21738467
tags question: http://stackoverflow.com/q/21703672
tags question: http://stackoverflow.com/q/21762375
tags question: http://stackoverflow.com/q/21709783
tags question: http://stackoverflow.com/q/21791356
tags question: http://stackoverflow.com/q/21816241
tags question: http://stackoverflow.com/q/21708094
tags question: http://stackoverflow.com/q/21769731
tags question: http://stackoverflow.com/q/21751064
tags question: http://stackoverflow.com/q/21832400
tags question: http://stackoverflow.com/q/21780320
tags question: http://stackoverflow.com/q/21803453
tags question: http://stackoverflow.com/q/21806304
tags question: http://stackoverflow.com/q/21841419
tags question: http://stackoverflow.com/q/21769552
tags question: http://stackoverflow.com/q/21710465
tags question: http://stackoverflow.com/q/21758276
tags question: http://stackoverflow.com/q/21799367
tags question: http://stackoverflow.com/q/21790960
tags question: http://stackoverflow.com/q/21742850

http://stackoverflow.com/q/21773926
accepted answer: http://stackoverflow.com/a/21773986
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
possible better answer: http://stackoverflow.com/a/21773984
has title: Why is data.entrySet().iterator() ordered in a different order, compared to the HashMap<Long, String> data?
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/32940885
has answer: http://stackoverflow.com/a/21774446
has comment: http://stackoverflow.com/comment/32941142
has body: I have input data (Timestamp, Json string) which I store in a HashMap&lt;Long, String&gt;. To process the JSON string I use an iterator. I use Iterator&lt;Entry&lt;Long, String&gt;&gt; it = data.entrySet().iterator(); to get the entrySet as iterator. My problem is now that the HashMap is organized as follows: 123,{String1} 124,{String2} 125,{String3} Better expressed: I add A to the HashMap, Z to the HashMap, E to the HashMap, I to the HashMap. I expect the order A, Z, E, I and I want the same order in the iterator. If I put it in an iterator I get: 124, {String2} 123, {String1} 125, {String3} The order of the itarator is different from the HashMap order. For me the order of the iterator has to be exactly the same as the order of the HashMap. What I'm doing wrong, that the iterator is changing the order of the data?
tagged with: iterator
has comment: http://stackoverflow.com/comment/32940912
has answer: http://stackoverflow.com/a/21773984
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/21773998
has answer: http://stackoverflow.com/a/21773986

http://stackoverflow.com/q/21838078
has comment: http://stackoverflow.com/comment/133877225
favorite count: 0
has title: JPA equivalent of Hibernate's @Generated(GenerationTime.ALWAYS)
has body: When certain non key fields of a entity are generated in the database (for instance, by triggers) a call to persist will not bring back values that the database has just generated. In practice this means that you may need to refresh an entity after persist or merge (and when level 2 cache is enabled you may even need to evict the entity). Hibernate have a custom annotation @Generated which handles Generated Properties. // Refresh property 1 on insert and update @Generated(GenerationTime.ALWAYS) @Column(insertable = false, updatable = false) private String property1; // Refresh property 2 on insert @Generated(GenerationTime.INSERT) @Column(insertable = false) private String property2; JPA @GeneratedValue only works with primary key properties. So, my question is if there is a replacement for @Generated on JPA API (maybe on 2.1)? And if there isn't one, what is the best practice to handle non key database generated fields?
type: Question
upvote count: 6
has comment: http://stackoverflow.com/comment/133878673
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/21838125
tagged with: jpa
linked to: http://stackoverflow.com/q/75890203
has comment: http://stackoverflow.com/comment/133878774
has comment: http://stackoverflow.com/comment/133880143
score: 6
has comment: http://stackoverflow.com/comment/33054585
has comment: http://stackoverflow.com/comment/33055039
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/21838125

http://stackoverflow.com/comment/87510111
has text: @user2890234 check above comments. Use the folders you have and modify the script.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/35431416

http://stackoverflow.com/a/21687323
upvote count: 1
type: Answer
downvote count: 0
has body: When linking, use the following options -Wl,--export-all-symbols -Wl,--add-stdcall-alias -m32 -shared Use Dependancy Walker(http://www.dependencywalker.com/) to validate your exports before and after to see the difference.
score: 1
answers question: http://stackoverflow.com/q/21684717

http://stackoverflow.com/q/21805846
has answer: http://stackoverflow.com/a/21805918
answer count: 2
tagged with: jpa
has comment: http://stackoverflow.com/comment/32997625
has comment: http://stackoverflow.com/comment/32997869
score: 0
linked to: http://stackoverflow.com/q/7271511
has answer: http://stackoverflow.com/a/21806380
accepted answer: http://stackoverflow.com/a/21806380
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21805918
has title: JPA error while removing entity containing @ManyToOne
tagged with: java
type: Question
has body: So I'm working with the two following classes: @Entity @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING, length = 1) @Table(name = "calibracao", catalog = "aquitel", schema = "") @XmlRootElement public abstract class Calibracao implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "idCalibracao") private Long idCalibracao; @Basic(optional = false) @Column(name = "type") private String type; @Basic(optional = false) @Column(name = "adc") private int adc; @Basic(optional = false) @Column(name = "voltagem") private float voltagem; @OneToOne(cascade = CascadeType.ALL, mappedBy = "calibracao") private CalibracaoPoco calibracaoPoco; @OneToOne(cascade = CascadeType.ALL, mappedBy = "calibracao") private CalibracaoRepetidor calibracaoRepetidor; @JoinColumn(name = "parametroStatus", referencedColumnName = "idParametro_Status") @ManyToOne(optional = false) private ParametroStatus parametroStatus; //Getters and setters } and @Entity @Table(name = "parametro_status", catalog = "aquitel", schema = "") @XmlRootElement public class ParametroStatus implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "idParametro_Status") private Integer idParametroStatus; @Basic(optional = false) @Column(name = "nome") private String nome; @Column(name = "unidadeMedida") private String unidadeMedida; @OneToMany(cascade = CascadeType.ALL, mappedBy = "parametro") private List&lt;Status&gt; statusList; @OneToMany(cascade = CascadeType.ALL, mappedBy = "parametroStatus") private List&lt;Calibracao&gt; calibracaoList; //Getters and setters } The entity objects are instantiated using the following code: public class AdcCalibratior extends javax.swing.JFrame { List&lt;Calibracao&gt; points; public AdcCalibrator(){ //Unrelated code ... points = getCalibration(selectedNode, selectedParameter); }…

http://stackoverflow.com/q/21782975
tagged with: java
has title: How to find a duplicate object of arraylist in java
has comment: http://stackoverflow.com/comment/32956311
has comment: http://stackoverflow.com/comment/32956456
type: Question
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/32956695
has comment: http://stackoverflow.com/comment/32956448
answer count: 3
has answer: http://stackoverflow.com/a/21784268
has answer: http://stackoverflow.com/a/30227085
type: UnansweredQuestion
has body: Hi I want to find a duplicate object of array list of one class type. I tried using hash set but is not working. Can somebody please help. package stream; import java.util.*; public class Chumma { public static void main(String[] args) { Dummy d = new Dummy(); Dummy d1 = new Dummy(); Dummy d2 = new Dummy(); d.setAge(14); d.setName("XXX"); d1.setAge(15); d1.setName("YYY"); d2.setAge(14); d2.setName("XXX"); List&lt;Dummy&gt; list = new ArrayList&lt;Dummy&gt;(); list.add(d); list.add(d1); list.add(d2); Set&lt;Dummy&gt; uniqueSet = new HashSet&lt;Dummy&gt;(list); Set uniqueEntries = new HashSet&lt;Dummy&gt;(); for (Iterator iter = list.iterator(); iter.hasNext(); ) { Object element = iter.next(); if (!uniqueEntries.add(element)) // if current element is a duplicate, // iter.remove(); System.out.println(iter.toString()); } } }
has answer: http://stackoverflow.com/a/21783586
has comment: http://stackoverflow.com/comment/32956536
tagged with: collections
has comment: http://stackoverflow.com/comment/32956342
has comment: http://stackoverflow.com/comment/32956676

http://stackoverflow.com/comment/32972709
has text: Code compiles and runs just fine for me locally even with that strange looking url. Not sure what your issue is.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/21791733
type: QuestionComment

http://stackoverflow.com/comment/32977955
comment on: http://stackoverflow.com/q/21794639
score: 0
type: Comment
has text: yes i have changed the codes..but still the problem persist..please check i have edited the codes
type: QuestionComment

http://stackoverflow.com/comment/33002725
has text: If your class is a singleton, you'll only have one signle instance of your class, stored at a given location in memory. All the variables referencing this singleton will point to the same, unique memory location where the singleton object is stored. An object is always == to itself. You seem to confuse reference variables (pointers) and objects. A reference variable is a pointer to an object living somewhere in memory. When you use `==` on two variables, you test if they both reference the same object.
comment on: http://stackoverflow.com/a/21801052
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/21901220
accepted answer of: http://stackoverflow.com/q/21745356
score: 6
has body: I had a similar problem with the NoClassDefFoundError in JBoss EAP 6.1 when using classes from sapjco3.jar in an EJB (annotated with @Singleton and @Startup). Besides that I also received an error saying that the native library was already loaded in another classloader when republishing to EAP or restarting the deployed module. My solution to both problems was to include sapjco3.jar as a global JBoss module. Step 1 I created the following structure inside EAPS's \modules folder: com --> sap --> conn --> jco --> main --> module.xml --> sapjco3.jar The contents of module.xml: <?xml version="1.0" encoding="UTF-8"?> <resource-root path="sapjco3.jar"/> Step 2 Adding the module as a global module in standalone.xml: ... ... Step 3 Create or edit file jboss-deployment-structure.xml inside EJB projects META-INF to contain the module. My file looks like this: <?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure> </jboss-deployment-structure> Step 4 Configure Maven dependency as scope provided, so that we can work with sapjco3.jar inside the workspace but not have it inside the deployment. com.sap.conn.jco sapjco3 3.0.10 provided That is what I recall so far to make it work, maybe this is helpful for you or anybody else.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21745356
type: Answer
upvote count: 6

http://stackoverflow.com/comment/32917738
score: 0
comment on: http://stackoverflow.com/a/21741589
type: Comment
has text: Actually you advice helped and I was trying to figure it out on my own. Yet the thing I didn't realize what that the delimiter, \\s*, was actually splitting each character. (It's kind of hard to ultimately figure out the source of my issues when new to the subject and not having any luck with research before I made this question) I generally don't want to post something similar to a project I was tasked for help but thought it was a great resource to try to learn how this feature works through a similar project online. Next time I'll try to be more considerate.
type: AnswerComment

http://stackoverflow.com/q/21696986
has comment: http://stackoverflow.com/comment/32804096
has answer: http://stackoverflow.com/a/21697629
possible better answer: http://stackoverflow.com/a/21697095
downvote count: 0
has answer: http://stackoverflow.com/a/21697095
favorite count: 0
has comment: http://stackoverflow.com/comment/32803697
tagged with: regex
has body: I am using java regular expression to split my string into substrings of 2 characters each. I am using the following code. import java.util.*; import java.util.regex.Pattern; import java.util.regex.Matcher; public class HelloWorld{ public static void main(String []args) { String str = "admins"; String delimiters = "([a-z]{2})"; String[] tokensVal = str.split(delimiters); System.out.println("Count of tokens = " + tokensVal.length); System.out.println(Arrays.toString(tokensVal)); } } But running the following code prints the value of count to zero and prints an empty array.
accepted answer: http://stackoverflow.com/a/21697071
has comment: http://stackoverflow.com/comment/32804149
upvote count: 2
has comment: http://stackoverflow.com/comment/32804059
score: 2
type: AnsweredQuestion
has title: Java regular expression not working as expected
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21697071
answer count: 3

http://stackoverflow.com/comment/32818380
has text: I am using java 1.7...
score: 0
comment on: http://stackoverflow.com/q/21705428
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33015704
type: Comment
comment on: http://stackoverflow.com/a/21815866
has text: @user1050619 They're initialized to `null`s so you get a **NullPointerException**...
type: AnswerComment
score: 0

http://stackoverflow.com/q/21688327
favorite count: 0
possible better answer: http://stackoverflow.com/a/21688461
has answer: http://stackoverflow.com/a/21688461
score: 1
has answer: http://stackoverflow.com/a/21761832
has body: I want a java servlet to access a database via hibernate in the doGet method and I created the HibernateUtil class to call buildSessionFactory in a static context When testing, I get an error "tomcat failed to start", apparently (?) because openSession in the doGet method is called before the buildSessionFactory call in the HibernateUtil class. How do I ensure that the HibernateUtil class gets statically initialied before the doGet method in the servlet? Here is the class: import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml return new Configuration() .configure() .buildSessionFactory(); } catch (Throwable ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } } I'm calling from the doGet() method like this: Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); // ... } Stack trace follows: INFO: Starting service Catalina Feb 10, 2014 12:58:21 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.42 Feb 10, 2014 12:58:21 PM org.apache.catalina.core.ContainerBase startInternal SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/dbwebtest]] at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) at org.apache.catalina.util.…
has comment: http://stackoverflow.com/comment/32918517
upvote count: 1
has comment: http://stackoverflow.com/comment/32789058
type: AnsweredQuestion
has title: How to have HibernateUtil statically initialized before servlet is called?
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/21761832
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32788197
tagged with: tomcat

http://stackoverflow.com/comment/33004926
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21809860
has text: Never seen that error before. Could you post your build.sbt file? What does running 'play compile' do?
score: 0

bitmap
tags question: http://stackoverflow.com/q/21683060
tags question: http://stackoverflow.com/q/21686222
tags question: http://stackoverflow.com/q/21711094
type: Tag
tags question: http://stackoverflow.com/q/21815279
tag name: bitmap
tags question: http://stackoverflow.com/q/21709388
tags question: http://stackoverflow.com/q/21796052

http://stackoverflow.com/comment/32956884
type: AnswerComment
has text: there's just one problem with this, i can't compare `Login.LOADED` to `Register.LOADED` and so on. I need the states to be the same type for all enums, so I can store them all in the same hashmap.
type: Comment
comment on: http://stackoverflow.com/a/21783191
score: 0

http://stackoverflow.com/a/21820234
type: Answer
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21820176
answers question: http://stackoverflow.com/q/21820176
has comment: http://stackoverflow.com/comment/33023651
has comment: http://stackoverflow.com/comment/33024481
has comment: http://stackoverflow.com/comment/33025451
score: 5
has body: Impossible as far as I know. The code Tile[] tiles = new Tile[20]; just creates an array of references. To fill the array, you should create a Tile object and then assign the reference to one index of the array, such as: tiles[0] = new Tile(5,5); If all elements of the array pointing to the same object is OK, you can full fill the array simply use: Tile tiles = new Tile[20]; Arrays.fill(tiles, new Tile(5,5));
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33023379

http://stackoverflow.com/comment/32826116
type: AnswerComment
comment on: http://stackoverflow.com/a/21709672
score: 0
type: Comment
has text: That would make sense. Their program would be trying to insert the record a second time, resulting in a primary key constraint violation. I was going to ask about the schema and then saw your answer.

http://stackoverflow.com/a/21768322
answers question: http://stackoverflow.com/q/21767687
has comment: http://stackoverflow.com/comment/32994513
has comment: http://stackoverflow.com/comment/32931057
upvote count: 1
has comment: http://stackoverflow.com/comment/32931286
has body: You have a good question, we just need to improve the quality of your post a bit. Stack Overflow is a site for helping you solve your coding issues, but we won't write them 100% for you. Providing us with your code or anything else you've attempted is always helpful. You mentioned that you know how to get the normal harmonic, but not the alternating signs. Start by looking for a pattern. Given n, we need to print n numbers, but only n - 1 operators. This means we have a fencepost problem. In this case, I think it's fairly obvious that we always need to print 1 first. Then each subsequent print is an operator and a fraction. When n = 2, we use subtraction before the fraction. When n = 3, we use addition before the fraction. When n = 4, we use subtraction before the fraction. When n = 5, we use addition before the fraction. What is the pattern here? I'll give you a hint: even numbers are preceded by subtraction and odd numbers are preceded by addition...
has comment: http://stackoverflow.com/comment/32961929
has comment: http://stackoverflow.com/comment/32931848
has comment: http://stackoverflow.com/comment/32931803
has comment: http://stackoverflow.com/comment/32939743
has comment: http://stackoverflow.com/comment/32932070
has comment: http://stackoverflow.com/comment/32932795
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/32931424

http://stackoverflow.com/comment/32991754
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21802683
has text: i see 2 mains here, and there is no istanstiation of the server class.
score: 0

http://stackoverflow.com/comment/32870534
comment on: http://stackoverflow.com/q/21733945
score: 0
type: Comment
type: QuestionComment
has text: Interesting. Not doable, because I need a combination of 8 floats, and 4 billion^8 is not doable.

http://stackoverflow.com/comment/32918512
has text: Please tell us what you've done so far.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21761708
score: 4

http://stackoverflow.com/q/21721061
tagged with: selenium
upvote count: 1
type: Question
has title: How to OR when capturing multiple webdriver exceptions
has answer: http://stackoverflow.com/a/21721122
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21721107
favorite count: 0
has body: I am trying to capture multiple exceptions like this but I get error '); expected'. How do I do it using ||? try { //find an element here }catch( StaleElementReferenceException e || NoSuchElementException e) { //do something }
possible better answer: http://stackoverflow.com/a/21721122
has answer: http://stackoverflow.com/a/21721107
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/21835097
tagged with: file
has answer: http://stackoverflow.com/a/21835270
has title: Error in uploading a file using java servlet
tagged with: java
has body: java.lang.ClassNotFoundException: org.apache.commons.fileupload.servlet.ServletFileUpload Could someone please help me know what exactly is causing this problem
tagged with: servlets
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21835151
tagged with: uploading
type: UnansweredQuestion

http://stackoverflow.com/a/21683158
type: Answer
downvote count: 1
score: 1
has body: You need to use a NinePatchDrawable API here - NinePatchDrawable npDrawable = (NinePatchDrawable)getResources().getDrawable(R.drawable.empty_icon_video);
answers question: http://stackoverflow.com/q/21683060
upvote count: 2

http://stackoverflow.com/comment/32903421
comment on: http://stackoverflow.com/q/21753229
score: 0
has text: what is the type of result array?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21791981
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21791886
answers question: http://stackoverflow.com/q/21791886
score: 3
has body: It is due to rounding errors from using the float datatype which is a single-precision 32-bit IEEE 754 floating point. When the number requires a greater precision than the datatype can cope with it will be rounded - this will happen when you are adding multiple floats together. If you convert your float datatypes to BigDecimal then you will get the same answer from both methods: import java.math.BigDecimal; import java.math.RoundingMode; public class RoundingErrors { private static final BigDecimal ONE = new BigDecimal( 1 ); static BigDecimal RecursiveFunction(int num){ //The num parameter represents the denominator that will be used //The recursive function is continually called at lower increments of num //If num is one, return 1 and do not call RecursiveFunction again if (num == 1) { return ONE; } //Otherwise, return 1/num (in floating point decimal) and call RecursiveFunction with a parameter of num - 1 else { return ONE.divide( new BigDecimal( num ), 100, RoundingMode.CEILING ).add( RecursiveFunction(num - 1) ); } } //A Non-recursive version of RecursiveFunction that will be used to test RecursiveFunction static BigDecimal NonRecursiveFunction(int num) { //The total variable adds up the fractions BigDecimal total = new BigDecimal( 0 ); //While num is greater than zero, add 1/num to total and then subtract 1 from num while (num &gt; 0) { total = total.add( ONE.divide( new BigDecimal( num ), 100, RoundingMode.CEILING ) ); num -= 1; } return total; } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println( RecursiveFunction( 1000 )); System.out.println( NonRecursiveFunction( 1000 )); } } Output 7.4854708605503449126565182043339001765216791697088036657736267499576993491652024409599344374118451321 7.4854708605503449126565182043339001765216791697088036657736267499576993491652024409599344374118451321
type: AcceptedAnswer

http://stackoverflow.com/q/21819406
type: Question
has title: Trying to use GUI, having trouble adding buttons and labels
tagged with: java
possible better answer: http://stackoverflow.com/a/21819432
has answer: http://stackoverflow.com/a/21819432
accepted answer: http://stackoverflow.com/a/21819428
tagged with: user-interface
downvote count: 0
score: 1
tagged with: awt
favorite count: 0
has body: The assignment is simple, all we need to do is have the code create a window with a red panel with a single button and label. Here is the code thus far as well as the tester class. I got the label to display on the window, but its in a weird place. I cant get the button to display at all as well getting the background to display as red. This is where I'm having trouble with the most: import java.awt.Color; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class MyCustomFrame extends JFrame { public MyCustomFrame() { createComponents(); setSize(FRAME_WIDTH, FRAME_HEIGHT); } private void createComponents() { JPanel panel=new createPanel(); button=new JButton("Push Me"); label=new JLabel("This is a label"); add(button); add(label); } private JButton button; private JLabel label; final int FRAME_WIDTH = 800; final int FRAME_HEIGHT = 800; public void createPanel() { JPanel panel=new JPanel(); panel.setBackground(Color.RED); //button=new JButton("Push Me"); //label=new JLabel("This is a label"); } public void createFrame() { JFrame frame=new JFrame(); add(frame); frame.setVisible(true); } } And this is the tester class: import javax.swing.JFrame; public class MyCustomFrameViewer { public static void main(String[] args) { MyCustomFrame frame = new MyCustomFrame(); frame.setTitle("My first frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }
answer count: 3
has answer: http://stackoverflow.com/a/21819640
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21819428
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/21783858
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/21785654
possible better answer: http://stackoverflow.com/a/21784041
has title: How to code the projectile of a ball of different force and angle in Java Swing?
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/32961113
tagged with: java
accepted answer: http://stackoverflow.com/a/21785654
answer count: 3
tagged with: japplet
downvote count: 0
tagged with: applet
has body: I have written the following function for projectile motion of different force and angle, but it doesn't work properly. Where have I gone wrong? I want something like the Angry Birds game. Code: public void shootBall(int timeCounter){ int gravity = 4; double time = timeCounter/40.0; int velocity = force_value; double radians = currentangle*Math.PI/180; ball.setX((int)((ball.getX()+10)*Math.cos(radians) + velocity*Math.cos(radians)*time)); ball.setY((int)((ball.getY()+10)*Math.sin(radians) + velocity*Math.sin(radians)*time - 0.5*gravity*time*time)); updateGame(); } I want the ball to be thrown from bottom left corner.
favorite count: 0
has answer: http://stackoverflow.com/a/21785385
tagged with: physics
has comment: http://stackoverflow.com/comment/32959466
has answer: http://stackoverflow.com/a/21784041

swing
tags question: http://stackoverflow.com/q/21687681
tags question: http://stackoverflow.com/q/21790021
tags question: http://stackoverflow.com/q/21771233
tags question: http://stackoverflow.com/q/21723766
tags question: http://stackoverflow.com/q/21818380
tags question: http://stackoverflow.com/q/21837899
tags question: http://stackoverflow.com/q/21734101
tags question: http://stackoverflow.com/q/21717917
tags question: http://stackoverflow.com/q/21763243
tags question: http://stackoverflow.com/q/21717476
tags question: http://stackoverflow.com/q/21704189
tags question: http://stackoverflow.com/q/21685029
tags question: http://stackoverflow.com/q/21734517
tags question: http://stackoverflow.com/q/21682761
tags question: http://stackoverflow.com/q/21693254
tags question: http://stackoverflow.com/q/21827923
tags question: http://stackoverflow.com/q/21710711
tags question: http://stackoverflow.com/q/21732119
tags question: http://stackoverflow.com/q/21712310
tags question: http://stackoverflow.com/q/21797434
tags question: http://stackoverflow.com/q/21799965
tags question: http://stackoverflow.com/q/21690227
tags question: http://stackoverflow.com/q/21839521
tags question: http://stackoverflow.com/q/21832133
tags question: http://stackoverflow.com/q/21815862
tags question: http://stackoverflow.com/q/21780427
tags question: http://stackoverflow.com/q/21795183
tags question: http://stackoverflow.com/q/21836049
tags question: http://stackoverflow.com/q/21786748
tags question: http://stackoverflow.com/q/21742310
tags question: http://stackoverflow.com/q/21762773
tags question: http://stackoverflow.com/q/21689917
tags question: http://stackoverflow.com/q/21711521
tags question: http://stackoverflow.com/q/21702573
tags question: http://stackoverflow.com/q/21688332
tags question: http://stackoverflow.com/q/21725745
tags question: http://stackoverflow.com/q/21806300
tags question: http://stackoverflow.com/q/21697482
tags question: http://stackoverflow.com/q/21753769
tags question: http://stackoverflow.com/q/21704779
tags question: http://stackoverflow.com/q/21728965
tags question: http://stackoverflow.com/q/21706493
tags question: http://stackoverflow.com/q/21800466
tags question: http://stackoverflow.com/q/21835430
tags question: http://stackoverflow.com/q/21820769
tags question: http://stackoverflow.com/q/21724467
tags question: http://stackoverflow.com/q/21833213
tags question: http://stackoverflow.com/q/21807086
tags question: http://stackoverflow.com/q/21736007
tags question: http://stackoverflow.com/q/21812698
tags question: http://stackoverflow.com/q/21790254
tags question: http://stackoverflow.com/q/21805999
tags question: http://stackoverflow.com/q/21829652
tags question: http://stackoverflow.com/q/21807402
tags question: http://stackoverflow.com/q/21691683
tags question: http://stackoverflow.com/q/21729529
tags question: http://stackoverflow.com/q/21692710
tags question: http://stackoverflow.com/q/21834927
tags question: http://stackoverflow.com/q/21753252
tags question: http://stackoverflow.com/q/21800543
tags question: http://stackoverflow.com/q/21734374
tags question: http://stackoverflow.com/q/21714436
tags question: http://stackoverflow.com/q/21754691
tags question: http://stackoverflow.com/q/21696882
tags question: http://stackoverflow.com/q/21816283
tags question: http://stackoverflow.com/q/21704278
tags question: http://stackoverflow.com/q/21732755
tags question: http://stackoverflow.com/q/21711628
tags question: http://stackoverflow.com/q/21729670
tags question: http://stackoverflow.com/q/21745118
tags question: http://stackoverflow.com/q/21710323
tags question: http://stackoverflow.com/q/21813048
tags question: http://stackoverflow.com/q/21811368
tags question: http://stackoverflow.com/q/21833460
tags question: http://stackoverflow.com/q/21754768
tags question: http://stackoverflow.com/q/21763192
tags question: http://stackoverflow.com/q/21835581
tags question: http://stackoverflow.com/q/21817782
tags question: http://stackoverflow.com/q/21745974
tags question: http://stackoverflow.com/q/21711963

http://stackoverflow.com/comment/32817490
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21704892
has text: Alright, so I initialize the two Threads first. I don't understand how to pass the parameters to the run() methods though.
type: AnswerComment

http://stackoverflow.com/q/21769586
type: Question
has comment: http://stackoverflow.com/comment/32933631
has comment: http://stackoverflow.com/comment/32933502
has comment: http://stackoverflow.com/comment/32933421
score: 5
duplicate of: http://stackoverflow.com/q/12674064
answer count: 1
has comment: http://stackoverflow.com/comment/32933612
has comment: http://stackoverflow.com/comment/32933299
has comment: http://stackoverflow.com/comment/32933656
has title: Directly convert BufferedImage in a File object
has comment: http://stackoverflow.com/comment/32934148
favorite count: 0
has body: I saw many examples on the internet on how to convert a File into a BufferedImage, but I need to make a counter conversion. I've tried some ways, but all are quite complicated. I wonder if there is a direct way to accomplish this. I have this in my code: for (FileItem item : formItems) { // processes only fields that are not form fields if (!item.isFormField()) { Date date = new Date(); String fileName = new File(item.getName()).getName(); String filePath = uploadPath + date.getTime() + fileName + ".tmp"; File storeFile = new File(filePath); BufferedImage tempImg = ImageIO.read(storeFile); //I make process in the tempImg //I need save it item.write(tempImg); } } I don't need write a FileItem, but the BufferedImage that I have processed.
has answer: http://stackoverflow.com/a/21769843
has comment: http://stackoverflow.com/comment/32933447
upvote count: 6
has comment: http://stackoverflow.com/comment/32933570
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/32933595
tagged with: java
has comment: http://stackoverflow.com/comment/32933254
linked to: http://stackoverflow.com/q/12674064
has comment: http://stackoverflow.com/comment/32933561

http://stackoverflow.com/a/21722986
has body: You can add borders and margins to JavaFX classes by setting them in CSS style sheets. Actually all styling in JavaFX should be done like that. Here is a tutorial for Skinning JavaFX Applications with CSS. You will also want to look at the JavaFX CSS Reference Guide, where the possible CSS elements for JavaFX are explained. What you are looking for is "-fx-padding". From the reference: A sets of four padding values, separated by commas. For each item in the series, a single padding value means that all padding are the same; and if a set of four padding values is specified, they are used for the top, right, bottom, and left edges of the region, in that order. You can e.g. set the padding for all tabs by adding a style sheet to the screen: scene.getStylesheets().add("urlpath/to/mystylesheet.css"); Where "mystylesheet.css" has the following contents: .tab{ -fx-padding: 0 30 0 30; } Or you can also add a style to individual elements in code: Tab tabA = new Tab(); tabA.setText("Tab A"); tabA.setStyle("-fx-padding: 0 30 0 30;"); tabPane.getTabs().add(tabA);
score: 0
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21721785

http://stackoverflow.com/comment/32922847
type: Comment
has text: Try with `@CompileStatic` or `@TypeChecked`
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/21763190

http://stackoverflow.com/a/21772636
upvote count: 1
has comment: http://stackoverflow.com/comment/32946792
has comment: http://stackoverflow.com/comment/32959269
has comment: http://stackoverflow.com/comment/32959922
has comment: http://stackoverflow.com/comment/32959375
type: AcceptedAnswer
downvote count: 0
has body: The JSON specification states The representation of strings is similar to conventions used in the C family of programming languages. A string begins and ends with quotation marks. All Unicode characters may be placed within the quotation marks except for the characters that must be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F). A reverse solidus is \. So you can't place a \ alone in a JSON string. Since your parsing is lenient it just ignores the \, since \d is not a valid escape sequence. Basically the JSON { "digit": "(\d*)" } is not valid.
type: Answer
accepted answer of: http://stackoverflow.com/q/21771982
answers question: http://stackoverflow.com/q/21771982
score: 1
has comment: http://stackoverflow.com/comment/32961889

http://stackoverflow.com/q/21708739
has comment: http://stackoverflow.com/comment/32825129
has answer: http://stackoverflow.com/a/24296737
score: 0
answer count: 2
has body: I am trying to debug an applet using eclipse with the latest JDK (1.7_51). I have set the JVM parameters through Java Control Panel as -Djava.compiler=NONE -Xnoagent -Xdebug -Xrunjdwp:transport=dt_socket,address=8091,server=y,suspend=y In Java Console I can see that the parameters are being passed and are passed correctly. However,when I try to connect to the port 8091 using Eclipse debugging as a Remote Java Application, Host is localhost, Standard Socket Attach and port 8091, it fails to connect to the JVM. I have ensured that port 8091 is not in use. I have even tried -agentlib:jdwp=transport=dt_socket,address=8091,server=y,suspend=y without any success. Through all these trials, I have been checking the ports in use through netstat -lntu to see if port 8091 ever goes in a LISTEN mode but it never does so no wonder Eclipse cannot connect. My question is has anyone successfully debugged Applets with Eclipse using the newest JDK release. If so, how?
tagged with: applet
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21780281
tagged with: java
tagged with: eclipse
type: Question
has title: Java 1.7_u51 Debugging Applets launched by a web page using Eclipse
has comment: http://stackoverflow.com/comment/38481004
tagged with: debugging

http://stackoverflow.com/comment/33014583
comment on: http://stackoverflow.com/a/21807864
has text: Your statement `colorList.get(i) == (Integer)v.getTag()` is comparing two Integer objects to see if they have the same memory address. You need to be using `.equals()` instead.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32817546
comment on: http://stackoverflow.com/q/21701164
has text: @Naren No. I tried as u said.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21779241
tagged with: java
has comment: http://stackoverflow.com/comment/33031973
tagged with: webserver
has answer: http://stackoverflow.com/a/21830385
type: Question
has answer: http://stackoverflow.com/a/21831127
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/21830641
linked to: http://stackoverflow.com/q/6440295
has comment: http://stackoverflow.com/comment/33032386
has answer: http://stackoverflow.com/a/21914518
answer count: 4
has title: JSP engines without webserver
favorite count: 0
accepted answer: http://stackoverflow.com/a/21831127
possible better answer: http://stackoverflow.com/a/21914518
upvote count: 7
has body: Within the scope of implementing my own webserver in Java I want to support JSPs. For the moment I don't want to write a JSP engine myself but use an existing one. I found several JSP engines (e.g. Jasper or Jakarta) but they all come within their own webservers. Is there a JSP engine implementation that is available as a standalone library?
type: AnsweredQuestion
score: 7

http://stackoverflow.com/a/21696300
type: Answer
has body: You can separate your tests on unit tests based on mocks and integration tests which run on real DB. Run unit tests only in Jenkins
score: 0
answers question: http://stackoverflow.com/q/21696212

http://stackoverflow.com/a/21774773
has comment: http://stackoverflow.com/comment/32942423
accepted answer of: http://stackoverflow.com/q/21774450
has comment: http://stackoverflow.com/comment/32942777
score: 0
has comment: http://stackoverflow.com/comment/32942888
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/32942488
has comment: http://stackoverflow.com/comment/32942549
has body: Try this solution: private boolean equals(Set elements, Set elements2) { return elements != null &amp;&amp; elements.equals(elements2); } private List&lt;Set&gt; removeDuplicates(List&lt;Set&gt; from) { List&lt;Set&gt; noDuplicates = new ArrayList&lt;Set&gt;(); for (Set possibleDuplicate : from) { boolean alreadyInNoDuplicatesList = false; for (Set elementFromNoDuplicateList : noDuplicates) { if (equals(elementFromNoDuplicateList, possibleDuplicate)) { alreadyInNoDuplicatesList = true; break; } } if (!alreadyInNoDuplicatesList) { noDuplicates.add(possibleDuplicate); } } return noDuplicates; }
has comment: http://stackoverflow.com/comment/32947404
has comment: http://stackoverflow.com/comment/32942404
answers question: http://stackoverflow.com/q/21774450
has comment: http://stackoverflow.com/comment/32943464
upvote count: 1
has comment: http://stackoverflow.com/comment/32942214
type: AcceptedAnswer

jaxb
tags question: http://stackoverflow.com/q/21797000
tags question: http://stackoverflow.com/q/21764131
tags question: http://stackoverflow.com/q/21821154
tags question: http://stackoverflow.com/q/21751624
tags question: http://stackoverflow.com/q/21727131
tags question: http://stackoverflow.com/q/21711183
tags question: http://stackoverflow.com/q/21704629
tags question: http://stackoverflow.com/q/21789317
tags question: http://stackoverflow.com/q/21684272
tags question: http://stackoverflow.com/q/21701593
tags question: http://stackoverflow.com/q/21804054
tags question: http://stackoverflow.com/q/21750116
tags question: http://stackoverflow.com/q/21821272
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/21798952
tags question: http://stackoverflow.com/q/21778400
tags question: http://stackoverflow.com/q/21683043
tags question: http://stackoverflow.com/q/21709204
tags question: http://stackoverflow.com/q/21767834
tags question: http://stackoverflow.com/q/21684854
tags question: http://stackoverflow.com/q/21788703
tags question: http://stackoverflow.com/q/21831031
tags question: http://stackoverflow.com/q/21700027
tags question: http://stackoverflow.com/q/21685003
tags question: http://stackoverflow.com/q/21786469
tags question: http://stackoverflow.com/q/21784108
tags question: http://stackoverflow.com/q/21764728
tags question: http://stackoverflow.com/q/21784751
tags question: http://stackoverflow.com/q/21720277

http://stackoverflow.com/comment/32951833
has text: What I'm saying is that the thread-safety of `ConcurrentHashMap` is not relevant to whether or not you need to use DCL. That's what you were asking about in your Q1.
comment on: http://stackoverflow.com/q/21774917
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/21680606
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21679148
answers question: http://stackoverflow.com/q/21679148
type: Answer
has body: Did you add android:onClick="CalcolaG" to the button tag in your layout XML? Also, if there's import android.R in import statements delete it.

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/21682485
tags question: http://stackoverflow.com/q/21710582
tags question: http://stackoverflow.com/q/21711096
tags question: http://stackoverflow.com/q/21745974
type: Tag

http://stackoverflow.com/q/21805969
has answer: http://stackoverflow.com/a/21806570
accepted answer: http://stackoverflow.com/a/21806570
linked to: http://stackoverflow.com/q/9624043
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: equality
upvote count: 8
type: Question
tagged with: testing
has title: Junit of equals method
answer count: 2
tagged with: junit
has comment: http://stackoverflow.com/comment/32998688
has comment: http://stackoverflow.com/comment/32998896
possible better answer: http://stackoverflow.com/a/30099262
favorite count: 0
score: 8
has body: I just want to know if there is a best practice or a common way to test equals implementation in objects. I mean test method that has been overridden. public boolean equals(Object o) I did using some logic like this. (Suppose number and name need to be equals to obtain true) Dog d1 = new Dog(1,"Alvin"); Dog d2 = new Dog(2,"Alvin"); Assert.assertFalse(d1.equals(null)); Assert.assertFalse(d1.equals(d2)); d2.setId(1); d2.setName("Kelvin"); Assert.assertFalse(d1.equals(d2)); d2.setName("Alvin"); Assert.assertTrue(d1.equals(d2)); Assert.assertTrue(d1.equals(d1)); But when there are a lot of fields this task is very large and boring, so my question is if there is any framework, tool, option, anything that makes this easier and can proof that method has been overridden correctly. thanks. I know that override the method equals depends on the logic that you need, but also test case creation is, so looking for an standard way to test the method avoiding large codes in test cases, if there is exists obviously or any suggestion you might have.
tagged with: equals
has answer: http://stackoverflow.com/a/30099262

http://stackoverflow.com/q/21711020
has body: I have been using Eclipse lately, where compiling and running the program is very simple. Not much needs to be done in setting the classpath. But apparently that is not the case when it comes to running them from commandLine. when I try compiling from terminal, I am having various errors. I am pasting an image of my package structure of the project cp125_soln. Now I want to compile Invoice.Java in the com.scg.domain package, I tried javac src/main/java/com/scg/domain/Invoice.java src/main/java/com/scg/domain/Invoice.java:17: error: package com.scg.util does not exist import com.scg.util.StateCode; .......................//long error message This means I do not have com.scg.util.* in my classpath. so I tried javac -cp src/main/java/com/scg/util/* src/main/java/com/scg/domain/Invoice.java src/main/java/com/scg/util/ListFactory.java:8: error: package org.slf4j does not exist import org.slf4j.Logger; ^ src/main/java/com/scg/util/ListFactory.java:9: error: package org.slf4j does not exist import org.slf4j.LoggerFactory; ^ src/main/java/com/scg/util/ListFactory.java:11: error: cannot find symbol import com.scg.domain.ClientAccount; ^ symbol: class ClientAccount location: package com.scg.domain ................... // long error message I read different articles on how classpath works and how to provide it in command-line. but when it comes topackage level structures, I am not able to find a good tutorial on how to COMPILE and RUN packages. If a little help could be provided here on the propery way to compile and run these kind of packages, it will be very helpful.
tagged with: compilation
score: 0
has answer: http://stackoverflow.com/a/21714505
tagged with: javac
linked to: http://stackoverflow.com/q/19776266
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/19776266
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32829333
tagged with: java
has comment: http://stackoverflow.com/comment/32835436
tagged with: classpath
type: Question
has title: setting the correct classpath for compiling and running Java packages?
linked to: http://stackoverflow.com/q/2451211

http://stackoverflow.com/q/21775112
has body: I have installed tomcat server on my eclipse and started it but when i hit the url i am getting error. I have set the port number as 8080. The error message is : HTTP Status 404 - /Basic_Struts2_Ant/index.action type Status report message /Basic_Struts2_Ant/index.action description The requested resource is not available. Apache Tomcat/7.0.34
type: Question
tagged with: web-development-server
has answer: http://stackoverflow.com/a/21775271
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32942851
has comment: http://stackoverflow.com/comment/32942804
score: 0
answer count: 1
has title: Error in running tomcat server for web application
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32942705
tagged with: embedded-tomcat-7
tagged with: tomcat7

http://stackoverflow.com/a/21692861
type: Answer
has comment: http://stackoverflow.com/comment/32823118
has comment: http://stackoverflow.com/comment/32797099
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32817383
has body: To find the first pixel in a Bitmap with given Color: int color = // your color int x, y; // used for output boolean found = false; for (int ix = 0; ix &lt; bitmap.getWidth(); ++ix) { for (int iy = 0; iy &lt; bitmap.getHeight(); ++iy) { if (color == bitmap.getPixel(ix, iy) { found = true; x = ix; y = iy; break; } } }
has comment: http://stackoverflow.com/comment/32797134
has comment: http://stackoverflow.com/comment/32796551
has comment: http://stackoverflow.com/comment/32814211
has comment: http://stackoverflow.com/comment/32796599
answers question: http://stackoverflow.com/q/21692813
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32821669
accepted answer of: http://stackoverflow.com/q/21692813
has comment: http://stackoverflow.com/comment/32826334

http://stackoverflow.com/comment/32802258
type: Comment
type: QuestionComment
has text: Instead of `goingOn=false` try with return false and return true nd let know whether it is working or not???
comment on: http://stackoverflow.com/q/21696141
score: 0

http://stackoverflow.com/comment/32838354
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21693525
has text: try this `total.setText(""+(((yearNow-year)*365)+((monthNow-month)*30)+(dayNow-day)))`

http://stackoverflow.com/comment/32837165
score: 1
type: AnswerComment
has text: This is ridiculous. Not only is the code over-complicated and confusing, but the question stated that there are to be no loops or recursion. This answer uses recursion, but the fact you used two functions for it instead of one shows that you don't understand what recursion is.
comment on: http://stackoverflow.com/a/21714386
type: Comment

http://stackoverflow.com/a/21782829
answers question: http://stackoverflow.com/q/21782769
type: Answer
accepted answer of: http://stackoverflow.com/q/21782769
has body: Simply use: MainActivity.this.value; Or, even simpler, just as if it was a member of the OnClickListener: value Will also work.
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21695026
score: 1
has body: Is $fin_result returning rows? Try the following try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "utf-8"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); json = sb.toString(); Log.e("JSON", json); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); } // try parse the string to a JSON object try { jObj = new JSONObject(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } // return JSON String return jObj;
has comment: http://stackoverflow.com/comment/32801307
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21694627
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21694627

http://stackoverflow.com/q/21763652
has title: Android Calling Async task inside another Async task?
tagged with: android
tagged with: asynchronous
accepted answer: http://stackoverflow.com/a/21764982
tagged with: http
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21764982
has body: I'm trying to do an Async call inside of another Async method I am not sure if I'm doing this correctly, or if it's even possible. First call gets the partID's from the database, and then second gets the lotNumbers of the part's. My reasoning for doing this is to be able to loop through and put the associated partLotNumebrs inside a Spinner and display a list of Spinners in a Listview. what am I doing wrong? Is this even possible? I know you can't make HTTP calls inside the main so I'm not sure of any other way to do this. the error I'm getting. 02-13 11:04:16.431: E/AndroidRuntime(1369): FATAL EXCEPTION: main 02-13 11:04:16.431: E/AndroidRuntime(1369): java.lang.NullPointerException 02-13 11:04:16.431: E/AndroidRuntime(1369): at com.cbs.iomamobile.ViewOrderlineAssemblyActivity$getPartLotNumbers.onPostExecute(ViewOrderlineAssemblyActivity.java:258) 02-13 11:04:16.431: E/AndroidRuntime(1369): at com.cbs.iomamobile.ViewOrderlineAssemblyActivity$getPartLotNumbers.onPostExecute(ViewOrderlineAssemblyActivity.java:1) 02-13 11:04:16.431: E/AndroidRuntime(1369): at android.os.AsyncTask.finish(AsyncTask.java:602) 02-13 11:04:16.431: E/AndroidRuntime(1369): at android.os.AsyncTask.access$600(AsyncTask.java:156) 02-13 11:04:16.431: E/AndroidRuntime(1369): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615) 02-13 11:04:16.431: E/AndroidRuntime(1369): at android.os.Handler.dispatchMessage(Handler.java:99) 02-13 11:04:16.431: E/AndroidRuntime(1369): at android.os.Looper.loop(Looper.java:137) 02-13 11:04:16.431: E/AndroidRuntime(1369): at android.app.ActivityThread.main(ActivityThread.java:4340) 02-13 11:04:16.431: E/AndroidRuntime(1369): at java.lang.reflect.Method.invokeNative(Native Method) 02-13 11:04:16.431: E/AndroidRuntime(1369): at java.lang.reflect.Method.invoke(Method.java:511) 02-13 11:04:16.431: E/AndroidRuntime(1369): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 02-13 11:04:16.431: E/AndroidRuntime(1369): at …
type: Question
has comment: http://stackoverflow.com/comment/32922231
answer count: 1
score: 0

http://stackoverflow.com/a/21749908
has comment: http://stackoverflow.com/comment/32898932
has comment: http://stackoverflow.com/comment/32898381
accepted answer of: http://stackoverflow.com/q/21749741
answers question: http://stackoverflow.com/q/21749741
has comment: http://stackoverflow.com/comment/32898801
score: 3
type: AcceptedAnswer
downvote count: 0
upvote count: 3
has body: This is a classloader issue. As per the Javadocs to Class.forName, you are looking up the class using the classloader of the current class. As your main class, this will be the JVM's bootstrap classloader (and will more or less just include the standard library plus anything you provided as a -cp command line argument). It is not going to delegate to the classloader that you instantiated as a local variable, and so will not return classes that that classloader could find. If you were to specify the classloader explicitly, and call Class.forName("HelloWorld", true, clazzloader) then the classloader you just created will be searched instead and your class should be found.
type: Answer

http://stackoverflow.com/comment/134672439
comment on: http://stackoverflow.com/a/21766822
score: 0
type: Comment
has text: This doesn't work for me unfortunately (Jetty 9.4.51). I have used the modifyHandshake method and set an empty value for Sec-WebSocket-Accept as suggested, but Jetty completes the WebSocket setup after that, and populates Sec-WebSocket-Accept with a successful value anyway.
type: AnswerComment

http://stackoverflow.com/comment/32861100
comment on: http://stackoverflow.com/q/21701413
type: Comment
has text: A picklist is definitely out of the question. Usually, when there so many options to pick from, the user is expected to have *some* idea of what they want; think autocomplete. The user should type in some entry and then get suggestions. Get the user to pick from that and add to a collection. Otherwise, just go full datatable
type: QuestionComment
score: 2

http://stackoverflow.com/a/21820935
type: Answer
has body: Consider this tutorial a good one , good example and you can see some working examples with DER's. Tutorial And also it is not a Jlist it is a List or ArrayList, possible typo error XD. In your test you are not adding a list of keywords to the Master.
score: 0
answers question: http://stackoverflow.com/q/21819901

http://stackoverflow.com/a/21754420
answers question: http://stackoverflow.com/q/21753687
has body: I think you would have to parse content of script tags first (manually by fetching HTML page and then using e.g. RegExp find content of all script elements) and then pass it to the eval() as a string. Not pretty thing is that the JS code in &lt;script&gt; could be using some other JS code (external, loaded before this element etc.) so you might need to check for these "dependencies" as well.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21753687
type: Answer

http://stackoverflow.com/q/21761928
type: Question
has body: I am modifying some old code that parses a DTD using the Wutka DTDParser (http://mvnrepository.com/artifact/com.wutka/dtdparser/1.21). I need to be able to retrieve the elements in the order they appeared in the DTD file. But the DTDParser stores the elements in a Hashtable, so I'm pretty sure I'm out of luck. Does anyone know if there's any trick to doing what I need here, or if there's another DTD parsing library for java that would support that functionality (preferably that would be easy to swap into code that currently uses Wutka)? Thanks!
score: 1
tagged with: java
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21768676
favorite count: 0
has title: wutka dtdparser library -- can I retrieve elements in the order defined?
tagged with: dtd-parsing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21768676
upvote count: 1

http://stackoverflow.com/q/21750887
tagged with: android
has body: A *.so file ,I want to get the installed packages list ,But I don't have context pointer thiz point But only env pointer, What should I do? That means I only have the jnienv pointer, but I want to get the installed apks list in system... How can I do that? Java_com_kings0527_JNIGetCert_JNIGetCert_stringFromJNI( JNIEnv* env, jobject thiz ) { jclass activityClass = (*env)-&gt;FindClass(env, "android/app/Activity"); jmethodID getPackageManagerMid = (*env)-&gt;GetMethodID(env, activityClass, "getPackageManager", "()Landroid/content/pm/PackageManager;"); jobject packageManagerObject = (*env)-&gt;CallObjectMethod(env, thiz, getPackageManagerMid); I need the Activity context.（jobject thiz） Who can share your idea? Thank you very much!
upvote count: 1
tagged with: c++
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33063727
has comment: http://stackoverflow.com/comment/32975819
has comment: http://stackoverflow.com/comment/75626189
downvote count: 0
favorite count: 0
has title: how to get activity object use jni？
answer count: 0
has comment: http://stackoverflow.com/comment/36935825
type: UnansweredQuestion

http://stackoverflow.com/comment/32911973
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21757623
has text: Question was about `Java`, not `C` ?

http://stackoverflow.com/a/21772704
accepted answer of: http://stackoverflow.com/q/21772221
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21772221
has body: Honestly, I really wouldn't spend time on making a payload "look nice". Now if you said that you were motivated to keep the payload small for efficiency reasons I'd buy that. Perhaps you use Jackson for serialising to JSON as well (I don't see why you are using two different libraries). I think that this question shows that Jackson's treatment of nulls can be controlled.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32965629
comment on: http://stackoverflow.com/q/21787993
score: 0
has text: First you should a specific exception from `createCurrencyTicket`. If you have control in that method you should throw from there exceptions it could be, ErrorException, DownException then you know what message or simple a CurrencyException with a property `type` that could be `ERROR`, `DOWN` etc.. If you can't handle IOException or that type you can put `DOWN`..
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32938223
type: Comment
comment on: http://stackoverflow.com/a/21772074
has text: i dont want to do this i want to count words not alphabets for that matter
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32862986
score: 3
has text: By passing in a string that's in the form "HH:mm"?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21730638

http://stackoverflow.com/q/21697790
tagged with: java
has answer: http://stackoverflow.com/a/21713770
tagged with: collision-detection
type: Question
has body: I am new to 3D programming, just started yesterday. I am just trying to create a simple game, where i move in 3D space, but collision detection works in 2D top down space, cause my character can't jump. So collision happens only on X and Z axis. But now i think about implementing shooting, where the bullet flies in the direction my camera is pointing (first person camera). But i have no idea how shooting is normaly implemented in 3D games? Is a Bullet an object, which is drawn, like in many 2D games, and moved at high speed? Or is it just a line, which isn't even shown sometimes? And how can i check for collision with that line without iterating throught all walls and mobs? I know you can find the areas throught which the bullet flies, but isn't this a big calculation when the line can go in every direction in 3D space?
tagged with: 3d
tagged with: libgdx
score: 0
answer count: 1
type: UnansweredQuestion
has title: Libgdx implementing shooting (collision between bullet and objects)

http://stackoverflow.com/comment/32782122
type: Comment
comment on: http://stackoverflow.com/a/21684903
score: 0
type: AnswerComment
has text: Correction, the etc folder is a root folder of the program, ie myproject/etc same root as the /src and /lib folder. Basically I want to build one program that will return different results based on the properties file passed in on run time ie, different airlines etc...

http://stackoverflow.com/q/21836831
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21836927
has answer: http://stackoverflow.com/a/21836890
has comment: http://stackoverflow.com/comment/33052238
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21836927
favorite count: 0
has comment: http://stackoverflow.com/comment/33052311
has title: Reversing Java For Loop
possible better answer: http://stackoverflow.com/a/21837130
has answer: http://stackoverflow.com/a/21837130
type: AnsweredQuestion
has body: I have this code, which I am trying to print the following shape out... **** * * ** * Current Code: System.out.print("\nEnter number of rows: "); rows = kybd.nextInt(); for (int i = 0; i &lt; rows; i++) { System.out.print("*"); } for (int i = 0; i &lt; rows; i++) { for (int j = 1; j &lt;= i; j++) { if (j == 1 || j == rows - 1 || j == i) { System.out.print("*"); } else { System.out.print("0"); } } System.out.println(); } For some reason, it prints out like this: **** * ** * * Any idea how to reverse the second for loop, so it prints the other way?
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33052251

http://stackoverflow.com/q/21816501
has body: Hello I am making a program to read chat and if the chat is a certain thing it presses a certain key. I have noticed that the code works, but not when I am in a game. CODE: if (message.equals("up")) { try { Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_W); // press a robot.keyRelease(KeyEvent.VK_W); // release a } catch (AWTException e) { e.printStackTrace(); } } I have tried making so that there are more keypresses because I thought it might be the rate that it inputs at is to fast to detect. I am at a lost any help is very welcome!
has comment: http://stackoverflow.com/comment/33016600
has comment: http://stackoverflow.com/comment/33017787
has answer: http://stackoverflow.com/a/21816572
has title: Code will print characters but not make a game move
upvote count: 1
has comment: http://stackoverflow.com/comment/33017789
type: AnsweredQuestion
tagged with: keyevent
has comment: http://stackoverflow.com/comment/33017788
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21816572
answer count: 1
downvote count: 0
tagged with: key
favorite count: 0

http://stackoverflow.com/comment/32771981
score: 0
comment on: http://stackoverflow.com/q/21679298
type: Comment
type: QuestionComment
has text: This is probably not the right forum for this type question (not flying off, just stating my opinion softly), but I'd say no, there are not any tools to magically convert a C# app to Java. However, there is a tool called PhoneGap (actually, I think the project is Apache Cordova, PhoneGap is just one offering of it) that allows you to write your app in HTML5, then generate clients for many mobile platforms. If you have to rewrite it anyways, and you think you might want to support iOS, Blackberry, etc then it may be worth a look.

http://stackoverflow.com/a/21712270
has comment: http://stackoverflow.com/comment/32831872
answers question: http://stackoverflow.com/q/21711772
type: Answer
has comment: http://stackoverflow.com/comment/32831390
upvote count: 1
has body: 3) Whether you do AA a = new AA(); or AA a = new BB();, the compiler does not remember later what you assigned to a, only that its declared type is AA. However, in the latter case, you can in fact assign the value of a to an element of a BB[], so arr2[0] = a; should not give you a runtime exception. Thus, the compiler cannot tell in advance. (Besides, you could try nasty things to change the value of a at runtime between the respective lines...) 2) Had you used List&lt;AA&gt; listAA = listBB;, you would have gotten a compile error. So what you expected from the array example -- compile time detection of an arising impossible assignment -- in fact works with lists! If you leave out the generic type parameter, however, you will get a raw-type list, to which you can assign other lists without reasonable type checks. This is best considered a leftover from early Java, which should be avoided. If you added the following line below you question's code: BB item = listBB.get(0); Do you think it should/will compile? Should/will it run (and, if so, what should be its result)? The how part of 1) probably warrants a separate question.
has comment: http://stackoverflow.com/comment/32831275
score: 1
has comment: http://stackoverflow.com/comment/32831867
downvote count: 0
has comment: http://stackoverflow.com/comment/32831927

http://stackoverflow.com/a/21774510
type: Answer
score: 1
upvote count: 1
has body: If you want a list behaviour guaranteeing a uniqueness of elements use a LinkedHashSet instead of ArrayList. If you are bound to using ArrayList (as in a student exercise), extend it, overwrite add and addAll methods by checking the uniqueness first and then calling super.add resp. super.addAll and then use the new class in place of ArrayList.
has comment: http://stackoverflow.com/comment/32942636
has comment: http://stackoverflow.com/comment/32942298
answers question: http://stackoverflow.com/q/21774450
downvote count: 0
has comment: http://stackoverflow.com/comment/32941728
has comment: http://stackoverflow.com/comment/32941901

http://stackoverflow.com/comment/33051389
comment on: http://stackoverflow.com/a/21835635
has text: @DusteD but if the number have two digits ? eg: 23 my buffer expect 4 digits how can I do?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21691345
has body: I have seen several examples using switch statements already with cases for 3 months at a time being a different season. But I want to create a method using a switch statement where the seasons start from specific date, for example: December 21 - March 20 = Winter March 21 - June 20 = Spring June 21 - September = Summer September 21 - December 20 = Autumn I want to do it using a user-inputted int variable for each the month, and the date. Please could someone tell me how I could go about doing this? Please bare in mind I am fairly new to coding My current code includes a method to check if the date is valid but is still a work in progress: package seasonclassification; import java.util.Scanner; public class SeasonClassification { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter the month in terms of numbers (e.g March = 3) you wish to check the season of:"); int calMonth = scan.nextInt(); System.out.println("Enter the day in terms of numbers (e.g 27th = 27):"); int calDay = scan.nextInt(); } public static boolean isValidDate(int month, int day) { boolean x; if ((month == 1) || (month == 3) || (month == 5) || (month == 7) || (month == 8) || (month == 10) || (month == 12) &amp;&amp; (day &gt;= 1) &amp;&amp; (day &lt;= 31)) { x = true; } if ((month == 4) || (month == 6) || (month == 9) || (month == 11) &amp;&amp; (day &gt;= 1) &amp;&amp; (day &lt;= 30)) { x = true; } if ((month == 2) &amp;&amp; (day &gt;= 1) &amp;&amp; (day &lt;= 29)) { x = true; } else { x = false; } return x; } public static String findSeason(int month, int day) { switch (month,day) { } } }
upvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21691715
has answer: http://stackoverflow.com/a/21691425
has answer: http://stackoverflow.com/a/21691715
score: -3
accepted answer: http://stackoverflow.com/a/21691727
has comment: http://stackoverflow.com/comment/32794244
has title: How can I write a method in java using a switch statement to calculate the season of a given date?
type: AnsweredQuestion
tagged with: java
downvote count: 3
linked to: http://stackoverflow.com/q/6437257
tagged with: methods
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/32794143
tagged with: date
has comment: http://stackoverflow.com/comment/32794137
has answer: http://stackoverflow.com/a/21691727
has comment: http://stackoverflow.com/comment/32794255
answer count: 3

http://stackoverflow.com/comment/32947978
comment on: http://stackoverflow.com/a/21777187
score: 0
type: AnswerComment
type: Comment
has text: I thought to use strategy pattern but I need my `Context` class to be an instance of the `Strategy` class: my `WrappedSequence` has to be a `Sequence`, becouse I have some reader and writer that uses `Sequence` as input and output.

http://stackoverflow.com/a/21792382
has comment: http://stackoverflow.com/comment/32999503
score: 2
has comment: http://stackoverflow.com/comment/33001363
has body: There's two things going on here. The first is integer division because symbolsWritten and totalSymbols are both int. So you will never get a fractional value from int / int. It will just jump from 0 to 1. You can make a cast if you want: bar.setValue((int)Math.round( 100.0 * ((double)symbolsWritten / (double)totalSymbols) )); (Either that or define them as double to begin with. It's OK to use ++ on a double if the values are in the range of an int.) The other is the way you are updating the value because it ought to be done on the Event Dispatch Thread. And it depends on how this method gets called. If this is called in an event, you need to be starting a background thread or the updates will not be shown until the process is complete. @Override public void actionPerformed(ActionEvent ae) { // some action event final String someString = "SoMe StRiNg"; // some String SwingWorker&lt;Void, Void&gt; task = new SwingWorker&lt;Void, Void&gt;() { @Override public Void doInBackground() { writeFileLC(someString.toCharArray()); return (Void)null; } @Override public void done() { try { get(); } catch(Exception e) { e.printStackTrace(System.err); } } }; task.execute(); } (The funny business in done is weird but important if you want to catch exceptions that get thrown in doInBackground. SwingWorker will eat them but will throw an ExecutionException with the eaten exception as its cause if you call get.) If you are already running this in a SwingWorker or other Thread, you should be calling these updates on the EDT. Either by using SwingWorker's publish or by using invokeLater. So when you want to update the progress bar inside writeFileLC: final int progress = (int)Math.round( 100.0 * ((double)symbolsWritten / (double)totalSymbols) ); EventQueue.invokeLater(new Runnable() { @Override public void run() { bar.setValue(progress); } }); publish is a bit less responsive typically than invokeLater because it combines the results. Personally, I usually use invokeLater to update a pro…
accepted answer of: http://stackoverflow.com/q/21792203
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21792203
upvote count: 2
type: Answer

http://stackoverflow.com/comment/32973076
comment on: http://stackoverflow.com/q/21791886
score: 0
type: Comment
type: QuestionComment
has text: You should use a debugger or logger to check every summand for rounding issues.

http://stackoverflow.com/comment/33045073
score: 0
type: Comment
type: QuestionComment
has text: In addition to Joop, have a look at AspectJ.
comment on: http://stackoverflow.com/q/21832620

http://stackoverflow.com/comment/32948114
comment on: http://stackoverflow.com/q/21777892
type: Comment
type: QuestionComment
has text: Yes thank you for noting that. I didn't actually evaluate how much time will be compromised. But I'm going to use `volatile` instead of synchronization as that will be enough in this case seeing all the other replies.
score: 0

http://stackoverflow.com/comment/53856934
has text: Note, that you need to include both of them Snappy and LZ4
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24642846
type: AnswerComment

http://stackoverflow.com/q/21797851
tagged with: dictionary
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
downvote count: 1
type: Question
has body: I'm trying to write a method that will return an ArrayList of Strings from my HashMap. Currently I have a HashMap that contains a String as the identifier (key?), and a List of type String that holds all the values associated with it. The program is meant to mimic a train/subway navigation tool, so the first String is the station name, and the arraylist is a series of Strings showing all the connected stations. Here is what I have so far, but it won't currently compile. There are several other methods which I know are working, so I've just put the final one which I'm having difficulty with (getConnections). I'm very much a novice at this, so if someone could point out where I've gone wrong I'd really appreciate it. public class MyNetwork implements Network { Map&lt;String, List&lt;String&gt;&gt; stations = new HashMap&lt;&gt;(); @Override public String[] getConnections(String fromStation) { /** * Get a list of all stations directly connected to a given station. * * @pre fromStation has been added to the network by the method * addStation. * @param fromStation * @return A list of all the stations to which there is a direct * connection from fromStation. */ ArrayList&lt;String&gt; Connections = new ArrayList&lt;&gt;(); Set&lt;String&gt; keys = stations.keySet(); for (String k : keys) { String keyValue; keyValue = (stations.get(fromStation)); } return fromStation; }
tagged with: hashmap
has title: JAVA: Hashmap - return arraylist of strings
tagged with: arraylist
answer count: 1
has answer: http://stackoverflow.com/a/21797903
accepted answer: http://stackoverflow.com/a/21797903
tagged with: string
favorite count: 0

http://stackoverflow.com/a/21727255
has comment: http://stackoverflow.com/comment/32857196
upvote count: 5
has comment: http://stackoverflow.com/comment/32856609
has comment: http://stackoverflow.com/comment/32856894
downvote count: 0
answers question: http://stackoverflow.com/q/21727182
has comment: http://stackoverflow.com/comment/32857333
has comment: http://stackoverflow.com/comment/32858026
accepted answer of: http://stackoverflow.com/q/21727182
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32858775
type: Answer
has body: Your problem is this line: Rectangle rect = item.getBounds(0); You are asking for the bounds of the first column. Just change the index to the column where you want your tooltip to appear and you'll be fine: Rectangle rect = item.getBounds(2); If you need to get the column index from the mouse position, use this code: Point point = new Point(event.x, event.y); int column = 0; for (int i = 0; i &lt; table.getColumnCount(); i++) { if (item.getBounds(i).contains(point)) { column = i; break; } } Rectangle rect = item.getBounds(column);

http://stackoverflow.com/comment/33426212
has text: Sorry, it is a bit late. But, from the command line: http://cobbservations.wordpress.com/2013/11/05/disabling-app-nap-in-os-x-mavericks/
comment on: http://stackoverflow.com/q/21688823
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21713675
downvote count: 0
has comment: http://stackoverflow.com/comment/32835127
has comment: http://stackoverflow.com/comment/32834326
type: Answer
has comment: http://stackoverflow.com/comment/32834285
has comment: http://stackoverflow.com/comment/32834359
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32834365
answers question: http://stackoverflow.com/q/21713573
has comment: http://stackoverflow.com/comment/32835041
has body: Ad 1.: The cast itself is safe, because you don't specify any types which the compiler can not match against the method signature. Java 4 List can be safely assigned to Java 5 List&lt;?&gt;, but when you specify a type, you assume something, the compile can not safely check (therefore the warning). Ad 2.: You have substituted a "hard" language cast with a "soft" method call cast, which will fail equally, if the classes are not castable into one another - I prefer the less verbose version of language casting, because one should rely one one's API.

http://stackoverflow.com/q/21835569
downvote count: 0
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/33059085
has body: I'm developing a web app (java) and I'm using Hibernate 4.1.4 and oracle 11g. By security's rules, the dbuser (the db user that app uses) doesnt have insert privileges. Then every time my app is gonna do a insert, it must execute the query "SET ROLE XXXX ...." before the insertion-query be executed. This "set role.." will give to dbuser the privileges to insert into some tables int that transaction. How to do it with Hibernate? I don't wanna put it in a default conf because I should execute the above query only in insertions (not to selects...). I tried do it on my save method: public Object saveOrUpdate(Object entity) { Query query = getSessionFactory().getCurrentSession().createSQLQuery("set role XXXX identified by XXXX"); query.executeUpdate(); getSessionFactory().getCurrentSession().saveOrUpdate(entity); return entity; } but it doesnt work. I get the error "view or table not exist". When I try execute only the query.executeUpdate() or the saveOrUpdate(entity) no error happened. I guess it is all. If you need more details, please ask to me. Thanks!
upvote count: 2
has title: How to execute a "SET ROLE XXXX..." with Hibernate
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/33053244
tagged with: insert
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: role
score: 2

http://stackoverflow.com/comment/32921319
type: QuestionComment
has text: What are you drawing? It's possibly due to some very complex drawing in your scrollview. Try to remove all unnecessary views (perhaps replacing them with plain views with a background), and try again.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21763221

http://stackoverflow.com/comment/33074617
score: 0
type: AnswerComment
has text: Why do you think you need this? The exception tells you.
type: Comment
comment on: http://stackoverflow.com/a/21826701

http://stackoverflow.com/comment/32807864
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21691913
type: AnswerComment
has text: @Paul Bellora: I don’t know whether it really was ever necessary, but by looking at the Java 7 code of `AbstractQueuedSynchronizer.ConditionObject` which is the back-end for the `wait` functionality it becomes clear that it is not necessary with this implementation. Consuming a signal and receiving an `InterruptedException` are mutually exclusive. So there is no need to catch the exception and re-signal.

http://stackoverflow.com/comment/32795158
type: QuestionComment
comment on: http://stackoverflow.com/q/21691963
has text: Duplicate of: [How to concatenate two arrays in Java?](http://stackoverflow.com/questions/80476/how-to-concatenate-two-arrays-in-java)
score: 0
type: Comment

http://stackoverflow.com/comment/32859773
comment on: http://stackoverflow.com/a/21728113
score: 0
type: AnswerComment
has text: This is working fine but the answer is in string. I want it to be converted to Double using valueOf method like the way i am doing in my code. After conversion,the trailing zero is trimmed off.So is there any way around?
type: Comment

http://stackoverflow.com/a/21788713
downvote count: 1
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21788661
has body: You should try using else, the compiler does not know that one of your current conditions must evaluate to true (because as posted they are all independent and unconnected statements). public String BMIResult(double weight,double height) { double bmi=((weight*703)/(height*height)); if (BMI&lt;18.5) { return "You are underweight."; } else if (BMI&lt;26) { // BMI&gt;=18.5 not needed, or the first if would be entered. return "Your weight is healthy."; } else { // &lt;-- you might omit this else entirely, and end the method return "You are overweight."; // &lt;-- with this } }
upvote count: 2

http://stackoverflow.com/comment/32878084
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21723493
has text: I have posted it as a question: http://stackoverflow.com/questions/21738690/strange-jit-pessimization-of-a-loop-idiom

http://stackoverflow.com/a/21835371
has body: If I understand your question, you want to compare word in the strings. For this you can split your first string using space as regex with String.split(), then you check if the second string contains that word using String.contains(). Like this: String[] temp = string1.split(" "); for(string x : temp){ if(string2.contains(x))System.println(x); }
answers question: http://stackoverflow.com/q/21834631
score: 0
type: Answer

http://stackoverflow.com/q/21719214
linked to: http://stackoverflow.com/q/1979957
answer count: 1
downvote count: 0
tagged with: servlet-3.0
has answer: http://stackoverflow.com/a/21719559
has title: Maven automatically removes trailing zeroes in dependency version (javax.servlet-api)
tagged with: dependencies
favorite count: 0
has body: I am trying to add the javax.servlet-api project to my Maven Java project (see this link for more information about versions for this dependency). I want to add version 3.1.0 to my project. So naturally, I add this dependency to my pom.xml file: javax.servlet javax.servlet-api 3.1.0 However, when Maven tries to download the jar/pom files for this artifact, it gets an error because it automatically converts version 3.1.0 to 3.1, which is not its actual version, and it cannot find that version of the artifact in the central Maven repo: Downloading: http://repo.maven.apache.org/maven2/javax/servlet/javax.servlet-api/3.1/javax.servlet-api-3.1.pom [WARNING] The POM for javax.servlet:javax.servlet-api:jar:3.1 is missing, no dependency information available Downloading: http://repo.maven.apache.org/maven2/javax/servlet/javax.servlet-api/3.1/javax.servlet-api-3.1.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ ... [ERROR] Failed to execute goal on project my-java-project: Could not resolve dependencies for project com.example.myproject:my-project:war:1.0-SNAPSHOT: Could not find artifact javax.servlet:javax.servlet-api:jar:3.1 in central (http://repo.maven.apache.org/maven2) -> [Help 1] Does anyone know how I can tell Maven to not strip off trailing zeroes in the version tag of a dependency in my pom.xml file? Any other workaround known? NOTE: I did check out this SOF post (Maven dependency for Servlet 3.0 API?), but this author's solution was to use a provided dependency for servlet-api, which I do not have interest in doing becuase I want to avoid needing to use the provided scope.
upvote count: 1
tagged with: maven
accepted answer: http://stackoverflow.com/a/21719559
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: servlets
type: Question

http://stackoverflow.com/q/21764704
tagged with: algorithm
linked to: http://stackoverflow.com/q/8106376
tagged with: java
has answer: http://stackoverflow.com/a/21788788
type: Question
has comment: http://stackoverflow.com/comment/32924417
answer count: 2
score: 2
tagged with: arrays
downvote count: 0
tagged with: swap
has title: alternate the order of elements of array
linked to: http://stackoverflow.com/q/18043778
favorite count: 0
has comment: http://stackoverflow.com/comment/32924895
linked to: http://stackoverflow.com/q/5557326
accepted answer: http://stackoverflow.com/a/21788788
upvote count: 2
possible better answer: http://stackoverflow.com/a/42786645
has body: Given an array [1, 2, 3, a, b, c], write a method to re-arrange the array such that every other elements change its place. The output should be [1, a, 2, b, 3, c]. 1.Write an algorithm that works faster and uses O(1) space. 2. If you are allowed one extra-space, how much improvement to time-complexity could be achieved. This is an interview question. There are couple of posts in SO, Interview test - rearrange the array, Reordering of array elements, Array movement from a1,..,an,b1,..,bn to a1,b1,..,an,bn and elsewhere, where various explanations are provided, but to me its not clear and concrete. I have a got a O(n^2) solution for the first question above. but it appears there is a possibility to improve it. but I really don't undersand the explanations from these posts, especially some referring to theoretical papers. It would be great if a simple pseudocode for improved time-complexity (better than O(n^2))for the first question would be great For the second, question the time complexity could be reduced to O(n), by using one storage array. but I don't see any way to improve it further. If it is possible, I would be love to hear it. The code for my first attempt (without using auxillary storage) is here: import java.util.Arrays; public class SwapHalfArrayElements { public static void main(String[] args){ Object[] arr = {1,2,3,'a','b','c'}; System.out.println("before sorting "+Arrays.toString(arr)); rearrageArray(arr); System.out.println("After sorting "+ Arrays.toString(arr)); } private static void swap(Object[] arr, int index1, int index2){ Object temp=arr[index1]; arr[index1]=arr[index2]; arr[index2]=temp; } private static void rearrageArray(Object[] arr){ int n=arr.length/2; for (int i=1;i&lt;n;i++){ for (int j=-i;j&lt;i;j+=2){ swap(arr,n+j,n+j+1); } } } }
has answer: http://stackoverflow.com/a/42786645
type: AnsweredQuestion

http://stackoverflow.com/a/21765972
accepted answer of: http://stackoverflow.com/q/21765807
has body: You can create your own action: interface PlaylistListener { void addToPlaylist(String name); } class MainClass implements PlaylistListener { private void createJMenu() { addto = new JMenu("add to"); //... for(String x: model.getPlaylist()){ addto.add(new AddToPlaylistAction(x, this)); } //... } @Override void addToPlaylist(String name) { //... } } class AddToPlaylistAction extends AbstractAction { private String name; private PlaylistListener callback; public AddToPlaylistAction(String name, PlaylistListener callback) { super(name); this.name = name; this.callback = callback; } void actionPerformed(ActionEvent e) { callback.addToPlaylist(name); } }
has comment: http://stackoverflow.com/comment/32927590
has comment: http://stackoverflow.com/comment/32926617
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21765807
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/32706161
has body: I don't know if you have to use scanner but this is how i would do it.BTW this code works with Jcreator. public static void main(String[] args) { String say = IO.getString("Say something") // This is asking the user to say something System.out.print(name); } If you want it to loop 10 times then then do this public static void main(String[] args) { String say = IO.getString("Say something"); // This is asking the user to say something int count = 10; // it will loop 10 times while (count &gt;= 10) { System.out.print(name); say = IO.getString("Say something"); count++; } By the way if you don't have IO class you can you this. Just copy this code into jcreator and say it where you save all your codes. /** * @(#)IO.java * This file is designed to allow HCRHS students to collect information from the * user during Computer Science 1 and Computer Science 2. * @author Mr. Twisler, Mr. Gaylord * @version 2.01 2014/12/21 * *Updated fix to let \t work for all input/output * *Added input methods to allow for console input * *Allowed all get methods to work with all objects * *Updated format methods to use String.format() */ import javax.swing.JOptionPane; import javax.swing.JTextArea; import java.util.Scanner; import java.util.InputMismatchException; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; public class IO { // Shows a message in a popup window public static void showMsg(Object obj) { JTextArea text = new JTextArea(obj.toString()); text.setBorder(null); text.setOpaque(false); text.setEditable(false); //String text = obj.toString().replace("\t", " "); JOptionPane.showMessageDialog(null, text, "HCRHS", JOptionPane.PLAIN_MESSAGE); } /*********************************User Input Methods*************************** * All user input methods get the data type mentioned in their name and return * a default value if the user enters an incorrect responce. ******************************************************************************/ // Returns …
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21745107

http://stackoverflow.com/a/21719879
has body: You should set nodes[index] = new Node() before assign any value to nodes[index]'s attributes. And the attributes of Node class should not be static, as every node should have its own values. Because every element in your nodes array will be null unless you set a value to it. And in your code, when you set value to nodes[index].outDegree, you are setting value of Node.outDegree actually, and nodes[index] is still null. So in the end, you get a array which is full of null. In summary, there is two mistakes here. Incorrectly use of static keywords and forget to initialize item of object array before using it.
answers question: http://stackoverflow.com/q/21719220
score: 0
type: Answer

http://stackoverflow.com/q/21720647
score: 0
tagged with: xml-parsing
answer count: 1
tagged with: url
has answer: http://stackoverflow.com/a/21722248
has title: Get the main content from RSS Feeds
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32861845
tagged with: android
has body: I've created an application which lists all the feed items in ListFragment. My question is how to load the full text from the link. I've tried with WebView, but it is loading the complete URL. Since RSS XML structure does not have any tags related to full/actual content, can anyone give some reference so that I can use it? This is how I've tried to load the URL in WebView: URL = getIntent().getStringExtra("url"); webView = (WebView) findViewById(R.id.activity_display_news_webview); webView.loadUrl(URL);
tagged with: rss
type: Question
tagged with: java

http://stackoverflow.com/q/21761865
type: AnsweredQuestion
has title: java coding style: one annotation with parameters, or several annotations with just one?
accepted answer: http://stackoverflow.com/a/21762349
tagged with: annotations
has body: I have got an annotation with about 10 parameters, all optional. But in case you use them, it may look like this: @myAnnotation(oneFlag anotherFlag parameter="value"). Splitting the one annotation into several, the example would look like this: @oneFlag @anotherFlag @parameter("value"); Which "good java style" criterial exist for this?
tagged with: styles
type: Question
has answer: http://stackoverflow.com/a/21762349
tagged with: java
answer count: 1
score: 0

http://stackoverflow.com/comment/32872322
type: QuestionComment
has text: Hello Michael, You can't down vote this. That links doesn't give the answer what I need. Even after closing the stream, i couldn't get the while loop thru.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21735427

http://stackoverflow.com/comment/32958578
type: QuestionComment
comment on: http://stackoverflow.com/q/21784200
score: 0
has text: Why would you want methods to be virtual by default? That could just cause more issues than anything else. To me it is better to specify something is virtual rather than having to say every property is not virtual.
type: Comment

http://stackoverflow.com/comment/32898229
type: Comment
has text: @noloader Yes, but changing the permission the file is better than executing it as super user
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21750062

http://stackoverflow.com/q/21730990
has answer: http://stackoverflow.com/a/21731899
tagged with: testng
tagged with: selenium-webdriver
linked to: http://stackoverflow.com/q/20395416
upvote count: 3
has comment: http://stackoverflow.com/comment/33042317
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31316947
score: 3
linked to: http://stackoverflow.com/q/14683800
tagged with: java
has title: Intellij IDEA Console Logging Truncated With TestNG Run/Debug Configuration
type: Question
tagged with: intellij-idea
downvote count: 0
has body: For some reason Intellij IDEA's 'save console output to file' option in run/debug configurations gets truncated for my TestNG test runs. Other posters have pointed out that to actually see the console output for all the tests, you have to drill down on the tree in the IDEA Run window, click + on package, click + on test class, etc. then click on each test method to see it's console output. EG: IntelliJ IDEA TestNG output console clears And: Intellij not shows test results in console However I don't see a post anywhere explaining how to actually log all of this to one log file. And I really don't get why IDEA must break up one test run's console outs to so many places in the tree, seems kind of silly. Anyway, all I'm getting in the log file is my initialization class output, but nothing from any of the subsequent tests (drilled further down in the tree). Any suggestions how to make IDEA logging work with TestNG much appreciated.
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/35784247

http://stackoverflow.com/q/21803118
has comment: http://stackoverflow.com/comment/32992869
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32992616
accepted answer: http://stackoverflow.com/a/21803575
has comment: http://stackoverflow.com/comment/32992715
has comment: http://stackoverflow.com/comment/32993221
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32992653
has comment: http://stackoverflow.com/comment/32992864
tagged with: java
has comment: http://stackoverflow.com/comment/32994045
upvote count: 1
type: Question
tagged with: 2d
has body: Hello in my game when I walk and jump, it stops everything after the jump finishes: Can you see after a jump, it continues walking for a bit &amp; then stops? It should stop immediately but my walking queue continues executing because I didn't reset it, it should only reset upon keypress or release. But keypressing will stop working after i release my jump key. I think if I use 2 keys at a time and release on, the OS won't remember the old key I am still pressing. Even in your browser URL input, press and any key and hold, and then hold another key for bit &amp; release it, it won't write the old key anymore. Is there a fix for this? I am using keylistener, because i couldn't figure out how to find out when a key was released in KeyBinds. This is how I do it: public class Keyboard implements KeyListener { private Player player; public Keyboard(Player p) { this.player = p; } @Override public void keyPressed(KeyEvent e) { System.out.println("yes"); switch (e.getKeyCode()) { case KeyEvent.VK_LEFT: this.player.getMovement().moveLeft(); break; case KeyEvent.VK_RIGHT: this.player.getMovement().moveRight(); break; case KeyEvent.VK_SPACE: this.player.getMovement().jump(); break; } } @Override public void keyReleased(KeyEvent e) { int left = KeyEvent.VK_LEFT; int right = KeyEvent.VK_RIGHT; if (e.getKeyCode() == left || e.getKeyCode() == right) { this.player.getMovement().stopMovement(); } } @Override public void keyTyped(KeyEvent e) { } } How can I fix this issue? If you need more parts of the code like the jump or walking queue, let me know. Keylog: Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Right clicked! Space is a nice button
has answer: http://stackoverflow.com/a/21803575
has comment: http://stackoverflow.com/comment/32993265
has comment: http://stackoverflow.com/comment/32992829
has title: Java game walking + jumping stops the key pressing action?

http://stackoverflow.com/comment/32952745
comment on: http://stackoverflow.com/a/21770062
score: 0
has text: I think in Eclipse there is a way to just bring up and empy form with in design view but for the life of me I could not figure out how to do it last night.
type: AnswerComment
type: Comment

gps
tags question: http://stackoverflow.com/q/21821514
tags question: http://stackoverflow.com/q/21681101
tags question: http://stackoverflow.com/q/21782785
tags question: http://stackoverflow.com/q/21691342
tag name: gps
type: Tag
tags question: http://stackoverflow.com/q/21787743

http://stackoverflow.com/q/21839183
has body: I'm facing the following problem.I can not type text in iframe in which there is a text editor:Here is the html: Here is what I have done so far,but the test passed successfully and no text is writen in the text editor.May be the solution is with Javascript executor but I'm not familiar with it. WaitTool.waitForElementPresent(Browser.instance, By.tagName("iframe"), 10); WebElement iframe = Browser.instance.findElement(By.tagName("iframe")); Browser.instance.switchTo().frame(iframe); WebElement description=Browser.instance.findElement(By.xpath("//body[@class='cke_editable cke_editable_themed cke_contents_ltr']")); description.click(); description.sendKeys("someText"); Browser.instance.switchTo().defaultContent(); Thanks in Advance!
has title: How to use SendKeys(webdriver) command in Rich Text editor that is located in iframe
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21839295
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: iframe
tagged with: selenium
has answer: http://stackoverflow.com/a/21839295
type: Question

http://stackoverflow.com/comment/32803607
comment on: http://stackoverflow.com/a/21696948
score: 0
type: AnswerComment
has text: @BoristheSpider Yea definitely. I will try
type: Comment

http://stackoverflow.com/comment/32989185
score: 0
has text: Well, I have successfully used this JNDI approach in almost every web application project I've worked and having no problems related to connectivity...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21769196

http://stackoverflow.com/comment/32910347
type: Comment
type: QuestionComment
has text: maybe It's abstract or singlton, try AdView.getInstance() insteat of new AdView()
comment on: http://stackoverflow.com/q/21757111
score: 0

http://stackoverflow.com/a/34726965
type: Answer
answers question: http://stackoverflow.com/q/21750365
score: 0
has body: function countString(ss) { var maxChar=''; var maxCount=0; for(var i=0;i&lt;ss.length;i++) { var charCount=0; var localChar='' for(var j=i+1;j&lt;ss.length;j++) { if(ss[i]!=' ' &amp;&amp; ss[i] !=maxChar) if(ss[i]==ss[j]) { localChar=ss[i]; ++charCount; } } if(charCount&gt;maxCount) { maxCount=charCount; maxChar=localChar; } } alert(maxCount+""+maxChar) }

http://stackoverflow.com/comment/32808863
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21696146
type: Comment
has text: In hibernate 4.2.0 have packacge org.hibernate.validator.method for malidate methods how validate with hibertnate validator 5.0.3

http://stackoverflow.com/q/21688966
has answer: http://stackoverflow.com/a/21688994
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/18669755
has body: I'm trying to see how much memory is used when I have a lot of duplicate strings. I am using the method highlighted in this answer (at the bottom) Here's me creating a list of a ten million strings, where each string has only a few characters. public class Test1 { public static void main(String[] args) { int count = 10000000; List&lt;String&gt; names = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; count; i++) { names.add("test"); } Runtime rt = Runtime.getRuntime(); long usedMem = rt.totalMemory() - rt.freeMemory(); System.out.println(usedMem / (1024*1024) + " MB"); } } I run it, and it says 88 MB. I am not too sure what this represents, but I'll just take it as a number to compare iwth. Here's me doing the same test again, except I replaced the small string with some lorem ipsum text public class Test1 { public static void main(String[] args) { int count = 10000000; List&lt;String&gt; names = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; count; i++) { names.add("Lorem ipsum dolor sit amet, brute euismod eleifend te quo, ne qui iudicabit hendrerit. Ea sit dolore assentior prodesset. In ludus adipiscing eos, ius erat graeco at, cu nec melius copiosae. Epicuri suavitate gubergren id sea, possim animal eu nam, cu error libris expetendis his. Te sea agam fabulas, vis eruditi complectitur ei. Ei sale modus vis, pri et iracundia temporibus. Mel mundi antiopam ad."); } Runtime rt = Runtime.getRuntime(); long usedMem = rt.totalMemory() - rt.freeMemory(); System.out.println(usedMem / (1024*1024) + " MB"); } } I run this, and it says 88 MB again. This is not meant to be an attempt to properly benchmark memory usage, but I was expecting the number for the ipsum lorem string to be somewhat larger because there are about 50x as many characters in the string. How does Java store arrays of strings in memory? Or, am I doing something wrong?
has answer: http://stackoverflow.com/a/21689008
answer count: 3
possible better answer: http://stackoverflow.com/a/21689008
has comment: http://stackoverflow.com/comment/32789630
accepted answer: http://stackoverflow.com/a/21688994
has answer: http://stackoverflow.com/a/21688990
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/3571203
has title: How are arrays of strings stored in memory
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/33022560
type: Comment
type: QuestionComment
has text: Yes that's what I figured out. Damn it. Thank you for your help.
comment on: http://stackoverflow.com/q/21816744
score: 0

jasper-reports
tags question: http://stackoverflow.com/q/21705085
tags question: http://stackoverflow.com/q/21791371
tags question: http://stackoverflow.com/q/21777874
tags question: http://stackoverflow.com/q/21760240
tags question: http://stackoverflow.com/q/21796883
tag name: jasper-reports
tags question: http://stackoverflow.com/q/21693362
tags question: http://stackoverflow.com/q/21710727
tags question: http://stackoverflow.com/q/21732319
tags question: http://stackoverflow.com/q/21762483
tags question: http://stackoverflow.com/q/21700651
type: Tag
tags question: http://stackoverflow.com/q/21776498
tags question: http://stackoverflow.com/q/21819881
tags question: http://stackoverflow.com/q/21786044

http://stackoverflow.com/a/21682211
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32781032
downvote count: 0
has body: Rather then use Replace Fragment use Add Fragment and Remove Fragment.. I already do this in one of my app.It's working properly.
type: Answer
has comment: http://stackoverflow.com/comment/32810268
answers question: http://stackoverflow.com/q/21682072

http://stackoverflow.com/q/21829639
score: 2
downvote count: 0
tagged with: java
has body: I have an Applet code like below. I have a String called String randomNumberStr in this Applet to display a random number, which has retrieved from a socket server. After Applet window is displayed, I have a button called "Connect". Clicking on this button will connect with Socket program and gets a Random Number string. My issue is, I am running socket connection code in a separate thread SocketConnectionThread in this Applet, But, String randomNumberStr and repaint function are there in main thread. How can i access and pass the random number value from this thread SocketConnectionThread to main and repaint the Applet window? public class CobrowseApplet extends Applet implements ActionListener { private static final long serialVersionUID = 1L; String titleStr ; String randomNumberStr; Image sharedImage; BufferedImage image; private Button connectBtn; Socket localSocket; PrintWriter out; BufferedReader in; static Timer timer; int delay = 1000; int period = 1000; DataInputStream inStream; PrintStream outStream; InputStream input; public void init(){ titleStr = "Welcome"; randomNumberStr = ""; connectBtn = new Button("Connect"); connectBtn.addActionListener(this); add(connectBtn); connectBtn.setBounds(200, 50, 90, 20); connectBtn.setEnabled(true); setLayout( null ); setSize(550, 650); } public void paint (final Graphics g) { //super.paint(g); int x = getSize().width; int c1 = x/2; g.drawString(titleStr, c1-100, 20); g.drawString(randomNumberStr, c1-100, 80); System.out.println("sharedImage" + sharedImage); //g.drawImage(sharedImage, 100, 100, this); System.out.println("drawImage"); } @Override public void actionPerformed(ActionEvent e) { Thread thr = new Thread(new SocketConnectionThread(randomNumberStr)); thr.start(); if ( connectBtn.getLabel()=="Connect" ) { connectBtn.setLabel(""); connectBtn.setLabel("Disconnect"); } else { connectBtn.setLabel(""); connectBtn.setLabel("Connect"); } System.out.println("randomNumberStr: " + randomNumberStr); repaint(); } } class So…
type: Question
upvote count: 2
has title: Updating String from a Non-Main Thread to Main dynamically in Applet
has answer: http://stackoverflow.com/a/21829763
has answer: http://stackoverflow.com/a/21830095
answer count: 3
has answer: http://stackoverflow.com/a/21851169
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/33039812
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33105806
linked to: http://stackoverflow.com/q/6255106

http://stackoverflow.com/comment/33068702
type: AnswerComment
has text: Thank you for your response But the problem is two different users isn't Allowed , when the second user try to log in he see that already someone else is logged in And about the second point I Put main.com.zc.attSys.security.beans.MyHttpSessionEventPublisher There are the same right ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21840629

http://stackoverflow.com/q/21746131
has comment: http://stackoverflow.com/comment/32938938
score: 0
tagged with: java
tagged with: jspinclude
has body: I have a jsp called view.jsp which has to work in two different scenarios. It has to work independently(I use ajax requests to execute this jsp). It will included by another jsp called main.jsp. Whenever a request come to server i have a common code in validate.jsp which will be used by almost all the jsp's. I'm including the validate.jsp into view.jsp. Ex: view.jsp &lt;%@ include file="validate.jsp" %&gt; `// code specific to view.jsp` This time it works fine if i'm sending request to view.jsp. But the problem is when i include view.jsp in main.jsp i'm getting some errors. Because of redundant data. EX: main.jsp &lt;%@ include file="validate.jsp"%&gt; // some code specific to main.jsp &lt;%@ include file="view.jsp"%&gt; to make view.jsp to be work in both cases i's written a condition like below Ex: view.jsp &lt;% if(request.getParameter("tra")!=null){ %&gt; `&lt;%@ include file="validate.jsp" %&gt;` &lt;% } %&gt; // code specifit to view.jsp i'm sure that this condition will be false when i'm executing main.jsp. But this condition based file include is not at all working when i execute main.jsp i'm getting errors like below. An error occurred at line: 9 in the jsp file: /validte.jsp Duplicate field main_jsp.dt 6: &lt;%@ page language="java" contentType="text/html; charset=UTF-8" 7: pageEncoding="UTF-8"%&gt; An error occurred at line: 10 in the jsp file: /validte.jsp Duplicate field main_jsp.bookInfo 7: pageEncoding="UTF-8"%&gt; An error occurred at line: 11 in the jsp file: /validte.jsp Duplicate field main_jsp.token But the same style coding is working as expected in php. Please some one guide me to make it work out.
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32938988
has comment: http://stackoverflow.com/comment/32891592
tagged with: jsp
type: Question
tagged with: jsp-tags
has comment: http://stackoverflow.com/comment/32891283
has title: jsp conditional based include file is not working as expected
tagged with: php

http://stackoverflow.com/comment/32860772
comment on: http://stackoverflow.com/q/21727150
type: Comment
has text: Can you show your producer and consumer code/configuration? Looks like some of them operate with batches (which is good thing, in fact).
type: QuestionComment
score: 0

http://stackoverflow.com/q/21818463
duplicate of: http://stackoverflow.com/q/19735507
has body: I've been trying to follow a tutorial on the link below, so to utilize the Google maps API within an Android application, but I just can't manage to get it to work properly. I have checked out this website and others. I've requested a new API key several times, I've made sure it was requested correctly (SHA1 fingerprint then my project name, which in this case is "com.example.reallystuck"). I've also made sure the code is correct but still it won't work, I just get the error "Unfortunately GoogleMaps V2 has stopped" when loading it up on the android emulator as in the picture below. If I have got any of the code wrong or done something stupid, I don't mind people pointing it out to me. I just want it to work. Tutorial I have used. . Code: MainActivity.java package com.example.reallystuck; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; public class MainActivity extends Activity { private GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); final LatLng CIU = new LatLng(35.21843892856462, 33.41662287712097); Marker ciu = mMap.addMarker(new MarkerOptions() .position(CIU).title("My Office")); } @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; } } Android Manifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-permission android:name="com.example.reallystuck.p…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33020942
downvote count: 2
upvote count: 1
type: Question
tagged with: java
score: -1
tagged with: eclipse
tagged with: google-maps
answer count: 1
has comment: http://stackoverflow.com/comment/33020198
has title: Google Maps API not functioning in Android
has comment: http://stackoverflow.com/comment/33020956
linked to: http://stackoverflow.com/q/19735507
favorite count: 0
has answer: http://stackoverflow.com/a/21818717
has comment: http://stackoverflow.com/comment/33020469
has comment: http://stackoverflow.com/comment/33020562
tagged with: android

http://stackoverflow.com/comment/33053232
comment on: http://stackoverflow.com/a/21835628
has text: Thank you for your answer, I have also used the variable "project.build.sourceEncoding" instead of the hard coded string "UTF-8" in order to use a generic code for my pom files. I hope I will have helped other developers.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32852832
type: Comment
comment on: http://stackoverflow.com/a/21724054
score: 0
type: AnswerComment
has text: yes, because each database have different syntex, it's just a examaple

http://stackoverflow.com/comment/32880004
comment on: http://stackoverflow.com/q/21736716
has text: I think the issue is more around the loop, because I am able to get the correct answer on the first try every time, but all subsequent entires just repeat the result of the first entry.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33000007
score: 0
comment on: http://stackoverflow.com/q/21807141
has text: It would help if you told us from what line the out-of-bounds exception is being thrown.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21746294
has answer: http://stackoverflow.com/a/66143940
score: 72
has answer: http://stackoverflow.com/a/70655703
answer count: 17
favorite count: 0
has answer: http://stackoverflow.com/a/72974818
has title: How to fix Eclipse autocomplete not working
has answer: http://stackoverflow.com/a/61843398
has answer: http://stackoverflow.com/a/38134408
has answer: http://stackoverflow.com/a/77383527
has answer: http://stackoverflow.com/a/75184399
possible better answer: http://stackoverflow.com/a/56906167
linked to: http://stackoverflow.com/q/908489
linked to: http://stackoverflow.com/q/6202223
has answer: http://stackoverflow.com/a/21748793
accepted answer: http://stackoverflow.com/a/21748793
has comment: http://stackoverflow.com/comment/116910477
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78039746
has answer: http://stackoverflow.com/a/72772546
has answer: http://stackoverflow.com/a/71981210
has answer: http://stackoverflow.com/a/30077602
upvote count: 72
has body: The autocomplete of eclipse is not working now and I searched for hours but I couldn't find an answer to solve it. I haven't used it for long time then the first thing after opening it was to install SWT and windows builder even though I had swing installed. What I mean is, it is may possibly be because of some conflict caused by swt and swing(I read something about a conflict but I don't if this is possible). Strange thing is it doesn't show anything when I press ctrl+space but when I go Edit-> Content Assist -> Default(it says Ctrl+Space nearby it), it shows things needed to be shown/works as desired. public class Dsada { String sssss; public Dsada(){ sss //pressing ctrl+space is not working,Edit->ContentAssist->Default works fine } } The solution is not to tick/untick some stuff under Windows->Preferences->...->Content Assist-> Advanced. I checked if "ctrl+space" is hijacked by some other thing which is not and checked keyboard language which is English (Those are suggested in mkyong). I read something about a bug but I couldn't understand. I tried to delete eclipse and re-install again but I guess some settings just stayed in the machine so that it didn't work.
type: Question
has answer: http://stackoverflow.com/a/76424854
has answer: http://stackoverflow.com/a/78683522
tagged with: autocomplete
tagged with: content-assist
has answer: http://stackoverflow.com/a/56906167
has answer: http://stackoverflow.com/a/41575258
tagged with: java
has answer: http://stackoverflow.com/a/35914162
has comment: http://stackoverflow.com/comment/111721991
tagged with: eclipse
has comment: http://stackoverflow.com/comment/122248335
downvote count: 0

http://stackoverflow.com/q/21757285
has body: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.amkit myapp SpringMVCFirst war 1.0.0-BUILD-SNAPSHOT 1.6 <org.springframework-version>3.2.2.RELEASE</org.springframework-version> <org.aspectj-version>1.6.10</org.aspectj-version> <org.slf4j-version>1.6.6</org.slf4j-version> org.springframework spring-aop ${org.springframework-version} org.springframework spring-beans ${org.springframework-version} org.springframework spring-context ${org.springframework-version} commons-logging commons-logging org.springframework spring-core ${org.springframework-version} org.springframework spring-jdbc ${org.springframework-version} org.springframework spring-orm ${org.springframework-version} org.springframework spring-tx ${org.springframework-version} org.springframework spring-web ${org.springframework-version} org.springframework spring-webmvc ${org.springframework-version} commons-httpclient commons-httpclient 3.1 cglib cglib 2.2.2 org.aspectj aspectjrt ${org.aspectj-version} org.slf4j slf4j-api ${org.slf4j-version} org.slf4j jcl-over-slf4j ${org.slf4j-version} runtime org.slf4j slf4j-log4j12 ${org.slf4j-version} runtime log4j log4j 1.2.15 javax.mail mail javax.jms jms com.sun.jdmk jmxtools com.sun.jmx jmxri runtime javax.inject javax.inject 1 javax.servlet servlet-api 2.5 provided javax.servlet.jsp jsp-api 2.1 provided javax.servlet jstl 1.2 junit junit 4.7 test maven-eclipse-plugin 2.9 <additionalProjectnatures> org.springframework.ide.eclipse.core.springnature </additionalProjectnatures> <additionalBuildcommands> org.springframework.ide.eclipse.core.springbuilder </additionalBuildcommands> true true org.apache.maven.plugins maven-compiler-plugin 2.5.1 1.6 1.6 -Xlint:all true true org.codehaus.mojo exec-maven-plugin 1.2.1 org.test.int1.Main > And the error is that i see on the console: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init …
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/21757646
score: 0
answer count: 2
has title: I'm using SpringMVC for a web app and i'm using sessionFactory for Hibernate. Following is the pom.xml that i am using
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21757522
tagged with: maven
tagged with: spring-mvc

http://stackoverflow.com/q/21812385
type: Question
has answer: http://stackoverflow.com/a/21812474
downvote count: 0
tagged with: classnotfoundexception
answer count: 1
has body: I currently have the following directory tree structure: CLASSES -&gt; ClassOne -&gt;package -&gt; my -&gt;App.class I would like to load the App.class from my local drive. I looked around, particularly stackoverflow, and most seem to suggest that I should use the URLClassLoader. In order to do this, I used this following code: However, I get a ClassNotFoundError. Can anybody help me please. String url = "file://" + classOneFolder.getAbsolutePath(); //Where classesFolder is a File representing the ClassOne directory URL[] urls = {new URL(url)}; urlClassLoader = URLClassLoader.newInstance(urls); //class loader needs the fully classified class name. Therefore: Class appClass = urlClassLoader.loadClass("package.my.App");
has title: ClassNotFound With URLClassLoader
favorite count: 0
accepted answer: http://stackoverflow.com/a/21812474
tagged with: classloader
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/32982605
has text: radio is the old filename. the project name i first had. I changed it to Msurvey and thats when i got this error first
comment on: http://stackoverflow.com/q/21797539
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32849817
has text: Have you checked that `<provider>` element is actually the first element in the `<persistence-unit>`? (it must be after the `<description>` element, in case you have one)
comment on: http://stackoverflow.com/q/21719201
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34754784
comment on: http://stackoverflow.com/q/21812128
score: 0
has text: Sorry, I misinformed you. MergeSort is used on big arrays (bigger then 286).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/55136398
has text: and how can we iterate through array of "photo" in success callback method of Retrofit?
comment on: http://stackoverflow.com/a/30621901
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32884058
type: AnswerComment
type: Comment
has text: Hey Mike, I'm just starting with this stuff.. could you give a link with examples oder any small example code? I'm currently transforming everything with Matrix object and need to keep track of the translations and scaling to keep original koordinates after translation. would that be a problem with a bitmap?
comment on: http://stackoverflow.com/a/21741962
score: 0

http://stackoverflow.com/comment/94915135
comment on: http://stackoverflow.com/a/37840526
type: AnswerComment
has text: Awesome! Worked for me with Spring Boot 2.0.6 and Hibernate 5.
type: Comment
score: 2

http://stackoverflow.com/a/21790875
has comment: http://stackoverflow.com/comment/32971612
accepted answer of: http://stackoverflow.com/q/21790869
has comment: http://stackoverflow.com/comment/32971498
has comment: http://stackoverflow.com/comment/32971591
has comment: http://stackoverflow.com/comment/32971379
answers question: http://stackoverflow.com/q/21790869
score: 3
type: AcceptedAnswer
downvote count: 0
has body: You probably just want to add %n to the end of your format string.
has comment: http://stackoverflow.com/comment/32971632
type: Answer
has comment: http://stackoverflow.com/comment/32971573
has comment: http://stackoverflow.com/comment/32971283
upvote count: 3
has comment: http://stackoverflow.com/comment/32971666
has comment: http://stackoverflow.com/comment/32971429
has comment: http://stackoverflow.com/comment/32971450

http://stackoverflow.com/comment/33001955
comment on: http://stackoverflow.com/q/21808288
type: Comment
type: QuestionComment
has text: Your question is unclear to me, can you please elaborate?
score: 1

http://stackoverflow.com/a/21837828
has body: You can achieve this by creating your own custom layout which can be inflated inside the ListView's getView method as an item and the same layout would be applied to all of them as @nikis said too. Here is an easy to understand and a working example for your need. :) http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/
has comment: http://stackoverflow.com/comment/33054037
type: Answer
has comment: http://stackoverflow.com/comment/33054137
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21837695

http://stackoverflow.com/q/21760439
has body: I've a tabBar with 4 tabs, the Main tab is the first one, and when I click the second one I want do display another activity above the main activity in the half of the screen, reducing the opacity of the main. I'm doing this with a Dialog but it's not the result I want. What are the best way to do this? example image
type: Question
tagged with: eclipse
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32916437
has answer: http://stackoverflow.com/a/21760603
has answer: http://stackoverflow.com/a/21760536
type: UnansweredQuestion
tagged with: android
has title: android 2 activities on the same screen
tagged with: java

http://stackoverflow.com/q/21765429
type: Question
tagged with: tostring
type: AnsweredQuestion
tagged with: actionlistener
tagged with: jtextarea
linked to: http://stackoverflow.com/q/4712139
has comment: http://stackoverflow.com/comment/32925364
score: 0
answer count: 1
has title: Getting my GUI to create an instance from a class and pull that information down into a text area
has answer: http://stackoverflow.com/a/21765456
has body: The goal of this project is simply to enter some text, press a button, and have my GUI create an instance of the "Dog" class in the text area. However, when I press my button, it always prints: "Dog@2a4c6a7d" or some other seemingly random combination of numbers and letters. Any help with this issue would be greatly appreciated. Thanks! Correct and functioning code below: import javax.swing.*; import java.awt.*; import java.awt.event.*; class Dog { private String name; private String breed; private String age; public Dog(String name, String breed, String age) { this.name = name; this.breed = breed; this.age = age; } public String setDogName(String name) { this.name = name; return name; } public String setDogBreed(String breed) { this.breed = breed; return breed; } public String SetDogAge(String age) { this.age = age; return age; } public String toString() { return ("Name: " + this.name + " Breed: " + this.breed + " Age: " + this.age); } } public class LabThree extends JFrame implements ActionListener { public LabThree() { setLayout(new GridLayout(8, 3)); // Creates TextFields, TextAreas, and the button name = new JTextField(); breed = new JTextField(); age = new JTextField(); JButton jbtGenerate = new JButton("Generate Dog"); echoDog = new JTextArea(); // Adds TextFields, TextAreas, and the button add(new JLabel("Name:")); add(name); add(new JLabel("Breed:")); add(breed); add(new JLabel("Age:")); add(age); add(jbtGenerate); jbtGenerate.addActionListener(this); add(echoDog); echoDog.setEditable(false); } // Top TextFields private JTextField name; private JTextField breed; private JTextField age; // Bottom(echoed) TextArea private JTextArea echoDog; public void actionPerformed(ActionEvent a) { Dog dog1 = new Dog(name.getText(), breed.getText(), age.getText()); echoDog.setText(dog1.toString()); } public static void main(String[] args) { LabThree frame = new LabThree(); frame.setTitle("Dog Generator"); frame.setSize(500, 400); frame.setLocationRelativeTo(null); frame.se…
has comment: http://stackoverflow.com/comment/32925485
accepted answer: http://stackoverflow.com/a/21765456
has comment: http://stackoverflow.com/comment/32925419
tagged with: java
tagged with: jtextfield

http://stackoverflow.com/q/21791365
type: AnsweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32972098
has answer: http://stackoverflow.com/a/21791477
type: Question
answer count: 2
tagged with: assert
has comment: http://stackoverflow.com/comment/32972117
upvote count: 0
has comment: http://stackoverflow.com/comment/32972017
has comment: http://stackoverflow.com/comment/32972072
has body: Java says that the following are not equal while they are: java.lang.AssertionError: expected:&lt;[[(7,UP), (2,RIGHT)], [(4,DOWN), (11,MIDDLE)], [(9,RIGHT), (1,UP)]]&gt; but was:&lt;[[(2,RIGHT), (7,UP)], [(11,MIDDLE), (4,DOWN)], [(1,UP), (9,RIGHT)]]&gt; (where each is a HashSet and each subset is another HashSet)
has comment: http://stackoverflow.com/comment/32972074
accepted answer: http://stackoverflow.com/a/21791477
favorite count: 0
possible better answer: http://stackoverflow.com/a/21791450
has answer: http://stackoverflow.com/a/21791450
has comment: http://stackoverflow.com/comment/32972007
has comment: http://stackoverflow.com/comment/32972026
downvote count: 1
has title: Java says not equal while they are
tagged with: unit-testing

http://stackoverflow.com/q/21768779
linked to: http://stackoverflow.com/q/583973
has comment: http://stackoverflow.com/comment/32932265
has comment: http://stackoverflow.com/comment/32932239
score: 0
has title: Jersey to customize error handling for invalid resource path?
tagged with: jersey
tagged with: jax-rs
has body: This is a very similar question, but mine is more specific. If I type in an invalid resource path, like /foobar, it returns a 404. I'd like this to return a 400. 400 is "bad request". I feel like this is more informative to the client. How I can configure Jersey 1.x to return this instead?
tagged with: rest
type: UnansweredQuestion
answer count: 0
tagged with: jersey-1.0
has comment: http://stackoverflow.com/comment/32932114
type: Question
has comment: http://stackoverflow.com/comment/32931897
tagged with: java
has comment: http://stackoverflow.com/comment/32932244

noclassdeffounderror
tags question: http://stackoverflow.com/q/21819026
tags question: http://stackoverflow.com/q/21771207
tag name: noclassdeffounderror
tags question: http://stackoverflow.com/q/21751014
type: Tag
tags question: http://stackoverflow.com/q/21791371

http://stackoverflow.com/comment/33008855
has text: Syntax error on token "+", Expression expected after this token
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21812181

http://stackoverflow.com/a/21690591
has comment: http://stackoverflow.com/comment/32793350
answers question: http://stackoverflow.com/q/21690438
has comment: http://stackoverflow.com/comment/32795644
score: 0
has comment: http://stackoverflow.com/comment/32795850
has comment: http://stackoverflow.com/comment/32793334
has comment: http://stackoverflow.com/comment/32792985
type: Answer
has body: In your first while loop, you are actually trying to populate the whole gmatrix by parsing a single line of the input file. This is not what you expect. Since there are only 4 tokens in the first line, you get the exception when you are trying to call st.nextToken() to get the next (non-existing) token when the program is trying to get gmatrix[1][0]. To correct your code, you should check and read a new input line in your first for(int i = ...) loop, and remove the 2 out-most while loops. Example: for(int i = 0; ...){ // check if there is another line in input; // tokenize a line of input; for(int j = 0; ...){ // get a token and populate one element in gmatrix; } } Instead of using the two while loops.

http://stackoverflow.com/q/21792330
has comment: http://stackoverflow.com/comment/32973828
has comment: http://stackoverflow.com/comment/32973752
upvote count: 1
has comment: http://stackoverflow.com/comment/35551968
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32973786
has body: My teacher at the University has taught us this implementation of a Stack. But this one is fully recursive and I haven't seen anything like this anywhere on the web. So I was wondering how good or efficient this is. As I have seen lots of implementations of Stacks with Linked List(been the most efficient one) and using arrays. public class Stack&lt;T&gt; { private T top; private Stack&lt;T&gt; base; public Stack(){ top = null; base = null; } public Stack(T data, Stack&lt;T&gt; base){ top = data; this.base = base; } public boolean isEmpty(){ return top == null; } public T top(){ return top; } public T push(T data){ if (isEmpty()){ top = data; base = new Stack&lt;T&gt;(); } else { base = new Stack&lt;T&gt;(top, base); top = data; } return data; } public T pop(){ T res = null; if (!isEmpty()){ res = top; top = base.top; base = base.base; } return res; } } Please I would like to hear your opinion, as I really haven't seen this kind of implementation ANYWHERE else. Please feel free to explain the complexity !
has comment: http://stackoverflow.com/comment/32973780
downvote count: 0
tagged with: stack
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/34234775
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/35610919
has comment: http://stackoverflow.com/comment/32974058
has title: Stack Recursive Implementation Complexity
has comment: http://stackoverflow.com/comment/35551326

http://stackoverflow.com/q/21735957
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21758743
tagged with: jpa
tagged with: spring-data-jpa
tagged with: eclipselink
answer count: 1
accepted answer: http://stackoverflow.com/a/21758743
has title: How to specify additional insert information for join table?
has comment: http://stackoverflow.com/comment/32912941
type: AnsweredQuestion
has body: I have an entity, Item, that is related to other Items through a join table. However, I need to insert the value of "additionalField" when persisting a related item. I am using spring data JPA (1.4.1) for my persistence abstraction. EclipseLink (2.5.0) is my JPA provider. @Entity public class Item { // other fields and getters/setters omitted for clarity @OneToMany @JoinTable(name = "related_items_map", joinColumns = @JoinColumn(name = "fk_item"), inverseJoinColumns = @JoinColumn(name = "fk_related_item")) private List&lt;Item&gt; relatedItems; } join table name = "related_items_map" with columns = fk_item, fk_related_item, additionalField My end goal is to achieve the following semantics: // obtain the items from service by id Item item = itemService.findOne(1); Item relatedItem = itemService.findOne(2); // add related item to item related list item.getRelatedItems().add(relatedItem); // save item using service itemService.save(item); Today the generated SQL looks correct INSERT INTO item (fk_item, fk_related_item) values (?, ?) =&gt; bind [1, 2] The only issue is that additionalField column is null. The value that should be inserted is to be calculated (based upon certain state) at run time prior to the insert. How do I customize the insert for this operation? I know how to customize specific classes, but not mappings. ==== UPDATE ==== As suggested by Chris, I created an entity wrapping the "JoinTable" @Entity @Table("related_items_map") public class RelatedItem { @Id private String itemId; @Id private String relatedItemId; // ... other stuff } @Entity public class Item { // other fields and getters/setters omitted for clarity @OneToMany @JoinTable(name = "related_items_map", joinColumns = @JoinColumn(name = "fk_item")) private List&lt;RelatedItem&gt; relatedItems; } However, eclipselink is attempting to do a multiple insert now when I do the following: // obtain two items Item item = itemService.find(1); Item other = itemService.find(2); // create the joining Rel…

http://stackoverflow.com/comment/32898062
has text: @najus You'll have to go through the implementation of `HashMap` and see how it uses the `hashCode` of your key objects.
comment on: http://stackoverflow.com/a/21750050
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32828151
score: 0
comment on: http://stackoverflow.com/a/21693874
type: AnswerComment
type: Comment
has text: Thank you very much! I am reading about generics and collections vs. lists. One thing that I noticed is that the keyword `extends` is used, why wouldn't one use `implements`? Isn't `Comparable` an interface?

http://stackoverflow.com/q/21816328
accepted answer: http://stackoverflow.com/a/21822986
has comment: http://stackoverflow.com/comment/33016634
tagged with: opengl
tagged with: java
has comment: http://stackoverflow.com/comment/33016868
score: 0
has body: Im trying to make a square follow my mouse after i left click on it . When i right click the square should stop following my mouse . My program detects that im clicking inside the square , but for some reason it doesn't update its position based on Mouse.getDX/DY . import static org.lwjgl.opengl.GL11.*; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; public class SimpleOGLRenderer { private static boolean somethingIsSelected = false; public static void main(String args[]) { try { Display.setDisplayMode(new DisplayMode(800,600)); Display.setTitle("Hello World"); Display.create(); } catch (LWJGLException e) { // TODO Auto-generated catch block e.printStackTrace(); } //Initializare OPENGL glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, 800, 600, 0, 1, -1); glMatrixMode(GL_MODELVIEW); while(!Display.isCloseRequested()) { //Render glClear(GL_COLOR_BUFFER_BIT); Box box = new Box(100,100); if(Mouse.isButtonDown(0) &amp;&amp; box.inBounds(Mouse.getX(), Display.getHeight()-Mouse.getY()-1) &amp;&amp; !somethingIsSelected) { System.out.println("Box clicked"); somethingIsSelected = true; box.selected = true; } if(Mouse.isButtonDown(1)) { box.selected = false; somethingIsSelected = false; System.out.println("Box released"); } if(box.selected) { box.update(Mouse.getDX(), -Mouse.getDY()); } box.drawQuad(); Display.update(); // Display.sync(60); } Display.destroy(); } private static class Box{ public int x, y; public boolean selected=false; Box(int x, int y) { this.x = x; this.y = y; } void drawQuad() { glBegin(GL_QUADS); glVertex2i(x,y); glVertex2i(x+50,y); glVertex2i(x+50,y+50); glVertex2i(x,y+50); glEnd(); } void update(int dx,int dy) { x = x + dx; y = y + dy; } boolean inBounds(int mouseX, int mouseY) { return mouseX &gt; x &amp;&amp; mouseX &lt; x + 50 &amp;&amp; mouseY &gt; y &amp;&amp; mouseY &lt; y + 50; } } }
has title: Trying to move a quad/square with the mouse - LWJGL
answer count: 1
has answer: http://stackoverflow.com/a/21822986
type: AnsweredQuestion
tagged with: lwjgl
type: Question

http://stackoverflow.com/a/21793336
upvote count: 4
has body: Painting methods are for painting, not for creating components. You should never create a component in the paintComponent() method. Every time Swing determines the component needs to be repainted the paintComponent() method is invoked so a new component will be created. Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); frame.setSize(dim.width, dim.height); There is no need for the above code since you are using the setExtendedState(...) method to set the size of the frame. Why would you put a text field at a random location? Sounds like a strange design. Swing was designed to be used with layout managers. Read the section from the Swing tutorial on Layout Managers for more information.
type: Answer
answers question: http://stackoverflow.com/q/21793312
downvote count: 0
score: 4

http://stackoverflow.com/a/21795668
has comment: http://stackoverflow.com/comment/32982461
has comment: http://stackoverflow.com/comment/32982854
type: Answer
has body: When i was doing it, i had done like this: First, put sqlite3.exe into folder src/main/resources - now sqlite3.exe will be in jar-file as resource file. Then, copy sqlite3.exe (from JAR) into system32 (if it is windows and sqlite not installed): // Copy file SQLite3 into /Windows/System32 try { // CopyFromJar just copies file from JAR archive into some directory CopyFromJar fileManager = new CopyFromJar(); fileManager.copyFile(new File("C:\\Windows\\System32\\sqlite3.exe"), "/sqlite3.exe"); } catch (IOException e) { ErrorFrame.showException(e); } Second, add sqlite-jdbc as dependency to project. And last, create connection to database: // Path to database - if first time, then database.db will created in folder with program private static final String pathToDatabase = "jdbc:sqlite:database.db"; //.................. // Loading JDBC driver Class.forName("org.sqlite.JDBC"); // Create connection Connection con = DriverManager.getConnection(pathToDatabase); Statement stat = con.createStatement();
has comment: http://stackoverflow.com/comment/32982157
downvote count: 1
has comment: http://stackoverflow.com/comment/32986429
score: -1
has comment: http://stackoverflow.com/comment/32983366
has comment: http://stackoverflow.com/comment/32983910
has comment: http://stackoverflow.com/comment/32983058
has comment: http://stackoverflow.com/comment/32982635
upvote count: 0
answers question: http://stackoverflow.com/q/21795451
has comment: http://stackoverflow.com/comment/32982526

http://stackoverflow.com/q/21784016
type: UnansweredQuestion
has title: curl waits in cygwin before sending the actual request
upvote count: 1
has comment: http://stackoverflow.com/comment/33045883
has comment: http://stackoverflow.com/comment/32958454
score: 1
tagged with: java
has body: I am running curl from cygwin like this $ curl -v -i -X POST 'http://www.abc.com:10123/myapp/abc' -H "Content-Type: application/json" --data-binary "@input.json" It starts connecting and hangs at this line STATE: CONNECT => WAITCONNECT handle 0x8001f150; line 1074 (connection #0) for 149986ms and then is able to connect and send the request (traces shown below). Now the question is why it waits for that long? How can I skip this wait time? Thanks. STATE: INIT =&gt; CONNECT handle 0x8001f150; line 1027 (connection #-5000) About to connect() to www.abc.com port 10123 (#0) Trying ::1... Adding handle: conn: 0x80059548 Adding handle: send: 0 Adding handle: recv: 0 Curl_addHandleToPipeline: length: 1 0x8001f150 is at send pipe head! - Conn 0 (0x80059548) send_pipe: 1, recv_pipe: 0 STATE: CONNECT =&gt; WAITCONNECT handle 0x8001f150; line 1074 (connection #0) After 149986ms connect time, move on! Trying 127.0.0.1... Connected to www.abc.com (127.0.0.1) port 10
type: Question
downvote count: 0
favorite count: 0
tagged with: curl
answer count: 0

http://stackoverflow.com/comment/32969049
type: AnswerComment
comment on: http://stackoverflow.com/a/21789644
type: Comment
score: 1
has text: Well I mean I could override the method in each of the concrete class implementing BaseGroup but that's kind of disappointing that I have to do myActionInstance.createGroup(); but right now I don't see any other way?

http://stackoverflow.com/q/21838872
has answer: http://stackoverflow.com/a/53297462
tagged with: osgi
type: AnsweredQuestion
score: 0
tagged with: java
has title: Running a jar included in an OSGi bundle
has answer: http://stackoverflow.com/a/21840762
type: Question
tagged with: eclipse
answer count: 2
tagged with: jar
possible better answer: http://stackoverflow.com/a/53297462
accepted answer: http://stackoverflow.com/a/21840762
has body: The situation is that I need to package a runnable jar, X.jar into an OSGi bundle. The jar itself can not be modified and OSGi is mandatory as X.jar is to be distributed and run via a software program that requires OSGi bundles. The application contained in X.jar is to communicate over a network with another application. My plan was to create an OSGi bundle with eclipse and then include X.jar in it. But the problem is that X.jar is not detected. If I instead try to access a copy of X.jar on my file system it works. My bundle file structure: -\MyBundle -\META-INF -\MANIFEST.MF -\src -\mybundle -\Activator.class -\X.jar Activator: public void start(BundleContext context) { Thread XThread = new Thread(){ public void run(){ try { Runtime.getRuntime().exec("java -jar X.jar"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; } Manifest.MF Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Bundle Bundle-SymbolicName: myBundle Bundle-Version: 1.0.0.qualifier Bundle-Activator: com.ericsson.mas.Activator Bundle-ClassPath: .,X.jar Bundle-Vendor: BundleVendor Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Import-Package: org.osgi.framework;version="1.3.0" I suspect that there is some problem with my Bundle-ClassPath, but it seems correct when I search around. Any help is greatly appreciated. Note: I am aware that this goes completely against OSGi's philosophy.

http://stackoverflow.com/q/21785054
has comment: http://stackoverflow.com/comment/32961606
upvote count: 2
has comment: http://stackoverflow.com/comment/32961658
has comment: http://stackoverflow.com/comment/32961522
answer count: 1
downvote count: 0
has body: I've been reading some tutorials on XmlPullParser in Android on how to parse XML data. To be more specific, I'm using the XML from https://gdata.youtube.com/feeds/api/standardfeeds/top_rated Here I simplify part on an entry from this feed (I hope without altering the structure) in: http://gdata.youtube.com/feeds/api/videos/abc45678qwe [...] THE TITLE [...] [...] <media:group> [...] <media:title type='plain'>THE TITLE</media:title> <yt:duration seconds='300'/> [...] <yt:videoid>abc45678qwe</yt:videoid> </media:group> <gd:rating average='1' max='5' min='1' numRaters='1' rel='http://schemas.google.com/g/2005#overall'/> <yt:statistics favoriteCount='0' viewCount='11111111'/> <yt:rating numDislikes='111' numLikes='111'/> I successfully get the title and the link with: private String[] readEntry(XmlPullParser parser) throws XmlPullParserException, IOException { parser.require(XmlPullParser.START_TAG, null, "entry"); String title = null; String link = null; while (parser.next() != XmlPullParser.END_TAG) { if (parser.getEventType() != XmlPullParser.START_TAG) { continue; } String name = parser.getName(); String rel = parser.getAttributeValue(null, "rel"); if (name.equalsIgnoreCase("title")) { title = readTitle(parser); } else if (name.equalsIgnoreCase("link") && rel.equals("alternate")) { link = readLink(parser); } else { skip(parser); } } return new String[] { title, link }; } private String readLink(XmlPullParser parser) throws XmlPullParserException, IOException { String link = ""; parser.require(XmlPullParser.START_TAG, null, "link"); link = parser.getAttributeValue(null, "href"); parser.nextTag(); parser.require(XmlPullParser.END_TAG, null, "link"); return link; } private String readTitle(XmlPullParser parser) throws XmlPullParserException, IOException { parser.require(XmlPullParser.START_TAG, null, "title"); String title = readText(parser); parser.require(XmlPullParser.END_TAG, null, "title"); return title; } But no matter what I try, I'm not able to get the duration …
has comment: http://stackoverflow.com/comment/32960708
favorite count: 0
has comment: http://stackoverflow.com/comment/32962251
has comment: http://stackoverflow.com/comment/32961552
tagged with: android
linked to: http://stackoverflow.com/q/21534340
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/21786303
accepted answer: http://stackoverflow.com/a/21786303
tagged with: xmlpullparser
tagged with: java
type: Question
has title: How to parse an XML with colons in some tags?

http://stackoverflow.com/comment/33035359
type: AnswerComment
score: 0
type: Comment
has text: Oh, and side question. Can I use SharedPreferences inside onOptionsItemSelected function?
comment on: http://stackoverflow.com/a/21826422

http://stackoverflow.com/comment/32800783
comment on: http://stackoverflow.com/a/21690631
type: Comment
has text: Aw, I've been doing these wrong as well? My professors have some explaining to do.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21760352
tagged with: java
has answer: http://stackoverflow.com/a/21760458
answer count: 5
has answer: http://stackoverflow.com/a/21760470
has comment: http://stackoverflow.com/comment/32916170
has comment: http://stackoverflow.com/comment/32916300
possible better answer: http://stackoverflow.com/a/21760470
has answer: http://stackoverflow.com/a/21760428
linked to: http://stackoverflow.com/q/3499214
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21760431
has title: Why is my static var not initialized when accessing it through a static method?
tagged with: static
type: Question
has comment: http://stackoverflow.com/comment/32916255
score: 0
has answer: http://stackoverflow.com/a/21760464
accepted answer: http://stackoverflow.com/a/21760431
has comment: http://stackoverflow.com/comment/32916187
has body: I have the following Java class: public class CWTokenMap { public static ConcurrentMap&lt;String, String&gt; allTokens = new ConcurrentHashMap&lt;String, String&gt;(); public static void putTokenData(final String token, final String user) { allTokens.put(token, user); } } When I run my application, I try to access the putTokenData method from another class and I get a NullPointerException for the line allTokens.put(...). Why do I get this exception? It was my understanding that the static ConcurrentMap should be initialized by the time we access the putTokenData method, but here it seems to not be the case. Are there cases where the static method will be called before initializing the static variable?
has comment: http://stackoverflow.com/comment/32916115
has comment: http://stackoverflow.com/comment/32916184

http://stackoverflow.com/q/21731611
answer count: 2
has answer: http://stackoverflow.com/a/21731704
duplicate of: http://stackoverflow.com/q/5257166
has comment: http://stackoverflow.com/comment/32865003
tagged with: double
has answer: http://stackoverflow.com/a/21731764
has body: private void fillInState() { state [0][0] = 0.6; state [0][1] = 0.4; state [1][0] = 0.3; state [1][1] = 0.6; state [1][2] = 0.1; state [2][0] = 0.7; state [2][2] = 0.3; } private void fillInNext() { next [0][0] = 1.0; } public void chain (int time) { for(int i=0; i&lt;time;i++) { for( int j=0; j&lt;3;j++) { double temp = 0; for(int k=0;k&lt;3;k++) { temp = state[k][j] * next [k][i] + temp; if(k==2) { next[j][i+1]=temp; } } } } } The expected answer should be: 1.0 0.6 0.48 0.0 0.4 0.48 0.0 0.0 0.04 But the answer in blueJ is: 1.0 0.6 0.48 0.0 0.4 0.48 0.0 0.0 0.04000000000000001 Anyone knows what happened? Is that about the Double class or blueJ?
type: UnansweredQuestion
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/5257166
has title: Java Double calculation between decimal place
type: Question

http://stackoverflow.com/comment/32969944
type: Comment
type: QuestionComment
score: 0
has text: may I suggest you use the WindowBuilder plugin? Not only does it save you alot of work, you can also learn from looking at the generated code
comment on: http://stackoverflow.com/q/21790254

http://stackoverflow.com/comment/32821013
type: AnswerComment
comment on: http://stackoverflow.com/a/21704506
type: Comment
score: 0
has text: how would you display the button? I wasn't aware that GridLayout could stretch elements across two cells.

http://stackoverflow.com/comment/32993425
type: QuestionComment
has text: Sorry, did not read properly - iterate the `values()` of the Map, copy the `values()`, remove the current iteration object from the `values()`-copy and check whether it is still, `contains()` in it.
comment on: http://stackoverflow.com/q/21772966
score: 0
type: Comment

http://stackoverflow.com/a/21814656
has comment: http://stackoverflow.com/comment/33013595
has body: Ideally, to access a REST Web service, you use a higher-level library, like Retrofit, that handles more of the work for you. Otherwise, Google's official recommendation is to use HttpURLConnection.
type: Answer
has comment: http://stackoverflow.com/comment/33013781
answers question: http://stackoverflow.com/q/21814486
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/33013548
has comment: http://stackoverflow.com/comment/33013747
has comment: http://stackoverflow.com/comment/33013636
has comment: http://stackoverflow.com/comment/33013530
accepted answer of: http://stackoverflow.com/q/21814486
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33013420
downvote count: 0

http://stackoverflow.com/comment/32963796
type: AnswerComment
has text: Thanks for your time & reply. it may take 1 week to reply to your answer. Because my office is closed for few days from today. I accepted your answer without testing. I accepted because it sounds good & you spend your time for me.
type: Comment
comment on: http://stackoverflow.com/a/21781304
score: 0

http://stackoverflow.com/a/21724318
answers question: http://stackoverflow.com/q/21723280
has comment: http://stackoverflow.com/comment/32856130
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32855889
has body: Using just SWT use the code in SWT Snippet 125. If you can use JFace then ColumnViewerToolTipSupport is rather easier.
accepted answer of: http://stackoverflow.com/q/21723280
type: Answer
has comment: http://stackoverflow.com/comment/32856478
score: 3
has comment: http://stackoverflow.com/comment/32854269
upvote count: 3
has comment: http://stackoverflow.com/comment/32853906

microbenchmark
tags question: http://stackoverflow.com/q/21772738
tags question: http://stackoverflow.com/q/21738690
tags question: http://stackoverflow.com/q/21702939
tag name: microbenchmark
type: Tag

http://stackoverflow.com/q/21827940
tagged with: java
linked to: http://stackoverflow.com/q/13507522
type: Question
has answer: http://stackoverflow.com/a/21828068
has title: How to re-initialize beans in spring without application server restart
tagged with: rest
answer count: 1
downvote count: 0
has body: I am programming service for getting data from database and providing them via REST service. It uses spring mvc. My database connection cofiguration is in property file from where it is loaded by spring as a data source bean during context initialization. Now my problem is - I want to change configuration in properties file (for example change database info) but I can't afford to restart the application server so the new configuration does not load. How can I re-initialize spring context or some particular beans so the newly defined properties are used?
tagged with: application-server
tagged with: initialization
favorite count: 0
linked to: http://stackoverflow.com/q/14330668
type: UnansweredQuestion
tagged with: spring
score: 3
upvote count: 3

http://stackoverflow.com/a/21720297
answers question: http://stackoverflow.com/q/21716839
upvote count: 10
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/32918961
score: 10
has body: Yes, caching won't hurt if you know what you are doing. Combining client side cache with server side cache wilds performance benefits if you reuse prepared statements as they are supposed to (a lot of people forget about the most important part :D). Just set Connector/J properties properties correctly: cachePrepStmts=true&amp;useServerPrepStmts=true While I'm not a big fan of micro benchmarks, here is one to back my statements up (lame pun intended). The interesting part about the benchmark is that it shows that enabling server side caching may actually slow things down without some client side caching, but with both layers of cache enabled as well as the proper reuse of prepared statements you may actually get a good speed up.

http://stackoverflow.com/comment/32853872
type: Comment
has text: Read (and implement) *all* the recommendations of [When Runtime.exec() won't](http://www.javaworld.com/jw-12-2000/jw-1229-traps.html). Then ignore that it refers to `exec` and build the `Process` using a `ProcessBuilder`. Also break a `String arg` into `String[] args` to account for arguments which themselves contain spaces.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21713711

http://stackoverflow.com/comment/33047897
comment on: http://stackoverflow.com/a/21833505
score: 0
type: AnswerComment
has text: Do you have an account to connect to the administrator SQL server to check on the status of the user or can you connect using windows authentication?
type: Comment

http://stackoverflow.com/comment/32840818
has text: Yeah, very good. Which line is line 67?
comment on: http://stackoverflow.com/q/21717426
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33043050
comment on: http://stackoverflow.com/q/21831608
type: Comment
type: QuestionComment
score: 0
has text: Sorry! Wait. I'll narrow it. @Vakh

http://stackoverflow.com/q/21717660
favorite count: 0
has comment: http://stackoverflow.com/comment/32841067
type: UnansweredQuestion
tagged with: python
downvote count: 0
has answer: http://stackoverflow.com/a/21718188
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/139847036
has answer: http://stackoverflow.com/a/21718088
has answer: http://stackoverflow.com/a/79233436
type: Question
has answer: http://stackoverflow.com/a/21717900
has comment: http://stackoverflow.com/comment/32841295
has comment: http://stackoverflow.com/comment/32841376
has body: I am a beginner in programming, and trying to learn Python from "Learning Python by Mark Lutz". In the 'Introducing the Python Interpreter' chapter the author states the following: Depending on which flavor of Python you run, the interpreter itself may be implemented as a C program, a set of Java classes, or something else. I am unable to understand how a piece of Python code is distinguished for a division to be made in the interpreter (either C program or Java classes as the author states).
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/32841380
upvote count: 1
has title: What exactly is the python interpreter implemented with?
answer count: 4

http://stackoverflow.com/comment/33014450
score: 3
comment on: http://stackoverflow.com/q/21815262
type: Comment
type: QuestionComment
has text: There's a prominent question, have you checked? http://stackoverflow.com/questions/541487/implements-runnable-vs-extends-thread

http://stackoverflow.com/q/21750369
has title: Version is not updated in JPA in case of bulk-update named queries
score: 5
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21750477
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39650115
tagged with: jpa
upvote count: 5
downvote count: 0
answer count: 1
has body: I am using openjpa 2.1.0 implementation of JPA. Where I have entity in that have property annotated with @Version annotation. /** version column to control concurrency*/ @Column(name = "XXX_VERSION") @Version private Integer xxxVersion; here XXX_VERSION is column in table with datatype numeric, now when I call merge by editing entity then openjpa will do increment value from XXX_VERSION column by 1. public E update(E entity) { return entityManager.merge(entity); } Above functionality as expected, working absolutely fine. But when I used a named query for updating some of the columns from table as below: Query query = getEntityManager().createNamedQuery(update query passed here without version column in it); query.setParameter(PaymentConstants.QUERY_PARAM_XXX_ID, Long.valueOf(XXXId)); query.executeUpdate(); then version is not getting incremented due to that if any other concurrent user doing anything with same row from DB from session of him then version is not got incremented in XXX_VERSION column. I have tried to pass the incremented version to update query, it throws an exception saying invalid query syntax. What could be done so that version got incremented in case update queries using named query?
has answer: http://stackoverflow.com/a/21750477
favorite count: 0

http://stackoverflow.com/a/21789679
upvote count: 1
has comment: http://stackoverflow.com/comment/33124589
downvote count: 1
has body: You cannot override an static method. A subclass may name a static method the same as that of the superclass, however super is a non-static operator. You could have multiple methods which perform two different functions, but they would need different names.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21789191

http://stackoverflow.com/q/21772878
downvote count: 3
upvote count: 1
has title: Cant figure out what I'm doing wrong with Java if else statements
favorite count: 0
type: UnansweredQuestion
has body: What am I doing wrong here? I need this to sort the numbers using if, else if and else statements. So far I haven't figure what it is that is wrong with the pseudo-code I received. import java.util.Scanner; public class Proj3 { public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.println("Enter three whole numbers &lt;integers&gt; to be sorted"); int n1,n2,n3; n1 = input.nextInt(); n2 = input.nextInt(); n3 = input.nextInt(); if (n1 &lt;= n2 || n1 &lt;= n3) { min = n1; if (n2 &lt;= n3){ mid= n2; max = n3; } else{ mid = n3; max = n2; } else if(n2 &lt;= n3) { min = n2; } else { min = n3; } } } }
has comment: http://stackoverflow.com/comment/32938987
has comment: http://stackoverflow.com/comment/32939137
has answer: http://stackoverflow.com/a/21772999
tagged with: java
has comment: http://stackoverflow.com/comment/32939089
has comment: http://stackoverflow.com/comment/32938946
type: Question
has comment: http://stackoverflow.com/comment/32939038
has comment: http://stackoverflow.com/comment/32939053
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/32939869
has comment: http://stackoverflow.com/comment/32938984

http://stackoverflow.com/a/21780422
answers question: http://stackoverflow.com/q/21780053
has comment: http://stackoverflow.com/comment/32976390
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32952829
downvote count: 0
has body: You are setting user name value to session attribute "username" so you can use this EL expression ${sessionScope.username} in your jsp. You should use it in jstl tag
type: Answer

http://stackoverflow.com/comment/33029541
comment on: http://stackoverflow.com/a/21823916
type: Comment
score: 0
has text: The name of vars and method in purpose says nothing... this is a challenge question, therefore there is no name for them...
type: AnswerComment

http://stackoverflow.com/q/21736293
has body: I'm making a program that is saving an array of JButtons to a file .btn. here is the code that is being saved: package avtech.software.compunav; import java.io.File; import java.io.FileOutputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import javax.swing.JButton; public class Buttons implements Serializable { public static Button[] buttons = new Button[15]; public Buttons() { for (int i = 0; i &lt; buttons.length; i++) { buttons[i] = new Button(); buttons[i].setText("Unassigned"); } } public JButton[] getButtons() { return buttons; } public JButton getButton(int index) { return buttons[index]; } public void setButtonText(String txt, int index) { buttons[index].setText(txt); } public void setButtonAction(String action, int index) { } public void save() { try { File dir = new File(Core.baseDir + "/bin/buttons.btn"); FileOutputStream fos = new FileOutputStream(dir); ObjectOutputStream oos = new ObjectOutputStream(fos); if (dir.exists()) dir.delete(); oos.writeObject(this); oos.flush(); oos.close(); } catch (Exception e) { e.printStackTrace(); } } } Button is a class that extends JButton, and here is that code: package avtech.software.compunav; import java.awt.Desktop; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import javax.swing.JButton; import CompuNav.main.Dialogs; public class Button extends JButton implements ActionListener { private String action = ""; public Button() { addActionListener(this); } public void setAction(String s) { action = s; } @Override public void actionPerformed(ActionEvent arg0) { if (action.equals("")) return; File file = new File(action); Desktop dt = Desktop.getDesktop(); try { dt.open(file); } catch (IOException e1) { Dialogs.msg("Could not open " + action); } } } Basically, the code is saving. there is a file called buttons.btn in the correct directory. The problem is, when I use the load method here: try { FileInputStream fis = new Fi…
tagged with: swing
tagged with: jbutton
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
tagged with: serialization
score: 0
tagged with: nullpointerexception
has title: Unable to load a saved JButton
has answer: http://stackoverflow.com/a/21740065
accepted answer: http://stackoverflow.com/a/21740065

http://stackoverflow.com/q/21790982
type: Question
answer count: 1
has title: Error in loading serial port shared library using java
type: UnansweredQuestion
tagged with: serial-communication
tagged with: serial-port
has body: I have to send data to serial port, javax.comm is also included but it gives the error "Caught java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path while loading driver gnu.io.RXTXCommDriver Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path Caught java.lang.UnsatisfiedLinkError: com.sun.comm.SolarisDriver.readRegistrySerial(Ljava/util/Vector;Ljava/lang/String;)I while loading driver com.sun.comm.SolarisDriver" I visited all serial port data read write related question in stackoverflow but find no any solution you kindly help me the code is below: package serial; import java.io.*; import java.util.*; import javax.comm.SerialPort; import javax.comm.CommPortIdentifier; import javax.comm.UnsupportedCommOperationException; import javax.comm.PortInUseException; public class SimpleWrite { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "Hello, world!\n"; static SerialPort serialPort; static OutputStream outputStream; public static void main(String[] args) { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM6")) { //if (portId.getName().equals("/dev/term/a")) { try { serialPort = (SerialPort) portId.open("SimpleWriteApp", 2000); } catch (PortInUseException e) {} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {} } } } } }
has answer: http://stackoverflow.com/a/21791064
score: 0
tagged with: javax.comm
tagged with: java
has comment: http://stackoverflow.com/comment/32971343
has comment: http://stackoverflow.com/comment/32971407

http://stackoverflow.com/comment/32875707
comment on: http://stackoverflow.com/a/21737187
score: 0
type: Comment
has text: @WillBD: But the only way to get the boolean value out is to call `booleanValue`, thats the unboxing.
type: AnswerComment

http://stackoverflow.com/q/21792734
has title: JPQL statement not working with Quotations
type: AnsweredQuestion
tagged with: java
has body: I'm trying to print a list (of only 1 item) but my JPQL statement isn't working due to quotations. I've tried every combination possible it seems but none will work. If anyone has any suggestions or different approaches I'd appreciate it. Note: I found a somewhat similar question on the site before I posted this but the answers aren't working for my case. Thanks String submittedName=request.getParameter("name"); user=entityManager.find(user.getClass(),submittedName); Query myQuery=entityManager.createQuery ("SELECT u.password FROM UserData u WHERE u.name=''"+submittedName+""); List results=myQuery.getResultList(); String convertedResults=results.get(0).toString(); out.println(results);
type: Question
linked to: http://stackoverflow.com/q/332365
tagged with: jpql
has answer: http://stackoverflow.com/a/21793605
score: 0
has comment: http://stackoverflow.com/comment/32975086
answer count: 1
has comment: http://stackoverflow.com/comment/32975788
accepted answer: http://stackoverflow.com/a/21793605

http://stackoverflow.com/a/21839601
answers question: http://stackoverflow.com/q/21838887
downvote count: 0
has body: Making an answer from comments to close this question: Make sure you send a query to a right URL.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/32972891
comment on: http://stackoverflow.com/a/21769725
type: AnswerComment
has text: If I wanted to add more than one button, I'm assuming I can just add them using the same strategy for MapButton you posted correct? And the grid view will place all of them in its layout?
type: Comment
score: 0

http://stackoverflow.com/a/21800404
score: 2
downvote count: 0
has body: war is web archive file. For the app server to run it it has to uncompress the archive and deploy it. That is called as "exploding" the war.
upvote count: 2
answers question: http://stackoverflow.com/q/21800380
has comment: http://stackoverflow.com/comment/32987615
type: Answer

http://stackoverflow.com/q/21710339
tagged with: java
has comment: http://stackoverflow.com/comment/32827531
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/21710419
accepted answer: http://stackoverflow.com/a/21710419
possible better answer: http://stackoverflow.com/a/21710533
favorite count: 0
tagged with: static
has title: Java Why does my program require Static variables and is it causing problems?
has comment: http://stackoverflow.com/comment/32827365
has answer: http://stackoverflow.com/a/21710533
has body: I am trying my hand at using what I have learned to create a Blackjack game, but I seem to be having problems. It seems like everything I do in this project requires me to use static variables, but when I do, I'm not getting the correct answers. What makes java require variables to be static, even when you don't wish to use them, and is that the reason that my results are always wrong? i.e. You and the dealer having the same hand despite .remove(0) being called each time. Card Class: package cardGames; import java.util.ArrayList; public class Card { private final Rank rank; private final Suit suit; private static final ArrayList&lt;Card&gt; deck = new ArrayList&lt;Card&gt;(); public enum Rank { Two(2), Three(3), Four(4), Five(5), Six(6), Seven(7), Eight(8), Nine(9), Ten(10), Jack(10), Queen(10), King(10), Ace(11); private int rankNum; Rank(int value) { this.rankNum = value; } public int getRankIDNum() { return this.rankNum; } } public enum Suit { Clubs(0), Diamonds(1), Hearts(2), Spades(3); private int suitNum; Suit(int value) { this.suitNum = value; } public int getSuitIDNum() { return this.suitNum; } } public Card(Rank rank, Suit suit) { this.rank = rank; this.suit = suit; } static { for(Suit suit: Suit.values()) { for(Rank rank: Rank.values()) { deck.add(new Card(rank, suit)); } } } public Rank getRank() { return this.rank; } public Suit getSuit() { return this.suit; } public static ArrayList&lt;Card&gt; createDeck() { return new ArrayList&lt;Card&gt;(deck); } @Override public String toString() { return rank + " of " + suit; } } And this is the class for my game. Blackjack Class: package cardGames; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Blackjack { static ArrayList&lt;Card&gt; deck; static ArrayList&lt;Card&gt; hand = new ArrayList&lt;Card&gt;(); static ArrayList&lt;Card&gt; dealer = new ArrayList&lt;Card&gt;(); private static int value = 0; private static int dealerValue = 0; private static int choice; pr…
downvote count: 0
has comment: http://stackoverflow.com/comment/32827457
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32827603
score: 1

http://stackoverflow.com/q/21788971
accepted answer: http://stackoverflow.com/a/21789278
favorite count: 0
has title: jetty 9.0.4 -> 9.1.2: WebServlet not loading any more
type: Question
answer count: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21789278
tagged with: jetty-9
tagged with: servlets
has body: Upgrading a servlet from jetty 9.0.4 to 9.1.2. My simple servlet does not get initialized any more when running against 9.1.2. Here is a diff generated over the two versions visualized by running mvn dependency:tree against my server distribution maven project: -[INFO] +- org.eclipse.jetty:jetty-server:jar:9.0.4.v20130625:compile -[INFO] | +- org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile -[INFO] | +- org.eclipse.jetty:jetty-http:jar:9.0.4.v20130625:compile (version managed from 9.0.4.v20130625) -[INFO] | | \- org.eclipse.jetty:jetty-util:jar:9.0.4.v20130625:compile (version managed from 9.0.4.v20130625) -[INFO] | \- org.eclipse.jetty:jetty-io:jar:9.0.4.v20130625:compile -[INFO] +- org.eclipse.jetty:jetty-jndi:jar:9.0.4.v20130625:runtime -[INFO] | \- org.eclipse.jetty.orbit:javax.mail.glassfish:jar:1.4.1.v201005082020:runtime -[INFO] | \- org.eclipse.jetty.orbit:javax.activation:jar:1.1.0.v201105071233:runtime -[INFO] +- org.eclipse.jetty:jetty-start:jar:9.0.4.v20130625:runtime -[INFO] +- org.eclipse.jetty:jetty-plus:jar:9.0.4.v20130625:runtime -[INFO] | +- org.eclipse.jetty.orbit:javax.transaction:jar:1.1.1.v201105210645:runtime -[INFO] | \- org.eclipse.jetty:jetty-webapp:jar:9.0.4.v20130625:runtime (version managed from 9.0.4.v20130625) -[INFO] | \- org.eclipse.jetty:jetty-servlet:jar:9.0.4.v20130625:runtime -[INFO] | \- org.eclipse.jetty:jetty-security:jar:9.0.4.v20130625:runtime -[INFO] +- org.eclipse.jetty:jetty-deploy:jar:9.0.4.v20130625:runtime -[INFO] | \- org.eclipse.jetty:jetty-xml:jar:9.0.4.v20130625:runtime +[INFO] +- org.eclipse.jetty:jetty-server:jar:9.1.2.v20140210:compile +[INFO] | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile (version managed from 3.1.0) +[INFO] | +- org.eclipse.jetty:jetty-http:jar:9.1.2.v20140210:compile (version managed from 9.1.2.v20140210) +[INFO] | | \- org.eclipse.jetty:jetty-util:jar:9.1.2.v20140210:compile (version managed from 9.1.2.v20140210) +[INFO] | \- org.eclipse.jetty:jetty-io:jar:9.1.2.…
type: AnsweredQuestion
tagged with: upgrade
downvote count: 0
score: 1
tagged with: config

http://stackoverflow.com/a/21769758
has comment: http://stackoverflow.com/comment/32934608
type: Answer
has comment: http://stackoverflow.com/comment/32933708
has comment: http://stackoverflow.com/comment/32934441
answers question: http://stackoverflow.com/q/21769554
score: 0
has body: This seems like a really weird setup, but I won't question you. If you know the condition at the method call site (eg, the condition is a constant flag passed to the method), you could parameterize the method with a generic instead. For example: public class TestGenerics { public static interface A { public void a(); } public static interface B { public void a(); } public static class C implements A, B { public void a() { System.out.println("a"); } } public static &lt;T&gt; T getCAsT() { return (T) new C(); } public static void main(String[] args) { A a = TestGenerics.&lt;A&gt;getCAsT(); B b = TestGenerics.&lt;B&gt;getCAsT(); a.a(); b.a(); } } Otherwise, I would try to merge the two interfaces in some way.

http://stackoverflow.com/comment/32897507
score: 0
comment on: http://stackoverflow.com/q/21745951
type: Comment
type: QuestionComment
has text: it is not possible since these are all some class files and we can't see what is internally happening

http://stackoverflow.com/comment/33018014
type: AnswerComment
has text: Thank you so much! I made the corrections but it still didn't work it compiled but it didn't execute this is what I have now:
comment on: http://stackoverflow.com/a/21816320
score: 0
type: Comment

http://stackoverflow.com/comment/33025601
type: Comment
comment on: http://stackoverflow.com/q/21821617
has text: Please understand that a jsp outputs HTML. When a browser submits a form, it sends an http request with the text values in the HTML. There are no Java objects involved at that point.
score: 1
type: QuestionComment

http://stackoverflow.com/q/21717625
has comment: http://stackoverflow.com/comment/32841148
type: Question
has answer: http://stackoverflow.com/a/21717763
has body: I have a project due soon. We have to write a program that asks for a year and prints out a calendar. We can only use one while, one for, and one switch loop. (and no arrays! ugh) Im having trouble figuring out how to print out the days of each month, starting with the first day of the first week, as most months will not start on Sunday. import java.util.*; import java.util.Calendar; class Lab2 { public static void main(String[] args) { Scanner user = new Scanner(System.in); System.out.print("What year do you want to view? "); int year = user.nextInt(); System.out.printf("%12d\n", year); System.out.println(); boolean leap = isLeap(year); int firstDay = JulianDate(year); monthLoop(year, firstDay, leap); } public static boolean isLeap(int year) { boolean verdict = false; if (year % 100 == 0 &amp;&amp; year % 400 == 0) { verdict = true; } if(year % 100 != 0 &amp;&amp; year % 4 == 0) { verdict = true; } return verdict; } public static int JulianDate(int year) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.DAY_OF_YEAR, 1); int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1; return dayOfWeek; } public static void monthLoop(int year, int firstDay, boolean leap) { for(int i=1; i &lt;= 12; i++) { switch (i) { case 1: System.out.printf("%13s\n", "January"); break; case 2: System.out.printf("%13s\n", "February"); break; case 3: System.out.printf("%12s\n", "March"); break; case 4: System.out.printf("%12s\n", "April"); break; case 5: System.out.printf("%11s\n", "May"); break; case 6: System.out.printf("%11s\n", "June"); break; case 7: System.out.printf("%11s\n", "July"); break; case 8: System.out.printf("%13s\n", "August"); break; case 9: System.out.printf("%14s\n", "September"); break; case 10: System.out.printf("%13s\n", "October"); break; case 11: System.out.printf("%14s\n", "November"); break; case 12: System.out.printf("%14s\n", "December"); break; } System.out.println("S M Tu W Th F S"); } } }
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/5270272
has comment: http://stackoverflow.com/comment/32841633
type: UnansweredQuestion
tagged with: java
has title: Java Calendar Program
tagged with: calendar

http://stackoverflow.com/comment/33028165
score: 0
type: Comment
has text: I've been trying to implement a callback like you've said, but I just can't get it to work. Would you be able to post code? Thanks
comment on: http://stackoverflow.com/a/21820242
type: AnswerComment

http://stackoverflow.com/a/21770982
has body: In java.lang.Class class having such a method's which load the assert pragmatically e.g. public URL getResource(String name) public InputStream getResourceAsStream(String name)
score: 0
answers question: http://stackoverflow.com/q/21770893
has comment: http://stackoverflow.com/comment/32953504
type: Answer

http://stackoverflow.com/comment/63716142
score: 0
type: Comment
has text: RuntimeTypeAdapterFactory is final. how to extends?
type: AnswerComment
comment on: http://stackoverflow.com/a/37777510

http://stackoverflow.com/comment/33012254
has text: No, basically C# doesn't have any equivalent to that.
comment on: http://stackoverflow.com/q/21814055
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21692227
upvote count: 2
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21692634
tagged with: android
has answer: http://stackoverflow.com/a/21692583
score: 1
has body: I'm new to Android programming and taking a Coursera class. In my assignment app, I'm trying to catch any exceptions when the user does not enter or enters incorrect time information (HH:MM:SS). My app crashes right after user error instead of displaying my Toast message or displaying a Log message to Logcat. SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); try { Date dt = formatter.parse(MileTime); Calendar cal = Calendar.getInstance(); cal.setTime(dt); int hours = cal.get(Calendar.HOUR); int minutes = cal.get(Calendar.MINUTE); int seconds = cal.get(Calendar.SECOND); int duration = 3600 * hours + 60 * minutes + seconds; int steps_per_second = 3; int running_rate = duration * steps_per_second; //pleaseStop = false; //DouglasZare example, don't need this. mHandler = new Handler(); // .os package class when importing mLeftfoot = findViewById(R.id.leftfoot); mRightfoot = findViewById(R.id.rightfoot); mFootAnim = AnimationUtils.loadAnimation(this, R.anim.foot); //this looks to the foot.xml file for the animations stepRecursive(); } catch (ParseException e) { e.printStackTrace(); Log.e(TAG, "Invalid Mile Time Entry", e); Toast.makeText(Assignment3MainActivity_V3_DouglasZare_AnimationCancel.this, "Please Enter Valid Time Stamp HH:MM:SS", Toast.LENGTH_LONG).show(); } The error log is here: http://pastebin.com/By7FWxLk. This error makes perfect sense and is intentional. Caused by: java.text.ParseException: Unparseable date: "" What do I fix to get my catch statement to prevent this?
tagged with: java
downvote count: 1
type: Question
tagged with: try-catch
has title: Android - Try Catch is not catching the exception and it's not displaying my toast message
answer count: 2
favorite count: 0

http://stackoverflow.com/comment/32969488
score: 0
type: QuestionComment
type: Comment
has text: yes,pathLogger is class instance. I am able to call other methods in that class.
comment on: http://stackoverflow.com/q/21789999

http://stackoverflow.com/comment/32932288
type: QuestionComment
comment on: http://stackoverflow.com/q/21767945
score: 1
has text: Well, since each request is being served by its own thread, why should the second kill the first?
type: Comment

http://stackoverflow.com/comment/33012556
type: QuestionComment
has text: Look at your imports is the inject from "javax.inject.Inject". Sometimes the imports goes wrong when you copy paste it :)
comment on: http://stackoverflow.com/q/21814136
score: 0
type: Comment

http://stackoverflow.com/comment/33017877
score: 0
comment on: http://stackoverflow.com/q/21817155
type: Comment
type: QuestionComment
has text: You "wrote a code" that involves no methods. It would seem odd that you have an assignment from class that is asking you to do things that have never been covered in class.

http://stackoverflow.com/comment/32914665
score: 0
type: Comment
type: QuestionComment
has text: @murrmurr Forget the console. Think of the console like a blackboard (or whiteboard) at school. Let's say I have a piece of paper that has an address on it, and I ask you to write whatever the paper says on the board. Then I change the value on that paper; does that automatically change what is written on the board? The answer of course is no. I would have to ask you to write the new value on the board again. Its the same with the console. So if you changed some value of your student object, for example, you'd have to write that new value to the console again.
comment on: http://stackoverflow.com/q/21757158

http://stackoverflow.com/q/21757773
answer count: 0
has comment: http://stackoverflow.com/comment/32936436
tagged with: servlet-filters
type: Question
tagged with: java
tagged with: javascript
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/33317405
has title: response.sendRedirect Not Working if html form target is Iframe?
type: UnansweredQuestion
has body: I have a form with attribute target=iframe, and I am submitting the form using document.getElementById("form_name").submit(); I have 2 conditions : 1) If control goes to servlet and any form validation gets failed say Captcha then response should be catch in Iframe and error should be displayed on top without refreshing the page. 2) If control goes to Filter before servlet and something breaks inside filter then the page itself should be redirecyed to global error page. The filter logic works fine and redirects succesfully but just for this page it shows the same page however I can see the logs on console of error page that means internally it is hitting error page but on front end it is not getting reflected. Please help. Thanks in advance

http://stackoverflow.com/comment/88343356
has text: But instead of instrumentTest they use androidTest currently
type: AnswerComment
comment on: http://stackoverflow.com/a/44379017
score: 1
type: Comment

http://stackoverflow.com/q/21803447
tagged with: hbox
type: UnansweredQuestion
tagged with: background-position
has body: The problem occurs when -fx_background-position:0 -40 is set either by a loaded style.css or in code via an action handler. In my example the background image is set on an hbox width one cell. When adjusting position the background image, the image moves outside of the limits/borders of the hbox, up in this case, and covers an area over the position of the hbox. In my case it covers action buttons so they don't fire. How to not show the part of the background image that is outside of hbox?
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/21805836
answer count: 1
score: 0
has title: javafx background image position outside of hbox

http://stackoverflow.com/comment/32918489
type: QuestionComment
type: Comment
score: 2
has text: Ok, what have you tried to accomplish it?
comment on: http://stackoverflow.com/q/21761708

http://stackoverflow.com/comment/32960002
has text: Fixed the problem perfectly. Many thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21784771
type: Comment

http://stackoverflow.com/q/21811638
has answer: http://stackoverflow.com/a/21812874
has body: Hello I've made it so that in my app the user selects a profile pic from clicking a button directing them to their gallery. They chose the pic and it's fine but once I exit the app or delete from multi tasking the profile pic has gone. How can I save it? I know I need shared prefs but im not fully sure how to use it in code. I'm a beginner. Here is my code at the moment on main.java. It shows how i have used code to chose a photo from gallary butneed to save that photo: import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.graphics.BitmapFactory; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class Main extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); { } Button buttonLoadImage = (Button) findViewById(R.id.buttonLoadPicture); buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } });; Button week1 = (Button) findViewById(R.id.week1button); Button week2 = (Button) findViewById(R.id.week2button); //Button Sound final MediaPlayer buttonSound = MediaPlayer.create(Main.this, R.raw.sound1); week1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub buttonSound.start(); startActivity(new Intent("com.example.timetable.WEEK1")); }}); week2.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub buttonSound.start(); startActivity(new Intent("com.example.timetable.WEEK2")); } }); }; @Override public…
accepted answer: http://stackoverflow.com/a/21812874
has comment: http://stackoverflow.com/comment/33010183
score: 0
answer count: 1
tagged with: android-image
has comment: http://stackoverflow.com/comment/33007875
tagged with: android
has title: How to store an image path in the application settings?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33008518
tagged with: java
linked to: http://stackoverflow.com/q/8586242
tagged with: android-preferences
type: Question

http://stackoverflow.com/comment/32958519
type: Comment
has text: @Rytis yes mate i am sry it was perfect understandable but i needed to make some changings that rly took me so much i couldn't fix the syntax so i am trying to solve problems before start to correcting the style
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21783914

http://stackoverflow.com/comment/33000613
type: QuestionComment
comment on: http://stackoverflow.com/q/21807472
has text: I don't really understand your question here. If you're trying to convert an `int` to its respective ASCII value, don't you already know the value of it?
score: 0
type: Comment

http://stackoverflow.com/comment/32870996
type: QuestionComment
comment on: http://stackoverflow.com/q/21734940
score: 0
type: Comment
has text: Could you include a screenshot of what the device is showing? Your xml wouldn't hurt either (just to make sure you haven't done anything silly like setting the visibility to GONE)

foreach
tags question: http://stackoverflow.com/q/21689021
tags question: http://stackoverflow.com/q/21805222
tags question: http://stackoverflow.com/q/21684284
type: Tag
tags question: http://stackoverflow.com/q/21792491
tag name: foreach
tags question: http://stackoverflow.com/q/21840395

http://stackoverflow.com/comment/32869505
type: QuestionComment
score: 1
has text: @AshotKarakhanyan we can't know that without confirmation from OP. If T was a usual class, `new T()` would have worked. (Assuming there is a default constructor)
comment on: http://stackoverflow.com/q/21733811
type: Comment

http://stackoverflow.com/q/21817860
has body: I getting issue while downloading a PDF file on click of button click in webview. File is downloaded but the file is partly downloaded that's why i am getting below error "The document cannot be opened because it is not a valid PDF document" Below is Asyncetask activity of my to download file: public class DownloadPDFTask extends AsyncTask&lt;String, Void, Integer&gt; { protected ProgressDialog mWorkingDialog; // progress dialog protected String mFileName; // downloaded file protected String mError; // for errors @Override protected Integer doInBackground(String... urls) { String filename = ""; String str[] = urls[2].split(";"); String st[] =str[1].split("="); filename = st[1]; String extStorageDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString(); File myDir = new File(extStorageDirectory, "NCR"); File file = new File(extStorageDirectory+"/NCR/"+filename); // create the directory if it does not exist if (!myDir.exists()) myDir.mkdirs(); if (file.exists()) { System.out.println("INSIDE FILE EXIST"); file.delete(); } try { byte[] dataBuffer = new byte[4096]; int nRead = 0; mFileName = filename; System.out.println("mFileName&lt;&gt;&lt;&gt;&lt;&gt; " +mFileName); // download URL and store to strFileName // connection to url java.net.URL urlReport = new java.net.URL(urls[0]); URLConnection urlConn = urlReport.openConnection(); urlConn.setRequestProperty("User-Agent", urls[1]); urlConn.setRequestProperty("Content-Disposition", urls[2]); urlConn.setRequestProperty("Content-Type", "application/pdf"); urlConn.setRequestProperty("Accept", "*/*"); InputStream streamInput = urlReport.openStream(); BufferedInputStream bufferedStreamInput = new BufferedInputStream(streamInput,8192); FileOutputStream outputStream = new FileOutputStream(extStorageDirectory+"/NCR/"+mFileName); while ((nRead = bufferedStreamInput.read(dataBuffer)) &gt; 0) outputStream.write(dataBuffer, 0, nRead); streamInput.close(); outputStream.close(); // displayPdf…
type: UnansweredQuestion
tagged with: android
tagged with: pdf-generation
tagged with: android-webview
tagged with: java
tagged with: webview
type: Question
has answer: http://stackoverflow.com/a/21818085
answer count: 2
has answer: http://stackoverflow.com/a/21818307
score: 0
has title: File is partly downloaded from Webview Android

http://stackoverflow.com/q/21758895
has answer: http://stackoverflow.com/a/21759043
tagged with: android-manifest
has comment: http://stackoverflow.com/comment/32913647
type: Question
has comment: http://stackoverflow.com/comment/32913466
tagged with: java
has title: Android - Change the name of app and select the main layout
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32913539
type: UnansweredQuestion
has body: I try to change app_name to "LangMe" but it show "Pram" instead.. I want main layout Pram.java but it show NewPost.java Any suggestion, Thanks for your help in advanced this is AndroidManifest.xml file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.parse.starter" android:versionCode="2" android:versionName="2.0" > <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="19" /> <permission android:name="com.parse.starter.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="com.parse.starter.permission.C2D_MESSAGE" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <service android:name="com.parse.PushService" /> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="com.parse.starter" /> strings.xml file :` <?xml version="1.0" encoding="utf-8"?> LangMe Settings Hey there Please Sign up! Sign up Username pass Email pass Login Please Sign in: Username: Password: Sign in Email address: Dashboard Post new entry Correct others posts Browse your posts Publish new post Publish English German Polish Arabic French Last Enties LangMe Comments Add comment Sign out New user any solution?
tagged with: android
has answer: http://stackoverflow.com/a/21759312

http://stackoverflow.com/q/21722372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32848996
has title: Login redirection error
has answer: http://stackoverflow.com/a/21722820
tagged with: java
has comment: http://stackoverflow.com/comment/32850266
possible better answer: http://stackoverflow.com/a/21722783
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/21722783
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21722820
tagged with: jsp
has body: I am building a web application i ve a login jsp form which will be redirected to a servlet... My servlet code: Login login=new Login(); login.setUserName(request.getParameter("txtUsername")); login.setPassWord(request.getParameter("txtPassword")); LoginService ls=new LoginService(); ls.loginValidate(login); RequestDispatcher rd=request.getRequestDispatcher("/Login.jsp"); rd.forward(request, response); } and from their to service class: My service class code: public class LoginService { Login login=null; public Login loginValidate(Login login) { validateLogin(login); return login; } private void validateLogin(Login login) { this.login=login; if(login!=null){ LoginDAO ld=new LoginDAO(); DataSource dataSource=new DataSource(); ld.setDataSource(dataSource); ld.validate(login); } } } } and from their to DAO My LoginDAO: public class LoginDAO { private DataSource dataSource; public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } public boolean validate(Login login){ boolean status=true; String sql="select * from Login where UserName=? and PassWord=?"; Connection conn = null; try{ conn = dataSource.createConnection(); PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1,login.getUserName()); ps.setString(2,login.getPassWord()); ResultSet rs=ps.executeQuery(); status=rs.next(); } catch (SQLException e) { throw new RuntimeException(e); } finally { if (conn != null) { try { conn.close(); } catch (SQLException e) {} } } return status; } } when i type the correct username and password its redirecting to success page(Login.jsp in this context) and even if i type wrong un and pw its redirecting i do understand why because after method call in servlet i have dispatched it to login.jsp so in any condition it will redirect me to success page. How to resolve this... Help needed.. Thanks in advance...
tagged with: http-redirect
tagged with: spring
has comment: http://stackoverflow.com/comment/32849168
has comment: http://stackoverflow.com/comment/32849384

http://stackoverflow.com/q/21686353
has title: Cleaning up my delay timer
has body: I made a game where you're a circle that moves around the screen and dodges other circles as they spawn on the screen. I have a delay timer that spawn an Enemy at a certain time, but it's not very good coding, as I'm kind of new to Java. If anyone could neaten up the code or give advice on how it could be better, I would really appreciate it. NOTE: spawnTime is a long set to System.currentTimeMillis(), timesDelay is a double set to 1.0, and spawnRateCounter is an int set to 0. Also, this code is being run in an awt Timer so it's being run again and again. private final double delayRateChange = .75; private void spawnEnemy() { Random r = new Random(); if (System.currentTimeMillis() - spawnTime &gt; (1000 * timesDelay)){ spawnRateCounter++; if (spawnRateCounter == 5){ timesDelay*=delayRateChange; spawnRateCounter = 0; } enemies.add(new Enemy(r.nextInt(500), r.nextInt(500), r.nextInt(4), r.nextInt(4) + 1, r.nextInt(3))); spawnTime = System.currentTimeMillis(); } }
type: AnsweredQuestion
score: 2
tagged with: refactoring
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21686592
downvote count: 0
tagged with: awt
has comment: http://stackoverflow.com/comment/32784748
accepted answer: http://stackoverflow.com/a/21686592
has comment: http://stackoverflow.com/comment/32784691
answer count: 1
favorite count: 0
tagged with: timer
upvote count: 2

http://stackoverflow.com/comment/32804821
comment on: http://stackoverflow.com/a/21697615
score: 0
type: AnswerComment
has text: oh.. so its like binary/hexadecimal stuff. thanks now im pretty clear on it :)
type: Comment

http://stackoverflow.com/comment/32876613
score: 1
type: QuestionComment
type: Comment
has text: You could just pull the plug and see what happens... :-)
comment on: http://stackoverflow.com/q/21737884

http://stackoverflow.com/comment/32944607
type: AnswerComment
score: 0
has text: when i commit i got this exception [java.sql.SQLException: Can't call commit when autocommit=true]
type: Comment
comment on: http://stackoverflow.com/a/21775967

http://stackoverflow.com/q/21734370
accepted answer: http://stackoverflow.com/a/21737630
tagged with: bash
has comment: http://stackoverflow.com/comment/32870152
upvote count: 1
has comment: http://stackoverflow.com/comment/32872707
answer count: 1
favorite count: 0
tagged with: linux
has body: I tried this: Runtime.getRuntime().exec("/bin/bash -c " + System.getProperty("catalina.home") + "/logs/shutdown.sh &amp;&amp; " + System.getProperty("catalina.home") + "/bin/startup.sh"); But only shutdown worked properly, Tomcat didn't startup properly, I think the problem was that the previous instance still used port 8080. I added a sleep 2m between the two commands (seperated with &amp;&amp;), but in this case, shutdown occured, but nothing happened later according to catalina log, no error, startup wasn't executed at all. (First time I tried without /bin/bash -c, but in that case nothing happened.)
type: AnsweredQuestion
downvote count: 0
has title: How is it possible to restart Tomcat in Linux from a webapp inside Tomcat?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32873351
tagged with: tomcat
has answer: http://stackoverflow.com/a/21737630

http://stackoverflow.com/comment/32807145
comment on: http://stackoverflow.com/q/21698992
score: 0
type: Comment
type: QuestionComment
has text: @GabrielAramburu: Time out the session once it pass the trigger time

http://stackoverflow.com/q/21733018
answer count: 1
tagged with: jakarta-ee
tagged with: jersey
has title: Jersey resources not found after deploying war to remote server
type: UnansweredQuestion
tagged with: glassfish
type: Question
has answer: http://stackoverflow.com/a/21877041
score: 0
tagged with: java
has body: My app is working well on my local Glassfish4 server but jersey resources are not found when I uplaod the war to a remote glassfish4 server. The resource path is 404 ! Can someone help ?

http://stackoverflow.com/a/21768539
answers question: http://stackoverflow.com/q/21768496
score: 0
has body: I think what you need is a List Array! Create ArrayList from array Think of it as a dynamic array, you don't need to specify the size of the array and it is expanded/made smaller automatically.
type: Answer

http://stackoverflow.com/comment/32828108
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21693307
has text: That actually prompted me to find the UAC and turn it off, so I automatically ran it as an admin. Thanks for the good advice!
score: 0

http://stackoverflow.com/comment/33004060
type: QuestionComment
comment on: http://stackoverflow.com/q/21809134
has text: @Kotsos You should post this as a different question. That would be better.
score: 0
type: Comment

http://stackoverflow.com/comment/32971429
score: 1
type: AnswerComment
has text: @Serenity I don't believe you. Post your code.
type: Comment
comment on: http://stackoverflow.com/a/21790875

http://stackoverflow.com/comment/32824763
type: Comment
has text: No, URLEncoder does `application/x-www-form-urlencoded`, not URI encoding - it will convert space to + rather than %20, and will also encode the existing slashes as %2F.
comment on: http://stackoverflow.com/a/21708876
score: 3
type: AnswerComment

http://stackoverflow.com/q/21810711
has title: Hibernate - <property> values vs. <column> values
tagged with: java
tagged with: hibernate
type: Question
tagged with: hbm
score: 0
has answer: http://stackoverflow.com/a/21845414
answer count: 1
tagged with: hbmxml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21845414
has body: I'm back here in Stackoverflow wondering what the difference is between values in and within a Hibernate's hbm.xml file. I explain myself a little better: <column length="128" name="LOGIN_NAME" not-null="true" sql-type="VARCHAR(128)" unique="true"/> In the above example I repeat some values such as not-null, unique or column-name in both and <column>. My question(s) is, what's the difference? Which of those must/should be defined?

http://stackoverflow.com/comment/32896628
comment on: http://stackoverflow.com/q/21748885
type: Comment
type: QuestionComment
has text: Are you sure you are getting a JSON response?
score: 0

http://stackoverflow.com/q/21758829
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/32913271
tagged with: jquery
tagged with: servlets
score: 0
has title: eclipse not detecting change in json file
answer count: 1
has answer: http://stackoverflow.com/a/23070113
type: UnansweredQuestion
has body: Hey i am trying to create a program in which a json file is written upon a request to servlet and the json file is read using jquery script in jsp.So far successful .But the problem now i am facing is that first time it works fine then the second time onwards when when servlet is requested again the content of the file is overwritten as desired.But change is seen both in Hard disk i mean filesystem and project explorer in eclipse but upon reloading page and using firebug when i see the returned json file it contains previous data after doing this two or three times the new result appears has anyone experienced it ????? s therey any bypassing ways
has comment: http://stackoverflow.com/comment/32913237
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/33037209
type: QuestionComment
has text: I'm doing a chat show and I would like the following "host / ip / message". Each message sent by the user, but my host overrides For example : 1st message sent = host / ip / message 2nd message sent = host / host / ip / message ip / message
comment on: http://stackoverflow.com/q/21828386
score: 0
type: Comment

http://stackoverflow.com/comment/32949492
comment on: http://stackoverflow.com/a/21778934
has text: Thank you Baz. But I now have a 500x500 size button... BTW, does it matter when do I call the shell.open() method?
score: 0
type: AnswerComment
type: Comment

applet
tags question: http://stackoverflow.com/q/21792835
tags question: http://stackoverflow.com/q/21695520
tags question: http://stackoverflow.com/q/21694277
tags question: http://stackoverflow.com/q/21708739
tags question: http://stackoverflow.com/q/21686659
tags question: http://stackoverflow.com/q/21795538
tags question: http://stackoverflow.com/q/21783400
tags question: http://stackoverflow.com/q/21743680
tags question: http://stackoverflow.com/q/21692255
tags question: http://stackoverflow.com/q/21731213
tags question: http://stackoverflow.com/q/21699522
tags question: http://stackoverflow.com/q/21783858
type: Tag
tag name: applet
tags question: http://stackoverflow.com/q/21702365
tags question: http://stackoverflow.com/q/21814778
tags question: http://stackoverflow.com/q/21831466
tags question: http://stackoverflow.com/q/21679765
tags question: http://stackoverflow.com/q/21704262
tags question: http://stackoverflow.com/q/21829652
tags question: http://stackoverflow.com/q/21829639
tags question: http://stackoverflow.com/q/21692710
tags question: http://stackoverflow.com/q/21754691
tags question: http://stackoverflow.com/q/21830003
tags question: http://stackoverflow.com/q/21710323
tags question: http://stackoverflow.com/q/21823322
tags question: http://stackoverflow.com/q/21758998
tags question: http://stackoverflow.com/q/21712656
tags question: http://stackoverflow.com/q/21708330
tags question: http://stackoverflow.com/q/21768993
tags question: http://stackoverflow.com/q/21803709

http://stackoverflow.com/a/26616064
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: You have to annotate the parameter directly such as below: //The class with the web method @Component @Qualifier("myFacade") @Service public class MyFacade implements IMyFacade { /* the web method */ findByYearMonth(@XmlJavaTypeAdapter(type = YearMonth.class, value = YearMonthAdapter.class) YearMonth yearMonth) throws MyException { // Break point should now show yearMonth = "2013-05" } }
type: Answer
accepted answer of: http://stackoverflow.com/q/21804054
answers question: http://stackoverflow.com/q/21804054

http://stackoverflow.com/a/21746292
has comment: http://stackoverflow.com/comment/32892076
has comment: http://stackoverflow.com/comment/32891532
has body: You need to first set the view and then use the resources. Move the line setContentView(R.layout.physics); to the top. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.physics); ImageView image; image = (ImageView) findViewById(R.id.imageView1); image.setImageResource(R.drawable.heart_maths); }
type: Answer
has comment: http://stackoverflow.com/comment/32891584
score: 0
answers question: http://stackoverflow.com/q/21746249

http://stackoverflow.com/q/21752809
downvote count: 0
favorite count: 0
tagged with: groovy
has title: GroovyClassLoading Mechanism
tagged with: groovyclassloader
score: 1
has answer: http://stackoverflow.com/a/21753443
tagged with: classloader
upvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/738393
tagged with: java
accepted answer: http://stackoverflow.com/a/21753443
linked to: http://stackoverflow.com/q/383920
type: Question
has body: I'm really newbie to groovy scripting but following some tutorial I tried to dynamically load some groovy class within my java code using parseClass() method of GroovyClassLoader. I wrote some snippet and it worked fine for me. The problem is that I don't clearly understand what groovy engine is doing beyond my view and how those scripts are compiled? Does a new class gets creted and loaded into jvm? Or does my application uses some cached sources? Here is the class I'm trying to parse: private static class MyScript { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("public class SomeClass\n"); builder.append("{\n"); builder.append("Some code...").append("\n"); builder.append("}\n"); return builder.toString(); } The I load it with build() as below: private Class MyGroovyBuilder { private Script script = new Script(); public String build() throws TemplateCompilationException // String groovyText = script.toString(); // CompilerConfiguration config = new CompilerConfiguration(); // byte[] bytes; try { bytes = groovyText.getBytes(config.getSourceEncoding()); } catch (UnsupportedEncodingException e) { throw new TemplateCompilationException(e, groovyText); } // InputStream in = new ByteArrayInputStream(bytes); GroovyCodeSource gcs = new GroovyCodeSource(in, "SomeName", "/groovy/shell"); GroovyClassLoader loader = new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), config); Class&lt;?&gt; scriptClass; try { scriptClass = loader.parseClass(gcs, false); } catch (CompilationFailedException e) { throw new GroovyCompilationException(e, "SomeName", groovyText); } catch (ClassFormatError e) { throw new GroovyCompilationException(e, "SomeName", groovyText); } return scriptClass.getName(); } Any clarification is greatelly appreciated. BR.
answer count: 1

http://stackoverflow.com/comment/32823855
has text: You don't need the brackets surrounding the "c" by the way. ;)
score: 1
comment on: http://stackoverflow.com/q/21708412
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24602337
type: Answer
has body: I found when I created: the image resolutions at 160px - 640px resolution change the "print size" (I'm using Gimp) to the 48px - 192px respectfully (while leaving the resolution intact) import all those different files into all my appropriately sized drawables folders change the Android Manifest to an ic_launcher_name_xxhdpi (my folders didn't have xxxhdpi)... then it automatically takes the right size you need, even though they are all different files in there with different names and different sizes. Score! Specifications are in Android Iconography.
score: 0
answers question: http://stackoverflow.com/q/21707310

http://stackoverflow.com/q/21730335
favorite count: 0
accepted answer: http://stackoverflow.com/a/21780377
tagged with: velocity
tagged with: templates
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/435210
has answer: http://stackoverflow.com/a/21780377
score: 21
has title: How to #include a file from a Velocity template using ClasspathResourceLoader
has body: I'm dealing with some Java code where Velocity 1.7 is set to retrieve templates through the ClasspathResourceLoader. Below is a stripped down sample of the code. It's from a Tapestry web application running on a Jetty server. The Java class, the templates and the file to be included are all are in the same folder "testpackage", so in the resulting JAR they are all in the same package "testpackage". The problem is that if the template contains an #include("MyInclude.vm") directive, Velocity cannot find "MyInclude.vm", and it throws a ResourceNotFoundException. Since in the argument of getTemplate I must prepend the package name to the template name, I also tried to do the same in the #include inside the template: #include("testpackage/MyInclude.vm") but the only difference is that the latter works if I run the web app from Eclipse, while the former doesn't work not even from Eclipse. If I build, deploy the JARs and run the web app from the deployment, both syntaxes fail with the same ResourceNotFoundException. The Velocity doc at http://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html#Include says: "For security reasons, the file to be included may only be under TEMPLATE_ROOT" This definitely could be the cause of my problem, but I haven't been able to find any further information about what TEMPLATE_ROOT actually is. It sounds a lot like an environment variable, but I don't know what I should set it to, since I'm using a ClasspathResourceLoader, and the file to be included is not an actual file located in a folder, it's inside the JAR containing the templates and the Java class (and all in the same package). I found TEMPLATE_ROOT mentioned in another question, Where should I put Velocity template files for a command line utility built with Maven? , but it's related to using a FileResourceLoader. I need to keep using the ClasspathResourceLoader and I need all the files to be in the JAR, not outside it as normal files in some folder. TestVelocity.java …
upvote count: 22
answer count: 1

http://stackoverflow.com/a/21690042
accepted answer of: http://stackoverflow.com/q/21688425
has comment: http://stackoverflow.com/comment/32794127
answers question: http://stackoverflow.com/q/21688425
has comment: http://stackoverflow.com/comment/32795278
has comment: http://stackoverflow.com/comment/32799036
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: Add a safe option as well. By default the safe option for API is SECURE or 20 (integer value) which disables include directives to be rendered. You can use any of the below key-value pair: 'safe':'SAFE' 'safe': 1 'safe':'SERVER' 'safe': 10 'safe':'UNSAFE' //If you want 'safe': 0 Below should work. def output = asciidoctor.renderFile(new File('index.ad'),[ 'in_place':true, 'header_footer':true, 'safe':'SAFE' ]) Refer Running AsciiDoctor Securely for more details. UPDATE toc and section numbers are attributes in CLI, so we just need to add required attributes to options. Simplest way: def output = asciidoctor.renderFile(new File('index.ad'),[ 'in_place':true, 'header_footer':true, 'safe':'SAFE', 'attributes': [toc: true, numbered: true] //I suppose ]) But the above tightly couples with the underlying ascii doc implementations which we wanted to abstract in the first place. Asciidoctor provides useful Builder patterns to overcome this clutter. import static org.asciidoctor.AttributesBuilder.attributes import static org.asciidoctor.OptionsBuilder.options import org.asciidoctor.Placement Attributes attributes = attributes().tableOfContents(true) .tableOfContents2(Placement.LEFT) .sectionNumbers(true) .get() Options options = options().inPlace(true) .headerFooter(true) .attributes(attributes) .get() def output = asciidoctor.renderFile(new File('index.ad'), options) Visit this package from asciidoctor java integration and it will be pretty much clear as to how things can be tailored easily.

http://stackoverflow.com/a/21790813
answers question: http://stackoverflow.com/q/21790621
has comment: http://stackoverflow.com/comment/33563728
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33537724
accepted answer of: http://stackoverflow.com/q/21790621
has comment: http://stackoverflow.com/comment/33541380
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/33538064
has comment: http://stackoverflow.com/comment/33563823
score: 2
has body: You're blocking the Event Dispatching Thread with your infinite loop. The EDT is responsible for many things, including event processing and painting. Any action which blocks/stops this thread will prevent your application from receiving new events or processing new paint requests. Swing is a single threaded environment and isn't thread safe, so while you could spawn off a new Thread, you would need to ensure that any code that interacted with the UI was done so fro within the context of the EDT. A simpler solution would be to use a SwingWorker, which would allow you to monitor the mouse position from within a background thread, but has publish and process methods which simplifies the EDT synchronization process. Take a look at Concurrency in Swing for more details.
has comment: http://stackoverflow.com/comment/33541395

http://stackoverflow.com/comment/32888680
type: QuestionComment
has text: @ElliottFrisch By dependency I meant specifically using the child type in the parent's source code. With an `abstract` method you don't do that, so it's fine.
comment on: http://stackoverflow.com/q/21744551
score: 0
type: Comment

http://stackoverflow.com/comment/33029134
comment on: http://stackoverflow.com/a/21819396
has text: Not exactly. They're public not because of some kind of relationship with the parameter but because when you want to set the grade by using the mutator method setGrade(grade); you will be doing so from outside of the class so it needs to be public so in your other class, say main, you can use the method. If it was private you could not.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32887608
score: 0
has text: I have tried but get this error `java.lang.UnsupportedOperationException 02-12 21:29:05.026 2051-2051/com.myapp W/System.err﹕ at com.facebook.crypto.streams.NativeGCMCipherOutputStream.write`
type: Comment
comment on: http://stackoverflow.com/a/21692093
type: AnswerComment

http://stackoverflow.com/comment/32844955
score: 1
type: Comment
type: QuestionComment
has text: in my case is array list is very big. and thankyou
comment on: http://stackoverflow.com/q/21720157

http://stackoverflow.com/a/21697314
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21696698
has body: You can re deli-mate the second token by space as FileInputStream stream = new FileInputStream("src/transactions.txt"); fileIn = new Scanner(stream); fileIn.useDelimiter(","); name = fileIn.next(); System.out.println("Customer Name: " + name); Scanner s = new Scanner(fileIn.next()); s.useDelimiter(" "); balance = s.nextDouble(); System.out.printf("Checking balance before transaction: %.2f %n", balance); System.out.println("Action: "+s.next()); System.out.println("Transaction amount: "+s.nextDouble()); fileIn.reset();

http://stackoverflow.com/comment/32899979
type: QuestionComment
comment on: http://stackoverflow.com/q/21751240
score: 0
has text: make 1 provider like php who send email id and password from server when user click on it
type: Comment

http://stackoverflow.com/q/21776495
has body: Here is my example code: package javaapplication35; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.logging.Level; import java.util.logging.Logger; import static javaapplication35.ProgressBarExample.customProgressBar; import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingWorker; public class ProgressBarExample { final static JButton myButton =new JButton("Start"); final static JProgressBar customProgressBar = new JProgressBar(); private static final JPanel myPanel = new JPanel(); public static void main(String[] args) { customProgressBar.setMaximum(32); customProgressBar.setStringPainted(true); myPanel.add(customProgressBar); myPanel.add(myButton); myButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Thread firstly =new Thread(new Runnable ( ) { @Override public void run() { Calculations a = new Calculations(); a.doCaculations(); } }); Thread secondly =new Thread(new Runnable ( ) { @Override public void run() { JOptionPane.showMessageDialog(null,"just finished"); } }); firstly.start(); try { firstly.join(); } catch (InterruptedException ex) { Logger.getLogger(ProgressBarExample.class.getName()).log(Level.SEVERE, null, ex); } secondly.start(); } }); JOptionPane.showMessageDialog(null, myPanel, "Progress bar test", JOptionPane.PLAIN_MESSAGE); } } class Calculations { public void doCaculations() { new SwingWorker&lt;Void, Void&gt;() { @Override protected Void doInBackground() throws Exception { int value = 0; while (value &lt; customProgressBar.getMaximum()) { Thread.sleep(250); value ++; customProgressBar.setValue(value); } return null; } }.execute(); } private void doOtherStaff(){ //more methods, that don't need to run in seperate threads, exist } } There are 2 Threads. The firstly thread creates a Calculations class insance and then runs a doCaculations() method on it. The secondly thr…
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21776612
tagged with: multithreading
tagged with: thread-synchronization
has answer: http://stackoverflow.com/a/21776622
type: Question
has title: How to make thread wait untill method of another class completes
has answer: http://stackoverflow.com/a/21777117
tagged with: java
score: 0

http://stackoverflow.com/a/21725129
score: 1
has comment: http://stackoverflow.com/comment/32853295
has comment: http://stackoverflow.com/comment/32853626
downvote count: 0
has comment: http://stackoverflow.com/comment/32853198
has comment: http://stackoverflow.com/comment/32853548
has comment: http://stackoverflow.com/comment/32853297
has comment: http://stackoverflow.com/comment/32853368
type: Answer
answers question: http://stackoverflow.com/q/21724910
has body: You could use ssh to execute a local script on the remote machine to start/stop Tomcat, so if you are in a linux terminal, you could do something like: ssh username@remoteMachine /home/username/myScipts/start_tomcat.sh where start_tomcat.sh would be a script in the remote machine, of course you would need a valid username/password on the remote machine, and also the remote machine would need to have sshd installed and running
upvote count: 1

http://stackoverflow.com/q/21709997
has comment: http://stackoverflow.com/comment/32826944
tagged with: awt
has comment: http://stackoverflow.com/comment/32827257
has answer: http://stackoverflow.com/a/21710413
has comment: http://stackoverflow.com/comment/34515996
has title: icon in JButton is not shown at the running of the program, what could be?
has comment: http://stackoverflow.com/comment/34516163
has comment: http://stackoverflow.com/comment/32827057
has comment: http://stackoverflow.com/comment/32827174
has comment: http://stackoverflow.com/comment/32827048
tagged with: swing
has body: I'm training with Java, especially with GUI (Swing &amp; AWT), but I'm having a problem with icon in JButton. The image isn't shown, to make that visible I must resize the window, how could I do? Here is the code: public class MainWindow extends JFrame implements WindowListener, KeyListener, ActionListener, FocusListener, MouseListener{ private final String APPLICATION_NAME = "GUI"; private final String APPLICATION_VERSION = "0.0.1"; private final JButton btnCiao; JPanel panel = new JPanel(); JPanel panel2 = new JPanel(); public MainWindow(){ super(); this.setTitle(APPLICATION_NAME + " " + APPLICATION_VERSION); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener(this); Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); setLocation((int)(dimension.getWidth()/2-getWidth()/2), (int)(dimension.getHeight()/2-getHeight()/2)); this.setVisible(true); setMinimumSize(new Dimension(600,600)); add(panel); btnCiao = new JButton("WAU"); panel.add(btnCiao); JButton imageButton = new JButton(); try{ Image img = ImageIO.read(getClass().getResource("Nike.jpg")); Image img2 = ImageIO.read(getClass().getResource("Adidas.jpg")); imageButton.setIcon(new ImageIcon(img)); imageButton.setPressedIcon(new ImageIcon(img2)); } catch(IOException ex){} // to remove the border imageButton.setBorder(null); panel.add(imageButton); } }
has comment: http://stackoverflow.com/comment/32827231
type: Question
linked to: http://stackoverflow.com/q/20890898
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32826980
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/32827005
accepted answer: http://stackoverflow.com/a/21710413
linked to: http://stackoverflow.com/q/9510125
tagged with: user-interface
answer count: 1

gmail
type: Tag
tags question: http://stackoverflow.com/q/21751240
tag name: gmail
tags question: http://stackoverflow.com/q/21683149

http://stackoverflow.com/q/21768074
tagged with: java
has answer: http://stackoverflow.com/a/21768261
has answer: http://stackoverflow.com/a/78349310
type: Question
has answer: http://stackoverflow.com/a/21768136
has comment: http://stackoverflow.com/comment/32930604
has body: I have an assignment in my intro to programming course that I don't understand at all. I've been falling behind because of problems at home. I'm not asking you to do my assignment for me I'm just hoping for some help for a programming boob like me. The question is this: Calculate the time complexity in average case for searching, adding, and removing in a - unsorted vector - sorted vector - unsorted singlelinked list - sorted singlelinked list - hash table Let n be the number of elements in the datastructure and present the solution in a table with three rows and five columns. I'm not sure what this even means.. I've read as much as I can about time complexity but I don't understand it.. It's so confusing. I don't know where I would even start.. Remember I'm a novice programmer, as dumb as they come. I did really well last semester but had problems at home at the start of this one so I missed a lot of lectures and the first assignments so now I'm in over my head.. Maybe if someone could give me the answer and the reasoning behind it on a couple of them I could maybe understand it and do the others? I have a hard time learning through theory, examples work best.
score: 0
has title: Time complexity assignment
has comment: http://stackoverflow.com/comment/32930609
tagged with: time-complexity
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21768326
answer count: 4

http://stackoverflow.com/comment/32860243
has text: Do not forget you have the stackoverflow wiki of the tag itself: http://stackoverflow.com/tags/weak-references/info
comment on: http://stackoverflow.com/q/21729134
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33063701
comment on: http://stackoverflow.com/q/21833287
score: 0
type: Comment
type: QuestionComment
has text: It would require natives. What is this app., some kind of logger?

http://stackoverflow.com/comment/32799925
score: 0
has text: Is it crashing on `AddUser` call?
comment on: http://stackoverflow.com/q/21694865
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21768744
answers question: http://stackoverflow.com/q/21768496
has comment: http://stackoverflow.com/comment/32932146
score: 0
has comment: http://stackoverflow.com/comment/32932099
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21768496
type: Answer
has body: You could use a do...while loop like this: import java.io.*; import java.util.*; public class Tester1 { public static void main(String args[]) { Scanner kbReader= new Scanner (System.in); int scores[] = new int [10]; int counter = 0; int sum = 0; int input = 0; do { System.out.println("Enter score out of 10 or negative to break."); input=kbReader.nextInt(); if (input&lt;0) { break; } else if (input&gt;10) { System.out.println("Score must be out of 10"); } else { scores[input]++; counter++; sum+=input; } } while (input&gt;0); System.out.println("Score\t# of occur..."); for(int i =0; i&lt;10; i++) { System.out.println(i + "\t" + scores[i]); }; System.out.println("The mean score is " +(sum/counter)); } } The formatting can certainly be done better (without c-style tabs) but I don't remember the syntax at the moment.

http://stackoverflow.com/comment/33023705
type: QuestionComment
has text: @SotiriosDelimanolis you mean the controller ? which is already there. Because there is nothing else between them, just the config files
comment on: http://stackoverflow.com/q/21790656
score: 0
type: Comment

http://stackoverflow.com/q/21693176
tagged with: java
answer count: 1
tagged with: indexoutofboundsexception
type: UnansweredQuestion
tagged with: arraylist
has comment: http://stackoverflow.com/comment/32797122
has comment: http://stackoverflow.com/comment/32797149
type: Question
has comment: http://stackoverflow.com/comment/32797076
has body: Basically I just want an error message when there are no more records to show in the array list. What do I need to tweak? public void nextRecord() { if(records.size() &gt; 0) { recordCount++; if(records.get(recordCount) != null) { String[] array = records.get(recordCount).split(","); String item = array[0].trim().replaceAll("\"", ""); String number = array[1].trim(); String cost = array[2].trim(); String amnt = array[3].trim(); txtItem.setText(item); txtNumber.setText(number); txtCost.setText(cost); txtAmount.setText(amnt); } } else if (records.get(recordCount) == null) { JOptionPane.showMessa
has comment: http://stackoverflow.com/comment/32797091
has answer: http://stackoverflow.com/a/21693293
has title: How do I prevent an IndexOutOfBoundsException error in this Java code?
score: 0

http://stackoverflow.com/a/21768354
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32931250
type: Answer
has body: You could consider GCHandle.Alloc to prevent managed objects from being collected: http://msdn.microsoft.com/en-us/library/a95009h1%28v=vs.110%29.aspx Do not forget to call Free when the GCHandle is no longer needed. object obj = ....; GCHandle handle = GCHandle.Alloc(obj); // .... // object o is protected from garbage collection // .... handle.Free(); Note that (http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.gchandle.free%28v=vs.110%29.aspx) The caller must ensure that for a given handle, Free is called only once.
upvote count: 1
has comment: http://stackoverflow.com/comment/32931747
answers question: http://stackoverflow.com/q/21767963

http://stackoverflow.com/q/21821474
has body: I have created a class "My" in which i am simply taking input from user using Scanner class" import java.util.Scanner; class My { public static void main(String[] args) { int val; Scanner sc = new Scanner(System.in); System.out.println("Enter no = "); val= sc.nextInt(); System.out.println("number " + val); } } But I am getting following errors: My.java:1: cannot resolve symbolsymbol : class Scanner location: package util import java.util.Scanner; My.java:8: cannot resolve symbol symbol : class Scanner location: package util java.util.Scanner scanner = new java.util.Scanner(System.in); My.java:8: cannot resolve symbol symbol : class Scanner location: package util java.util.Scanner scanner = new java.util.Scanner(System.in);
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/33025466
type: Question
answer count: 2
score: -2
has comment: http://stackoverflow.com/comment/33025377
upvote count: 1
has comment: http://stackoverflow.com/comment/33025423
has answer: http://stackoverflow.com/a/21821674
favorite count: 0
tagged with: java.util.scanner
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/21821717
type: UnansweredQuestion
has title: how to resolve the error while using Scanner class in java
has comment: http://stackoverflow.com/comment/137812229

http://stackoverflow.com/comment/33027114
score: 0
type: Comment
has text: You can create a http server instead of 'TServerSocket'. But it's much more complicated. There is only 'TServlet' in thrift java library could help you to do that.
comment on: http://stackoverflow.com/a/21822216
type: AnswerComment

http://stackoverflow.com/comment/32856791
type: Comment
type: AnswerComment
has text: i dont have eclipes working :)
comment on: http://stackoverflow.com/a/21727036
score: 0

http://stackoverflow.com/a/21780179
upvote count: 5
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/32951111
has comment: http://stackoverflow.com/comment/32951533
type: Answer
has comment: http://stackoverflow.com/comment/32953834
answers question: http://stackoverflow.com/q/21780103
has body: It refers to gererics. I suggest you read a little on it. Basically, you know only at runtime what type of object you get to work with. For example, Class can be Integer, String or even YourDefinedClassType read here http://java.sun.com/developer/technicalArticles/J2SE/generics/

http://stackoverflow.com/comment/33053244
comment on: http://stackoverflow.com/q/21835569
score: 0
type: Comment
has text: Did you mention two questions here? 1. Design how to do this? and 2. you are not able to run the 'set role..'query?
type: QuestionComment

http://stackoverflow.com/comment/33197526
score: 0
has text: What could work, but isn't a solution imo: 1) store a list lSelected with the selected actors and a list lNotSelected with the actors not selected and visible 2) for each actor in lSelected, set that actor to invisible and for each actor in lNotSelected set that actor to visible 3) call draw on the stage 4) for each actor in lNotSelected, set that actor to invisible and set each actor in lSelected to visible. 5) call draw on the stage 6) update lSelected and lNotSelected 7) go to 2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21839302

http://stackoverflow.com/comment/32870351
has text: If I'm understanding you, I've addressed exactly that in my answer. Maybe you are looking at an old version? Refresh the page. It's the same concept as putting the input into `iInput` instead of `iTotalGrades`, and not adding it to `iTotalGrades` unless it's *not* `-1`.
type: Comment
comment on: http://stackoverflow.com/a/21734168
type: AnswerComment
score: 0

http://stackoverflow.com/comment/82844015
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21718900
score: 0
has text: Hey Naveen, Did you find any solution for this problem??

http://stackoverflow.com/comment/32983677
comment on: http://stackoverflow.com/a/21798067
score: 0
type: AnswerComment
type: Comment
has text: How could this be used to take a screenshot of a `RunningTaskInfo`?

algorithm
tags question: http://stackoverflow.com/q/21702251
tags question: http://stackoverflow.com/q/21794777
tags question: http://stackoverflow.com/q/21769278
tags question: http://stackoverflow.com/q/21822388
tags question: http://stackoverflow.com/q/21761749
tags question: http://stackoverflow.com/q/21837205
tags question: http://stackoverflow.com/q/21687054
tags question: http://stackoverflow.com/q/21769112
tag name: algorithm
tags question: http://stackoverflow.com/q/21799872
tags question: http://stackoverflow.com/q/21818850
tags question: http://stackoverflow.com/q/21832444
tags question: http://stackoverflow.com/q/21693252
tags question: http://stackoverflow.com/q/21771119
tags question: http://stackoverflow.com/q/21838044
tags question: http://stackoverflow.com/q/21839032
tags question: http://stackoverflow.com/q/21793463
tags question: http://stackoverflow.com/q/21750365
tags question: http://stackoverflow.com/q/21788530
tags question: http://stackoverflow.com/q/21729518
tags question: http://stackoverflow.com/q/21840953
tags question: http://stackoverflow.com/q/21815468
tags question: http://stackoverflow.com/q/21729173
tags question: http://stackoverflow.com/q/21764704
tags question: http://stackoverflow.com/q/21731792
tags question: http://stackoverflow.com/q/21767188
tags question: http://stackoverflow.com/q/21748235
tags question: http://stackoverflow.com/q/21713631
tags question: http://stackoverflow.com/q/21706947
tags question: http://stackoverflow.com/q/21780320
tags question: http://stackoverflow.com/q/21735468
type: Tag
tags question: http://stackoverflow.com/q/21680990
tags question: http://stackoverflow.com/q/21685529
tags question: http://stackoverflow.com/q/21800820
tags question: http://stackoverflow.com/q/21785684
tags question: http://stackoverflow.com/q/21803408
tags question: http://stackoverflow.com/q/21740234
tags question: http://stackoverflow.com/q/21787743
tags question: http://stackoverflow.com/q/21691760
tags question: http://stackoverflow.com/q/21722612
tags question: http://stackoverflow.com/q/21734598
tags question: http://stackoverflow.com/q/21765780
tags question: http://stackoverflow.com/q/21708832
tags question: http://stackoverflow.com/q/21812128
tags question: http://stackoverflow.com/q/21789787
tags question: http://stackoverflow.com/q/21796992

http://stackoverflow.com/comment/32848532
comment on: http://stackoverflow.com/a/21715745
has text: @user3235376: The thing is that, while you get back a String object in Java and you can output it to the screen, you will run into trouble when you write it out to a stream to save it on some device.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32786637
comment on: http://stackoverflow.com/a/21687474
score: 1
has text: As this is a JavaFX question, it seems likely the OP is referring to the javafx.application.Application class. This class shouldn't be instantiated by the developer but by the JavaFX framework.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32825182
comment on: http://stackoverflow.com/q/21708888
has text: @John no, it is because OP has this odd design. It would be a race condition if both workers A and B modify and use the same resource, which doesn't seem to be the problem OP states.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32783941
has text: Ah, I see. Could I then convert the `DateTime` object value, to a `Calendar` object, which would then be returned? Or would my problem go with it? I hate to burden you more, but my method really does need to return a `Calendar` object.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21685777

http://stackoverflow.com/comment/32997978
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21805918
type: AnswerComment
has text: I'm not sure I undesrtood what's happening. I want to delete the `Calibracao`entity but I don't want it to cascade delete the `ParametroStatus` it references. Thank you @eduardohl

http://stackoverflow.com/comment/32782506
comment on: http://stackoverflow.com/a/21685050
score: 0
type: AnswerComment
type: Comment
has text: @Watt sorry, I misspelled the ID. I corrected it in the code.

http://stackoverflow.com/q/21683434
answer count: 2
has title: Setting TextView to Array value
has answer: http://stackoverflow.com/a/21683997
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/32779334
favorite count: 0
tagged with: android
tagged with: textview
type: UnansweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21683530
has body: I'm trying to make a small app that takes an input in an EditText number and takes the corresponding value from an array and displays it in a TextView @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText e = (EditText) findViewById(R.id.editText1); final TextView t = (TextView) findViewById(R.id.textView1); Button b = (Button) findViewById(R.id.button1); Resources res = this.getResources(); String arr[] = getResources().getStringArray(R.array.example); final Editable input = e.getText(); final String in2 = input.toString(); int number = Integer.parseInt(in2); if(number < 0){ t.setText("Input is too small"); } else if (number > 666){ t.setText("Input is too large"); } else { final String out = arr[number].toString(); b.setOnClickListener(new OnClickListener() { public void onClick(View v) { t.setText(in2); } }); } } I want it so that if the input is 0 and the button is clicked the TextView is A. A B C D Unfortunately whenever I start this up on an emulator or a phone it instantly crashes. Does anyone know what I'm doing wrong?
score: 1
tagged with: java
tagged with: settext

http://stackoverflow.com/q/21759534
has answer: http://stackoverflow.com/a/21759618
favorite count: 0
has comment: http://stackoverflow.com/comment/32914616
type: UnansweredQuestion
tagged with: encryption
has answer: http://stackoverflow.com/a/21759858
score: -1
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32914487
downvote count: 3
has comment: http://stackoverflow.com/comment/32914380
type: Question
has body: If i have an already known cipher text and the only information that i know is that the plaintext is English language message.I dont know the plaintext,only that is english language message. The key is 16-bit. Which is the procedure that i should follow if i want to decrypt it with brute force attack??
answer count: 2
has title: How to decrypt a known cipher text with brute force attack?

http://stackoverflow.com/q/21783038
tagged with: java
has title: change Server time to our local machine`s time in Java
upvote count: 0
answer count: 1
favorite count: 0
has body: I am developing a web application (in jsp) which is used worldwide. Now I need to change date and time to local machine specific(in java). For example my web server is in USA and a client from India opens the application then the application should change all the date and time in the IST (Indian Standered Time) format. Actually, what I am looking for is like this -- import java.text.DateFormat; import java.util.Date; import java.util.TimeZone; import java.text.SimpleDateFormat; public class TZConvert { public static void main(String[] args) throws Exception { SimpleDateFormat format = new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss"); Date date1 = format.parse("14-Feb-2014 14:40:00"); DateFormat localDf = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL); System.out.println("local : " + localDf.format(date1)); } } I want value of "date1" should change in different timezone. If a person from EST timezone he should see this date and time (14-Feb-2014 14:40:00) and if a person open the application he should see "15-Feb-2014 01:10:00".
has answer: http://stackoverflow.com/a/21783602
tagged with: timezone
type: UnansweredQuestion
downvote count: 2
type: Question
score: -2

http://stackoverflow.com/a/21693007
has comment: http://stackoverflow.com/comment/32796899
upvote count: 1
answers question: http://stackoverflow.com/q/21692944
has comment: http://stackoverflow.com/comment/32796952
score: 1
has body: In this case, you don't need the Thread t=new Thread(h) line, because LengthOfString extends Thread. Many times though, you implement the Runnable Interface. In that case, you need to create a Thread object with a Runnable argument in the constructor, because Runnable Objects dont have a start methods
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32797017

http://stackoverflow.com/q/21717795
has comment: http://stackoverflow.com/comment/32841387
has comment: http://stackoverflow.com/comment/32841308
accepted answer: http://stackoverflow.com/a/21718571
has comment: http://stackoverflow.com/comment/32841400
upvote count: 1
has comment: http://stackoverflow.com/comment/32841324
type: Question
has comment: http://stackoverflow.com/comment/32841277
has comment: http://stackoverflow.com/comment/32841406
has comment: http://stackoverflow.com/comment/32841369
tagged with: java
has comment: http://stackoverflow.com/comment/32841481
tagged with: jsoup
answer count: 1
has comment: http://stackoverflow.com/comment/32841237
downvote count: 0
has body: I have been porting a PC Application I made to Android. I have the code up and running perfectly, but JSoup seems to be getting the wrong data for some reason. I did a direct copy and paste from the working PC Application, which works just fine. Here is a piece of the code I am using in both PC and Android String AllGamesURL = "http://www.nfl.com/standings?category=league&amp;season=" + Stringyear + "-REG"; String HomeGamesURL = "http://www.nfl.com/standings?category=league&amp;season=" + Stringyear + "-REG&amp;split=Home"; String AwayGamesURL = "http://www.nfl.com/standings?category=league&amp;season=" + Stringyear + "-REG&amp;split=Road"; String DivisionGamesURL = "http://www.nfl.com/standings?category=league&amp;season=" + Stringyear + "-REG&amp;split=Division"; Document AllGames = Jsoup.connect(AllGamesURL).get(); Document HomeGames = Jsoup.connect(HomeGamesURL).get(); Document AwayGames = Jsoup.connect(AwayGamesURL).get(); Document DivisionGames = Jsoup.connect(DivisionGamesURL).get(); Elements AllGamesTeams = AllGames.select("table.data-table1 tr.tbdy1"); Elements HomeGamesTeams = HomeGames.select("table.data-table1 tr.tbdy1"); Elements AwayGamesTeams = AwayGames.select("table.data-table1 tr.tbdy1"); Elements DivisionGamesTeams = DivisionGames.select("table.data-table1 tr.tbdy1"); for (Element teamName : AllGamesTeams) { if(teamName.select("td[align] &gt; a[href]").text().trim().equals("")) { team = teamName.select("td[align]").text().trim(); } else { team = teamName.select("td[align] &gt; a[href]").text().trim(); } if(team.equals(currentSelectedTeam)) { //Division = teamName.select("td:eq(2)").text().trim(); wins = Integer.parseInt(teamName.select("td:eq(3)").text().trim()); losses = Integer.parseInt(teamName.select("td:eq(4)").text().trim()); ties = Integer.parseInt(teamName.select("td:eq(5)").text().trim()); gamesPlayed = wins + losses + ties; pointsFor = Integer.parseInt(teamName.select("td:eq(7)").text().trim()); pointsAgainst = Integer.parseInt(teamName.…
score: 1
has title: JSoup acts differently on Android than on PC?
has answer: http://stackoverflow.com/a/21718571
favorite count: 0
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/q/21684819
tagged with: bounds
type: Question
downvote count: 0
favorite count: 0
has body: I'm currently writing a new Karaoke-FX-Generator using Java. Now I have a problem with the implementation of the TextExtents-Function: It returns the wrong string bounds for the Subtitle file. Here's an example: The red rectangle represents the bounds of the string calculated by my program while the red background are the bounds calculated by xy-vsfilter. Does anyone know how to fix that. I'm trying several hours and I still don't get any further. This is the current implementation of the function. /** * Calculates the text-extents for the given text in the specified * style. * @param style The style * @param text The text * @return The extents of the text. */ public TextExtents getTextExtents(AssStyle style, String text) { // Reads the font object from the cache. Font font = this.getFont(style.getFontname(), style.isBold(), style.isItalic()); // If the font is unknown, return null. if (font == null) return null; // Add the font size. (Note: FONT_SIZE_SCALE is 64) font = font.deriveFont((float) style.getFontsize() * FONT_SIZE_SCALE); // Returns other values like ascend, descend and ext-lead. LineMetrics metrics = font.getLineMetrics(text, this.ctx); // Calculate String bounds. Rectangle2D rSize = font.getStringBounds(text, this.ctx); // Returns the text-extents. return new TextExtents( rSize.getWidth() / FONT_SIZE_SCALE, rSize.getHeight() / FONT_SIZE_SCALE, metrics.getAscent() / FONT_SIZE_SCALE, metrics.getDescent() / FONT_SIZE_SCALE, metrics.getLeading() / FONT_SIZE_SCALE ); } I partially solved the problem. LOGFONT.lfHeight and Java uses different unit for font sizes. As such, I had to convert the font-size of java to the "logical" units. // I used this code to convert from pixel-size to "logical units" float fontSize = 72F / SCREEN_DPI; // SCREEN_DPI = 96 Now I only have small differences.
has title: Wrong text width using AWT
tagged with: measure
answer count: 0
tagged with: subtitle
type: UnansweredQuestion
upvote count: 1
tagged with: text
score: 1
tagged with: java

http://stackoverflow.com/q/21678550
tagged with: apache-axis
has body: When am trying to deployin Rampart(rampart-1.6.2) into Axis2(axis2-1.6.0) am getting the below excpetion. I have followed the steps which are mentioned here Exception trace: weblogic.application.ModuleException: [HTTP:101216]Servlet: "AxisServlet" failed to preload on startup in Web application: "axis2.war". java.lang.NoSuchMethodError: org.opensaml.xml.XMLConfigurator.load(Ljava/io/InputStream;)V at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:199) at org.apache.rahas.RampartSAMLBootstrap.bootstrap(RampartSAMLBootstrap.java:79) at org.apache.rahas.Rahas.init(Rahas.java:41) at org.apache.axis2.context.ConfigurationContextFactory.initModules(ConfigurationContextFactory.java:252) at org.apache.axis2.context.ConfigurationContextFactory.init(ConfigurationContextFactory.java:230) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:93) at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584) at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454) at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64) at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58) at weblogic.servlet.internal.StubLifecycleHelper.&lt;init&gt;(StubLifecycleHelper.java:48) at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539) at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1981) at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1955) at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppS…
type: Question
score: 0
answer count: 1
has title: Unable to deploying Rampart into Axis2
type: UnansweredQuestion
tagged with: web-services
has answer: http://stackoverflow.com/a/21723930
tagged with: rampart
tagged with: java

http://stackoverflow.com/q/21833137
has comment: http://stackoverflow.com/comment/33045658
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/21833276
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/33045820
tagged with: resultset
possible better answer: http://stackoverflow.com/a/21833276
has answer: http://stackoverflow.com/a/21836123
accepted answer: http://stackoverflow.com/a/21836123
downvote count: 1
has comment: http://stackoverflow.com/comment/33047235
type: Question
has comment: http://stackoverflow.com/comment/33054218
type: AnsweredQuestion
has title: iterate through resultset passed in array
has comment: http://stackoverflow.com/comment/33045666
has body: I have passed an ArrayList to another method. In this method I need to extract the resultset from the ArrayList and iterate through it. The resultset is being passed no problem. The problem is trying to extract the resultset from the Array, and because of this I cannot do resultSet = GUIsidearray.get(0); does not work, and because of this I cannot do while(resultSet.next()). See some of the code sample below. Any help would be appreciated. public void updateLocal(ArrayList&lt;ArrayList&lt;Object&gt;&gt; GUIsidearray) { System.out.println("Get passed Array Value " + GUIsidearray.get(0)); // Shown in console -&gt; Get passed Array Value // [sun.jdbc.odbc.JdbcOdbcResultSet@1adc30] // ResultSet resultSet resultSet = GUIsidearray.get(0); boolean emptyRs = true; try { while (resultSet.next()) { emptyRs = false; // If ResultSet is empty String Serno = (resultSet.getString("Serialnumber")); System.out.println("Serial Number " + Serno); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
tagged with: java
has comment: http://stackoverflow.com/comment/33054219
has comment: http://stackoverflow.com/comment/33046003
score: -1
has comment: http://stackoverflow.com/comment/33054220
has comment: http://stackoverflow.com/comment/33054217

http://stackoverflow.com/comment/33553339
type: Comment
comment on: http://stackoverflow.com/a/21841558
score: 0
type: AnswerComment
has text: Spot on, when performing operations they carried on working as if nothing had happened. Failover worked a treat

http://stackoverflow.com/a/21830275
has body: There are three general flavors that are commonly seen with a lazy Singleton. The first is one without synchronization like your first example. The second, as you mentioned is double checked locking without volatile, and finally DCL with volatile. One contains a race-condition (if shared field is synchronized) and one contains a data-race. public static class Singleton{ private static volatile Singleton INSTANCE; // volatile to illustrate the race condition public static Singleton getInstance(){ if(INSTANCE == null){ INSTANCE = new Singleton(); } return INSTANCE; } } In this case there doesn't happen to be a data-race but there is a race condition. The race here is that two or more threads can create a Singleton instance. Now for a Double Checked locking example: public static class Singleton{ private static Singleton INSTANCE; // not volatile to illustrate the data-race public static Singleton getInstance(){ if(INSTANCE == null){ synchronized(Singleton.class){ INSTANCE = new Singleton(); } } return INSTANCE; } } In this case there is a data-race but not race-condition. The writes that occur to the INSTANCE variable may not be visible to other threads despite INSTANCE not being null. So to answer your question. My question is whether this code can also be considered to cause a Data race? In your example, it contains both a data-race and a race-condition since neither the shared mutable variable is synchronized nor the atomic action of check-then-set is synchronized.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21829921
has comment: http://stackoverflow.com/comment/33040967
score: 7
has comment: http://stackoverflow.com/comment/33041661
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33041990
type: Answer
answers question: http://stackoverflow.com/q/21829921

http://stackoverflow.com/a/21812839
score: 1
accepted answer of: http://stackoverflow.com/q/21812762
type: Answer
answers question: http://stackoverflow.com/q/21812762
upvote count: 1
has body: You have to specify the table name instead of the database name when you're inserting, same with other methods (crud): public long insert(String content1){ ContentValues contentValues = new ContentValues(); contentValues.put(EMPLOYEE_NAME,content1); return db.insert(DATA_TABLE_NAME,null,contentValues); }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21681044
has comment: http://stackoverflow.com/comment/124550887
has body: I run a Java game server where I need to efficiently rank players in various ways. For example, by score, money, games won, and other achievements. This is so I can recognize the top 25 players in a given category to apply medals to those players, and dynamically update them as the rankings change. Performance is a high priority. Note that this cannot easily be done in the database only, as the ranks will come from different sources of data and different database tables, so my hope is to handle this all in memory, and call methods on the ranked list when a value needs to be updated. Also, potentially many users can tie for the same rank. For example, let's say I have a million players in the database. A given player might earn some extra points and instantly move from 21,305th place to 23rd place, and then later drop back off the top 25 list. I need a way to handle this efficiently. I imagine that some kind of doubly-linked list would be used, but am unsure of how to handle quickly jumping many spots in the list without traversing it one at a time to find the correct new ranking. The fact that players can tie complicates things a little bit, as each element in the ranked list can have multiple users. How would you handle this in Java?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32775098
tagged with: list
tagged with: performance
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/21682141
type: Question
has comment: http://stackoverflow.com/comment/32789902
has title: Efficiently and dynamically rank many users in memory?
tagged with: jar
possible better answer: http://stackoverflow.com/a/21681841
has answer: http://stackoverflow.com/a/21681841
has answer: http://stackoverflow.com/a/21681887
answer count: 3
score: 2
has comment: http://stackoverflow.com/comment/32776318
has comment: http://stackoverflow.com/comment/32775331
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21682141

http://stackoverflow.com/comment/32952965
score: 0
comment on: http://stackoverflow.com/q/21777205
type: Comment
type: QuestionComment
has text: You probably want to set autocommit=false.

ejb
tags question: http://stackoverflow.com/q/21700900
tags question: http://stackoverflow.com/q/21751455
tags question: http://stackoverflow.com/q/21752788
tags question: http://stackoverflow.com/q/21769800
tags question: http://stackoverflow.com/q/21702051
tags question: http://stackoverflow.com/q/21759197
tags question: http://stackoverflow.com/q/21748229
tag name: ejb
tags question: http://stackoverflow.com/q/21740003
tags question: http://stackoverflow.com/q/21809747
tags question: http://stackoverflow.com/q/21811737
tags question: http://stackoverflow.com/q/21802575
tags question: http://stackoverflow.com/q/21682869
tags question: http://stackoverflow.com/q/21804438
tags question: http://stackoverflow.com/q/21817809
tags question: http://stackoverflow.com/q/21698992
tags question: http://stackoverflow.com/q/21707062
tags question: http://stackoverflow.com/q/21681921
tags question: http://stackoverflow.com/q/21687646
type: Tag
tags question: http://stackoverflow.com/q/21738420
tags question: http://stackoverflow.com/q/21725476
tags question: http://stackoverflow.com/q/21825141
tags question: http://stackoverflow.com/q/21784252

asyncsocket
tags question: http://stackoverflow.com/q/21816005
tags question: http://stackoverflow.com/q/21841159
type: Tag
tags question: http://stackoverflow.com/q/21818076
tag name: asyncsocket

pdf-generation
tags question: http://stackoverflow.com/q/21826843
tag name: pdf-generation
tags question: http://stackoverflow.com/q/21817860
tags question: http://stackoverflow.com/q/21727047
type: Tag
tags question: http://stackoverflow.com/q/21696426
tags question: http://stackoverflow.com/q/21759903
tags question: http://stackoverflow.com/q/21731439

http://stackoverflow.com/q/21829162
duplicate of: http://stackoverflow.com/q/21826639
tagged with: spring
has comment: http://stackoverflow.com/comment/33039011
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/18496693
has comment: http://stackoverflow.com/comment/33038391
upvote count: 14
tagged with: spring-3
tagged with: java
has title: Spring bean instantiation by passing constructor args?
type: Question
score: 14
has comment: http://stackoverflow.com/comment/33038920
has comment: http://stackoverflow.com/comment/33038489
has answer: http://stackoverflow.com/a/21829388
linked to: http://stackoverflow.com/q/18516874
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33038931
favorite count: 0
duplicate of: http://stackoverflow.com/q/18516874
linked to: http://stackoverflow.com/q/21826639
has body: I have below spring bean. public class Employee2 { private int id; private String name; private double salary; public Employee2(int id, String name, double salary) { this.id = id; this.name = name; this.salary = salary; } // some logic to call database using above values } Now i have below config in spring configuration file. &lt;bean id="emp2" class="com.basic.Employee2"&gt; &lt;constructor-arg name="id" value="" /&gt; &lt;constructor-arg name="name" value="" /&gt; &lt;constructor-arg name="salary" value="" /&gt; &lt;/bean&gt; Now i cannot hard code the values in above config since they are dynamic. Now i am getting spring bean programmatically using below code. The bean scope is singelton. Employee2 emp = (Employee2)applicationContext.getBean("emp2"); Now how can i pass the values to Employee2 constructor? Thanks!
has comment: http://stackoverflow.com/comment/33039210
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33039090

http://stackoverflow.com/comment/32869825
type: Comment
comment on: http://stackoverflow.com/a/21734168
has text: As I said, there are other problems. I'm specifically addressing the while loop not terminating issue. I'll edit my post to say that, but as others already have said it, it seems redundant (and not worthy of a down-vote).
score: 0
type: AnswerComment

http://stackoverflow.com/q/21807210
score: -1
has answer: http://stackoverflow.com/a/21807297
has comment: http://stackoverflow.com/comment/33000065
tagged with: class
has body: I am new to Java and would like your help with the following simple and short code: public boolean hasPassed(Student s) { return (grade &gt; 45); } The above, code, is part of a program in Java. The following is the full code for the simple exemplar program if you would like to know: public class Student { private String name; private int grade; public Student(String n) { name = n; } public void setGrade(int g) { grade = g; } public boolean hasPassed(Student s) { return (grade &gt; 45); } } Question I believe that this invokes a method called 'hasPassed' to determine whether if student 's' has passed (for example, Computer science). Could you correct me if I am wrong? Select the best option that describes the function of the hasPassed method: a) This code defines a method called hasPassed that determines if all students have passed computer science. b) This code defines a method called hasPassed that determines if student 's' has passed computer science. c) This code invokes a method called hasPassed to determine if student 's' has passed computer science. d) This code defines a method called hasPassed that determines if a student has passed computer science. e) Nothing - this code would not compile. Since this is a past exam paper question, one of the above is definitely the correct answer. I somehow think it's 'C' but since there are no condition; it doesn't seem possible but then again it does do one of the above and I think it's not 'E' since the function seems correct and compile-able, just lacking a condition is all. Thanks for your time for reading this.
has comment: http://stackoverflow.com/comment/33000035
answer count: 2
has comment: http://stackoverflow.com/comment/33000057
favorite count: 0
has comment: http://stackoverflow.com/comment/33000040
has comment: http://stackoverflow.com/comment/33000329
has answer: http://stackoverflow.com/a/21807392
has comment: http://stackoverflow.com/comment/33000080
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21807392
upvote count: 2
downvote count: 3
tagged with: methods
has title: Java Code method
has comment: http://stackoverflow.com/comment/33000086
has comment: http://stackoverflow.com/comment/33000460
type: Question
possible better answer: http://stackoverflow.com/a/21807297
tagged with: java

http://stackoverflow.com/q/21688823
accepted answer: http://stackoverflow.com/a/25172468
downvote count: 0
has body: Our Java application makes background file transfer to a server. When the user wish to add a bunch of documents to the server and do something else with other applications, App Nap becomes active and slow down the window with the progress bar and the network transfert speed. One solution is too opt out the entire application from App Nap, but it would be great if we could exclude some Java threads from being slowed down. I am not sure how we could integrate the functionality of NSProcessInfo into Java... Anybody have tried to do such thing from Java? Any ideas? Thanks!
has comment: http://stackoverflow.com/comment/33048238
upvote count: 1
has answer: http://stackoverflow.com/a/25172468
has title: Disabling App Nap in Java
tagged with: macos
possible better answer: http://stackoverflow.com/a/22525820
favorite count: 0
tagged with: energy
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33426212
score: 1
tagged with: osx-mavericks
tagged with: java
has answer: http://stackoverflow.com/a/22525820
has comment: http://stackoverflow.com/comment/33481389
type: Question
answer count: 2

http://stackoverflow.com/comment/32896744
type: Comment
type: QuestionComment
has text: How do I know? Sorry for my ignorance, I am new to Android.
score: 0
comment on: http://stackoverflow.com/q/21748885

http://stackoverflow.com/q/21749662
has title: NullPointerException when adding some LinearLayouts
tagged with: android
has answer: http://stackoverflow.com/a/21750023
has comment: http://stackoverflow.com/comment/32904731
has comment: http://stackoverflow.com/comment/32898542
has comment: http://stackoverflow.com/comment/32897773
has comment: http://stackoverflow.com/comment/32897324
accepted answer: http://stackoverflow.com/a/21749769
has answer: http://stackoverflow.com/a/21750653
has body: I'm developing an Android app which requires me to define some LinearLayouts contained inside a main LinearLayout, these layouts data are dynamically obtained through the run_time, but the Container Layout is statically declared in the XML, I add the dynamically created Layouts to the main Layout but i got a NullPointerException : 02-13 11:03:45.745: WARN/System.err(620): java.lang.NullPointerException 02-13 11:03:45.745: WARN/System.err(620): at com.example.solaceap.Media.initiatePopupWindow(Media.java:476) 02-13 11:03:45.755: WARN/System.err(620): at android.view.View.performClick(View.java:3480) 02-13 11:03:45.765: WARN/System.err(620): at android.view.View$PerformClick.run(View.java:13983) 02-13 11:03:45.765: WARN/System.err(620): at android.os.Handler.handleCallback(Handler.java:605) 02-13 11:03:45.765: WARN/System.err(620): at android.os.Handler.dispatchMessage(Handler.java:92) 02-13 11:03:45.775: WARN/System.err(620): at android.os.Looper.loop(Looper.java:137) 02-13 11:03:45.785: WARN/System.err(620): at android.app.ActivityThread.main(ActivityThread.java:4340) 02-13 11:03:45.785: WARN/System.err(620): at java.lang.reflect.Method.invokeNative(Native Method) 02-13 11:03:45.795: WARN/System.err(620): at java.lang.reflect.Method.invoke(Method.java:511) 02-13 11:03:45.795: WARN/System.err(620): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 02-13 11:03:45.805: WARN/System.err(620): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 02-13 11:03:45.805: WARN/System.err(620): at dalvik.system.NativeStart.main(Native Method) and This is my code : main Layout: &lt;LinearLayout android:id="@+id/music_popup" android:layout_width="300dp" android:layout_height="500dp" android:background="@drawable/ac_overlay" android:gravity="top" android:orientation="vertical" android:paddingBottom="12dp" android:paddingTop="12dp" &gt; &lt;/LinearLayout&gt; And this is the dynamically declared layouts: private View layout = null; LinearLay…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32897400
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/21750653
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/32897690
tagged with: layout
has comment: http://stackoverflow.com/comment/32897607
has answer: http://stackoverflow.com/a/21749769
tagged with: nullpointerexception
answer count: 3

http://stackoverflow.com/q/21801353
has body: My Java app creates and deletes a directory Dir_X. Somehow I've noticed when I have a Windows Explorer Window open and pointing at that directory, my Java app won't run properly, so I used Java to list all the processes and get the PID for the process explorer.exe and killed it. But this would kill the main task bar at the bottom of the desktop Windows Explorer, that's not what I want. I just want to close any Windows Explorer Window that is open, so my Java app can create and delete Dir_X without a problem, so my question is: how do I use Java to close a Windows Explorer Window?
score: 0
has title: How to use Java to close a Windows Explorer Window?
type: UnansweredQuestion
tagged with: windows
tagged with: windows-explorer
has comment: http://stackoverflow.com/comment/32989393
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32990226

http://stackoverflow.com/comment/32790857
has text: Use `System.out.println()` instead of `System.out.print()`.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21689422
type: Comment

http://stackoverflow.com/q/21728506
has comment: http://stackoverflow.com/comment/32864280
downvote count: 0
tagged with: dom-events
has comment: http://stackoverflow.com/comment/32867798
linked to: http://stackoverflow.com/q/3582671
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/32871142
has comment: http://stackoverflow.com/comment/32863364
favorite count: 0
has comment: http://stackoverflow.com/comment/32865511
answer count: 0
type: UnansweredQuestion
tagged with: swt
upvote count: 1
has body: I'm using SWT Browser which is being filled by setting the browser's text (due to dynamic html changes). I want to add a location listener in order to get values from the html and use it in the Java code, but I get about:blank# instead of the link I'm sending in the html file. Java code: if (browser == null) { browser = new Browser(browserComposite, SWT.NONE); browser.setJavascriptEnabled(true); } browser.setText(os.toString(),true); browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); browser.addLocationListener(new LocationListener() { @Override public void changing(LocationEvent e) { System.out.println(e.location); e.doit = false; } @Override public void changed(LocationEvent e) { e.doit = false; } }); html code: &lt;script&gt; function myFunc(vars) { window.location="http://www.google.com"; } function recordVariableUse(nodes, vars) { for (var i=0; i&lt;nodes.length; i++) { nodes[i].onclick=function() {myFunc(vars)} } } recordVariableUse(document.getElementsByClassName("x"), ["y"]); &lt;/script&gt;
score: 1
tagged with: java
has title: SWT Browser location listener event returns about:blank
has comment: http://stackoverflow.com/comment/98438649
type: Question
tagged with: browser

http://stackoverflow.com/q/21746724
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32892387
score: 0
answer count: 1
has body: i have done following to retrieve code from xls sheet and csv file. i tried using ".trim()" but I am not getting the required output. Please tell where I am going wrong in order to remove any trailing blank spaces from xls cell and csv file. for (int rowNum = rowStart-1; rowNum &lt; rowEnd+1; rowNum++) { List&lt;String&gt; cellTempList = new ArrayList&lt;String&gt;(); Row rowObj = hssfSheet.getRow(rowNum); for (int col = 0; col &lt; columnEnd; col++) { Cell cell = rowObj.getCell(col, Row.CREATE_NULL_AS_BLANK); if(cell.getCellType()==cell.CELL_TYPE_NUMERIC) { DecimalFormat df = new DecimalFormat("#.##"); String cellValue=df.format(cell.getNumericCellValue()); cellTempList.add(cellValue.toString()); logger.trace(TId + " Adding cell having string to "+cellTempList); } else { cellTempList.add(cell.toString()+""); } } cellDataList.add(cellTempList); //following to retrieve data from a csv file while ((line = stream.readLine()) != null) { if(iteration &lt; iteration1-1 || StringUtils.isBlank(line)) { iteration++; continue; } //String[] splitted = line.split(","); String[] splitted = StringUtils.splitPreserveAllTokens(line,','); List&lt;String&gt; dataLine = new ArrayList&lt;String&gt;(splitted.length); for (String data : splitted) dataLine.add(data.trim()); csvData.add(dataLine); } } catch (Exception e) { logger.error(TId + " Other Exception : " + e.getStackTrace()); throw new Exception("-8"); } finally { if (stream != null) try { stream.close(); } catch (IOException e) { // TODO Auto-generated catch block //e.printStackTrace(); logger.error(TId + " IOException : " + e.getStackTrace()); throw new Exception("-8"); } } logger.info(TId + " [Flow]:Exiting readcsvFile Method...." + csvData); return csvData; } please help i tried trim but i am not getting the required output
has comment: http://stackoverflow.com/comment/32892354
tagged with: hssf
tagged with: apache-poi
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77286616
has comment: http://stackoverflow.com/comment/32892637
has comment: http://stackoverflow.com/comment/32892526
has title: How to use "trim" while retrieving data from xls sheet and csv file?

soa
type: Tag
tags question: http://stackoverflow.com/q/21761715
tag name: soa

http://stackoverflow.com/a/21681170
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32776210
type: Answer
has body: This is not a technical limitation, rather (as you have pointed out) a logical one. Java (and many other languages) enforce various rules not because they are impossible to break, but because this is an intentional part of the language.
answers question: http://stackoverflow.com/q/21681094
upvote count: 12
score: 12
has comment: http://stackoverflow.com/comment/32775183
accepted answer of: http://stackoverflow.com/q/21681094

http://stackoverflow.com/q/21837596
duplicate of: http://stackoverflow.com/q/21823383
has answer: http://stackoverflow.com/a/21837714
linked to: http://stackoverflow.com/q/21823383
tagged with: return
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33053594
downvote count: 1
type: Question
tagged with: numbers
tagged with: java
has title: missing return statement for a for loop to sort numbers from lowest to highest
has comment: http://stackoverflow.com/comment/33053580
score: -1
has comment: http://stackoverflow.com/comment/33053801
has answer: http://stackoverflow.com/a/21837764
answer count: 2
has comment: http://stackoverflow.com/comment/33053609
has body: public int sorting ( int side1, int side2,int side3) { int[] xx= {side1,side2,side3}; int trace=0; for (int i = 0; i &lt; xx.length-1; i++) { for (int j = i+1; j &lt; xx.length; j++) { if (xx[i] &gt; xx[j]) { int save= xx[i]; xx[i]= xx[j]; xx[j]= save; } trace++; } } for (int i = 0; i &lt; xx.length; i++) { int number = xx[i]; return number; } }// missing return statement Making a method that sorts numbers from lowest to highest as part for a triangle program and it giving me a missing return statement error. I don't know what I'm missing exactly. Please help.
upvote count: 0
tagged with: sorting
favorite count: 0

http://stackoverflow.com/a/21805088
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21804982
answers question: http://stackoverflow.com/q/21804982
upvote count: 2
has body: Substitute (Distinct method_name) with Distinct method_name because that is the correct syntax for the SELECT Also, you need to substitute 'String' with 'String%' or '%String%' (depends on what exactly are you wanna fetch, I don't know java, so...), otherwise it is logicaly become equal to name = 'String'

http://stackoverflow.com/a/21837228
type: Answer
has comment: http://stackoverflow.com/comment/33053128
has comment: http://stackoverflow.com/comment/33052957
downvote count: 0
has comment: http://stackoverflow.com/comment/33053252
has comment: http://stackoverflow.com/comment/33053341
has body: I don't know why when I launch it, the screen is black until application retreives data from the service. A service runs in the same process as the application. The code to bind to the service and the callback from the ServiceConnection... everything runs in the main thread. You're wrong when you say bindService() is working asynchronously. You still need to create a separate thread to do the job, to prevent the UI from blocking. The documentation says: Caution: A service runs in the main thread of its hosting process—the service does not create its own thread and does not run in a separate process (unless you specify otherwise). This means that, if your service is going to do any CPU intensive work or blocking operations (such as MP3 playback or networking), you should create a new thread within the service to do that work. By using a separate thread, you will reduce the risk of Application Not Responding (ANR) errors and the application's main thread can remain dedicated to user interaction with your activities.
score: 3
has comment: http://stackoverflow.com/comment/33053190
answers question: http://stackoverflow.com/q/21837120
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21837120
upvote count: 3

http://stackoverflow.com/a/21692929
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21692610
has body: There was a similar topic already on stack overflow, hope it helps: Java - Ramanujan Series for pi
score: 1
upvote count: 1

http://stackoverflow.com/comment/32877614
has text: That's not an objection; he's explicitly asking for new syntax.
score: 2
comment on: http://stackoverflow.com/a/21738456
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32796208
type: QuestionComment
score: 5
has text: This question appears to be off-topic because it (1) lacks information regarding the problem encountered, (2) is too broad because the OP doesn't seem to know basics of programming, (3) lacks any research effort (there would be numerous examples for the problem already).
comment on: http://stackoverflow.com/q/21692610
type: Comment

http://stackoverflow.com/comment/33021283
comment on: http://stackoverflow.com/q/21819046
score: 0
type: Comment
type: QuestionComment
has text: have u checked to see that image is not null

http://stackoverflow.com/q/21702347
tagged with: android
has answer: http://stackoverflow.com/a/21702807
linked to: http://stackoverflow.com/q/19465013
tagged with: java
tagged with: andengine
has body: I read that they both are based in OpenGL ES 2 and both have Box2D physics. I'm pretty new into Android game development, but somewhat experienced with game development (C++ and C#/XNA). I also have experience with Unity and Construct2. So, I'm trying to find a great game engine to use to develop 2D games. Do you guys have any recommendations or anything? I'm willing to purchase books and whatnot.
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/21702791
score: 0
answer count: 3
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21702858
has title: What is the difference between AndEngine and LibGDX?
type: UnansweredQuestion

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/21833844
type: Tag
tags question: http://stackoverflow.com/q/21693480

http://stackoverflow.com/comment/32963800
has text: Where is the rest of the query and the Java code?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21787028

http://stackoverflow.com/comment/32960135
type: AnswerComment
has text: Is there any way to make sure what I see on the client is an actual reflection on the JFrame on the server? Perhaps passing it by reference (if possible)?
type: Comment
comment on: http://stackoverflow.com/a/21782461
score: 0

http://stackoverflow.com/comment/32912271
score: 0
type: Comment
type: QuestionComment
has text: "Sometimes it isn't three digits then dot and four digits after" - How would you differentiate this: `114.5533 & 111.3257` from this: `114.553 & 3111.3257` given the input: `114.5533111.3257`?
comment on: http://stackoverflow.com/q/21758138

http://stackoverflow.com/comment/32982479
score: 0
type: AnswerComment
has text: when i do that. the program starts for 5 seconds then closes
type: Comment
comment on: http://stackoverflow.com/a/21797418

http://stackoverflow.com/q/21681774
tagged with: java
has answer: http://stackoverflow.com/a/21703912
tagged with: xsd-validation
has title: XmlBeans - XSD validation against a type, not element
type: Question
has answer: http://stackoverflow.com/a/21734277
score: 0
answer count: 2
has body: I need to validate the following XML against a (complex) type declared in the following XSD, using XmlBeans. My XSD: &lt;xs:schema targetNamespace="http://www.xxx.com/xmlns/osb/WS2CICS/program/PROG1/p1" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns="http://www.xxx.com/xmlns/osb/WS2CICS/program/PROG1/p1" xmlns:ct="http://www.xxx.com/xmlns/osb/WS2CICS/common" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;!--xs:element name="Param" type="ParamType"/--&gt; &lt;xs:complexType name="ParamType"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Text" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; My XML: &lt;Param xsi:type="p1:ParamType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.xxx.com/xmlns/osb/WS2CICS/Envelope/v01" xmlns:p1="http://www.xxx.com/xmlns/osb/WS2CICS/program/PROG1/p1"&gt; &lt;p1:Text&gt;abc&lt;/p1:Text&gt; &lt;/Param&gt; I essentially use the code from this site for XML validation using XmlBeans. But the validation fails with the message "Invalid type" for the element "Param". The validation succeeds only after uncommenting the "Param"-element declaration in the XSD and after changing the namespace of "Param" in the XML by adding the namespace prefix p1: to it - that is when validating against an element declaration, not a type declaration. What I need is: Use XmlBeans Tell somehow to XmlBeans that the element "{http://www.xxx.com/xmlns/osb/WS2CICS/Envelope/v01}Param" in the XML root is OK (no need to check). Tell XmlBeans that the root is of complex type "{http://www.xxx.com/xmlns/osb/WS2CICS/program/PROG1/p1}ParamType" (to check the children) How am I to do that? Background: I have a message envelope where the "Param" element is of type "anyType", i.e. it can have any content. In a particular situation I need to check that "Param" has a particular content given by a dynamically chosen XSD. I can easily check the validity of the envelope, but in the second step, I …
accepted answer: http://stackoverflow.com/a/21734277
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: xmlbeans
possible better answer: http://stackoverflow.com/a/21703912

sensors
type: Tag
tags question: http://stackoverflow.com/q/21692923
tag name: sensors

http://stackoverflow.com/a/21767302
downvote count: 0
answers question: http://stackoverflow.com/q/21767251
has comment: http://stackoverflow.com/comment/32929143
has body: If you call Collections.synchronizedCollection on a List, then you can't use the List methods on the returned Collection. In the other direction, you can't call Collections.synchronizedList on something that might be an arbitrary Collection, including a Set.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32929444
score: 1

http://stackoverflow.com/comment/33010242
has text: Also look Cascade is useful because it cascades the operation across the relationships. That way you can just call persist once an the whole chain will be persisted.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21794308

http://stackoverflow.com/a/21724958
upvote count: 2
has comment: http://stackoverflow.com/comment/138488434
has body: You must use BigInteger to store values that exceed the max value of long.
has comment: http://stackoverflow.com/comment/32853172
has comment: http://stackoverflow.com/comment/104342377
has comment: http://stackoverflow.com/comment/104341724
downvote count: 0
has comment: http://stackoverflow.com/comment/138488532
type: Answer
answers question: http://stackoverflow.com/q/21724945
score: 2

http://stackoverflow.com/q/21719220
score: 2
downvote count: 0
tagged with: loops
has comment: http://stackoverflow.com/comment/32843869
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21719879
tagged with: java
tagged with: class
upvote count: 2
answer count: 2
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21719897
has comment: http://stackoverflow.com/comment/32843979
favorite count: 0
tagged with: scope
has comment: http://stackoverflow.com/comment/32843602
possible better answer: http://stackoverflow.com/a/21719879
has title: Need help understanding scope of variables in Java
has answer: http://stackoverflow.com/a/21719897
has body: I'm doing a small program for school where it reads in a data file and outputs the results in the console. I'm having problems figuring out why my array of objects doesn't carry over after I finish a while loop. Here's the code: import java.io.*; import java.util.*; public class order{ private static Node nodes[]; public static void main(String[] args) throws FileNotFoundException { String dataFile = "file.dat"; indegreeCompute(dataFile); } private static void indegreeCompute(String dataFile) throws FileNotFoundException { Scanner scanFile = new Scanner(new File(dataFile)); nodes = new Node[scanFile.nextInt()]; while (scanFile.hasNextLine()) { scanFile.nextLine(); int index = scanFile.nextInt(); System.out.print("node = " + index); scanFile.next(); int NumOutDegree = scanFile.nextInt(); nodes[index].outDegree = NumOutDegree; System.out.print(" outDegree = " + nodes[index].outDegree); nodes[index].adjNodes = new int[NumOutDegree]; scanFile.next(); System.out.print(" adjNodes = ["); for ( int i = 0; i &lt; nodes[index].outDegree; i ++ ) { nodes[index].adjNodes[i] = scanFile.nextInt(); if (i &lt; nodes[index].outDegree - 1) System.out.print(nodes[index].adjNodes[i] + ", "); else System.out.print(nodes[index].adjNodes[i]); } System.out.print("]"); System.out.println(); } for (int i = 0; i &lt; nodes.length; i ++) { int outDegree = nodes[i].outDegree; for(int k = 0; k &lt; outDegree; k ++) { int adjNode = nodes[i].adjNodes[k]; nodes[adjNode].inDegree ++; } } scanFile.close(); } } The part I'm having issues with specifically is the last part with the for loop. I'm trying to use the information from the array I created in my while loop but when I debug, it's showing my node array with wrong values. The auxiliary class is just this: public class Node { public static int inDegree, outDegree, adjNodes[]; } Any help or explanation to help me understand would be greatly appreciated. Thanks! Here's the contents of the file: 14 //numNodes; space after '(' and before ')' to simpli…

http://stackoverflow.com/a/36878470
type: Answer
downvote count: 6
upvote count: 3
score: -3
has body: Default methods cannot be accessed from within lambda expressions. The following code does not compile: interface Formula { double calculate(int a); default double sqrt(int a) { return Math.sqrt(a); } } Formula formula = (a) -&gt; sqrt( a * 100); only work with functional interface(single abstract method only +any number of default methods) so lambda expresion work with only abstract method
has comment: http://stackoverflow.com/comment/61323770
answers question: http://stackoverflow.com/q/21833537

http://stackoverflow.com/comment/32893120
type: Comment
comment on: http://stackoverflow.com/q/21747061
type: QuestionComment
has text: possible duplicate of [Account class not working propertly](http://stackoverflow.com/questions/21746201/account-class-not-working-propertly)
score: 0

http://stackoverflow.com/q/21797138
has comment: http://stackoverflow.com/comment/32981775
upvote count: 1
answer count: 1
downvote count: 7
has comment: http://stackoverflow.com/comment/32982081
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/32981909
has comment: http://stackoverflow.com/comment/32982000
type: AnsweredQuestion
has title: explain why java does not support the concept of executable file
has body: Problem: I can not understand the meaning of the question and another doubt which is generated from the above problem is that all the java software which i am using are come with executable setup so i am little bit confused from this. Thank You
type: Question
linked to: http://stackoverflow.com/q/5396778
accepted answer: http://stackoverflow.com/a/21797205
tagged with: java
has answer: http://stackoverflow.com/a/21797205

http://stackoverflow.com/comment/33086797
type: Comment
score: 0
type: AnswerComment
has text: Thanks! I missed that the fragments are tied to the activity. SettingsActivity does not hold the adapter. What do you mean when saying "have to re-create the fragments"? What if I move the fragments to the main activity XML? Won't it make things simpler - I'll be able to access their id by accessing the activity first - findViewById(R.id.<mainactivityid).getFragmentIdSomehow? Though not sure I can use FragmentManager in SettingsActivity...
comment on: http://stackoverflow.com/a/21841127

http://stackoverflow.com/q/21700056
has answer: http://stackoverflow.com/a/21700213
favorite count: 0
tagged with: android
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/21700213
possible better answer: http://stackoverflow.com/a/21700239
has comment: http://stackoverflow.com/comment/32808839
linked to: http://stackoverflow.com/q/2905542
has answer: http://stackoverflow.com/a/21700239
has title: How to show number of unread sms on mesege inbox icon
type: Question
linked to: http://stackoverflow.com/q/19086189
linked to: http://stackoverflow.com/q/20136483
tagged with: java
linked to: http://stackoverflow.com/q/20216806
has body: when sms is recieved a pop up is appeared on inbox icon which show number of unread sms,, how can i show that popup which indicate number of unread sms in inbox.... Is there a way to add a badge to an application icon in Android?
answer count: 2
score: 2
downvote count: 0

http://stackoverflow.com/a/21791625
type: Answer
has comment: http://stackoverflow.com/comment/33057995
answers question: http://stackoverflow.com/q/21768952
upvote count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32972877
has body: Having a peek at your github project, your execution looks a little like: --&gt; serve request --&gt; authenticate (blocking db call) --&gt; forward request &lt;-- receive response &lt;-- serve response Without a separate EventExecutorGroup all of your execution runs within the NioEventLoopGroup which is supposed to be used only for non-blocking actions. Each request served would decode, and then immediately block on the DB call, so your server is effectively rate-limited to the number of threads in the NioEventLoopGroup. You have added a DefaultEventExecutorGroup around the ChannelHandler which does the authentication, so now serving requests and authenticating are partly decoupled because each request will be decoded and then execution will be passed to the DEEG, leaving the NioEventLoopGroup to decode more requests. Except your bootstrap which connects to the DB is configured to use the same NioEventLoopGroup as the initial channel: b.group(inboundChannel.eventLoop()) Which means that you're still blocking your main netty worker threads with your blocking DB connection. I'm not sure what happens after that point, but perhaps your serving a bunch of requests (effectively queueing them all up waiting on the DEEG to be available) and then timing them out because they're all waiting on the blocking DB call (which is having it's ability to execute be starved because it's in contention with server decode stuff). i.e. (Assuming you have plenty of concurrent clients) [original, 2 thread NioEventLoopGroup, no EventExecutorGroup] nio-thread-1: serve-request 1 and authenticate (block) nio-thread-2: serve-request 2 and authenticate (block) (db calls completes) nio-thread-1: forward-request 1 (non-blocking) nio-thread-2: forward-request 2 (non-blocking) nio-thread-1: serve-request 3 and authenticate (block) nio-thread-2: serve-request 4 and authenticate (block) (db calls complete) nio-thread-1: forward-request 3 (non-blocking) nio-thread-2: forward-request 4 (non-blocking) ni…
has comment: http://stackoverflow.com/comment/33057208

http://stackoverflow.com/comment/32984210
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21798434
has text: If order of the elements does not matter then you may use a java.util.Set

http://stackoverflow.com/q/21687332
duplicate of: http://stackoverflow.com/q/8054703
linked to: http://stackoverflow.com/q/8054703
has title: Passing cmd line arguments to specific method
possible better answer: http://stackoverflow.com/a/21687668
type: AnsweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has body: In java, you can pass cmd line arguments to the main() method during program startup. I'd like to pass cmd line arguments to a specific method that I call from a script directly. I'd had no luck just entering them as I would for main(). Example: public class Test { public static void main(String[] args) { // args is cmd line input // do stuff with args } } You would do: ~]# java Test cmdlineinput I need to do: public class Test { public void someMethod(String input) { // do stuff with input } } I want to do: ~]# java Test.someMethod cmdlineinput Is this possible and how so?
tagged with: command-line-arguments
has answer: http://stackoverflow.com/a/21687668
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21687343
accepted answer: http://stackoverflow.com/a/21687343
favorite count: 0

http://stackoverflow.com/comment/32875765
comment on: http://stackoverflow.com/a/21735577
has text: I took out all my System.out.prints. They showed me that im in the if statement but nothing else
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21770342
type: Question
tagged with: jframe
has comment: http://stackoverflow.com/comment/32934597
answer count: 1
downvote count: 1
has title: Create Methods to Draw Rectangle and Circle in JFrame?
tagged with: java
has answer: http://stackoverflow.com/a/21770439
upvote count: 0
type: UnansweredQuestion
has body: I was assigned this problem without any teaching on how to do it and I can't figure it out on my own. I've started, but I can't figure out what methods to add. Below is the main method of a program which paints a circle and a square at the given coordinates. Your job is to write the rest of the code, BUT THE MAIN METHOD CANNOT BE ALTERED!!! You can add methods to the main driver class but you CANNOT add anything to the main method below. public static void main (String[] args){ JFrame picture = new JFrame("Circle and Square"); picture.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); picture.getContentPane().add(new Drawing(200, 50,100, 150)); picture.pack(); picture.setVisible(true); } The first two numbers are the height and width where the rectange should start and the second two numbers are the height and width where the circle should start. //The following is my failure attempt, so at least you know I tried to figure something out. import javax.swing.*; import java.awt.*; public class Drawing extends JFrame { int a, b, c, d; public Drawing(int x, int y, int z, int yeah) { setSize(400, 400); a = x; b = y; c = z; d = yeah; } public void paint(Graphics g) { super.paint(g); g.drawRect(a, b, c, d); g.drawOval(c, d, a, b); } public getContentPane() { } //Can't change following class: public static void main (String[] args) { JFrame picture = new JFrame("Circle and Square"); picture.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); picture.getContentPane().add(new Drawing(200, 50, 100, 150)); picture.pack(); picture.setVisible(true); } } I know I have to create something called a panel, but I don't even really understand how to do that. I'm sure I could reverse engineer any code anyone here shows me on how to solve my assignment. Thanks.
tagged with: user-interface
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/32934579
has comment: http://stackoverflow.com/comment/32934652

http://stackoverflow.com/comment/32886353
comment on: http://stackoverflow.com/a/21743285
score: 0
type: AnswerComment
type: Comment
has text: Thanks! This is it! Also thanks for specifying that || means OR!

http://stackoverflow.com/q/21765807
tagged with: listener
has answer: http://stackoverflow.com/a/21765972
has body: I have got a JMenu, to which I add items using a for loop. The items are displayed correctly, however, I've got no idea how to add any kind of Listener to the objects created. I don't need a listener on every single item added to JMenu, I just need a Listener on the JMenu, which returns "name" of the object i clicked on.. So if the JMenu contains an item "song", it should return String "song", when i click the item through the JMenu. My current code: JPopupMenu popup = new JPopupMenu(); remove = new JMenuItem("delete"); copyURL = new JMenuItem("copy url"); add = new JMenuItem("add"); edit = new JMenuItem("edit"); addto = new JMenu("add to"); popup.add(add); popup.add(edit); popup.add(addto); popup.add(copyURL); popup.add(remove); for(String x:model.getPlaylist()){ addto.add(x); } if(! gui.display.isRowSelected(row)){ gui.display.changeSelection(row, column, false, false); } popup.show(e.getComponent(),e.getX(),e.getY()); remove.addActionListener(this); copyURL.addActionListener(this); add.addActionListener(this); edit.addActionListener(this); addto.addActionListener(this); }}
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21765972
tagged with: jmenu
downvote count: 1
type: Question
score: -1
has title: Java add ActionListener to JMenu with looped items
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/21716102
has body: I'm trying to read through a data list of integers, find the most popular, least popular, and average and report the following... MOST POPULAR NUMBERS The following numbers were picked 263 times: 41 LEAST POPULAR NUMBERS The following numbers were picked 198 times: 20 AVERAGE The Average was 228.545455 times. The following numbers were picked 228 times: 5 22 The following numbers were picked 229 times: 2 7 12 40 My code... import java.util.*; import java.io.*; import java.util.Arrays; import java.util.Collections; public class Hmwk { public static void main(String[] args) throws FileNotFoundException { Scanner input=new Scanner (new File ("input.txt")); int counter = 0; ArrayList&lt;Integer&gt; numberList = new ArrayList&lt;Integer&gt;(45); while(input.hasNextInt()){ int in = input.nextInt(); numberList.add(in); counter++; } mostPopular(numberList,counter); leastPopular(numberList,counter); average(numberList,counter); } public static void mostPopular(ArrayList&lt;Integer&gt; list, int total){ Collections.sort(list); int popular = 0; int counter = 0; int counterTwo = 0; for (int i=0; i&lt;total-1; i++){ while(list.get(i) == list.get(i+1)){ counter++; i++; } if(counter &gt; counterTwo){ counterTwo = counter; popular = i; } } System.out.printf("MOST POPULAR NUMBERS"); System.out.printf("The following number was picked",counterTwo,"times:", popular); } public static void leastPopular(ArrayList&lt;Integer&gt; list, int total){ Collections.sort(list); int unpopular=0; int counter = 0; int counterTwo = 0; for (int i=0; i&lt;total-1; i++){ while(list.get(i) == list.get(i+1)){ counter++; i++; if(counter &lt; counterTwo){ counterTwo = counter; unpopular = i; } } } System.out.printf("LEAST POPULAR NUMBERS"); System.out.printf("The following number was picked",counterTwo,"times:", unpopular); } public static void average(ArrayList&lt;Integer&gt; list, int total){ int sum = 0; int counter = 0; ArrayList&lt;Integer&gt; average = new ArrayList&lt;Integer&gt;(45); for (int i=0; i&…
has answer: http://stackoverflow.com/a/21716143
tagged with: indexoutofboundsexception
tagged with: arraylist
score: 0
tagged with: while-loop
tagged with: for-loop
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21716155
tagged with: java
has answer: http://stackoverflow.com/a/21716180
type: Question
has title: Java: Index out of bounds while using ArrayList?

http://stackoverflow.com/a/26565581
has comment: http://stackoverflow.com/comment/41782645
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21683149
has body: I have been experiencing this issue when debugging using NetBeans, even executing the actual jar file. Antivirus would block sending email. You should temporarily disable your antivirus during debugging or exclude NetBeans and the actual jar file from being scanned. In my case, I'm using Avast. See this link on how to Exclude : How to Add File/Website Exception into avast! Antivirus 2014 It works for me.
upvote count: 1
type: Answer

http://stackoverflow.com/q/21821662
favorite count: 0
score: 0
has body: I am using j8583 library to build iso8583 message. I want to set DE96 element value as hexadecimals of binary data. As per my understanding, the value should be converted to binary and then to hexadecimal. Much like the BitMap value. I am not finding any way on achieving this using j8583 API. I have tried ISOType.BINARY type but that does not give the required value. Please see the following code package j8583.example; import java.io.IOException; import java.util.Date; import com.solab.iso8583.IsoMessage; import com.solab.iso8583.IsoType; import com.solab.iso8583.MessageFactory; import com.solab.iso8583.parse.ConfigParser; import com.solab.iso8583.util.HexCodec; public class MsgSender0800 { public static void main(String[] args) { try { MessageFactory mfact = ConfigParser.createFromClasspathConfig("j8583/example/config.xml"); IsoMessage msg = mfact.newMessage(0x800); msg.setValue(7, new Date(), IsoType.DATE10, 10); msg.setValue(96, "123456", IsoType.BINARY, 6); /* I want DE 96 value similar to the output of this code String test = "123456"; String encoded = HexCodec.hexEncode(test.getBytes(), 0, test.length()); System.out.println(encoded); System.out.println(new String(HexCodec.hexDecode(encoded))); */ String strMsg = new String(msg.writeData()); System.out.println(strMsg); } catch (IOException e) { e.printStackTrace(); } } } The above code prints the following iso message 08008200000000000800040000010000000002190926080000000000000000000123456000000 Please see the last 12 bytes, produced by msg.setValue(96, "123456", IsoType.BINARY, 6);, instead of above message I want to build the following message 08008200000000000800040000010000000002190926080000000000000000000313233343536 The last 6 bytes are hex encoded value. The ISO.BINAY also appending additional '0' i.e. with msg.setValue(96, "123456", IsoType.BINARY, 6);, it produces 123456000000 instead of 123456 I am wondering if anyone has done it using this API. Otherwise I have to add some sort of wrapper on it to add…
accepted answer: http://stackoverflow.com/a/22210289
tagged with: iso8583
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/33106951
type: AnsweredQuestion
has title: j8583 library - how to convert value into hex
has comment: http://stackoverflow.com/comment/33106526
tagged with: java
has comment: http://stackoverflow.com/comment/33449055
type: Question
has answer: http://stackoverflow.com/a/22210289
answer count: 1

http://stackoverflow.com/comment/33102386
score: 3
comment on: http://stackoverflow.com/a/21824485
type: AnswerComment
type: Comment
has text: Implementing duck-typing would involve a `Duck` class implementing `Avialae`, too?

http://stackoverflow.com/comment/32930372
score: 0
has text: This won't compile. The type of the value of the map is `Class<? extends InputType>` which isn't the same as `InputType`.
type: AnswerComment
comment on: http://stackoverflow.com/a/21767929
type: Comment

http://stackoverflow.com/comment/33005590
comment on: http://stackoverflow.com/a/21810369
has text: +1 and neither Integer or String is more specific than the other.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33043146
comment on: http://stackoverflow.com/q/21828799
type: Comment
type: QuestionComment
score: 2
has text: Further investigation that sure enough, there is a second Spring JAR. We are using WebLogic and there is a "repackaged" JAR loaded and hidden... so now I have to work around that.. or not use Autowire!

http://stackoverflow.com/comment/33050189
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21835635
has text: What about the StringIndexOutOfBoundsException?

http://stackoverflow.com/q/21749241
has answer: http://stackoverflow.com/a/21749291
tagged with: hex
has comment: http://stackoverflow.com/comment/32896682
has answer: http://stackoverflow.com/a/21749288
accepted answer: http://stackoverflow.com/a/21749291
has comment: http://stackoverflow.com/comment/32896653
has body: Hexadecimal goes from 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. I am confused as to where the 'x' in '0x0f' comes from. And if '0x0f' = '0000 1111' or '15' why not just write '0f'. Pretty sure this is universal across most languages, but if not, I'm using Java. Thank you.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21749288
linked to: http://stackoverflow.com/q/2670639
has title: Explain to me where the 'x' in hexadecimal '0xf0' comes from
upvote count: 5
tagged with: java
type: Question
answer count: 2
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/71768779
favorite count: 0
duplicate of: http://stackoverflow.com/q/2670639

http://stackoverflow.com/q/21815862
score: 0
has title: Compile error: Cannot find symbol - makeFrame();
has answer: http://stackoverflow.com/a/21815890
accepted answer: http://stackoverflow.com/a/21815890
tagged with: compiler-errors
tagged with: swing
possible better answer: http://stackoverflow.com/a/21815966
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21815966
tagged with: java
type: Question
tagged with: bluej
has body: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Spel { private JFrame frame; public Spel() { makeFrame(); } } Here's my code. Im new to Java programming, and im trying to make a simple game. But i get this error when compiling, why is that? EDIT: Solved this, thanks. Added new code: private void makeFrame() { frame = new JFrame("Spel"); Container contentPane = frame.getContentPane(); JLabel label = new JLabel("titel"); contentPane.add(label); frame.pack(); frame.setVisible(true); }
answer count: 2

http://stackoverflow.com/comment/39331547
has text: Great! We are going to test this solution soon and accept your answer if it works! :)
type: Comment
comment on: http://stackoverflow.com/a/25172468
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33060010
has text: Thats work. I'm still quite new with this and cleary don't understand how it exactly work, but it work. Will spend some time to learn more, but I have a little no time now, so MANY THANKS for help! :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21840935

http://stackoverflow.com/q/21686123
has answer: http://stackoverflow.com/a/21686188
has body: I Can't use findViewById() from my Kclass=( How can i use it? ` private class BackGroundTask extends AsyncTask&lt;Void, Void, Void&gt;{ @Override protected Void doInBackground(Void... params) { try { //execute - means sending response =httpClient.execute(request); HttpEntity entity=response.getEntity(); String str=EntityUtils.toString(entity); Log.v("Json=", str); //adding new response to our Response Class resp.addNewResponse(str); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { Log.e(TAG, "Exception caught: ", e); } return null; } protected void onPostExecute(Void result) { super.onPostExecute(result); httpClient.getConnectionManager().shutdown(); TextView textView = (TextView) findViewById(R.id.textView1); textView.setText("Done"); } } } please write an exact code. This class is in another .java file. Not in MainActivity.java
answer count: 3
tagged with: android
has title: I Can't use my findViewById from AsyncClass
has answer: http://stackoverflow.com/a/21686202
tagged with: textview
favorite count: 0
has comment: http://stackoverflow.com/comment/32784166
tagged with: android-asynctask
type: UnansweredQuestion
downvote count: 2
linked to: http://stackoverflow.com/q/18517400
has comment: http://stackoverflow.com/comment/32784264
tagged with: java
has answer: http://stackoverflow.com/a/21686187
type: Question
has comment: http://stackoverflow.com/comment/32784219
tagged with: findviewbyid
upvote count: 0
score: -2

http://stackoverflow.com/q/21697537
has comment: http://stackoverflow.com/comment/32806442
tagged with: eclipse
type: Question
has body: I was using the Service Builder in Liferay 6.2 CE but when I closed my project and opened it again, it was all messed up. I can run my project without a problem but I can't make changes to the Service Builder anymore... When I open the service.xml file I get the following message: I updated Eclipse and Sapphire but still the same. Software Versions: Eclipse: Kepler Service Release 1 Liferay IDE: 2.0.0.201312200205-ga1 Sapphire: 0.7.0 EDIT The contents of service.xml: <?xml version="1.0" encoding="UTF-8"?> fvoordeckers Event
has title: Liferay Service Builder Error
tagged with: liferay
has comment: http://stackoverflow.com/comment/32805619
answer count: 1
has comment: http://stackoverflow.com/comment/32807299
has comment: http://stackoverflow.com/comment/32808131
has answer: http://stackoverflow.com/a/22944790
has comment: http://stackoverflow.com/comment/32813496
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34515301
has comment: http://stackoverflow.com/comment/32813589
tagged with: liferay-6
has comment: http://stackoverflow.com/comment/32808880
has comment: http://stackoverflow.com/comment/32812057
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32805702

http://stackoverflow.com/comment/33028712
has text: When a programmer compares string's with == , SO cries.
comment on: http://stackoverflow.com/q/21823479
type: Comment
type: QuestionComment
score: 6

http://stackoverflow.com/comment/32960360
type: AnswerComment
type: Comment
has text: Youcan make the war target 'dependsOn' the compile target, or you can create an 'all' target to like follows <target name="all" dependsOn="clean,init,compile,war"/> - haven't syntax checked this - but that is the idea - all in one - then you can change the "dfault" value at the top to all, then you just run -> "ant" - assuming your build file is named build.xml
comment on: http://stackoverflow.com/a/21770806
score: 0

http://stackoverflow.com/comment/32836019
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21714486
has text: Still isn't responding after I put "addKeyListener(p1)" in start after I create a new MainCharacter. Should I be adding the listener to the Applet or the Frame and would that make a difference?
type: AnswerComment

http://stackoverflow.com/q/21737244
has comment: http://stackoverflow.com/comment/32875239
linked to: http://stackoverflow.com/q/21733963
tagged with: java
has comment: http://stackoverflow.com/comment/32875181
type: Question
has answer: http://stackoverflow.com/a/21737273
has comment: http://stackoverflow.com/comment/32875478
has comment: http://stackoverflow.com/comment/32875591
has comment: http://stackoverflow.com/comment/32875602
answer count: 2
has body: Getting a very strange error. When I add { while { System.out.println( "Enter homework grades, Enter -1 when done" ); homeworkGrades += input.nextInt(); } } I get about 19 errors. If i remove it, then no errors. I've spent quite a few minutes changing it up, but I can't seem to get it to work. The program simply asks if you want to Average grades or Quit, then asks for your name. Now I want it to allow a user to enter in the Homework grades to average, then it will ask for quiz grades to average, then lastly test grades. Then it will take those 3 averages and average those. import java.util.Scanner; public class Assignment3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int homeworkGrades; int quizGrades; int testGrades; int choice; int total; double average; String name; total = 0; System.out.println("Enter 1 or 2: \n 1 - Average grades \n 2 - Quit"); choice = input.nextInt(); if (choice == 1) { System.out.println("Enter the students name"); name = input.next(); System.out.println("Grades will be entered in this order: \n 1) Homework Grades \n 2) Quiz Grades \n 3) Test Grades "); //here { while { System.out.println( "Enter homework grades, Enter -1 when done" ); homeworkGrades += input.nextInt(); } } } if (choice == 2) { System.out.println("Exiting program"); } else { System.out.println("Invalid response, exiting program."); } } }
has answer: http://stackoverflow.com/a/21738057
has title: getting a bunch of compile errors
favorite count: 0
has comment: http://stackoverflow.com/comment/32875404
has comment: http://stackoverflow.com/comment/32875664
type: UnansweredQuestion
downvote count: 8
score: -8
has comment: http://stackoverflow.com/comment/32875710
upvote count: 0

jsp
tags question: http://stackoverflow.com/q/21791498
tags question: http://stackoverflow.com/q/21797157
tags question: http://stackoverflow.com/q/21780053
tags question: http://stackoverflow.com/q/21747533
tags question: http://stackoverflow.com/q/21782789
tags question: http://stackoverflow.com/q/21710363
tags question: http://stackoverflow.com/q/21723938
tags question: http://stackoverflow.com/q/21722372
tags question: http://stackoverflow.com/q/21746513
tags question: http://stackoverflow.com/q/21693650
tags question: http://stackoverflow.com/q/21720478
tags question: http://stackoverflow.com/q/21688684
tags question: http://stackoverflow.com/q/21831245
tags question: http://stackoverflow.com/q/21778163
tags question: http://stackoverflow.com/q/21810187
tags question: http://stackoverflow.com/q/21764353
tags question: http://stackoverflow.com/q/21684988
tags question: http://stackoverflow.com/q/21787750
tags question: http://stackoverflow.com/q/21792096
tags question: http://stackoverflow.com/q/21798107
tags question: http://stackoverflow.com/q/21694299
tags question: http://stackoverflow.com/q/21777884
tags question: http://stackoverflow.com/q/21724688
tags question: http://stackoverflow.com/q/21813005
tags question: http://stackoverflow.com/q/21702819
tags question: http://stackoverflow.com/q/21774883
tags question: http://stackoverflow.com/q/21779241
tags question: http://stackoverflow.com/q/21779007
tags question: http://stackoverflow.com/q/21801246
tags question: http://stackoverflow.com/q/21827474
tags question: http://stackoverflow.com/q/21822219
type: Tag
tags question: http://stackoverflow.com/q/21831118
tags question: http://stackoverflow.com/q/21780777
tags question: http://stackoverflow.com/q/21796549
tags question: http://stackoverflow.com/q/21800518
tags question: http://stackoverflow.com/q/21686063
tags question: http://stackoverflow.com/q/21697348
tags question: http://stackoverflow.com/q/21785439
tags question: http://stackoverflow.com/q/21720397
tags question: http://stackoverflow.com/q/21837961
tags question: http://stackoverflow.com/q/21760135
tags question: http://stackoverflow.com/q/21718025
tags question: http://stackoverflow.com/q/21762650
tags question: http://stackoverflow.com/q/21787047
tags question: http://stackoverflow.com/q/21699730
tags question: http://stackoverflow.com/q/21735430
tags question: http://stackoverflow.com/q/21763225
tags question: http://stackoverflow.com/q/21826046
tags question: http://stackoverflow.com/q/21797526
tag name: jsp
tags question: http://stackoverflow.com/q/21694154
tags question: http://stackoverflow.com/q/21720952
tags question: http://stackoverflow.com/q/21796512
tags question: http://stackoverflow.com/q/21800380
tags question: http://stackoverflow.com/q/21773527
tags question: http://stackoverflow.com/q/21707723
tags question: http://stackoverflow.com/q/21806126
tags question: http://stackoverflow.com/q/21708937
tags question: http://stackoverflow.com/q/21833182
tags question: http://stackoverflow.com/q/21786747
tags question: http://stackoverflow.com/q/21825917
tags question: http://stackoverflow.com/q/21820701
tags question: http://stackoverflow.com/q/21733072
tags question: http://stackoverflow.com/q/21683021
tags question: http://stackoverflow.com/q/21746094
tags question: http://stackoverflow.com/q/21745194
tags question: http://stackoverflow.com/q/21812352
tags question: http://stackoverflow.com/q/21702227
tags question: http://stackoverflow.com/q/21807691
tags question: http://stackoverflow.com/q/21694457
tags question: http://stackoverflow.com/q/21683212
tags question: http://stackoverflow.com/q/21695963
tags question: http://stackoverflow.com/q/21714513
tags question: http://stackoverflow.com/q/21759969
tags question: http://stackoverflow.com/q/21741433
tags question: http://stackoverflow.com/q/21821617
tags question: http://stackoverflow.com/q/21773492
tags question: http://stackoverflow.com/q/21746131
tags question: http://stackoverflow.com/q/21752305

http://stackoverflow.com/q/21741601
has comment: http://stackoverflow.com/comment/32883457
answer count: 3
tagged with: types
downvote count: 0
has comment: http://stackoverflow.com/comment/32883511
tagged with: polymorphism
tagged with: generics
favorite count: 0
has body: I'm learning that it is generally better to make the declared type as general as possible, but I'm not sure why. For example, in most cases, this... List&lt;String&gt; myList = new ArrayList&lt;String&gt;(); is considered better than this: ArrayList&lt;String&gt; myList = new ArrayList&lt;String&gt;(); One of the reasons given for this preference is quoted below( Java - declaring from Interface type instead of Class) Yes, you are correct. You should declare as the most general type providing the methods you >use.This is the concept of polymorphism. However, polymorphism usually increases the amount of methods available to you because you can also access the methods of your super-types. But, in the case of declaring with interface types you actually restrict the number of methods available to you because you can only access methods in the interface, and you cannot access those just belonging to the class type. So is this really Polymorphism? and why is it considered "more general" when it seems more restrictive, if anything, to me? What am I missing?
has answer: http://stackoverflow.com/a/21741971
has answer: http://stackoverflow.com/a/21741685
linked to: http://stackoverflow.com/q/3383726
has answer: http://stackoverflow.com/a/21741966
possible better answer: http://stackoverflow.com/a/21741971
accepted answer: http://stackoverflow.com/a/21741685
score: 1
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion
has title: Declaring from Interface type, instead of class type, doesn't seem Polymorphic or more general

http://stackoverflow.com/a/21758406
has comment: http://stackoverflow.com/comment/32917214
has comment: http://stackoverflow.com/comment/32914892
answers question: http://stackoverflow.com/q/21756675
score: 0
has comment: http://stackoverflow.com/comment/32946831
type: Answer
has body: What do you want to do? And we are going to change the implementations so that not the whole collection will be pulled in memory, but more like a resultset you will get chunks of the data.

http://stackoverflow.com/a/21781471
has comment: http://stackoverflow.com/comment/32956337
has comment: http://stackoverflow.com/comment/32957417
type: Answer
has comment: http://stackoverflow.com/comment/32953974
has comment: http://stackoverflow.com/comment/32956412
has body: In an XML document, if you add xmlns="http://a.b.c" to an Element, then that Element, and all it's descendant Elements, will be in the namespace "http://a.b.c", unless the descendant Elements happen to change the xmlns declaration. This means that, in an XML Document, the default namespace 'cascades' to the descendants. This process is a 'convenience' so that the XML is not as 'cluttered'. The 'default' namespace is the namespace that has no prefix. The Child Elements of a parent that sets the default Namespace to some value "http://a.b.c" are 'in' that namespace, even though they do not have an xmlns="http://a.b.c" declaration on their tag-line. When JDOM models a document like this, it sets the Namespace of each Element node to the exact valu it should be. It does not 'calculate', or 'cascade' the namespace of an Element. In JDOM, if you change the namespace of a parent Element, it does not change the namespaces of the child elements as well. So, for example, if you have: <child /> Then you have both root and child in the default Namespace "http://a.b.c". That document could be created, in JDOM, as: Namesapce ns = Namespace.get("http://a.b.c"); Element root = new Element("root", ns); Element child = new Element("child", ns); root.addConent(child); Note how ns was added to both Elements. The output of this JDOM would be, as expeced: <child /> Now, if you change the root's Namespace: Namesapce ns = Namespace.get("http://a.b.c"); Element root = new Element("root", ns); Element child = new Element("child", ns); root.addConent(child); root.setNamespace(Namespace.NO_NAMESPACE); you will get: <child xmlns="http://a.b.c"/> But, more interesting, if you leave the root namespace, and change the child namespace, Namesapce ns = Namespace.get("http://a.b.c"); Element root = new Element("root", ns); Element child = new Element("child", ns); root.addConent(child); child.setNamespace(Namespace.NO_NAMESPACE); you get: <child xmlns="" /> When you create a JDOM Element without a nam…
answers question: http://stackoverflow.com/q/21778987
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/32954067
has comment: http://stackoverflow.com/comment/32954159
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32957312
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21778987
has comment: http://stackoverflow.com/comment/32957507

http://stackoverflow.com/q/21767449
has title: Inheritance code returns no value
possible better answer: http://stackoverflow.com/a/21767565
type: Question
has answer: http://stackoverflow.com/a/21767565
has body: I created a super class called Employee, with a subclass called ProductionWorker and a driver called ProductionWorkerDriver. The program takes my entered info and returns the String values from the Employee class, but not the double and int values from the ProductionWorker class. The program I'm using said I had to initialize the values of those as 0, and I'm thinking that's why they show up as zero when compiled. However, the program won't compile without that, so I'm not sure what to do. public class Employee { private String name; private String employeeNumber; private String hireDate; public Employee(String n, String num, String date) { name = n; employeeNumber = num; hireDate = date; } public Employee() { name = ""; employeeNumber = ""; hireDate = ""; } public void setName(String n) { name = n; } public void setEmployeeNumber(String e) { employeeNumber = e; } public void setHireDate(String h) { hireDate = h; } public String getName() { return name; } public String getEmployeeNumber() { return employeeNumber; } public String getHireDate() { return hireDate; } public String toString() { String str = "Employee Name: " + name + "\nEmployee #: " + employeeNumber + "\nHire Date: " + hireDate; return str; } } //end of Employee class //beginning of ProductionWorker class import java.text.DecimalFormat; public class ProductionWorker extends Employee { private int shift; private double payRate; public int DAY_SHIFT = 1; public int NIGHT_SHIFT = 2; public ProductionWorker(String n, String num, String date, int sh, double rate) { super(n, num, date); shift = sh; payRate = rate; } public ProductionWorker() { } public void setShift(int s) { shift = s; } public void setPayRate(double p) { payRate = p; } public int getShift() { return shift; } public double getPayRate() { return payRate; } public String toString() { DecimalFormat dollar = new DecimalFormat("#,##0.00"); String str = super.toString() + "\nShift: " + shift + "\nPay Rate: $" + dollar.format(payRate); return str; }…
tagged with: inheritance
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21767583
accepted answer: http://stackoverflow.com/a/21767583
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32986037
has text: What you want cannot be done with MySQL. There is no option to connect direct to a file. While [MySQL uses files internally](http://stackoverflow.com/questions/484750/restoring-mysql-database-from-physical-files) you can't ["connect"](http://stackoverflow.com/questions/15232755/how-to-connect-with-mysql-database-file-sql-using-directory-path-like-ms-acc) to files. Your best beat would be [MySQL Connector/MXJ](http://dev.mysql.com/doc/connector-mxj/en/connector-mxj.html), but it was discontinued a long time ago.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21799384

http://stackoverflow.com/q/21747680
tagged with: jvm
score: 0
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32893809
has body: I'm trying to run clean install on a maven project of mine using JDK 1.6.0_45 on a machine running Ubunto 13.10, but it fails with the error: "Could not find artifact sun.plugin:plugin:jar:1.6 at specified path /usr/lib/jvm/jdk1.6.0_41/jre/lib/plugin.jar" For some reason it's is trying to find the plugin in the wrong version of JDK, it's looking in update 41 directory(/usr/lib/jvm/jdk1.6.0_41), which doesn't exist, instead of the update 45 directory. I've successfully ran clean install on another machine running Windows with jdk1.6.0_45 I've run a file search on my project but it didn't come up with any match for jdk1.6.0_41
tagged with: maven
has answer: http://stackoverflow.com/a/21747743
has title: Why is maven looking for an artifact in the lib directory other than the one I'm running it with?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32894012
answer count: 1
tagged with: ubuntu-13.10

http://stackoverflow.com/comment/32997468
has text: @ExcelledProducts - That probably >>is<< the entire code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21805331
score: 1

http://stackoverflow.com/a/21750550
score: 5
upvote count: 5
has body: Why don't you simply use N letter buckets (N=number of letters in alphabet) ? Just go along the string and increment the corresponding letter bucket. Time complexity O(n), space complexity O(N)
downvote count: 0
answers question: http://stackoverflow.com/q/21750365
type: Answer

http://stackoverflow.com/comment/32865178
type: Comment
comment on: http://stackoverflow.com/a/21729086
score: 0
type: AnswerComment
has text: I rechecked my code and it has many syntax errors, sorry. I am editting it now

http://stackoverflow.com/q/21817885
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33018935
possible better answer: http://stackoverflow.com/a/21817945
has comment: http://stackoverflow.com/comment/33018988
has title: Distinguishing between ArrayList#remove() methods
has answer: http://stackoverflow.com/a/21817943
accepted answer: http://stackoverflow.com/a/21817943
has answer: http://stackoverflow.com/a/21817945
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: indexing
has comment: http://stackoverflow.com/comment/33018994
has body: I have an ArrayList of integers, as such; ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;(); list.add(8); list.add(20); list.add(50); I also have a variable, that is set to a random item from that ArrayList. I want to remove the item in the variable from the arraylist, so I tried this; list.remove(var); However, it assumes that because var is an integer, it tries to get the index at the location of var instead of searching for and removing it. But because every item in the list is larger than the size of it, it always gives an ArrayOutOfBoundsException. Is there a way to force Java to attempt to use the proper remove method?
tagged with: indexoutofboundsexception
tagged with: arraylist

http://stackoverflow.com/comment/32931330
has text: `original[i]` is of type `double`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21768374

http://stackoverflow.com/comment/33002806
has text: @RohitJain Yes, you are right. That was the problem: missuse of current cache size instead of "capacity". Thank you!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21808736
score: 0

http://stackoverflow.com/q/21764943
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21765045
tagged with: list
tagged with: stack
type: Question
has answer: http://stackoverflow.com/a/21765241
tagged with: java
has comment: http://stackoverflow.com/comment/32924537
has answer: http://stackoverflow.com/a/21765021
has title: Java Array list stack
has answer: http://stackoverflow.com/a/21765042
score: 0
has body: This is the top portion of my ArrayListStack class. I am trying to make values become an array list of T of 10. I am getting an error "incompatible types required: ArrayListStack found:java.util.ArrayList". In the line values = new ArrayList(10)". How would i properly set this value thanks import java.util.ArrayList; public class ArrayListStack&lt;T&gt; implements StackInterface&lt;T&gt; { private ArrayListStack&lt;Integer&gt; values= new ArrayListStack&lt;Integer&gt;(); private int size; public ArrayListStack() { size = 0; values = new ArrayList&lt;T&gt;(10); }
tagged with: arrays
has answer: http://stackoverflow.com/a/21765010

http://stackoverflow.com/comment/33061461
has text: The `getClass().getClassLoader().getResource("res/Fonts/aesysmatt.ttf");` statement sets the path to the directory of the .class file. The actual setup here looks like this: `disparity/characterCreation/` In here is where my classes are located, and in the `disparity/characterCreation/res/Font` dir is where my `aesysmatt.ttf` is located. The program doesn't know to enter `res` without my telling, so that wouldn't work, thanks though.
comment on: http://stackoverflow.com/q/21841595
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32804858
score: 0
has text: Am I right that under Test class, i need to declare rand1 as int and rand2 as double?
comment on: http://stackoverflow.com/a/21697433
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21783881
score: 0
has comment: http://stackoverflow.com/comment/32958522
answer count: 1
tagged with: android-4.4-kitkat
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21784466
tagged with: android
has comment: http://stackoverflow.com/comment/32959016
has body: I have the following error when addTextChangedListener is added to onCreate Os Android 4.4 API19: Error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nes.android.emplacements/com.nes.android.emplacements.MainActivity}: java.lang.NullPointerException Caused by: java.lang.NullPointerException at com.nes.android.emplacements.MainActivity.onCreate(MainActivity.java:32) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.access$800(ActivityThread.java:135) Here's my code: 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(); } EditText valEmplacement = (EditText)findViewById(R.id.editText2); valEmplacement.addTextChangedListener(new TextWatcher(){ public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after){} public void onTextChanged(CharSequence s, int start, int before, int count){} }); } editText2 is in fragment_main and not in activiy_main activiy_main.xml : &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.nes.android.emplacements.MainActivity" tools:ignore="MergeRootFrame" /&gt; fragment_main.xml : &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_p…
has comment: http://stackoverflow.com/comment/32958492
has title: java.lang.NullPointerException when addTextChangedListener
type: Question
has comment: http://stackoverflow.com/comment/32959729
tagged with: java

windows
tags question: http://stackoverflow.com/q/21702634
tags question: http://stackoverflow.com/q/21753155
tags question: http://stackoverflow.com/q/21759369
tags question: http://stackoverflow.com/q/21821651
tags question: http://stackoverflow.com/q/21688814
tags question: http://stackoverflow.com/q/21804233
tags question: http://stackoverflow.com/q/21691967
tags question: http://stackoverflow.com/q/21801353
tags question: http://stackoverflow.com/q/21796238
type: Tag
tags question: http://stackoverflow.com/q/21786099
tags question: http://stackoverflow.com/q/21705205
tags question: http://stackoverflow.com/q/21768222
tag name: windows
tags question: http://stackoverflow.com/q/21713414

http://stackoverflow.com/q/21835101
type: Question
score: 0
has title: Does -XX: parallelGCThreads = 8 relates to the number of Cores in relation to Amdahl's law?
answer count: 1
tagged with: parallelism-amdahl
has answer: http://stackoverflow.com/a/21835435
has body: Intro: I am currently working on a piece of software where I benchmark a sequential program with a multithreaded one. My hardware has 24 cores available and 16GB of RAM. My program is written in Java but executed from MATLAB due to the need for plotting. Upon opening of MATLAB the following message is displayed: Picked up JAVA_TOOL:OPTIONS: -XX:parallelGCThreads = 8 - Xmx8g -Dsun.java2d.pmoffscreen = false Theory Now in accordance with Amdahl's Law the maksimum performance increase would be defined as 1/(B-(1-B)/P), where B is the sequential fraction and P is the number of processors. In my case I have that B = 0.01, (1-B = .99) and P = 24 This gives me a theoretical maximum performance increase of around 20. Now, as I understand parallelGCThreads it is the maximum number of Garbage Collector threads available. After doing some intensive testing on my program it appears that the maximum ratio increase I have been able to achieve was a factor of 7.5 which is no where near the theoretical of 20. However, If I substitute P = 8 I get a theoretical limit of 7.8 which is very close to the one obtained in my program. Question Does parallelGCThreads actually limit the amount of threads such that Amdahl's law should be used with P = 8 and not P = 24? Thanks in advance!
tagged with: matlab
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21835435
tagged with: java
tagged with: multithreading

http://stackoverflow.com/comment/32841655
has text: Give him the logic, let him write the code. Well done. 1+
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21717322
score: 0

http://stackoverflow.com/a/21715912
score: 1
upvote count: 1
downvote count: 0
type: Answer
has body: You have to import everything before all class declarations. So move import javax.swing.JOptionPane; up to the top with all of your other declarations. Or like @assylias pointed out just split up the two classes into different files. Oh, and the package import Java.text.DecimalFormat; does not exist, make that 'j' in 'Java' lowercase.
answers question: http://stackoverflow.com/q/21715832

http://stackoverflow.com/q/21686384
accepted answer: http://stackoverflow.com/a/21686431
tagged with: android
type: AnsweredQuestion
tagged with: java
has body: I have this code for showing a Menu: public boolean onCreateOptionsMenu(Menu menu) { this.menu = menu; MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.options_menu, menu); return true; } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.Email_settings: // startActivity(new Intent(this, About.class)); return true; case R.id.Help_settings: // startActivity(new Intent(this, Help.class)); return true; default: return super.onOptionsItemSelected(item); } } The code works fine when pressing the device options button. How can i open the menu on a button click from inside my screen and not the device options button?
type: Question
has answer: http://stackoverflow.com/a/21686431
has comment: http://stackoverflow.com/comment/32784606
possible better answer: http://stackoverflow.com/a/21686436
has answer: http://stackoverflow.com/a/21686436
score: 0
has title: Open Menu from a button click
answer count: 2
has comment: http://stackoverflow.com/comment/32784625

http://stackoverflow.com/comment/33010832
comment on: http://stackoverflow.com/q/21813069
type: Comment
type: QuestionComment
has text: @kent :see my edit :)
score: 0

compiler-errors
tags question: http://stackoverflow.com/q/21822750
tags question: http://stackoverflow.com/q/21805331
tag name: compiler-errors
tags question: http://stackoverflow.com/q/21692810
tags question: http://stackoverflow.com/q/21683723
tags question: http://stackoverflow.com/q/21753874
tags question: http://stackoverflow.com/q/21821474
tags question: http://stackoverflow.com/q/21712604
type: Tag
tags question: http://stackoverflow.com/q/21815862
tags question: http://stackoverflow.com/q/21720894
tags question: http://stackoverflow.com/q/21782964
tags question: http://stackoverflow.com/q/21764125
tags question: http://stackoverflow.com/q/21699574
tags question: http://stackoverflow.com/q/21727821
tags question: http://stackoverflow.com/q/21802299

http://stackoverflow.com/q/21813300
has title: How to set java swing component size to its enclosing parent size. ex: setting JLabel size to its enclosing JPanel size.
has body: How to set java swing component size to its enclosing parent size. ex: setting JLabel size to its enclosing JPanel size. Like android's Wrap_parent option.
possible better answer: http://stackoverflow.com/a/21813430
linked to: http://stackoverflow.com/q/21375255
answer count: 2
has answer: http://stackoverflow.com/a/21813430
accepted answer: http://stackoverflow.com/a/21813801
score: 3
tagged with: user-interface
downvote count: 0
favorite count: 0
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21813801
has comment: http://stackoverflow.com/comment/33012339
tagged with: swing
type: Question

http://stackoverflow.com/comment/33031905
score: 1
comment on: http://stackoverflow.com/q/21825252
type: Comment
type: QuestionComment
has text: Why do you need this?

http://stackoverflow.com/a/21707916
answers question: http://stackoverflow.com/q/21705261
score: 0
has body: if you are using Baseadapter then put this code before getview() @Override public int getItemViewType(int position) { return position; } @Override public int getViewTypeCount() { if (list.size() &gt; 1) { return list.size(); } else { return super.getViewTypeCount(); } }
type: Answer

http://stackoverflow.com/q/21817925
tagged with: java
has answer: http://stackoverflow.com/a/21818006
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/21817430
has title: highlight cells in grid - java swing
accepted answer: http://stackoverflow.com/a/21818006
answer count: 1
tagged with: paintcomponent
favorite count: 0
tagged with: repaint
has body: I need to highlight different cells of a grid. In each iteration of my algorithm, a co-ordinate (i,j) is obtained. I pass these values to the Grid to the current_x and current_y variables. How do I color the corresponding cell by calling the paintComponent() method of the TestPane class. public class Grid { int current_x; int current_y; public static void main(String[] args) { new Grid(); } public Grid() { 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 void getCurrentValues( int x, int y ){ this.current_x = x; this.current_y = y; } public class TestPane extends JPanel { // code to create grid using rectangles @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // more code } } } I am not clear as to how to pass the (i,j) values to the TestPane class and how to call the paintComponent.
upvote count: 1
tagged with: swing
tagged with: grid
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/41002775
score: 0
type: Comment
has text: if you run your jvm with the "-ea" param, you'll get exceptions from vaadin, if you access sth without (needed) a lock.
comment on: http://stackoverflow.com/a/25578867
type: AnswerComment

http://stackoverflow.com/comment/32792826
score: 1
comment on: http://stackoverflow.com/a/21690302
type: AnswerComment
type: Comment
has text: If that was the actual issue, then the compiler would say something like 'The method isMp3() from the type Classname is not visible' . When the compiler complains that the method is undefined for that type, that means there is no such method that exists inside the Class.

http://stackoverflow.com/q/21699052
upvote count: 3
tagged with: java
has body: So I've set up my Eclipse and the necessary libraries to get Tess4J working, however, it's giving me an error when I use the provided example code. The imagefile is right there in the root of the workspace and I even tried moving it around and even editing the method to point directly to the path. All to no avail. I'm a bit stumped, to be honest and was wondering if someone might have an idea where I need to be looking. import java.io.File; import net.sourceforge.tess4j.*; public class Main { public static void main(String[] args) { File imageFile = new File("eurotext.tif"); Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping // Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping try { String result = instance.doOCR(imageFile); System.out.println(result); } catch (TesseractException e) { System.err.println(e.getMessage()); } } } The error I'm getting is the following: Feb 11, 2014 11:05:13 AM net.sourceforge.tess4j.Tesseract doOCR SEVERE: Input not set! java.lang.IllegalStateException: Input not set! at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.getNumImages(TIFFImageReader.java:268) at net.sourceforge.vietocr.ImageIOHelper.getIIOImageList(Unknown Source) at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source) at Main.main(Main.java:12) java.lang.IllegalStateException: Input not set! Thanks in advance! EDIT: Quick update, as I've been trying to figure out a lot of stuff and trying out multiple things. First of all, I've figured out that the input not set is caused by a wrongly placed .dll file. However, now I've run into a new and much more difficult error. Here is the new code (I merely added a println to verify if it is able to read the file before it goes into the try-catch). import java.io.File; import net.sourceforge.tess4j.*; public class Main { public static void main(String[] args) { File imageFile = new File("C:\\Users\\Marouane Boutaib\\Java projects\\Tess4…
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/70301579
has comment: http://stackoverflow.com/comment/33029572
type: Question
accepted answer: http://stackoverflow.com/a/26896588
answer count: 2
tagged with: io
downvote count: 0
has comment: http://stackoverflow.com/comment/32837538
tagged with: ocr
favorite count: 0
has answer: http://stackoverflow.com/a/26896588
tagged with: tesseract
has answer: http://stackoverflow.com/a/70301579
type: AnsweredQuestion
score: 3
has title: Tess4J IllegalStateException: Input not set

http://stackoverflow.com/comment/32892973
type: AnswerComment
type: Comment
has text: @Opal yes you did, but both are two different classes.
score: 1
comment on: http://stackoverflow.com/a/21746689

http://stackoverflow.com/comment/33027364
comment on: http://stackoverflow.com/a/21821795
type: AnswerComment
score: 0
type: Comment
has text: It is the default value that will be selected when there is no key for `Intent`

http://stackoverflow.com/comment/32896221
type: Comment
comment on: http://stackoverflow.com/q/21748970
has text: I am a beginner in java.I am expected to not use functions.I have to do this only with the help of loop.Please help.
score: 0
type: QuestionComment

http://stackoverflow.com/a/21738603
has body: Here's how I ended up doing it. This is the build.gradle file for the config module: apply plugin: 'java' sourceSets { main { resources { srcDir 'props' } } } // this is to force Gradle to create the JAR used at // runtime with the correct folder structure jar.into('props') idea.module.iml.withXml { def node = it.asNode() // this is to force IntelliJ to create the folders // used at runtime with the correct folder ('package') structure node.component.content.sourceFolder.@packagePrefix="props" } It works like a charm because the config module only contains resources in the props folder. Whew.
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21711395
downvote count: 0
answers question: http://stackoverflow.com/q/21711395
score: 5
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/21739878
type: Answer
downvote count: 0
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21739412
has body: Better yet, don't create the stream yourself; let the StreamResult handle opening and closing: StreamResult sr = new StreamResult(new File(fileName));

http://stackoverflow.com/comment/32998196
has text: Why don't you just create a custom class and `Comparator` for that class instead?
type: QuestionComment
comment on: http://stackoverflow.com/q/21806158
type: Comment
score: 0

http://stackoverflow.com/comment/32974211
type: QuestionComment
comment on: http://stackoverflow.com/q/21791999
score: 0
type: Comment
has text: u can make space key to toggle auto fire. i mean once space key is pressed start auto fire n on other press stop the auto fire. for this u can go with schedule timer

http://stackoverflow.com/q/21686563
accepted answer: http://stackoverflow.com/a/21686821
has body: Here is my android code for post data to remote db, It doesn't work as I wish, well, it doesn't work at all. No errors, no actions. Help guys. I really don't know what is going on.. Any advice is welcome. final String suma = Float.valueOf(zam.getSuma()).toString();` ib_wyslij.setOnClickListener(new OnClickListener() {` @Override public void onClick(View v) { // TODO Auto-generated method stub new MyAsyncTask().execute(suma); } }); private class MyAsyncTask extends AsyncTask&lt;String, Void, Void&gt; { @Override protected Void doInBackground(String... params) { // TODO Auto-generated method stub postData(params[0]); return null; } protected void onPostExecute(Double result) { Toast.makeText(getApplicationContext(), "command sent", Toast.LENGTH_LONG).show(); } public void postData(String valueIWantToSend) { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.msinzynierka.cba.pl/executeConn.php"); try { // Add your data List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("Zam_suma", valueIWantToSend)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Here is my execution php script [logging &amp; connecting ] . . . . $Zam_suma = $_POST['Zam_suma']; mysql_query("INSERT INTO Zamowienie(Zam_suma) VALUES($Zam_suma)");
has comment: http://stackoverflow.com/comment/32786096
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/21686821
has comment: http://stackoverflow.com/comment/32785714
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/32954532
has comment: http://stackoverflow.com/comment/32785035
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32785098
tagged with: java
has comment: http://stackoverflow.com/comment/32785305
tagged with: mysql
has title: Ask with asynctask while posting to phpmyadmin
type: Question
has comment: http://stackoverflow.com/comment/32785691

http://stackoverflow.com/a/21827299
answers question: http://stackoverflow.com/q/21825336
type: Answer
has body: Before this question is answered the first thing to remember is that whenever you come across object is assigned to another object , you need to consider that reference is like remote control to the object. but in case object is assigned to another object , your reference(remote control) no longer controls your obj. lets go line by line to see whats happening: E obj1 = new E(); // the obj1 is created and holds reference to a memory location let's say 1a2s3d E obj2 = new E(); // the obj2 is created and holds reference to say 5g5g5g5 . List myList = new ArrayList&lt;E&gt;(); // empty list created acception elements of type E myList.add(obj1); //myList now points to reference 1a2s3d by addition of obj1 . obj1 = obj2 //obj1 and obj2 now point to same reference .. 5g5g5g5 and myList still points to reference 1a2s3d because it points to reference not obj1. So its value will not change. Also any new changes to elements of obj1 or obj2 like setting value of any field in obj1 of class E will change value of that field in obj2 also . thus the code is (obj1==obj2) ?? will return true.
score: 0

http://stackoverflow.com/q/21780320
tagged with: permutation
has comment: http://stackoverflow.com/comment/32953174
has comment: http://stackoverflow.com/comment/32952341
has answer: http://stackoverflow.com/a/21812693
favorite count: 0
has comment: http://stackoverflow.com/comment/33007024
has comment: http://stackoverflow.com/comment/32952294
has comment: http://stackoverflow.com/comment/32952231
has comment: http://stackoverflow.com/comment/32953039
has comment: http://stackoverflow.com/comment/32952446
has comment: http://stackoverflow.com/comment/33007992
has comment: http://stackoverflow.com/comment/32954111
has comment: http://stackoverflow.com/comment/32951679
has comment: http://stackoverflow.com/comment/32982443
upvote count: 2
has comment: http://stackoverflow.com/comment/33007832
score: 1
has comment: http://stackoverflow.com/comment/32983885
has comment: http://stackoverflow.com/comment/32952258
accepted answer: http://stackoverflow.com/a/21812693
possible better answer: http://stackoverflow.com/a/21781486
has comment: http://stackoverflow.com/comment/32956488
has comment: http://stackoverflow.com/comment/32953454
downvote count: 1
has comment: http://stackoverflow.com/comment/32952761
has title: Permute array elements maximizing the distance vector Java
has answer: http://stackoverflow.com/a/21781486
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/32953388
has comment: http://stackoverflow.com/comment/32952762
has comment: http://stackoverflow.com/comment/32952788
type: Question
has comment: http://stackoverflow.com/comment/32952115
tagged with: distance
answer count: 3
has body: Suppose v = [0, 1, 2, 3, 4] , I need to permute it so that the new indices of each element are as distant as possible. I mean, minimizing the variance in the distance vector and, at the same time, maxim. For example, being d the distance vector: Opt 1 -&gt; [0, 4, 1, 3, 2], d = [3, 2, 1, 0] -> NO OK! It isn't uniform. Opt 2 -&gt; [0, 1, 2, 3, 4], d = [0, 0, 0, 0] -> NO OK! It's uniform but not maxim. Opt 3 -&gt; [0, 2, 4, 1, 3], d = [1, 1, 2, 1] -> Maybe good option, I don't know if it's the best... There is some algorithm/procedure/idea to do that? I've to do it in Java, maybe exist some built method to do that, but I don't find it...
tagged with: arrays
has comment: http://stackoverflow.com/comment/33006900
has answer: http://stackoverflow.com/a/36864447

http://stackoverflow.com/comment/32864710
has text: `new String("February")` is nonsense. Just write `"February"`. There is no use for constructing a `String` by passing another `String`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21730928

http://stackoverflow.com/q/21833770
has body: Alfresco 4.2.e not working on osx mavericks + Java 7 I can't login into share. I got the following message: 'Your authentication details have not been recognized or Alfresco may not be available at this time.' 2014-02-17 20:40:41,593 ERROR [repo.admin.ConfigurationChecker] [localhost-startStop-1] CONTENT INTEGRITY ERROR: System content not found in content store. 2014-02-17 20:40:41,593 ERROR [repo.admin.ConfigurationChecker] [localhost-startStop-1] Ensure that the 'dir.root' property is pointing to the correct data location. 2014-02-17 20:40:41,597 ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed org.alfresco.error.AlfrescoRuntimeException: 01170001 Ensure that the 'dir.root' property is pointing to the correct data location. and 20:51:30,537 WARN [org.alfresco.wcm.client.util.impl.GuestSessionFactoryImpl] WQS unable to connect to repository: Not Found 20:51:44,578 WARN [org.alfresco.wcm.client.util.impl.GuestSessionFactoryImpl] WQS unable to connect to repository: Not Found 2014-02-17 20:51:45,030 ERROR [solr.tracker.CoreTracker] [SolrTrackerScheduler_Worker-2] Tracking failed org.alfresco.error.AlfrescoRuntimeException: 01170085 GetModelsDiff return status is 404 adding machine name into /etc/hosts do not fix the problem. Any idea on how to install alfresco on osx mavericks + Java 7 Thanks
tagged with: alfresco
tagged with: cmis
type: UnansweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33050159
has answer: http://stackoverflow.com/a/21840862
type: Question
has title: alfresco 4.2.e not working on osx mavericks + Java 7
answer count: 1
has comment: http://stackoverflow.com/comment/33079635

http://stackoverflow.com/a/21692358
has comment: http://stackoverflow.com/comment/32795758
has comment: http://stackoverflow.com/comment/32795873
has comment: http://stackoverflow.com/comment/32795912
has comment: http://stackoverflow.com/comment/32795831
has comment: http://stackoverflow.com/comment/32795748
score: 0
answers question: http://stackoverflow.com/q/21692282
has comment: http://stackoverflow.com/comment/32796118
type: Answer
has comment: http://stackoverflow.com/comment/32796157
has body: Your raise() method's return type is void, which means that it will not return anything at all. Change the return type to double, and simply typing return this.salary at the end should work fine. It should look like this: public double raise(double salary) { this.salary = salary + (salary * 0.1); return this.salary; } The this keyword references the instance of the object that you are using. Put it simply, you probably want to reference the classes salary variable, rather than the parameter passed in the method, otherwise it will reference the parameter passed in. And you also need call this.salary = salary; in your constructor, because the only way it was assigned before is if salary is below zero, but 4000 is not below zero.

http://stackoverflow.com/a/21784592
score: 1
answers question: http://stackoverflow.com/q/21783689
has body: I'm not proficient on SWIG but I have some knowledge on regex. Try this regex: %(regex:/SWIG_p_f_p_([A-Za-z\\d_]+)/PointerOn\\1/) Description SWIG_p_f_p_([A-Za-z\\d_]+) ^ ^ | | | | | | Generated prefix | | Character class allowing upper/lower cased letters, underscores, and digits inside class names.
has comment: http://stackoverflow.com/comment/32960622
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32875058
type: Comment
comment on: http://stackoverflow.com/a/21735072
type: AnswerComment
score: 0
has text: Sorry, getInputStream only returns the body of the request. The headers are before the body. You're right though, the container may render this futile (thus my comment about the request from Socket to HttpServletRequest in the original question).

http://stackoverflow.com/comment/32929244
has text: I have tried something similar myself using the Timer.scheduleAtFixedRate() but still cant seem to get it right ,if you could post something it would be a great help thank you,Maria
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21685781
type: Comment

http://stackoverflow.com/a/44579536
downvote count: 0
answers question: http://stackoverflow.com/q/21710756
type: Answer
has body: I prefer using a mathematical solution using the golden number. enjoy private static final double GOLDEN_NUMBER = 1.618d; public long fibonacci(int n) { double sqrt = Math.sqrt(5); double result = Math.pow(GOLDEN_NUMBER, n); result = result - Math.pow(1d - GOLDEN_NUMBER, n); result = Math.round(result / sqrt); return Double.valueOf(result).longValue(); }
score: 2
upvote count: 2

http://stackoverflow.com/q/21815162
has title: Set size and position to imageview in custom view in Android
accepted answer: http://stackoverflow.com/a/21815232
tagged with: android
tagged with: android-imageview
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21815232
tagged with: java
has comment: http://stackoverflow.com/comment/33014623
type: Question
tagged with: android-layout
has body: I got a custom class that extends View. I want to have a imageview in this class which should be the size of the View, so when I add the View to a layout it would show the imageview for the View. My problem is, that I can't change the size of the imageview. public class CustomView extends View{ ImageView imageView; public CustomView(Context context, float ivSize) { super(context); imageView = new ImageView(context); //change size of imageView here } What I tried: LinearLayout.LayoutParams imgvwDimens = new LinearLayout.LayoutParams((int)ivSize, (int)ivSize); imageView.setLayoutParams(imgvwDimens); -nothing android.view.ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); layoutParams.width = (int)ivSize; layoutParams.height = (int)ivSize; imageView.setLayoutParams(layoutParams); -nullpointer for layoutParams.width &amp; layoutParams.height imageView.setLayoutParams(new LayoutParams((int)ivSize, (int)ivSize)); -nothing imageView.requestLayout(); imageView.getLayoutParams().height = (int)ivSize; imageView.getLayoutParams().width = (int)ivSize; -nullpointer for .width &amp; .height I get that there might be no params yet because I don't use a imageview from xml, but that only explains case 2 and 4. I don't get why 1 and 3 do nothing and I don't know what else I could try. What am I missing? Edit: Solution Works now, I extended RelativeLayout instead of View, added the imageView in the constructor like this: this.addView(imageView); and implemented @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { imageView.layout(0, 0, ivSize, ivSize); } Thanks guys!
score: 0
answer count: 1

http://stackoverflow.com/comment/32979594
type: AnswerComment
type: Comment
has text: You should have mentioned that in the question ;)
score: 0
comment on: http://stackoverflow.com/a/21782640

http://stackoverflow.com/a/21840906
score: 1
upvote count: 1
has body: Consider this: new SortedLinkedSetNode().getValue().compareTo("some string"); This is essentially what's happening when you call SortedLinkedSetNode.add when you reach the else block and next is null. However, your default constructor leaves the node's value as null, so the above resolves to null.compareTo("some string"). You should either set value to something non-null (such as the empty string) in your default constructor, or check that the return value of getValue is non-null before performing operations on it. As a side note, if (this == null) will always evaluate to false. The program is not going to enter the method of a null object (it will throw a NullPointerException instead). You have several methods whose logic depends on this comparison, which will break, either logically (isEmpty will always return false, for example) or functionally. In several cases, if (this == null) is your termination condition for a recursive method, meaning you're going to hit more NullPointerExceptions once you get this one figured out. Try using if (this.next == null) as a termination condition for your recursive methods instead. For isEmpty, try using something such as return this.value == null &amp;&amp; (this.next == null || this.next.isEmpty())
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21840642

http://stackoverflow.com/q/21831723
has comment: http://stackoverflow.com/comment/33043623
has comment: http://stackoverflow.com/comment/33045058
has comment: http://stackoverflow.com/comment/33045225
has comment: http://stackoverflow.com/comment/33044403
has comment: http://stackoverflow.com/comment/33043104
has comment: http://stackoverflow.com/comment/33044593
tagged with: android-custom-view
has answer: http://stackoverflow.com/a/21832031
type: Question
has comment: http://stackoverflow.com/comment/33043167
tagged with: android-view
has title: setText() called from SubClass instance returns NULLPointerException
score: 0
answer count: 2
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/33045133
has comment: http://stackoverflow.com/comment/33044755
has comment: http://stackoverflow.com/comment/33044959
type: UnansweredQuestion
tagged with: android
has body: I am developing an android application which requires to set the default font family(typeface) of the TextView to Roboto, I extended the TextView and defined the typeface to be Roboto-Light.tff but the application crashes with a NullPointerException. Here is the Class: public class RobotoTextView extends TextView { public RobotoTextView(Context context, AttributeSet attrs) { super(context); // Eclipse edit mode doesn't show the font if (isInEditMode()) { return; } if(attrs != null) { TypedArray styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.RobotoTextView); String fontName = styledAttrs.getString(R.styleable.RobotoTextView_typeface); styledAttrs.recycle(); if (fontName != null) { Typeface typeface = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Light.ttf"); setTypeface(typeface); } } } } Here is my XML attrs.xml: &lt;resources&gt; &lt;declare-styleable name="RobotoTextView"&gt; &lt;attr name="typeface" format="string" /&gt; &lt;/declare-styleable&gt;&lt;/resources&gt; here is the code where at line 54 the exception is thrown, knowing that the parameter supplied is not null. and here is the error: here is the drawer_list_item.xml: &lt;ImageView android:id="@+id/icon" android:layout_width="25dp" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_marginLeft="12dp" android:layout_marginRight="12dp" android:contentDescription="@string/desc_list_item_icon" android:src="@drawable/ic_launcher" android:layout_centerVertical="true" /&gt; &lt;com.mhproductions.widget.RobotoTextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_toRightOf="@id/icon" android:minHeight="?android:attr/listPreferredItemHeightSmall" android:textAppearance="?android:attr/textAppearanceListItemSmall" android:textColor="@color/list_item_title" android:gravity="center_vertical" android:paddingRight="40dp" app:typeface="Roboto-Light"/&gt; &lt;com.mhproductions.widget.Robo…
has comment: http://stackoverflow.com/comment/33043324
has comment: http://stackoverflow.com/comment/33045270
has comment: http://stackoverflow.com/comment/33044894
has answer: http://stackoverflow.com/a/21831935
tagged with: java

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/21720024

http://stackoverflow.com/q/21701164
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32845927
tagged with: java
has comment: http://stackoverflow.com/comment/32810697
type: Question
answer count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32810542
has comment: http://stackoverflow.com/comment/32810786
has comment: http://stackoverflow.com/comment/32846164
has answer: http://stackoverflow.com/a/21721161
possible better answer: http://stackoverflow.com/a/26237079
favorite count: 0
has answer: http://stackoverflow.com/a/26237079
has title: RetrievalException in wordnet code
has comment: http://stackoverflow.com/comment/32820036
has comment: http://stackoverflow.com/comment/32811051
upvote count: 2
has comment: http://stackoverflow.com/comment/32817546
tagged with: jaws-wordnet
accepted answer: http://stackoverflow.com/a/21721161
tagged with: wordnet
has body: I executed this code: package edu.smu.tspell.wordnet; import java.util.Scanner; public class TestJAWS { /** * Main entry point. The command-line arguments are concatenated together * (separated by spaces) and used as the word form to look up. */ public static void main(String[] args) { Scanner scan = new Scanner(System.in); args = new String[] {"airplane"}; if (args.length &gt; 0) { // Concatenate the command-line arguments StringBuffer buffer = new StringBuffer(); for (int i = 0; i &lt; args.length; i++) { buffer.append((i &gt; 0 ? " " : "") + args[i]); } String wordForm = buffer.toString(); // Get the synsets containing the wrod form WordNetDatabase database = WordNetDatabase.getFileInstance(); Synset[] synsets = database.getSynsets(wordForm); // Display the word forms and definitions for synsets retrieved if (synsets.length &gt; 0) { System.out.println("The following synsets contain '" + wordForm + "' or a possible base form " + "of that text:"); for (int i = 0; i &lt; synsets.length; i++) { System.out.println(""); String[] wordForms = synsets[i].getWordForms(); for (int j = 0; j &lt; wordForms.length; j++) { System.out.print((j &gt; 0 ? ", " : "") + wordForms[j]); } System.out.println(": " + synsets[i].getDefinition()); } } else { System.err.println("No synsets exist that contain " + "the word form '" + wordForm + "'"); } } else { System.err.println("You must specify " + "a word form for which to retrieve synsets."); } } } but I'm getting this error: Exception in thread "main" edu.smu.tspell.wordnet.impl.file.RetrievalException: Error opening index file: .\C:\Users\piyush_p\Desktop\workspace\Wordnet\src\WordNet-3.0\dict\index.sense (The filename, directory name, or volume label syntax is incorrect) at edu.smu.tspell.wordnet.impl.file.SenseIndexReader.getInstance(SenseIndexReader.java:88) at edu.smu.tspell.wordnet.impl.file.WordFormLookup.loadSynsets(WordFormLookup.java:273) at edu.smu.tspell.wordnet.impl.file.WordFormLookup.getSynsets(WordFormLookup.java:230) at…

http://stackoverflow.com/comment/32824506
comment on: http://stackoverflow.com/a/21708518
has text: @Gene No problem. Happens to everyone :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32780488
type: AnswerComment
comment on: http://stackoverflow.com/a/21683836
score: 0
type: Comment
has text: right which is why im stuck because if i put int for quarter why do i get an error for highest when i already declared it a double? "Error: incompatible types required: double"

http://stackoverflow.com/q/21749958
has comment: http://stackoverflow.com/comment/32899227
score: 0
has comment: http://stackoverflow.com/comment/32898566
has body: I am trying to read a Jar file which contains few classes and has methods defined in it. I want to get all the declared methods from all the classes without loading individual classes. is it possible? Here's how I am loading jar file and method(Using class name as of now). File urlclasspath = new File(newJarPath); URL urlarray[] = new URL[1]; urlarray[0] = urlclasspath.toURI().toURL(); ClassLoader loader = new ClassLoader(urlarray); Class&lt;?&gt; myclass = loader .loadClass($classname$); Object obj = myclass.newInstance(); Method add = myclass.getMethod("add", new Class[] { Integer.TYPE, Integer.TYPE }); add.invoke(obj, new Object[] { new Integer(var1), new Integer(var2) }); if (obj == null) { System.out .println("FAIL: Could not create an instance of the loaded class"); } Thanks in advance
answer count: 1
has comment: http://stackoverflow.com/comment/57449295
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21750471
has title: How to load methods from a jar without loading class?
tagged with: reflection
has comment: http://stackoverflow.com/comment/32899209
linked to: http://stackoverflow.com/q/9508247
tagged with: urlclassloader
type: Question
tagged with: java

http://stackoverflow.com/a/21694371
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32823984
has comment: http://stackoverflow.com/comment/32831413
answers question: http://stackoverflow.com/q/21691977
upvote count: 1
has comment: http://stackoverflow.com/comment/32815577
has body: An usual approach is to use a load-balancer like apache behind the tomcat cluster and let it take care of SSL, this way you can horizontally scale as much as you like without worrying about key stores and certificates. Here are the docs for apache ssl config, and how to set it as a load balancer.
has comment: http://stackoverflow.com/comment/32832059

http://stackoverflow.com/a/21821123
answers question: http://stackoverflow.com/q/21821076
score: 0
has body: There are many other preferred methods of pinging a server, and it appears like isReachable() has some definite design flaws. This has been addressed here: Why does InetAddress.isReachable return false, when I can ping the IP address?
type: Answer

http://stackoverflow.com/comment/32888136
type: QuestionComment
comment on: http://stackoverflow.com/q/21744223
score: 0
has text: Thank you to whoever replied! :) Thank you
type: Comment

http://stackoverflow.com/q/21808754
tagged with: java
has comment: http://stackoverflow.com/comment/33004854
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33002647
has comment: http://stackoverflow.com/comment/33009314
linked to: http://stackoverflow.com/q/5854859
has body: I have a large text file with N number of lines. Now I have to read these lines in i iterations. Which means that I have to read n = Math.floor(N/i) lines in a single iteration. Now in each iteration I have to fill a string array of n length. So the basic question is that how should I read n lines in optimum time? The simplest way to do this is to use a BufferedReader and read one line at time with BufferedReader.readLine() but it will significantly decrease performance if n is too large. Is there a way to read exactly n lines at a time?
tagged with: optimization
score: 0
tagged with: file-io
has title: Reading N lines with optimization - Java
has comment: http://stackoverflow.com/comment/33002861
tagged with: readline
has answer: http://stackoverflow.com/a/21829443
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33002881
linked to: http://stackoverflow.com/q/13480183
has comment: http://stackoverflow.com/comment/33009903
has answer: http://stackoverflow.com/a/21810071

http://stackoverflow.com/comment/32976748
comment on: http://stackoverflow.com/q/21793960
has text: it doesn't update the JFrame means is the JFrame not displayed or the JFrame is displayed but JPanel is not displayed?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21755226
type: Answer
has body: Define some boolean field that you could set to true when your are tweaking the check states manually and false when you are not and expecting the user input instead. Now the listener can check the value of this field and ignore "software triggered checks" when the flag is true. The optimal location of the flag (method field, static field, etc) depends on the overall program design. Be sure your code always sets this flag back to false when you finish tweaking the check boxes manually, so not to stay in the permanently locked state. This is one of the cases when finally statement may be appropriate. If you only check the boxes programmatically on initialization, such cluttering may be avoided by setting the listeners only after the states are set.
answers question: http://stackoverflow.com/q/21754107
has comment: http://stackoverflow.com/comment/32907389
has comment: http://stackoverflow.com/comment/32908189
has comment: http://stackoverflow.com/comment/32907003
score: 0

http://stackoverflow.com/a/25758801
answers question: http://stackoverflow.com/q/21679708
downvote count: 0
score: 1
has body: It seems that LogFactory Class is missing, Please check your web-inf/lib folder and check if there org.apache.commons.looging.LogFactory class present or not, also check it in your build path. If not then download the required jar and add to your build path.
upvote count: 1
type: Answer

http://stackoverflow.com/q/21802904
tagged with: web-applications
possible better answer: http://stackoverflow.com/a/21802942
has answer: http://stackoverflow.com/a/21803689
tagged with: refresh
type: AnsweredQuestion
has body: I am making a web application that receives pictures from an android smartphone and then displayes them in a .jsp page. I need a mechanism to reload the .jsp page if there is new pictures in the server. Kinda like facebook where we dont need to refresh to see new content. Does facebook just refreshs from time to time or there is some mechanism that realizes there is new information to be displayed and notifies the page to refresh itself?
tagged with: java
tagged with: servlets
type: Question
has title: how to make a servlet refresh a jsp page if there is new information to be displayed?
answer count: 2
has answer: http://stackoverflow.com/a/21802942
score: 0
accepted answer: http://stackoverflow.com/a/21803689
tagged with: facebook

http://stackoverflow.com/comment/32870797
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21734627
score: 1
has text: If you are a student, it might be good to try and figure out what confused you about this, and ask your professor about it. This is a pretty elementary question; you should have a firm understanding of this behavior. Chances are that whatever confused you will come up in other forms in the future.

deserialization
type: Tag
tag name: deserialization
tags question: http://stackoverflow.com/q/21706415
tags question: http://stackoverflow.com/q/21767485

http://stackoverflow.com/comment/33069864
comment on: http://stackoverflow.com/a/21756501
has text: Ok, your setup looks good. It seems this is a bug of the library. You might want to try downloading the patched version from [here](https://code.google.com/p/simple-openni/issues/detail?id=73), and test if that works.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/110829254
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/60347493
type: Comment
has text: This worked to me. You must put the path without the "bin" folder.

http://stackoverflow.com/a/21794654
type: Answer
answers question: http://stackoverflow.com/q/21794614
score: 0
has body: You do not show the first string when the app launched. You can add display.setText(allquotes[0]); somewhere. Add checking if (counter &lt; allquotes.length) display.setText(allquotes[counter]);

http://stackoverflow.com/q/21800380
tagged with: intellij-idea
possible better answer: http://stackoverflow.com/a/21800404
tagged with: jsp
tagged with: servlets
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21815685
has title: Successfully deployed, however web:war exlpoded. Why? (Using IntelliJIDEA)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21815685
tagged with: java
has answer: http://stackoverflow.com/a/21800404
has body: I am getting in the application server window the following message: web:war exlpoded. However when hovering over it says "Artifact is deployed successfully." What does it mean "war exploded"? Thanks in advance.
type: Question

http://stackoverflow.com/a/21777541
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21777363
has body: I believe it to mean classes which inherit Reader or Writer. Such classes "wrap" byte streams so as to convert them automatically to character streams. Example: FileReader, FileWriter; they can read text from files directly. If no such classes exist for your particular stream needs but you know what you get out of it/put into it is text, then you must use these two wrapper classes. Classical example: HTML. It is text, but what you get from sockets is byte streams; if you want to read it as HTML, use a Reader (with the correct encoding!) over the socket stream (but of course, many APIs today don't require you to do that).
type: Answer

search-engine
type: Tag
tags question: http://stackoverflow.com/q/21753021
tag name: search-engine
tags question: http://stackoverflow.com/q/21796653

http://stackoverflow.com/q/21792030
has answer: http://stackoverflow.com/a/38200866
score: 27
upvote count: 27
downvote count: 0
answer count: 7
has title: Threadsafe vs Synchronized
has comment: http://stackoverflow.com/comment/32973308
linked to: http://stackoverflow.com/q/4201713
tagged with: synchronization
tagged with: synchronized
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/38204417
has answer: http://stackoverflow.com/a/47349532
linked to: http://stackoverflow.com/q/1085709
has answer: http://stackoverflow.com/a/46267598
has comment: http://stackoverflow.com/comment/32973282
has answer: http://stackoverflow.com/a/29257388
has comment: http://stackoverflow.com/comment/32973322
has comment: http://stackoverflow.com/comment/32973304
has comment: http://stackoverflow.com/comment/33026247
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32973329
has body: I'm new to java. I'm little bit confused between Threadsafe and synchronized. Thread safe means that a method or class instance can be used by multiple threads at the same time without any problems occurring. Where as Synchronized means only one thread can operate at single time. So how they are related to each other?
type: Question
has comment: http://stackoverflow.com/comment/32973478
has answer: http://stackoverflow.com/a/21792051
tagged with: java
has answer: http://stackoverflow.com/a/29256563
tagged with: thread-safety

http://stackoverflow.com/q/21814770
has answer: http://stackoverflow.com/a/21816303
accepted answer: http://stackoverflow.com/a/21816303
tagged with: class
score: 0
answer count: 1
has body: I'm creating a web-based scholar system for students to look up their scores, view their schedule, etc. However, I'm having a problem on architecting this system, as in I can't find a suitable way to associate the data. There's a student, which is in a (school) class. The student has a scoreboard. The (school) class has a list of the "assignments" the students had for each subject, but it only has informations such as name, maximum score, weight. The actual score sits on the student's scoreboard. Many students are in the same class. Only one instance of an assignment should exist at any time, and it should live in the SchoolClass object, because it's then applied to the whole class instead of per-student. A student, then, should only hold it's own score, and reference the rest of the assignment data from outside. How do i reference the specific homework from the student? That was kind of confusing. This is what I currently have: class Student extends Person { private SchoolClass schoolClass; private Scorecard scorecard; } class Subject { private String name; /// "Compilers II", "Data Structures", etc. } class SchoolClass { private Course course; // "Computer Science", "Administration", etc. private List&lt;Assignment&gt; assignments; class Assignment { private Subject subject; private int maxScore; private int weight; private String name; // "Test about material resistance II" } } class Scorecard { // How to reference each assignment from each subject in this student's class cleanly? } Is my design going on a good direction or should I just erase this and begin again? Thanks!
linked to: http://stackoverflow.com/q/21805879
tagged with: architecture
type: AnsweredQuestion
tagged with: oop
tagged with: java
tagged with: web-applications
has title: Design of a scholar system
type: Question

http://stackoverflow.com/a/21833390
score: 3
answers question: http://stackoverflow.com/q/21833352
has comment: http://stackoverflow.com/comment/33045974
downvote count: 0
upvote count: 3
has body: You should always start at index 0, it is the index of the first element of your array: for(int i=0; i&lt;b1; i++) { for(int j=0; j&lt;b2; j++) { for(int k=0; k&lt;b3; k++) { System.out.print("Enter element-&gt;"); threedarray[i][j][k]=sc.nextInt(); } } } for(int i=0; i&lt;b1; i++) { for(int j=0; j&lt;b2; j++) { for(int k=0; k&lt;b3; k++) { System.out.print(" "+threedarray[i][j][k]); } } } furthermore make the check with &lt; not &lt;= With the last loop you access the array element n+1 where n is the size of that array. Thats the reason for the exception.
type: Answer

http://stackoverflow.com/comment/32840362
has text: Can we see both of the methods too? And yes, you are correct, the `if-statement` will only run `doSomething()` if both methods return `true`. Which leads me to believe that the error is being thrown while running one of the methods.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21717309

http://stackoverflow.com/q/21704742
has answer: http://stackoverflow.com/a/21705002
tagged with: user-interface
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/32817048
has answer: http://stackoverflow.com/a/21704945
has comment: http://stackoverflow.com/comment/32817217
has title: Array in Gui to Increment
has body: Hi i have a trouble in my program because i need to set an array for easy way of incrementing it because it is sales so i declare of my array like this iam not yet done of my program this is my program so far . import java.awt.*; import java.awt.event.*; import javax.swing.*; public class We extends JFrame { public static JPanel panel2 = new JPanel(); public static String totallist,addprod; public static int grandtotal,ve,xxx,z,x,adding,pay,totalp,totalc,payment; public static JTextField in = new JTextField(z); public static JTextField ki = new JTextField(15); public static double disc,totalbayad,sukli; public static int benta[] = new int [11]; public static String prod[] = new String[11]; public static void main(String[] args) { We frameTabel = new We(); prod[1] = "Palmolive"; prod[2] = "Egg"; prod[3] = "Milo"; prod[4] = "Noodles"; prod[5] = "PancitCanton"; prod[6] = "CornBeef"; prod[7] = "LigoSardines"; prod[8] = "CokeSakto"; prod[9] = "RcBig"; prod[10] = "GibsonLespaulGuitar"; benta[1] = 6; benta[2] = 5; benta[3] = 6; benta[4] = 9; benta[5] = 10; benta[6] = 25; benta[7] = 16; benta[8] = 6; benta[9] = 16; benta[10] = 14000; } JFrame frame = new JFrame("Customer"); JFrame prodcho = new JFrame("Unofficial receipt"); JFrame want = new JFrame("Buy AGain"); JFrame ftinda = new JFrame("Item &amp;&amp; Prices"); JButton blogin = new JButton("Login"); JPanel panel = new JPanel(); JTextField txuser = new JTextField(15); JPasswordField pass = new JPasswordField(15); JLabel lab = new JLabel("Username :"); JLabel pas = new JLabel("Password :"); JLabel cos; //JPanel panel = new JPanel(); JButton y1; JButton y2; We() { super("Enter Your Account !"); setSize(300,200); setLocation(500,280); panel.setLayout (null); txuser.setBounds(90,30,150,20); pass.setBounds(90,65,150,20); blogin.setBounds(110,100,80,20); lab.setBounds(15,28,150,20); pas.setBounds(15,63,150,20); panel.add(lab); panel.add(pas); panel.add(blogin); panel.add(txuser); panel.add(pass); getContentPane().add(panel); s…
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21704945
tagged with: java
has comment: http://stackoverflow.com/comment/32817134
possible better answer: http://stackoverflow.com/a/21705002
answer count: 2

http://stackoverflow.com/comment/32850706
has text: Here is your error: `Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0` Have you tried fixing it or you ask for both finding it, and fixing it for you?
comment on: http://stackoverflow.com/q/21723639
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21811460
score: 2
has body: Your client sends the bytes of a line, and waits for a response, keeping the stream open. Your server waits for a line break (or the end of the stream, i.e. the connection being closed) before ReadLine returns. So both sides are waiting for the other. I would suggest that you use an OutputStreamWriter wrapped around the stream on the client side - then you can use WriteLine very simply (rather than messing around with the encoding yourself). When the server sees the line break, it will respond. I'd also use an InputStreamReader on the client rather than calling Convert.ToChar on each byte. Fundamentally, if you're only interested in transferring text and you're happy to use "a line" as the unit of messaging, using a writer/reader pair on both sides is the simplest approach.
has comment: http://stackoverflow.com/comment/33007749
answers question: http://stackoverflow.com/q/21811432
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21811432
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/21780900
has title: parsing numbersearch API in windows phone
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21781826
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: windows-phone-8
linked to: http://stackoverflow.com/q/7895105
type: Question
tagged with: c#
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/1732054
has body: I'm looking to train myself in JSON (request, response and parsing). I'm trying to develop a simple application, parsing the response into a list as seen in this app (never mind the language, just see the screenshots) However, JSON and parsing it looks like magic to me right now and I currently got no idea on how to use it. I've programmed a lot of c#, but markup languages and respones with tons of brackets, etc just confuses me. Here you can see code snippets from the place I'm trying to parse. I'm going to use this as a people search app. Really need to work on my parsing skills. I'm not asking you to do it for me, just point me to some easy tutorials and things like that. Java equivalent code snippet from the site showing me the API: package com.eniro.demo; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonProcessingException; import org.codehaus.jackson.map.ObjectMapper; public class EniroAPIExample { private static ObjectMapper objectMapper = new ObjectMapper (); public static void main(String[] args) throws JsonParseException, JsonProcessingException, IOException { URL eniroApiUrl = new URL("http://api.eniro.com/cs/search/basic?profile=[profile]&amp;key= [key]&amp;country=se" + "&amp;version=1.1.3&amp;search_word=pizza"); HttpURLConnection eniroApiConn = (HttpURLConnection) eniroApiUrl.openConnection(); if (eniroApiConn == null) { return; } int respCode = eniroApiConn.getResponseCode(); if (respCode != 200) { return; } BufferedReader in = new BufferedReader(new InputStreamReader(eniroApiConn.getInputStream(), "UTF-8")); StringBuilder strResult = new StringBuilder(); String inputLine; while ((inputLine = in.readLine()) != null) { strResult.append(inputLine); } in.close(); JsonNode json = objectMapper.readTree(objectMapper.getJsonFactory().createJso…
tagged with: parsing

http://stackoverflow.com/comment/32960332
score: 0
comment on: http://stackoverflow.com/q/21784884
type: Comment
type: QuestionComment
has text: I wonder what's the real problem you're facing. Creating a thread to just do a single `hash.put` is not really efficient. Explain the big picture to get a more accurate answer.

http://stackoverflow.com/a/21790774
has comment: http://stackoverflow.com/comment/32978320
has comment: http://stackoverflow.com/comment/34479597
has comment: http://stackoverflow.com/comment/32977680
answers question: http://stackoverflow.com/q/21790254
score: 0
type: Answer
has body: The problem is, you forgot to pass the GridBagConstraints when you added label_amount_paid and text_amount_paid label_amount_paid = new JLabel("Amount Paid: "); gbc = new GridBagConstraints(); //... data_panel.add(label_amount_paid); // Missing constraints text_amount_paid = new JTextField(20); text_amount_paid.setName("amount"); gbc = new GridBagConstraints(); //... data_panel.add(text_amount_paid); // Missing constraints Remember, by default, the x/y positions are 0 based. label_amount_paid = new JLabel("Amount Paid: "); gbc = new GridBagConstraints(); //... data_panel.add(label_amount_paid, gbc); text_amount_paid = new JTextField(20); text_amount_paid.setName("amount"); //... gbc = new GridBagConstraints(); data_panel.add(text_amount_paid, gbc); I'd also be very careful with gridWidth and gridHeight

http://stackoverflow.com/comment/32928716
type: Comment
type: QuestionComment
has text: yeah have not learned them yet though. (still a student).
score: 0
comment on: http://stackoverflow.com/q/21767100

http://stackoverflow.com/comment/32892202
type: QuestionComment
has text: `pm.get(124);` would do it if `pm` was an ArrayList. More: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#get(int)
score: 0
comment on: http://stackoverflow.com/q/21746649
type: Comment

http://stackoverflow.com/a/31820539
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21824304
has body: You could pass the Enum class as the parameter. void fun(Class&lt;? extends Enum&lt;?&gt;&gt; yourEnum) { // Do something here. Here's how you would get an array of the Enum values. yourEnum.getEnumConstants(); } You would pass Type1 in. fun(Type1.class);
downvote count: 0
type: Answer

http://stackoverflow.com/q/21836891
has comment: http://stackoverflow.com/comment/33052383
has answer: http://stackoverflow.com/a/21837242
possible better answer: http://stackoverflow.com/a/21836998
accepted answer: http://stackoverflow.com/a/21837152
tagged with: java
has answer: http://stackoverflow.com/a/21836998
has answer: http://stackoverflow.com/a/21837152
has title: I can't figure out my error in my PrimeGenerator
has body: In the output, I get a 9 where I should be getting an 11! This occurs after the fifth call to nextPrime(). Every other output is correct except for the 5th one! I have been struggling to determine my error for a few hours now. Sorry if my code is sloppy, this is the way my mind figured out the problem! It was a requirement to use the flag controlled loop. public class PrimeGenerator { private int num = 2; public PrimeGenerator() { } public int nextPrime() { boolean done = false; for (int n = num; !isPrime(num); n++) num = n; if (isPrime(num)) { done = true; } if (done) { int prime = num; num++; return prime; } return num; } public static boolean isPrime(int n) { boolean result = true; for (int i = 2; n % i == 0 &amp;&amp; i &lt; n; i++) result = false; if (n == 2) result = true; return result; } } My Tester just calls the nextPrime() method and prints the result.
type: Question
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/33052357
answer count: 3

http://stackoverflow.com/comment/35695628
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21770347
has text: @candy Have you checked the SQL Ebean generates? You should be able to do that adding `db.default.logStatements=true` and `logger.com.jolbox=DEBUG` to `application.conf`. Also check if adding `@Column(nullable=true)` to the field helps...
type: Comment

http://stackoverflow.com/comment/32998604
type: Comment
score: 0
has text: In that case, creating a new array each time would not be unreasonable in my opinion.
type: AnswerComment
comment on: http://stackoverflow.com/a/21806297

http://stackoverflow.com/comment/32891660
score: 0
type: Comment
type: QuestionComment
has text: I guess you are facing issue of thread synchronization. Your thread which creates zip file is spawn separately and your other code executes sequentially. I think, this causes your assert statement executed before zip is created completely. Try using wait or join to ensure that thread execution is complete and you have zip file created.
comment on: http://stackoverflow.com/q/21743974

struts2
tags question: http://stackoverflow.com/q/21829023
tags question: http://stackoverflow.com/q/21747885
tags question: http://stackoverflow.com/q/21702368
tags question: http://stackoverflow.com/q/21785264
tags question: http://stackoverflow.com/q/21779007
tags question: http://stackoverflow.com/q/21697348
tags question: http://stackoverflow.com/q/21680358
tags question: http://stackoverflow.com/q/21727045
tags question: http://stackoverflow.com/q/21826046
tag name: struts2
tags question: http://stackoverflow.com/q/21789972
tags question: http://stackoverflow.com/q/21806403
tags question: http://stackoverflow.com/q/21751503
tags question: http://stackoverflow.com/q/21728677
tags question: http://stackoverflow.com/q/21787821
tags question: http://stackoverflow.com/q/21739171
type: Tag
tags question: http://stackoverflow.com/q/21720478

http://stackoverflow.com/q/21690214
accepted answer: http://stackoverflow.com/a/21690258
score: 2
type: AnsweredQuestion
tagged with: netbeans
tagged with: java
tagged with: swing
type: Question
has title: Can I add to Combobox's model a different value than String?
has body: I've created a Java Application Project in Netbeans. This project has the main class JFrame form. There is, inter alia, Combo Box. I need to add a quadratic function to this Combobox. And I really don't want to use for squared anything like this ^2 . I've thought, that function might be represented by ,for example, .png file.(Like setting icon of buttons). Is it possible to add a picture to the model of Combo Box? Can be model of Combobox different than String? Or any idea, how to add a function to the Combo Box without ^ or _ ? I have this idea for few days, but I really don't know how to solve this.
has answer: http://stackoverflow.com/a/21690258
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
tagged with: combobox

http://stackoverflow.com/comment/33030313
comment on: http://stackoverflow.com/a/21821398
score: 0
type: Comment
type: AnswerComment
has text: Yogesh, I have a small problem again. I put a global variable for time(5th row). But that method do not get the value from that variable. How can I put a variable for the time in here?

http://stackoverflow.com/comment/32984472
type: AnswerComment
score: 0
has text: @user2250333 it is there in java7 as well as java6, java 5, etc
type: Comment
comment on: http://stackoverflow.com/a/21797937

http://stackoverflow.com/comment/33077886
has text: It's in the tab_bg_selector.xml where you can set the color of the selected tab. Or maybe I didn't understand what you are looking for, if it is so, my apologies.
comment on: http://stackoverflow.com/q/21756445
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21836004
type: AcceptedAnswer
score: 32
type: Answer
has comment: http://stackoverflow.com/comment/76658496
has body: Here is a variant of jaiwo99's answer in a more JPAesque form BooleanExpression exp = invoice.supplier.number.in(new JPASubQuery() .from(company) .where(company.active.isTrue()) .list(company.nu‌​mber)); Feel free to merge this into the original answer.
downvote count: 1
upvote count: 33
answers question: http://stackoverflow.com/q/21826773
accepted answer of: http://stackoverflow.com/q/21826773
has comment: http://stackoverflow.com/comment/72652287

http://stackoverflow.com/comment/33086852
type: AnswerComment
comment on: http://stackoverflow.com/a/21855968
score: 0
type: Comment
has text: I just used his example. First check his code then judge the answer.

http://stackoverflow.com/q/21723466
answer count: 2
has answer: http://stackoverflow.com/a/21748863
upvote count: 1
has title: OpenAm agent for tomcat can not read authservice url?
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/49107958
tagged with: single-sign-on
tagged with: openam
tagged with: opensso
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/49107958
accepted answer: http://stackoverflow.com/a/21748863
has body: amAuthContext:02/12/2014 04:58:20:946 下午 CST: Thread[main,5,main] ERROR: Failed to obtain auth service url from server: null://null:null I found it in "C:\tomcat_v6_agent\Agent_001\logs\debug" And I'm sure the url that can read and visit, Hers is the setting in OpenSSOAgentConfiguration.properties com.iplanet.am.server.protocol=http com.iplanet.am.server.host=gordon.demo.com com.iplanet.am.server.port=8080 It already setup in my dns config. Now I can't start my app tomcat , but openam was in another tomcat which is fine to work. Env is app tomcat in test.demo.com port 8086 openam tomcat in gordon.demo.com port 8080 And log in tomcat is like that org.apache.tomcat.util.digester.Digester startElement SEVERE: Begin event threw error java.lang.StackOverflowError at java.lang.String.indexOf(String.java:1698) at java.net.URLStreamHandler.parseURL(URLStreamHandler.java:272) at sun.net.www.protocol.file.Handler.parseURL(Handler.java:67) at java.net.URL.&lt;init&gt;(URL.java:614) at java.net.URL.&lt;init&gt;(URL.java:482) at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:1034) at sun.misc.URLClassPath$FileLoader.findResource(URLClassPath.java:1024) at sun.misc.URLClassPath.findResource(URLClassPath.java:172) at java.net.URLClassLoader$2.run(URLClassLoader.java:551) at java.net.URLClassLoader$2.run(URLClassLoader.java:549) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findResource(URLClassLoader.java:548) at java.lang.ClassLoader.getResource(ClassLoader.java:1138) at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:227) at javax.xml.parsers.SecuritySupport$4.run(SecuritySupport.java:94) at java.security.AccessController.doPrivileged(Native Method) at javax.xml.parsers.SecuritySupport.getResourceAsStream(SecuritySupport.java:87) at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:275) at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:247) at javax.xml.parsers.DocumentBui…

http://stackoverflow.com/q/21780001
favorite count: 0
has body: Is there any difference between the following? : Example 1: public class OddEven { private static void OddEven() { //some calculation. } public static void main(String[] args) { OddEven(); } } Example 2: public class OddEven { private static void main(String[] args) { OddEven(); } private static void OddEven() { //some calculation. } } The reason I ask is I would always go with example 2, putting Main first. Though most of the examples I've seen online put the methods first, before Main. I've never had formal computing lessons, and I apologise if this is an obvious question, but I'd like to know: Is the order of the layout simply aesthetics, or convention? Does it make any difference in processing efficiency and/or memory? If so, is that saving seen for all programming languages? Thanks for any help on this topic.
has comment: http://stackoverflow.com/comment/32951053
score: 6
tagged with: structure
upvote count: 6
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21780019
has comment: http://stackoverflow.com/comment/32953336
has comment: http://stackoverflow.com/comment/32950755
accepted answer: http://stackoverflow.com/a/21780051
has comment: http://stackoverflow.com/comment/32950993
tagged with: java
has comment: http://stackoverflow.com/comment/32953291
possible better answer: http://stackoverflow.com/a/21780019
type: Question
has answer: http://stackoverflow.com/a/21780043
tagged with: layout
has title: Does the order of a Java class matter?
has comment: http://stackoverflow.com/comment/32950895
has comment: http://stackoverflow.com/comment/32950916
has answer: http://stackoverflow.com/a/21780068
downvote count: 0
has answer: http://stackoverflow.com/a/21780051

http://stackoverflow.com/q/21820351
downvote count: 2
has title: Nest If Getting no output
has comment: http://stackoverflow.com/comment/33023650
has comment: http://stackoverflow.com/comment/33023680
has comment: http://stackoverflow.com/comment/33023821
tagged with: java
has comment: http://stackoverflow.com/comment/33023587
has comment: http://stackoverflow.com/comment/33024036
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33023561
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/33023693
has comment: http://stackoverflow.com/comment/33023886
has body: When compiled and run, i get no output what so ever. Trying to get the output recommended when the cost is less than 100 and has a rating of 4. if else print save your money System.out.print("Enter cost: "); double cost = input.nextDouble(); System.out.println("Enter a Star value between 1-4"); int rating = input.nextInt(); if (cost &lt; 100){ if (rating == 4 ) System.out.println("Recommended"); } else System.out.println("Save your money");
has answer: http://stackoverflow.com/a/21820548
has answer: http://stackoverflow.com/a/21820510
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21735767
score: 0
has comment: http://stackoverflow.com/comment/32874409
answer count: 1
has answer: http://stackoverflow.com/a/21750848
tagged with: java
accepted answer: http://stackoverflow.com/a/21750848
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/32895892
type: AnsweredQuestion
type: Question
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/32872780
has title: PDF page size with wider image
has body: I am processing PDF files with PDF Box and insert text objects according to the given coordinates on the pages. The coordinates I get are top-left based and I find the media box of the page, then calculate the position of the text. However there are some PDF images (they're scanned) which the text I inserted does not stand on the correct location, like the size of the page is much bigger than I get with media box. // getX-Y returns the coordinates that the text should be inserted // getSize returns the text height void write(PDDocument doc, PDPage page, PDPageContentStream cs) { PDRectangle rect = page.findMediaBox(); cs.moveTextPositionByAmount(this.getX(), height-this.getY()-getSize()); } The dimensions retreieved from media box are 595.2 x 841.92. For a given text location 300x420, I expect this text to be inserted in the middle of the page. However it is inserted way too down and left of the page. When I open the document with Acrobat Reader and copy the page as image (since it's scanned) I see that the image dimensions are 2480 x 3508. The location of the inserted text would make sense if the page dimensions were in that size. I feel like pdf page size is changed according to the content it has, but why don't I get those dimensions as the page size and still getting something like 595.2 x 841.92 instead? Should I process every image on the page and find the true dimensions? What am I missing here? Edit: Sample PDF Document Edit: This is the code part that I get PDPageContentStream: PDDocument doc = null; doc = PDDocument.load(inputFile); List &lt;?&gt; allPages = doc.getDocumentCatalog().getAllPages(); for (int i = 0; i &lt; list.size(); i++) { PDFObject obj = (PDFObject) list.get(i); for (int j = 0; j &lt; allPages.size(); j++) { PDPage page = (PDPage) allPages.get(j); PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true); obj.write(doc, page, contentStream); if ("F".equalsIgnoreCase(obj.getPageType())) { break; } } }

http://stackoverflow.com/comment/32797685
has text: [**Read this post**](http://christprogramming.wordpress.com/2014/01/30/java-common-mistakes-1/), it's a common mistake when using `nextInt()` before `nextLine()`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21693544
score: 1

http://stackoverflow.com/q/21834285
has body: I'm creating a simple layout with a TableLayout and TableRow, that contain two TextViews. This is a part of code. &lt;TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="0"&gt; &lt;TableRow android:id="@+id/myTableRow"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="15dip" android:text="Short description"/&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="15dip" android:text="Large description"/&gt; &lt;/TableRow&gt; The problem is that if there is long text in TextView1 then full text is not showing. How can I show full text in TextView1?
has answer: http://stackoverflow.com/a/21835411
accepted answer: http://stackoverflow.com/a/21835411
has answer: http://stackoverflow.com/a/21835529
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/33047851
has comment: http://stackoverflow.com/comment/33048756
tagged with: android
possible better answer: http://stackoverflow.com/a/21835529
has comment: http://stackoverflow.com/comment/33047750
has title: Textview that doesn't show full text
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/4851659
type: Question
has comment: http://stackoverflow.com/comment/33047908
answer count: 2
tagged with: tableview
upvote count: 3

http://stackoverflow.com/a/21804201
answers question: http://stackoverflow.com/q/21804180
score: 1
has body: int age=in.nextInt(); Is only consuming the "int" part. The String gender=in.nextLine(); Consumes the (empty) newline and moves on. You need to consume both before you prompt for Gender.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/33021372
type: QuestionComment
comment on: http://stackoverflow.com/q/21819064
has text: Do `request.getServletContext().getInitParameter("preptimeminutes");` work?
score: 0
type: Comment

http://stackoverflow.com/comment/32916924
type: AnswerComment
type: Comment
has text: I'm looking for more concrete answers with references. For example, I've made the same assumptions as you have for question 1. It looks for the dll in system32 folder during loading, but the working directory is correctly initialized (just don't know why it doesn't look there). For the second answer, _bstr_t to char* conversion is supposed to work as I described. Thanks for the other points though.
comment on: http://stackoverflow.com/a/21744616
score: 0

http://stackoverflow.com/a/24797495
has body: In my case it was because I didn't have the hibernate packagesToScan property. I see that you have it. May be this comment will be useful for someone who missed it.
downvote count: 0
upvote count: 5
answers question: http://stackoverflow.com/q/21796190
type: Answer
has comment: http://stackoverflow.com/comment/43741527
score: 5

http://stackoverflow.com/comment/32999868
comment on: http://stackoverflow.com/q/21806778
type: QuestionComment
has text: I added Logcat, but I don't know how to style it :(
score: 0
type: Comment

http://stackoverflow.com/comment/32867570
type: Comment
has text: only consider the digit now
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21733024

http://stackoverflow.com/q/21709716
downvote count: 0
has title: Changes in HTML not reflected as long as I am using proxy
tagged with: proxy
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
accepted answer: http://stackoverflow.com/a/22060475
upvote count: 7
tagged with: jdeveloper
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21998071
score: 7
tagged with: java
has body: I shifted from Eclipse to Jdeveloper. I had a weird problem that I was able to solve but not able to understand. Whenever I made any changes in HTML in Jdeveloper's web projects the changes were not reflected when I ran the HTML again. The old webpages kept coming in the webbrowser. Same source code. Same CSS/JS. I found that as long as there were proxy settings in my web browser the changes were not reflected. But if I switched off the proxy the changes made in HTML were reflected i.e webpage were displayed with the changes made from last time. By proxy set I mean proxy setting placed at the following Window -> Start Menu -> internet options -> Connections -> LAN Settings -> Proxy Server I have tried to run the resulting URL on Google chrome, Firefox and internet explorer. As long as the web browser was using proxy the changes made in HTML were not shown by running it again. In Eclipse Juno I simply had to clean Tomcat's directory to get changes reflected. Anyone can explain why this happens?
has answer: http://stackoverflow.com/a/21998071
tagged with: eclipse
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22060475

http://stackoverflow.com/comment/32783714
has text: I imported what the IDE suggested when I hovered `List`. Are you suggesting that's the problem???
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21685856

http://stackoverflow.com/a/21697369
answers question: http://stackoverflow.com/q/21697270
has body: This is the answer you are looking for a spalshActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); try { TimerTask timerTask = new TimerTask() { @Override public void run() { Intent i = new Intent(SplashScreen.this, MainActivity.class); startActivity(i); finish(); } }; Timer timer = new Timer(); timer.schedule(timerTask, 300);// DElay of 300 mil sec } catch (Exception e) { Log.e("ERROR in Splash Screen", e.toString()); } }
type: Answer
score: 0

http://stackoverflow.com/q/21727716
tagged with: java
upvote count: 2
has comment: http://stackoverflow.com/comment/32857910
tagged with: profiling
answer count: 1
favorite count: 0
tagged with: timer
has body: I want to skip a block of statements if it not complete in particular time interval . For example //block starts while(m3.find()) { // System.out.println(m3.group()); patit = m3.group().replace("(54)", " "); patit = patit.trim(); System.out.println("m3"); } while(m4.find() ) { // System.out.println(m4.group()); patno = m4.group().replace("Patent No.: ", " "); patno = patno.replace("Patent No: ", " "); patno = patno.replace("Patent", " "); patno = patno.replace("No.:", " "); patno = patno.replace("No:", " "); patno = patno.replace("Number: ", " "); patno = patno.replace("Number.: ", " "); patno = patno.trim(); System.out.println("m4"); } //block ends In the above block , if the block takes more than 20 secs to complete , then "continue;" statement have to be issued ( to skip a for loop, that not given here).. How to achive this ?
has title: How to set timeout for a block?
score: 2
has comment: http://stackoverflow.com/comment/32857582
downvote count: 0
has comment: http://stackoverflow.com/comment/32857529
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21728310

http://stackoverflow.com/a/21728571
has body: You can divide your filter (WHERE clause) to two: At first you get all data by date: CAST(b.new_SwWarrantyEndDate as date) BETWEEN dateadd(day,27,(CONVERT (date, SYSUTCDATETIME()))) AND dateadd(day,33,(CONVERT (date, SYSUTCDATETIME()))) And then by time CAST(b.new_SwWarrantyEndDate as time) BETWEEN '12:00:00' and '23:59:59'
answers question: http://stackoverflow.com/q/21728027
score: 0
type: Answer

http://stackoverflow.com/a/21821606
score: 0
has body: Because userChoice never changes inside the loop (which is because you don't change it).
type: Answer
answers question: http://stackoverflow.com/q/21821542

http://stackoverflow.com/a/21834292
type: Answer
upvote count: 11
score: 11
accepted answer of: http://stackoverflow.com/q/21802318
answers question: http://stackoverflow.com/q/21802318
type: AcceptedAnswer
downvote count: 0
has body: change your AddToDoActivity code like this public class AddToDoActivity extends Activity { // 7 days in milliseconds - 7 * 24 * 60 * 60 * 1000 private static final int SEVEN_DAYS = 604800000; private static final String TAG = "Lab-UserInterface"; private static String timeString; private static String dateString; private static TextView dateView; private static TextView timeView; private Date mDate; private RadioGroup mPriorityRadioGroup; private RadioGroup mStatusRadioGroup; private EditText mTitleText; private RadioButton mDefaultStatusButton; private RadioButton mDefaultPriorityButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_todo); mTitleText = (EditText) findViewById(R.id.title); mDefaultStatusButton = (RadioButton) findViewById(R.id.statusNotDone); mDefaultPriorityButton = (RadioButton) findViewById(R.id.medPriority); mPriorityRadioGroup = (RadioGroup) findViewById(R.id.priorityGroup); mStatusRadioGroup = (RadioGroup) findViewById(R.id.statusGroup); dateView = (TextView) findViewById(R.id.date); timeView = (TextView) findViewById(R.id.time); // Set the default date and time setDefaultDateTime(); // OnClickListener for the Date button, calls showDatePickerDialog() to show // the Date dialog final Button datePickerButton = (Button) findViewById(R.id.date_picker_button); datePickerButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showDatePickerDialog(); } }); // OnClickListener for the Time button, calls showTimePickerDialog() to show // the Time Dialog final Button timePickerButton = (Button) findViewById(R.id.time_picker_button); timePickerButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showTimePickerDialog(); } }); // OnClickListener for the Cancel Button, final Button cancelButton = (Button) findViewById(R.id.cancelButton); cancelButton.setOnClickListener(new OnClickListener() { @Override publi…

http://stackoverflow.com/a/21798012
downvote count: 0
has body: In your previous question, You were using a DefaultTableModel. Keep in mind, a TableModel is a data structure in itself. There is no need at to store the data in two data structures, i.e. your data[][] and the DefaultTableModel. The underlying structure of DefaultTableModel is a dynamic Vector of Vectors. What you can do is this. Just declare your DefaultTableModel with 0 rows, using this constructor public DefaultTableModel(Object[] columnNames, int rowCount) Then just add rows dynamically to the structure with public void addRow(Object[] rowData) - Adds a row to the end of the model. The new row will contain null values unless rowData is specified. Notification of the row being added will be generated. So basically, your declaration will be like this String[] colName = {"Member", "Book", "Issue Date", "Return Date ", "Remarks" }; DefaultTableModel model = new DefaultTableModel(colName, 0); JTable table = new JTable(model); Then just add rows like String member = "Stack"; String book = "overflow"; Data issueDate = date; .... Object[] row = { member, book, issueDate, returnDate, remarks }; DefaultTableModel model = (DefaultTableModel)table.getModel(); model.addRow(row); Please read the DefaultTableModel api documentation to see more constructors and methods available
answers question: http://stackoverflow.com/q/21797434
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21797434
type: Answer
score: 2

http://stackoverflow.com/comment/33113252
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21823315
has text: @newacct, I think this link can help http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206

http://stackoverflow.com/q/21763656
has title: How do I undo All of what i drew
type: Question
score: 0
answer count: 1
has body: So I want to clean my window after I draw on it my boxes and triangles and some other shapes. I need to click on a button and undo everything like they all should be gone from the window and everything is cleaned up. Here I did a box and when I click the Button box and click in the window a box show up where ever i click. I did the same for the triangle as i did for the boxes. This is the main program ( with only the boxes): import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Kaleidescope extends JFrame implements MouseListener, ActionListener, MouseMotionListener { Triangle L; Triangle[] triangles; int triangleCount; Box b; Box[] boxes; // 2-d array of Box objects, form a color pallet int boxCount; JButton boxButton; Oval O; Oval[] ovals; int ovalCount; Oval v; // Oval x, y int downX=0, downY=0, upX=0, upY=0; int x1, y1; // mousePressed int w1, z1; // mouseEntered int mode = 1; // 1 = line, 2= boxes, 3 = oval, 4= text, 5 = SG, twoLines = 7. JButton TriangleButton; JButton boxButton; boolean Boxe = false; // if true draw box JButton ovalButton; int x1, y1; // mousePressed int w1, z1; // mouseEntered public static void main(String[] args) { System.out.println("hi there."); new Kaleidescope(); setDefaultCloseOperation(EXIT_ON_CLOSE); addMouseListener(this); addMouseMotionListener(this); triangles = new Triangle[20]; triangleCount = 0; boxes = new Box[20]; boxCount = 0; ovals = new Oval[20]; ovalCount = 0; setLayout(new FlowLayout()); boxButton = new JButton("Boxes"); add(boxButton); boxButton.addActionListener(this); TriangleButton = new JButton("Triangles"); add(TriangleButton); TriangleButton.addActionListener( this); ovalButton = new JButton("Oval"); add(ovalButton); ovalButton.addActionListener( this); setSize(new Dimension(500, 500)); setVisible(true); } // returns a random color public Color randomColor() { int red = (int)(Math.random()*255); int green = (int)(Math.random()*255); int blue = (int)(Math.random()*255); return new Color(re…
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21763803
tagged with: swing

http://stackoverflow.com/q/21821209
has answer: http://stackoverflow.com/a/21821250
has body: public static void main(String[] args) { // TODO Auto-generated method stub String a="Apple-banana-pineapple"; StringTokenizer st = new StringTokenizer(a,"-"); String key = st.nextToken(); String val = st.nextToken(); System.out.println("key"+key); System.out.println("Values"+val); }
downvote count: 6
has comment: http://stackoverflow.com/comment/33024984
has answer: http://stackoverflow.com/a/21821251
has comment: http://stackoverflow.com/comment/33024967
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21821246
has answer: http://stackoverflow.com/a/21821253
linked to: http://stackoverflow.com/q/2356251
type: Question
duplicate of: http://stackoverflow.com/q/2356251
has answer: http://stackoverflow.com/a/21821259
has title: How To get seperate 3 string and remove '-'..?
upvote count: 0
has comment: http://stackoverflow.com/comment/33024991
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/33024969
answer count: 5
has comment: http://stackoverflow.com/comment/33024955

http://stackoverflow.com/q/21721011
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: eclipse: Project not built due to "Could not read file ... ~$somefile.xlsx"
tagged with: eclipse
has answer: http://stackoverflow.com/a/27272173
accepted answer: http://stackoverflow.com/a/27272173
type: Question
score: 4
answer count: 1
favorite count: 0
upvote count: 4
tagged with: excel
has body: I've got a excel file(somefile.xlsx) in my maven project. A temp file ~$somefile.xlsx would be generated automatically, if I modify this file. It also disappear automatically if I close the file. With the existence of this temp file, eclipse failed to build my project. The problem window said: The project was not build due to "Could not read file :D:\myworkspace\src\main\java\com\mycompany\suites\~$somefile.xlsx". How to resolve this kind of problems? Should I try to tell eclipse or maven to ignore this temp file -- is there such a way?

maven
tags question: http://stackoverflow.com/q/21827729
tags question: http://stackoverflow.com/q/21778903
tags question: http://stackoverflow.com/q/21757152
tags question: http://stackoverflow.com/q/21708311
tags question: http://stackoverflow.com/q/21690215
tags question: http://stackoverflow.com/q/21779537
tags question: http://stackoverflow.com/q/21730162
tags question: http://stackoverflow.com/q/21834806
type: Tag
tags question: http://stackoverflow.com/q/21679990
tags question: http://stackoverflow.com/q/21681318
tags question: http://stackoverflow.com/q/21734493
tags question: http://stackoverflow.com/q/21734564
tags question: http://stackoverflow.com/q/21779364
tags question: http://stackoverflow.com/q/21757285
tags question: http://stackoverflow.com/q/21747680
tags question: http://stackoverflow.com/q/21828269
tags question: http://stackoverflow.com/q/21834219
tags question: http://stackoverflow.com/q/21802299
tags question: http://stackoverflow.com/q/21757179
tags question: http://stackoverflow.com/q/21782517
tags question: http://stackoverflow.com/q/21770042
tags question: http://stackoverflow.com/q/21721412
tags question: http://stackoverflow.com/q/21789849
tags question: http://stackoverflow.com/q/21833680
tags question: http://stackoverflow.com/q/21690799
tags question: http://stackoverflow.com/q/21721846
tags question: http://stackoverflow.com/q/21738543
tags question: http://stackoverflow.com/q/21730010
tags question: http://stackoverflow.com/q/21698731
tags question: http://stackoverflow.com/q/21692785
tags question: http://stackoverflow.com/q/21696212
tags question: http://stackoverflow.com/q/21698330
tags question: http://stackoverflow.com/q/21780953
tags question: http://stackoverflow.com/q/21834340
tags question: http://stackoverflow.com/q/21788134
tags question: http://stackoverflow.com/q/21771093
tags question: http://stackoverflow.com/q/21718357
tags question: http://stackoverflow.com/q/21744714
tags question: http://stackoverflow.com/q/21747220
tags question: http://stackoverflow.com/q/21726378
tags question: http://stackoverflow.com/q/21710770
tags question: http://stackoverflow.com/q/21738938
tags question: http://stackoverflow.com/q/21828846
tags question: http://stackoverflow.com/q/21733220
tags question: http://stackoverflow.com/q/21685353
tags question: http://stackoverflow.com/q/21815270
tags question: http://stackoverflow.com/q/21786076
tags question: http://stackoverflow.com/q/21773516
tags question: http://stackoverflow.com/q/21805536
tags question: http://stackoverflow.com/q/21723125
tags question: http://stackoverflow.com/q/21790894
tags question: http://stackoverflow.com/q/21835654
tags question: http://stackoverflow.com/q/21751455
tags question: http://stackoverflow.com/q/21750863
tags question: http://stackoverflow.com/q/21796503
tags question: http://stackoverflow.com/q/21739981
tags question: http://stackoverflow.com/q/21683738
tags question: http://stackoverflow.com/q/21704449
tags question: http://stackoverflow.com/q/21832620
tags question: http://stackoverflow.com/q/21756263
tags question: http://stackoverflow.com/q/21782519
tags question: http://stackoverflow.com/q/21779244
tags question: http://stackoverflow.com/q/21758392
tags question: http://stackoverflow.com/q/21784149
tags question: http://stackoverflow.com/q/21722103
tags question: http://stackoverflow.com/q/21763096
tags question: http://stackoverflow.com/q/21820078
tags question: http://stackoverflow.com/q/21685974
tags question: http://stackoverflow.com/q/21705851
tags question: http://stackoverflow.com/q/21831672
tags question: http://stackoverflow.com/q/21686237
tags question: http://stackoverflow.com/q/21686744
tags question: http://stackoverflow.com/q/21824853
tags question: http://stackoverflow.com/q/21739126
tags question: http://stackoverflow.com/q/21791463
tags question: http://stackoverflow.com/q/21726774
tags question: http://stackoverflow.com/q/21769446
tags question: http://stackoverflow.com/q/21697359
tags question: http://stackoverflow.com/q/21711462

http://stackoverflow.com/a/21740225
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21738635
has comment: http://stackoverflow.com/comment/32956529
downvote count: 0
upvote count: 2
has body: An altChunk is not "real" docx content. Before it can be outputted in PDF, it needs to be replaced with normal WordML paragraphs, tables etc. You can try doing this yourself, which is easy enough if the content does not include any relationships (images, hyperlinks etc), or conflicting styles or numbering. Please see further http://www.docx4java.org/blog/2010/11/merging-word-documents/ .. or my company's website plutext.com

http://stackoverflow.com/a/21714524
answers question: http://stackoverflow.com/q/21714290
has comment: http://stackoverflow.com/comment/32837008
has comment: http://stackoverflow.com/comment/32837212
has comment: http://stackoverflow.com/comment/32836664
has comment: http://stackoverflow.com/comment/32836831
has comment: http://stackoverflow.com/comment/32836550
has comment: http://stackoverflow.com/comment/32836475
accepted answer of: http://stackoverflow.com/q/21714290
has comment: http://stackoverflow.com/comment/32836615
type: AcceptedAnswer
downvote count: 0
has body: Servlet context listener (web.xml) approach A web application WAR is being deployed by user. Servlet container (Tomcat) reads web.xml. Servlet context listener ContextLoaderListener is being instantiated (if defined as &lt;listener&gt; inside the web.xml) by servlet container. ContextLoaderListener creates new WebApplicationContext with application context XML configuration. Your ROOT context beans are registered and instantiated by BeanFactory inside the application context. DispatcherServlet is being instantiated by servlet container. DispatcherServlet creates its own WebApplicationContext (WEB-INF/{servletName}-servlet.xml by default) with the ROOT context as its parent. Your servlet beans are registered and instantiated by BeanFactory inside the application context. DispatcherServlet registers some default beans in case you did not provide them yourself. Servlet container initializer (non web.xml) approach This one is possible with Servlet 3 features. A web application WAR is being deployed by user. Servlet container searches for classes implementing ServletContainerInitializer via Java's ServiceLoader. Spring's SpringServletContainerInitializer is found and instantiated by servlet container. Spring's initializer reads web application's class-path and searches for WebApplicationInitializer implementations. Your WebApplicationInitializer is found (btw. check its JavaDoc!!!) and instantiated by SpringServletContainerInitializer. Your WebApplicationInitializer creates new ROOT WebApplicationContext with XML or @Configuration based configuration. Your WebApplicationInitializer creates new servlet WebApplicationContext with XML or @Configuration based configuration. Your WebApplicationInitializer creates and registers new DispatcherServlet with the context from previous step. Servlet container finishes the web application initialization and instantiates components which were registered by their class in previous steps (none in my example). Java based approach is much…
has comment: http://stackoverflow.com/comment/32836434
has comment: http://stackoverflow.com/comment/32836365
score: 48
type: Answer
upvote count: 48
has comment: http://stackoverflow.com/comment/61771359
has comment: http://stackoverflow.com/comment/32837176

http://stackoverflow.com/q/21828805
tagged with: string-matching
has title: String matching operation
has comment: http://stackoverflow.com/comment/33037739
tagged with: java
has body: I have two Strings (they can be anything) like I am a boy and I am a man. Where I am a is common. My task is to find out the common words from two strings. I used Set&lt;String&gt; to store the data, but it only stores unique values. So my question is, how can I get common words from two Strings? The two sentences above should, for instance, produce the result {"I", "am", "a"}, i.e. the set of words common to both sentences.
has comment: http://stackoverflow.com/comment/33038344
has comment: http://stackoverflow.com/comment/33037761
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/33037842
score: -1
has comment: http://stackoverflow.com/comment/33037643
has comment: http://stackoverflow.com/comment/33037996
has answer: http://stackoverflow.com/a/21828852
has answer: http://stackoverflow.com/a/21828939
has answer: http://stackoverflow.com/a/21828915
tagged with: string
has comment: http://stackoverflow.com/comment/33038298
favorite count: 0
has answer: http://stackoverflow.com/a/21829589
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33038653
has answer: http://stackoverflow.com/a/21828868

http://stackoverflow.com/comment/33022229
has text: as i see jsfiddle is for javascript not for java? but for that clear listeners. It clears all other listeners, so in button1 and button2. Problem is just on last one, which is clicked/touched
type: Comment
comment on: http://stackoverflow.com/a/21819496
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32872800
score: 0
has text: Are you sure the entries member variable is not null? The NPE leads me to believe you are trying to save an instance where the ArrayList is null
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21731959

http://stackoverflow.com/q/21815102
possible better answer: http://stackoverflow.com/a/21815172
has title: Java - String Index Out of Bounds Exception : 11
has answer: http://stackoverflow.com/a/21815172
has answer: http://stackoverflow.com/a/21815126
has body: I am writing a simple program to get the first initial of the last name. input: Bruce Lee output: L Here is the code: public char getFirstInitial() { char initial; int num = this.getFullName().length(); while (this.getFullName().charAt(num) != ' ') //this is line 120 { num--; } initial = this.getFullName().charAt(num + 1); return initial; } public String getFullName() { return fullName; } I'm getting this error: java.lang.StringIndexOutOfBoundsException: String index out of range: 11 at java.lang.String.charAt(Unknown Source) at lab1.Person.getFirstInitial(Person.java:120) I don't get what the problem is. Thank you
has comment: http://stackoverflow.com/comment/33014145
score: 0
has answer: http://stackoverflow.com/a/21815185
tagged with: string
accepted answer: http://stackoverflow.com/a/21815126
tagged with: exception
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21815534
tagged with: java
type: Question

http://stackoverflow.com/comment/32810463
has text: Oh :), i forgot the flush, i was using before then i removed, i tried everything, was almost crying... thanks!!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21699528

http://stackoverflow.com/q/21680379
possible better answer: http://stackoverflow.com/a/21680413
has answer: http://stackoverflow.com/a/21680413
has comment: http://stackoverflow.com/comment/32774132
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/21680398
favorite count: 0
type: Question
tagged with: android
has title: Catch doesn't execute Toast
score: -1
accepted answer: http://stackoverflow.com/a/21680398
tagged with: java
answer count: 3
has body: I want to show a message to the users when they click "Bintro" button and the EditTexts were empty. I have the next code: Bintro.setOnClickListener(new View.OnClickListener() { String eva; double por, not; @Override public void onClick(View v){ try{ eva = edEva.getText().toString(); por = Double.parseDouble(edPor.getText().toString()); not = Double.parseDouble(edNot.getText().toString()); } catch (Exception e){ Toast.makeText(getApplicationContext(), "Faltan datos por introducir", Toast.LENGTH_LONG); return; } //The code continues down here but it's irrelevant to solve the question. My problem is that when I click the button and there is no EditText filled, the 'catch' doesn't execute the Toast message but, however, it returns the app progress out of the onClick method. When they are filled, the app executes the code below 'catch' perfectly. Hope you can help with my code or with another way to do it. Thanks.
downvote count: 1
tagged with: try-catch
has answer: http://stackoverflow.com/a/21680466
has comment: http://stackoverflow.com/comment/32773971

http://stackoverflow.com/q/21705440
upvote count: 1
has body: There is a FieldGroup, whose datasource is set to an SQLContainer which is configured to use PostgreSQL database with a FreeformQuery. Another application (not webapp) writes data to a database every second. How do I make my FieldGroup update with new data immediately? What I tried to do is setting up a ScheduledExecutorService which would get the data from the database every second and set it to a FieldGroup. But it doesn't seem to work - ScheduledExecutorService successfully gets the data from the database, but the UI isn't updated. There are no exceptions, the UI just doesn't change. Here is the code for my ScheduledExecutorService: ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(); ses.scheduleAtFixedRate(new Runnable() { @Override public void run() { SQLContainer latestData = DatabaseHelper.getLatestData(); fieldGroup.setItemDataSource(latestData.getItem(id)); } }, 0, 1, TimeUnit.SECONDS); I have also tried to show a Notification from ScheduledExecutorService Notification.show("hello"); But it has no effect - the notification isn't displayed. So, maybe, it's not possible to change the UI from other than main thread? So, once again, how to make my UI update with a new data from the database every second? Is it possible to get data not every second, but when there is a change in the database? I have also read about push from server to a client - can it help to solve my problem?
tagged with: java
tagged with: vaadin
has comment: http://stackoverflow.com/comment/32860436
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/32857457
has title: Vaadin - Update UI data every second with data fetched from database
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/32819186
score: 1
favorite count: 0
tagged with: web-applications
tagged with: vaadin7

http://stackoverflow.com/a/21802832
has body: Create a class like: public class Key{ int randomNumber; byte[] data; String ipAddress; } And store it like a value of your Map. Map&lt;String, Key&gt; map; Hope it helps.
type: Answer
has comment: http://stackoverflow.com/comment/32992938
has comment: http://stackoverflow.com/comment/32992045
answers question: http://stackoverflow.com/q/21802776
score: 0

http://stackoverflow.com/q/21774197
score: 0
has comment: http://stackoverflow.com/comment/32941201
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21775714
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32943299
accepted answer: http://stackoverflow.com/a/21775714
tagged with: java
has title: org.jdom2.IllegalAddException: The Content already has an existing parent
has comment: http://stackoverflow.com/comment/32942606
type: Question
tagged with: jdom
has body: I am trying to add new xml data to existing xml file. But I get this error. I try to add a new type and I got like 20 in the orginal file already. Exception in thread "AWT-EventQueue-0" org.jdom2.IllegalAddException: The Content already has an existing parent "type" at org.jdom2.ContentList.checkPreConditions(ContentList.java:211) at org.jdom2.ContentList.add(ContentList.java:244) at org.jdom2.ContentList.add(ContentList.java:79) at java.util.AbstractList.add(Unknown Source) at org.jdom2.Element.addContent(Element.java:917) at xmleditor.service.CreateNewXMLData.saveXmlToFile(CreateNewXMLData.java:64) at xmleditor.gui.CreateNewObjectType$1.actionPerformed(CreateNewObjectType.java:405) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThr…
answer count: 1

http://stackoverflow.com/comment/32988503
comment on: http://stackoverflow.com/a/21799569
type: Comment
has text: Well this helps, but only because I have only one webapp.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21827032
has answer: http://stackoverflow.com/a/21979061
accepted answer: http://stackoverflow.com/a/21979061
has answer: http://stackoverflow.com/a/21827483
type: AnsweredQuestion
tagged with: java
tagged with: classpath
has body: I've to read all the java file names available in scripts package to execuete a particular method. The below code works fine using eclipse. I want to run the Test using Runnable Jar - as the strTestScriptsPath = "src/com/xyz/test/scripts" contains src, It is getting failed (Otherwise I've to provide src folder to the JAR file to run it successfully) In this context how to use this.getClass().getResourceAsStream() Note: I am trying to give path of the directory not the file. I've to fectch file name from the above code only :( public static boolean executeKeyword(String keyword){ String strTestScriptsPath = "src/com/xyz/test/scripts"; File folder = new File( strTestScriptsPath ); File[] listOfFiles = folder.listFiles(); boolean booFindMethod = false; findKeyword: for(File file: listOfFiles ){ strJavaClassFileName = FilenameUtils.removeExtension( file.getName()); strJavaClassFileName = "com.xyz.test.scripts." + strJavaClassFileName; System.out.println(strJavaClassFileName); // Reflection API code to call the required method from the class .. .. } }
type: Question
possible better answer: http://stackoverflow.com/a/21827483
has title: Runnable Jar file - src file path issue
score: 0
has comment: http://stackoverflow.com/comment/33037406
answer count: 2
tagged with: jar

http://stackoverflow.com/comment/32887372
type: Comment
comment on: http://stackoverflow.com/a/21743814
has text: In fact I know what does the execution(1) mean, there are other type of join points like `field` and etc, spring just support 'method execution`. But what confused me is the execution(2) in the pointcut expression, what does that mean?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21738932
has body: UPDATE: I've learned more about what's going on and added the new info at the bottom. I have 2 applications running under tomcat. App1 is loaded first, then App2. If App1 runs into any kind of error during startup and fails to load successfully, I get this error during startup of App2: Caused by: java.security.NoSuchAlgorithmException: No such algorithm: RSA/NONE/OAEPWithSHA1AndMGF1Padding at javax.crypto.Cipher.getInstance(DashoA13*..) at javax.crypto.Cipher.getInstance(DashoA13*..) at com.jp.protection.security.BouncyCastleSecurityProvider.getCipher(BouncyCastleSecurityProvider.java:139) at com.jp.protection.security.BouncyCastleSecurityProvider.decode(BouncyCastleSecurityProvider.java:110) ... 70 more Caused by: java.lang.NullPointerException at org.bouncycastle.jcajce.provider.util.DigestFactory.getDigest(DigestFactory.java:86) at org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.initFromSpec(CipherSpi.java:83) at org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.engineSetPadding(CipherSpi.java:214) at javax.crypto.Cipher$r.a(DashoA13*..) ... 74 more Note that the ultimate cause is a NullPointerException. I downloaded the source for DigestFactory and it looks like this (just the relevant parts excerpted): package org.bouncycastle.jcajce.provider.util; public class DigestFactory { private static Set sha1 = new HashSet(); static { sha1.add("SHA1"); sha1.add("SHA-1"); } public static Digest getDigest( String digestName) { digestName = Strings.toUpperCase(digestName); if (sha1.contains(digestName)) ** line 86 where npe occurs** { return new SHA1Digest(); } [...] The only way to get an NPE at line 86 is if sha1 is null. (If digestName was null, the NPE would occur in the call to Strings.toUpperCase. ) And in fact if I put a breakpoint here, under the error scenario the debugger shows sha1 (and all the other similarly statically initialized fields) as null. These fields are private and there are no methods that allow these fields to be modified. How is…
answer count: 3
downvote count: 0
tagged with: tomcat
favorite count: 0
possible better answer: http://stackoverflow.com/a/21739654
score: 3
has answer: http://stackoverflow.com/a/21739654
has comment: http://stackoverflow.com/comment/32878790
has answer: http://stackoverflow.com/a/22057064
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32882234
tagged with: bouncycastle
upvote count: 3
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22057064
has answer: http://stackoverflow.com/a/31357864
has title: tomcat classloader bug?

http://stackoverflow.com/comment/32920101
comment on: http://stackoverflow.com/a/21762468
has text: @user230137 `\x0B` is "Vertical Tab" (VT) in ASCII.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/32849541
type: QuestionComment
comment on: http://stackoverflow.com/q/21722660
type: Comment
has text: What is the charset of your database? In order to save hindi charset must be UTF-8
score: 0

http://stackoverflow.com/comment/41248535
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26237478
type: AnswerComment
has text: I'm using it in my game right now. I just compared line and filled. Filled is definitely what you want for ShapeRenderer.rectLine(). It works for ShapeRenderer.line() the same way that shaptype.line does but is probably much less efficient.

http://stackoverflow.com/comment/32780562
type: AnswerComment
score: 0
type: Comment
has text: The reflection API allows you to find methods on an object and identify their arg types etc. I think you'll have to perform some sort of pattern match based on your inputs.
comment on: http://stackoverflow.com/a/21684066

http://stackoverflow.com/q/21804982
tagged with: jdbc
has title: getting java.sql.SQLSyntaxErrorException: ORA-00936: missing expression error
type: AnsweredQuestion
tagged with: java
has body: I'm using JDBC to connect to the Oracle database and ask how many methods are in the String class. I keep getting the following error: Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00936: missing expression at the following line: ResultSet res1 = stmt.executeQuery("SELECT (Distinct method_name) FROM all_java_method WHERE name LIKE 'String' Order BY method_name"); I don't have a ton of experience with SQL yet so any help would be appreciated. Thanks.
type: Question
accepted answer: http://stackoverflow.com/a/21805088
score: 0
has answer: http://stackoverflow.com/a/21805088
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/32996032
has comment: http://stackoverflow.com/comment/32995954
tagged with: oracle-database

http://stackoverflow.com/comment/33001389
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21807944
has text: Yes, it should get added all the time when new Node added, not only second one, but third, fourth...
type: Comment

http://stackoverflow.com/q/21839182
has comment: http://stackoverflow.com/comment/33056592
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33056568
tagged with: java
has comment: http://stackoverflow.com/comment/33056612
accepted answer: http://stackoverflow.com/a/21839342
has comment: http://stackoverflow.com/comment/33056720
type: Question
has title: cannot make a static reference to a non static method
has answer: http://stackoverflow.com/a/21839342
tagged with: static-methods
has comment: http://stackoverflow.com/comment/33056760
upvote count: 3
has answer: http://stackoverflow.com/a/43933330
possible better answer: http://stackoverflow.com/a/21839360
downvote count: 1
has body: So far I have the following code: import java.util.Scanner; public class HallLanceMemoryCalculator { private double currentValue; public static int displayMenu(){ Scanner input=new Scanner(System.in); int choice=0; while(choice&lt;1||choice&gt;5){ System.out.println("1.Add"); System.out.println("2.Subtract"); System.out.println("3.Multiply"); System.out.println("4.Divide"); System.out.println("5.Clear"); System.out.println("What would you like to do?"); choice=input.nextInt(); } return choice; } public static double getOperand(String prompt){ Scanner input=new Scanner(System.in); System.out.println("What is the second number?"); double secondNumber=input.nextDouble(); return secondNumber; } public double getCurrentValue(){ return currentValue; } public void add(double operand2){ currentValue+=operand2; } public void subtract(double operand2){ currentValue-=operand2; } public void multiply(double operand2){ currentValue*=operand2; } public void divide(double operand2){ currentValue/=operand2; } public void clear(){ currentValue=0; } public static void main(String[] args) { double value=getCurrentValue(); } } When I try to set double value=getCurrentValue(); at the end, I get an error message "Cannot make a static reference to the non-static method." It says the fix is to make the getCurrentValue() method static as well, but I was told not to make that field static by my professor. Is there a simple solution to this that I am just missing?
has answer: http://stackoverflow.com/a/21839360
has answer: http://stackoverflow.com/a/21839267
favorite count: 0
has answer: http://stackoverflow.com/a/21839365
answer count: 5
score: 2

http://stackoverflow.com/comment/32940903
has text: Depends a bit on how you use jaxws today. CXF supports the standard JAXWs API like Endpoint.publish. So if you use this no change is required. On the other hand CXF provides special support for e.g. blueprint. So it depends if you want to use those.
comment on: http://stackoverflow.com/a/21749139
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21825468
answers question: http://stackoverflow.com/q/21825336
has body: Java is always pass-by-value. That means that the original variable before you pass it is never changed by anything done inside methods/objects/etc that you call. However the thing that confuses people here is that when you pass an object you actually pass a reference to that object by value. Which is what is giving you the behavior here. You have passed a reference to the object into the list. The reference has been passed by value. That means it has been copied, and you can change the reference (but not the thing it points to) as much as you like and the method you called will not see any change.
type: Answer
score: 0

http://stackoverflow.com/comment/32990723
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21801820
has text: I also disovered when the text is the same in all cells, then the height is also the same. I'm wondering if it has any relation with new line character I use to break the text (\n). As some cells doesn't have this new line while some have one or two....

http://stackoverflow.com/q/21831633
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21831703
favorite count: 0
upvote count: 2
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: java
has body: I'm working on a project using SQLite. I did create my db a while ago and so on but yesterday i uninstall my app from the phone and tryed to run it again via eclipse and it seems that since that moment, it doesn't work anymore. first the code : my SQLHelper : public class SQLHelper extends SQLiteOpenHelper { public static final String DATABASE_NAME = "listopresto"; public static final String TABLE_CATEGORIES = "categories"; public static final String CATEGORY_NAME = "name"; public static final String CATEGORY_ID = "id"; public static final String CATEGORY_ID_PARENT = "parent_id"; public static final String CATEGORY_URL_IMAGE = "image_url"; public static final String TABLE_SHOPPING_LIST = "shopping_list"; public static final String SHOPPING_LIST_ID = "shopping_list_id"; public static final String SHOPPING_LIST_NAME = "shopping_list_name"; public static final String SHOPPING_LIST_DATE_CREATION = "shopping_list_date_creation"; public static final String TABLE_SHOPPING_LIST_ITEMS = "shopping_list_items"; public static final String SHOPPING_LIST_ITEMS_LIST_ID = "shopping_list_items_list_id"; public static final String SHOPPING_LIST_ITEMS_ID = "shopping_list_items_id"; public static final String SHOPPING_LIST_ITEMS_NB_ITEMS = "shopping_list_items_nb_items"; public static final String SHOPPING_LIST_ITEMS_CHECKED = "shopping_list_items_checked"; public static final String TABLE_INFOS = "infos"; public static final String INFOS_AGE = "age"; public static final String INFOS_MAIL = "mail"; public static final String INFOS_DISPLAY_PRICE = "display_price"; public static final String INFOS_TOKEN = "token"; public static final String INFOS_REFRESH_TOKEN = "refresh_token"; public static final String INFOS_TOKEN_EXPIRATION = "token_expiration"; public static final String INFOS_REFRESH_TOKEN_EXPIRATION = "refresh_token_expiration"; public static final String INFOS_APP_VERSION = "app_version"; public static final String TABLE_ITEMS = "items"; public static final String ITEM_ID = "id";…
has comment: http://stackoverflow.com/comment/33042970
tagged with: cursor
type: Question
has title: What to do when cursor.movetofirst is false (SQLite)
has answer: http://stackoverflow.com/a/21831703
tagged with: sqlite

http://stackoverflow.com/q/21696426
tagged with: java
tagged with: xmlworker
answer count: 1
downvote count: 0
favorite count: 0
tagged with: html-lists
has comment: http://stackoverflow.com/comment/32921334
has title: itext XMLWorkerHelper ignores value attribute of tag
has comment: http://stackoverflow.com/comment/32947383
has answer: http://stackoverflow.com/a/58421905
tagged with: pdf-generation
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: itext
type: Question
has body: I'm using itext 5.4.5 with XMLWorker 5.4.5 to generate pdf from html that cames from ckEditor. Users can also paste some text from word documents and this results sometimes in something like this: some text1 lorem ipsum dolor some text2 lorem ipsum dolor some text3 this results in ckEditor and in html as 3. some text1 lorem ipsum dolor 100. some text2 lorem ipsum dolor 77. some text3 But if itext convert this html to pdf, it ignores the value of li-tags and sets it to "1." and this results in something like 1. some text1 lorem ipsum dolor 1. some text2 lorem ipsum dolor 1. some text3 Does somebody knows a way, make itext read and also use the numeric value of a li-tag? Thanks in advance.

http://stackoverflow.com/comment/33037319
comment on: http://stackoverflow.com/q/21828203
score: 0
type: QuestionComment
has text: Can you explain: not working?
type: Comment

http://stackoverflow.com/comment/33140413
score: 0
comment on: http://stackoverflow.com/q/21760679
type: Comment
type: QuestionComment
has text: What is your architecture?

http://stackoverflow.com/comment/33013446
comment on: http://stackoverflow.com/a/21804170
score: 0
type: AnswerComment
has text: I guess the exit value comes from the missing argument. But I'm not sure since I don't know how your source code looks like. Did you try to pass arguments? The shell scripts will forward those to the main class.
type: Comment

http://stackoverflow.com/a/21728110
has comment: http://stackoverflow.com/comment/32898661
upvote count: 5
answers question: http://stackoverflow.com/q/21725093
score: 5
has comment: http://stackoverflow.com/comment/32896780
has comment: http://stackoverflow.com/comment/101232613
downvote count: 0
type: Answer
has body: By using Google's Gson library you can easily parse it to List&lt;Artwork&gt;. Try below code Gson gson = new Gson(); List&lt;Artwork&gt; returnedArtworks = gson.fromJson(jsonStr, new TypeToken&lt;List&lt;Artwork&gt;&gt;(){}.getType()); //* where jsonStr is the response string(Json) receiving from your Restful webservice
has comment: http://stackoverflow.com/comment/32897927

http://stackoverflow.com/comment/80549474
has text: I am having the problem with finding a correct testing framework/tool, do you have any recommend framework? i am using play framwork + angular + mongod
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21768688

http://stackoverflow.com/q/21746067
upvote count: 0
score: -3
has comment: http://stackoverflow.com/comment/32891173
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32891104
accepted answer: http://stackoverflow.com/a/21746229
tagged with: dialog
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32914799
has body: From 1925 through 1963, Burma Shave advertising signs appeared next to high- ways all across the United States. There were always four or five signs in a row containing pieces of a rhyme, followed by a final sign that read “Burma Shave.” For example, one set of signs that has been preserved by the Smithsonian Institution reads as follows: Shaving brushes You'll soon see 'em On a shelf In some museum Burma Shave Find a classic Burma Shave rhyme on the Web. Write, compile, and test a class that produces a series of four dialog boxes so that each displays one line of a Burma Shave slogan in turn. Save the class as BurmaShave.java.
has answer: http://stackoverflow.com/a/21746229
has title: Novice Java Student: How can I create a series of output dialog boxes using JOptionpane?
has comment: http://stackoverflow.com/comment/32891092
has comment: http://stackoverflow.com/comment/32914816
downvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/32891051
favorite count: 0
tagged with: joptionpane

http://stackoverflow.com/a/21793209
has comment: http://stackoverflow.com/comment/32975232
has body: I'll start off by saying that you need more practice with Java. Your code isn't even close... if (numerator != 0) { int common = gcd(Math.abs(numerator), denominator); // Gets a common denominator and uses abs to make sure it is positive. numerator = numerator / common; // Divides top number by common # denominator = denominator / common; // Divides bottom number by common # } You'll need to import java.util.Math; and you'll have to also get the GCD like i did. To get the GCD you say while (num1 != num2) { if (num1 &gt; num2) { num1 = num1 - num2; } else { num2 = num2 - num1; } } return num1; I hope this makes sense to you. It's not too hard after you understand it. Let me know if you have any more questions!
accepted answer of: http://stackoverflow.com/q/21793169
has comment: http://stackoverflow.com/comment/32975244
answers question: http://stackoverflow.com/q/21793169
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32975342
type: Answer

http://stackoverflow.com/comment/32894372
type: Comment
has text: yes. tried it.. same result. but if i'm making two separate pages dedicated for this task. i.e one page only for radio buttons and another only for getting the values.. it is working fine..
type: AnswerComment
comment on: http://stackoverflow.com/a/21746816
score: 0

http://stackoverflow.com/a/21707749
has comment: http://stackoverflow.com/comment/32826114
type: Answer
has comment: http://stackoverflow.com/comment/32826209
has comment: http://stackoverflow.com/comment/32827810
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32827462
has body: Exactly equal that the onClickListener(), but with onLongClickListener() implementing onLongClick(). I'd go by registering each row for contextual menu, this way: context.registerForContextMenu(yourView); And then simply implement the contextual menu function overridings. @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.setHeaderTitle("My twitter menu"); menu.add(Menu.NONE, 0, 0, "Remove"); } @Override public boolean onContextItemSelected(MenuItem item) { final int mId = item.getItemId(); switch (mId) { case 0: ... break; default: break; } return true; }
has comment: http://stackoverflow.com/comment/32827688
accepted answer of: http://stackoverflow.com/q/21707618
has comment: http://stackoverflow.com/comment/32827892
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21707618
downvote count: 0
has comment: http://stackoverflow.com/comment/32827514

http://stackoverflow.com/comment/34160112
type: QuestionComment
comment on: http://stackoverflow.com/q/21797500
score: 0
type: Comment
has text: I am not sure this is an appropriate use of spring. However take a look at method injection: http://docs.spring.io/spring/docs/4.0.0.RELEASE/spring-framework-reference/htmlsingle/#beans-factory-method-injection

http://stackoverflow.com/comment/32917058
type: QuestionComment
type: Comment
has text: did you check the json,it is valid ?
score: 1
comment on: http://stackoverflow.com/q/21760891

http://stackoverflow.com/comment/32964941
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21787668
has text: Ignore the variable `id` for now. This was just for testing purposes.

http://stackoverflow.com/q/21817457
tagged with: bit-manipulation
has answer: http://stackoverflow.com/a/21817532
tagged with: floating-point
has answer: http://stackoverflow.com/a/21817480
type: Question
score: 3
has comment: http://stackoverflow.com/comment/33041986
tagged with: java
answer count: 2
tagged with: java-7
accepted answer: http://stackoverflow.com/a/21817480
downvote count: 0
has comment: http://stackoverflow.com/comment/33018477
favorite count: 0
has title: Increment float exponent only
has body: I'm looking to increment the exponent of a float (without touching the mantissa) in Java. I understand how to retrieve the exponent with Math.getExponent() and increment it, but am unsure about how to use bit manipulation to replace the original exponent of the float. It doesn't like Java makes available a getExponent() or similar. Note that this must increment correctly in both the negative and positive exponent range.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21817532
upvote count: 3

http://stackoverflow.com/q/21766362
tagged with: multithreading
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21766414
answer count: 2
has body: I am reading about multi-threading, when I read about wait() and notify methods. I am having a doubt that what happens if notify() method completes before wait() method. Wait() method will wait again? or previous notification is valid to move further?
has answer: http://stackoverflow.com/a/60119898
has comment: http://stackoverflow.com/comment/32927265
downvote count: 0
has title: Notify called before wait
favorite count: 0
has comment: http://stackoverflow.com/comment/32927169
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/21825402
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21825495
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21825495
accepted answer: http://stackoverflow.com/a/21825922
answer count: 2
has comment: http://stackoverflow.com/comment/33032187
has title: java web application, check if any request taking more than certain amount of time
has body: I am not sure if this is the proper platform for this type of question. I am working on a Java web application which use JPA(with play framwork) in backend and frontend html, jquery. For some requests the system is taking more than required time, some requests are taking more than 20 sec. My question is, is there a tool or a way to identify the requests/thread which are taking more than a specified amount of time. Thank you. EDIT : I was looking for a tool which can be used long term in production server not an eclipse profiler.
tagged with: monitoring
score: 0
tagged with: profiling
has answer: http://stackoverflow.com/a/21825922

http://stackoverflow.com/q/21745852
has answer: http://stackoverflow.com/a/21745907
type: Question
answer count: 2
has body: The result is pretty impressive. with almost 50% each, however the process is the one I am worried about. Sometime i get 10 ones in a roll or 8 zeros in a roll. Which I consider at that period is not a TRUE randomness. I would want to avoid that and only allowing most 3 repeated sequence. Is there a good advice on this? int resetOne = 0; int resetZero = 0; Random ran = new Random(); while (y &lt; 100) { y++; x = ran.nextInt(2); if (x == 1) { resetOne++; resetZero = 0; if (resetOne == 3) { x = ran.nextInt(2); } oneCounter++; } else if (x == 0) { resetZero++; resetOne = 0; if (resetZero == 3) { x = ran.nextInt(2); } zeroCounter++; } System.out.println(x); System.out.println("0 = " + zeroCounter + " " + "1 = " + oneCounter); }
score: 0
tagged with: random
has answer: http://stackoverflow.com/a/21745921
has title: Java Random Class output 1 or 0
has comment: http://stackoverflow.com/comment/32890757
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32890758

http://stackoverflow.com/q/21683171
tagged with: java
tagged with: multithreading
tagged with: inputstream
has comment: http://stackoverflow.com/comment/32805413
type: Question
accepted answer: http://stackoverflow.com/a/21809706
score: 0
has body: I'm trying to write a client server application. the clients post service requests and the server receives them and display them in a tech room. everything was fine until I tried to send a screen capture to a special admin client, that should receive a screen capture of the list of live requests. my main server listening thread looks like this : while (true) { clientSocket = echoServer.accept(); log.debug("Server Started Listening"); is = new DataInputStream(clientSocket.getInputStream()); os = new PrintStream(clientSocket.getOutputStream()); // An option for a stop listening button. currently not available ! if( listening==true ) { line = is.readUTF(); os.println(line); System.out.println(line); RequestReciever.pharseToRequest(line); } The pharseToRequest Method looks like this : public static void pharseToRequest(String input) { List&lt;String&gt; list = new ArrayList&lt;String&gt;(Arrays.asList(input.split(";;;"))); if (list.get(0).equalsIgnoreCase("Login") &amp;&amp; list.get(1).equalsIgnoreCase("Login") &amp;&amp; list.get(2).equalsIgnoreCase("5")) { _adminClients.add(list.get(4)); updateScreenCapture(); AdminClientUpdate tmp = new AdminClientUpdate(list.get(4)); Thread aCU = new Thread (tmp); aCU.start(); } else { ServerRequest newReq = new ServerRequest(list.get(0), list.get(1), Integer.parseInt(list.get(2)),list.get(3),list.get(4)); addRequest(newReq); } } when the client sends "Login" as the data, I treat him as an ADMIN CLIENT, and try to send it a screencapture, via the AdminclientUpdate thread. and when a client sent regular data, I just update it on the server screen with the "addRequest" method. the problem I have is when I try to send the screen capture, it will find its way to the admin client and will be updated there correctly, but my server gets an error and stops working. I suspect it might have something to do with the listening thread still have data in it from the old request while the AdminclientUpdate thread transferring data, or something. …
answer count: 1
has title: How can i know when a socket is idle?
tagged with: sockets
has comment: http://stackoverflow.com/comment/32786557
has answer: http://stackoverflow.com/a/21809706
type: AnsweredQuestion
tagged with: eofexception

http://stackoverflow.com/q/21754746
type: Question
has comment: http://stackoverflow.com/comment/32906640
has title: Issue with Hibernate One to One Mapping
score: 0
has comment: http://stackoverflow.com/comment/32906420
answer count: 1
has body: I have two tables ProductDetails and PartNumber. There is a partNumber field in ProductDetails table which is also the Primary Key of PartNumber table. Current Mapping: for PartNumber table: @Id @Column(name = "Part_Number") private String partNumber; Data to PartNumber field is added separately. Now I want to add this as a column in ProductDetails section. How should the relation be specified. Its a One to One relation. A ProductDetail has only one PartDetail. I have written something like. @OneToOne(mappedBy = "partNumber") private PartNumber part_number = new PartNumber(); How should it be in the PartNumber table? Update The column in ProductDetails table is something like Id, ProductName, PartUsed, Description. In this PartUsed should refer to Part_Number column of PartNumber table.
has comment: http://stackoverflow.com/comment/32906904
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32906281
has comment: http://stackoverflow.com/comment/32906774
has comment: http://stackoverflow.com/comment/32906499
has comment: http://stackoverflow.com/comment/32907082
has answer: http://stackoverflow.com/a/21755294
has comment: http://stackoverflow.com/comment/32906075
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/21697737
tagged with: synchronization
tagged with: service
has body: We are using service oriented architecture, and have a multi-threaded application which serves requests. These requests need to read certain values from a large object that is shared across all the threads and must be periodically refreshed by reading it from the database (say, with a frequency of once per day). The periodic refresh of this large object can possibly take a few minutes and our service must still continue to serve requests using the older cached value of the object. In other words, we do not want to block requests until we have the most updated value of the object. We are thinking of doing the following: A daemon thread can read the database and reconstruct the object into a new variable. Later, the reference of the new object can be copied onto the variable holding the previously cached object. However, we are unsure whether the copying of the reference can be said to be reasonably thread-safe operation (we don't need it to be completely thread safe). In other words, if a daemon thread updates shared variable A as follows (without locking it): A = B; At that time, if another thread attempts to read A, will it always read only the new or the old value of A (both are acceptable scenarios for us) or can it possibly end up reading some garbage value ? If we expressly need to lock A, then the latencies of our requests could go up. Any other suggestions are also welcome. Thanks!
type: UnansweredQuestion
tagged with: multithreading
linked to: http://stackoverflow.com/q/4633866
upvote count: 1
has title: Periodic refresh of a large object
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/3964211
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21698000

http://stackoverflow.com/q/21707276
answer count: 2
tagged with: file-io
downvote count: 0
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
tagged with: war
tagged with: spring
has comment: http://stackoverflow.com/comment/32863437
score: 2
has answer: http://stackoverflow.com/a/21707879
has comment: http://stackoverflow.com/comment/39135135
upvote count: 2
tagged with: java
has body: I am in need of a few special file types for my Spring application hence I raised this specific question on how to do a foolproof file I/O in both my local machine and once the WAR file is uploaded to the server. I did a few research myself and found some slightly helpful articles: The question "Absolute file access in Spring Service layer" asks how to do file I/O in a Spring Service class. The accepted answer suggests to use Spring's Resource but it requires that the files needed to be inside /WEB-INF/classes and unfortunately it contradicts one of the comments with the highest vote-ups: Don't write inside your web content or WEB-INF folder. There is no guarantee that the war file will be exploded on the filesystem. Write to a well known (probaly configurable) file location. Okay so where do I put it??? Doesn't matter, find a nice location for your files. Maybe a user directory for your application, inside the TMP directory or whatever you like. Everything but writing inside your web-apps directories. So I guess putting the file in /src is okay. The poor guy asked again but this time it needs to be in the Tomcat server: "Tomcat server absolute file access in war webapp". This answer said to NOT DO FILE I/O INSIDE A WAR FILE. The accepted answer by OP is not helping either because a comment said that: This solution will not work unless your webapp is deployed as an exploded-WAR file. It is therefore fragile. Using the ClassLoader or ServletContext to fetch resources is a more robust solution. This solution appears to use the ClassLoader but then mangles the URL and loads the resource using standard file I/O. :( Okay so I saw a link provided by the guy who suggested not to do file I/O in a WAR called "How to really read text file from classpath in Java". The problem with this one is that the file needs to be somewhere outside the whole Spring project given by the accepted answer and the second highest suggests Resource again. What I tried so far According to DwB's an…
has answer: http://stackoverflow.com/a/21707991
type: Question
has title: How to do file I/O in Spring that will be exported as WAR file
linked to: http://stackoverflow.com/q/1464291
linked to: http://stackoverflow.com/q/20403810

http://stackoverflow.com/comment/32829985
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21709703
has text: But your servlet needs to know what to use/parse. You just pass the reference to the file, not the file itself. If you want to include the file as well, you put it in "webapp/WEB-INF/classes" and from your servlet you can parse it as "Dhanush Gopinath" is describing below. I might have misunderstood the problem though.
score: 0

http://stackoverflow.com/comment/33106464
score: 0
type: AnswerComment
type: Comment
has text: And what is the best way to use these resources in the template. Is there some api that resolves context path and so on? I mean magnolia api. I ve seen some good feature in gsp that is checking if the resource exists before path resolution.
comment on: http://stackoverflow.com/a/21864387

http://stackoverflow.com/comment/32872003
type: Comment
has text: its a suggestion to help the op know and able to debug certian things himself
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21735577

http://stackoverflow.com/comment/33027878
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21818931
type: Comment
has text: Use JFrame directly? I tried to put add(diceOne) but it gives me an error saying it can't find the symbol.

http://stackoverflow.com/a/21708766
answers question: http://stackoverflow.com/q/21708642
score: 0
has body: There are other Swing objects for toolbars which you may find more suitable than trying to add a button. See here: http://docs.oracle.com/javase/tutorial/uiswing/components/toolbar.html
type: Answer

http://stackoverflow.com/comment/32939066
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21772600
has text: Thanks, added some code now.The error message depends on where I put the annotation. If I put it above the class, like in the example, it expects it to be a class declaration, if I put it above the method, it expects a method.

http://stackoverflow.com/comment/32959226
type: Comment
score: 1
has text: Have you stepped through your code in an IDE debugger? In general, posting a wall of code saying "Please debug this" is not considered appropriate. You should debug it, narrow down the problem to a _very_ simple testcase that demonstrates what you don't understand, and ask a specific question.
type: QuestionComment
comment on: http://stackoverflow.com/q/21784638

http://stackoverflow.com/q/21836154
has title: bukkit plugin.yml external var
score: 1
downvote count: 1
type: Question
tagged with: java
tagged with: bukkit
has body: i have started 1 day ago with scripting java and i am working with bukkit. my question is how i can get&amp;set values( variables ) into a external file (plugin.yml) ? like this plugin.yml commandforx: ABC main.java if(cmd.getName().equalsIgnoreCase( *commandforx* )) ...... so my target is to get the var commandforx from plugin.yml to main.java and heres my second question how i can save coordinates? also set&amp;get the coordinates over the plugin.yml... thanks ahead
answer count: 3
has answer: http://stackoverflow.com/a/21836279
favorite count: 0
has answer: http://stackoverflow.com/a/40418494
has answer: http://stackoverflow.com/a/21841661
accepted answer: http://stackoverflow.com/a/21836279
possible better answer: http://stackoverflow.com/a/21841661
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/comment/32804815
comment on: http://stackoverflow.com/a/21681807
score: 0
type: Comment
has text: Could you show me the request you sent? Which tool you use?
type: AnswerComment

http://stackoverflow.com/comment/32790796
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21689550
has text: It's just what my professor wants to be used.
score: 0

http://stackoverflow.com/comment/32960815
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21784884
has text: What do you really want to test? Using a simple HashMap concurrently can result in corrupt data structures which create endless loops on access!
type: Comment

http://stackoverflow.com/a/21779840
has comment: http://stackoverflow.com/comment/32951511
answers question: http://stackoverflow.com/q/21779577
has comment: http://stackoverflow.com/comment/32951674
type: Answer
accepted answer of: http://stackoverflow.com/q/21779577
has comment: http://stackoverflow.com/comment/32951450
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32951628
has comment: http://stackoverflow.com/comment/32951376
has comment: http://stackoverflow.com/comment/32950995
has comment: http://stackoverflow.com/comment/32950894
has body: I gave you the query to use in your previous question: SELECT composicao FROM Composicao composicao Don't you understand that selecting two fields of an entity, as you're doing in the query SELECT composicao.valortotal,composicao.id FROM Composicao composicao ^-- first field ^-- second field doesn't return Composicao objects, but simply the two fields you selected: valortotal and id? You're explicitely asking JPA to return only valortotal and id. Why would it return all the other fields and create a Composicao object? You want all the fields, and not just valortotal and id. So the query is (I'll repeat it a third time just in case): SELECT composicao FROM Composicao composicao
upvote count: 3
has comment: http://stackoverflow.com/comment/32952267
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32951269
has comment: http://stackoverflow.com/comment/32951831
has comment: http://stackoverflow.com/comment/32952026
has comment: http://stackoverflow.com/comment/32952080
has comment: http://stackoverflow.com/comment/32951127

http://stackoverflow.com/a/21822245
upvote count: 1
has body: Use SharedPreference. Save in OnCLick of first class and retrieve in OnCreate of second class. Initialization SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", 0); // 0 - for private mode Editor editor = pref.edit(); Storing Data editor.putBoolean("key_name", true); // Storing boolean - true/false editor.putString("key_name", "string value"); // Storing string editor.putInt("key_name", "int value"); // Storing integer editor.putFloat("key_name", "float value"); // Storing float editor.putLong("key_name", "long value"); // Storing long editor.commit(); // commit changes Retrieving Data // returns stored preference value // If value is not present return second param value - In this case null pref.getString("key_name", null); // getting String pref.getInt("key_name", null); // getting Integer pref.getFloat("key_name", null); // getting Float pref.getLong("key_name", null); // getting Long pref.getBoolean("key_name", null); // getting boolean Deleting Data editor.remove("name"); // will delete key name editor.remove("email"); // will delete key email editor.commit(); // commit changes Clearing Storage editor.clear(); editor.commit(); // commit changes
downvote count: 0
answers question: http://stackoverflow.com/q/21822168
has comment: http://stackoverflow.com/comment/33027052
type: Answer
score: 1

http://stackoverflow.com/q/21771952
has comment: http://stackoverflow.com/comment/32938582
score: 3
has answer: http://stackoverflow.com/a/22279358
tagged with: android
tagged with: google-cloud-messaging
has comment: http://stackoverflow.com/comment/32938613
has comment: http://stackoverflow.com/comment/32938029
favorite count: 0
has comment: http://stackoverflow.com/comment/32938313
has title: New GCM Implementation Running On Emulater having Issues
type: Question
has comment: http://stackoverflow.com/comment/32937459
answer count: 1
tagged with: emulation
has comment: http://stackoverflow.com/comment/32938369
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32937479
has comment: http://stackoverflow.com/comment/32938406
tagged with: android-emulator
has body: I am trying to Implement GCM for my application but emulator gives above message. I have updated my Google API I also include Google play service library project I also add Google play service library I also recreate my Emulator Still my project wont run this is my emulator details when i try GCM with old GCMRegistrar library which is currently deprecated, is working with Emulator but when i Used new GCM google play services for GCM it shows above error message
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32937564
has comment: http://stackoverflow.com/comment/32938045

http://stackoverflow.com/q/21683060
type: Question
possible better answer: http://stackoverflow.com/a/21683158
accepted answer: http://stackoverflow.com/a/21683105
score: 4
upvote count: 4
answer count: 2
downvote count: 0
favorite count: 0
has title: Android Converting Ninepatch Resource To Bitmap
tagged with: nine-patch
tagged with: android
has answer: http://stackoverflow.com/a/21683105
type: AnsweredQuestion
has body: I have a 9 patch drawable as XML. When I try to use BitmapFactory.decode to get bitmap out of it, it returns null. Is there anyway to get a bitmap from this resource? nine_patch.xml: <?xml version="1.0" encoding="utf-8"?> and the code is: BitmapFactory.decodeResource(mResources, resId);
tagged with: java
tagged with: bitmap
has answer: http://stackoverflow.com/a/21683158

http://stackoverflow.com/comment/32987206
comment on: http://stackoverflow.com/q/21799775
score: 0
type: QuestionComment
type: Comment
has text: What happens if you print the output yourself instead of using the default `LinkedHashMap#toString()`?

http://stackoverflow.com/q/21829060
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/33040656
has answer: http://stackoverflow.com/a/21829152
has answer: http://stackoverflow.com/a/21835287
has body: Hi there I am trying to impor the facebook sdk project into Eclipse EE Kepler but I always get this stupid error about the import that doesn't found.. import com.facebook.android.R; I already deleted project and add it again.. I already comment the classes with errors to see if the file would be generated.. I already restarted eclipse.. I already right-clicked the project and select Android Tools > Fix Project Properties I already clean the problem.. Any thoughs on how to fix this? Thanks alot in advance..
has comment: http://stackoverflow.com/comment/33038101
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21829152
has comment: http://stackoverflow.com/comment/33040666
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33038111
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21835287
has title: Import com.facebook.android.R; not found

http://stackoverflow.com/a/21769801
has comment: http://stackoverflow.com/comment/32934726
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32936797
has comment: http://stackoverflow.com/comment/32934976
has comment: http://stackoverflow.com/comment/32934587
answers question: http://stackoverflow.com/q/21769655
has comment: http://stackoverflow.com/comment/32934575
upvote count: 3
has body: The function declared in your .c file isn't the function declared in your .h file, or as the native method in your Java code either. You've changed the name somewhere along the line without keeping everything in sync.
has comment: http://stackoverflow.com/comment/32950557
has comment: http://stackoverflow.com/comment/32934777
type: Answer

http://stackoverflow.com/q/21733256
has body: Okay so, I've my main class which loads everything in from my framework. What I'm having trouble with now is my collision detection; I've got it so if it hits something, something will happen. I've a method that calls a GameOverUI in the GameScreen class, but I want to use that in my Enemy.class .. I've created a new instance for the object but it's saying its undefined. What I dont get is the class has no definition but a method called GameScreen is defined by (Game game). import java.util.ArrayList; import java.util.List; import java.util.Scanner; import android.graphics.Color; import android.graphics.Paint; import com.vaughanslater.framework.Game; import com.vaughanslater.framework.Graphics; import com.vaughanslater.framework.Image; import com.vaughanslater.framework.Input.TouchEvent; import com.vaughanslater.framework.Screen; public class GameScreen extends Screen { enum GameState { Ready, Running, Paused, GameOver } GameState state = GameState.Ready; // Variable Setup private static Background bg1, bg2; private static Robot robot; public static Heliboy hb, hb2; private Image currentSprite, character, character2, character3, heliboy, heliboy2, heliboy3, heliboy4, heliboy5; private Animation anim, hanim; private ArrayList tilearray = new ArrayList(); int livesLeft = 1; Paint paint, paint2; public GameScreen(Game game) { super(game); // Initialize game objects here bg1 = new Background(0, 0); bg2 = new Background(2160, 0); robot = new Robot(); hb = new Heliboy(340, 360); hb2 = new Heliboy(700, 360); character = Assets.character; character2 = Assets.character2; character3 = Assets.character3; heliboy = Assets.heliboy; heliboy2 = Assets.heliboy2; heliboy3 = Assets.heliboy3; heliboy4 = Assets.heliboy4; heliboy5 = Assets.heliboy5; anim = new Animation(); anim.addFrame(character, 1250); anim.addFrame(character2, 50); anim.addFrame(character3, 50); anim.addFrame(character2, 50); hanim = new Animation(); hanim.addFrame(heliboy, 100); hanim.addFrame(heliboy2, 100); hanim.…
favorite count: 0
tagged with: constructor
has title: Why doesn't my code uses default non parameterized constructor, if one constructor with parameters is defined?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32867985
has comment: http://stackoverflow.com/comment/32867886
tagged with: default-constructor
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21733334
type: Question
has answer: http://stackoverflow.com/a/21733340
has comment: http://stackoverflow.com/comment/32867795
answer count: 2
has comment: http://stackoverflow.com/comment/32867827
downvote count: 0

http://stackoverflow.com/a/21801820
has body: Use this for the tableLayout &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; and this for each row &lt;TableRow android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:gravity="center"&gt;
has comment: http://stackoverflow.com/comment/32991602
has comment: http://stackoverflow.com/comment/32990552
answers question: http://stackoverflow.com/q/21801594
has comment: http://stackoverflow.com/comment/32990723
has comment: http://stackoverflow.com/comment/32990631
score: 0
has comment: http://stackoverflow.com/comment/32990471
type: Answer

twitter4j
tags question: http://stackoverflow.com/q/21805439
tags question: http://stackoverflow.com/q/21694055
tags question: http://stackoverflow.com/q/21831641
tags question: http://stackoverflow.com/q/21822861
tags question: http://stackoverflow.com/q/21712493
tags question: http://stackoverflow.com/q/21828871
type: Tag
tag name: twitter4j

http://stackoverflow.com/a/21737246
downvote count: 0
has body: Apparently I can not add logger to my data objects, when I removed the logger it started working again protected final Log logger = LogFactory.getLog(getClass()); Be careful when using loggers in your data object in MongoDB It seems that using @Transient should signal MongoDB driver not to persist the logger variable http://docs.spring.io/spring-data/data-document/docs/current/reference/html/#mapping-usage-annotations
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32876004
type: Answer
has comment: http://stackoverflow.com/comment/32876008
has comment: http://stackoverflow.com/comment/107858182
has comment: http://stackoverflow.com/comment/32876505
answers question: http://stackoverflow.com/q/21734785
has comment: http://stackoverflow.com/comment/32876375
score: 9
upvote count: 9
accepted answer of: http://stackoverflow.com/q/21734785
has comment: http://stackoverflow.com/comment/82560735

http://stackoverflow.com/comment/32874026
comment on: http://stackoverflow.com/q/21736610
type: Comment
type: QuestionComment
score: 2
has text: Can't you just update the content of the activity? I suggest you create an init() method on your activity to set the content and then call this method instead of doing all you need in the onCreate method

http://stackoverflow.com/q/21762888
has body: I've been struggling all day, trying to bind a very simple JSON request to a method using Jersey. I can't seem to find what's wrong, any help is very appreciated. My JSON request is as simple as this: {"user":"xyz","pwd":"123"} My Jersey class looks like this: @Path("/rest") public class JerseyService { @POST @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") @Consumes(MediaType.APPLICATION_JSON) @Path("authenticate.svc") @Transactional(readOnly = true) public Response authenticate( String user, String pwd) throws IOException { Response.ResponseBuilder responseBuilder = Response.ok(); responseBuilder.entity(JsonSerializer.serialize(Status.SUCCESS)); return responseBuilder.build(); } } When I send the JSON request to the service as it is, the "user" parameter is set with the entire JSON request as a String (user = "{\"user\":\"xyz\",\"pwd\":\"123\"}"), while pwd remains null. I've tried using @QueryParam, @FormParam among another annotations with both "user" and "pwd", but I can't find a way for Jersey to bind the JSON values to the Java parameters. Any ideas of what I'm doing wrong? Thanks!
type: Question
tagged with: jersey
has title: How do I map JSON parameters to Jersey parameters?
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21769798
tagged with: rest
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/21769798

http://stackoverflow.com/comment/32784709
has text: Well what would you expect it to do? Do you understand the error? Look at all the related questions.
score: 0
comment on: http://stackoverflow.com/q/21686352
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32814967
type: Comment
type: QuestionComment
has text: I'm sure this is a dupe, but the answer is that methods should only be static when there's only one possible way to do a job, such as basic math functions. Otherwise, you can't use mock objects for testing, or allow pluggable implementations.
score: 2
comment on: http://stackoverflow.com/q/21703691

http://stackoverflow.com/q/21741432
has answer: http://stackoverflow.com/a/21741514
tagged with: bounded-wildcard
score: 2
downvote count: 0
tagged with: wildcard
favorite count: 0
accepted answer: http://stackoverflow.com/a/21741514
tagged with: generics
upvote count: 2
linked to: http://stackoverflow.com/q/2723397
has title: bounded wildcards in java generics
linked to: http://stackoverflow.com/q/4343202
has body: I am reading Core Java volume-1 by Horstmann, Cay.S on generics. I am not able to understand some explanation of the text book. I give the sample code below which the author refers to. followed by the text from the book and my question. class Employees{ } class Manager extends Employees { } class Pair&lt;T&gt;{ private T first; private T second; Pair(T first, T second){ this.first=first; this.second=second; } void setFirst(T value){ first=value; } T getFirst(){ return first; } } public class WildCardGenerics { public static void main(String[] args){ Manager ceo = new Manager(); Manager cfo=new Manager(); Employees clerk = new Employees(); Pair&lt;Manager&gt; managers= new Pair&lt;&gt;(ceo,cfo); Pair&lt;? extends Employees&gt; employees=managers; employees.setFirst(clerk); } } From the book: """No corruption is possible. The call to setFirst is a type error. To see why, let us have a closer look at the type Pair&lt;? extends Employee&gt;. Its methods look like this: ? extends Employee getFirst() void setFirst(? extends Employee) This makes it impossible to call the setFirst method. The compiler only knows that it needs some subtype of Employees, but it doesn't know which type. It refuses to pass any specific type - after all ?might not match it.""" Question: I do not understand why it refuses to pass any specific type. so what does this method accept? ? extends Employee -- means include Employee and any subtype of Employee. so passing an Employee should be legal correct? From the book: pair&lt;? super Manager&gt; has methods: void setFirst(? super Manager) ? super Manager getFirst() The compiler doesnt' know the exact type of the setFirst method and therefore can't call it with an object of type Employee or Object, but only with Manager or a subtype such as executive. Question: So here I say the method can accept any Manager objects or that extends Manager object (similar to subytpe bound above). Not clear to me as why? From the book: Intuitively speaking, wildcards …
duplicate of: http://stackoverflow.com/q/2723397
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21741801
tagged with: java
has answer: http://stackoverflow.com/a/21741801
type: Question
answer count: 2

http://stackoverflow.com/q/21757018
has body: I am doing some very beginner database programming on an android device. In the following code, I am attempting to query a database with some filters. If I choose to filter based on the ID of the row, then it returns correctly, but if instead I filter by a different column, I am unable to find any entries into the database. Can anyone spot what sort of error I have made? *Note, I have put comments over the specific section I am asking about. import java.util.ArrayList; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DataBaseManager { Context context; private SQLiteDatabase db; private final String DB_NAME = "database_name"; private final int DB_VERSION = 1; private final String TABLE_NAME = "database_table"; private final String TABLE_COLUMN_ID = "id"; private final String TABLE_COLUMN_ONE = "user_name"; private final String TABLE_COLUMN_TWO = "pass_word"; public DataBaseManager(Context context) { this.context = context; CustomSQLiteOpenHelper helper = new CustomSQLiteOpenHelper(context); this.db = helper.getWritableDatabase(); } private class CustomSQLiteOpenHelper extends SQLiteOpenHelper { public CustomSQLiteOpenHelper(Context context) { super(context, DB_NAME, null, DB_VERSION); } public void onCreate(SQLiteDatabase db) { String newTableQueryString = "create table " + TABLE_NAME + " (" + TABLE_COLUMN_ID + " integer primary key autoincrement not null," + TABLE_COLUMN_ONE + " text," + TABLE_COLUMN_TWO + " text" + ");"; db.execSQL(newTableQueryString); } public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } } public void addRow(String username, String password) { ContentValues values = new ContentValues(); values.put(TABLE_COLUMN_ONE, username); values.put(TABLE_COLUMN_TWO, password); try { db.insert(TABLE_NAME, null, values); } catch (Exception e) { Log.e("…
has answer: http://stackoverflow.com/a/21757068
tagged with: database
has title: SQLiteDatabase unable to find String
score: 0
tagged with: sqlite
answer count: 1
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21757068
tagged with: java
type: Question

http://stackoverflow.com/comment/33027612
type: Comment
type: QuestionComment
score: 1
has text: possible duplicate of [Server/client not sending or receiving data through socket \[Java\]?](http://stackoverflow.com/questions/21199644/server-client-not-sending-or-receiving-data-through-socket-java) or any number of others. You need the `flush()` if you're not using `println()`
comment on: http://stackoverflow.com/q/21822610

http://stackoverflow.com/comment/32841098
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21717568
has text: the file name the user is inputting is CompuDataSales . I even tried replacing it and having it just read the file without the user input and got the same result

http://stackoverflow.com/a/26882099
has body: Yes, It is possible, if use MultiValueMap headers instead of HttpHeaders Example: MultiValueMap&lt;String, String&gt; headers = new LinkedMultiValueMap&lt;String, String&gt;(); headers.add("Authorization", "Basic " + base64Creds); headers.add("Content-Type", "application/json"); RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); HttpEntity&lt;ObjectToPass&gt; request = new HttpEntity&lt;ObjectToPass&gt;(objectToPassInstance, headers); restTemplate.postForObject(urlPost, request, Boolean.class); Boolean.class just because my controller returns boolean at this endpoint (could be anything) Good luck with coding!
has comment: http://stackoverflow.com/comment/58241391
has comment: http://stackoverflow.com/comment/58242675
has comment: http://stackoverflow.com/comment/58239705
has comment: http://stackoverflow.com/comment/83353283
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/58245403
has comment: http://stackoverflow.com/comment/58245963
answers question: http://stackoverflow.com/q/21723183
upvote count: 75
type: Answer
has comment: http://stackoverflow.com/comment/58237641
has comment: http://stackoverflow.com/comment/79446002
downvote count: 1
has comment: http://stackoverflow.com/comment/58252660
score: 74
accepted answer of: http://stackoverflow.com/q/21723183
has comment: http://stackoverflow.com/comment/83338571
has comment: http://stackoverflow.com/comment/58242321
has comment: http://stackoverflow.com/comment/89938265

file
tags question: http://stackoverflow.com/q/21825820
type: Tag
tags question: http://stackoverflow.com/q/21818211
tags question: http://stackoverflow.com/q/21809517
tags question: http://stackoverflow.com/q/21734508
tags question: http://stackoverflow.com/q/21831552
tag name: file
tags question: http://stackoverflow.com/q/21829272
tags question: http://stackoverflow.com/q/21802238
tags question: http://stackoverflow.com/q/21810275
tags question: http://stackoverflow.com/q/21835097
tags question: http://stackoverflow.com/q/21812683
tags question: http://stackoverflow.com/q/21773270
tags question: http://stackoverflow.com/q/21690220
tags question: http://stackoverflow.com/q/21697669
tags question: http://stackoverflow.com/q/21730776
tags question: http://stackoverflow.com/q/21717568
tags question: http://stackoverflow.com/q/21708229
tags question: http://stackoverflow.com/q/21760240
tags question: http://stackoverflow.com/q/21723533
tags question: http://stackoverflow.com/q/21764299
tags question: http://stackoverflow.com/q/21683463
tags question: http://stackoverflow.com/q/21737644
tags question: http://stackoverflow.com/q/21721658
tags question: http://stackoverflow.com/q/21778786
tags question: http://stackoverflow.com/q/21833356
tags question: http://stackoverflow.com/q/21718588
tags question: http://stackoverflow.com/q/21827789
tags question: http://stackoverflow.com/q/21802173
tags question: http://stackoverflow.com/q/21802680
tags question: http://stackoverflow.com/q/21723967
tags question: http://stackoverflow.com/q/21699231
tags question: http://stackoverflow.com/q/21796055
tags question: http://stackoverflow.com/q/21833854
tags question: http://stackoverflow.com/q/21738673
tags question: http://stackoverflow.com/q/21756613

http://stackoverflow.com/comment/32826866
type: Comment
comment on: http://stackoverflow.com/a/21709601
score: 0
type: AnswerComment
has text: Instead of "If any two given values passed to two different hash functions" you meant to say "If any two given values passed to two different _orthogonal_ hash functions", I believe...

http://stackoverflow.com/a/21761576
has body: Proguard already does it for you, although it's used to make the bytecode smaller. Remember, there is nothing special in your code. You're not the great genius you think you are, so any time you put into this is wasted time. (If you were a genius, you wouldn't be asking this question ;)
answers question: http://stackoverflow.com/q/21761538
upvote count: 2
has comment: http://stackoverflow.com/comment/32941191
has comment: http://stackoverflow.com/comment/32918402
has comment: http://stackoverflow.com/comment/32918666
has comment: http://stackoverflow.com/comment/32918383
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32918680
has comment: http://stackoverflow.com/comment/32918273
type: Answer

http://stackoverflow.com/comment/32961109
type: Comment
comment on: http://stackoverflow.com/a/21784629
has text: Re-read my answer. You just need to put an empty list in the map: `public void addStation(String station) {stations.put(station, new ArrayList<String>());}`. You don't want the station to be connected with itself. So why would you add the station to the list of connected stations?
score: 0
type: AnswerComment

http://stackoverflow.com/a/21770413
score: 2
has comment: http://stackoverflow.com/comment/32956123
has body: your pID is long type, which is 4 bytes, max value is 2^31-1 = 2,147,483,647. So you cannot assign 5.62949953421312E15 to it at pID = rs101.getLong("ProjectId");
answers question: http://stackoverflow.com/q/21770137
upvote count: 3
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/32934673

http://stackoverflow.com/comment/32877139
type: QuestionComment
comment on: http://stackoverflow.com/q/21737876
score: 0
type: Comment
has text: That would be my choice, unfortunately that choice was not offered to me.

http://stackoverflow.com/comment/32861563
has text: Yes, I looked at the source code of ScheduledExecutorService etc, and thought that it should be possible to replace the DelayedWorkQueue with a priority queue. But the infrastructure around that (wrapping all tasks into ScheduledFutureTasks internally, etc) makes this difficult. Depending on the exact requirements, one could consider creating an own ScheduledExecutorService implementation with the desired behavior, but this could be a considerable effort. Maybe someone finds a more simple and elegant solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/21725417
score: 0
type: Comment

nullpointerexception
tags question: http://stackoverflow.com/q/21838971
tags question: http://stackoverflow.com/q/21750934
tags question: http://stackoverflow.com/q/21838871
tags question: http://stackoverflow.com/q/21749662
tags question: http://stackoverflow.com/q/21767127
tags question: http://stackoverflow.com/q/21707062
tags question: http://stackoverflow.com/q/21840642
type: Tag
tags question: http://stackoverflow.com/q/21818915
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/21703836
tags question: http://stackoverflow.com/q/21721154
tags question: http://stackoverflow.com/q/21697967
tags question: http://stackoverflow.com/q/21733925
tags question: http://stackoverflow.com/q/21715057
tags question: http://stackoverflow.com/q/21792140
tags question: http://stackoverflow.com/q/21799226
tags question: http://stackoverflow.com/q/21819264
tags question: http://stackoverflow.com/q/21710660
tags question: http://stackoverflow.com/q/21800427
tags question: http://stackoverflow.com/q/21736494
tags question: http://stackoverflow.com/q/21841159
tags question: http://stackoverflow.com/q/21736293
tags question: http://stackoverflow.com/q/21712513
tags question: http://stackoverflow.com/q/21694455
tags question: http://stackoverflow.com/q/21831723
tags question: http://stackoverflow.com/q/21773836
tags question: http://stackoverflow.com/q/21771624
tags question: http://stackoverflow.com/q/21837640
tags question: http://stackoverflow.com/q/21746658
tags question: http://stackoverflow.com/q/21836087

http://stackoverflow.com/comment/32882425
has text: tried with parenthesis with the same error. I did one work around though which is working for me. I set the empty lists to null before i create the query. So the query is working with this logic and with null check. May be something to do with empty list being passed to JPA query creation.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21737261

http://stackoverflow.com/comment/33036540
type: Comment
comment on: http://stackoverflow.com/a/21824834
type: AnswerComment
score: 28
has text: It will work, but I don't like that kind of approach (Wrappper) because then it seems Pegasus HAS a horse, instead it IS a horse.

http://stackoverflow.com/comment/32870362
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21734573
type: Comment
has text: Well, make the variable a class member and make a setter for it.

http://stackoverflow.com/q/21822388
has title: Number Guessing Game Over Intervals
type: Question
has body: I have just started my long path to becoming a better coder on CodeChef. People begin with the problems marked 'Easy' and I have done the same. The Problem The problem statement defines the following -: n, where 1 &lt;= n &lt;= 10^9. This is the integer which Johnny is keeping secret. k, where 1 &lt;= k &lt;= 10^5. For each test case or instance of the game, Johnny provides exactly k hints to Alice. A hint is of the form op num Yes/No, where - op is an operator from &lt;, &gt;, =. num is an integer, again satisfying 1 &lt;= num &lt;= 10^9. Yes or No are answers to the question: Does the relation n op num hold? If the answer to the question is correct, Johnny has uttered a truth. Otherwise, he is lying. Each hint is fed to the program and the program determines whether it is the truth or possibly a lie. My job is to find the minimum possible number of lies. Now CodeChef's Editorial answer uses the concept of segment trees, which I cannot wrap my head around at all. I was wondering if there is an alternative data structure or method to solve this question, maybe a simpler one, considering it is in the 'Easy' category. This is what I tried -: class Solution //Represents a test case. { HashSet&lt;SolutionObj&gt; set = new HashSet&lt;SolutionObj&gt;(); //To prevent duplicates. BigInteger max = new BigInteger("100000000"); //Max range. BigInteger min = new BigInteger("1"); //Min range. int lies = 0; //Lies counter. void addHint(String s) { String[] vals = s.split(" "); set.add(new SolutionObj(vals[0], vals[1], vals[2])); } void testHints() { for(SolutionObj obj : set) { //Given number is not in range. Lie. if(obj.bg.compareTo(min) == -1 || obj.bg.compareTo(max) == 1) { lies++; continue; } if(obj.yesno) { if(obj.operator.equals("&lt;")) { max = new BigInteger(obj.bg.toString()); //Change max value } else if(obj.operator.equals("&gt;")) { min = new BigInteger(obj.bg.toString()); //Change min value } } else { //Still to think of this portion. } } } } class SolutionObj //Repr…
downvote count: 2
possible better answer: http://stackoverflow.com/a/21823177
tagged with: range
accepted answer: http://stackoverflow.com/a/21823169
has answer: http://stackoverflow.com/a/21823557
tagged with: java
answer count: 3
upvote count: 1
tagged with: algorithm
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21823177
has comment: http://stackoverflow.com/comment/33027672
has answer: http://stackoverflow.com/a/21823169
favorite count: 0
score: -1

http://stackoverflow.com/comment/33059630
type: QuestionComment
has text: I made the edit to my question. I want to, for the sake of doing it.
comment on: http://stackoverflow.com/q/21840818
score: 0
type: Comment

http://stackoverflow.com/comment/32812621
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21701398
has text: Hi Daniel, I have added my code snippet. hope you can view it.
score: 0

swt
tags question: http://stackoverflow.com/q/21837250
tags question: http://stackoverflow.com/q/21722554
tags question: http://stackoverflow.com/q/21708321
tags question: http://stackoverflow.com/q/21760988
tags question: http://stackoverflow.com/q/21749604
tags question: http://stackoverflow.com/q/21782604
tags question: http://stackoverflow.com/q/21779290
tags question: http://stackoverflow.com/q/21776282
tags question: http://stackoverflow.com/q/21763994
tags question: http://stackoverflow.com/q/21797935
tags question: http://stackoverflow.com/q/21836968
tags question: http://stackoverflow.com/q/21769134
tags question: http://stackoverflow.com/q/21774088
tags question: http://stackoverflow.com/q/21704932
tags question: http://stackoverflow.com/q/21727182
tags question: http://stackoverflow.com/q/21824587
tags question: http://stackoverflow.com/q/21719351
tags question: http://stackoverflow.com/q/21832199
tags question: http://stackoverflow.com/q/21686475
type: Tag
tags question: http://stackoverflow.com/q/21698420
tags question: http://stackoverflow.com/q/21745814
tags question: http://stackoverflow.com/q/21728506
tags question: http://stackoverflow.com/q/21747384
tags question: http://stackoverflow.com/q/21778495
tag name: swt
tags question: http://stackoverflow.com/q/21832571
tags question: http://stackoverflow.com/q/21723280

http://stackoverflow.com/a/21745599
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21724468
has body: The answer is as below public static void main(String[] args) throws Throwable { XMLEventWriter eventWriter; XMLEventFactory eventFactory; XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); eventWriter = outputFactory.createXMLEventWriter(bos); eventFactory = XMLEventFactory.newInstance(); XMLEvent newLine = eventFactory.createDTD("\n"); // Create and write Start Tag StartDocument startDocument = eventFactory.createStartDocument(); eventWriter.add(startDocument); eventWriter.add(newLine); StartElement configStartElement = eventFactory.createStartElement("","","Message"); eventWriter.add(configStartElement); eventWriter.add(newLine); XMLInputFactory inputFactory = XMLInputFactory.newFactory(); PatientDetails patientDetails= new PatientDetails();// Here I have called an POJO that return String and we add String xml = patientDetails.getPatientDetails(); Source src = new StreamSource(new java.io.StringReader(xml)); XMLEventReader test = inputFactory.createXMLEventReader(src); while(test.hasNext()){ XMLEvent event= test.nextEvent(); //avoiding start(&lt;?xml version="1.0"?&gt;) and end of the documents; if (event.getEventType()!= XMLEvent.START_DOCUMENT &amp;&amp; event.getEventType() != XMLEvent.END_DOCUMENT) eventWriter.add(event); // eventWriter.add(newLine); test.close(); } //end of while eventWriter.add(eventFactory.createEndElement("", "", "Message")); eventWriter.add(newLine); eventWriter.add(eventFactory.createEndDocument()); eventWriter.close(); System.out.println(bos.toString()); }//end of main

http://stackoverflow.com/q/21791489
possible better answer: http://stackoverflow.com/a/21791530
has body: My jar file is working on the development machine but won't execute on test pc. I checked and found out that there is no jdk installed and I do not have installation rights on that specific PC. Is the lack of JDK the reason why I won't get a result? Here is what I got. C:\Users\autosterileprocuser&gt;java -jar C:\Users\autosterileprocuser\Documents\Sc hedule.jar Exception in thread "main" java.lang.UnsupportedClassVersionError: sterileProc/S cheduleApp : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Could not find the main class: sterileProc.ScheduleApp. Program will exit.
has answer: http://stackoverflow.com/a/21791530
type: Question
has answer: http://stackoverflow.com/a/21791586
tagged with: jar
has answer: http://stackoverflow.com/a/21791593
accepted answer: http://stackoverflow.com/a/21791593
score: 0
answer count: 4
has title: Jar File is not executing on test pc
has answer: http://stackoverflow.com/a/21791590
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32972302
tagged with: java

http://stackoverflow.com/q/21813680
answer count: 2
downvote count: 0
favorite count: 0
has body: I'm using the skin from libgdx tests: uiskin.json. For some reason the checkbox is displayed much smaller as f.e. in badlogic/gdx/tests/MipMapTest.java What does the size of the Checkbox depend on? the camera's resolution? Or is there a way to set it manually? Helper.RESOLUTION_WIDTH = 800 and Helper.RESOLUTION_HEIGHT = 1280 @Override public void show() { skin = new Skin(Gdx.files.internal("skins/uiskin.json")); cam = new OrthographicCamera(Helper.RESOLUTION_WIDTH, Helper.RESOLUTION_HEIGHT); cam.position.set(Helper.RESOLUTION_WIDTH / 2, Helper.RESOLUTION_HEIGHT / 2, 0); stage = new Stage(Helper.RESOLUTION_WIDTH, Helper.RESOLUTION_HEIGHT, true); stage.setCamera(cam); CheckBox checkBox1 = new CheckBox("", skin); checkBox1.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { game.setScreen(new WinScreen2a(game)); } }); CheckBox checkBox2 = new CheckBox("", skin); checkBox2.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { game.setScreen(new WinScreen2b(game)); } }); Window window = new Window("Dialog", skin); window.debug(); window.setPosition(Helper.RESOLUTION_WIDTH/2 - 375, 10); window.setSize(750, 350); table.add(checkBox1).left(); table.getCells().get(0).size(200, 100); table.add(option1).width(500).height(100).pad(10f); table.row(); table.add(checkBox2).left(); table.getCells().get(2).size(200, 100); table.add(option2).width(500).height(100).pad(10f); table.row(); window.add(table).top().left(); stage.addActor(window);
has answer: http://stackoverflow.com/a/57166350
has title: How can I change the size of the CheckBox image of LibGdx?
type: UnansweredQuestion
upvote count: 1
tagged with: libgdx
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/38216828
type: Question

http://stackoverflow.com/q/21815612
answer count: 0
has body: I can't get the addHeaders method to work when using HttpPost in Java/Android. This is what I doing in the Android app: HttpClient client = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Accept-Encoding", "gzip"); StringEntity entity = new StringEntity(jsonString, HTTP.UTF_8); httpPost.setEntity(entity); HttpResponse resp = client.execute(httpPost); and this is what I see on the server-side (in Wireshark): As you can see, there is no sign of any "Accept-Encoding". If I break in the C#-server and look at the WebOperationContext.Current.IncomingRequest, then it's also missing there: It doesn't matter what headers I add, they simply don't show up.
tagged with: java
type: Question
tagged with: c#
tagged with: http-headers
has comment: http://stackoverflow.com/comment/33015161
score: 0
has comment: http://stackoverflow.com/comment/33015439
has title: HttpPost addHeader does not work - headers are untouched
has comment: http://stackoverflow.com/comment/33015159
has comment: http://stackoverflow.com/comment/49616528
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33015181

http://stackoverflow.com/a/21706004
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21705151
has body: The safer solution than an unchecked cast: public &lt;T extends Result&gt; T execute(Command&lt;T&gt; command, Class&lt;T&gt; cls) { return cls.cast(new LoginResult()); } LoginResult result = execute(loginCommand, LoginResult.class); The rationale behind having both parameters is that the contract of execute is implied to be: Either use a method of Command to obtain a result of type T to return it. Or create a result in some other way, but ensure it is of type T by downcasting it. With Java's generics, only parameters to a generic method of the form &lt;T&gt; T foo(Bar&lt;T&gt;, Baz&lt;T&gt;) can safely "create" an object of the type T. Thus, if in your case, you're not creating the result using the command parameter, you need another parameter that can take care of the type check.
upvote count: 1
has comment: http://stackoverflow.com/comment/32995850
has comment: http://stackoverflow.com/comment/32976048

http://stackoverflow.com/q/21825667
tagged with: bytebuffer
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21825779
has title: Java NIO Pipe and ByteBuffer
score: 2
upvote count: 2
has body: I'm trying to pipe some ByteBuffer in a thread (IO1) to another (IO2). http://tutorials.jenkov.com/java-nio/pipe.html private int bufferSize; private boolean isRecording; private Thread IO1; private Thread IO2; private ByteBuffer byteBuffer1; private ByteBuffer byteBuffer2; private Pipe pipe; private Pipe.SinkChannel skChannel; private Pipe.SourceChannel sourceChannel; byteBuffer1 = ByteBuffer.allocateDirect(bufferSize); byteBuffer2 = ByteBuffer.allocateDirect(bufferSize); //An instance of Pipe is created try { pipe = Pipe.open(); skChannel = pipe.sink(); sourceChannel = pipe.source(); IO1.start(); IO2.start(); } catch (IOException e) { e.printStackTrace(); } -- IO1 = new Thread(new Runnable() { public void run() { isRecording = true; recorder.startRecording(); try { int read; while (isRecording) { // byteBuffer1.clear(); read = recorder.read(byteBuffer1, bufferSize); if (AudioRecord.ERROR_INVALID_OPERATION != read) { skChannel.write(byteBuffer1); Log.v("========IO1 ", String.valueOf(read)); //This triggered almost 20 times/second } } recorder.stop(); } catch (Exception e) { e.printStackTrace(); } } }); skChannel.write(byteBuffer1); and Log.v("========IO1 ", String.valueOf(read)); is triggered almost 20 times/second, and this is the expected behavior, so far so good. IO2 = new Thread(new Runnable() { public void run() { try { int read; while ( (read =sourceChannel.read(byteBuffer2)) &gt;0) { Log.v("========IO2 ", String.valueOf(read)); //this triggered only once // To do Codec etc. //............ } } catch (IOException e) { e.printStackTrace(); } Log.v("========IO2 ", "END!!!!!"); //never triggered(this is fine) } }); However, Log.v("========IO2 ", String.valueOf(read)); is triggered only once, and I don't know why. Can someone tell me how can I obtain the update of Thread IO1 in IO2? Thanks.
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/21804390

http://stackoverflow.com/a/59232095
answers question: http://stackoverflow.com/q/21714964
score: 1
upvote count: 1
has body: tl;dr LocalDate .of( 2020 , Month.JANUARY , 20 ) .minusMonths( 1 ) java.time The modern approach uses the java.time classes that years ago supplanted the terrible Calendar &amp; Date classes. For a date-only value, without time-of-day and without time zone, use LocalDate. LocalDate localDate = LocalDate.of( 2020 , Month.JANUARY , 20 ) ; To do date-math, call the plus… &amp; minus… methods. LocalDate monthAgo = localDate.minusMonths( 1 ) ; // Get same day-of-month in the previous month. Or use a Period to represent a span-of-time unattached to the timeline. Period p = Period.ofMonths( 1 ) ; LocalDate earlier = localDate.minus( p ) ; About java.time The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, &amp; SimpleDateFormat. To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310. The Joda-Time project, now in maintenance mode, advises migration to the java.time classes. You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.* classes. Where to obtain the java.time classes? Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later - Part of the standard Java API with a bundled implementation. Java 9 adds some minor features and fixes. Java SE 6 and Java SE 7 Most of the java.time functionality is back-ported to Java 6 &amp; 7 in ThreeTen-Backport. Android Later versions of Android bundle implementations of the java.time classes. For earlier Android (&lt;26), the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP…. The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval, YearWeek, YearQuarter, and more.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32805018
score: 1
type: Comment
has text: `c.getString(iKEY_TMPTYPE)` and `temptype` is String ? then use `equalsIgnoreCase` instead of ==
type: QuestionComment
comment on: http://stackoverflow.com/q/21697855

http://stackoverflow.com/a/21713535
downvote count: 0
has comment: http://stackoverflow.com/comment/32834063
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/21713497
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21713497
type: Answer
has body: You didn't provide a type parameter for Observable in your extends clause for Subject. Since you declared Observable&lt;T&gt; in that class, you should declare: public class Subject extends Observable&lt;Subject&gt; { ... }

http://stackoverflow.com/a/21766744
has body: This is my quick hack: a function to truncate a string to given number of bytes in UTF-8 encoding: public static String truncateUtf8(String original, int byteCount) { if (original.length() * 3 &lt;= byteCount) { return original; } StringBuilder sb = new StringBuilder(); int count = 0; for (int i = 0; i &lt; original.length(); i++) { char c = original.charAt(i); int newCount; if (c &lt;= 0x7f) newCount = count + 1; else if (c &lt;= 0x7ff) newCount = count + 2; else newCount = count + 3; if (newCount &gt; byteCount) { break; } count = newCount; sb.append(c); } return sb.toString(); } It does not work as expected for characters outside of BMP – counts them as 6 bytes instead of 4. It may also break grapheme clusters. But for most simple tasks it should be OK. truncateUtf8("e", 1) =&gt; "e" truncateUtf8("ée", 1) =&gt; "" truncateUtf8("ée", 2) =&gt; "é" truncateUtf8("ée", 3) =&gt; "ée"
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21764883
downvote count: 0
score: 1

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/21829398
tag name: google-oauth
tags question: http://stackoverflow.com/q/21825605

http://stackoverflow.com/comment/32784407
comment on: http://stackoverflow.com/a/21685887
has text: "This parsing operation uses the calendar to produce a Date. As a result, the calendar's date-time fields and the TimeZone value may have been overwritten, depending on subclass implementations. Any TimeZone value that has previously been set by a call to setTimeZone may need to be restored for further operations." http://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html#parse%28java.lang.String,%20java.text.ParsePosition%29 (Knew it had to be there somewhere..)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/69212464
type: Comment
comment on: http://stackoverflow.com/a/37478938
has text: Received the same error and this checked out - make sure you're not "expecting" the same same call twice. I was editing a unit test and didn't realize something was mocked before it.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21809124
has comment: http://stackoverflow.com/comment/33004066
has comment: http://stackoverflow.com/comment/33003813
has comment: http://stackoverflow.com/comment/33003986
type: Answer
has comment: http://stackoverflow.com/comment/33004191
answers question: http://stackoverflow.com/q/21809013
has comment: http://stackoverflow.com/comment/33004129
has body: java.io.IOException: Unable to create the directory [/usr/share/tomcat7/webapps/ROOT/META-INF] Make sure that the user that you are using to start/stop the tomcat server has proper read/write privileges in the directory /usr/share/ directory.
score: 0

http://stackoverflow.com/comment/32932257
comment on: http://stackoverflow.com/q/21769026
has text: Your two examples are fundamentally different. What are you trying to achieve?
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/21731174
tagged with: xslt
type: Question
score: 1
tagged with: java
has title: Where is XSLProcessorContext in the JAXP
downvote count: 0
tagged with: xalan
favorite count: 0
tagged with: jaxp
type: UnansweredQuestion
has body: I would like to get rid of xalan.jar (version 2.7.0) dependency in one of our old projects and use xalan which is included into JRE 1.7.0_51. However there is an extension java class in that project which imports org.apache.xalan.extensions.XSLProcessorContext and org.apache.xalan.templates.ElemExtensionCall classes. I cannot find those classes in the JRE and I cannot figure out where the problem is. Does Oracle include just a part of xalan into JRE or those classes are already depreciated and now the custom mapping should be done differently?
has comment: http://stackoverflow.com/comment/32864294
answer count: 0
upvote count: 1

http://stackoverflow.com/comment/40484876
type: QuestionComment
has text: My colleague recently upgraded from 3.x to 4.2f. I remember him mentioning need to upgrade to 4.0 first and later to 4.2f. Simple googling says that other things require this, but I'm curious what you say about this?
score: 1
comment on: http://stackoverflow.com/q/21733439
type: Comment

http://stackoverflow.com/comment/32973576
comment on: http://stackoverflow.com/q/21792237
score: 1
has text: There's http headers for last-modified and whatnot, but the only way you'll GET those headers is by polling the web site. Some sites may offer a "push" version to notify of changes (e.g. like SO does for updates/messages), but that's a per-site thing, and not in any way "standard".
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21750709
answers question: http://stackoverflow.com/q/21749756
type: Answer
has body: you may delete the enum Faces you already have and add the following method to class Card: public String getFace(int rank){ String result = ""; switch (rank){ case 11: result = "Jack"; break; case 12: result = "QUEEN"; break; case 13: result = "KING"; break; case 14: result = "ACE"; break; default:{ result = Integer.toString(rank); break; } } return result; } and modify your format() method to look like this: public String format(){ return String.format("%s of %s, ", getFace(getRank()), getSuit()); } This will do the job ;-)
score: 0

http://stackoverflow.com/q/21813005
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/21813334
answer count: 1
has comment: http://stackoverflow.com/comment/33010648
tagged with: servlets
has comment: http://stackoverflow.com/comment/33010342
tagged with: jstl
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
score: 1
has title: Multiple Params in JSP Include
favorite count: 0
has answer: http://stackoverflow.com/a/21813334
tagged with: el
type: Question
has comment: http://stackoverflow.com/comment/33010711
linked to: http://stackoverflow.com/q/9110148
has body: This line: /${initParam['webinf']}${initParam['test']}header.jsp Prints out: /WEB-INF/test/header.jsp and if I copy this into: &lt;%@ include file="/WEB-INF/test/header.jsp" %&gt; it works perfectly. However, if I use the first line of code directly in the statement like this: &lt;%@ include file="/${initParam['webinf']}${initParam['test']}header.jsp" %&gt; I get the error: Sun Feb 16 15:03:56 GMT 2014: org.apache.jasper.JasperException: /WEB-INF/test/index.jsp (line: 10, column: 9) File "/${initParam['webinf']}${initParam['test']}header.jsp" not found

http://stackoverflow.com/a/21703321
has comment: http://stackoverflow.com/comment/32844444
type: Answer
has body: Try using External Interface if target is Flash Player For more info please see External Interface. AS3 code is like so, ExternalInterface.addCallback("yourJavaFunction", yourAS3Function); fscommand("someMessage to Java container from AS3");
has comment: http://stackoverflow.com/comment/32848704
score: 0
answers question: http://stackoverflow.com/q/21697482

jboss
tags question: http://stackoverflow.com/q/21756059
tags question: http://stackoverflow.com/q/21701154
tags question: http://stackoverflow.com/q/21765334
tags question: http://stackoverflow.com/q/21682869
tags question: http://stackoverflow.com/q/21748229
tag name: jboss
tags question: http://stackoverflow.com/q/21745356
type: Tag
tags question: http://stackoverflow.com/q/21773997
tags question: http://stackoverflow.com/q/21695442
tags question: http://stackoverflow.com/q/21751865
tags question: http://stackoverflow.com/q/21718997
tags question: http://stackoverflow.com/q/21756707
tags question: http://stackoverflow.com/q/21769785
tags question: http://stackoverflow.com/q/21837506
tags question: http://stackoverflow.com/q/21698478
tags question: http://stackoverflow.com/q/21687646
tags question: http://stackoverflow.com/q/21831672
tags question: http://stackoverflow.com/q/21738420
tags question: http://stackoverflow.com/q/21700284
tags question: http://stackoverflow.com/q/21681007
tags question: http://stackoverflow.com/q/21790827
tags question: http://stackoverflow.com/q/21703704
tags question: http://stackoverflow.com/q/21814672
tags question: http://stackoverflow.com/q/21700645
tags question: http://stackoverflow.com/q/21771225
tags question: http://stackoverflow.com/q/21770923
tags question: http://stackoverflow.com/q/21720261

http://stackoverflow.com/comment/32973759
type: QuestionComment
comment on: http://stackoverflow.com/q/21792215
score: 0
type: Comment
has text: @B.J.Smegma it runs, no bugs. But when I end the application and reopen it my timers are lost.

http://stackoverflow.com/a/21721305
upvote count: 217
has comment: http://stackoverflow.com/comment/32857362
downvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32847919
type: Answer
has comment: http://stackoverflow.com/comment/32856901
has comment: http://stackoverflow.com/comment/112247223
has comment: http://stackoverflow.com/comment/32847846
has body: An executable jar file is just a jar file containing a Main-Class entry in its manifest. So you just need to configure the jar task in order to add this entry in its manifest: jar { manifest { attributes 'Main-Class': 'com.foo.bar.MainClass' } } You might also need to add classpath entries in the manifest, but that would be done the same way. See http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html If you already have defined an application context, you can re-use the definition rather than duplicate it: application { // Define the main class for the application. mainClass = 'com.foo.bar.MainClass' } jar { manifest { attributes 'Main-Class': application.mainClass } }
answers question: http://stackoverflow.com/q/21721119
has comment: http://stackoverflow.com/comment/100120011
has comment: http://stackoverflow.com/comment/63226124
score: 214
accepted answer of: http://stackoverflow.com/q/21721119
has comment: http://stackoverflow.com/comment/32850399

http://stackoverflow.com/a/26884358
type: Answer
answers question: http://stackoverflow.com/q/21793337
score: 0
has body: Yes, jnetpcap supports wireless packets. In general, it supports all the interfaces provided by devices e.g. wlan0, eth0. But you do not need to specify anything about wireless or wired information if you are reading packets from a pcap file, all you need to do is to use the pcap function Pcap.openOffline("path_of_pcap_file/file_name.pcap", StringBuilder errMsg) to create the handle to read packets. where errMsg is a object to know any error happened while Refer more about this function from jnetpcap documentation http://jnetpcap.com/?q=node/68 If you have done the same thing as I mentioned and still have some error, read the errMsg after the above function call. Here to help..

http://stackoverflow.com/q/21801593
score: 0
has comment: http://stackoverflow.com/comment/32990231
has body: I am new to the world of J2ee using Tomcat, so pardon me for my noobness. At Tomcat start-up, all the war files deployed gets enabled. What do I need to do if I want some of them to be enabled at start up and start the rest of the wars later as per my convenience? There should be something which tells tomcat to enable the wars right[modifying which I might set the start-up settings of an application manual/automatic like that we do for windows services in services.msc]? What I'm looking for is, if there are 3 different apps deployed in tomcat, I should be able to instruct tomcat that at Tomcat start-up, only app1 should start. I will manually turn up app2 and app3 as and when I need it. Like configuring the start up of apps with options like "manual"/"automatic" Thanks in advance.
has comment: http://stackoverflow.com/comment/32989799
has comment: http://stackoverflow.com/comment/32990138
has comment: http://stackoverflow.com/comment/32990326
answer count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: java
type: Question
has title: How to dynamically enable war files deployed in Tomcat6+
linked to: http://stackoverflow.com/q/809775
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32989817

http://stackoverflow.com/comment/32800325
score: 0
type: Comment
type: QuestionComment
has text: Did you consider removing the undesired part in the string (or capturing the desired part) after reading the complete line?
comment on: http://stackoverflow.com/q/21695100

http://stackoverflow.com/a/21699582
answers question: http://stackoverflow.com/q/21699463
has body: just add this permission into your manifest.xml file: &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
score: 0
type: Answer

http://stackoverflow.com/q/21701229
upvote count: 15
has answer: http://stackoverflow.com/a/36144323
downvote count: 0
possible better answer: http://stackoverflow.com/a/36144323
type: AnsweredQuestion
favorite count: 0
has body: I have maven profile set for testing where in pre-integration-tests maven starts two jetty servers and afterwards tests are started. The problem I've stumbled into is in the servers, they aren't fully loaded when tests start. It seems like the problem is fixed by adding 5 second sleep time into the tests, but I wish to add it in maven and remove from tests. Is there anyway I could do that? Please look into code sample below for additional information org.apache.maven.plugins maven-dependency-plugin 2.7 copy compile copy com.work.projectname projectname-web ${project.version} war projectname-${project.version}.war com.work.projectname projectname-stubs-web ${project.version} war projectname-stubs-${project.version}.war ${project.build.directory} false true org.apache.maven.plugins maven-surefire-plugin 2.16 true org.mortbay.jetty jetty-maven-plugin ${jetty-server.version} start-projectname pre-integration-test deploy-war true manual ${project.build.directory}/projectname-${project.version}.war ${basedir}/src/jetty/jetty-loginService.xml /projectname true ${project.build.directory}/tmp-projectname 8006 STOP start-projectname-stubs pre-integration-test deploy-war true manual ${project.build.directory}/projectname-stubs-${project.version}.war ${stub-jetty-server.port} 300000 8008 STOP stop-projectname post-integration-test stop 8006 STOP stop-projectname-stubs post-integration-test stop 8008 STOP org.apache.maven.plugins maven-failsafe-plugin 2.16 classes 33 **/*Test.java integration-test integration-test verify verify
has answer: http://stackoverflow.com/a/21701378
type: Question
answer count: 2
tagged with: jetty
tagged with: maven
score: 15
tagged with: java
accepted answer: http://stackoverflow.com/a/21701378
has title: Is there any maven sleep functionality?

http://stackoverflow.com/comment/33026234
type: AnswerComment
score: 0
has text: Matter of taste IMHO, this is more "introspection" than "reflection". I see a problem with reflection when you use it to do stuff you are not supposed to do directly (like access a private field, ...)
type: Comment
comment on: http://stackoverflow.com/a/21821863

http://stackoverflow.com/a/70896760
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/21753267
downvote count: 0
has body: In my case, i was running with intellij cucumber for java plugin, it doesnt automatically detect the glue, so you need to add it. Run -&gt; Edit Configurations Then on the Glue section, put the steps folder path.
type: Answer

http://stackoverflow.com/comment/32875574
type: Comment
has text: I had to change the code a bit to make it work before, I am going to paste it above in my post. Now it won't get disabled.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21732737

http://stackoverflow.com/a/21727292
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/32914658
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/32856949
has body: As per JMS specs JMS defines that messages sent by a session to a destination must be received in the order in which they were sent. This defines a partial ordering constraint on a session’s input message stream. JMS does not define order of message receipt across destinations or across a destination’s messages sent from multiple sessions. This aspect of a session’s input message stream order is timing-dependent. It is not under application control. Also Although clients loosely view the messages they produce within a session as forming a serial stream of sent messages, the total ordering of this stream is not significant. The only ordering that is visible to receiving clients is the order of messages a session sends to a particular destination. Several things can affect this order like message priority, persistent/non persistent etc. So to answer your question it is not really JMS provider specific what order messages are received. They will be received in the same order they were sent with above information. The order in which messages are delivered to the server however will be constrained by limitations like message priority, persistent/non persistent etc.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21727084
answers question: http://stackoverflow.com/q/21727084
has comment: http://stackoverflow.com/comment/32856903

http://stackoverflow.com/a/73071760
has body: In my case, I did the operation of deleting the entity before the operation of deleting (changing) records in the database containing the already deleted entity. Just swapping operations around helped.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21727573

http://stackoverflow.com/a/21684634
has comment: http://stackoverflow.com/comment/32783919
has body: use JTextField with these methods : setBackground() and setForeground() . Or override the paintcomponent(graphics g) function of Jpanel and use the graphic class to draw text on it try this import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JTextField; public class frame extends JFrame { JTextField txt; frame() { txt = new JTextField("Text goes here"); txt.setBackground(Color.black); txt.setFont(new Font("verdana", Font.BOLD, 30)); txt.setForeground(Color.white); add(txt); setVisible(true); pack(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] arg) { new frame(); } }
answers question: http://stackoverflow.com/q/21684503
type: Answer
has comment: http://stackoverflow.com/comment/32782980
has comment: http://stackoverflow.com/comment/32783591
has comment: http://stackoverflow.com/comment/32783639
score: 0
has comment: http://stackoverflow.com/comment/32783528
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21684503

ondraw
type: Tag
tag name: ondraw
tags question: http://stackoverflow.com/q/21746658

http://stackoverflow.com/comment/32904821
score: 1
comment on: http://stackoverflow.com/q/21754078
type: QuestionComment
type: Comment
has text: It would be easier to know how to read the file if you showed the code used to write it.

http://stackoverflow.com/a/21732216
type: Answer
answers question: http://stackoverflow.com/q/21731213
has comment: http://stackoverflow.com/comment/32868236
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32867374
type: AcceptedAnswer
downvote count: 0
has body: Because paint is a method in JApplet, when you override it, you need to call super.paint(g) so that the parent component can still do it's painting. Your paint method should look something more like this: @Override public void paint(Graphics g) { super.paint(g); g.drawString("Registration Form", 195, 10); }
accepted answer of: http://stackoverflow.com/q/21731213
has comment: http://stackoverflow.com/comment/32868291

http://stackoverflow.com/comment/33000564
has text: Within the class, you should use whatever is easier
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21807474

http://stackoverflow.com/comment/33007923
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21811667
has text: What did you try? Suggestion: try splitting the array on values `' '`.

http://stackoverflow.com/comment/32821960
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21702427
has text: There's a link labeled "Source Code" near the top right of the page, which will open a popup window with the source.

http://stackoverflow.com/q/21695193
answer count: 6
has comment: http://stackoverflow.com/comment/32800500
has answer: http://stackoverflow.com/a/21695297
has body: Many times, I run in a situation where I have a option to either return a bool or void. For example consider the case: public (return_type) updateQueryStats(String ident, Double execTime) { Double newAvgTime; //calculate average query time. avgTime.put(ident, newAvgTime); //return true; } Let us say that these are to be used as API or library by other users. Although both are functionally same, which one is a better practice.
favorite count: 0
tagged with: return-type
has title: preferable return type: void or bool
has comment: http://stackoverflow.com/comment/32800528
tagged with: c++
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21695297
has answer: http://stackoverflow.com/a/21700167
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21695332
has answer: http://stackoverflow.com/a/21695239
has comment: http://stackoverflow.com/comment/32800435
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21695213
has answer: http://stackoverflow.com/a/21695324
has answer: http://stackoverflow.com/a/21695213

http://stackoverflow.com/comment/32893634
type: QuestionComment
comment on: http://stackoverflow.com/q/21747363
has text: edited my original post to include the compile error
score: 0
type: Comment

http://stackoverflow.com/q/21767251
type: Question
has comment: http://stackoverflow.com/comment/32928904
has answer: http://stackoverflow.com/a/21767302
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21788461
has body: We can use the Collections.synchronizedCollection(Collection c) for all objects of type Collection like Set and List right, why we have separate methods like - Collections.synchronizedList or Collections.synchronizedSet.
type: UnansweredQuestion
has title: What is difference between Collections.synchronizedCollection and Collections.synchronizedList or Collections.synchronizedSet
tagged with: java
tagged with: collections
has answer: http://stackoverflow.com/a/21767286

http://stackoverflow.com/comment/32983651
type: QuestionComment
score: 1
has text: Recursion isn't an appropriate technique for this.
comment on: http://stackoverflow.com/q/21798202
type: Comment

http://stackoverflow.com/comment/33026431
has text: `StringBuffer.toString().replaceAll(...)`?
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/21822060

http://stackoverflow.com/a/21854413
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33083047
accepted answer of: http://stackoverflow.com/q/21824367
answers question: http://stackoverflow.com/q/21824367
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/33083499
score: 2
has comment: http://stackoverflow.com/comment/33090595
has comment: http://stackoverflow.com/comment/33090735
has body: In theory yes. You have to define and create an API in playn and them you have to code the implementation for each platform. The implementation in android should be easy, since you just use java for android, but for ios, you have to consider that playn uses MonoTouch to compile from java to native, I think they support WebView so you can go with it. Obviously the simplest implementation is the html5 one through gwt.

http://stackoverflow.com/comment/33056554
comment on: http://stackoverflow.com/a/21839052
has text: I applied the string to the label and tthen add that label to the position `fixtureDescLabel.setBounds(250, 150, 200, 40);` and then I displayed it by using `add(fixtureDescLabel);`
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21793231
score: 0
answers question: http://stackoverflow.com/q/21793202
has body: Your checking whether the vYourName string equals to something before you even read it. Furthermore, you should use the .equals() method instead of the ==.
type: Answer

http://stackoverflow.com/a/21701097
answers question: http://stackoverflow.com/q/21699745
score: 0
has body: the @XMLRootElement is the way to do that since the json must be unmarshaled before you can use any of its elements.
type: Answer

http://stackoverflow.com/q/21782604
tagged with: jface
score: 2
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/21782691
has comment: http://stackoverflow.com/comment/32955742
tagged with: swt
tagged with: treeviewer
type: Question
has body: How to expand TreeViewer programmatically? If I use underlying Tree.setExpanded(true), action1 = new Action() { public void run() { viewer.getTree().getItems()[0].setExpanded(true); } }; element does not appear: If I use mouse clicks, branch expands ok.
has answer: http://stackoverflow.com/a/21782691
tagged with: java
has title: How to expand TreeViewer programmatically?
upvote count: 2
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/32970755
has text: Are you grabbing pixel values at arbitrary points on the screen? IE not inside a Swing/AWT component. (Judging by your use of Robot this seems to be what you're doing.)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21790621
score: 0

eclipse-emf
tags question: http://stackoverflow.com/q/21832567
tag name: eclipse-emf
tags question: http://stackoverflow.com/q/21716052
type: Tag

http://stackoverflow.com/q/21717426
tagged with: int
has comment: http://stackoverflow.com/comment/32840958
has comment: http://stackoverflow.com/comment/32840793
answer count: 3
has answer: http://stackoverflow.com/a/21717495
favorite count: 0
possible better answer: http://stackoverflow.com/a/21717604
linked to: http://stackoverflow.com/q/269669
has answer: http://stackoverflow.com/a/21717604
downvote count: 2
has comment: http://stackoverflow.com/comment/32840931
has body: So I already have this whole entire class done in Int and now I had to convert it to BigInteger. Main objective is so I can store the coefficients as the BigIntegers for large coefficients. I am getting a null pointer error with the code but I knew that BigInteger was immutable and needed that format. Just maybe another eye or maybe I'm just not doing this correctly. public class Polynomial { private BigInteger[] coef; // coefficients private int deg; // degree of polynomial (0 for the zero polynomial) /** Creates the constant polynomial P(x) = 1. */ public Polynomial(){ coef = new BigInteger[1]; coef[0] = BigInteger.valueOf(1); deg = 0; } /** Creates the linear polynomial of the form P(x) = x + a. */ public Polynomial(int a){ coef = new BigInteger[2]; coef[1] = BigInteger.valueOf(1); coef[0] = BigInteger.valueOf(a); deg = 1; } /** Creates the polynomial P(x) = a * x^b. */ public Polynomial(int a, int b) { coef = new BigInteger[b+1]; coef[b] = BigInteger.valueOf(a); deg = degree(); } public Polynomial(BigInteger a, int b) { coef = new BigInteger[b+1]; coef[b] = a; deg = degree(); } /** Return the degree of this polynomial (0 for the constant polynomial). */ public int degree() { int d = 0; for (int i = 0; i &lt; coef.length; i++) if (coef[i] != BigInteger.valueOf(0)) d = i; return d; } /** Return the sum of this polynomial and b, i.e., return c = this + b. */ public Polynomial plus(Polynomial b) { Polynomial a = this; Polynomial c = new Polynomial(0, Math.max(a.deg, b.deg)); for (int i = 0; i &lt;= a.deg; i++) c.coef[i] = c.coef[i].add(a.coef[i]); for (int i = 0; i &lt;= b.deg; i++) c.coef[i] = c.coef[i].add(b.coef[i]); c.deg = c.degree(); return c; } /** Return the difference of this polynomial and b, i.e., return (this - b). */ public Polynomial minus(Polynomial b) { Polynomial a = this; Polynomial c = new Polynomial(0, Math.max(a.deg, b.deg)); for (int i = 0; i &lt;= a.deg; i++) c.coef[i] = c.coef[i].add(a.coef[i]); for (int i = 0; i &lt;= b.deg; i++) c.coef[i] =…
has title: Converting whole program from Int to BigInteger
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32840952
has comment: http://stackoverflow.com/comment/32840775
accepted answer: http://stackoverflow.com/a/21717495
has answer: http://stackoverflow.com/a/21717656
tagged with: biginteger
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/32840785
type: Question
score: -1
has comment: http://stackoverflow.com/comment/32840818
tagged with: type-conversion

http://stackoverflow.com/q/21757527
has body: I am supposed to reverse the individual words in a sentence using a helper method that takes a string as a parameter and returns a string. The stack is supposed to be in the helper method. So my program works in that it reverses the words correctly. But reverse isnt actually getting returned, i think its just printing the stack. Can anyone help me return and print the string variable 'reverse'. import java.util.Scanner; import java.util.Stack; public class ReverseStack { public static void main(String[] args) { String sentence; System.out.print("Enter a sentence: "); Scanner scan = new Scanner(System.in); sentence = scan.nextLine(); System.out.println("Reversed:" + PrintStack(sentence)); } private static String PrintStack(String sentence) { String reverse = ""; String next = ""; Stack&lt;String&gt; stack= new Stack&lt;String&gt;(); String words[] = sentence.split(" "); for(int j = 1; j&lt;words.length +1; j++) { String newWord = words[words.length - j]; // Single word for(int i = 0; i &lt; newWord.length(); i++) { next = newWord.substring(i,i+1); stack.push(next); } stack.push(" "); } while(!stack.isEmpty()) { reverse += stack.pop(); } return reverse; } }
tagged with: stack
tagged with: java
has title: Java returning a string from a stack
has comment: http://stackoverflow.com/comment/32912779
type: Question
score: 0
has comment: http://stackoverflow.com/comment/32911143
has comment: http://stackoverflow.com/comment/32913277
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/21757681
tagged with: return
has comment: http://stackoverflow.com/comment/32913046
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32910921
has comment: http://stackoverflow.com/comment/32913637

http://stackoverflow.com/q/21754562
has title: JPQL not giving results
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: spring-data
has comment: http://stackoverflow.com/comment/32906597
type: Question
has answer: http://stackoverflow.com/a/21800505
has comment: http://stackoverflow.com/comment/32905730
score: 0
accepted answer: http://stackoverflow.com/a/21800505
answer count: 1
tagged with: jpa
has body: In my application I am hitting DB using JPA (With Hibernate as JPA Provider). When I try to run a query, system provides me empty result list. But when I run SQL representation of same query (taken from logs), it runs fine and provides me correct results. Can someone please help me in understanding what can be the possible issue here?
tagged with: jpa-2.0
has comment: http://stackoverflow.com/comment/32910111

http://stackoverflow.com/q/21735038
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21735216
has body: I have a nested data structure, where somewhere down the hierarchy the same objects are used several times. What I want as a result is, that when serializing this via Jackson, it is somehow detected than an object has already been written to the output and instead of serializing the object again, its ID is used. Is Jackson able to do this for me, or do I have to implement this manually? Example: AddressBook | Person | Tag A lot of Persons can have the same Tag. I only want each Tag object once in the JSON output.
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has title: What is an easy way to replace duplicated object serialisations by the ID in jackson
tagged with: jackson

http://stackoverflow.com/comment/32816210
score: 0
comment on: http://stackoverflow.com/q/21699627
type: Comment
type: QuestionComment
has text: Naren, added all the files in the post.

http://stackoverflow.com/comment/32921602
comment on: http://stackoverflow.com/a/21763380
score: 0
type: AnswerComment
type: Comment
has text: Not all carriers allow for this method.

http://stackoverflow.com/a/21825940
downvote count: 0
has comment: http://stackoverflow.com/comment/33035810
type: Answer
has body: In Java 8 and later, you could use default methods to achieve a sort of C++-like multiple inheritance. You could also have a look at this tutorial which shows a few examples that should be easier to start working with than the official documentation.
answers question: http://stackoverflow.com/q/21824402
upvote count: 15
has comment: http://stackoverflow.com/comment/33073932
score: 15

http://stackoverflow.com/q/21743880
has answer: http://stackoverflow.com/a/21745019
has body: I'm making a mini-inventory control system. This is my database's invoice table. columns are inid(p), itid(p), cuid(p), itname, qty, sprice, total, isdate, redate This is my Invoice interface when searching an old invoice using invoice id (inid). I already searched one before. Every data set to text fields and table properly. But the thing is when I'm searching another invoice other data will set properly but table not clear and second search's data also set under the first search's data to the given table. this is second search interface. Given below is my source code of search. JDBC db = new JDBC(); public boolean b; public void selectFromDate(JComboBox combodate, JDateChooser isdate, JDateChooser redate, DateSpinner retime, DateSpinner istime, JTable jtable1, JTextField txtCuid, JTextField txtCuName, JTextField txtCuAdd, JTextField txtCuTp, JTextField txtgtotal, JTextField txtAdvance, JTextField txtDue, JTextField txtInvoiceID, JTextField txtDamage, JTextField txtInvoiceTotal) { SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat formatter2 = new SimpleDateFormat("HH:mm:ss"); try { ResultSet rs1 = db.getData("SELECT * FROM invoice WHERE isdate='" + combodate.getSelectedItem().toString() + "'"); if (rs1.next()) { b = true; while (rs1.next()) { txtInvoiceID.setText((rs1.getString("inid"))); Vector v = new Vector(); DefaultTableModel dd = (DefaultTableModel) jtable1.getModel(); dd.setRowCount(0); v.add(rs1.getInt("itid")); v.add(rs1.getString("itname")); v.add(rs1.getInt("qty")); v.add(rs1.getDouble("sprice")); v.add(rs1.getDouble("total")); dd.addRow(v); String maindate1 = rs1.getString("isdate"); String date1 = maindate1.substring(0, 10); String time1 = maindate1.substring(11, 19); Date d1 = formatter1.parse(date1); Date t1 = formatter2.parse(time1); isdate.setDate(d1); istime.setValue(t1); String maindate2 = rs1.getString("redate"); String date2 = maindate2.substring(0, 10); String time2 = maindate2.substring(11, 19); Date d = forma…
possible better answer: http://stackoverflow.com/a/21744102
has comment: http://stackoverflow.com/comment/32887720
has comment: http://stackoverflow.com/comment/32888551
tagged with: swing
type: AnsweredQuestion
has title: How to load data to table clearing loaded data before?
tagged with: java
has comment: http://stackoverflow.com/comment/32888543
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/32887599
has comment: http://stackoverflow.com/comment/32888608
has comment: http://stackoverflow.com/comment/32887761
has comment: http://stackoverflow.com/comment/32888798
accepted answer: http://stackoverflow.com/a/21745019
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21744102

http://stackoverflow.com/comment/32801008
score: 0
type: Comment
has text: Thank You im having one problem Now
comment on: http://stackoverflow.com/a/21695241
type: AnswerComment

http://stackoverflow.com/a/21715475
score: 1
upvote count: 1
has body: Start by taking a look at How to Use Lists, which has lots of awesome code examples. The basic idea would be to... When your actionPerformed method is triggered, create a new DefaultListModel, assuming you don't have your own implementation, fill it with all the new items you need and apply it to the instance of list_racentRaces If you want to maintain what was previously in the list, you should consider starting with a DefaultListModel and simply add the new items to it as you need to... Then, attach a ListSelectionListener to list_racentRaces and when the valueChanged event is triggered, find the selected item(s) and do what ever you need to based on these result(s) You can find more details and examples through How to Write a List Selection Listener
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21715399

http://stackoverflow.com/q/21699231
type: AnsweredQuestion
score: 1
tagged with: java
has body: I need to set a header for each of the logger files generated via java.util.logging.Logger. The file format is .csv. Please let me know if there is any method to implement this.
tagged with: file
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21699397
has title: How to set a header for csv java logger file.Using logger java.util.logging.Logger
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21699397
tagged with: http://stackoverflow.com/tag/csv
tagged with: logging

http://stackoverflow.com/comment/32872737
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21735940
type: QuestionComment
has text: I find it highly unlikely that the URL you show is related to anything that would accept and process a file upload.

http://stackoverflow.com/comment/33035508
type: Comment
has text: The problem I had was that converted a String out of an XML. String is `80 0 0 0 0 0 0 0`. So through a XmlPullparser I fetched the data and stored it in a HashMap. Now I wanted to take via a key the value stored to it. So I fetched it and saved it to the `value` int array. The Problem why it did not work was, that in my pullparser I didnt convert it correctly to an hex int. But at the moment it works with the answer that was posted, but which is now deleted
comment on: http://stackoverflow.com/a/21826996
score: 0
type: AnswerComment

accelerometer
tags question: http://stackoverflow.com/q/21755809
type: Tag
tags question: http://stackoverflow.com/q/21819536
tags question: http://stackoverflow.com/q/21758087
tag name: accelerometer

http://stackoverflow.com/a/21783632
has comment: http://stackoverflow.com/comment/32979964
upvote count: 1
has comment: http://stackoverflow.com/comment/32983160
type: Answer
has comment: http://stackoverflow.com/comment/32994450
answers question: http://stackoverflow.com/q/21776496
has comment: http://stackoverflow.com/comment/32984162
has comment: http://stackoverflow.com/comment/32957970
has body: AFAIK ResourceBundle.Control is used to load ResourceBundles. In the new Message Extension we use a custom ResourceBundle.Control to enable the loading of ResourceBundles in the OSGi context, and it is configurable via annotations. AFAICS exchanging the ResourceBundle.Control will break any other use case supported by the new Message Extension. The question is, why do you use a custom ResourceBundle.Control instead of creating a class based ResourceBundle? I haven't tried it yet, but maybe it is possible to create only the base ResourceBundle (without Locale information) and determine the Locale in another way than using getLocale(). But without knowing what you are doing in your custom ResourceBundle.Control, I don't know what to answer and what to suggest. Of course we could open the API for that, but as I said before, then every other plugin that makes use of the default implementation will fail. Maybe you can give some hints on what you are doing exactly and I can show you a way to achieve your goal in another way.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32982216

http://stackoverflow.com/q/21832738
has answer: http://stackoverflow.com/a/21832829
score: 0
answer count: 1
has body: The following line of code works perfectly when tested with string criteria.add(Restrictions.eq("name", "John")); However when i test it with Date it returns error This is line of code that returns error criteria.add(Restrictions.eq(currentDate,dd)); This is how i am getting currentDate DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar cal = Calendar.getInstance(); String currentDate=dateFormat.format(cal.getTime()); I printed currentDate and dd and following is output in console along with the error Current Date:2014-02-17 dd:2014-02-16 JKInsrException:->could not resolve property: 2014-02-17 of: com.java.JKInsr.Contact
accepted answer: http://stackoverflow.com/a/21832829
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
has title: Hibernate Criteria Query not working with date
type: Question

android-scrollview
type: Tag
tags question: http://stackoverflow.com/q/21700808
tag name: android-scrollview

http://stackoverflow.com/a/21788609
has body: You don't have to remove from the temp list. The only thing to do is to test the value that you get at each iteration from the list you passed in parameter: check if both conditions are true, in this case just add the original word. test if it contains a l, then multiply it by two otherwise do nothing (you didn't precise what to do for words that doesn't contain l and r): if(strL &amp;&amp; strR) { temp.add(s); } else if(strL){ temp.add(s); temp.add(s); } Which outputs: liar lisa lisa
answers question: http://stackoverflow.com/q/21788415
type: Answer
score: 0

http://stackoverflow.com/a/21685185
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32782610
accepted answer of: http://stackoverflow.com/q/21685061
answers question: http://stackoverflow.com/q/21685061
has body: The specifications seem pretty good to me. They mean Set as in "Set Theory". One way to represent a set of integers, albeit inefficient from a storage point of view, is to use an array of booleans. This is a perfectly reasonable exercise. Clearly it would be better to use Set&lt;Integer&gt; for this project, but that would be missing the point. This is a programming exercise that is fun. As always, break this down into manageable parts. I would: Create the class Write the constructor. This will lead you to the proper member variables. Write the addElement method Those things should be pretty easy and perhaps you will gain more insight. Once you have that work on the union and intersection methods. If you still have trouble, check back here! Keep in mind if you add the value 3, to the set twice, it will only be in the set once. (Definition of sets). So your method will look something like this (keep in mind this is not the 100% correct definition): public void addElement(int element) { myArray[element] = true; } So when you call addElement(3); a second or third time, it does not change the state of the set as is proper.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32783653
has comment: http://stackoverflow.com/comment/32782878

http://stackoverflow.com/a/21729585
accepted answer of: http://stackoverflow.com/q/21729362
answers question: http://stackoverflow.com/q/21729362
type: Answer
score: 11
has body: You must provide a constructor with no arguments when you extend application. So you could do something like: public class SimpleSun extends Application { private Stage primaryStage; Configuration configuration; public SimpleSun() { this.configuration = Main.getConfig(); } //... and in your Main class: public static Configuration getConfig() { return new ConfigurationFromFile(); } Alternatively you can pass String parameters to the class with launch(args) and get them back in the SimpleSun class with getParameters().
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32861334
upvote count: 11
has comment: http://stackoverflow.com/comment/32861273

http://stackoverflow.com/q/21828119
has title: How to add progressbar to display download status in Java?
has answer: http://stackoverflow.com/a/21828330
tagged with: download
type: UnansweredQuestion
score: 0
tagged with: java
has body: I am using an external library to download files from Mega but I need a progressbar to display the duration of the download to the user. I have read a lot of progressbar related articles on stackoverflow but the problem is that I don't know what take so long in my code to add a progress bar. Where and how do I have to add a progressbar to display the download status? try { URLConnection urlConn = new URL(file_url).openConnection(); print(file_url); is = urlConn.getInputStream(); while ((read = is.read(buffer)) &gt; 0) { cos.write(buffer, 0, read); } } finally { try { cos.close(); if (is != null) { is.close(); } } finally { if (fos != null) { fos.close(); } } } print("Download finished"); }
type: Question
answer count: 1
tagged with: url
linked to: http://stackoverflow.com/q/20260372
tagged with: buffer

http://stackoverflow.com/q/21823001
tagged with: amazon-ec2
tagged with: tomcat
tagged with: centos
score: 0
tagged with: linux
answer count: 2
possible better answer: http://stackoverflow.com/a/21823127
favorite count: 0
accepted answer: http://stackoverflow.com/a/21823236
upvote count: 1
linked to: http://stackoverflow.com/q/12917179
type: AnsweredQuestion
tagged with: java
downvote count: 1
has title: Get server memory usages on Amazon EC2 Instance
type: Question
has body: We are running our J2EE application on Amazon EC2 instance server which is an m1.large instance having configuration as Instance Family Instance Type Processor Arch vCPU ECU Memory (GiB) Instance Storage (GB) EBS-optimized Available Network Performance General purpose m1.large 64-bit 2 4 7.5 2 x 420 Yes Moderate now when I check memory usages of my server I found that free memory is 0 as shown below total used free shared buffers cached Mem: 7 6 0 0 0 5 -/+ buffers/cache: 1 5 Swap: 0 0 0 After investigating bit on server I got following details... Process Name Number of processes Memory usage per process Total memory usage java 2 523.379 MB 1046.76 MB httpd 24 3.47965 MB 83.5117 MB memcached 1 13.7227 MB 13.7227 MB sshd 3 2.91016 MB 8.73047 MB rsyslogd 1 5.51953 MB 5.51953 MB pickup 1 3.25781 MB 3.25781 MB udevd 2 1.24805 MB 2.49609 MB master 1 2.84375 MB 2.84375 MB qmgr 1 2.77734 MB 2.77734 MB crond 1 1.30078 MB 1.30078 MB auditd 1 0.789062 MB 0.789062 MB which having total usages around 1 .5 GB now I can not understand where this 5.33 GB is going to used and how can I find the details about it can someone help me about this NOTE: we are running two tomcat on same server for QA and Production Apatche : 2 Tomcat Version : 7 (for Both) Memcached : for better performance Thanks in Advance..
has answer: http://stackoverflow.com/a/21823236
has answer: http://stackoverflow.com/a/21823127

http://stackoverflow.com/q/21715989
favorite count: 0
has body: I am new to Apache Sling, CQ5, etc. In our codebase, we have a code snippet similar to this: void perform(SlingHttpServletRequest request, SlingHttpServletResponse response) { ResourceResolver resourceResolver = request.getResourceResolver(); Session session = resourceResolver.adaptTo(Session.class); PageManager pageManager = resourceResolver.adaptTo(PageManager.class); } What's adapTo doing here? Also is there a good documentation/user manual available I can read to get started using Sling, CQ5, etc.?
score: 8
downvote count: 0
has title: What's the purpose of resourceResolver.adaptTo(Session.class) in Apache Sling?
tagged with: aem
tagged with: sling
type: AnsweredQuestion
tagged with: java
tagged with: jcr
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/21723320
accepted answer: http://stackoverflow.com/a/21723320
answer count: 1

http://stackoverflow.com/comment/42719430
type: Comment
comment on: http://stackoverflow.com/a/27088885
score: 0
has text: I think sadly the solution did involve quitting Eclipse and restarting. Ugh.
type: AnswerComment

fileoutputstream
tags question: http://stackoverflow.com/q/21792215
type: Tag
tags question: http://stackoverflow.com/q/21836036
tag name: fileoutputstream
tags question: http://stackoverflow.com/q/21816049

http://stackoverflow.com/comment/33045399
comment on: http://stackoverflow.com/q/21832408
score: 0
has text: Minecraft modding is not illegal unless I distribute unmodified classes too. This is why I need the tool. I can't change the names - they are used in unmodded classes, but i need to change them temporary to understand code and the tool to change them back.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32828204
type: Comment
score: 1
has text: @AlexWien: Actually, you were right in a way, though not the way you intended. (`ArrayList.addAll` calls `toArray()`, not `iterator()`.) Fixed now.
type: AnswerComment
comment on: http://stackoverflow.com/a/21710703

http://stackoverflow.com/comment/32910207
type: AnswerComment
comment on: http://stackoverflow.com/a/21756139
type: Comment
has text: @AndreiI I didn't read that to mean that that's actually occurring, but you're definitely right that if this is a non-key column with no database constraint, that's the first problem to fix right there.
score: 0

http://stackoverflow.com/a/21758565
has comment: http://stackoverflow.com/comment/32917391
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32917261
has body: If you were to use uiautomatorviewer to examine that app, I suspect that you will find that the tabs are a tabbed indicator for a ViewPager. PagerTabStrip is one that ships with the Android Support package, the ViewPagerIndicator library has another, and there are still more floating around out there. Such a tab strip can be placed pretty much anywhere.
has comment: http://stackoverflow.com/comment/32916913
type: Answer
has comment: http://stackoverflow.com/comment/32917894
has comment: http://stackoverflow.com/comment/32918788
has comment: http://stackoverflow.com/comment/32917580
downvote count: 0
answers question: http://stackoverflow.com/q/21757950
accepted answer of: http://stackoverflow.com/q/21757950
score: 1

http://stackoverflow.com/comment/32916592
type: Comment
has text: You need to debug out what Restlet thinks its receiving. Its not a standard form, nor is it json (or the json handler would have caught it). Post up the PHP code that you're using.
comment on: http://stackoverflow.com/a/21760139
type: AnswerComment
score: 0

http://stackoverflow.com/a/21710874
has body: Strings in C/C++ are already arrays (even when abstracted by a higher level class like std::string). The array elements are the character values of each character. Are you sure you can't just grab the string's .c_str() (or .data()) and use that, possibly with a cast?
answers question: http://stackoverflow.com/q/21710744
score: 0
has comment: http://stackoverflow.com/comment/32829265
type: Answer
has comment: http://stackoverflow.com/comment/32829007

http://stackoverflow.com/a/73730209
type: Answer
answers question: http://stackoverflow.com/q/21761875
score: 0
has body: I think that using a static method can be a benefit in terms of readability and if such a static method could be defined as a standard, there could be also improvements in terms of performance: let me say, imagine that in java.lang.Math you have a method isBetween(int toCheck, int from, int to), which is defined as public static boolean isBetween(int toCheck, int from, int to){ // eventually validate the range return from &lt;= toCheck &amp;&amp; toCheck &lt;= to; } the first benefit can be that, if you import static Math.isBetween, than tou can write code like if(isBetween(userInput, 0, 16)){ //... } and the second benefit would be that, hitting this method many times (for boundary checks, for example, in Strings, arrays, or other statically-sized data structures), can lead to an easily C2-compiled method (probably inlined), and eventually if someone points out that the HotSpot compiler generates a branch, due to the fact that there is a conditionated jump, then can write an improvement that generates brachless code, and every application of this method can benefit, just upgrading to a newer runtime. Another improvement in readability could come from project Valhalla: if ints can have methods, than you could just write if(userInput.isBetween(0, 16))

http://stackoverflow.com/q/21748295
tagged with: java
has comment: http://stackoverflow.com/comment/32895149
has comment: http://stackoverflow.com/comment/32895324
has title: Overriding the clone() function in java
type: Question
has comment: http://stackoverflow.com/comment/32895908
has comment: http://stackoverflow.com/comment/32895646
has answer: http://stackoverflow.com/a/21748839
score: 0
answer count: 1
has body: I hava a class Stack in which I have a Node declared in it and I need to override the clone() function: public class Stack&lt;T&gt; { public class Node&lt;T&gt; { T element; Node&lt;T&gt; next; public Node(T data, Node&lt;T&gt; n) { element = data; next = n; } @Override public Stack&lt;T&gt; clone() { Stack&lt;T&gt; temp = new Stack&lt;T&gt;(); Node&lt;T&gt; n; n = top; if(n != null) { temp.push(n.element); while(n.next!=null) { n = n.next; temp.push(n.element); } } Stack&lt;T&gt; temp2 = new Stack&lt;T&gt;(); while(!temp.isEmpty()) { temp2.push(temp.pop()); } return temp2; } I have other functions like push() and pop(), so you can assume they work fine. The problem is that what im trying to do is to be able to create 2 different stack objects, push some values in to one of them and then clone it to the 2nd one. with my code this is possible but when I trying pushing values into the stack that was cloned, it automatically pushes values into the 1st stack too. This is my push public void push(T el) throws MyException { Node&lt;T&gt; random = null; Node&lt;T&gt; newN = new Node&lt;T&gt;(el, random); if(isEmpty()) { top=newN; newN.next = null; } else { newN.next = top; Node&lt;T&gt; temp; temp = top; top = newN; while(temp.next!=null) temp = temp.next; temp.next=null; } } This is the code for my main function public class Tester { public static void main(String []args) { Stack&lt;Integer&gt; test = new Stack&lt;Integer&gt;(); test.push(1); test.push(3); System.out.println(test.toString()); Stack&lt;Integer&gt; test2 = new Stack&lt;Integer&gt;(); test2 = test.clone(); test2.push(4); System.out.println(test2.toString()); System.out.println(test.toString()); } } How can I separate this link? thank you
has comment: http://stackoverflow.com/comment/32895485
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32895543
has comment: http://stackoverflow.com/comment/32895750
has comment: http://stackoverflow.com/comment/32895112
has comment: http://stackoverflow.com/comment/32894992
has comment: http://stackoverflow.com/comment/32895040
tagged with: clone

http://stackoverflow.com/a/21706169
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32837236
type: Answer
has body: The following regular expression will extract this: \w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}\W{1}-\d{2} http://ideone.com/FwpV7z import java.util.*; import java.lang.*; import java.io.*; import java.util.regex.*; class Ideone { public static void main (String[] args) throws java.lang.Exception { String testData = "#1|77|1391436891|1|1|00:1e:58:f4:15:f7|Nexus 4, 4.4, MAKOZ30d $1|1391436893 ?[176.08179, -13.839829, -1.0054213] %PKKV7|00:7f:28:3f:17:9d|-67|2437 %DC2VJ|f8:e4:fb:a0:06:f8|-71|2412 %VVWSP|00:7f:28:d5:92:65|-71|2462 %SVT8H|f8:e4:fb:8e:d6:9b|-77|2437 %ThreeBestFriends|20:10:7a:14:6a:f7|-66|2452 %2X4C8|00:7f:28:44:23:da|-75|2437 %STDGD|f8:e4:fb:70:86:f4|-82|2462 %DeathStar|00:7f:28:be:c8:94|-84|2412 %Freeinternet|00:1e:58:f4:15:f7|-59|2437 %QB657|00:26:62:b7:16:4b|-88|2462 %375F2|00:26:b8:3e:0a:14|-70|2412 %E1K38|00:26:62:cf:90:37|-81|2412"; String regularExpression = "\\w{2}:\\w{2}:\\w{2}:\\w{2}:\\w{2}:\\w{2}\\W{1}-\\d{2}"; Pattern pattern = Pattern.compile(regularExpression); Matcher matcher = pattern.matcher(testData); while(matcher.find()) { System.out.println(matcher.group(0)); } } } output: 00:7f:28:3f:17:9d|-67 f8:e4:fb:a0:06:f8|-71 00:7f:28:d5:92:65|-71 f8:e4:fb:8e:d6:9b|-77 20:10:7a:14:6a:f7|-66 00:7f:28:44:23:da|-75 f8:e4:fb:70:86:f4|-82
accepted answer of: http://stackoverflow.com/q/21705821
score: 0
answers question: http://stackoverflow.com/q/21705821

http://stackoverflow.com/comment/32855056
has text: i did all as you said, still its not working.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21725262

http://stackoverflow.com/q/21807878
tagged with: interface
has title: Why is ArrayList implementing List
duplicate of: http://stackoverflow.com/q/4387419
answer count: 0
upvote count: 1
type: Question
tagged with: oop
tagged with: java
has comment: http://stackoverflow.com/comment/33001297
downvote count: 0
score: 1
has body: I was observing that ArrayList extends AbstractList and implements List. Now AbstractList itself implements List. Given that, what was the need to ArrayList to implement List at all ?
tagged with: inheritance
favorite count: 0
linked to: http://stackoverflow.com/q/4387419
type: UnansweredQuestion

http://stackoverflow.com/q/21757897
has comment: http://stackoverflow.com/comment/32953605
has answer: http://stackoverflow.com/a/21757976
score: -1
upvote count: 1
has body: I'm brand new at writing programs in any language and I'm trying to write a simple Newton-Raphson method which I think works in C (haven't compiled but going from a previous example that did work so I'm making this assumption) but realised that I don't know exactly how to call a method from Java... I'm getting these errors: NewtRaphEx.java:5: class, interface, or enum expected double f = (double); ^ NewtRaphEx.java:6: class, interface, or enum expected double df = (double); ^ NewtRaphEx.java:39: class, interface, or enum expected double f(double x) { ^ I assume I'm calling the f and df methods incorrectly? This is not for a homework question, simply my own practice! My program so far is: /* Newton Raphson Method*/ import Scanner.java.util; double f = (double); double df = (double); public class NewtRaphEx { public static void main (String[] args) { double xn, e_allow, fn, fnew, eps, dfn, dfnew; int n; int nMax = 10000; e_allow = 0.001; xn = 0.6; while (eps &lt;= e_allow || n &lt; nMax) { for (n = 0; n &lt;= nMax; n++) { fn = f(xn); dfn = df(xn); dx = -(fn / dfn); xnew = xn + dx; eps = Math.abs(dx / xn); n = n + 1; System.out.println("N" + "\t" + "X" + "\t" + "F(x)" + "\t" + "dF(x)" + "\t" + "delX" + "\t" + "X_new" + "\t" + "Epsilon"); System.out.println(n + "\t" + xn + "\t" + fn + "\t" + dfn + "\t" + dx + "\t" + xnew + "\t" + eps); } } } } // Creating Function f = x - cos(3.5x) double f(double x) { return (x - cos(3.5 * x)) } double df (double x) { return (1 + sin(3.5 * x)) }
has comment: http://stackoverflow.com/comment/32911986
favorite count: 0
has comment: http://stackoverflow.com/comment/32911618
has answer: http://stackoverflow.com/a/21758234
possible better answer: http://stackoverflow.com/a/21757976
downvote count: 2
has comment: http://stackoverflow.com/comment/32911584
has title: Programming Beginner - Java program adapted from C
has comment: http://stackoverflow.com/comment/32911648
accepted answer: http://stackoverflow.com/a/21758107
answer count: 4
tagged with: newtons-method
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32911992
tagged with: java
has answer: http://stackoverflow.com/a/21758121
has comment: http://stackoverflow.com/comment/32911642
has comment: http://stackoverflow.com/comment/32911774
has answer: http://stackoverflow.com/a/21758107
type: Question

http://stackoverflow.com/comment/32888421
comment on: http://stackoverflow.com/q/21743657
has text: Is it possible to make it work with such dependencies as described in the question and shown in the diagram? I.e. when module A depends only on module base-api, but not on base?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21789906
answers question: http://stackoverflow.com/q/21789616
type: Answer
has comment: http://stackoverflow.com/comment/32971627
has body: Instead of getting a document collection of all the documents in the database, you could instead create a view that shows only the recently modified documents and loop through that view.
score: 0

http://stackoverflow.com/comment/32873204
comment on: http://stackoverflow.com/q/21716188
type: Comment
has text: OK, maybe "bytesPerSample" would work better. Try that.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32904249
type: Comment
comment on: http://stackoverflow.com/a/21753374
has text: Thanks for suggestion.Added the props.put("request.required.acks", "1") to producer but the program is behaving in a random manner. I ran the program 5 times each time with a new topic. But it gave different results all 5 times.Twice the producer and consumer were in sync rest of the times the consumer was delayed.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32875239
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21737244
score: 0
has text: `I get about 19 errors.` Ahhhhh, those classic 19 errors. Someone must be a Stephen King fan.

http://stackoverflow.com/q/21704402
favorite count: 0
type: UnansweredQuestion
has body: I have an excel template as follows First Sheet is Named State it has the following data Cell A1 --&gt; State Cell B1 --&gt; Count Cell A2 --&gt; B4 &lt;jx:forEach items="${stateList}" var="row"&gt; ${row[0]} ${row[1]} &lt;/jx:forEach&gt; I have a named Range StateNames defined as =OFFSET(State!$A$2,0,0,COUNTA(State!$A$2:State!$A$100),1), which is suppose to evaluate to A2 --> Last Filled values, so if there were 20 states then it will evaluate to A2-->A21 The problem is that after the transformation, the Named Range Contains =OFFSET(State!#REF!,0,0,COUNTA(State!#REF!:State!$A$100),1) The reason based on my research seems to be that since A2 cell got transformed into A2:A21 the named range is trying to replace State!$A$2 with the State!$A$2:$A$21 and which caused the problem since the OFFSET function is not expecting a range. I need help to figure out how to solve the issue. I need the named ranges to later use in the Charts. But the basic problem is how to make sure that the named ranges refer to the correct locations. Thanks
tagged with: jxls
downvote count: 0
answer count: 0
score: 1
tagged with: java
tagged with: excel
type: Question
tagged with: transformation
has title: jxls transformation creates error in defined named ranges
upvote count: 1

http://stackoverflow.com/comment/32901517
comment on: http://stackoverflow.com/a/21751766
type: AnswerComment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/47406/discussion-between-prabha-and-smutje)
score: 0
type: Comment

http://stackoverflow.com/q/21785544
favorite count: 0
has body: i am designing a system where user shall register for a particular period and then logout. he may login and logout multiple times in day. i have to count all of those session to measure performance. so what would be best way to design database for it create table scheduler( ID bigint auto_increment, userID varchar(100), start_session TIMESTAMP, end_session TIMESTAMP, primary key(ID), INDEX(userID) ) i have to insert multiple session data of a user. so is it logical design for my desired task? one more info this will be for a real time system.
type: Question
has title: Count multiple login and logout session
upvote count: 2
answer count: 2
tagged with: performance
tagged with: java
tagged with: database
tagged with: mysql
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21786042
has answer: http://stackoverflow.com/a/21786355
has comment: http://stackoverflow.com/comment/32961123
score: 2
downvote count: 0

http://stackoverflow.com/a/21722820
has body: For your validate method in LoginDAO, if the username and password is not present in the table, it will return an empty Resultset. Based on whether the result set is empty or not return the boolean value to the Servlet. public boolean validate(Login login) { boolean status=true; ... ... ... ResultSet rs=ps.executeQuery(); if (!rs.next()){ status=false; } return status; } In the servlet you can get the returned value in a parameter and based on its value redirect it to the appropriate success or error page Boolean check=ls.loginValidate(login); if(check==true) { RequestDispatcher rd=request.getRequestDispatcher("/Login.jsp"); rd.forward(request, response); } else { RequestDispatcher rd=request.getRequestDispatcher("/error.jsp"); rd.forward(request, response); } The LoginService class can have only 1 method loginValidate which should return a boolean public boolean loginValidate(Login login) { Boolean check=false; if(login!=null){ LoginDAO ld=new LoginDAO(); DataSource dataSource=new DataSource(); ld.setDataSource(dataSource); check=ld.validate(login); } return check; }
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21722372
answers question: http://stackoverflow.com/q/21722372
type: AcceptedAnswer
upvote count: 1
has comment: http://stackoverflow.com/comment/32852328
type: Answer
has comment: http://stackoverflow.com/comment/32851952
has comment: http://stackoverflow.com/comment/33000842
has comment: http://stackoverflow.com/comment/32850332

http://stackoverflow.com/q/21782934
tagged with: hsqldb
type: UnansweredQuestion
has title: HSQLDB database manager on a remote site or vps
tagged with: java
tagged with: database
type: Question
has body: i have a vps which is running a HSQLDB, the problem is that i dont know how to connect to the database remotely and when i logon to my vps via ssh, the HSQLDB database manager applet will not run as it requires x11. can anyone help please
score: 0
tagged with: vps
has answer: http://stackoverflow.com/a/21795555
answer count: 1

http://stackoverflow.com/comment/32813783
type: QuestionComment
type: Comment
has text: This question is plain wrong: you want a 3-parameters `Predicate`, where only one exists (you can use lists to match that). You want to kill a fly with a bazooka as your code is perfectly readable and makes complete sense; no need to use Guava. Finally, you want to use `Predicate`s for no reason. I'll provide an answer that answer strictly to your question, but it still makes no sense.
score: 0
comment on: http://stackoverflow.com/q/21700655

http://stackoverflow.com/q/21788530
has body: I am writing the code for peak finding algorithm for a 1D array. I have read this post Peak finding algorithm. This is exactly what I am trying to do, there is discussion about time complexity but nothing of sort of pseudocode. The problem: Given an array [a,b,c,d,e,f,g] where a to g are numbers, b is a peak if and only if a&lt;=b and b&gt;=c. Example: given an array {1,2,3,4,5,19,25,20}, index 6 should be returned. The edge cases should give: {100,4,3,1,19,20} -- index 0 {1,3,5,19,20} -- index 4 I have implemented in Java. my current run-time is O(n). I am wondering if this could be improved public static int naive(int[] arr){ int l=arr.length; if (arr[0]&gt;=arr[1]) { return 0; } if (arr[l-1]&gt;arr[l-2]){ return l-1; } for (int i=1; i &lt; arr.length-1;i++){ if (arr[i] &gt;= arr[i-1] &amp;&amp; arr[i] &gt;= arr[i+1] ){ return i; } } return -1; }
tagged with: java
has title: finding 1D peak of a given array
type: Question
linked to: http://stackoverflow.com/q/18929108
has comment: http://stackoverflow.com/comment/32968188
has answer: http://stackoverflow.com/a/26693627
has comment: http://stackoverflow.com/comment/32967798
has answer: http://stackoverflow.com/a/45803870
tagged with: arrays
has comment: http://stackoverflow.com/comment/32967554
has comment: http://stackoverflow.com/comment/32967377
favorite count: 0
possible better answer: http://stackoverflow.com/a/21788873
upvote count: 3
has comment: http://stackoverflow.com/comment/32966502
has comment: http://stackoverflow.com/comment/32967484
has comment: http://stackoverflow.com/comment/32966426
has answer: http://stackoverflow.com/a/21788645
accepted answer: http://stackoverflow.com/a/21788645
answer count: 4
has answer: http://stackoverflow.com/a/21788873
downvote count: 0
has comment: http://stackoverflow.com/comment/32967418
has comment: http://stackoverflow.com/comment/32966466
type: AnsweredQuestion
score: 3
tagged with: algorithm

biginteger
tags question: http://stackoverflow.com/q/21740745
tag name: biginteger
tags question: http://stackoverflow.com/q/21802344
tags question: http://stackoverflow.com/q/21717426
type: Tag
tags question: http://stackoverflow.com/q/21776462
tags question: http://stackoverflow.com/q/21810418

http://stackoverflow.com/comment/124603740
score: 1
comment on: http://stackoverflow.com/q/21688814
type: Comment
type: QuestionComment
has text: @DirkBoer It's been seven years and I've retired since. I don't think I ever did.

http://stackoverflow.com/q/21813168
type: Question
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21813196
has comment: http://stackoverflow.com/comment/33011279
favorite count: 0
has title: Could not trace whats wrong with my answer
linked to: http://stackoverflow.com/q/40480
upvote count: 1
type: AnsweredQuestion
tagged with: object
has body: class OpenSource { private int x; public OpenSource(int x) { this.x = x; } public void setX(int x) { this.x = x; } public int getX() { return x; } static OpenSource Open(OpenSource opensource) { opensource = new OpenSource(100); //line 19 return opensource; } public static void main(String a[]) { OpenSource open = new OpenSource(300); //line 24 System.out.println(open.getX() + "."); OpenSource opensource = Open(open); //line 26 System.out.println(open.getX() + "."); System.out.println(opensource.getX() + "."); open = Open(opensource); System.out.println(open.getX() + "."); System.out.println(opensource.getX()); } } //why the output produces 300 300 100 100 100 why not 300 100 100 100 100 where i am wrong? i have drawn representation as below to understand it.
tagged with: oop
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21813196

http://stackoverflow.com/comment/33083191
has text: Ok I have found the file, I should have read the comments they provided better, but which levels do I have to set to get useful output? I have it on all now, and the persisting does not create any log entry, just retreiving data creates one log entry and there are thee fatal exceptions because of some date/timemapping, i will insert it into my post so you can see it
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21841570
type: Comment

http://stackoverflow.com/a/21717381
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21717358
upvote count: 3
has body: The statement myArrayList.get(index) += "myString"; does not work because you are never storing it back in arraylist. Due to immutability of strings, your new string is created but it is not referred. Hence you don't find it reflected in arraylist element. Personally, I would have chosen the first way.
answers question: http://stackoverflow.com/q/21717358
type: Answer
downvote count: 0

http://stackoverflow.com/q/21840412
has title: How to read a text file in a bottom up fashion in java?
duplicate of: http://stackoverflow.com/q/6011345
has answer: http://stackoverflow.com/a/21840486
type: Question
has body: I'm trying to implement a log structure file system as an operating system assignment. In it most recent data is placed at end of file. That's why I want to read text file "line-by-line" in reverse order. Is it possible?
linked to: http://stackoverflow.com/q/8664705
has comment: http://stackoverflow.com/comment/33059642
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/33058909
linked to: http://stackoverflow.com/q/6011345
has comment: http://stackoverflow.com/comment/33059906
downvote count: 1
tagged with: bufferedreader
favorite count: 0
possible better answer: http://stackoverflow.com/a/21840486
has comment: http://stackoverflow.com/comment/33058899
has answer: http://stackoverflow.com/a/21840468
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21840536
accepted answer: http://stackoverflow.com/a/21840536
score: 1
tagged with: java

http://stackoverflow.com/comment/33006900
comment on: http://stackoverflow.com/q/21780320
type: QuestionComment
has text: So far I've been thinking more theoretically about the problem. I didn't prove it yet, but to me it seems obvious that if the vector is sorted, `|d|` will be minimal. Now if you take the highest value in the vector and put it in the middle of a new vector. Then you take the two smallest values and put those each on one side of the first value. Next you take the two highest values and then again the lowest values. And so on. That should give a quite maximized `|d|`. It might even be the absolute maximum. But the variance will be horrible. Without a rule for a trade off, I'm pretty stuck now.
type: Comment
score: 1

http://stackoverflow.com/comment/32991061
type: AnswerComment
comment on: http://stackoverflow.com/a/21802188
type: Comment
has text: Thanks, but how do I run checker?
score: 0

http://stackoverflow.com/q/21716052
tagged with: metamodel
tagged with: eclipse
tagged with: eclipse-emf
has title: Error on load EMF model dynamically
has answer: http://stackoverflow.com/a/26672188
upvote count: 2
has body: I am following the article http://www.ibm.com/developerworks/library/os-eclipse-dynamicemf/ to load dynamically metamodels. I load the model instanced document using this ResourceSet load_resourceSet = new ResourceSetImpl(); // ResourceSet load_resourceSet2 = new ResourceSetImpl(); /* * Register XMI Factory impl ementation using DEFAULT_EXTENSION */ load_resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", //$NON-NLS-1$ new XMIResourceFactoryImpl()); /* * Add bookStoreEPackage to package registry */ load_resourceSet.getPackageRegistry().put("http:///com.ibm.dynamic.example.bookstore.ecore", bookStoreEPackage); // load_resourceSet2.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", //$NON-NLS-1$ // new XMIResourceFactoryImpl()); /* * Load the resources using the URI */ Resource modelo_esquerda = load_resourceSet .getResource(URI.createURI("./BookStore.xmi"), true); But, I´ve got this error message Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'BookStore' is not found or is abstract. (.\BookStore.xmi, 9, 34) The XMI file already exists on directory. What I can do? Thank you
accepted answer: http://stackoverflow.com/a/26672188
downvote count: 0
answer count: 1
favorite count: 0
score: 2
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/32997678
type: QuestionComment
comment on: http://stackoverflow.com/q/21805787
has text: Does it peak memory usage?
score: 0
type: Comment

http://stackoverflow.com/a/22043703
has body: I tried the following: ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.writeValueAsString(new Something("Name", 12, "male", new Nested("books", "Music", "Movie")))); public class Something { @JsonProperty("name") public String name; @JsonProperty("age") public int age; @JsonProperty("gender") public String gender; @JsonProperty("interest") public Nested nested; //Constructor } public class Nested { @JsonProperty("books") public String books; @JsonProperty("music") public String music; @JsonProperty("movie") public String movie; //Constructor } and the Output is: { "name":"Name", "age":12, "gender":"male", "interest": { "books":"books", "music":"Music", "movie":"Movie" } } So everything is working as expected. I already checked if theres a difference if you provide some setters and getters and setting the visibility of the fields on private but that doas not make a difference. Maybe you want to show us your InterestPojo or your output/stacktrace? EDIT: Okay i think i got it ;) I tried the following: public void start() throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.getSerializationConfig().addMixInAnnotations(Something.class, Nested.class); mapper.getDeserializationConfig().addMixInAnnotations(Something.class, Nested.class); System.out.println(mapper.writeValueAsString(new Something("Name", 12, "male", new NestedImpl("name", null)))); } public final class Something { private final String name; private int age; private String gender; // thats your interest thing public Nested nested; public Something(String name, int age, String gender, Nested nested) { this.name = name; this.age = age; this.gender = gender; this.nested = nested; } String getName() { return name; } Nested getNested() { return nested; } } public abstract class Nested { @JsonProperty("name-ext") abstract String getName(); @JsonProperty("interest-ext") abstract Nested getNested(); } public class NestedImpl extends Nested { private String name; private Nested nes…
has comment: http://stackoverflow.com/comment/33777000
upvote count: 8
has comment: http://stackoverflow.com/comment/33776996
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/33705734
has comment: http://stackoverflow.com/comment/33706791
has comment: http://stackoverflow.com/comment/33706003
has comment: http://stackoverflow.com/comment/33831492
has comment: http://stackoverflow.com/comment/33694752
answers question: http://stackoverflow.com/q/21751615
has comment: http://stackoverflow.com/comment/33704839
accepted answer of: http://stackoverflow.com/q/21751615
has comment: http://stackoverflow.com/comment/33742756
has comment: http://stackoverflow.com/comment/33451232
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33776946
has comment: http://stackoverflow.com/comment/33728713

http://stackoverflow.com/comment/32865444
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21731669
has text: well, yeah that makes sense. I mean i don't remember checking at each CPU utilization, i mean the overall multiprocessor CPU usages were hovering somewhere around 30-40 percent. let me go back and check if there was any single CPU busy doing all the switching and getting maxed out..

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/21770790
tags question: http://stackoverflow.com/q/21754951
tags question: http://stackoverflow.com/q/21821173
type: Tag
tags question: http://stackoverflow.com/q/21775237

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/21688823
tag name: osx-mavericks

http://stackoverflow.com/q/21832990
has answer: http://stackoverflow.com/a/21833271
answer count: 4
type: AnsweredQuestion
has title: Creating an list of arrays in java?
downvote count: 2
has comment: http://stackoverflow.com/comment/33045593
has comment: http://stackoverflow.com/comment/33045490
upvote count: 1
has answer: http://stackoverflow.com/a/21833269
type: Question
has answer: http://stackoverflow.com/a/21833262
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/33045373
has answer: http://stackoverflow.com/a/21833257
has comment: http://stackoverflow.com/comment/33089843
accepted answer: http://stackoverflow.com/a/21833269
tagged with: arrays
favorite count: 0
has body: the program gets the frequency of 0's and 1's in every feature vector(Column) and store it into the array. but then when I access my list of arrays(observed e.g observed.get(0)[0] ) it returns all the 0's in my matrix. DoubleMatrix[] featurevec = new DoubleMatrix[tempfeatures.numCols()]; for (int i = 0; i&lt; featurevec.length; i++) { featurevec[i] = tempfeatures.extractVector(false,i); } double[]f = new double[2]; ArrayList&lt;double[]&gt; observed = new ArrayList&lt;&gt;(); for (int j = 0; j&lt; featurevec.length; j++) { for (int i = 0; i&lt; featurevec[j].getNumElements(); i++) { if (featurevec[j].get(i) == 1) f[0]++; else f[1]++; } observed.add(f); }
possible better answer: http://stackoverflow.com/a/21833257
has comment: http://stackoverflow.com/comment/33045428

http://stackoverflow.com/q/21802969
downvote count: 0
tagged with: websocket
tagged with: tomcat
favorite count: 0
has title: Spring 4 websockets causing tons of exceptions
type: Question
score: 1
upvote count: 1
tagged with: spring
answer count: 1
has body: Ever since we started using websockets in Spring 4, our logs are littered with this exception: 3 ERROR MessageBrokerSockJS-1 handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession:276 - Terminating connection after failure to send message to client. This may be because the client has gone away (see https://java.net/jira/browse/SERVLET_SPEC-44) Feb 15 12:05:16 apmgui i-04e9bc6a: ClientAbortException: java.net.SocketException: Broken pipe Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:371) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:333) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.Response.flushBuffer(Response.java:570) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:307) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.http.server.ServletServerHttpResponse.flush(ServletServerHttpResponse.java:81) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession.writeFrameInternal(StreamingSockJsSession.java:99) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.writeFrame(AbstractSockJsSession.java:273) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.sendHeartbeat(AbstractSockJsSession.java:294) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession$1.run(AbstractSockJsSession.java:309) Feb 15 12:05:16 apmgui i-04e9bc6a: at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) Feb 15 12:05:16 apmgui i-04e9bc6a: at java.util.concurrent.Fu…
tagged with: spring-4
has answer: http://stackoverflow.com/a/21859590
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/comment/32786010
type: Comment
has text: I've never seen the need to do jquery on the server side. Is there a reason you can't add this to the xhtml page? Remember that EL gets evaluated in the ` ` blocks, too.
comment on: http://stackoverflow.com/q/21685472
score: 0
type: QuestionComment

http://stackoverflow.com/a/21698381
has comment: http://stackoverflow.com/comment/32805900
accepted answer of: http://stackoverflow.com/q/21698317
score: 1
has comment: http://stackoverflow.com/comment/32807098
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32807125
type: Answer
has comment: http://stackoverflow.com/comment/32807517
has body: To set environment variable temporary, you need to open terminal and execute in the command line: export PENTAHO_JAVA_HOME=/some/path/where/java/located If you need it persistent, you can add above line at the end of your shell configuration file. Usually, shell config file is named: ~/.profile, ~/.bashrc So, look for any of files above. If no files, create ~/.profile file: touch ~/.profile and place the command line above into it (using any text editor you prefer most). Re-login/re-boot might be necessary. To check if you have the variabled successfully set, you can execure such command in the terminal: echo $PENTAHO_JAVA_HOME It will show value of the variable.
has comment: http://stackoverflow.com/comment/32814328
upvote count: 1
answers question: http://stackoverflow.com/q/21698317
has comment: http://stackoverflow.com/comment/32813856

http://stackoverflow.com/a/21723803
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21722979
type: Answer
answers question: http://stackoverflow.com/q/21722979
has body: If you are using Spring MVC add this to your web.xml charsetFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true charsetFilter /* If no, implement your own filter for character encoding and add it to your web.xml. Have a look at code of CharacterEncodingFilter.
score: 0

http://stackoverflow.com/comment/32811360
has text: is your problem solved now? then please mark the answer as right answer.
comment on: http://stackoverflow.com/a/21698088
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32958811
has text: If you use the same name for a method in a derived class and do not intend its functionality to be somehow adequate to the functionality of its parrent method then this would be a fatal name choice leading to confusion. If you declare a method with the same method as in parrents class I can't imagine a situation when you do not want it to be used in polymorphism
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21784200
type: Comment

http://stackoverflow.com/a/21709042
has comment: http://stackoverflow.com/comment/32837779
has body: Casting null to any type is useless. Pass a real object to the constructor. Also, try adding some content to the JDialog (a label perhaps)... So that sizing won't be an issue (use an appropriate layout-manager). For location of the JDialog, refer to How do I center a JDialog on screen? or something similar. Hope this helps.
answers question: http://stackoverflow.com/q/21708752
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32825603
has comment: http://stackoverflow.com/comment/32857338

http://stackoverflow.com/comment/97025248
has text: You must always return something if the method is not `void`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21772641
type: Comment

http://stackoverflow.com/a/26848692
has comment: http://stackoverflow.com/comment/57529385
has comment: http://stackoverflow.com/comment/88175654
has comment: http://stackoverflow.com/comment/116727423
upvote count: 155
has comment: http://stackoverflow.com/comment/98800544
has comment: http://stackoverflow.com/comment/61000016
has comment: http://stackoverflow.com/comment/88175675
has comment: http://stackoverflow.com/comment/135924875
has comment: http://stackoverflow.com/comment/126035569
downvote count: 1
score: 154
has comment: http://stackoverflow.com/comment/90369255
type: Answer
has body: If you're using an annotation based security config file (@EnableWebSecurity &amp; @Configuration) you can do something like the following in the configure() method to allow for the OPTION requests to be permitted by Spring Security without authentication for a given path: @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers(HttpMethod.OPTIONS,"/path/to/allow").permitAll()//allow CORS option calls .antMatchers("/resources/**").permitAll() .anyRequest().authenticated() .and() .formLogin() .and() .httpBasic(); }
has comment: http://stackoverflow.com/comment/42323937
has comment: http://stackoverflow.com/comment/67178652
answers question: http://stackoverflow.com/q/21696592
has comment: http://stackoverflow.com/comment/83815690

intellij-idea
tags question: http://stackoverflow.com/q/21717824
tags question: http://stackoverflow.com/q/21695357
tags question: http://stackoverflow.com/q/21771305
tags question: http://stackoverflow.com/q/21834165
tags question: http://stackoverflow.com/q/21709307
tags question: http://stackoverflow.com/q/21700088
type: Tag
tags question: http://stackoverflow.com/q/21685852
tags question: http://stackoverflow.com/q/21711891
tags question: http://stackoverflow.com/q/21828269
tags question: http://stackoverflow.com/q/21716943
tag name: intellij-idea
tags question: http://stackoverflow.com/q/21699492
tags question: http://stackoverflow.com/q/21803844
tags question: http://stackoverflow.com/q/21782584
tags question: http://stackoverflow.com/q/21730990
tags question: http://stackoverflow.com/q/21698073
tags question: http://stackoverflow.com/q/21712585
tags question: http://stackoverflow.com/q/21758039
tags question: http://stackoverflow.com/q/21801765
tags question: http://stackoverflow.com/q/21726378
tags question: http://stackoverflow.com/q/21744266
tags question: http://stackoverflow.com/q/21821521
tags question: http://stackoverflow.com/q/21713414
tags question: http://stackoverflow.com/q/21800380
tags question: http://stackoverflow.com/q/21789849
tags question: http://stackoverflow.com/q/21720013
tags question: http://stackoverflow.com/q/21686783
tags question: http://stackoverflow.com/q/21708972
tags question: http://stackoverflow.com/q/21763096
tags question: http://stackoverflow.com/q/21708350
tags question: http://stackoverflow.com/q/21753267
tags question: http://stackoverflow.com/q/21780953
tags question: http://stackoverflow.com/q/21727326
tags question: http://stackoverflow.com/q/21831672
tags question: http://stackoverflow.com/q/21686237
tags question: http://stackoverflow.com/q/21824853
tags question: http://stackoverflow.com/q/21713660
tags question: http://stackoverflow.com/q/21747254
tags question: http://stackoverflow.com/q/21789090
tags question: http://stackoverflow.com/q/21686930
tags question: http://stackoverflow.com/q/21822869
tags question: http://stackoverflow.com/q/21832620
tags question: http://stackoverflow.com/q/21688759

http://stackoverflow.com/comment/32929332
type: Comment
has text: Check the source: https://github.com/facebook/conceal/blob/master/java/com/facebook/crypto/streams/NativeGCMCipherOutputStream.java Apparently they have not written the `write(int)` method. ObjectOuputStream uses this method. That method is easy enough to implement using the `write(byte[], int, int)` methods if you edit the source code. You probably want to use a `byte[]` member and declare the method synchronized to avoid thrashing the GC on every write.
comment on: http://stackoverflow.com/a/21692093
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32882966
type: Comment
has text: JSR 352 sounds like an evolution of JMS
comment on: http://stackoverflow.com/a/21732798
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32871273
comment on: http://stackoverflow.com/q/21729218
has text: Xpath is not definitive. Every object can have the same xpath, every object can have a unique xpath, every object can have many xpath. Confusing xpath as a definitive thing really grinds my gears!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21814127
has answer: http://stackoverflow.com/a/21814306
has comment: http://stackoverflow.com/comment/33012362
score: 0
upvote count: 1
has body: code will not compile byte a = 127; byte b = 1; byte c; c = (a + b); //eror System.out.println("The value of c=" + c); the compiler won't compile the code.
answer count: 1
favorite count: 0
tagged with: operators
has comment: http://stackoverflow.com/comment/33012423
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
has title: in the code snip below, the compiler won't compile

dictionary
tags question: http://stackoverflow.com/q/21797851
tags question: http://stackoverflow.com/q/21785684
tags question: http://stackoverflow.com/q/21729574
tags question: http://stackoverflow.com/q/21751253
tags question: http://stackoverflow.com/q/21709875
tags question: http://stackoverflow.com/q/21814588
tag name: dictionary
tags question: http://stackoverflow.com/q/21735328
tags question: http://stackoverflow.com/q/21720759
tags question: http://stackoverflow.com/q/21815639
tags question: http://stackoverflow.com/q/21788591
tags question: http://stackoverflow.com/q/21710068
type: Tag
tags question: http://stackoverflow.com/q/21831577
tags question: http://stackoverflow.com/q/21718901
tags question: http://stackoverflow.com/q/21713573

http://stackoverflow.com/comment/32797698
type: AnswerComment
score: 0
type: Comment
has text: I meant a mySQL db that is also hosted in Windows Azure , as far as I know , I can create a mySQL db on Windows Azure through ClearDB MySQL DB. I'm sorry for asking many questions , I hope I'm not annoying you Sir
comment on: http://stackoverflow.com/a/21690699

http://stackoverflow.com/comment/32838709
score: 0
has text: Fixed it. I had to change the do a one time delay of 500 ms in your one time postDelayed and then double the global delay of 1000 (doubling the left foot, 500 ms). You should have posted an answer. Your answer was the most helpful.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21711435

http://stackoverflow.com/comment/32997549
score: 0
comment on: http://stackoverflow.com/a/21805766
type: Comment
has text: So the dog and cat classes extend the animal class and implement the talk method. Só that You can handle both of them as animals and not just as dog or cat
type: AnswerComment

http://stackoverflow.com/comment/32784716
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21679998
has text: @MikeStrobel You are of course right. I hope it was still clear from the context, I went blind for `foo` and `bar` over the years.

http://stackoverflow.com/q/21720894
has body: Trying to create (or rather learn) a HashMap in below fashion : public class Demo{ public static void main(String args[]){ System.out.println("============Starting Hashmap============"); //hashmap portion HashMap&lt;String, Integer&gt; myMap = new HashMap&lt;String, Integer&gt;(); System.out.println("============Ending Hashmap============"); } } I am using an online complier and have searched a lot, i found that my way of declaration is correct but something else is popping up the error Below is the error Demo.java:8: error: cannot find symbol HashMap&lt;String, Integer&gt; myMap = new HashMap&lt;String, Integer&gt;(); ^ symbol: class HashMap location: class Demo Demo.java:8: error: cannot find symbol HashMap&lt;String, Integer&gt; myMap = new HashMap&lt;String, Integer&gt;(); ^ symbol: class HashMap location: class Demo 2 errors What i need help in : m just trying to get the basic of creating a hashmap and inserting some key and value in it, but above error stopped me in very first step.....any help in solving this is appreciated!! :)
downvote count: 1
type: Question
has title: "error: cannot find symbol HashMap"
has comment: http://stackoverflow.com/comment/32846103
tagged with: hashmap
score: 10
answer count: 3
has answer: http://stackoverflow.com/a/21720905
accepted answer: http://stackoverflow.com/a/21720905
possible better answer: http://stackoverflow.com/a/21720920
duplicate of: http://stackoverflow.com/q/25706216
upvote count: 11
favorite count: 0
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/63689056
linked to: http://stackoverflow.com/q/25706216
has comment: http://stackoverflow.com/comment/32846057
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21720920
tagged with: java

http://stackoverflow.com/a/21765664
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/21765631
has body: You need to implement factorial(i) yourself in Java. Just a hint: make sure it does not overflow. If needed use the BigInteger class (from the Java libraries).
type: Answer
has comment: http://stackoverflow.com/comment/32925881
has comment: http://stackoverflow.com/comment/32925856
upvote count: 7

http://stackoverflow.com/a/72828205
has comment: http://stackoverflow.com/comment/128638543
answers question: http://stackoverflow.com/q/21700467
has body: As I said in my other answer, I don't think you should mutate the list parameter. But there are times where you also don't want to take a copy of the original list and mutate the copy. The original list might be large so the copy is expensive You want the copy to be kept up-to-date with any updates to the original list. In these scenarios, you could create a MergedList which is a view over two (or perhaps more) lists import java.util.*; public class MergedList<T> extends AbstractList<T> { private final List<T> list1; private final List<T> list2; public MergedList(List<T> list1, List<T> list2) { this.list1 = list1; this.list2 = list2; } @Override public Iterator<T> iterator() { return new Iterator<T>() { Iterator<T> it1 = list1.iterator(); Iterator<T> it2 = list1.iterator(); @Override public boolean hasNext() { return it1.hasNext() || it2.hasNext(); } @Override public T next() { return it1.hasNext() ? it1.next() : it2.next(); } }; } @Override public T get(int index) { int size1 = list1.size(); return index < size1 ? list1.get(index) : list2.get(index - size1); } @Override public int size() { return list1.size() + list2.size(); } } The you could do public List<String> modifyMyList(List<String> someList){ return new MergedList(someList, List.of("foo", "bar", "baz")); }
downvote count: 0
has comment: http://stackoverflow.com/comment/128638458
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34686018
type: Comment
comment on: http://stackoverflow.com/a/22745448
has text: Hey, I am new to java programming and I make approximately everything from Netbeans GUI. So I do not know much how to code all that, care to explain?
type: AnswerComment
score: 0

http://stackoverflow.com/q/21699574
has title: Java error: class, interface, or enum expected
possible better answer: http://stackoverflow.com/a/21699808
upvote count: 3
has comment: http://stackoverflow.com/comment/32807887
has answer: http://stackoverflow.com/a/21699856
has body: I need to know the output of this code. But it's not working. Maybe the code is wrong. I'm still learning how to use Java, and I tried fixing this for hours but still no luck. Here is the code: public class A { public A() { System.out.println ("A"); } } public class B extends A { public B() { System.out.println ("B"); } } public class C extends B { public C() { System.out.println ("C"); } } public static void main(String args[]) { A a = new A(); B b = new B(); C c = new C(); } Can anyone tell me what is wrong or missing in the code?
accepted answer: http://stackoverflow.com/a/21699856
has comment: http://stackoverflow.com/comment/32808052
favorite count: 0
has comment: http://stackoverflow.com/comment/32807863
tagged with: javac
has answer: http://stackoverflow.com/a/21699962
has answer: http://stackoverflow.com/a/21699808
answer count: 4
has comment: http://stackoverflow.com/comment/32808096
type: AnsweredQuestion
tagged with: compiler-errors
downvote count: 0
has answer: http://stackoverflow.com/a/21699991
type: Question
score: 3
tagged with: java

http://stackoverflow.com/q/21733841
downvote count: 0
has body: I have the following json string returned from a webservice. How would the JAXB annotated entity have to look like? My problem: the json does not have any "outer" root element. { "Header": "head", "ProductIdentifier": "WLW", "Version": "2" } //JAXB: @XmlRootElement class JsonVO { private String header, productIdentifier, version; //constructor, getter, setter } unmarshal: builder.get(JsonVO.class); result: org.apache.cxf.jaxrs.utils.JAXRSUtils logMessageHandlerProblem Schwerwiegend: No message body reader has been found for class com.craps.service.Reseed, ContentType: application/json
favorite count: 0
score: 2
type: AnsweredQuestion
tagged with: cxf
upvote count: 2
possible better answer: http://stackoverflow.com/a/21739825
type: Question
accepted answer: http://stackoverflow.com/a/21738717
tagged with: java
has title: How to convert json to entity without root element?
tagged with: jax-ws
has comment: http://stackoverflow.com/comment/32876882
has answer: http://stackoverflow.com/a/21738717
has comment: http://stackoverflow.com/comment/32876306
answer count: 2
has answer: http://stackoverflow.com/a/21739825

http://stackoverflow.com/comment/32856465
has text: Port 80 is designated to web page requests so this will cause problems. You might want to select a different port number then investigate SOAP.
comment on: http://stackoverflow.com/q/21726759
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32991825
type: Comment
comment on: http://stackoverflow.com/a/21802675
has text: You would think that a competent programmer could think of a solution as easy as that, god I feel stupid :P Thanks
type: AnswerComment
score: 0

zbar
tags question: http://stackoverflow.com/q/21810454
tag name: zbar
type: Tag

http://stackoverflow.com/comment/32990749
type: Comment
score: 0
has text: The CoP videos may be of help - https://www.udemy.com/java-multithreading/#/lecture/108950
comment on: http://stackoverflow.com/q/21802025
type: QuestionComment

http://stackoverflow.com/a/35541665
upvote count: 4
answers question: http://stackoverflow.com/q/21783391
downvote count: 0
type: Answer
has body: I've had similar problems when the main method is on a different class than that passed to SpringApplcation.run() So the solution would be to use the line you've commented out: public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
score: 4

http://stackoverflow.com/comment/32898141
type: AnswerComment
comment on: http://stackoverflow.com/a/21750062
type: Comment
score: 1
has text: Dude... He does *not* want to change permissions on the file.

http://stackoverflow.com/a/21738456
has comment: http://stackoverflow.com/comment/32877614
has comment: http://stackoverflow.com/comment/32878029
has comment: http://stackoverflow.com/comment/32877557
has comment: http://stackoverflow.com/comment/32877640
upvote count: 1
type: Answer
has body: Here's a few reasons: Method fooIntMethod = A.foo(int).method; is syntactically incorrect Field xField = A.x.field; now you can't have a field in the x class named "field". What if people already had this in their code? This would not be backwards compatible. Same thing applies to A.foo().method. What if the response already had a field named method?
has comment: http://stackoverflow.com/comment/32877588
downvote count: 0
answers question: http://stackoverflow.com/q/21738363
score: 1

http://stackoverflow.com/a/21732414
upvote count: 2
type: Answer
has body: First of all, note that you cannot be sure that your Fruit object is an instance of Apple, and that your fruits object is not a single Fruit but a List&lt;Fruit&gt;. That said, assuming you want getAge to return the age of the first Apple in the list, you can do something like this: public void getAge() { int age = -1; for(Fruit f : fruits) { if(f instanceof Apple) { age = ((Apple)f).getAge(); } } }
answers question: http://stackoverflow.com/q/21732272
score: 2
downvote count: 0

http://stackoverflow.com/a/21780797
type: Answer
has body: Do you have a class named model.TTlsLocation or a class Entity.TTlsLocation? The persistence.xml (not persistance.xml) file mentions the former, the exception the latter. Which one is it?
answers question: http://stackoverflow.com/q/21776829
score: 0

http://stackoverflow.com/comment/33348250
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21787848
type: AnswerComment
has text: I have another related question. Are you willing to help me solve it? Here is the link to the new posting: http://stackoverflow.com/questions/22002272/entity-relationship-not-populating-properly

http://stackoverflow.com/q/21839747
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21843043
score: 0
has title: CalendarView.setTime issues
answer count: 1
has answer: http://stackoverflow.com/a/21843043
tagged with: android-calendar
has body: I'm having issues trying to use .setTime on a CalendarView object, see code below. package com.example.calendar_test; import java.util.Calendar; import java.util.Date; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.text.format.DateFormat; import android.text.format.Time; import android.view.Menu; import android.view.View; import android.widget.CalendarView; import android.widget.Toast; import android.widget.CalendarView.OnDateChangeListener; public class MainActivity extends Activity { CalendarView cv; @Override protected void onCreate(Bundle savedInstanceState) { long startDate; super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); cv = (CalendarView) this.findViewById(android.R.id.content).findViewById(R.id.calendarView1); startDate = cv.getDate(); cv.setDate(cv.getDate()); final Context context = this; cv.setOnDateChangeListener(new OnDateChangeListener(){ public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) { Date selDate = new Date(); selDate.setMonth(month); selDate.setYear(year); selDate.setDate(dayOfMonth); selDate.setTime(selDate.getTime()); view.setDate(selDate.getTime()); Date d = new Date(); d.setMonth(2); d.setYear(2014); d.setDate(22); d.setTime(d.getTime()); if(view.getDate() == d.getTime()){ Toast.makeText(context, "You hit the 22", Toast.LENGTH_SHORT).show(); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } When I run I get this message when selecting a date. 02-17 15:50:30.501: E/MessageQueue-JNI(1098): java.lang.IllegalArgumentException: Time not between Mon Jan 01 00:00:00 EST 1900 and Fri Dec 31 00:00:00 EST 2100 Blowing up on view.setDate(selDate.getTime()); I don't quite understand why selDate.getTime() isn't a valid long for view.setDate() Anyone?
tagged with: android
tagged with: calendarview
type: AnsweredQuestion

http://stackoverflow.com/comment/33059057
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21840405
score: 0
has text: I am calling `finish` in one and `finishActivity` in the other. I edited the question to clarify what I'm doing.

http://stackoverflow.com/comment/40106646
has text: This works for us as well, see my solution if you dont want to change handler.
type: Comment
comment on: http://stackoverflow.com/a/21786801
score: 0
type: AnswerComment

http://stackoverflow.com/q/21759631
tagged with: wicket
has comment: http://stackoverflow.com/comment/32967917
has comment: http://stackoverflow.com/comment/32968138
downvote count: 0
has answer: http://stackoverflow.com/a/21789936
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
has title: Wicket: Need to implement an AjaxTabbedPanel with tab error indicators
favorite count: 0
has body: I have an AjaxTabbedPanel, and each tab may contain content which is invalid. I want to indicate this to the user by highlighting the tabs with errors, using a red background. As an experiment I implemented the tabbed panel's newLink() method, and as you can see the onClick() method iterates over all the tab links of the parent panel and appends a CSS class attribute value to render a red background. But none of my tabs are being highlighted. I can find no relevant example for doing this, but it's possible someone may have done something similar, and can offer some advice. @SuppressWarnings("unchecked") @Override protected WebMarkupContainer newLink(String linkId, final int index) { return new IndicatingAjaxFallbackLink(linkId) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { setSelectedTab(index); if (target != null) { target.add(IndicatingAjaxTabbedPanel.this); int tabIndex = 0; for (ITab tab : (List&lt;ITab&gt;)getTabs()) { Component link = IndicatingAjaxTabbedPanel.this.get("tabs-container:tabs:" + tabIndex++ + ":link"); if (link != null) { link.add(AttributeAppender.append("class", "invalidValue")); target.add(link); } } } } }; }
type: UnansweredQuestion
tagged with: wicket-1.6

http://stackoverflow.com/comment/33039749
type: Comment
comment on: http://stackoverflow.com/a/21820066
score: 0
type: AnswerComment
has text: All these I was doing my entire project the wrong way...You helped me.. Thanks a lot..

http://stackoverflow.com/comment/32883071
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21741165
has text: @Brian Gordon why not? wouldnt you understand what I'm saying more easier?

http://stackoverflow.com/a/39384980
type: Answer
answers question: http://stackoverflow.com/q/21771566
downvote count: 1
has body: public class TestSplit { public static void main(String[] args) { String input="Find the repeated word which is repeated in this string"; List&lt;String&gt; output= (List) Arrays.asList(input.split(" ")); for(String str: output) { int occurrences = Collections.frequency(output, str); System.out.println("Occurence of " + str+ " is "+occurrences); } System.out.println(output); } }
score: -1
upvote count: 0

http://stackoverflow.com/comment/32832313
type: Comment
comment on: http://stackoverflow.com/a/21707944
score: 0
type: AnswerComment
has text: It works if there is only one parameter thus easy to make a comparison between names. What if it has multiple parameters? Only solution is to individual match each and every parameter to check? Tnks.

http://stackoverflow.com/comment/32962214
score: 0
type: Comment
has text: OK I've got you, I was over thinking as always! So now I have a station stored as a String, and an empty arraylist for each station which will contain its connected station. So keeping to how it is currently, how would I create the association between a Station and its Connected Station? The new Arraylist bit has no name, so how to I refer to it in the code? Is this where I need to keyset or something? Apologies, I know this must be second nature for you but its one step after brutal step for me!
type: AnswerComment
comment on: http://stackoverflow.com/a/21784629

http://stackoverflow.com/q/21716081
has comment: http://stackoverflow.com/comment/32838204
has title: call a method inside the same class
has comment: http://stackoverflow.com/comment/32838268
accepted answer: http://stackoverflow.com/a/21716192
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32838248
tagged with: java
has body: Can someone please explain why this is not working? can you not run a method that belongs to the same class? I have been going at this for a while and my brain is just starting to hurt. Thank you in advance. My error im getting is "Exception in thread 'main' java.lang.NoClassDefFoundError: dProb (wrong name:DProb)" its not a compile error though. its when i try to pass the variables. public class DProb{ public static double Combinations(long N, long X){ double comb = 0.0; long n = N; long r = X; long denom; if(n==r || r == 0) n = 1; else{ denom = n-r; for(long i = n; i &gt; denom; i--){ if (i == n){} else n *= i; } for (long i = r; i &gt; 0; i--){ if (i == r){} else r *= i; } n = n/r; } comb = n; return comb; } public static double HyperGeometric(long Np, long Xp, long N, long X){ double probX = 0.0; double leftNum = Combinations(N,X); return probX; } }
has comment: http://stackoverflow.com/comment/32838247
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21716150
has comment: http://stackoverflow.com/comment/32838219
score: 0
has comment: http://stackoverflow.com/comment/32838404
has answer: http://stackoverflow.com/a/21716192
possible better answer: http://stackoverflow.com/a/21716150
has comment: http://stackoverflow.com/comment/32838205

http://stackoverflow.com/a/21712609
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21708405
type: Answer
has body: Hej, today i have a guess day and would like to share my solution with you, maybe it fits your needs. This is a simple class, which initializes a JFrame and adds a JPanel containing a JFormattedTextField and a JButton on it. If you click the Button the Content of the TextField is printed out on the console. If the input does not match an error is displayed on the console. package com.example; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.ParseException; import javax.swing.JButton; import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.text.MaskFormatter; public class MainFrame extends JFrame { /** * */ private static final long serialVersionUID = 4159266806348540020L; private JFormattedTextField tf; private JButton clickBtn; public MainFrame(final String title) { initGUI(title); } private void initGUI(String title) { this.setTitle(title); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); try { final MaskFormatter formatter = new MaskFormatter("###-##-####"); tf = new JFormattedTextField(formatter); JPanel panel = new JPanel(new BorderLayout()); panel.add(tf, BorderLayout.NORTH); clickBtn = new JButton("Click me!"); clickBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(!tf.getText().matches(formatter.getMask())) { System.err.println("Your Input does not match the pattern!"); } else { System.out.println(tf.getText()); } } }); panel.add(clickBtn, BorderLayout.SOUTH); this.getContentPane().add(panel, BorderLayout.CENTER); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.setSize(800, 600); this.setVisible(true); } } Starting Point package com.example; public class DemoApp { public static void main(String[] args) { new MainFrame("FormattedTextField Demo"); } } Please be more detailed in setting up a question next time! Patrick
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21708405
score: -1
upvote count: 0

http://stackoverflow.com/comment/32818974
has text: @millimoose How would I do `Class.cast`? If I try: `return T.class.cast(new LoginResult() );` I get: 'cannot select from a type variable`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21705574

http://stackoverflow.com/a/21805319
score: 0
type: Answer
has body: When you want to insert a " character in a string, you have to prepend a \ to mark it as non-string-terminating.
answers question: http://stackoverflow.com/q/21805253

http://stackoverflow.com/a/21679816
downvote count: 0
has comment: http://stackoverflow.com/comment/32773223
score: 3
has comment: http://stackoverflow.com/comment/32772846
has comment: http://stackoverflow.com/comment/32773333
upvote count: 3
has comment: http://stackoverflow.com/comment/32773113
answers question: http://stackoverflow.com/q/21679787
type: Answer
has body: Use: System.getenv("PROCESSOR_IDENTIFIER"); System.getenv("PROCESSOR_ARCHITECTURE"); System.getenv("NUMBER_OF_PROCESSORS"); Note: System.getenv returns an OS-dependent mapping and may potentially return null on the keys mentioned above if they are not defined in the current OS. You can also consider using the Runtime class information: Runtime.getRuntime().availableProcessors(); If you intend to develop a tool that works like JConsole, you should explore the Java Management packages. There are a bunch of useful classes there that could suit your requirement.

http://stackoverflow.com/comment/32937278
type: QuestionComment
has text: Are there any test cases?
comment on: http://stackoverflow.com/q/21771855
score: 0
type: Comment

http://stackoverflow.com/q/21735355
has comment: http://stackoverflow.com/comment/32871743
has comment: http://stackoverflow.com/comment/32872261
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has title: Where should hibernate libraries live on web server?
has answer: http://stackoverflow.com/a/21735690
has body: I'm deploying a hibernate web servlet app onto a cloud server. I read that hibernate libraries should not go into the webapp's lib folder. I assume that means the hibernate jars should not be part of the war file? So where should the hibernate libraries go?
score: 0
answer count: 1

http://stackoverflow.com/a/21694678
answers question: http://stackoverflow.com/q/21690879
score: 0
has body: Yes, you must create a multi-module project: project-api, project-impl, project-web, etc Create your entities, interfaces and all the artifacts that you want share in "project-api" and distribute the rest of project artifacts in the other modules.
type: Answer
has comment: http://stackoverflow.com/comment/33779466
has comment: http://stackoverflow.com/comment/33778449

http://stackoverflow.com/q/21802533
type: Question
has comment: http://stackoverflow.com/comment/32991546
has body: I can write MiniJava code in Notepad++, however, I am confused as to how it can be checked, compiled and tested by myself. Would greatly greatly greatly appreciate it, if someone could tell me how.
has title: How to compile and check functionality of MiniJava programs?
score: 0
has comment: http://stackoverflow.com/comment/32991667
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32991527

http://stackoverflow.com/a/21798200
answers question: http://stackoverflow.com/q/21798049
type: Answer
has body: <property file="test.properties"/> <copy file="${src1}" todir="dest" /> <copy file="${src2}" todir="dest" /> Here src1 and src2 are the paths variables defined in your test.properties. EDIT: In that case you can use load file in combination with for task (to read file line by line) like this: <pathelement location="path/to/ant-contrib.jar"/> <loadfile property="file" srcfile="test.txt"/> <copy file="@{line}" todir="dest" /> you have to use ant-contrib for for task. Hope this helps.
has comment: http://stackoverflow.com/comment/32983992
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/42689687
type: Comment
comment on: http://stackoverflow.com/a/21886019
score: 14
has text: The correct answer for op's question is: ```jarsigner -tsa http://timestamp.digicert.com -keystore my keystore myjar.jar myalias```
type: AnswerComment

http://stackoverflow.com/a/21769176
type: AcceptedAnswer
downvote count: 0
has body: If I understand the question correctly then the issue lies in how you have used the synchronized block in the second example. You have synchronized the whole logic including the for loop inside synchronized block. While the correct way would be to just keep synchronized(monitor){ monitor.wait(); //excluding exception handling } //for loop logic Why? Because you just want the threads to wait for the nod of the main thread to start working and once they get the notification you dont want the logic to be executed in synchronized manner and so release the monitor. Because you hold the monitor while for loop, no other thread is able to proceed until the one holding it completes.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21769026
accepted answer of: http://stackoverflow.com/q/21769026

http://stackoverflow.com/a/21693812
has comment: http://stackoverflow.com/comment/32798308
answers question: http://stackoverflow.com/q/21693702
score: 0
type: AcceptedAnswer
has body: Hey what exactly are you trying to do though? Are you trying to save the same data 3 times for a different customer each? In that case, you could probably make a class that implements all of the above methods and then you could make new objects in accordance with the customers, and save those objects in an array or arraylist. I don't know if that helps, but hopefully!
type: Answer
has comment: http://stackoverflow.com/comment/32798213
accepted answer of: http://stackoverflow.com/q/21693702

http://stackoverflow.com/a/21729200
has comment: http://stackoverflow.com/comment/32862505
accepted answer of: http://stackoverflow.com/q/21729093
score: 3
has body: In android every application is a separate process, you can't do any communication except via intents, so you need to send an action intent from app1 and implement a broadcast-receiver in app2 that catches the intent and fire your activity. app1-&gt;activityA-&gt;send intent-&gt;app2 receiver-&gt;start activity-&gt; activityB here is another way offered by official doc where you can skip broacastreceivers as your activity will be the receiver of a certain intent filter
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32860447
answers question: http://stackoverflow.com/q/21729093
type: Answer

http://stackoverflow.com/comment/32914527
type: AnswerComment
comment on: http://stackoverflow.com/a/21759543
has text: So to get a close enough estimate of the GC activity I should run a collection thread and my application in the same thread?
type: Comment
score: 0

http://stackoverflow.com/comment/32901886
type: AnswerComment
comment on: http://stackoverflow.com/a/21752201
score: 0
type: Comment
has text: under data we get the array

http://stackoverflow.com/comment/32831872
score: 0
type: Comment
type: AnswerComment
has text: so the compiler looks to see whether what is assigned is valid or not but throws out when it goes to next line..?
comment on: http://stackoverflow.com/a/21712270

http://stackoverflow.com/a/21760324
type: Answer
has comment: http://stackoverflow.com/comment/32916802
upvote count: 1
score: 1
has body: Each time you create a new StudentInformation[i] you override the last student information array, but you don't copy its values. This means the after the first makeChoice() your studentInformation variable will contain: [StudentInformation&lt;--some data--&gt;] After the second call to makeChoice() it will contain: [null, StudentInformation&lt;--new data--&gt;] After the tenth call is will look like: [null, null, null, null, null,...,StudentInformation&lt;--some new data--&gt;] Then, when you print it, it will cause an NLE.
has comment: http://stackoverflow.com/comment/32916375
downvote count: 0
answers question: http://stackoverflow.com/q/21759939

http://stackoverflow.com/comment/55939373
type: Comment
comment on: http://stackoverflow.com/a/34058580
has text: @Springrbua And if you want to pitch, camera could be rotated around the direction vector. I didn't test this.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32903297
score: 0
type: Comment
type: QuestionComment
has text: yeah, i already import library.
comment on: http://stackoverflow.com/q/21753005

http://stackoverflow.com/q/21730285
answer count: 1
favorite count: 0
tagged with: statistics
accepted answer: http://stackoverflow.com/a/21735516
tagged with: excel
has answer: http://stackoverflow.com/a/21735516
type: AnsweredQuestion
has body: I'm trying to calculate a the inverse of a 2 tailed Student Distribution using commons-math. I'm using Excel to compare values and validate if my results are correct. So Using excel to calculate TINV with 5 degrees of freedom and 95.45% I use =TINV(0.0455,5) And get the Result: 2.64865 Using commons Math like so : TDistribution t = new TDistribution(5); double value = t.inverseCumulativeProbability(0.9545); I get Result : 2.08913 I'm probably doing something wrong obviously. I'm not really that math savvy but I need to port an Excel sheet formula to Java for a project and got stuck on this. What should I be using to get the result exactly like the TINV value? What am I missing.
downvote count: 0
score: 1
tagged with: java
tagged with: apache-commons-math
has title: Calculating t-inverse
type: Question
upvote count: 1

http://stackoverflow.com/a/37327882
downvote count: 0
answers question: http://stackoverflow.com/q/21774894
has body: I was facing similar problem in database backup from MYSQL through JDBC. So I ran the below code. String path = C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump String command= "cmd.exe /c " + "\"\""+path+"\" " + " --user="+UserInputs.getDbUserName() + " --password="+UserInputs.getDbPassword() + " --host="+UserInputs.getDbConnectionIP() + " --protocol=tcp " + " --port="+UserInputs.getDbConnectionPort() + " --default-character-set=utf8 " + " --single-transaction=TRUE " + " --routines " + " --events " + "\""+UserInputs.getDbName() +"\" " + "&gt;" + " \"" + "D:\\MY DATA\\DB_Backup.sql" + "\"" + " \""; Runtime runtime = Runtime.getRuntime(command); In case password is blank remove the --password line. This will create your database backup. In case you are running this on LINUX replace cmd.exe /c by /bin/sh -c Thanks!
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/32916517
has text: @JBNizet: I fully understand this. What I tried to say is that (finally) JPA because of it all (no way to enforce the constructor arguments of an enum) chooses to use `name()`. You did answer my question (finally) which was indeed on JPA (did mention Hibernate till you did), so please :)
score: 0
comment on: http://stackoverflow.com/q/21759197
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32911835
type: Comment
comment on: http://stackoverflow.com/a/21756365
has text: @ExcelledProducts: I flipped the negation in numerator and denominator and now it is working! Thanks for your time.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32835564
score: 0
type: Comment
has text: My guess would be that either `zam.klient` or `zam.klient.getAdres()` is `null`. Do you set `zam.klient` in the constructor of `Zamowienie`?
type: QuestionComment
comment on: http://stackoverflow.com/q/21714119

http://stackoverflow.com/comment/32882906
type: Comment
comment on: http://stackoverflow.com/a/21737252
has text: Read my answer again, and understand that initializing your list with new ArrayList is a waste of time and resources, since you're throwing this new ArrayList away right after. You didn't show what your original code looked like in your answer, so I can't know what you have after `List<Object[]> itemProdutoLista =`. You should have the same thing as what you have right now. What matters is the type of the list, which shouldn't be `List<Composicao>`, but `List<Object[]>`. I have the feeling that you don't understand types and variables and methods. You should learn that much before using JPA.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21773299
has comment: http://stackoverflow.com/comment/32939670
type: Question
score: 0
answer count: 1
tagged with: android-asynctask
tagged with: android
has comment: http://stackoverflow.com/comment/32939679
has body: I have a problem regarding Async task Async from android Using 2 activities "A" and "B" by entering a word to search from the url and and store value in DTO and then fetching values from getter and setter. My complication is that i have implemented async in my activity "B" and that activity is fetching value from same DTO. Problem is that how my post know that do in background have fetched value from DTO and DTO have fetched value from internet...in case of slow internet connection. I m sending intent from "A" to "B" and showing the results on "B" PROBLEM: 1. If i remove async then app shows black page and also freezes (in case of slow connection only) but data is displayed 2. If i use aync then sometimes progress dialog show for long time and inspite of knowing that data is already displayed in UI code links https://www.dropbox.com/s/p27rpokz68sryv3/SearchData.java https://www.dropbox.com/s/rm3i52djiay327u/SearchData_DTO.java https://www.dropbox.com/s/2hpufx2a12480on/Search.java Pls suggest me the possible solution for this Regards
has title: AsyncTask (Asynchronous processes)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21773406
accepted answer: http://stackoverflow.com/a/21773406
tagged with: java

http://stackoverflow.com/q/21708392
has answer: http://stackoverflow.com/a/21712010
type: Question
has body: Right now I have a texview that's being generated by pulling a large paragraph from a database. This paragraph gives an overview, and should have multiple links in it to another view. I.e., the paragraph will say something like: Angry Birds is a fun app. Flappy Birds is a frustrating app. But in the database, there is something along the lines of this: [**Angry Birds**](/app_reviews/3326) is a fun app. [**Flappy Birds**](/app_reviews/4458) is a frustrating app. Basically, this paragraph will have descriptions about different "apps", and when you click on the name of the app, it should open up another activity that is a review of the app. The name of the app in the paragraph should be underlined or another color, like a link. So far, I've come to the conclusion that since this is a large paragraph of text in a single textview, I'd like to parse the string before it enters the text view and insert an href link to the other activity, passing the review id to the new view. Is this a viable way of doing this? So far, if I include the link to the new activity and I click on it, I get a "Unfortunately, the has stopped working" message. I believe it isn't linking correctly. Here is a snippet of my AndroidManifest.xml file with the activity I want to link to: <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.LAUNCHER" /> Here is the code in my original activity where I am hosting my textview: TextView categoryBlurb = (TextView)findViewById(R.id.categoryBlurb); categoryBlurb.setText(Html.fromHtml(" This is an app link to Angry birds ")); categoryBlurb.setMovementMethod(LinkMovementMethod.getInstance()); and this is the AppReviewActivity.java code: public class AppReviewActivity extends BaseActivity { private AppReview review; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_app_review); Uri passedData = getIntent().getData(); if (passedData != …
score: 0
tagged with: android
answer count: 1
tagged with: textview
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has title: Need to route to another activity when different links in a textview are clicked
tagged with: java

http://stackoverflow.com/comment/33026164
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21821275
has text: Thanks for the quick response, MadProgrammer. This may work except I get this error. "java.lang.string.replaceall(unknown source)". I tried "\\r\\n|\\n" which also yielded the same error.
score: 0

http://stackoverflow.com/comment/32781073
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21683904
has text: @rdllopes my mistake, I read the title and whole first paragraph as a duplicate. hopefully someone with a better understanding of the question will edit.

http://stackoverflow.com/comment/32939629
type: Comment
comment on: http://stackoverflow.com/a/21773305
score: 3
has text: This is more of a comment. Not an answer
type: AnswerComment

http://stackoverflow.com/comment/32938406
type: Comment
has text: Click on `Android Virtual Device Manager` from your tool bar then it will load all the emulator list.
comment on: http://stackoverflow.com/q/21771952
score: 0
type: QuestionComment

http://stackoverflow.com/q/21679787
type: Question
tagged with: c#
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32773192
favorite count: 0
has body: Is it possible to create a program in java (Or C#) that can check how big the users CPU power is? If so, what classes/API are available to look up? I can't seem to find anything by googling.
has answer: http://stackoverflow.com/a/21680672
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21679816
has comment: http://stackoverflow.com/comment/32777476
tagged with: java
linked to: http://stackoverflow.com/q/1020581
has title: java program that determines users CPU size?
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/33059391
type: Comment
comment on: http://stackoverflow.com/q/21840587
score: 0
has text: it only has readlong and it always gets the wrong value
type: QuestionComment

http://stackoverflow.com/comment/32997885
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21805952
score: 0
has text: No, it's not that. Cleaned, rebuilt, remade, moved code around a little just for the sake of it too - no difference. I created a new test project just to check it, and I'm running it on an actual device, not an emulator. Try it!

http://stackoverflow.com/q/21812830
accepted answer: http://stackoverflow.com/a/21813200
has comment: http://stackoverflow.com/comment/33026460
has comment: http://stackoverflow.com/comment/33026324
tagged with: socketserver
type: AnsweredQuestion
has title: Problems with java sockets
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21813200
upvote count: 1
type: Question
downvote count: 0
has body: I'm trying to reprodruce a client-server architecture in order to understand java sockets. So I have a client that sends a message to the server, and the server just "say" something like "(Server) " So here we go : public class ServeurTCP { static ServerSocket socketServeur; static Socket socketVersUnClient; static BufferedReader in; static PrintWriter out; public static void main(String[] args){ //attente des connexions sur le port 9999 //traitement des exceptions try { socketServeur = new ServerSocket(9999); } catch (IOException e) { e.printStackTrace(); } //dans une boucle pour chaque socket clientes, appeler traiterSocketClient while(true) { try { socketVersUnClient = socketServeur.accept(); System.out.println("Attente des clients"); in = creerReader(socketVersUnClient); out = creerPrinter(socketVersUnClient); envoyerMessage(out,"test"); System.out.println(recevoirMessage(in)); traiterSocketClient(socketVersUnClient); } catch (IOException e) { e.printStackTrace(); } } } public static void traiterSocketClient(Socket socketVersUnClient) { //CrÃ©er printer et reader //Tant qu'il y'a message Ã lire via recevoirMessage while(!recevoirMessage(in).equals("fin")) { System.out.println("ici"); //Envoyer message client via envoyerMessage try { envoyerMessage(out,"(Serveur) message : "+in.readLine()); } catch (IOException e) { e.printStackTrace(); } finally { try{ socketVersUnClient.close(); } catch(IOException e){ e.printStackTrace(); } } } } public static BufferedReader creerReader(Socket socketVersUnClient) { //crÃ©e BufferedReader associÃ© Ã la socket try { return new BufferedReader(new InputStreamReader(socketVersUnClient.getInputStream())); } catch (IOException e) { e.printStackTrace(); } return null; } public static PrintWriter creerPrinter(Socket socketVersUnClient) { //crÃ©e PrintWriter associÃ© Ã la socket try { return new PrintWriter(socketVersUnClient.getOutputStream()); } catch (IOException e) { e.printStackTrace(); } return null; } public static String recevoi…
tagged with: client-server
has comment: http://stackoverflow.com/comment/33010348
answer count: 1
has comment: http://stackoverflow.com/comment/33010304
favorite count: 0
has comment: http://stackoverflow.com/comment/33010154
has comment: http://stackoverflow.com/comment/33010330
tagged with: sockets

http://stackoverflow.com/comment/32898891
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21749182
has text: Thanks for the help Jim. I have updated the question with the tested solution.

http://stackoverflow.com/comment/32991587
has text: First step: [Acquire HTML Parser](http://jsoup.org/)
type: QuestionComment
comment on: http://stackoverflow.com/q/21802616
score: 0
type: Comment

http://stackoverflow.com/q/21784027
linked to: http://stackoverflow.com/q/4497579
has answer: http://stackoverflow.com/a/21784230
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/21784469
linked to: http://stackoverflow.com/q/1119677
has answer: http://stackoverflow.com/a/21784269
has comment: http://stackoverflow.com/comment/32958392
answer count: 5
linked to: http://stackoverflow.com/q/1062941
has body: How can I get this Java code to run outside of Eclipse? import java.util.*; public class Calculations { public static void main(String[] args) { Scanner console = new Scanner (System.in); System.out.println("So... you want to figure out what the Hypotenuse of any Right Triangle is but your to"); System.out.println("lazy to do it your self huh..Sigh... Ok well, At least your being honest about it :)"); System.out.println(); System.out.println("Lets do this...Pythagoreom Style"); System.out.println(); System.out.println("First things first, whats your Sine? And no I don't mean if your an Aquarious or"); System.out.print("some shit like that, I mean your Y value or the first side of your triangle? "); double side1 = console.nextDouble(); System.out.println(); System.out.println("Okayyyy and now as any good math teacher would say, Whats your Cosine or X value?"); System.out.print("(You might as well learn some Trigonometry while your taking the easy way out) "); double side2 = console.nextDouble(); System.out.println(); System.out.println("Ok give me a minute... "); System.out.println(); System.out.println(); System.out.print("Oh, by the way whats your favorite food? "); String x = console.next(); System.out.println(); System.out.println(); double hypotonuse = Math.sqrt((Math.pow(side1,2)+ Math.pow(side2,2))); System.out.println("So you favorite food is " + x + " Huh...well...THATS BESIDES THE POINT!!! BACK TO MATH!!!"); System.out.println(); double sum = (Math.pow(side1,2)+Math.pow(side2,2)); System.out.println("So if your First Side is "+side1 + " and we square that and your Second Side is " + side2+ " and we square that too,"); System.out.println(); System.out.println("we can add those sides together to get our sum of "+sum+" Finally we can square root "+sum+ " and Viola!"); System.out.println(); System.out.println("Pythagoras says your Hypotenuse is "+ hypotonuse); System.out.println(); System.out.println(); System.out.println("HHHAAAZZZAAAAA!!!! FOR MATH!!! HAAAZZZ…
has title: Executable Jar files
has answer: http://stackoverflow.com/a/21784580
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21784177

http://stackoverflow.com/q/21771003
has title: How I compile my server code on server?
has comment: http://stackoverflow.com/comment/32935684
possible better answer: http://stackoverflow.com/a/21771541
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32935687
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21771541
score: 0
has comment: http://stackoverflow.com/comment/32935710
accepted answer: http://stackoverflow.com/a/21771152
has answer: http://stackoverflow.com/a/21771152
tagged with: sockets
has body: I am new in socket programming. i have two java programs( Client.java and Server.java), For socket programming i want to compile my server.java code to server which always listen to socket, But i don't know what i do on server. Server.java import java.lang.*; import java.io.*; import java.net.*; class Server { public static void main(String args[]) { String data = "Toobie ornaught toobie"; try { ServerSocket srvr = new ServerSocket(1234); Socket skt = srvr.accept(); System.out.print("Server has connected!\n"); PrintWriter out = new PrintWriter(skt.getOutputStream(), true); System.out.print("Sending string: '" + data + "'\n"); out.print(data); out.close(); skt.close(); srvr.close(); } catch(Exception e) { System.out.print("Whoops! It didn't work!\n"); } } } Client.java import java.lang.*; import java.io.*; import java.net.*; class Client { public static void main(String args[]) { try { Socket skt = new Socket("localhost", 1234); BufferedReader in = new BufferedReader(new InputStreamReader(skt.getInputStream())); System.out.print("Received string: '"); while (!in.ready()) {} System.out.println(in.readLine()); // Read one line and output it System.out.print("'\n"); in.close(); } catch(Exception e) { System.out.print("Whoops! It didn't work!\n"); } } }

http://stackoverflow.com/comment/32975315
comment on: http://stackoverflow.com/a/21793210
score: 0
type: Comment
has text: Please provide an answer with better formatting, this is difficult to understand.
type: AnswerComment

http://stackoverflow.com/comment/32896462
type: Comment
type: QuestionComment
has text: You can make third project with internalization only and add dependency of new project to mainProject and projectForTesting
comment on: http://stackoverflow.com/q/21748675
score: 0

http://stackoverflow.com/q/21781520
duplicate of: http://stackoverflow.com/q/21771566
has comment: http://stackoverflow.com/comment/32953684
has comment: http://stackoverflow.com/comment/32953710
type: AnsweredQuestion
has body: I have a already sorted string array named arr and Supposing I enter the sentence hello how hello to how me in Desired Output is hello 2 how 2 me 1 in 1 to 1 Here's how I am trying to count it int counter = 1; for(j1 = 0; j1 &lt; arr.length; j1++){ if(j1 + 1 &lt; arr.length){ if(arr[j1].equals(arr[j1 + 1])){ counter++; } else { System.out.println(arr[j1] + " " + counter); counter = 1; } } } but this is not working , please help?
score: -5
has comment: http://stackoverflow.com/comment/32953680
upvote count: 2
downvote count: 7
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21781828
answer count: 1
has comment: http://stackoverflow.com/comment/32953821
linked to: http://stackoverflow.com/q/21771566
favorite count: 0
has comment: http://stackoverflow.com/comment/32953603
has comment: http://stackoverflow.com/comment/32953772
has title: Java - Adjacent comparing and calculating frequency of words
accepted answer: http://stackoverflow.com/a/21781828

http://stackoverflow.com/comment/32782678
has text: For the interface D I wanted to inherit methods from B too. Sorry may not clear the question.
comment on: http://stackoverflow.com/a/21685251
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32783292
comment on: http://stackoverflow.com/a/21684826
has text: That is what UnitTests are for ... write a UnitTest that would fail in lower memory and test it.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32934544
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21742875
has text: No worries, we've all stared at code looking for a bug until it starts looking like the Matrix's source! I've not used jGRASP. The industry standard IDEs are Eclipse and IntelliJ. The former is completely free, the latter has a free community edition with reduced feature set (although probably fine for your course). However, if everyone in your class are using the same tool, then it's probably worth persevering with it.

http://stackoverflow.com/q/21753639
has comment: http://stackoverflow.com/comment/32905304
has comment: http://stackoverflow.com/comment/32905801
has comment: http://stackoverflow.com/comment/32905079
has comment: http://stackoverflow.com/comment/32905015
type: AnsweredQuestion
has title: Message is not shown on ajax update
tagged with: jsf
tagged with: java
has comment: http://stackoverflow.com/comment/32906558
has body: I've read dozens of question regarding similar problem, but could not find an answer to it. I've got this piece of code inside a form: &lt;p:outputPanel id="articleInfo"&gt; &lt;p:growl id="messages" autoUpdate="true"/&gt; &lt;p:panel rendered="#{not empty myBB.selectedProduct}"&gt; &lt;p:panel&gt; &lt;h:outputText escape="false" value="#{myBB.content}"/&gt; &lt;/p:panel&gt; &lt;p:commandButton value="Button" update=":mainForm:articleInfo"/&gt; &lt;/p:panel&gt; &lt;/p:panel&gt; When I click a button, new content is generated in the backing bean and FacesMessage is added like this: public String getContent(){ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, title, detail)); return "something"; } The ajax update is fine because I see new content, addMessage is also called, but I cannot see the message. I've tried p:messages instead of growl, adding for="mainForm:articleInfo" and calling the addMessage with "mainForm:articleInfo" (I've checked that it's the correct ID in the view. I still cannot find a reason for this.
type: Question
has comment: http://stackoverflow.com/comment/32906732
tagged with: primefaces
has answer: http://stackoverflow.com/a/21755725
accepted answer: http://stackoverflow.com/a/21755725
has comment: http://stackoverflow.com/comment/32904804
has comment: http://stackoverflow.com/comment/32907415
linked to: http://stackoverflow.com/q/2090033
score: 0
has comment: http://stackoverflow.com/comment/32904723
has comment: http://stackoverflow.com/comment/32905171
answer count: 1
tagged with: ajax
has comment: http://stackoverflow.com/comment/32905827

http://stackoverflow.com/a/21763803
answers question: http://stackoverflow.com/q/21763656
has comment: http://stackoverflow.com/comment/32922687
has comment: http://stackoverflow.com/comment/32963574
has comment: http://stackoverflow.com/comment/32958749
has comment: http://stackoverflow.com/comment/32936292
has comment: http://stackoverflow.com/comment/32968126
type: Answer
has comment: http://stackoverflow.com/comment/32935037
has comment: http://stackoverflow.com/comment/32963853
has comment: http://stackoverflow.com/comment/32931846
has comment: http://stackoverflow.com/comment/32929294
has comment: http://stackoverflow.com/comment/32960245
has comment: http://stackoverflow.com/comment/32963866
has comment: http://stackoverflow.com/comment/32929351
has body: Just add a "Clear" button and in the handler, set boxCount back to zero and call repaint(). You'll have to adjust actionPerformed to detect when the clear button was the source. EDIT: Here's your code modified to add a clear function (just for boxes, but see below): JButton boxButton; JButton clearButton; // NEW public static void main(String[] args) { System.out.println("hi there."); new Kaleidescope(); setDefaultCloseOperation(EXIT_ON_CLOSE); addMouseListener(this); addMouseMotionListener(this); boxes = new Box[20]; boxCount = 0; setLayout(new FlowLayout()); boxButton = new JButton("Boxes"); add(boxButton); boxButton.addActionListener(this); // NEXT 3 LINES ARE NEW clearButton = new JButton("Clear"); add(clearButton); clearButton.addActionListener(this); setSize(new Dimension(500, 500)); setVisible(true); } public void actionPerformed(ActionEvent e) { if (e.getSource() == boxButton) { mode = 2; repaint(); } else if (e.getSource() == clearButton) { // release all existing boxes while (boxCount-- &gt; 0) boxes[boxCount] = null; // TODO: zero out all other display list items as well // redraw everything (which is now nothing) repaint(); } } Since you don't show how you are maintaining the list of other shapes, I can't provide specific code for the TODO part. However, it would look quite similar to what I've posted. EDIT 2: Here's how I would recommend switching things around to use ArrayLists instead of arrays. I'll just describe how to change things for boxes; the other shapes would be similar. Import java.util.ArrayList. Eliminate the variable boxCount. Change Box[] boxes; to ArrayList&lt;Box&gt; boxes; Replace the lines boxes = new Box[20]; boxCount = 0; with: boxes = new ArrayList&lt;Box&gt;(); // or new ArrayList&lt;&gt;() for Java 7+ compiler Replace the line: boxes[boxCount++] = new Box(e.getX(), e.getY(), randomColor()); with: boxes.add(new Box(e.getX(), e.getY(), randomColor())); Replace the line: while (boxCount-- &gt; 0) boxes[boxCount] = null; with: boxes…
has comment: http://stackoverflow.com/comment/32961093
has comment: http://stackoverflow.com/comment/32958239
score: 0
has comment: http://stackoverflow.com/comment/32962259

http://stackoverflow.com/a/21749182
upvote count: 2
has comment: http://stackoverflow.com/comment/32896515
has comment: http://stackoverflow.com/comment/32896451
has comment: http://stackoverflow.com/comment/32896745
has comment: http://stackoverflow.com/comment/32898891
score: 2
accepted answer of: http://stackoverflow.com/q/21748767
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21748767
type: Answer
has body: You need 2 tables: KEYS and VALUES where VALUES should have a foreign key column referencing KEYS. Example: TABLE KEYS: | ID | KEY | | 1 | key1| TABLE VALUES: | ID | KEY_ID | VALUE | | 1 | 1 | value1| | 2 | 1 | value2| Now to persist a multimap you need to first persist the a key in the KEYS table and then the corresponding values in the VALUES table. Let me know if you need an example of that. EDIT: See comments You should use the foreach tags in mybatis. Do a foreach on the keyset or on the entries. Something like this should work: INSERT INTO table1 (integer1, integer2) VALUES &lt;foreach item="item" seperator="," collection="#{entries}"&gt; ( #{item.key)},#{item.value}) &lt;/foreach&gt; Where entries should reference the MultiMap.Entries()

http://stackoverflow.com/comment/32950459
type: Comment
has text: Genc, I am getting en error on the word List in List<JButton> availableButtons = new ArrayList<JButton>();
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21779658

http://stackoverflow.com/comment/33034256
type: AnswerComment
type: Comment
has text: I've never used Play, but a quick google search on 'play framework interceptor' showed me this: http://www.playframework.com/documentation/2.0.4/JavaInterceptors which might be of use.
comment on: http://stackoverflow.com/a/21825495
score: 0

http://stackoverflow.com/comment/33001959
type: QuestionComment
comment on: http://stackoverflow.com/q/21808255
score: 0
has text: If you want a delay of sixty seconds, why are you specifying a delay of one second?
type: Comment

http://stackoverflow.com/comment/32917723
comment on: http://stackoverflow.com/a/21757433
score: 0
type: AnswerComment
has text: EDIT: I'm so sorry man. It just didn't work in the emulator, it works perfectly fine on my phone when compiled to an app! If I could give u a medal I would, great man!
type: Comment

http://stackoverflow.com/comment/32867772
score: 1
has text: In that case, it might be good to note that setting variable to null doesn't necessarily mean that it's no longer in ram. There might be a delay before they are GC.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21733040

http://stackoverflow.com/q/21773498
upvote count: 1
answer count: 1
tagged with: autocompletetextview
favorite count: 0
linked to: http://stackoverflow.com/q/9249919
has answer: http://stackoverflow.com/a/21774344
accepted answer: http://stackoverflow.com/a/21774344
has body: When I fill name and select in auto-complete text-view. It's not working same spinner. function in if-else not working or condition incorrect(I don't know).Please suggest me how to use onitemselectlistener on auto-complete text-view to use function in each condition. AutoCompleteTextView auto1 = (AutoCompleteTextView)findViewById(R.id.autoCompleteTextView1); String[] word; word = getResources().getStringArray(R.array.word_name); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line, word); auto1.setAdapter(adapter); auto1.setOnItemSelectedListener(new OnItemSelectedListener() { TextView txt1 = (TextView)findViewById(R.id.textView1); @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if(arg2==0) // when I fill AED(array 0 in string.xml It's not work) { getmoney(); } else if(arg2==1) { getmoney1(); } } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); String.xml AED United Arab Emirates Dirham AFN Afghan Afghani ALL Albanian Lek AMD Armenian Dram
tagged with: android
type: AnsweredQuestion
downvote count: 0
has title: How to use autocomplete textview
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32941372
type: Question

http://stackoverflow.com/q/21784104
tagged with: java.util.scanner
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21785232
type: Question
has title: reading input from URL in java and sorting values
score: 0
has body: I am having some trouble find a solution to a problem. I have already did a search to see if I could find the answer, and I did not find anything that help me understand the problem clearer. I think I am missing a part of key point in using wrappers. Here is the problem: I need to use the URL class to read input from the site below. national weather service Once I read it in I need to find the minimum temperature and the day. The temperature and the day will be variables and I must use ArrayList to collect and store them. I understand the individual parts that I need to use ArrayList, Scanner and Exception except URL. When I read the URL how do I extract just the values I need? Should I read the input to a file? I feel I will still be back at square one. Trying to separate the column of days and temperate from everything else.
answer count: 1

java-bytecode-asm
tags question: http://stackoverflow.com/q/21757947
type: Tag
tag name: java-bytecode-asm

http://stackoverflow.com/comment/33049830
type: QuestionComment
has text: What's `ChannelBuffer`?
type: Comment
comment on: http://stackoverflow.com/q/21835483
score: 0

http://stackoverflow.com/a/21735168
has comment: http://stackoverflow.com/comment/32873237
answers question: http://stackoverflow.com/q/21735131
score: 5
accepted answer of: http://stackoverflow.com/q/21735131
has body: Sat has a t in it. Try ":([tf])" instead. Pattern p = Pattern.compile(":([tf])"); Matcher m = p.matcher("Sun:t Mon:f Tue:t Wed:t Thu:f Fri:t Sat:f "); while (m.find()) { System.out.println(m.group(1)); }
has comment: http://stackoverflow.com/comment/32871770
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/q/21761488
has comment: http://stackoverflow.com/comment/32918093
has body: I can't seem to get the last "i" in this code to fully function, it wont respond to the initial "i", just tells me that it "cannot find symbol". What am I doing wrong? public void fillCB (JComboBox cb){ String sqlQueryCB = "select namn from ANSTALLD order by namn"; try { ArrayList&lt;String&gt; listaAnstalld = idb.fetchColumn(sqlQueryCB); for(int i = 0; i &lt; listaAnstalld.size(); i++); { cb.addItem(listaAnstalld.get(i)); } } catch(Exception e) { }
has answer: http://stackoverflow.com/a/21761560
tagged with: java
downvote count: 1
type: Question
tagged with: for-loop
upvote count: 0
score: -1
answer count: 1
favorite count: 0
has title: Cannot find i in the for loop
type: UnansweredQuestion

http://stackoverflow.com/a/57500486
has body: public static boolean between(int variable, int minValueInclusive, int maxValueInclusive) { return variable &gt;= minValueInclusive &amp;&amp; variable &lt;= maxValueInclusive; } A Java method to determine if an integer is between a range
type: Answer
upvote count: 6
downvote count: 1
has comment: http://stackoverflow.com/comment/112557190
has comment: http://stackoverflow.com/comment/112552166
score: 5
answers question: http://stackoverflow.com/q/21761875
has comment: http://stackoverflow.com/comment/112380960

http://stackoverflow.com/q/21753687
type: Question
has comment: http://stackoverflow.com/comment/32904182
tagged with: java
has title: Invoke a javascript function of a website from java code?
possible better answer: http://stackoverflow.com/a/21753728
has answer: http://stackoverflow.com/a/21753728
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21754420
has comment: http://stackoverflow.com/comment/32904048
tagged with: javascript
has answer: http://stackoverflow.com/a/21754012
has body: Is it possible to use java code to invoke a javascript function that is in the sourcecode of a website? Imagine a website with following code: &lt;script&gt; function sayHello(name) { return "Hello " + name; } &lt;/script&gt; Could I call "sayHello" from a client connecting to that webpage? (I know I could call javascript from java if I have the *.js file locally saved. But I don't want this as the JS might change on the website I want to invoke the function). ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); engine.eval(..); //is it possible to invoke the JS function on the website?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21754420

http://stackoverflow.com/q/21829531
has body: 3 questions: 1.Does anybody know a CA company which allows me to put the bought CA certficate inside SoftHSM (the same as an HSM but without any hardware, this is pure software)? 2.Is it hard to work with the PKCS11 interface? I have a Java application which will sign documents. But I need to communicate through the PKCS11 interface. Anybody had any experience with it before? Is there any tutorial on this? 3.If I buy an trusted certficate, why don't they deliver it in .crt? I have a trial certificate, but my browser just imports it. Don't see where to download this certificate so I can store it my hsm. Please help to clear my mind.
has title: Root certifcate from an CA company which can be encrpyted by SoftHSM
tagged with: security
tagged with: hsm
has answer: http://stackoverflow.com/a/23068587
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: ca
score: 1
tagged with: java
tagged with: encryption
upvote count: 1
type: Question

http://stackoverflow.com/q/21782861
has answer: http://stackoverflow.com/a/21816474
accepted answer: http://stackoverflow.com/a/21816474
favorite count: 0
has comment: http://stackoverflow.com/comment/33002016
has comment: http://stackoverflow.com/comment/32969588
tagged with: sesame
has body: I am writing an Java web application that fetches RDF data from URIs and stores them in a Jena Model object. Currently the models contain ordinary triples, some Blank Nodes, no inference. (That is described here already 1). Using Sesame would be an option, too. After data collection, the application displays some of the collected information in a specified order. It would be necessary to build filters on the model using predicates only and filters specifiying subject & predicate (as we will collect data from several sources); in each case, the object-literal or URI would be displayed. What would be the best way to generically access the model's contents from a JSP-View (without writing custom tags for each function)? The JSP-View would look like this: <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> Name: <c:out value="${modelBean.model.namePred}"/> Life dates: <c:out value="${modelBean.model.birthPred}"/>-<c:out value="${modelBean.model.deathPred}"/> Links: Linktext ... Jena-Servlet to collect data: protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ModelBean modelBean = new ModelBean(); Model model = ModelFactory.createDefaultModel(); model.read("http://dbpedia.org/resource/Ludwig_van_Beethoven"); modelBean.setModel(model); request.setAttribute("modelBean", modelBean); RequestDispatcher rd = request.getRequestDispatcher("/view.jsp"); rd.forward(request, response); } Sesame-Variant of the Servlet: protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ModelBean modelBean = new ModelBean(); URL url = new URL("http://dbpedia.org/resource/Ludwig_van_Beethoven"); URLConnection conn = url.openConnection(); conn.addRequestProperty("Accept", RDFFormat.TURTLE.getDefaultMIMEType()); InputStream is = conn.getInputStream(); try { Model model = Rio.parse(is, url.…
tagged with: http://stackoverflow.com/tag/rdf
has comment: http://stackoverflow.com/comment/33016451
upvote count: 1
tagged with: spring
linked to: http://stackoverflow.com/q/7121303
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33015550
type: Question
has title: What is the best way to make an RDF Model accessible in a JSP view?
has comment: http://stackoverflow.com/comment/32977409
tagged with: jena
answer count: 1
downvote count: 0

http://stackoverflow.com/a/21779441
score: 0
has body: get imageview's bitmap: Bitmap bitmap = ((BitmapDrawable)image.getDrawable()).getBitmap(); get color of pixel at location: int pixel = bitmap.getPixel(x,y); split in RGB: int redValue = Color.red(pixel); int blueValue = Color.blue(pixel); int greenValue = Color.green(pixel); there you have your color for a specific pixel.
type: Answer
answers question: http://stackoverflow.com/q/21779371

http://stackoverflow.com/comment/32958604
score: 0
type: Comment
type: QuestionComment
has text: @Seth yes i know i did in fact but i have to do it with an exception, because this is for a project and the professor asked that part have to be handled with an exception
comment on: http://stackoverflow.com/q/21783914

http://stackoverflow.com/q/21703678
type: Question
has comment: http://stackoverflow.com/comment/32815464
upvote count: 0
accepted answer: http://stackoverflow.com/a/21704370
has title: I can not send a Request
has comment: http://stackoverflow.com/comment/32815277
has comment: http://stackoverflow.com/comment/32815412
answer count: 1
has comment: http://stackoverflow.com/comment/32815723
favorite count: 0
has answer: http://stackoverflow.com/a/21704370
has body: I think my problem will be e laughti thing for you. I have three classes called (CloudCommunicator, EnergyManagerJob and the Main) My CloudCommunicator looks like that: public class CloudCommunicator { private String _chargingStationId; public void cloudCommunicator(String charginStationId) { _chargingStationId = charginStationId; } public EnergyManagerJob SendRequest(boolean chargingOnGoing, boolean setCarConnectedToChargePoint, int setChargingStationDisfunction, float setMeterValue, String setUserId) { DChargingStationRequest dChargingStationRequest = new DChargingStationRequest(); dChargingStationRequest.chargingOnGoing=chargingOnGoing; dChargingStationRequest.carConnectedToChargePoint=setCarConnectedToChargePoint; dChargingStationRequest.chargingStationDisfunction=setChargingStationDisfunction; dChargingStationRequest.chargingStationId = _chargingStationId; dChargingStationRequest.meterValue=setMeterValue; dChargingStationRequest.userId=setUserId; try { EVSEHeartbeatService_Service hbs = new EVSEHeartbeatService_Service(); EVSEHeartbeatService h = hbs.getEVSEHeartbeatServiceSoap11(); DChargingStationResponse response = h.chargingStation(dChargingStationRequest); EnergyManagerJob emj = new EnergyManagerJob(); emj.allowedMaximumCurrent = response.allowedMaximumCurrent; emj.chargingPending = response.chargingPending; emj.powerOn = response.powerOn; } catch(Exception e) { System.out.println("Exception = " + e.getMessage()); } return SendRequest(chargingOnGoing = true, setCarConnectedToChargePoint =false, setChargingStationDisfunction = 0, setMeterValue = 44, setUserId ="ich"); } and my EnergyManagerJob look like this: public class EnergyManagerJob { public double allowedMaximumCurrent; public boolean chargingPending; public boolean powerOn; } So we will come to the Problem. In my main i have a while. I want to send the Dates of de CloudCommunicator to the server. And then I get an answer. My Main look like this. public class Main { public static void main(String[] a…
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1

http://stackoverflow.com/comment/33141740
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21845414
has text: Thanks! I really appreciate the answer!
score: 0

http://stackoverflow.com/q/21769554
has comment: http://stackoverflow.com/comment/32933213
favorite count: 0
has answer: http://stackoverflow.com/a/21769758
has comment: http://stackoverflow.com/comment/32933847
has comment: http://stackoverflow.com/comment/32933240
has body: I have two different interfaces which employ the same methods but dont implement or extend each other. These two interfaces are each extended by another class which implements the interfaces methods I then have a class which is located in a seperate package which calls the interface methods. So the class has methods which calls the methods of the interfaces, which are all the same. public void doThis(){ connection.doThis(); } public void doThat(){ connection.doThat(); } public void doAnother(){ connection.doAnother(); } Now, i want to make the variable connection work for both interface1 and interface2. My idea was to set connection as a class variable Object connection and then to change it type to interface1 or interface2 depending on a condition: if(this){ //condition which converts connection to type interface1 } else{ //condition which converts connection to type interface2 } How do i do this. Can i do this? I have been given an interface which can not be changed, yet does not implement remote. But my project uses RMI. So i created a 2nd interface in a seperate package which implemets Remote. Thus the reason for 2 different interfaces that do he same thing.
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21769679
type: Question
has title: Changing a class variables type
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32933210
has comment: http://stackoverflow.com/comment/32933302
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/32884269
score: 0
type: Comment
type: QuestionComment
has text: The portions of the page that I am missing are most likely generated by JavaScript since the page is very dynamic and is updated anytime the teams Github repo changes. Would there be a way to invoke the script that is generating the parts that I need?
comment on: http://stackoverflow.com/q/21740779

http://stackoverflow.com/q/21833035
has answer: http://stackoverflow.com/a/21833909
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21833909
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/33045993
has comment: http://stackoverflow.com/comment/33045472
has body: I'm at a complete loss as to how I can get my server app to send a message back to the client after the client sent a message. My goal is the client sends a message say "Hello" to the server the server receives the message then sends back to the client "hello to you" my question How do set up the part of the server sending a message and the client receiving the message? my server public class MainActivity extends Activity { private ServerSocket serverSocket; Handler updateConversationHandler; Thread serverThread = null; public String serverIP = "127.0.0.1"; private InetAddress serverAddr; public static final int SERVERPORT = 4444; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); updateConversationHandler = new Handler(); this.serverThread = new Thread(new ServerThread()); this.serverThread.start(); } class ServerThread implements Runnable { public void run() { Socket socket = null; try { serverSocket = new ServerSocket(SERVERPORT); } catch (IOException e) { e.printStackTrace(); } while (!Thread.currentThread().isInterrupted()) { try { socket = serverSocket.accept(); CommunicationThread commThread = new CommunicationThread(socket); new Thread(commThread).start(); } catch (IOException e) { e.printStackTrace(); } } } } class CommunicationThread implements Runnable { private Socket clientSocket; private BufferedReader input; public CommunicationThread(Socket clientSocket) { this.clientSocket = clientSocket; try { this.input = new BufferedReader(new InputStreamReader(this.clientSocket.getInputStream())); } catch (IOException e) { e.printStackTrace(); } } public void run() { while (!Thread.currentThread().isInterrupted()) { try { String read = input.readLine(); updateConversationHandler.post(new updateUIThread(read)); } catch (IOException e) { e.printStackTrace(); } } } } class updateUIThread implements Runnable { private String msg; public updateUIThread(String str) { this.msg = str; } @Overrid…
has comment: http://stackoverflow.com/comment/33046469
answer count: 1
has title: How can I get a TCP server to send a message back to the client?
has comment: http://stackoverflow.com/comment/33045712
tagged with: android

http://stackoverflow.com/comment/32872216
type: AnswerComment
type: Comment
has text: No..Please check my updated question. I am closing the stream after writing it, still the same issue.
comment on: http://stackoverflow.com/a/21735545
score: 0

http://stackoverflow.com/q/21750609
downvote count: 0
has title: Will the compiler-generated default constructor be public?
favorite count: 0
has answer: http://stackoverflow.com/a/21750725
has body: When I write a class Widget.java public class Widget { int data; String name; } will the compiler-generated constructor be public or default? public would be like public class Widget { int data; String name; public Widget() {} } whereas default similar to public class Widget { int data; String name; Widget() {} }
upvote count: 8
type: Question
tagged with: member-access
tagged with: compiler-generated
has answer: http://stackoverflow.com/a/21750683
has answer: http://stackoverflow.com/a/21750667
has answer: http://stackoverflow.com/a/21750779
possible better answer: http://stackoverflow.com/a/21750675
tagged with: default-constructor
has answer: http://stackoverflow.com/a/21750675
tagged with: java
has answer: http://stackoverflow.com/a/21750670
answer count: 7
score: 8
accepted answer: http://stackoverflow.com/a/21750667
has answer: http://stackoverflow.com/a/21750715
type: AnsweredQuestion

executorservice
type: Tag
tags question: http://stackoverflow.com/q/21790835
tag name: executorservice
tags question: http://stackoverflow.com/q/21689174
tags question: http://stackoverflow.com/q/21813516
tags question: http://stackoverflow.com/q/21687708
tags question: http://stackoverflow.com/q/21791058

http://stackoverflow.com/comment/32930806
comment on: http://stackoverflow.com/q/21767486
type: QuestionComment
has text: I think that would work. If it was the same size as the display resolution, it would take the entire screen, and the mouse would click through it. Can you make that an answer so I can mark it as the correct answer?
score: 0
type: Comment

http://stackoverflow.com/a/21818030
score: 0
type: AcceptedAnswer
has body: It's still a good idea to figure out the correct data model first. The other thing you need to figure out before starting to code is the interface architecture: what calls you are going to support, what arguments the calls will have, and what data will be returned. Once you understand those two things, the actual Java coding can go much more smoothly.
type: Answer
has comment: http://stackoverflow.com/comment/33019323
has comment: http://stackoverflow.com/comment/33032933
has comment: http://stackoverflow.com/comment/33019486
accepted answer of: http://stackoverflow.com/q/21817936
answers question: http://stackoverflow.com/q/21817936

http://stackoverflow.com/comment/32797134
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21692861
has text: sure. forgot that. added it to the answer.

http://stackoverflow.com/q/21720713
answer count: 3
has comment: http://stackoverflow.com/comment/32845846
linked to: http://stackoverflow.com/q/1268174
favorite count: 0
has body: I can't seem to find a good way to manipulate Date objects from strings containing arbitrary modifiers such as "+3days", as described in http://www.php.net/manual/en/datetime.formats.relative.php. I couldn't find anything in the standard Java APIs, nor in Joda-Time.
has title: Is there a Java library that does what php date_modify does?
tagged with: datetime
has comment: http://stackoverflow.com/comment/32846496
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32845883
possible better answer: http://stackoverflow.com/a/21720753
upvote count: 2
tagged with: java
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/21723018
has answer: http://stackoverflow.com/a/21723442
has answer: http://stackoverflow.com/a/21720753
accepted answer: http://stackoverflow.com/a/21723442
score: 0

http://stackoverflow.com/q/21784884
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32960332
has comment: http://stackoverflow.com/comment/32959763
accepted answer: http://stackoverflow.com/a/21785154
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/21785105
has body: Sorry for the question(( I just have stuck in the end of the day(( I need for test 10 threads writing to the same hash (really not a hash but very similar thing i need to prove it synchronization for write) is this is right code? Random rn = new Random(); Map&lt;int,int&gt; hash = new MyHashMap&lt;int,int&gt;(); for(int i = 0; i&lt; 10; i++) { Thread th = new MyAddingThread(); th.Start(); } public class MyAddingThread extends Thread{ public void run() { hash.Add(rn.nextInt,rn.nextInt); } } May be better to change 10 to 100. but I have no idea how to test dat hash for synchronization(
tagged with: multithreading
has answer: http://stackoverflow.com/a/21785105
has comment: http://stackoverflow.com/comment/32960815
upvote count: 3
tagged with: java
answer count: 3
has title: 10 threads write to single hash simultaniously
downvote count: 1
has answer: http://stackoverflow.com/a/21785154
has comment: http://stackoverflow.com/comment/32960506
has comment: http://stackoverflow.com/comment/32960876
has answer: http://stackoverflow.com/a/21785245
score: 2

http://stackoverflow.com/comment/83366973
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/32473606
has text: Here's a [full `build.gradle` example](https://gist.github.com/TurekBot/4a3cd406cb52dfd8bfb8022b982f0f6c).

http://stackoverflow.com/q/21829272
has comment: http://stackoverflow.com/comment/33038598
has answer: http://stackoverflow.com/a/21829379
type: AnsweredQuestion
tagged with: java
tagged with: file
possible better answer: http://stackoverflow.com/a/21829363
has answer: http://stackoverflow.com/a/21829501
type: Question
has answer: http://stackoverflow.com/a/21829363
upvote count: 0
accepted answer: http://stackoverflow.com/a/21829379
tagged with: arraylist
has answer: http://stackoverflow.com/a/21829506
has body: What I wanted to do is convert an ArrayList to file and after that, use the file line per line. My code: List&lt;String&gt; Inserts = new ArrayList&lt;String&gt;(); String FileToLoad = null; . . . . FileToLoad = prpfile.properties(); System.out.println(FileToLoad); FileWriter writer = new FileWriter(FileToLoad); for (String str : Inserts) { writer.write(str); } writer.close(); String QueryNewData = "LOAD DATA LOCAL INFILE '" + FileToLoad + "' INTO TABLE companies FIELDS TERMINATED BY ',' (Name,Address,NumberDUG,post,status)"; UpdateDatabase LoadNewData = new UpdateDatabase(); LoadNewData.LoadQuery(QueryNewData); Onces the code run, the file is created correctly but it's made the wholw ArrayLIst in one single line. How could inlude a new line for each element in the ArrayList?
score: -2
answer count: 4
favorite count: 0
downvote count: 2
has title: How can I write from the ArrayList to file, each element from the ArraList in a new line?

http://stackoverflow.com/a/21826421
answers question: http://stackoverflow.com/q/21826379
type: Answer
has body: You can use SharedPreference to store the values of credentials. To store values in SharedPreference SharedPreferences preferences = getSharedPreferences("userData", 0); SharedPreferences.Editor editor = preferences.edit(); editor.putString("userName", "value"); editor.putString("password", "value"); editor.commit(); To retrieve values from SharedPreference, SharedPreferences preferences = getSharedPreferences("loginData", 0); String userName = preferences.getString("userName", ""); String password = preferences.getString("password", "");
score: 0

http://stackoverflow.com/comment/33049531
has text: It worked perfectly :) Was that info on the documentation? Today was the first time i used jsoup, maybe i missed that info. Thank you very much!
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21834289
type: Comment

http://stackoverflow.com/q/21738544
has title: setting classpath for slf4j for java compiling
has body: I am having a problem setting up the classpath for slf4j for compiling java files. I tried two ways: 1. provide the classpath in command line javac -cp /Users/page/.m2/repository/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar src/main/java/com/scg/domain/*.java src/main/java/com/scg/util/*.java This gave the following error: src/main/java/com/scg/util/ListFactory.java:8: error: package org.slf4j does not exist import org.slf4j.Logger; ^ src/main/java/com/scg/util/ListFactory.java:9: error: package org.slf4j does not exist import org.slf4j.LoggerFactory; ...../long error message I tried to export the CLASSPATH to my env variable. export CLASSPATH=/Users/page/.m2/repository/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar This did not help either and resulted in same error, when I tried javac src/main/java/com/scg/domain/*.java src/main/java/com/scg/util/*.java I am trying to compile all the java files in two packages. but I need to have slf4j in my classpath. but somehow I am not able to get it work. Thanks
type: AnsweredQuestion
upvote count: 9
tagged with: java
tagged with: classpath
type: Question
score: 9
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21738657
has comment: http://stackoverflow.com/comment/32877874
favorite count: 0
tagged with: slf4j
tagged with: javac
has comment: http://stackoverflow.com/comment/32877836
accepted answer: http://stackoverflow.com/a/21738657

http://stackoverflow.com/comment/33056978
has text: Hi, your answer sounds like it could work! Could you please further edit it with some examples? I didn't really get the 5th-6th paragraphs. Thanks!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21838833

http://stackoverflow.com/comment/33041636
score: 0
has text: Glad to have helped :) If you found my answer to be useful please consider marking it as "accepted". If you have questions or need an elaboration, feel free to post. Again, glad to have helped :)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21789090

http://stackoverflow.com/comment/33022618
comment on: http://stackoverflow.com/a/21815653
score: 0
has text: I took your example and put it to the test, can you tell me what I am doing wrong. The Jpanel comes up, so it is going through my for statement. However, the jpanel does not clear so the user could put another input? How would I make the Jpanel clear out so another input can be put in?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32876353
score: 0
comment on: http://stackoverflow.com/q/21717814
type: Comment
type: QuestionComment
has text: Strange. Are you seeing this consistently? Have you tried several times in the region where you are seeing problems?

http://stackoverflow.com/comment/33011900
has text: input.charAt(0); doesnt help you? not should i get the question, give us a more fixed example of an input and expected output
comment on: http://stackoverflow.com/q/21813888
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32847145
score: 4
type: AnswerComment
type: Comment
has text: It releases it, but to be able to execute the operations coming after the wait() call, it needs to reacquire the lock on `obj`. Every instruction inside a synchronized block can only be executed if the thread holds the lock.
comment on: http://stackoverflow.com/a/21721502

http://stackoverflow.com/q/21799331
tagged with: jtable
tagged with: listselectionlistener
has comment: http://stackoverflow.com/comment/32986103
tagged with: netbeans-7
has title: Netbeans told that "declared variable" is a package that does not exist
favorite count: 0
possible better answer: http://stackoverflow.com/a/21799378
upvote count: 1
type: AnsweredQuestion
has body: It happened when I tried to use a ListSelectionModel. Did I made some mistake?
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21799378
downvote count: 0
has comment: http://stackoverflow.com/comment/32985522
has answer: http://stackoverflow.com/a/21799396
accepted answer: http://stackoverflow.com/a/21799396

http://stackoverflow.com/q/21726759
tagged with: java
has body: My background is VB.net, I have a device that sends data via a socket to my website www.3dweb2010.net on port 80 and I need to receive that data and save it in a database. I do not have much knowledge of web design and am completely stuck as to where to look and what to look for. As you can see the website currently has an index page and thats it! The data is just a string being sent to the ipaddress/web site name using a socket on a specific port Can anyone help?
type: Question
has comment: http://stackoverflow.com/comment/32856465
tagged with: apache
has comment: http://stackoverflow.com/comment/32856567
has comment: http://stackoverflow.com/comment/32859112
has title: Can I receive data from a port on my website
answer count: 0
type: UnansweredQuestion
tagged with: php
tagged with: vb.net
score: 0

http://stackoverflow.com/a/21788325
answers question: http://stackoverflow.com/q/21787788
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21787788
has body: From JLS §9.7.1 (emphasis is mine) the following are allowed combinations in element-value pairs: The type of V is assignment compatible (§5.2) with T, and furthermore: If T is a primitive type or String, and V is a constant expression (§15.28). V is not null. If T is Class, or an invocation of Class, and V is a class literal (§15.8.2). If T is an enum type, and V is an enum constant. So, as you can see, value can be only a constant of sorts.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/21803099
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21799640
has body: Maybe JSF in an option. Look at NetBeans generator for JSF CRUD application from an existing DB: https://netbeans.org/kb/docs/web/jsf20-crud.html

http://stackoverflow.com/q/21778495
downvote count: 0
tagged with: swt
type: Question
type: AnsweredQuestion
tagged with: java
has body: I'm trying to create a simple window with a push button using the following code: public static void main(String[] args) { Display display=new Display(); Shell shell=new Shell(); shell.open(); shell.setText("Hi there!"); shell.setSize(500,500); Button pushButton = new Button(shell, SWT.PUSH); pushButton.setText("Im a Push Button"); //pushButton.pack(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } shell.dispose(); } When commenting out the "pushButton.pack()" line, the button will not appear on the window. Is it really necessary to call the pack() method for every button I want to add? What if I have 10 buttons? for (int i=0; i&lt;10; i++) { new Button(shell, SWT.RADIO).setText("option "+(i+1)); } How will it then work? Plus, is there a good SWT tutorial for beginners online? Can you recommend a book that can guide me through SWT?
upvote count: 2
has answer: http://stackoverflow.com/a/21778934
has title: Java SWT - Adding buttons to shell
accepted answer: http://stackoverflow.com/a/21778934
answer count: 1
favorite count: 0
score: 2

http://stackoverflow.com/a/21734884
answers question: http://stackoverflow.com/q/21734841
has body: You should not extend the super class to get the desired output. Or You can define another overloaded Constructor in Super class and, you need to call it explicitly in sub class Constructor. When a sub class Constructor invoked, before the constructor's body get executed, Super class Constructor will be called, Hence the output of you program.
score: 0
type: Answer
upvote count: 2
downvote count: 2

http://stackoverflow.com/comment/33012144
has text: "It can be that the Color to which you keep a reference are not fast enough cleaned up." - is not correct. Modern JVMs with generational GC can easily cleanup local variables. Also, just returning from the method will cleanup all the variables created in the method. So it us unlikely to cause any problem.
type: Comment
comment on: http://stackoverflow.com/a/21807019
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32827249
has text: I'm using 2.2.4. But I just tested it using a JOptionPane. You were right. It was just a problem of displaying.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21709558

http://stackoverflow.com/comment/33039408
comment on: http://stackoverflow.com/q/21828714
has text: @Terje I have added some more code above hopefully that will give you more to go off, note that all the rendering is fine so i have not added this.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21835352
has comment: http://stackoverflow.com/comment/36863627
type: Question
has title: Spring Webflow Subflow - Referenced Flow Cannot be Found
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/26430080
favorite count: 0
has body: I have all of my flow documents under /WEB-INF/pageFlows. &lt;webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/pageFlows"&gt; &lt;webflow:flow-location-pattern value="/**/*-flow.xml"/&gt; &lt;/webflow:flow-registry&gt; When using Eclipse's type-ahead feature on the subflow property of the subflow element, I can see a list of the flows that I have included in my project... except that it only loads half of the flows I actually have in the project. Any flow that is not on that type-ahead list creates an ERROR warning in Eclipse. So now I have several errors reported in my project when there isn't actually any error. I'd like to get rid of these error messages. Any suggestions for resolving these reference errors? The error messages read like this: "Referenced flow [flow-name] cannot be found"
has answer: http://stackoverflow.com/a/41152672
has answer: http://stackoverflow.com/a/23836768
tagged with: spring-webflow
upvote count: 2
type: UnansweredQuestion
tagged with: spring
score: 2
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/32946922
has text: the line is the name=user.getName(); this line works fine when I don't use JPA. so I need to find the problem in the JPA part of my code?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21776828

http://stackoverflow.com/a/21760306
has comment: http://stackoverflow.com/comment/32916268
has body: After reading your instructions: take input choice Student, Teacher or College information to add. then as do you want to continue (y/n), again taking input. Again take input asking Do you want to add or print in any of student, college or teacher. after add or print again ask Do you want to continue (y/n). I stand by my prior comments, that your code is way off base. I suggest that you: Create a Student class that is designed to hold a single Student's information, his name, perhaps an id number, grades, or whatever else is needed. Give it a constructor to pass this info into the class. give it getter methods and perhaps setter methods. Do not give it a StudentInformation array or any fields that don't pertain to a single Student. Do all the input output and use of Scanner in your Driver class, the one with the main method. Perhaps your StudentInformation class should be renamed Student. Your driver class, then one interacting with the user should probably have a List&lt;Student&gt; that is intialized as an ArrayList&lt;Student&gt;. It should likely have a similar List for Teachers. Your Student class should not have an array that holds information about other students, which your current code does. Your current code recreates a new Student class, which recreates its array each time its run, so any previous information stored in the array is lost, that's not going to work. Again, you should start over.
downvote count: 0
answers question: http://stackoverflow.com/q/21759939
has comment: http://stackoverflow.com/comment/32916576
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/33050073
comment on: http://stackoverflow.com/q/21835181
type: Comment
type: QuestionComment
has text: Ok, i just want to be sure that is a commom approach, because i´m getting some messy methods.
score: 1

http://stackoverflow.com/a/52187442
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21720759
upvote count: 2
has body: If you hate recursion - using a Stack and javax.json to convert a Json String into a List of Maps: import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; import javax.json.Json; import javax.json.stream.JsonParser; public class TestCreateObjFromJson { public static List&lt;Map&lt;String,Object&gt;&gt; extract(InputStream is) { List extracted = new ArrayList&lt;&gt;(); JsonParser parser = Json.createParser(is); String nextKey = ""; Object nextval = ""; Stack s = new Stack&lt;&gt;(); while(parser.hasNext()) { JsonParser.Event event = parser.next(); switch(event) { case START_ARRAY : List nextList = new ArrayList&lt;&gt;(); if(!s.empty()) { // If this is not the root object, add it to tbe parent object setValue(s,nextKey,nextList); } s.push(nextList); break; case START_OBJECT : Map&lt;String,Object&gt; nextMap = new HashMap&lt;&gt;(); if(!s.empty()) { // If this is not the root object, add it to tbe parent object setValue(s,nextKey,nextMap); } s.push(nextMap); break; case KEY_NAME : nextKey = parser.getString(); break; case VALUE_STRING : setValue(s,nextKey,parser.getString()); break; case VALUE_NUMBER : setValue(s,nextKey,parser.getLong()); break; case VALUE_TRUE : setValue(s,nextKey,true); break; case VALUE_FALSE : setValue(s,nextKey,false); break; case VALUE_NULL : setValue(s,nextKey,""); break; case END_OBJECT : case END_ARRAY : if(s.size() &gt; 1) { // If this is not a root object, move up s.pop(); } else { // If this is a root object, add ir ro rhw final extracted.add(s.pop()); } default : break; } } return extracted; } private static void setValue(Stack s, String nextKey, Object v) { if(Map.class.isAssignableFrom(s.peek().getClass()) ) ((Map)s.peek()).put(nextKey, v); else ((List)s.peek()).add(v); } }
score: 2

http://stackoverflow.com/a/21750050
accepted answer of: http://stackoverflow.com/q/21750004
has comment: http://stackoverflow.com/comment/32897951
type: Answer
has comment: http://stackoverflow.com/comment/32898281
answers question: http://stackoverflow.com/q/21750004
has body: It's a coincidence (not really, rather it has to do with the hashing algorithm). Try adding newHashMap.put(-5, "Fifth"); as last. Output will be Key: 0 Value: Second Key: 1 Value: Fourth Key: 2 Value: First Key: 3 Value: Third Key: -5 Value: Fifth The javadoc specifically says This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/32898062
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32898190

input
tags question: http://stackoverflow.com/q/21686590
tags question: http://stackoverflow.com/q/21711620
tags question: http://stackoverflow.com/q/21693544
tags question: http://stackoverflow.com/q/21738837
tags question: http://stackoverflow.com/q/21768496
tags question: http://stackoverflow.com/q/21773270
tags question: http://stackoverflow.com/q/21693737
tags question: http://stackoverflow.com/q/21690313
tags question: http://stackoverflow.com/q/21705218
tag name: input
tags question: http://stackoverflow.com/q/21768793
type: Tag
tags question: http://stackoverflow.com/q/21703458

http://stackoverflow.com/q/21715466
has comment: http://stackoverflow.com/comment/33504621
favorite count: 0
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22468494
tagged with: java
type: Question
has title: Use AWS ElastiCache client for local memcached server
downvote count: 0
tagged with: amazon-elasticache
upvote count: 2
has body: I have been trying, without success, to use ElastiCache client with a memcached server installed on localhost. The webapp, in production, runs in AWS env but during development, I want to use the same ElastiCache client jar with my local memcached server. I currently am falling back to using the spymemcached client jar for development. I want to avoid recompiling the application with different jars for production and development. Is there a way to configure the ElastiCache client for localhost use?
answer count: 1

http://stackoverflow.com/q/21725227
favorite count: 0
has title: How to call an Object's Method from another class without creating a sub-class and/or inheriting class?
has body: I've been learning basic code at a very beginner level. Now I'm finally starting to dabble in actually writing simple programs, and got really stuck. I'm writing a simple a program that consists of two classes; People, MainPage. Once the program runs, the method openApp() is called in main method from (MainPage Class). public static void main(String[] args) { openApp(); } Next, when the openApp() is called, the user has three menus to choose to go to that are selected by entering the corresponding number i.e. 1 = Newsfeed, 2 = Profile or 3 = Friends. public class MainPage { public static void openApp() { System.out.println("Welcome to App!"); System.out.println(); System.out.println("To Select Option for:"); System.out.println("Newsfeed : 1"); System.out.println("Profile : 2"); System.out.println("Friends : 3"); System.out.println("Enter corresponding number: "); int optionSelected = input.nextInt(); switch (optionSelected) { case 1: System.out.println("NewsFeed"); break; case 2: System.out.println("Profile"); break; case 3: System.out.println("Friends"); break; if (optionSelected == 3) { people.friend();// Is it possible to write: friend() from "People" Class without extending to People Class } } } If User selects "friends" then the program calls a method from People Class called friend(People name) in MainPage class that prints out people object's friends. My Attempt: if (optionSelected == 3) { people.friend(); } The Error I get: Exception in thread "main" java.lang.Error: Unresolved compilation problem: people cannot be resolved Problem is I don't want to extend People Class in MainPage and inherit all it's methods, yet I still want to call an Object method from People Class to print people object's friends. Note: just in case anyone would want to look at the friend(People people) method that is located in the People class: public void friend(People people) { System.out.println(people.friend);
upvote count: 3
tagged with: methods
type: AnsweredQuestion
tagged with: oop
tagged with: java
tagged with: inheritance
has answer: http://stackoverflow.com/a/21725389
tagged with: class
type: Question
score: 3
answer count: 1
accepted answer: http://stackoverflow.com/a/21725389
downvote count: 0

http://stackoverflow.com/comment/33023693
comment on: http://stackoverflow.com/q/21820351
score: 0
type: Comment
type: QuestionComment
has text: when i run i cant get it to print out "save your money"

http://stackoverflow.com/comment/76609884
has text: I was able to workaround this issue setting time range explicitly. Wonder how we could fix it if Secondary index's sort key is not numeric. There should have been a fix for this issue by Amazon by now.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21789195
type: Comment

http://stackoverflow.com/comment/32945214
score: 1
has text: http://static.springsource.com/projects/tc-server/2.5/getting-started/htmlsingle/getting-started.html#intro-tcserver-features
type: AnswerComment
comment on: http://stackoverflow.com/a/21775839
type: Comment

http://stackoverflow.com/comment/32830675
type: Comment
comment on: http://stackoverflow.com/q/21711772
score: 1
has text: Why did you not use `List<AA> listAA` in the penultimate code line to make the array and list handling examples more similar? (If you answer is "because it did not work", think about why it did not work. ;-))
type: QuestionComment

http://stackoverflow.com/q/21802680
has body: I need to know how to know how to make Java's File.list(); method list only the files I am able to access or how to filter them out, cause now it lists files like $RecycleBin or Documents and Settings (I am on Win7) basically files I am unable to see in Win Explorer. Many Thanks.
type: Question
has answer: http://stackoverflow.com/a/21802801
accepted answer: http://stackoverflow.com/a/21802801
has comment: http://stackoverflow.com/comment/32991851
score: 0
has comment: http://stackoverflow.com/comment/32991873
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
has title: How to make Java list only writable files
linked to: http://stackoverflow.com/q/1272130
has comment: http://stackoverflow.com/comment/32991708
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32991772
tagged with: java
tagged with: file

http://stackoverflow.com/comment/33144525
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21828856
has text: Thats what I an confused about, How can I change my database data to a graph. Its so complicated for me.
type: AnswerComment

http://stackoverflow.com/q/21710370
has answer: http://stackoverflow.com/a/21710747
downvote count: 0
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/21712591
has answer: http://stackoverflow.com/a/21710594
has body: I found very less understanding in web about java gc. I request you to answer or correct my questions possibly by providing some reliable sources. I hope this post will be helpful to many people like me. Q1) Please correct or improve my understanding about garbage collection: gc will automatically be called by jvm during the execution of an application. Calling gc explicitly may only make the gc happen little early than it may happen without explicit call. JVM may call gc at irregular intervals, probably frequently. gc may collect an object when (i) It's not being referenced by. and (ii) It's not referencing to. but before destroying an object it will call finalize method of that object class where it can execute some code, normally cleanup operations wrt that object. Finalize method will be called only once per one object. If object is saved by finalize method at the first time, next time it can't escape from death. If there are memory blocks allocated but not reclaimed due to exceptions/thread abortions they are called as memory leaks which may result in scarcity of memory in the system. OS may tackle with it but not in expected response time of running applications which need memory immediately on demand in which case applications may halt/hang with insufficient memory resource error dumps. Q2) Garbage collection will only be for heap? ( That means, only to collect unreferenced objects? ) If so, what about static variables/constants/objects which are stored in class-method area? Q3) How can we make a java object imperishable? Meaning... No matter what happens in the application, the object should not be reclaimed by gc through out the application life. Is it possible? Q4) I am guessing there will be some occasions in program where gc may go wrong...meaning reclaim an object which shouldn't reclaim because it may gonna be used but gc didn't see the future use. Do such mistakes possible about what programmer should suspect or take care of this auto gc provided by j…
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: garbage-collection
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21711205
has title: Java - Garbage collection
has answer: http://stackoverflow.com/a/21710821

http://stackoverflow.com/q/21815100
accepted answer: http://stackoverflow.com/a/21815146
has body: More specifically, i would like to know if only certain characters are used in a word. For example the program will detect if only A B and C are used in an input. I have this so far but obviously this is an extremely brute force method to use. Is there a more efficient way to do this? (I should also mentions that this program doesn't work properly as I would need to add many more conditions) public static void main(String[] args) { Scanner in = new Scanner(System.in); String str = in.nextLine(); if(str.contains("I") &amp;&amp; str.contains("O") &amp;&amp; str.contains("S") &amp;&amp; str.contains("H") &amp;&amp; str.contains("Z") &amp;&amp; str.contains("X") &amp;&amp; str.contains("N")){ System.out.println("YES"); }else if(str.contains("I") &amp;&amp; str.contains("O") &amp;&amp; str.contains("S") &amp;&amp; str.contains("H") &amp;&amp; str.contains("Z") &amp;&amp; str.contains("X")){ System.out.println("YES"); }else if(str.contains("I") &amp;&amp; str.contains("O") &amp;&amp; str.contains("S") &amp;&amp; str.contains("H") &amp;&amp; str.contains("Z")){ System.out.println("YES"); }else if(str.contains("I") &amp;&amp; str.contains("O") &amp;&amp; str.contains("S") &amp;&amp; str.contains("H")){ System.out.println("YES"); }else if(str.contains("I") &amp;&amp; str.contains("O") &amp;&amp; str.contains("S")){ System.out.println("YES"); }else if(str.contains("I") &amp;&amp; str.contains("O")){ System.out.println("YES"); }else if(str.contains("I")){ System.out.println("YES"); }else{ System.out.println("NO"); } in.close(); }
tagged with: regex
favorite count: 0
has comment: http://stackoverflow.com/comment/33015095
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/33014748
has answer: http://stackoverflow.com/a/21815146
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/21815127
has answer: http://stackoverflow.com/a/21815127
type: Question
has title: Check for specific characters used in a String?
answer count: 2
downvote count: 0
tagged with: string

http://stackoverflow.com/q/21780709
tagged with: spring
has comment: http://stackoverflow.com/comment/39276212
has comment: http://stackoverflow.com/comment/39123410
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/32952431
upvote count: 1
has comment: http://stackoverflow.com/comment/39245751
has body: I'm trying to invalidate all sessions using Spring Security's SessionRegistry. Unfortunately, when I get the class, it does not have any principals. I have followed tutorial: http://krams915.blogspot.com/2010/12/spring-security-mvc-querying.html I have the following configuration: web.xml: Spring MVC Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / contextConfigLocation /WEB-INF/mvc-dispatcher-servlet.xml, log4jConfigLocation /WEB-INF/classes/log4j.properties org.springframework.web.util.Log4jConfigListener org.springframework.web.context.ContextLoaderListener org.springframework.security.web.session.HttpSessionEventPublisher SetCharacterEncodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF8 forceEncoding true SetCharacterEncodingFilter /* springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* hiddenHttpMethodFilter org.springframework.web.filter.HiddenHttpMethodFilter hiddenHttpMethodFilter /* <!--error-page> 400 /WEB-INF/views/pages/errors/400.jsp 403 /WEB-INF/views/pages/errors/403.jsp 404 /WEB-INF/views/pages/errors/404.jsp 500 /WEB-INF/views/pages/errors/500.jsp </error-page--> spring-security.xml: <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <beans:bean id="userDetailsService" class="agh.ideafactory.obieraki.service.impl.UserDetailsServiceImpl" /> <beans:bean id="shaPasswordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"> <beans:constructor-arg value="512"/> </beans:bean> <authentication-manager id="authenticationMan…
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32963656
has title: SessionRegistry does not have any principals
downvote count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/39255778
score: 1
tagged with: spring-security
favorite count: 0
type: Question

http://stackoverflow.com/comment/32946245
comment on: http://stackoverflow.com/q/21773516
has text: @user3300629 Unfortunately I cannot advise you on that. But the fact the project compiles yet updates in the source do not lead to changes in the behaviour means that Eclipse gets the dependency not from your source and from elsewhere -- this is regulated by the version number in `<dependency>` in pom. Sorry I cannot be of more help
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21695536
accepted answer: http://stackoverflow.com/a/21695595
favorite count: 0
tagged with: system
tagged with: time
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/32801204
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21695595
has title: Changing ubuntu system time using java code
has body: I have a java code written to change the system time but it is not working. java code is compiled and run successfully. Someone please point out what's wrong here. My java code is: Process process = Runtime.getRuntime().exec("/home/priyatam/timesetter.sh"); process.waitFor(); DataInputStream d = new DataInputStream(process.getInputStream()); System.out.println(d.read()); //It gives the output as number of bytes as 83 The content of sh file is as follows: #!/bin/sh date --set="2014-2-20 11:58 AM" The command 'date --set="2014-2-20 11:58 AM"' works properly in terminal. Moreover, this sh file works fine when executed from terminal but it won't work through java code. Anyone have any idea, please share.
tagged with: java
tagged with: ubuntu
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/32962176
comment on: http://stackoverflow.com/q/21786147
score: 0
type: QuestionComment
has text: It is most certainly there. You are probably not actually including the jar file in your classpath.
type: Comment

http://stackoverflow.com/q/21723541
type: Question
accepted answer: http://stackoverflow.com/a/21723731
tagged with: java
upvote count: 1
tagged with: swing
tagged with: jtextfield
has body: I was trying to build a simple java GUI application to get the data from the user and display it to the label. I got this code from the internet but it is using a separate pane for displaying the result. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class JTextFieldDemo extends JFrame { //Class Declarations JTextField jtfText1, jtfUneditableText; String disp = ""; TextHandler handler = null; //Constructor public JTextFieldDemo() { super("TextField Test Demo"); Container container = getContentPane(); container.setLayout(new FlowLayout()); jtfText1 = new JTextField(10); jtfUneditableText = new JTextField("Uneditable text field", 20); jtfUneditableText.setEditable(false); container.add(jtfText1); container.add(jtfUneditableText); handler = new TextHandler(); jtfText1.addActionListener(handler); jtfUneditableText.addActionListener(handler); setSize(325, 100); setVisible(true); } //Inner Class TextHandler private class TextHandler implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == jtfText1) { disp = "text1 : " + e.getActionCommand(); } else if (e.getSource() == jtfUneditableText) { disp = "text3 : " + e.getActionCommand(); } JOptionPane.showMessageDialog(null, disp); } } //Main Program that starts Execution public static void main(String args[]) { JTextFieldDemo test = new JTextFieldDemo(); test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
has comment: http://stackoverflow.com/comment/32858495
has answer: http://stackoverflow.com/a/21723731
type: AnsweredQuestion
has title: How to get data from a textfield in java and display it into a jlabel on the second form
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: jlabel

http://stackoverflow.com/comment/32816497
comment on: http://stackoverflow.com/q/21704407
score: 0
type: QuestionComment
has text: documentation is outdated for java sikuli api.
type: Comment

http://stackoverflow.com/a/21691423
has comment: http://stackoverflow.com/comment/32795488
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21691305
type: Answer
accepted answer of: http://stackoverflow.com/q/21691305
has comment: http://stackoverflow.com/comment/32795512
score: 0
has body: I don't think that I get what you want exactly, but this way you can run the program until user enters something different than "F", "f", "C", "C" in the first part of the program. import java.util.Scanner; public class FtoC{ static Scanner cin = new Scanner (System.in); public static void main(String[] args) { while(true) { char userInput = ' '; System.out.print("\nEnter " + "\"F\"" + " or " + "\"f\"" + " for Fahrenheit to Celsius" + "\nEnter " + "\"C\"" + " or " + "\"c\"" + " for Celsius to Fahrenheit" + "\nEnter something else to quit." +"\n"); userInput = cin.next().charAt(0); if ((userInput == 'F') || (userInput =='f')) {print("Enter a temp in Fahrenheit" +"\n I will tell you temp in Celsius" +"\n"); far2cel(); } else if ((userInput == 'C') || (userInput =='c')) { print("Enter a temp in Celsius:" +"\n I will tell you temp in fahrenheit" +"\n"); cel2far(); } else { print("Terminating the program" + "\n"); break; } } } private static void cel2far() { Scanner input = new Scanner(System.in); Double celsius = input.nextDouble(); print(celsius + " celsius is " + ((celsius * 9 / 5.0) + 32) + " Fahrenheit"); } private static void far2cel() { Scanner input = new Scanner(System.in); Double Fahrenheit = input.nextDouble(); print(Fahrenheit + " Fahrenheit is " + ((Fahrenheit - 32) * (5 / 9.0)) + " celsius"); } private static void print(String string) { System.out.print("\n" + string); } } I have placed it into while loop and added "break;" in the "Terminating program" part.

http://stackoverflow.com/q/21772951
duplicate of: http://stackoverflow.com/q/11907245
downvote count: 4
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21773511
favorite count: 0
has comment: http://stackoverflow.com/comment/32939072
has comment: http://stackoverflow.com/comment/32939436
linked to: http://stackoverflow.com/q/11907245
has body: Can anyone explain the difference of theese two codes? public class radacinaPatrata { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in); } } and this one import java.util. Scanner (); public class radacinaPatrata { public static void main(String[] args) { Scanner input = Scanner(System.in); } }
accepted answer: http://stackoverflow.com/a/21773511
score: -4
has title: difference between java.util.Scanner input = new Scanner () and import Scanner in main class
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32850735
type: Comment
comment on: http://stackoverflow.com/a/21722381
type: AnswerComment
has text: Thnk u for ur replaying.Could you please tell me what value will going to store if I make my field as not null in my entity and making Dynamic-insert=true.This sentence is not understandable(With dynamic-insert you will end up with an entity that has null value for the property message in-memory while at the same time the corresponding database row has ''.)
score: 0

http://stackoverflow.com/a/21810144
has body: i dont really get what you mean but you can use a handler this way to upgrade a progressBar from the backGroud thread private ProgressBar mProgressBar private Handler handle = new Handler(){ @Override public void handleMessage(Message msg){ super.handleMessage(msg); mProgressBar.setProgress(msg.arg1); } }; and to send update from another thread Message msg = handle.obtainMessage(null,intWhat, mProgressionValur, 0); handle.sendMessage(msg);
score: 0
answers question: http://stackoverflow.com/q/21810015
type: Answer

http://stackoverflow.com/q/21835319
has comment: http://stackoverflow.com/comment/33049737
score: 2
type: AnsweredQuestion
has body: Imagine we have two lists and want to know the postions of elements from one list in the other. To illustrate: List&lt;String&gt; one = Arrays.asList("B", "I", "G"); List&lt;String&gt; another = Arrays.asList("L", "A", "R", "G", "E"); Result would be: [-1, -1, 3] because neither B nor I occur in second list, but G does on 3rd position. This is what I came with so far: &lt;E&gt; List&lt;Integer&gt; indices(List&lt;E&gt; elements, List&lt;E&gt; container) { List&lt;Integer&gt; indices = new ArrayList&lt;&gt;(elements.size()); for (int i = 0; i &lt; elements.size(); i++) { indices.add(container.indexOf(indices.get(i))); } return indices; } Is there a faster solution that avoids internal loop in List.indexOf()?
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21835459
accepted answer: http://stackoverflow.com/a/21835454
type: Question
possible better answer: http://stackoverflow.com/a/21835459
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21835454
favorite count: 0
has title: Map elements in a list to positions in another list

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/21731174
tags question: http://stackoverflow.com/q/21827340

http://stackoverflow.com/comment/65246278
score: 0
has text: Thank you so much for this!! How could I add a shadow also? I have my light sources and they are working great, but how can I make some parts even darker than the overlay??
type: Comment
comment on: http://stackoverflow.com/a/21778759
type: AnswerComment

http://stackoverflow.com/q/21765437
has comment: http://stackoverflow.com/comment/32925692
has body: I'm trying to do: PrinterJob pj = PrinterJob.getPrinterJob(); pj.printDialog(); and want to change the Java Icon on the modal print dialog window (or even remove it) but I can't seem to. The following SO question seems to answer it for Java 6, but even with the information provided in the following StackOverflow answer for Java 7 I was not able to resolve. I could not find the appropriate constant to remove it. Does anyone know how to do this for Java 7 specifically?
tagged with: printing
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/33151482
tagged with: java-7
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21767621
has comment: http://stackoverflow.com/comment/32925835
linked to: http://stackoverflow.com/q/4554452
downvote count: 0
score: 1
tagged with: java
tagged with: swing
duplicate of: http://stackoverflow.com/q/4554452
has title: How to remove Java icon in Print Dialog on Java 7
type: Question
has comment: http://stackoverflow.com/comment/33151353
has comment: http://stackoverflow.com/comment/62016588
has answer: http://stackoverflow.com/a/21765641
has answer: http://stackoverflow.com/a/21765554

http://stackoverflow.com/comment/33359452
has text: I'm not sure how much sense it makes for information like OS version to be exposed via an API. VM's aren't exclusively Windows, after all.
comment on: http://stackoverflow.com/a/21775396
score: 0
type: AnswerComment
type: Comment

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/21788971

http://stackoverflow.com/comment/33080324
comment on: http://stackoverflow.com/a/21852900
type: AnswerComment
score: 0
type: Comment
has text: I'll try it now, thank you for the response and I'll update you once I'm done.

http://stackoverflow.com/q/21703911
has body: Given the following main: public static void main(String[] args) { System.out.println("System.out.println"); Logger.getGlobal().setLevel(Level.INFO); Logger.getGlobal().log(Level.INFO, "Logger.INFO"); } I get the following output: If there a way to get a better output for Logger? I would much prefer a single line output and a coherent color highlighting (SEVERE=red, INFO=green, ... like logcat for Android basically). Thanks
tagged with: logging
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21706964
tagged with: java
has comment: http://stackoverflow.com/comment/32816000
has title: Java logger better formatting
type: Question
has answer: http://stackoverflow.com/a/21704291
tagged with: logcat
has answer: http://stackoverflow.com/a/21704637
possible better answer: http://stackoverflow.com/a/21704291
score: 0
has answer: http://stackoverflow.com/a/59637826
accepted answer: http://stackoverflow.com/a/21704637
has comment: http://stackoverflow.com/comment/32815302

http://stackoverflow.com/a/21728545
has comment: http://stackoverflow.com/comment/32859101
accepted answer of: http://stackoverflow.com/q/21728480
has comment: http://stackoverflow.com/comment/32859165
upvote count: 2
answers question: http://stackoverflow.com/q/21728480
type: AcceptedAnswer
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32859004
downvote count: 0
has comment: http://stackoverflow.com/comment/32858951
has body: Use a configuration file with all the materials in it, written in some DSL (simple table, basically).

http://stackoverflow.com/a/21755166
has comment: http://stackoverflow.com/comment/32938734
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: you forgot to extend public class subclass extends maintype{ public numbers(){ AB = A+B; } }
answers question: http://stackoverflow.com/q/21755138
has comment: http://stackoverflow.com/comment/32906655
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21755138
score: 3

http://stackoverflow.com/comment/32930191
has text: I think the best thing to do would be to set the absolute path to the expected c3p0-config.xml in your script as a System property, ie as `-Dcom.mchange.v2.c3p0.cfg.xml=${APP_HOME}/conf/c3p0-config.xml` when you start the JVM from your script.
score: 1
comment on: http://stackoverflow.com/a/21738021
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32828162
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21710700
has text: Thanks a lot Mike, this cleared a lot of things.
score: 0

http://stackoverflow.com/comment/33039983
type: Comment
comment on: http://stackoverflow.com/q/21829775
score: 0
type: QuestionComment
has text: possible duplicate of [Problems with setting up and accessing Distributed Cache](http://stackoverflow.com/questions/21247085/problems-with-setting-up-and-accessing-distributed-cache)

http://stackoverflow.com/a/21680444
type: Answer
has body: None of the distinctions in the bytecode will matter much for performance of JIT-compiled code. HotSpot will routinely keep a type profile for each invokevirtual call site. If the record indicates only one type being dispatched on, the JIT compiler will treat it as an invokespecial call, basically a direct jump to the callee, or even inlining of the callee. The above describes the optimization of the hardest case, a fully general virtual method. HotSpot also knows which methods are effectively final: in the set of loaded classes there is no occurrence of an override for that method. In that case HotSpot proceeds similar to above, but with a few instructions omitted (those which perform the type assertion). I have additionally put some effort into hacking the .class file such that an invokevirtual instruction was replaced by invokespecial. The result was a VerifyError: Exception in thread "main" java.lang.VerifyError: Bad invokespecial instruction: current class isn't assignable to reference class. You can use invokespecial only for methods of the current class or its ancestor, and this is in fact specified by the Java Virtual Machine Specification, §4.9.2: Each invokespecial instruction must name an instance initialization method (§2.9), a method in the current class, or a method in a superclass of the current class.
accepted answer of: http://stackoverflow.com/q/21679998
has comment: http://stackoverflow.com/comment/32786464
upvote count: 9
answers question: http://stackoverflow.com/q/21679998
type: AcceptedAnswer
downvote count: 0
score: 9

http://stackoverflow.com/a/21703988
has body: Since you are limited to 10 * 4 = 40 numbers you can use a list and randomize the index : List&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); for (int i = 1; i &lt; 11; ++i) { for (int j = 0; j &lt; 4; ++j) numbers.add(i); } And then when you assign a random number : int i = rand.nextInt(numbers.size()); myArray[i][j] = numbers.get(i); numbers.remove(i); This assumes your two dimensional will not contain more then 40 numbers
score: 3
has comment: http://stackoverflow.com/comment/32815492
answers question: http://stackoverflow.com/q/21703867
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32815716
upvote count: 3

http://stackoverflow.com/q/21839776
tagged with: java
type: Question
has title: In Android emulator, Android app installed successfully and shown under Setting -> Apps, but not shown on Apps home screen
has body: I installed the app and I get the following message ------------------------------ [2014-02-17 13:02:42 - Stealth1] Android Launch! [2014-02-17 13:02:42 - Stealth1] adb is running normally. [2014-02-17 13:02:42 - Stealth1] No Launcher activity found! [2014-02-17 13:02:42 - Stealth1] The launch will only sync the application package on the device! [2014-02-17 13:02:42 - Stealth1] Performing sync [2014-02-17 13:02:42 - Stealth1] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Stealth1' [2014-02-17 13:02:42 - Stealth1] Uploading Stealth1.apk onto device 'emulator-5554' [2014-02-17 13:02:42 - Stealth1] Installing Stealth1.apk... [2014-02-17 13:02:49 - Stealth1] Success! [2014-02-17 13:02:50 - Stealth1] /Stealth1/bin/Stealth1.apk installed on device [2014-02-17 13:02:50 - Stealth1] Done! I could find the app installed in emulator under Setting --> Apps. But how should I run the application. I tried running it from eclipse. Still I couldn't run. When I run from command line I get 1934 KB/s (288622 bytes in 0.145s) pkg: /data/local/tmp/Stealth1.apk Failure [INSTALL_FAILED_ALREADY_EXISTS]
tagged with: google-maps
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/21839810
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21839810
score: 0

universe
type: Tag
tag name: universe
tags question: http://stackoverflow.com/q/21691018

http://stackoverflow.com/a/21723762
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21723639
has body: By looking at the log, your problem seems that you try to get the first element in a list(index 0) and your list is empty(the size is 0) cursor.getString(0) that seems to be the problem. your cursor has no records

http://stackoverflow.com/comment/32836658
score: 1
has text: Could you explain to this mystified reader what you mean by "it also does it a bit more circumstantial"?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21714958

http://stackoverflow.com/a/21828262
has comment: http://stackoverflow.com/comment/33169719
has comment: http://stackoverflow.com/comment/33084497
answers question: http://stackoverflow.com/q/21825044
has comment: http://stackoverflow.com/comment/33115821
has comment: http://stackoverflow.com/comment/33121006
upvote count: 3
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/33173394
has comment: http://stackoverflow.com/comment/33174886
has body: You may use already implemented ArrayWritable for this purposes. Or look at other classes implementing Writable interface.
score: 3

http://stackoverflow.com/q/21713666
answer count: 1
score: 0
has body: We have a websphere application server that runs a java filter when j_security_check is run. We authenticate a user using Websphere's custom registry. When the filter runs I need to know whether or not the user that logged in was authenticated. I have tried to get the remote user from the request but it returns null if the user authenticated successfully or not successfully. It seems that the remote user has not been built when this filter runs. I am assuming that the custom registry code runs before the java filter runs. Is there anyway to test if the user has been successfully authenticated inside of my java filter. Thanks Doug
tagged with: authentication
tagged with: servlet-filters
type: AnsweredQuestion
tagged with: java
tagged with: websphere-8
has answer: http://stackoverflow.com/a/21859970
accepted answer: http://stackoverflow.com/a/21859970
has title: Testing if user is authenticated java filter Websphere 8 server
type: Question

http://stackoverflow.com/q/21703378
has comment: http://stackoverflow.com/comment/32814302
favorite count: 0
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21703868
has answer: http://stackoverflow.com/a/21703399
has body: I want to assign values and make it as a pair. For example OrderID and ItemID Items are in list. What should I use to look like this (OrderID,ItemID) where OrderID should be the same for all ItemID in list. All examples and samples are welcome.
accepted answer: http://stackoverflow.com/a/21703868
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: How can I assign values in pairs?
type: Question
possible better answer: http://stackoverflow.com/a/21703398
has answer: http://stackoverflow.com/a/21703398

http://stackoverflow.com/a/21700522
has comment: http://stackoverflow.com/comment/32851316
has comment: http://stackoverflow.com/comment/32851959
accepted answer of: http://stackoverflow.com/q/21700284
has comment: http://stackoverflow.com/comment/32809967
answers question: http://stackoverflow.com/q/21700284
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32853136
score: 0
has body: It depends on how the pinging is implemented by your application .... However, it is plausible that timeouts on a Socket or DatagramSocket could lead to an exception that (if not coded properly) could lead to a file descriptor leak. Here's an example of the wrong, and then right way to do this kind of thing: // Wrong way Socket sock = new Socket(...); sock.connect(); // do stuff including a read that might time out sock.close(); The problem is that the time-out exception is liable to cause the close() call to be skipped as control jumps to the handler for the exception ... further up the stack. // Right way (Java 6 and earlier) Socket sock = new Socket(...); try { sock.connect(); // do stuff including a read that might time out } finally { sock.close(); } // Right way (Java 7 and later) try (Socket sock = new Socket(...)) { sock.connect(); // do stuff including a read that might time out } In the latter case, there is an implicit handler that closes sock automatically. Obviously, you will need to adapt this pattern to what your real code is doing.
type: Answer
has comment: http://stackoverflow.com/comment/32852551
has comment: http://stackoverflow.com/comment/32851590
has comment: http://stackoverflow.com/comment/32853312
has comment: http://stackoverflow.com/comment/32835683
has comment: http://stackoverflow.com/comment/32809785
has comment: http://stackoverflow.com/comment/32809513
has comment: http://stackoverflow.com/comment/32810735

http://stackoverflow.com/q/21720597
has title: Reducing the size of index files
answer count: 1
has answer: http://stackoverflow.com/a/21722306
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: lucene
has body: Okay after having so much doubts in lucene indexing, I tried a program to index every files in a folder and able to index 76 files of 131 MB which includes mostly ppt, pdf and docs. The index file size is around 80 MB.It did it in 36 seconds and searched a query in 7 milli seconds. Is it faster? Is the size of the index file is normal? Any way to reduce the size of indexing? Every time I have to run the indexer program whenever I add a new file. Is there any automatic way to do the indexing whenever new file is adder? Here is my indexer file which is actually from Lucene In Action book package lia.meetlucene; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.Directory; import org.apache.lucene.util.Version; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.io.FileReader; public class Indexer { public static void main(String[] args) throws Exception { if (args.length != 2) { throw new IllegalArgumentException("Usage: java " + Indexer.class.getName() + " &lt;index dir&gt; &lt;data dir&gt;"); } String indexDir = args[0]; //1 String dataDir = args[1]; //2 long start = System.currentTimeMillis(); Indexer indexer = new Indexer(indexDir); int numIndexed; try { numIndexed = indexer.index(dataDir); } finally { indexer.close(); } long end = System.currentTimeMillis(); System.out.println("Indexing " + numIndexed + " files took " + (end - start) + " milliseconds"); } private IndexWriter writer; public Indexer(String indexDir) throws IOException { Directory dir = FSDirectory.open(new File(indexDir)); writer = new IndexWriter(dir, //3 new StandardAnalyzer( //3 Version.LUCENE_30),//3 true, //3 IndexWriter.MaxFieldLength.UNLIMITED); //3 } public void close() throws IOException { writer.close(); //4 } public int index(String dataDir) …
score: 0

http://stackoverflow.com/comment/32804459
has text: and the title does not give any meaningful hints on your problem
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21697386

http://stackoverflow.com/q/21758138
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/32912023
has comment: http://stackoverflow.com/comment/32911978
type: UnansweredQuestion
upvote count: 1
has body: I have large String something like: String = "ABC114.553111.325785.658EFG114.256114.589115.898"; I would like to achieve: String1 = "ABC"; String2 = "114.553"; String3 = "111.325"; String4 = "785.658"; Sometimes it isn't three digits then dot and four digits after. But always Before digits there is three letters.
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21758317
tagged with: split
answer count: 3
has title: Java split string at custom position
has comment: http://stackoverflow.com/comment/32912271
has answer: http://stackoverflow.com/a/21758325
has answer: http://stackoverflow.com/a/21758351
downvote count: 0

http://stackoverflow.com/a/21763229
has comment: http://stackoverflow.com/comment/33132321
answers question: http://stackoverflow.com/q/21730323
has comment: http://stackoverflow.com/comment/33128423
type: AcceptedAnswer
downvote count: 0
has body: It should be dependsOn not depends. You should also point to both projects from the folder root: name := "java-test" version := "1.0-SNAPSHOT" playJavaSettings lazy val mainProject = project.in(file(".")) .aggregate(subProject, playProject) .dependsOn(subProject, playProject) lazy val subProject = project.in(file("sub-projects/sub-project-1")) //play project depends on subProject... lazy val playProject = project.in(file("play-project")).dependsOn(subProject)
has comment: http://stackoverflow.com/comment/33134192
type: Answer
has comment: http://stackoverflow.com/comment/33042409
score: 1
accepted answer of: http://stackoverflow.com/q/21730323
upvote count: 1

http://stackoverflow.com/comment/32834373
type: Comment
has text: @Ty221 English language only here please. It is in the [FAQ]
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21713544

http://stackoverflow.com/comment/32928709
type: AnswerComment
has text: @webuster Thank you for expanding on it; I was really caught up on the "differences" between the two because the professor kept emphasizing it. It's very interesting to know that they're handled the same way at the compiler level.
comment on: http://stackoverflow.com/a/21766858
type: Comment
score: 0

http://stackoverflow.com/a/21831050
type: Answer
has comment: http://stackoverflow.com/comment/33042188
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33041886
answers question: http://stackoverflow.com/q/21830970
has body: Is it logical to expect contains() to take more time when the arraylist is larger? Yes. The ArrayList Javadoc says: The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. All of the other operations run in linear time (roughly speaking). Thus, the complexity of ArrayList.contains() is O(n), which makes sense since you need to check each element of the ArrayList. There is no other option, since an ArrayList is not sorted and there is no other access path to a specific element, given its value.

http://stackoverflow.com/comment/33044687
type: AnswerComment
score: 0
type: Comment
has text: thanks, now it works, but temporary .lck files have left in the directory
comment on: http://stackoverflow.com/a/21832535

jlist
tags question: http://stackoverflow.com/q/21715399
tags question: http://stackoverflow.com/q/21703673
tags question: http://stackoverflow.com/q/21713866
tags question: http://stackoverflow.com/q/21710072
tags question: http://stackoverflow.com/q/21736324
tags question: http://stackoverflow.com/q/21691884
type: Tag
tags question: http://stackoverflow.com/q/21780427
tags question: http://stackoverflow.com/q/21762773
tags question: http://stackoverflow.com/q/21811368
tag name: jlist
tags question: http://stackoverflow.com/q/21832879

http://stackoverflow.com/comment/32915971
has text: No error deployed success. May be I am firing wrong url or mention wrong url pattern. I have uploaded new image which shows studentspringmvc true.
score: 0
comment on: http://stackoverflow.com/q/21760201
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33009978
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21812594
has text: You need a loop, there is no other way.
score: 0

http://stackoverflow.com/comment/32829665
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21711489
has text: Because you are also shuffling `unshuffledPlaylist`, since they point to the same reference.
type: Comment

http://stackoverflow.com/q/21817809
type: Question
possible better answer: http://stackoverflow.com/a/21819846
answer count: 2
has body: I know there are plenty of similar questions on Google, but I tried a lot from them and nothing helped. I tried to run this project from Java EE 7 Tutorial and got exception during deployment. Then I've made simple little project with Stateful Bean and got the same one. First of all, it's war project. All my files: /pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 radzikowski ejb 0.1 war ejb <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> javax javaee-web-api 7.0 provided /src/main/webapp/WEB-INF/web.xml (simple, default web.xml) <?xml version="1.0" encoding="UTF-8"?> 30 /src/main/java/radzikowski/ejb/FulBean.java package radzikowski.ejb; import javax.ejb.Stateful; @Stateful public class FulBean { } Pretty simple, right? And I'm using Glassfish 4.0 (build 89) (installed from repository - Linux) with all-default configuration and everything. I checked by pkg and I have installed glassfish-ejb package: glassfish-ejb 4.0-89 installed ---- glassfish-ejb-l10n 4.0-89 known ---- glassfish-ejb-lite 4.0-89 installed ---- glassfish-ejb-lite-l10n 4.0-89 known ---- And finally my logs on an attempt to deploy: SEVERE: Exception while invoking class org.glassfish.ejb.startup.EjbDeployer load method java.lang.RuntimeException: EJB Container initialization error at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:234) at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:291) at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:99) at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:206) at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:313) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) at com.sun.enterpr…
upvote count: 1
has answer: http://stackoverflow.com/a/21819846
has comment: http://stackoverflow.com/comment/33019664
tagged with: java
accepted answer: http://stackoverflow.com/a/21850873
tagged with: jakarta-ee
has title: Glassfish Exception during deployment project with Stateful EJB
tagged with: ejb
downvote count: 0
tagged with: glassfish
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/33019434
favorite count: 0
has answer: http://stackoverflow.com/a/21850873

http://stackoverflow.com/a/22869931
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21685189
type: Answer
has body: The error java.lang.ClassCastException: org.apache.hadoop.mapreduce.lib.input.FileSplit cannot be cast to org.apache.hadoop.mapred.InputSplit occurs also frequently with Hadoop 2.2.0 or 2.3.0 on Windows when trying the attached examples. In that case, run Hadoop with admin privileges. It might be sufficient to have the right to create symbolic links. With bin\winutils.exe /? you get the following hint: The default security settings in Windows disallow non-elevated administrators and all non-administrators from creating symbolic links. The security settings for symbolic links can be changed in the Local Security Policy management console. Without admin privileges I could only run the examples by using a local mapreduce (in mapred-site.xml, set mapreduce.framework.name to local).

http://stackoverflow.com/a/21701378
has comment: http://stackoverflow.com/comment/32815944
has comment: http://stackoverflow.com/comment/32836593
answers question: http://stackoverflow.com/q/21701229
has comment: http://stackoverflow.com/comment/61860731
type: Answer
accepted answer of: http://stackoverflow.com/q/21701229
has comment: http://stackoverflow.com/comment/32822892
upvote count: 21
has body: You can do it with the help of the maven antrun plugin. Something like this: org.apache.maven.plugins maven-antrun-plugin <sleep seconds="5" /> sleep-for-a-while pre-integration-test run EDIT: In case someone will catch this. Based on the comment from jl, tasks have indeed been deprecated and here is the same thing based on using targets instead. Sligthly reorganized but has the same function. org.apache.maven.plugins maven-antrun-plugin 1.8 sleep-for-a-while pre-integration-test <sleep seconds="5" /> run
score: 21
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32815392

http://stackoverflow.com/a/21734062
answers question: http://stackoverflow.com/q/21733974
has comment: http://stackoverflow.com/comment/33059457
downvote count: 1
has body: You are not getting values here JsonArray platforms = jsonObject.getAsJsonArray("platforms"); platforms is null, thats why you are gettin that exception Update: I have realized you have a problem here: JsonArray platforms = jsonObject.getAsJsonArray("platforms"); change to: JsonArray platforms = itemObj.getAsJsonArray("platforms");
has comment: http://stackoverflow.com/comment/32872070
score: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/32943556
accepted answer of: http://stackoverflow.com/q/21733974
upvote count: 2

http://stackoverflow.com/a/21764350
has body: but the "Loading" message always shows up after it fetches the webpage. then your code is blocking the EDT so the GUI can't repaint itself. I tried using several different methods such as ... SwingUtilities, The code you posted using invokeLater() is wrong because you are still executing the long running task on the EDT. I tried using several different methods such as Thread, SwingWorker, - Those are the proper approaches. The long running task should exectute in the Thread or the doInBackground() method of your Swing worker. Read the section from the Swing tutorial on Concurrency for more information.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21764152
score: 4
answers question: http://stackoverflow.com/q/21764152
upvote count: 4

http://stackoverflow.com/comment/32981488
has text: Post the full java file here
type: Comment
comment on: http://stackoverflow.com/q/21796954
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32857943
type: Comment
type: QuestionComment
has text: Did you try using "clean" option for your project as well as restarting Eclipse?
score: 0
comment on: http://stackoverflow.com/q/21727961

http://stackoverflow.com/q/21791627
tagged with: java
has title: Appending StringBuilder to a JTextArea
accepted answer: http://stackoverflow.com/a/21791732
tagged with: jfilechooser
type: Question
has body: i am trying to make myself a word processor. I have only become familiar with the concept of the JFileChooser and have implemented it into my code. My hope is to be able to use a JFileChooser to open a text file and append the contents of the text file to the JTextArea. To try my best at seperating my functionality i implemented the MVC (model view controller) so i have 3 classes. the view is called WordFrame.java, the model is called DataStuff.java and the controller is called ProcessEvents.java. My issue is rather simple, i can print the contents of a text file to the console, but attempts to append the said contents to the TextArea is only resulting in white space, the image below shows the position on the textArea, signifying its character spacing, this is after the file is loaded. As stated the console prints it out perfectly. also, here is code for the model and controller import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.Scanner; public class ProcessEvents { private WordFrame frame = new WordFrame(); private DataStuff data = new DataStuff(); private DialogBoxes dialogs = new DialogBoxes(); private boolean fileSaved; String fileName = ""; int fontSize = 0; public ProcessEvents(WordFrame frame, DataStuff data){ this.frame = frame; this.data = data; this.frame.addListener(new wordProcessListener()); } class wordProcessListener implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { if(e.getSource().equals(frame.openMenuItem)){ frame.fileChooser.showOpenDialog(frame); File f = frame.fileChooser.getSelectedFile(); System.out.println("Command Executed: open"); data.loadFile(f.getAbsoluteFile()); if(data.showText() != null){ String texts = data.showText().toString(); System.out.println(data.showText()); frame.textArea.append(data.showText().toString()); } } if(e.getSource().equals(frame.FontMenuItem)){ System.out.println("font"); } if(e.getSource().equals(frame.exitMenuItem)){ dia…
score: 0
has comment: http://stackoverflow.com/comment/32979921
answer count: 1
has comment: http://stackoverflow.com/comment/32982588
has answer: http://stackoverflow.com/a/21791732
tagged with: jframe
type: AnsweredQuestion
tagged with: stringbuilder

http://stackoverflow.com/a/21792001
has comment: http://stackoverflow.com/comment/32973978
score: 0
has body: In the first place, Swing is inherently single-threaded. This was once summarized in the "single thread rule" Once a Swing component has been realized, all code that might affect or depend on the state of that component should be executed in the event-dispatching thread. (Unfortunately, the respective site did not survive the migration of Java from Sun to Oracle, but some information can be found here http://docs.oracle.com/javase/tutorial/uiswing/concurrency/dispatch.html or when doing a websearch for "swing single thread rule") In general, this applies also to painting : The paintComponent may only safely be called by the Event Dispatch Thread (EDT). And it will be called "automatically". That is why this technique is called "passive rendering": You overwrite the paintComponent method, expecting that it will be called by the EDT. However, particularly for game development, you can use a technique called "active rendering". In this case, painting is slightly more complicated and involves setting up an own BufferStrategy. The potential advantage is that any thread may perform rendering operations in this case, because you can obtain a Graphics object by calling BufferStrategy#getDrawGraphics. Information can be found at http://docs.oracle.com/javase/tutorial/extra/fullscreen/rendering.html (while this refers to fullscreen rendering, similar concepts can be applied to active rendering in a window, but I'd recommend to consult further tutorials/resources that can be found with keywords like "swing active rendering").
answers question: http://stackoverflow.com/q/21791102
type: Answer

http://stackoverflow.com/comment/32947717
score: 0
has text: While I basically agree with Carlos Robles' answer, what you are describing there just seems to be the Decorator Pattern http://en.wikipedia.org/wiki/Decorator_pattern - which has its justification, but it should (like all patterns) be verified that it really fits the particular application case
type: QuestionComment
comment on: http://stackoverflow.com/q/21776751
type: Comment

http://stackoverflow.com/comment/32972575
score: 0
has text: Thanks -- That is my understanding however similar to Tomas, I am curious to see how the coding is done for the event and to see it all tie together. I now have a grasp on the difference between implementing interfaces and extending classes and the idea for abstract classes, I would just like to see how to know when I should use them.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21791146

http://stackoverflow.com/a/21822197
answers question: http://stackoverflow.com/q/21822012
has body: You are creating an array of character but assigning the string to it.It will give you error but if you create a string just and pass it as argument to the method then your method would look like this public static void decrypt(String encrypted,int key){ System.out.println(key + ": "); for (int i=0; i &lt; encrypted.length; i++){ char originalChar = encrypted.CharAt(i); char encryptedChar; if ((originalChar -key) &lt; 32) encryptedChar = (char) (originalChar - 32 + 127 -key); else encryptedChar = (char) (originalChar -key); System.out.println(encryptedChar); } }
score: 0
type: Answer

http://stackoverflow.com/a/21791501
has comment: http://stackoverflow.com/comment/32981095
has comment: http://stackoverflow.com/comment/38598979
answers question: http://stackoverflow.com/q/21791228
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21791228
downvote count: 0
has body: BaseGameActivity cannot be resolved to a type public Class FisrstActivity extends BaseGameActivity{ In your project, right click > properties > Android > in Library section check if your library is correct and don´t show any red cross. Check the same for your BaseGameUtils library, probably the reference to google_play_services is incorrect. you problem must be similar to : android - import - with developers google com games
has comment: http://stackoverflow.com/comment/38632880
upvote count: 2
has comment: http://stackoverflow.com/comment/32980949
has comment: http://stackoverflow.com/comment/32980254
type: AcceptedAnswer

http://stackoverflow.com/q/21804301
has comment: http://stackoverflow.com/comment/32994789
tagged with: spring
type: AnsweredQuestion
tagged with: transactions
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/21804366
type: Question
has title: What happens when a @Transactional annotated method is hit in parallel by multiple instances?
answer count: 2
has body: Please correct me if I am wrong somewhere. I am having an issue where my transaction are not being saved to the data base and some sort of racing is occurring which screws up the data. The app is hit in parallel by multiple instances. I have used @Transactional, which I know is to do a transaction with database and the transaction is committed when the method returns. The question is, does hitting it through multiple instance still maintain this one transaction per hit thing, or it does not handle the situation and data will screw up because of racing? Can a solution be suggested for the given condition?
score: 5
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21804417
has answer: http://stackoverflow.com/a/21804417
accepted answer: http://stackoverflow.com/a/21804366

http://stackoverflow.com/q/21817782
tagged with: swing
has answer: http://stackoverflow.com/a/41043309
type: AnsweredQuestion
score: 2
has body: I have a JEditorPane that displays a link containing an image like so: &lt;a href='http://somesite.com/'&gt; &lt;img src='someImage.png' /&gt; &lt;/a&gt; When the JEditorPane display this as HTML, it puts a blue border around the image which I am trying to remove without any luck. I want it to look like this inside of the jeditorpane: image: (http://randomcloud.net/img/prob/valid.png) But this is how the JEditorPane displays it: image(http://randomcloud.net/img/prob/jeditorpane.png) This is what I have tried so far, and it still is not working editorPane = new JEditorPane("http://randomcloud.net/ads/index.php?id=1"); StyleSheet style = ((HTMLDocument)editorPane.getDocument()).getStyleSheet(); style.addRule("a img {text-decoration: none; border: none;}"); Any suggestions or insight ? -Michel
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21823073
type: Question
tagged with: hyperlink
tagged with: border
answer count: 2
has title: JEditorPane remove border from image link
downvote count: 0
accepted answer: http://stackoverflow.com/a/21823073
favorite count: 0
tagged with: jeditorpane
possible better answer: http://stackoverflow.com/a/41043309

http://stackoverflow.com/comment/32778446
score: 0
has text: exactly, but I dont know how should I do it?
type: Comment
comment on: http://stackoverflow.com/a/21682811
type: AnswerComment

http://stackoverflow.com/q/21746983
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21748313
has title: JBoss drools checking value of HashMap by passing a key
type: Question
tagged with: drools
has answer: http://stackoverflow.com/a/21748313
score: 0
has body: Is there a way I can check the value of a HashMap in "when" block, by passing a key. Something like(may not be the actual way) rule "checkHM" when $account : Account( hm.get("A") == "B") then System.out.println("HashMap has value B" ); end Here Account is a class and hm is a HashMap in this class. hm has key/value pair as "A"/"B". I hope the question is clear.
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/21762267
score: 0
type: Answer
has body: notifyDataSetCHanged doesn't help?
has comment: http://stackoverflow.com/comment/32919529
answers question: http://stackoverflow.com/q/21761720

http://stackoverflow.com/comment/32797233
comment on: http://stackoverflow.com/q/21693254
score: 1
has text: Please go through this http://stackoverflow.com/help/mcve
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21679325
score: 0
has body: Try to replace this line +" join customers_messages cm on gc.customer_id = cm.customer_id and gm.message_id = cm.message_id" by +" join customers_messages cm on (gc.customer_id = cm.customer_id and gm.message_id = cm.message_id)" edit: replaced the final ( by a ). Sorry for the typo.
type: Answer
answers question: http://stackoverflow.com/q/21679085

http://stackoverflow.com/q/21820701
tagged with: android
has comment: http://stackoverflow.com/comment/33024413
answer count: 0
tagged with: java
type: Question
has body: I have created two jsp pages in which I am able to get the response of my input. Below are my 2 jsp pages. Also I would like to get a response from android java class to the same Index1.jsp.(For eg: If I am sending one string to Index1.jsp I would to get the response as same string). Index.jsp &lt;form action="index1.jsp" method="POST"&gt; &lt;input type="checkbox" name="maths" checked="checked" /&gt; Maths &lt;input type="checkbox" name="physics" /&gt; Physics &lt;input type="checkbox" name="chemistry" checked="checked" /&gt; Chem &lt;input type="submit" value="Select Subject" /&gt; &lt;/form&gt; Index1.jsp &lt;% Enumeration paramNames = request.getParameterNames(); while(paramNames.hasMoreElements()) { String paramName = (String)paramNames.nextElement(); out.print("&lt;tr&gt;&lt;td&gt;" + paramName + "&lt;/td&gt;\n"); String paramValue = request.getParameter(paramName); out.println("&lt;td&gt; " + paramValue + "&lt;/td&gt;&lt;/tr&gt;\n"); } %&gt;
has comment: http://stackoverflow.com/comment/33024364
tagged with: jsp
has title: How to send values from java class to jsp page ?
score: 0
linked to: http://stackoverflow.com/q/5374768
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33024185

http://stackoverflow.com/q/21691017
favorite count: 0
has body: I'm struggling to make this code work properly. The goal is to create fibonacci codes for values 0-127 to be used later in a program intended to compress a text file. Examples 0: 1 1: 11 2: 011 3: 0011 4: 1011 5: 00011 6: 10011 for {1, 2, 3, 5, 8, 13...} with an extra 1 at the end to make it clear when the specific char is completed. Any help would be appreciated, I've been playing with it for a while now trying to make it work, so if anything isn't clear ask. If you have a better algorithm for this situation, that would be great as well if you could lead me in the right direction. public static void makeFibCodes (String[] fibCodes) { int[] fibSeq = {1,2,3,5,8,13,21,34,55,89,144}; String s = "1"; for (int i = 1; i &lt;= 127; i++) { s = "1"; s = makeFibRec(fibSeq, i, s, false, 9); fibCodes[i] = s; System.out.println(s); } } public static String makeFibRec (int[] fibSeq, int i, String s, boolean hasValue, int fibI) { if (i == 0) { hasValue = true; return "0" + s ; } else if (i == 1) { hasValue = true; return "1" + s; } else { for (int j = fibI; j &gt; 0; j--) { if (i &gt; fibSeq[j]) { hasValue = true; s = "1" + s; i = i - fibSeq[j]; return makeFibRec(fibSeq, i, s, hasValue, j) + s; } if (hasValue) { s = "0" + s; } } return s; } }
type: Question
has comment: http://stackoverflow.com/comment/32794371
has comment: http://stackoverflow.com/comment/32793580
has comment: http://stackoverflow.com/comment/32794537
has comment: http://stackoverflow.com/comment/32834423
tagged with: java
tagged with: compression
upvote count: 1
tagged with: recursion
linked to: http://stackoverflow.com/q/10471543
has title: Creating Fibonacci codes in Java
tagged with: fibonacci
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32793627
has comment: http://stackoverflow.com/comment/32794442
answer count: 0
downvote count: 0
score: 1

http://stackoverflow.com/q/21757626
has body: I am trying to scroll two Jtables at the same time. Each JTable is placed on a JScrollpane and both JScrollpanes are set on a JSplitpane. Here the relöevant code for scrolling: teststepScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); rerouteScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); teststepScrollPane.getVerticalScrollBar().setModel( rerouteScrollPane.getVerticalScrollBar().getModel()); ........ public void setTeststepTableFocus(final int teststep) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (teststep &lt;= teststepTable.getModel().getRowCount() - 1){ teststepTable.setRowSelectionInterval(teststep, teststep); teststepTable.scrollRectToVisible(new Rectangle(teststepTable.getCellRect(teststep, 0, true))); } } }); } Sadly it does not work at all. Any ideas? Thanks for any help.
has title: Simultaniously scroll 2 JTables?
has answer: http://stackoverflow.com/a/21772087
type: UnansweredQuestion
tagged with: java
tagged with: scroll
type: Question
has answer: http://stackoverflow.com/a/21758471
tagged with: jtable
score: 0
answer count: 2

http://stackoverflow.com/a/21866797
score: 44
has comment: http://stackoverflow.com/comment/60234913
answers question: http://stackoverflow.com/q/21805868
has comment: http://stackoverflow.com/comment/40537159
accepted answer of: http://stackoverflow.com/q/21805868
has comment: http://stackoverflow.com/comment/44178370
has comment: http://stackoverflow.com/comment/33128284
type: AcceptedAnswer
downvote count: 0
upvote count: 44
has comment: http://stackoverflow.com/comment/65012594
has body: This is a problem with dx, which is the part of the build that turns your Java .class files into .dx files for packaging into Android. According to this: https://code.google.com/p/android/issues/detail?id=34193 if a function has multiple return paths, dx merges the return instruction into a single return instruction, so during debugging, the debugger can't tell which line a return belongs to and things jump around. This corresponds to what I see when I try to reproduce your problem: each time through the loop it does the if (a == 3) check, jumps to the return 0 at the end, and then jumps back into the loop. You're seeing that last return 0 get merged with the return retval in the middle of the loop. I doubt this will be fixed any time soon, so you may just have to learn to live with it. Sorry, I know it's kinda crazy.
type: Answer
has comment: http://stackoverflow.com/comment/33150903
has comment: http://stackoverflow.com/comment/33140855

http://stackoverflow.com/comment/32986499
has text: @SeanOwen See my answer for explanation.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21786147

http://stackoverflow.com/comment/32785424
has text: Again: OP just want/needs a `List<double[]>` and provided an answer about it. Period.
type: Comment
comment on: http://stackoverflow.com/a/21686724
type: AnswerComment
score: 1

http://stackoverflow.com/q/21785712
score: 0
has comment: http://stackoverflow.com/comment/32961529
answer count: 1
accepted answer: http://stackoverflow.com/a/21785807
type: AnsweredQuestion
has title: My hadoop code never enters a test on key value
type: Question
has answer: http://stackoverflow.com/a/21785807
tagged with: java
has body: I wrote a mapreduce program and I would like to test the key value of the combiner. Here is the code of the combiner : public static class FlowStats_Combiner extends Reducer&lt;Text, Text, Text, Text&gt; { public void reduce(Text key, Iterable&lt;Text&gt; values, Context context) throws IOException, InterruptedException { String test = key.toString().trim(); if ((test=="srcPort")||(test=="dstPort")||(test=="srcAddr")||(test=="dstAddr")){ StringBuilder builder = new StringBuilder(); for (Text value:values){ builder.append(value.toString()); builder.append('|'); } context.write(key, new Text(builder.toString())); } if ((test=="Packet")||(test=="Byte")||(test=="Flow")){ int sum = 0; for (Text value : values){ sum += Integer.valueOf(value.toString()); } context.write(key, new Text(Integer.toString(sum))); } } } The program never enters the IF test. Would you have an idea of what is wrong ? thank you. Winston.
tagged with: hadoop

http://stackoverflow.com/a/21763375
upvote count: 2
answers question: http://stackoverflow.com/q/21763225
type: Answer
score: 2
downvote count: 0
has body: I do not think your client fully understands what they are asking of you. Imagine we could invent something quite nasty in javascript or with referer header, or something like that, in order to achieve what they want. What if your user entered then different credentials in your tab #2? Is your client aware that the session open in tab #1 is the same for both of them? Make them understand they are trying to override a basic behavior of web browsers, and even if they did it would be useless. Besides that, from a usability point of view, it would harm your application, since it would trick naive users into thinking they can open many sessions in the same browser instance... good luck!
has comment: http://stackoverflow.com/comment/32922999

http://stackoverflow.com/a/21715252
upvote count: 4
has comment: http://stackoverflow.com/comment/98163980
type: Answer
has body: No, just import all the certificates from one truststore into the other, and use the second.
answers question: http://stackoverflow.com/q/21707894
has comment: http://stackoverflow.com/comment/107290579
score: 3
downvote count: 1

http://stackoverflow.com/comment/33018316
comment on: http://stackoverflow.com/q/21817503
score: 2
has text: What don't you understand using SharedPreferences? This is well explained here (and the others options available to save app datas): http://developer.android.com/guide/topics/data/data-storage.html
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32785664
comment on: http://stackoverflow.com/q/21686237
has text: What about the version of Maven?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21765767
tagged with: insert
tagged with: connection
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21766181
type: Question
tagged with: model-view-controller
tagged with: java
tagged with: sqlexception
has body: I need someone to help me check why the data is not recorded into database? When I try to "Check Out" the cart, the record of the cart is supposed to execute sql statement to transfer the data to the database. Here's the code and error: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections" at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1112) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2486) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2519) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2304) at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:834) at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:47) at sun.reflect.GeneratedConstructorAccessor12.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at servlet.TicketDataBean.getConnection(TicketDataBean.java:16) An…
answer count: 1
has title: Java MVC createsqlException when inserting confirmed cart into database (cannot be inserted)
score: 0

http://stackoverflow.com/comment/32964791
score: 1
has text: Your question as currently phrased requires knowledge of both .Net AppDomains and OSGi. That combination of skills is rare. I know a lot about OSGi but very little about .Net, so if you describe what specific features of AppDomains are missing from Java then I can tell you if OSGi is a good fit.
type: QuestionComment
comment on: http://stackoverflow.com/q/21777121
type: Comment

http://stackoverflow.com/q/21747363
upvote count: 1
answer count: 1
has title: Proper syntax for gson with generics
tagged with: java
has answer: http://stackoverflow.com/a/21747624
tagged with: gson
has comment: http://stackoverflow.com/comment/32893634
accepted answer: http://stackoverflow.com/a/21747624
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/32893518
has comment: http://stackoverflow.com/comment/32893361
tagged with: android
has comment: http://stackoverflow.com/comment/32893505
tagged with: generics
tagged with: android-asynctask
has body: I'm trying to write a reusable asynctask where I define the type of a class that Gson should deserialize to in the asynctask's constructor. Having never worked with Java Generics before, I'm a little lost on how to proceed. I can't figure out the correct syntax for the fromJson method. The error I receive is Cannot resolve method'fromJson(java.io.InputStream, java.lang.Class&lt;T&gt;)' The full AsyncTask... public class AsyncGet&lt;T&gt; extends AsyncTask&lt;String,String,ApiResponse&gt; { private String TAG = "AsyncGet"; private HttpURLConnection mConnection; private IApiCallback mCallback; private Context mContext; private Class&lt;T&gt; type; public AsyncGet(IApiCallback callback, Class&lt;T&gt; classType, Context context) { this.mCallback = callback; this.mContext = context; this.type = classType; } @Override protected ApiResponse doInBackground(String... uri) { try { URL url = new URL(uri[0]); mConnection = (HttpURLConnection) url.openConnection(); mConnection.setConnectTimeout(5000); mConnection.setReadTimeout(60000); mConnection.addRequestProperty("Accept-Encoding", "gzip"); mConnection.addRequestProperty("Cache-Control", "no-cache"); mConnection.connect(); String encoding = mConnection.getContentEncoding(); InputStream inStream; if (encoding != null &amp;&amp; encoding.equalsIgnoreCase("gzip")) { inStream = new GZIPInputStream(mConnection.getInputStream()); } else { inStream = mConnection.getInputStream(); } if (inStream != null) { try { Gson gson = new Gson(); ApiResponse response = new ApiResponse(); response.data = gson.fromJson(inStream, type); // What is wrong here? response.responseCode = mConnection.getResponseCode(); response.responseMessage = mConnection.getResponseMessage(); return response; } catch (Exception e) { Log.i(TAG, "Exception"); if (e.getMessage() != null) { Log.e(TAG, e.getMessage()); } } finally { inStream.close(); } } } catch (SocketTimeoutException e) { Log.i(TAG, "Socket Timeout occurred"); FileLogger.getFileLogger(mContext).ReportE…

http://stackoverflow.com/comment/32849206
type: Comment
has text: Fildor... I am not using unicode text encoding. How i can use it give me some example
comment on: http://stackoverflow.com/q/21722660
score: 0
type: QuestionComment

http://stackoverflow.com/q/21736007
tagged with: java
has comment: http://stackoverflow.com/comment/32873003
upvote count: 1
has body: is it possible to prompt user with an error message if they click on a button that is disabled. e.g. JButton button = new JButton(); button.addActionListener(this); public void actionPerformed(ActionEvent e) { if(buttonClicked.getSource()== button){ button.setEnabled(false); } } Right now, when the user clicks on the button, the button gets disabled now once the button is disabled and the user clicks the button again, I want a error message to pop up saying something like 'you cannot click me again'
tagged with: actionlistener
downvote count: 0
has comment: http://stackoverflow.com/comment/32873743
has comment: http://stackoverflow.com/comment/32872934
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21736289
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32874501
type: Question
tagged with: swing
answer count: 1
tagged with: jbutton
has title: is it possible to prompt user with an error message if they click on a button that is disabled, JAVA
accepted answer: http://stackoverflow.com/a/21736289
has comment: http://stackoverflow.com/comment/32873033

http://stackoverflow.com/a/21805463
has body: Change the linke (char)c = (int)c -32 + key + 127; to c = (char) ((int) c - 32 + key + 127);
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/21805331
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/32997480
has comment: http://stackoverflow.com/comment/32996850

http://stackoverflow.com/a/21797653
type: Answer
has comment: http://stackoverflow.com/comment/32983181
has comment: http://stackoverflow.com/comment/32982742
answers question: http://stackoverflow.com/q/21797573
has comment: http://stackoverflow.com/comment/32983070
has body: Scanner inbuilt functions parse the tokens where the BufferedReader just read the input.There is overhead of parsing tokens...
score: 0

http://stackoverflow.com/a/21704768
has comment: http://stackoverflow.com/comment/32818427
has comment: http://stackoverflow.com/comment/32817127
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21704583
has comment: http://stackoverflow.com/comment/32817993
has body: The following regex might work for you: ^[0-9]+[.]?[0-9]{0,}$ The quantifier {0,} would match zero or more digits.
score: 2
accepted answer of: http://stackoverflow.com/q/21704583
downvote count: 0

http://stackoverflow.com/comment/32985777
has text: @MartijnCourteaux You're telling me that if you have two arrays of zero elements, and you try to iterate over them and return a value, it will go through them and reach the return statement? Not happening.
type: Comment
comment on: http://stackoverflow.com/a/21799417
type: AnswerComment
score: 0

http://stackoverflow.com/q/21762399
has answer: http://stackoverflow.com/a/21775905
has title: Drools accessing generated java files
answer count: 1
tagged with: java
tagged with: drools
type: UnansweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32927266
favorite count: 0
has comment: http://stackoverflow.com/comment/32919871
has comment: http://stackoverflow.com/comment/32924619
has body: I am executing Drools rule through Mockito test. The rule fails at run time reporting the error with a line number of a java file having some long arbitrary name. It seems that Drools generates java files on the fly and injects into JVM. But when I search those files on my disc I don't find any. Is there a way I could store them on my disc?
type: Question
upvote count: 2

http://stackoverflow.com/comment/32941640
type: QuestionComment
has text: @i.n.e.f Have you initialized `txtCustRecCardRouteNo`? Is `vectorCustRecipetDB.get(i)` null?
score: 0
comment on: http://stackoverflow.com/q/21773836
type: Comment

http://stackoverflow.com/comment/32773873
comment on: http://stackoverflow.com/q/21679357
score: 0
type: Comment
type: QuestionComment
has text: have you tried the code using firefox? You can remove the System.setProperty() and call driver = new FirefoxDriver() directly. I also see that the spelling of local host is wrong in your code.

eclipse
tags question: http://stackoverflow.com/q/21775451
tag name: eclipse
tags question: http://stackoverflow.com/q/21704762
tags question: http://stackoverflow.com/q/21762931
tags question: http://stackoverflow.com/q/21681258
tags question: http://stackoverflow.com/q/21681595
tags question: http://stackoverflow.com/q/21737094
tags question: http://stackoverflow.com/q/21694753
tags question: http://stackoverflow.com/q/21757179
tags question: http://stackoverflow.com/q/21764353
tags question: http://stackoverflow.com/q/21756711
tags question: http://stackoverflow.com/q/21768792
tags question: http://stackoverflow.com/q/21692850
tags question: http://stackoverflow.com/q/21727821
tags question: http://stackoverflow.com/q/21758829
tags question: http://stackoverflow.com/q/21774098
tags question: http://stackoverflow.com/q/21693307
tags question: http://stackoverflow.com/q/21700219
tags question: http://stackoverflow.com/q/21752074
tags question: http://stackoverflow.com/q/21727961
tags question: http://stackoverflow.com/q/21690799
tags question: http://stackoverflow.com/q/21734900
tags question: http://stackoverflow.com/q/21706691
tags question: http://stackoverflow.com/q/21787733
tags question: http://stackoverflow.com/q/21797814
tags question: http://stackoverflow.com/q/21762434
tags question: http://stackoverflow.com/q/21684943
tags question: http://stackoverflow.com/q/21833729
tags question: http://stackoverflow.com/q/21801880
tags question: http://stackoverflow.com/q/21768370
tags question: http://stackoverflow.com/q/21687125
tags question: http://stackoverflow.com/q/21724688
tags question: http://stackoverflow.com/q/21778407
tags question: http://stackoverflow.com/q/21732754
tags question: http://stackoverflow.com/q/21770177
tags question: http://stackoverflow.com/q/21699627
tags question: http://stackoverflow.com/q/21690030
tags question: http://stackoverflow.com/q/21752839
tags question: http://stackoverflow.com/q/21841571
tags question: http://stackoverflow.com/q/21831795
tags question: http://stackoverflow.com/q/21707570
tags question: http://stackoverflow.com/q/21749609
tags question: http://stackoverflow.com/q/21698128
tags question: http://stackoverflow.com/q/21825389
tags question: http://stackoverflow.com/q/21799245
tags question: http://stackoverflow.com/q/21795457
tags question: http://stackoverflow.com/q/21741004
tags question: http://stackoverflow.com/q/21817581
tags question: http://stackoverflow.com/q/21789381
tags question: http://stackoverflow.com/q/21735578
tags question: http://stackoverflow.com/q/21758112
tags question: http://stackoverflow.com/q/21721011
tags question: http://stackoverflow.com/q/21834877
tags question: http://stackoverflow.com/q/21802318
tags question: http://stackoverflow.com/q/21761599
tags question: http://stackoverflow.com/q/21817503
tags question: http://stackoverflow.com/q/21782357
tags question: http://stackoverflow.com/q/21684015
tags question: http://stackoverflow.com/q/21729173
tags question: http://stackoverflow.com/q/21731268
tags question: http://stackoverflow.com/q/21712768
tags question: http://stackoverflow.com/q/21720075
tags question: http://stackoverflow.com/q/21690215
tags question: http://stackoverflow.com/q/21757098
tags question: http://stackoverflow.com/q/21702055
tags question: http://stackoverflow.com/q/21741992
tags question: http://stackoverflow.com/q/21722354
tags question: http://stackoverflow.com/q/21834806
tags question: http://stackoverflow.com/q/21701332
tags question: http://stackoverflow.com/q/21816374
tags question: http://stackoverflow.com/q/21823438
tags question: http://stackoverflow.com/q/21734493
tags question: http://stackoverflow.com/q/21768235
tags question: http://stackoverflow.com/q/21712997
tags question: http://stackoverflow.com/q/21785129
tags question: http://stackoverflow.com/q/21709410
tags question: http://stackoverflow.com/q/21806485
tags question: http://stackoverflow.com/q/21761987
tags question: http://stackoverflow.com/q/21837822
tags question: http://stackoverflow.com/q/21760626

http://stackoverflow.com/a/21762554
answers question: http://stackoverflow.com/q/21762375
downvote count: 0
has body: sourceImage = new int[image.length][]; for (int i=0; i&lt;image.length; i++) { sourceImage[i] = Arrays.copyOf(image[i],image[i].length); }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21780103
has answer: http://stackoverflow.com/a/21780877
downvote count: 1
has answer: http://stackoverflow.com/a/21780179
tagged with: generics
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/21780221
has answer: http://stackoverflow.com/a/21780206
has answer: http://stackoverflow.com/a/21780404
accepted answer: http://stackoverflow.com/a/21780206
has answer: http://stackoverflow.com/a/21780221
has title: Understanding Class<?>
type: AnsweredQuestion
has body: I came across this code: public class RestfulAdage extends Application { @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { Set&lt;Class&lt;?&gt;&gt; set = new HashSet&lt;Class&lt;?&gt;&gt;(); set.add(Adages.class); return set; } } I do not understand what Class&lt;?&gt; means.
tagged with: java
has comment: http://stackoverflow.com/comment/32951058
linked to: http://stackoverflow.com/q/290982
type: Question
has answer: http://stackoverflow.com/a/21780218
score: 18
answer count: 6
upvote count: 19

http://stackoverflow.com/q/21696651
has comment: http://stackoverflow.com/comment/32803579
favorite count: 0
tagged with: apache-httpclient-4.x
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21698836
downvote count: 0
score: 1
has title: Java - Http Authentification 401 error with HttpClient library
has comment: http://stackoverflow.com/comment/32804018
tagged with: java
tagged with: authentication
type: Question
has body: This dialog appears when I try to login from web browser (IE, Chromw, Etc). Using Apache httpclient library try to auto-login. way 1. http://userid:pass@hostname (X) way 2. Using Apache HttpClient QuickStart Example (X) All of the above methods does not work. Please Help me. Lastest Try Code DefaultHttpClient httpClient = new DefaultHttpClient(); try{ httpClient.getCredentialsProvider() .setCredentials(new AuthScope( new HttpHost(host)), new UsernamePasswordCredentials(username, password)); HttpGet httpget = new HttpGet(host); System.out.println("executing request" + httpget.getRequestLine()); HttpResponse response = httpClient.execute(httpget); HttpEntity entity = response.getEntity(); System.out.println("----------------------------------------"); System.out.println(response.getStatusLine()); if (entity != null) { System.out.println("Response content length: " + entity.getContentLength()); } EntityUtils.consume(entity); } finally { // When HttpClient instance is no longer needed, // shut down the connection manager to ensure // immediate deallocation of all system resources httpClient.getConnectionManager().shutdown(); } Console window says: 'executing requestGET http://192.168.100.129/tag/unsubscribe HTTP/1.1' '----------------------------------------' 'HTTP/1.0 401 Unauthorized' 'Response content length: 0'
tagged with: apache
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/32858436
type: Comment
score: 0
has text: You have you error with the stack trace now. Check the line 29 of dataCollection -> NullPointerException means you have probably not initialized correctly a variable.
comment on: http://stackoverflow.com/q/21727629
type: QuestionComment

http://stackoverflow.com/comment/32882618
type: QuestionComment
has text: Why would you want to decrease cohesion?
score: 3
comment on: http://stackoverflow.com/q/21741171
type: Comment

http://stackoverflow.com/comment/32959440
has text: @turbo, the `Stack` class provided to the OP (I assume this is a school exercise) is not `java.util.Stack`, and it does not have a `size` method.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21784713

http://stackoverflow.com/q/21826402
has answer: http://stackoverflow.com/a/21826871
favorite count: 0
downvote count: 0
possible better answer: http://stackoverflow.com/a/21826871
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21826807
has body: I have the following three classes: public class ApplicationView extends Application { private static Context mContext; private static final String TAG = "ApplicationView "; public static Context getContext() { Log.i(TAG, "getContext: " + mContext); return mContext; } public static void setContext(Context mmContext) { Log.i(TAG, "setContext: " + mmContext); mContext = mmContext; } } public class VideoCapture extends Activity implements SurfaceHolder.Callback { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ApplicationView.setContext(this); } } -------------------------- public class OverlayView extends SurfaceView implements SurfaceHolder.Callback { public void updateText() { Context mcontext = ApplicationView.getContext(); ((VideoCapture)mcontext).runOnUiThread(new Runnable(){ public void run(){ String NewText = "bla bla bla" TextView txtView = (TextView)findViewById(R.id.txt_status); txtView.setText(NewText); } }); } } In my manifest: in application: android:name="xxx.yyy.zzz.ApplicationView" - in activity: android:name="xxx.yyy.zzz.VideoCapture" It gives me when I call Update Text the following NullPointerException error: 02-17 11:15:27.850: E/AndroidRuntime(15834): FATAL EXCEPTION: main 02-17 11:15:27.850: E/AndroidRuntime(15834): java.lang.NullPointerException 02-17 11:15:27.850: E/AndroidRuntime(15834): at xx.yyy.zzz.OverlayView$2.run(OverlayView.java:137) 02-17 11:15:27.850: E/AndroidRuntime(15834): at android.app.Activity.runOnUiThread(Activity.java:4591) 02-17 11:15:27.850: E/AndroidRuntime(15834): at xxx.yyy.zzz.OverlayView.updateText(OverlayView.java:133) 02-17 11:15:27.850: E/AndroidRuntime(15834): at xxx.yyy.zzz.OverlayView$1.onPreviewFrame(OverlayView.java:122) 02-17 11:15:27.850: E/AndroidRuntime(15834): at android.hardware.Camera$EventHandler.handleMessage(Camera.java:754) 02-17 11:15:27.850: E/AndroidRuntime(15834): at android.os.Handler.dispatchMessage(Handler.java:99) 0…
has title: Update TextView outside Activity through Application
has answer: http://stackoverflow.com/a/21826807
upvote count: 1
tagged with: android

http://stackoverflow.com/q/21793337
score: 1
tagged with: java
tagged with: wireless
has body: I want to read captured (.pcap) WIRELESS packets and get information like IP addresses and port number, flag ( from network layer and above layer of OSI model ). SO which JAVA library can help me. I tried with JnetPcap but did not succeed, so JnetPcap support wireless packets or not ?... or any other java library I can use for above
type: Question
tagged with: libpcap
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26884358
type: UnansweredQuestion
has title: Reading WIRELESS .pcap packet using Java
tagged with: pcap
downvote count: 0
tagged with: jnetpcap

http://stackoverflow.com/comment/32971224
score: 1
comment on: http://stackoverflow.com/q/21790835
type: Comment
type: QuestionComment
has text: How many concurrent clients do you have to measure this?

http://stackoverflow.com/a/21727186
type: Answer
has comment: http://stackoverflow.com/comment/32857251
has comment: http://stackoverflow.com/comment/32857136
has body: You can specify the RoundingMode for the DecimalFormatter, but please choose it as per your needs(I've just given an example using HALF_UP). double d = 42.405; DecimalFormat f = new DecimalFormat("##.00"); f.setRoundingMode(RoundingMode.HALF_UP); System.out.println(f.format(d)); // Prints 42.41 Alternatively, you can also use BigDecimal(incase you know why we usually go for BigDecimal instead of double) for the same. double d = 42.405; BigDecimal bd = new BigDecimal(d); bd = bd.setScale(2, RoundingMode.HALF_UP); System.out.println(bd.doubleValue()); // Prints 42.41
has comment: http://stackoverflow.com/comment/32856629
downvote count: 1
has comment: http://stackoverflow.com/comment/32857818
accepted answer of: http://stackoverflow.com/q/21727101
has comment: http://stackoverflow.com/comment/32858810
has comment: http://stackoverflow.com/comment/32858081
answers question: http://stackoverflow.com/q/21727101
upvote count: 4
type: AcceptedAnswer
score: 3

http://stackoverflow.com/comment/32998760
type: Comment
type: QuestionComment
has text: Just tried it and it works with all the cases you show. "^[+-]?\\d+(\\.\\d{2})? [A-Z]{3}$"
comment on: http://stackoverflow.com/q/21806381
score: 0

http://stackoverflow.com/comment/32990591
type: AnswerComment
comment on: http://stackoverflow.com/a/21802040
type: Comment
has text: use inorder or any standard tree traversal technique for that. this will help you : http://www.cs.swarthmore.edu/~newhall/unixhelp/Java_bst.pdf
score: 0

http://stackoverflow.com/comment/32950288
type: QuestionComment
score: 0
has text: see my printscreen. It gets me an Object elementData and I need an entity elementData
comment on: http://stackoverflow.com/q/21779577
type: Comment

http://stackoverflow.com/comment/32964057
comment on: http://stackoverflow.com/q/21787289
type: Comment
has text: there are many deamon threads too. Like GC being one of them.
score: 2
type: QuestionComment

http://stackoverflow.com/q/21802238
tagged with: arrays
has answer: http://stackoverflow.com/a/21802386
tagged with: sorting
downvote count: 2
answer count: 1
has title: Sort strings in alphabetical order as they enter the array - Java
favorite count: 0
has comment: http://stackoverflow.com/comment/32991121
has body: So I have a program that reads a file, adds the information into an array and then afterwards sorts the array using an exchange sort into alphabetical order. The problem is I misunderstood the assignment and need the strings to be sorted as they are entered into the array instead of using a separate sorting method after they are already entered. Heres what I have: public class NumberCollection2 { String nextName; int nextNumber; private Person[] people = new Person[50]; private int size =0; public void load() { try { Scanner in = new Scanner(new File ("numbers.txt")); while (in.hasNextLine()) { nextName = in.next(); nextNumber = in.nextInt(); people[size]=new Person(nextName, nextNumber); size++; in.nextLine(); } //use exchange sort to sort in ascending alphabetical order int i, j; for ( i = 0; i &lt; size - 1; i++ ) { for ( j = i + 1; j &lt; size; j++ ) { if ( people[ i ].getName().compareTo(people[ j ].getName()) &gt; 0 ) { Person temp = people [ i ]; people [ i ] = people [ j ]; people [ j ] = temp; } } } } This works perfectly yet my professor needs it to be sorted as it is entered into the array "people" and I am not sure how to approach that. Any advice/help would be awesome, thanks!!! this is the email I got from my prof : "To receive full credit, you must insert each item into its sorted position in the array as it is read in. It is not ok to read it all in and call a sort routine."
type: UnansweredQuestion
upvote count: 0
tagged with: java
tagged with: file
type: Question
score: -2

http://stackoverflow.com/q/21839494
possible better answer: http://stackoverflow.com/a/21840087
has answer: http://stackoverflow.com/a/21840254
tagged with: string-matching
type: AnsweredQuestion
has body: I am currently struggling with my "dirty word" filter finding partial matches. example: if I pass in these two params replaceWord("ass", "passing pass passed ass") to this method private static String replaceWord(String word, String input) { Pattern legacyPattern = Pattern.compile(word, Pattern.CASE_INSENSITIVE); Matcher matcher = legacyPattern.matcher(input); StringBuilder returnString = new StringBuilder(); int index = 0; while(matcher.find()) { returnString.append(input.substring(index,matcher.start())); for(int i = 0; i &lt; word.length() - 1; i++) { returnString.append('*'); } returnString.append(word.substring(word.length()-1)); index = matcher.end(); } if(index &lt; input.length() - 1){ returnString.append(input.substring(index)); } return returnString.toString(); } I get p*sing p*s p**sed **s When I really just want "passing pass passed **s. Does anyone know how to avoid this partial matching with this method?? Any help would be great thanks!
has title: String matching in java
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33057197
upvote count: 1
has answer: http://stackoverflow.com/a/21839605
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/21839605
answer count: 3
has comment: http://stackoverflow.com/comment/33057265
has answer: http://stackoverflow.com/a/21840087
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/32816636
type: QuestionComment
has text: Well I want to send the code to my friend to see if it's possible to chat via the console. That means it needs to be listening to packets and allowing to send packets at the same time.
comment on: http://stackoverflow.com/q/21704501
score: 0
type: Comment

http://stackoverflow.com/comment/32802068
type: Comment
type: QuestionComment
score: 3
has text: Apparently, Java 8 moves away from _checked_ exceptions. Almost all newly introduced exceptions are _unchecked_, and newly introduced methods use _unchecked_ exceptions, e.g. [Files.list](http://download.java.net/jdk8/docs/api/java/nio/file/Files.html#lines-java.nio.file.Path-) throws an [UncheckedIOException](http://download.java.net/jdk8/docs/api/java/io/UncheckedIOException.html).
comment on: http://stackoverflow.com/q/21690568

http://stackoverflow.com/a/68156411
score: -3
upvote count: 1
answers question: http://stackoverflow.com/q/21732018
downvote count: 4
has comment: http://stackoverflow.com/comment/120522788
type: Answer
has body: Most encrypted text contains "�"

http://stackoverflow.com/comment/32975987
type: AnswerComment
has text: Thanks, I do use @RequestBody :) I just made a mistake while writing the question. I corrected it.
type: Comment
comment on: http://stackoverflow.com/a/21793665
score: 0

http://stackoverflow.com/a/25914967
downvote count: 0
has body: Adding to the answers above. I was trying to modify the android chat example and I was doing that correctly all the names were correct and as per the forge. Still I was getting the same error. Solution: When creating Bean class, include every child in the structure without leaving any entry. In my case I was trying to create a bean according to android application's requirement and thus the error. Example: I just had two getter methods declared for author and message ( Which is wrong. ) android-chat |---&gt; chat |---&gt; pushID |---&gt; author |---&gt; message |---&gt; time |---&gt; fourthChild
score: 1
answers question: http://stackoverflow.com/q/21698441
upvote count: 1
has comment: http://stackoverflow.com/comment/50703778
type: Answer

http://stackoverflow.com/q/21729953
type: Question
tagged with: graphics
answer count: 2
has body: I am making a flappy bird like plane game, and in one class I have the background that moves, and then I add it to the jPanel in the main which is in its own class, in another class I have the player and I add that to the main Jpanel. But whichever class I add first dissapears when I add the second class to the JPanel. Here is my background class: import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JPanel; import javax.swing.Timer; public class map1 extends JPanel implements ActionListener{ Timer t = new Timer(5, this); int rect1x = 1000, rect1y = 0; int rect2x = 1250, rect2y = 0; int rect3x = 1500, rect3y = 0; int rect4x = 1750, rect4y = 0; int rect5x = 2000, rect5y = 0; int rect1dx = 1000, rect1dy = 300; int rect2dx = 1250, rect2dy = 350; int rect3dx = 1500, rect3dy = 400; int rect4dx = 1750, rect4dy = 350; int rect5dx = 2000, rect5dy = 300; public map1(){t.start();} public void rectset1(Graphics g){ g.drawRect(rect1x, rect1y, 50, 100); g.drawRect(rect1dx, rect1dy, 50, 300); } public void rect2(Graphics g){ g.drawRect(rect2x, rect2y, 50, 150); g.drawRect(rect2dx, rect2dy, 50, 300); } public void rect3(Graphics g){ g.drawRect(rect3x, rect3y, 50, 200); g.drawRect(rect3dx, rect3dy, 50, 300); } public void rect4(Graphics g){ g.drawRect(rect4x, rect4y, 50, 150); g.drawRect(rect4dx, rect4dy, 50, 300); } public void rect5(Graphics g){ g.drawRect(rect5x, rect5y, 50, 100); g.drawRect(rect5dx, rect5dy, 50, 300); } public void paintComponent(Graphics g){ super.paintComponent(g); rectset1(g); rect2(g); rect3(g); rect4(g); rect5(g); } @Override public void actionPerformed(ActionEvent e) { repaint(); rect1x--; rect2x --; rect3x --; rect4x --; rect5x --; rect1dx --; rect2dx --; rect3dx --; rect4dx --; rect5dx --; } } And here is my plane class: import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import…
tagged with: flappy-bird-clone
has answer: http://stackoverflow.com/a/21730292
has comment: http://stackoverflow.com/comment/32861972
has title: Drawing Graphics From multiple classes?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21730843
tagged with: drawing
has comment: http://stackoverflow.com/comment/32862476
score: 0
tagged with: java
tagged with: screen

http://stackoverflow.com/a/21699139
score: 4
downvote count: 0
has body: It is because Matcher#matches attempts to match entire input. You need matcher#find() instead.
type: Answer
answers question: http://stackoverflow.com/q/21699095
upvote count: 4

http://stackoverflow.com/comment/32983910
type: AnswerComment
has text: no success... It's a problem with the path, when i create the jar with 'connection = DriverManager.getConnection("jdbc:sqlite:/home/user/Bureau/BDD/CyberSamer.sqlite");', it works...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21795668

http://stackoverflow.com/comment/32844784
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [How to get the first non-null value in Java?](http://stackoverflow.com/questions/2768054/how-to-get-the-first-non-null-value-in-java)
comment on: http://stackoverflow.com/q/21720024

http://stackoverflow.com/comment/33009272
type: Comment
score: 0
has text: Right. Try it and see what happens.
comment on: http://stackoverflow.com/q/21812289
type: QuestionComment

http://stackoverflow.com/comment/32837728
score: 0
has text: Are you free to skype for a few minutes? I'm experiencing a really weird bug when debugging and I don't even know how to describe it without sharing my screen.
type: Comment
comment on: http://stackoverflow.com/a/21715130
type: AnswerComment

http://stackoverflow.com/comment/32791828
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21689883
has text: I am sorry. I din't get you.
score: 0

http://stackoverflow.com/comment/32914616
type: Comment
has text: This sounds very similar to a project euler problem I solved recently. Perhaps looking at peoples solutions to [this just for fun puzzle](http://projecteuler.net/problem=59) will help you.
score: 0
comment on: http://stackoverflow.com/q/21759534
type: QuestionComment

http://stackoverflow.com/comment/33032903
has text: For the duplicated code, this is because the BundleTranslationProvider existed before the ResourceBundleHelper and initially the ResourceBundleHelper only existed in e4.tools, so it was not possible to merge that in some way. Regarding on how you set the service, AFAIK there shouldn't be problems. Form the lifecycle perspective model addons are processed within @ProcessAdditions, which is still before the renderers are called. So it should be fine to use an addon instead of a lifecycle handler.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21808998

http://stackoverflow.com/q/21685061
has comment: http://stackoverflow.com/comment/32782246
answer count: 1
has answer: http://stackoverflow.com/a/21685185
accepted answer: http://stackoverflow.com/a/21685185
favorite count: 0
has comment: http://stackoverflow.com/comment/32782212
type: AnsweredQuestion
tagged with: software-design
type: Question
has comment: http://stackoverflow.com/comment/32783535
tagged with: java
score: -1
has title: Java Project Wording issue
has comment: http://stackoverflow.com/comment/32782288
downvote count: 2
has body: I have the following project to complete but the person who has set it isn't making much sense. I have done around 60% of the program and it just doesn't feel right and I would like to check what other people think they are going on about. For this part of the project you are asked to implement a class IntegerSet. The set should be represented by an array of booleans. The ith element will be true if and only if i is in the set. The largest integer that can be an element of the set is thus determined by the size of the array. You should provide the following methods: A constructor that has a single integer argument domainMax and creates an instance of IntegerSet whose elements may be any non-negative integer not greater than the domainMax. Initially the set should be empty. You may assume that the argument will always be greater than zero. A method addElement that takes a non-negative integer as argument and inserts it into a set. If the element exceeds the domain maximum for the set, the domain maximum should be increased to accommodate it. If the element is already present, the set is unchanged. You may assume that the method will never be called with negative argument. A static method union that takes two sets as its arguments and returns a new set that is the union of the two sets. Note that the two sets supplied as arguments may have different domain maxima; the resulting union should have whichever of these two domain maxima is larger. A static method intersection that takes two sets as its arguments and returns a new set that is the intersection of the two sets. Note that the two sets supplied as arguments may have different domain maxima; the resulting intersection should have whichever of the two domain maxima is smaller. What is meant by the word "set" I am unable to find anything relevant to this project. How would I take two objected instances in union and intersection if the methods inside an instanced object. It makes no sense to me. What do I do to sto…
has comment: http://stackoverflow.com/comment/32782769
upvote count: 1

http://stackoverflow.com/q/21770571
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/32934917
has body: I'm working on this java program and I keep getting error from the IsLetterOrDigit method invocation, it's confusing me as I've used isLetter() already in the program and I didn't get any error from that one, somebody help me please. import java.io.*; import java.util.*; import java.lang.*; public class A11{ public static void main(String args[]) throws IOException{ BufferedReader br = new BufferedReader(new FileReader(args[0])); BufferedWriter bw = new BufferedWriter(new FileWriter("A1.output")); List&lt;String&gt; keywords = Arrays.asList("IF", "ELSE", "WRITE", "READ", "RETURN", "BEGIN", "END", "MAIN", "INT", "REAL"); List&lt;String&gt; l = new LinkedList&lt;String&gt;(); String line, word; while((line = br.readLine()) != null){ StringTokenizer tk = new StringTokenizer(line, " ;)*,("); while(tk.hasMoreTokens()){ word = tk.nextToken(); if(!keywords.contains(word)){ if(Character.isLetter(word.charAt(0) )){ for(int i=0; i&lt;word.length(); ++i){ if(Character.IsLetterOrDigit(word.charAt(i))){//Error here System.out.println(word); } } } } } } } }
favorite count: 0
linked to: http://stackoverflow.com/q/2128459
has answer: http://stackoverflow.com/a/21770584
type: UnansweredQuestion
downvote count: 1
has title: IsLetterOrDigit Error
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/21770589
type: Question

http://stackoverflow.com/q/21689370
tagged with: overriding
has body: I'm trying to make a rational numbers class and override the equals and hash code methods. But my equals is coming back true in cases were its clearly not true ie the numerator and denominator are different. Any idea what could be causing this? public boolean equals(Object rhs) { if (this == rhs){ return true; } if (rhs == null){ return false; } if (!(rhs instanceof Rational)){ return false; } Rational other = (Rational) rhs; if (denom == other.denom){ if (num == other.num);{ return true; } } return false; }
accepted answer: http://stackoverflow.com/a/21689397
score: 0
has answer: http://stackoverflow.com/a/21689392
answer count: 3
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21689397
has answer: http://stackoverflow.com/a/21689394
has title: overriding equals method problems
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21689392

http://stackoverflow.com/comment/32803632
has text: Use List on the LHS rather than ArrayList, if you don't absolutly need an ArrayList there. And use the diamond operator on the RHS to avoid warnings.
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/21696844
type: Comment

http://stackoverflow.com/comment/75133799
has text: I have no idea why, but `gradle clean bootRepackage ` helped me. Previously, I have manually clean all cache and build folder.
type: Comment
comment on: http://stackoverflow.com/a/37496757
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32919450
type: AnswerComment
score: 0
type: Comment
has text: Applets are running in the browser with Java plugin on client side.
comment on: http://stackoverflow.com/a/21747276

http://stackoverflow.com/q/21752771
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32902641
upvote count: 1
has comment: http://stackoverflow.com/comment/32905696
has title: java clone deep copy HashMap
has body: In my webapplication, I've to bring the same data from DB into the webapplicatio, which takes lots of time. What I did is, that I took the data and put it into the HashMap. That way I dont't have to bring it every time into the webapplication. But the big problem is, that all user will operate on the same data, which they change. My first question is: Is it correct, to save the data brought from DB in a HashMap, so I don't have to query it from DB every time? My second question is, in case I can use a HashMap to save the data, I've to make a deep copy or clone of the data brought and put in the HashMap, so each user have a copy of the origin data. right? The Object I've to clone is, a transfer object, which has references to other Object and HashMaps. The process is so: bring first the data from DB, make classes and put all classes into a transfer object and put that transfer object into a hashmap. next time, bring the data from hashmap. Thanks for every help. Edit: That data coming from DB creates a online form and has default values like name and address and sex... All user have to edit the form for their own purposes. Thats way every user must have his own copy to operate on it.
tagged with: clone
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32905887
type: Question
has comment: http://stackoverflow.com/comment/32905381
tagged with: hashmap
has answer: http://stackoverflow.com/a/21752968
downvote count: 0

http://stackoverflow.com/a/21693441
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21691342
has body: Location updates come to onLocationChanged() callback. You won't get them somewhere else, so be sure to handle handle them in callback. Also it may be really useful to let your activity implement this listener and pass YourActivity.this as instance of LocationListener to GPSTracker, where you later request location updates with activity parameter

http://stackoverflow.com/a/21818881
has comment: http://stackoverflow.com/comment/33020966
accepted answer of: http://stackoverflow.com/q/21818835
has comment: http://stackoverflow.com/comment/33020894
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33021097
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/33020852
has comment: http://stackoverflow.com/comment/33020917
has body: I would split the Strings one and two at the - and put them into arrays, one for year, one for month, and one for the day. Then, use the .parseInt(); command to change each String[] to int[] and compare them as integers. First compare the years, then the months, then the days. I can write up some sample code if you would like. String[][] sorted = new String[2][3]; //hold sorted data String[] unsorted = new String[2]; //hold unsorted data unsorted[0] = one; unsorted[1] = two; int[] year = new int[2]; int[] month = new int[2]; int[] day = new int[2]; for (int i = 0; i &lt; 2; i++){ sorted[i] = unsorted[i].split("-"); //sort data } //place sorted data into seperate arrays to make calculations more logical to look at for (int i = 0; i &lt; 2; i++){ year[i] = Integer.parseInt(sorted[i][1]); month[i] = Integer.parseInt(sorted[i][2]); day[i] = Integer.parseInt(sorted[i][3]); } Basically, this splits up the dates into three separate arrays called year, month, and day. Now you can use comparator or if statements to check to see which date is larger.
has comment: http://stackoverflow.com/comment/33020984
answers question: http://stackoverflow.com/q/21818835

http://stackoverflow.com/comment/32778128
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21682720
has text: You can only bundle data that's serializable, your textview is a ui element of your previous activity. To give you proper assistance, what are you trying to do with your textview in the new Intent? Do you just need the text inside of it?
type: Comment

http://stackoverflow.com/comment/32977446
score: 0
comment on: http://stackoverflow.com/q/21793967
type: QuestionComment
type: Comment
has text: Some kind of exceptions related to state. The exceptions are probably caused by code other than generic arrays since after modifications the code is running. Can anyone explain why this is allowed despite IDE warnings?

http://stackoverflow.com/a/21772083
answers question: http://stackoverflow.com/q/21771043
score: 1
upvote count: 1
downvote count: 0
has body: I think it's not that simple. I think you can reference other objects in .net and java alike and the same problem exists about the other objects being in an unpredictable state. One would need to study the inner workings of both to fully understand them, but I don't know java that deeply, I only think that they are very similar. And by the way, this finalizer guardian looks fishy to me.
type: Answer

http://stackoverflow.com/q/21803299
type: AnsweredQuestion
downvote count: 0
favorite count: 0
tagged with: jboss6.x
has comment: http://stackoverflow.com/comment/32993628
has body: I have using stateless bean as JMS message producer: package com.cts.businesslogic; import javax.annotation.Resource; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.MessageProducer; import javax.jms.ObjectMessage; import javax.jms.Queue; import javax.jms.Session; import com.cts.business.HelloWorldBeanRemote; import com.cts.to.Customer; /** * Session Bean implementation class HelloWorldBean */ @Stateless(name = "HelloWorldBean") @LocalBean public class HelloWorldBean implements HelloWorldBeanRemote { @Resource(name = "java:/ConnectionFactory") private ConnectionFactory connectionFactory; @Resource(name = "java:/jms/HelloWorldQueue") private Queue destination; private Connection connection; private MessageProducer producer; /** * Default constructor. */ public HelloWorldBean() { } @Override public String sayHello() { try { connection = connectionFactory.createConnection(); Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(destination); ObjectMessage message = session.createObjectMessage(); Customer c = new Customer(); c.setName("John"); message.setObject(c); producer.send(destination, message); session.close(); connection.close(); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } return "Hello World : First Ejb"; } } My MDB is as follows: package com.cts.businesslogic; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.ObjectMessage; import com.cts.to.Customer; /** * Message-Driven Bean implementation class for: HelloWorldMDB */ @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValu…
has comment: http://stackoverflow.com/comment/33023827
type: Question
has comment: http://stackoverflow.com/comment/32993728
score: 1
tagged with: jms
accepted answer: http://stackoverflow.com/a/21858628
upvote count: 1
answer count: 1
has title: MDB not receiving message from stateless session bean
tagged with: java
tagged with: message-driven-bean
tagged with: ejb-3.1
has comment: http://stackoverflow.com/comment/32999707
has comment: http://stackoverflow.com/comment/33090641
has answer: http://stackoverflow.com/a/21858628
has comment: http://stackoverflow.com/comment/33000538

http://stackoverflow.com/a/21755155
score: 0
answers question: http://stackoverflow.com/q/21755112
has body: IF statement in java expects boolean. Your code should be if(data[x] ==numToFind) This might been a Typo. A mistake users from C background frequently make is confusing the assignment and equality operators = and ==. If you want to compare two values, you should use a double equal sign since that's how Java works. If you accidentally use a single equal sign, you don't compare values but assign a value to a variable. Your code would have perfectly worked in C, but it won't work in Java
type: Answer

http://stackoverflow.com/q/21802451
has title: Rotate triangle in openGL android
has comment: http://stackoverflow.com/comment/32992475
type: Question
has answer: http://stackoverflow.com/a/21803601
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32992723
tagged with: opengl-es
type: UnansweredQuestion
tagged with: android
has body: I did a simple app based on the sample of getting started at developer.android.com. It was working fine, but I changed the rotation logic and now it doesn't show the triangle. I'm not sure I understood the matrix stuff, so I would like if someone could check my code. This is the SurfaceView method I think may have a problem: @Override public boolean onTouchEvent(MotionEvent e){ float x = e.getX(); float y = e.getY(); switch(e.getAction()){ case MotionEvent.ACTION_MOVE: float rotateX = 0.0f; float rotateY = 0.0f; float rotateZ = 0.0f; //na coluna da esquerda, rotação no eixo Z if(x &lt; getWidth() / 3){ rotateZ = (y - previousY); } //na coluna do meio, rotação no eixo X if(getWidth()/3 &lt; x &amp;&amp; x &lt; 2*getWidth()/3){ rotateX = (y - previousY); } //na coluna da direita, rotação no eixo Z invertido if(x &gt; getWidth() / 3){ rotateZ = - (y - previousY); } //na linha superior, rotação no eixo Z if(y &lt; getHeight() / 3){ rotateZ = (x - previousX); } //na linha do meio, rotação no eixo Y if(getHeight()/3 &lt; y &amp;&amp; y &lt; 2*getHeight()/3){ rotateY = (x - previousY); } //na linha inferior, rotação no eixo Z invertido if(y &gt; 2*getHeight() / 3){ rotateZ = - (x - previousX); } mRenderer.setAngulo(mRenderer.getAnguloX() + (rotateX) * TOUCH_SCALE_FACTOR, mRenderer.getAnguloY() + (rotateY) * TOUCH_SCALE_FACTOR, mRenderer.getAnguloZ() + (rotateZ) * TOUCH_SCALE_FACTOR); requestRender(); } previousX = x; previousY = y; return true; } This is the renderer method: @Override public void onDrawFrame(GL10 unused) { //desenha o fundo GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); //define a posição da camera //Matrix.setLookAtM(mViewMatrix, 0, eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ); Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -5f, 0f, 0f, 0f, 0f, 1.0f, 0.0f); //cria uma matrix para a rotação de cada angulo Matrix.setRotateM(xRotationMatrix, 0, anguloX, 1, 0, 0); Matrix.setRotateM(yRotationMatrix, 0, anguloY, 0, 1, 0); Matrix.setRot…
tagged with: java

http://stackoverflow.com/a/21767079
has body: Turns out that deleting this line solved my problem: BasicConfigurator.configure(); With regard to setting additivity to false, this was a solution to removing the initial INFO root - Applying Resources Which was being written despite the stacking of the logging messages.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21765979

http://stackoverflow.com/comment/33011545
has text: Because maximized window is not fullscreen window - the Windows task bar is sitll there and I do not want it
comment on: http://stackoverflow.com/q/21785837
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32890310
comment on: http://stackoverflow.com/a/21745400
has text: Because it was still coming up 'null' and I was trying something new, updated code - still comes up null. And I notice a slight delay in it even displaying, I believe moving my phone triggers it to update - is onLocationChanged even called initially in the first bit of code? Or only when the phones location changes?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33050325
type: AnswerComment
type: Comment
has text: Java is actually Pass-By-Value-Reference.. If it was actually pass by value, you won't be able to modify the original object using getters or setters as in C++. In Java, a copy of a pointer/reference to the object is passed: http://www.javaworld.com/article/2077424/learn-java/does-java-pass-by-reference-or-pass-by-value.html and http://stackoverflow.com/questions/40480/is-java-pass-by-reference Describing Java's object passing semantics really depends on your definition of reference..
score: 1
comment on: http://stackoverflow.com/a/21835326

http://stackoverflow.com/comment/32910398
has text: Can I not convert the windows-1252 encoding to utf-8? Also even if its utf-8 why is java not able to read it properly?
type: AnswerComment
comment on: http://stackoverflow.com/a/21756798
score: 0
type: Comment

http://stackoverflow.com/a/22037179
has comment: http://stackoverflow.com/comment/33410630
has comment: http://stackoverflow.com/comment/33410496
answers question: http://stackoverflow.com/q/21768205
type: Answer
score: 0
has body: You should copy the Zxing library source code into your project. The two packages that you will need for scanning QR code are com.google.zxing.client.android com.google.zxing.client.android.camera After you have copied these packages you can call the QR code scanner activity from your activity. private static final int LOGIN_SCAN_REQUEST = 0; /** * Call this method from anywhere in the activity */ private void startScannerActivity() { Intent qrScannerIntent = new Intent(LoginActivity.this, CaptureActivity.class); startActivityForResult(qrScannerIntent, LOGIN_SCAN_REQUEST); } /** * Result is returned in this method after QR code scanning is complete */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == LOGIN_SCAN_REQUEST) { if (resultCode == RESULT_OK) { String qrcodeString = data.getStringExtra( Intents.Scan.RESULT).trim(); Log.i("QR String", qrcodeString); //Do what you want with QR Code here } } }
has comment: http://stackoverflow.com/comment/33409812
has comment: http://stackoverflow.com/comment/33411052

http://stackoverflow.com/q/21799924
tagged with: spring
type: AnsweredQuestion
tagged with: java
has title: Exception Modelling in Product
downvote count: 1
has body: I need some ideas on how to implement Exceptions in our product. I think of few ideas like: 1.) Since we are using Spring AOP, can i create some aspect,advice around catch block so that i do not have to change everywhere in the code. Also Spring global exception handler is there which only comes into play if no catch block is there. 2.) Auditing exceptions in database, generating reports so as o control and make changes in the code accordingly. 3.) Sending emails to specific groups. 4.) Displaying different error pages, handling different error codes for different exceptions. 5.) Fine gaining exception stacktrace to extract use full information and display to business users/end users. Please share what else we can provide as apart of exception modelling in our product. Any avilable API we can consult..???
type: Question
score: -1
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21800304
tagged with: exception
accepted answer: http://stackoverflow.com/a/21800304

http://stackoverflow.com/comment/32786069
has text: Ah that is true: the `TimeZone` stays the same, but the `ZONE_OFFSET` is updated, which is good enough (or better, even). Sadly the spec does not give any guarantees about `ZONE_OFFSET`, so it's underspecified to be actually reliable.
type: AnswerComment
comment on: http://stackoverflow.com/a/21685887
type: Comment
score: 0

http://stackoverflow.com/q/21827863
has answer: http://stackoverflow.com/a/21827909
tagged with: arrays
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21827909
has body: I have a class like this: public class Questionnaire { private String questionnaireLibelle; private List&lt;Question&gt; questions; // ... } And I've initialized a new Questionnaire like this: Questionnaire q = new Questionnaire( "Architecture des ordinateurs", Arrays.asList( new Question( "1. La partie du processeur spécialisée pour les calculs est :"), new Question("2. Dans un ordinateur, les données sont présentées par un signal électrique de la forme :"), new Question("3. Les différents éléments d’un ordinateur (mémoire, processeur, périphériques…) sont reliés entre eux par des:") ) ); As you see I used Arrays.asList() instead of declaring a new ArrayList. In another class I used this code: for(Question q : (ArrayList&lt;Question&gt;) request.getAttribute("listQuestions")) But I got this error for that line: java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList How can I solve this?
possible better answer: http://stackoverflow.com/a/21828220
has answer: http://stackoverflow.com/a/21828220
score: 2
has title: Error: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
tagged with: arraylist
has answer: http://stackoverflow.com/a/21828319
answer count: 3

http://stackoverflow.com/comment/32927722
has text: This has to be inside a listener which is attached to a widget(ArrayAdapter) so that it will be triggered when the list is empty. The listener is the triggering mechanism.
score: 0
comment on: http://stackoverflow.com/a/21765434
type: Comment
type: AnswerComment

http://stackoverflow.com/a/21718795
type: Answer
score: 13
upvote count: 13
answers question: http://stackoverflow.com/q/21718669
downvote count: 0
has body: You'll probably need to create some sort of Node class to represent the nodes in the tree: public class Node { private List&lt;Node&gt; children = null; private String value; public Node(String value) { this.children = new ArrayList&lt;&gt;(); this.value = value; } public void addChild(Node child) { children.add(child); } } Then to populate your tree: public static void main(String [] args) { Node root = new Node("root"); root.addChild(new Node("child1")); root.addChild(new Node("child2")); //etc. } You'll have to modify this to suit your own purposes, this code is just to give you an idea of the structure.

http://stackoverflow.com/a/21784376
accepted answer of: http://stackoverflow.com/q/21783914
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21783914
has comment: http://stackoverflow.com/comment/32959270
type: Answer
has body: It's not good to use recursion for that, because after "n" invocations you can receive StackOverFlowError. And I agree with @laune. Thus I recommend to use loop. For example: while (true){ // lol2 here is TRUE if was entered correct value and false if not. if (lol2) break; else { JOptionPane.showMessageDialog(frame, "Quantità non disponibile"); this.addToCart(cart,quant); } }
upvote count: 2
has comment: http://stackoverflow.com/comment/32961502

http://stackoverflow.com/q/21686327
downvote count: 0
tagged with: typesafe
favorite count: 0
has title: akka.io dispatcher configuration Exception
tagged with: scala
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/21699157
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32808101
tagged with: actor
type: Question
has body: In sbt 0.13 project, I put the following in application.conf file located under src/main/resources application.conf: blocking-dispatcher { type = PinnedDispatcher executor = "thread-pool-executor" thread-pool-executor { core-pool-size-min = 2 core-pool-size-factor = 2.0 core-pool-size-max = 10 } throughput = 100 mailbox-capacity = -1 mailbox-type ="" } now when I create actor I'm getting exception: object Main extends App { implicit val system = ActorSystem() val fileReaderActor = system.actorOf(Props(new FileReaderActor(fileName)).withDispatcher("blocking-dispatcher"), "fileReaderActor") } I'm getting: Exception in thread "main" akka.ConfigurationException: Dispatcher [blocking-dispatcher] not configured for path akka://default/user/fileReaderActor at akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:714) at akka.actor.dungeon.Children$class.makeChild(Children.scala:191) at akka.actor.dungeon.Children$class.attachChild(Children.scala:42) at akka.actor.ActorCell.attachChild(ActorCell.scala:338) at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:518) at Main$delayedInit$body.apply(Main.scala:14) at scala.Function0$class.apply$mcV$sp(Function0.scala:40) at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) at scala.App$$anonfun$main$1.apply(App.scala:71) at scala.App$$anonfun$main$1.apply(App.scala:71) at scala.collection.immutable.List.foreach(List.scala:318) at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32) at scala.App$class.main(App.scala:71) at Main$.main(Main.scala:8) at Main.main(Main.scala) What am I missing?
possible better answer: http://stackoverflow.com/a/21688848
has answer: http://stackoverflow.com/a/21688848
answer count: 2
tagged with: akka
has answer: http://stackoverflow.com/a/21699157

http://stackoverflow.com/a/21726507
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32855917
has body: Fragment1 and Fragment2 are effectively the same. They both have the same scope, and create the same object. In the latter, this is done in the constructor. That is the difference. In my view, members should usually be initialised in the constructor. Fragment3 scope is different. Once the constructor ends, C is garbage collected. That is because, when a method is finished, all local objects are dereferenced. Once there is no reference pointing at an instance, the garbage collector does what it does best. Collects the damn garbage. The three different examples exist because.. well.. they can be used in several different situations. You might have a member that relies on another member, so can only be initialised after the first member was. Example public class Test { private A a; private B b; public Test() { b = new B(); // As you can see, b needs to exist first. a = new A(b); } How an object created without any reference variable will be maintained. For example, new C(); new C().Hello(); How to understand their memory management, default values, scope!! If there is no reference to an object, then it will be garbage collected. When you declare new A() it exists for as long as you use it. The second the program steps over that line of code (or collection of byte code as it were), the Garbage Collector cleans up again. Q3) Difference between the below 2 fragments: In the first example, a can be used anywhere in the class. This is called a global variable or, more specifically, an instance variable. In the second example, you declare a local variable. This means that it can only be used inside the method it is declared in. In this case, the constructor.
downvote count: 0
answers question: http://stackoverflow.com/q/21726240
type: Answer

http://stackoverflow.com/comment/33042082
comment on: http://stackoverflow.com/a/21753374
type: Comment
has text: Yea @Dmitry seems to be working. But using the property props.put("auto.offset.reset", "smallest"), would it mean that consumer would not keep a track of the offsets while fetching data from the same topic later after we produce some more data to it? Won't we be getting duplicate data that we have already read from the consumer?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21681173
has comment: http://stackoverflow.com/comment/32776288
has comment: http://stackoverflow.com/comment/32776188
tagged with: java
has comment: http://stackoverflow.com/comment/32775887
has comment: http://stackoverflow.com/comment/32775607
type: Question
answer count: 1
has title: downloading resourses from URL java
tagged with: url
has comment: http://stackoverflow.com/comment/32775455
has body: I have a list of Links that's points to server repository location, Links represents some resourses that includes images, xml,txt,csv (each of different sizes) files but the problem i am facing is that when i download files all downloaded files got same file size. List&lt;String&gt; Links;//list of links dynamically populated for(String link:Links) { int i=link.lastIndexOf("/"); String temp=link.substring(0, i); String contentname = temp.substring(temp.lastIndexOf("/")+1); String filePath = tempFolderPath + "\\" + contentname; URL url = new URL(link); URLConnection connection = url.openConnection(); InputStream is = new DataInputStream(connection.getInputStream()); FileOutputStream fos = null; try { fos = new FileOutputStream(new File(filePath)); int inByte; while((inByte = is.read()) != -1) fos.write(inByte); is.close(); fos.close(); } catch (Exception e) { e.printStackTrace(); } finally { try { is.close(); fos.close(); } catch (Exception e) { e.printStackTrace(); } } where links are direct access to the resourses "//localhost:8090/documents/11234/13935/abc.txt"
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21681432
has comment: http://stackoverflow.com/comment/32776035

http://stackoverflow.com/comment/32994588
score: 0
has text: Obvious question: Does simply typing `GIT` in the mac console works?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21804233

http://stackoverflow.com/q/21826432
has title: Android broadcast receiver to scan every incoming SMS for specific Contant
score: 1
favorite count: 0
type: Question
tagged with: android
has body: I want to Scan every incoming SMS for specific content. when specific content found then a specific task is performed. suppose specific content string is "Hello world" when service find this string it will trigger a specific task i.e. take a photo with front camera and place that photo on a specific folder. receiver have to run always when phone is on.
upvote count: 2
tagged with: java
answer count: 1
downvote count: 1
tagged with: broadcastreceiver
has answer: http://stackoverflow.com/a/21826663
has comment: http://stackoverflow.com/comment/33033833
has comment: http://stackoverflow.com/comment/33034156
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33033978
has comment: http://stackoverflow.com/comment/33034422

http://stackoverflow.com/comment/33039499
score: 0
comment on: http://stackoverflow.com/a/21812317
type: AnswerComment
has text: @user3051067 It wouldn't. It would just make it one line shorter. If it upsets you that much, put the if-break on the same line as the opening brace and pretend it's part of the for syntax.
type: Comment

http://stackoverflow.com/comment/32870891
has text: YeniLabel yeni = new YeniLabel("Paint component.............. "); add(yeni); I put them in the Grafik3 method. and I remove the int a=25 in the second class
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21734603

http://stackoverflow.com/a/21740833
has body: From the Javadocs for BigInteger's isProbablePrime method: certainty - a measure of the uncertainty that the caller is willing to tolerate: if the call returns true the probability that this BigInteger is prime exceeds (1 - 1/2certainty) So, the higher the certainty number you pass, the more certain you can be, i.e. 100 means it's prime with probability 1 - (1/2)100, which is extremely close to 1. Java accomplishes this by performing Miller-Rabin primality tests, the number of which is based on certainty (and a Lucas-Lehmer test).
has comment: http://stackoverflow.com/comment/102626249
downvote count: 0
has comment: http://stackoverflow.com/comment/102632355
answers question: http://stackoverflow.com/q/21740745
type: Answer
has comment: http://stackoverflow.com/comment/32882053
upvote count: 24
score: 24

http://stackoverflow.com/a/25321221
downvote count: 1
answers question: http://stackoverflow.com/q/21797500
type: Answer
upvote count: 0
score: -1
has body: If you like to change the database changes dynamically, you have to write the UI for database source information and set to the spring config files in version-4.0.

http://stackoverflow.com/q/21796022
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32980019
tagged with: android-activity
has answer: http://stackoverflow.com/a/21796036
type: Question
score: 0
answer count: 2
tagged with: android
has body: I'm working on a simple 'Click Countdown' application, which basically has an imagebutton function. when pressed it displays the number of clicks from 10 to 9, 8, 7,... to 0. I have a problem, when I close the application the number of clicks starts again from 10. I know that's quite beginner question, but can someone help me please? how can I save number of clicks? This is the code I have so far: package com.example.testapp; import com.example.testapp.R; import android.os.Bundle; import android.app.Activity; import android.widget.ImageButton; import android.view.View; import android.widget.TextView; import android.view.View.OnClickListener; import com.google.ads.AdRequest; import com.google.ads.AdView; public class MainActivity extends Activity { ImageButton button1; TextView textView1; int counter = 10; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AdView adView = (AdView)this.findViewById(R.id.adView); adView.loadAd(new AdRequest()); ImageButton imageButton; imageButton = (ImageButton) findViewById(R.id.button1); textView1 = (TextView) findViewById(R.id.textView1); button1 = (ImageButton) findViewById(R.id.button1); imageButton.setOnClickListener(new OnClickListener(){ public void onClick(View v) { if (counter &gt;= 1) { counter--; textView1.setText("" + counter); } else if (counter == 0){ button1.setImageResource(R.drawable.picture2); counter--; } } }); } }
tagged with: java
has answer: http://stackoverflow.com/a/21796048
has title: Saving number of button clicks

http://stackoverflow.com/comment/32804464
comment on: http://stackoverflow.com/q/21697506
score: 0
type: Comment
type: QuestionComment
has text: What's the problem? What error do you get?

http://stackoverflow.com/comment/32843245
comment on: http://stackoverflow.com/a/21718940
type: Comment
has text: Please clarify then because I don't see it. How does it answer why all 11 threads are calling the code inside the `synchronized(Crawler.class)` block if the `updateQueue` method is meant to change the size so that the `if` block returns `false` on the second+ thread?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21696680
duplicate of: http://stackoverflow.com/q/1963806
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32803095
favorite count: 0
linked to: http://stackoverflow.com/q/5498865
has answer: http://stackoverflow.com/a/21696750
has comment: http://stackoverflow.com/comment/32807369
has title: Is there a Java collection which removes items as more items are added? (a simple cache)
has body: I need a simple caching mechanism. I want to keep up to the last 100 most-recent items that were added, but no more than that limit. As I add another item, I want the collection to automatically delete the 101st item. Imagine pushing LifeSaver candies through a tube – as I add another candy at one end of the tube, at the other end another candy will fall out. It would be simple to write my own. My "add" method would first delete the oldest item before performing tho "add". I just wonder if there is already such a class written. I looked at the bundled Collection classes, List, Queue, and so on. I looked a Google Guava as well. But none seem to have this simple feature. This is a difficult topic to google, as I do not know the jargon for this behavior.
downvote count: 0
has comment: http://stackoverflow.com/comment/45707696
linked to: http://stackoverflow.com/q/3355216
has comment: http://stackoverflow.com/comment/32803285
tagged with: collections
duplicate of: http://stackoverflow.com/q/5498865
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/32803118
tagged with: java
linked to: http://stackoverflow.com/q/1963806
linked to: http://stackoverflow.com/q/9580457
type: Question
accepted answer: http://stackoverflow.com/a/21696750

http://stackoverflow.com/comment/33016631
score: 0
type: Comment
has text: the question is the same, it was just a pasting error I missed. Its still giving me the same issue because the hyphen was always in the original code
type: AnswerComment
comment on: http://stackoverflow.com/a/21816456

http://stackoverflow.com/comment/32892437
has text: I am getting objList as a parameter. It consists of multiple values from DB. Ok Giving you.
comment on: http://stackoverflow.com/q/21746827
score: 0
type: QuestionComment
type: Comment

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/21822750
tags question: http://stackoverflow.com/q/21753874

http://stackoverflow.com/comment/33003893
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21809453
type: Comment
has text: Not your answer, but good programming practice : use while(inCombat) instead of while(inCombat != false).

http://stackoverflow.com/q/21837205
has comment: http://stackoverflow.com/comment/33052969
answer count: 2
has answer: http://stackoverflow.com/a/21838497
accepted answer: http://stackoverflow.com/a/21892882
has body: I am creating an app which will provide mock tests to its user. I have 3 sets of questions from which I need to create other unique sets by using permutations. Each question has a id related to it. So assume that Set 1 has questions with id's from 1 to 50, set 2 has id's from 101 to 150 and set 3 has id's from 201 to 250(P.S. The id's can be anything. Just to make the problem to be simple to understand lets take them to be sequential.). Now id's 1, 101 and 201 are similar type of question, so is 2, 102 and 202 and so on. And no two similar question can some under same set . Please Help. Set 1 - 1 2 3 4 5 6 7 8 9 10 .... 50 Set 2 - 101 102 103 104 105 ......150 set 3 - 201 202 203 204 205 ......250 What I want to do is create sets with below id's set 4 - 101 2 3 4 5 6 7 8 9 ......50 set 5 - 201 2 3 4 5 6 7 8 9 ......50 set 6 - 1 102 3 4 5 6 7 8 9 ......50 set 7 - 1 202 3 4 5 6 7 8 9 ......50 set 8 - 1 2 103 4 5 6 7 8 9 ......50 set 9 - 1 2 203 4 5 6 7 8 9 ......50 set 10- 1 2 3 104 5 6 7 8 9 ......50 and so on.. I have tried the below code. I was trying for 4 sets with 4 questions. public class GenerateTestSets { public static void main(String[] args) { int x = 1,i,j=0,k,m,n,temp; int[][] test = new int[4][4]; for(i = 0; i&lt;4;i++){ for(j=0; j&lt;4; j++){ test[i][j] = x + j; } x += 10; } for(m=0;m&lt;3;m++){ for(n=0;n&lt;4;n++){ for(k=0;k&lt;4;k++){ for(i = 0; i&lt;4; i++){//Print Logic for(j=0;j&lt;4;j++){ System.out.print("\t"+test[i][j]); }//End of J System.out.println(""); }//End of i //End of Print Logic System.out.println("--------------------------------------------------"); temp = test[0][0]; for(i = 0; i&lt;3;i++){ test[i][0] = test[i+1][0]; } test[i][0]=temp; }//End of K temp = test[0][m+1]; for(i = 0;i&lt;3;i++){ test[i][m+1] = test[i+1][m+1]; } test[i][m+1]=temp; }//End of n }//End of m } } I think the number of total sets that I can create from 3 sets of 50 question is 50*50*50 i.e. 125,000. Thanks in advance. I know this might seem to very simple but I…
score: -1
favorite count: 0
possible better answer: http://stackoverflow.com/a/21838497
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33056613
tagged with: java
has comment: http://stackoverflow.com/comment/33053003
downvote count: 1
type: Question
tagged with: algorithm
upvote count: 0
has title: Algorithm for creating permutation of arrays of integers
has answer: http://stackoverflow.com/a/21892882

http://stackoverflow.com/comment/32850527
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21723474
has text: You'll have to check if the cursor has content instead of it being `null`. For example use [moveToFirst](http://developer.android.com/reference/android/database/Cursor.html#moveToFirst()) - if this returns false, the cursor is empty and so has no results.
score: 0

http://stackoverflow.com/a/21739287
has comment: http://stackoverflow.com/comment/47646079
accepted answer of: http://stackoverflow.com/q/21739080
has comment: http://stackoverflow.com/comment/32880392
answers question: http://stackoverflow.com/q/21739080
score: 5
has comment: http://stackoverflow.com/comment/47631535
type: AcceptedAnswer
has body: Step 1 Provide a natural ordering for your resources. For example, if your resources were letters, A would come before B, B would come before C, and so on. Step 2 Only allow your threads to grab resources in order. Now your threads cannot possibly reach deadlock in any situation. Example Thread 1 needs locks on resources A, B, D, and E Thread 2 needs locks on resources B and E Our threads must fight for locks on resources B and D. Because we have enforced a natural order, the thread that obtains the lock on B first is guaranteed to get the lock on D and proceed smoothly. The losing thread will be waiting for B to be released.
upvote count: 5
has comment: http://stackoverflow.com/comment/32882349
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32912668
type: Comment
has text: Dear user3274993 you can appreciate the answer by accepting it as an answer or by voting up the answer.
comment on: http://stackoverflow.com/a/21733481
score: 0
type: AnswerComment

http://stackoverflow.com/a/75375076
has body: If your main() method has SpringApplication.run() method then you should remember ,it by default, returns the ApplicationContext object. See this. Meaning,you can do this: ApplicationContext context=SpringApplication.run(YourMainMethodClassName.class,args); MyClass obj=(MyClass)context.getBean(MyClass.class);
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21827548

http://stackoverflow.com/comment/32870748
type: Comment
has text: So instead of EditText, I can put TextView? (I tried looking all over android troubleshoot NEVER saw this!) Thank you if this is the answer.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21734832

http://stackoverflow.com/comment/32793707
type: AnswerComment
has text: Ah, so as Blorgbeard said, put the switch statement inside the do instead of outside of it so when the break statement happens, it will go back to the menu. Thanks for the advise Josh Braun!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21691098

http://stackoverflow.com/q/21800256
has answer: http://stackoverflow.com/a/28751820
type: Question
possible better answer: http://stackoverflow.com/a/28751820
answer count: 3
accepted answer: http://stackoverflow.com/a/21800677
downvote count: 0
has title: JSR-308 : Clarification on Nonnull, ParameterAreNonnullByDefault and the way Eclipse Kepler detect it
has comment: http://stackoverflow.com/comment/32987486
favorite count: 0
linked to: http://stackoverflow.com/q/11776302
has body: I decided to edit my question, after seeing that 1 year after, I've changed how I work with nulls: I don't use Eclipse builtin null checks, because I found it rather primitive (and perhaps a little tricky to understand) I use @Nullable to tell a value can be null. After all, there should be less null-values than non-null values. I'm using Java 8 and I tend to use Optional, thus allowing the following: Optional.ofNullable(value).orElseGet(() -&gt; 1);. It does not beat the ?: and ?. operator of Groovy, but Optional give some nice tool like map, filter, and so on. And, as for my code: constructors checks for nulls using Objects.requireNonNull, like this: public Foobar(String a) { this.a = Objects.requireNonNull(a, "a"); } methods checks for nulls using Preconditions.checkNotNull from Guava framework whenever I use it in my projects or Objects.requireNonNull: public void foobar(String a) { Preconditions.checkNotNull(a, "a"); } Using the one or the other depends on if I reuse the value. I don't check for method parameters every time, but rather mostly in the public methods. The idea is not to replace the default runtime check that throws NullPointerException more efficiently than I can do. I am currently using @Nonnull or @Nullable annotation on all my parameters, fields, method result (return), but I'm wondering what is truly the best : How could I tell that my field and method result are non null by default ? (the @ParameterAreNonnullByDefault does not work for them). I'd like a portable way (I've read here that I could create my own annotations, with specific names, and that would work for findbugs) If I annotate package com.foobar with @ParameterAreNonnullByDefault, does it apply to com.foobar.example as well ? Should I check every parameters (I am currently checking constructor parameters) when annotated by @Nonnull ? Also, since Eclipse 3.8, there is annotation based null checks. But I have problem with some "simple" case : @ParameterAreNonnullByDefault class Foob…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28795891
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21800677
has comment: http://stackoverflow.com/comment/33009846
tagged with: eclipse

inheritance
tags question: http://stackoverflow.com/q/21817256
tags question: http://stackoverflow.com/q/21689781
tags question: http://stackoverflow.com/q/21742442
tags question: http://stackoverflow.com/q/21727605
tags question: http://stackoverflow.com/q/21837750
tags question: http://stackoverflow.com/q/21836460
tags question: http://stackoverflow.com/q/21821751
tags question: http://stackoverflow.com/q/21716802
tag name: inheritance
tags question: http://stackoverflow.com/q/21818544
tags question: http://stackoverflow.com/q/21711097
tags question: http://stackoverflow.com/q/21824304
tags question: http://stackoverflow.com/q/21741168
tags question: http://stackoverflow.com/q/21807878
tags question: http://stackoverflow.com/q/21713697
tags question: http://stackoverflow.com/q/21716728
type: Tag
tags question: http://stackoverflow.com/q/21706413
tags question: http://stackoverflow.com/q/21690399
tags question: http://stackoverflow.com/q/21699898
tags question: http://stackoverflow.com/q/21767748
tags question: http://stackoverflow.com/q/21828721
tags question: http://stackoverflow.com/q/21816739
tags question: http://stackoverflow.com/q/21681094
tags question: http://stackoverflow.com/q/21783301
tags question: http://stackoverflow.com/q/21753070
tags question: http://stackoverflow.com/q/21767449
tags question: http://stackoverflow.com/q/21695917
tags question: http://stackoverflow.com/q/21725227
tags question: http://stackoverflow.com/q/21841301
tags question: http://stackoverflow.com/q/21766423
tags question: http://stackoverflow.com/q/21745929
tags question: http://stackoverflow.com/q/21821865
tags question: http://stackoverflow.com/q/21683128
tags question: http://stackoverflow.com/q/21744551
tags question: http://stackoverflow.com/q/21743145
tags question: http://stackoverflow.com/q/21790541

http://stackoverflow.com/a/21803285
upvote count: 1
has comment: http://stackoverflow.com/comment/32993008
answers question: http://stackoverflow.com/q/21803247
has body: "Or it's just a trick if you call another Object from inside the same kind of Object structure then private identifier doesn't count?" - simply, yes. EDIT Official explanation: "The first (left-most) modifier used lets you control what other classes have access to a member field. For the moment, consider only public and private. Other access modifiers will be discussed later. public modifier—the field is accessible from all classes. private modifier—the field is accessible only within its own class." (http://docs.oracle.com/javase/tutorial/java/javaOO/variables.html)
downvote count: 0
has comment: http://stackoverflow.com/comment/32993066
type: Answer
has comment: http://stackoverflow.com/comment/32992895
has comment: http://stackoverflow.com/comment/32992953
score: 1

http://stackoverflow.com/comment/32862031
score: 0
type: QuestionComment
type: Comment
has text: there are libraries like Gson that convert json strings to java objects, but i think they might have a problem with this naming convention, you can try and see.
comment on: http://stackoverflow.com/q/21729968

http://stackoverflow.com/comment/32990607
comment on: http://stackoverflow.com/q/21802025
has text: @Adel No this not homework for me, i am java learner.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21750587
answers question: http://stackoverflow.com/q/21750556
has body: Your class has to implements Iterable&lt;T&gt;. public class Report&lt;T&gt; implements Iterable&lt;T&gt; { private ObservableList&lt;T&gt; items = FXCollections.observableArrayList(); // ... public ObservableList&lt;T&gt; getItems() { return items; } public Iterator&lt;T&gt; iterator() { return items.iterator(); } // ... }
upvote count: 9
type: AcceptedAnswer
downvote count: 0
score: 9
type: Answer
accepted answer of: http://stackoverflow.com/q/21750556

http://stackoverflow.com/comment/32820194
type: Comment
type: QuestionComment
score: 0
has text: @ExpertSystem heh, well I was just using your code example but I can try. I also tried just writing to HKCR because I thought I would have admin permissions when running wrapped as an exe but didn't seem to work, Ill recheck
comment on: http://stackoverflow.com/q/21684149

http://stackoverflow.com/comment/32819318
comment on: http://stackoverflow.com/q/21705493
type: Comment
has text: @dabadaba: So you're telling me you tried ALL of the answers to ALL of the duplicate questions? If none of these worked, we're unlikely to do better by rehashing the question again.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32830313
has text: I can only answer 2) Due to type erasure, since behind the scenes you have `Object[]` and no `BB[]`.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21711772

http://stackoverflow.com/q/21736959
has answer: http://stackoverflow.com/a/21741609
type: UnansweredQuestion
tagged with: ms-access
type: Question
has comment: http://stackoverflow.com/comment/32875440
has title: how to compare two table MD5 values to identify virus in java
score: 0
has comment: http://stackoverflow.com/comment/32875655
has comment: http://stackoverflow.com/comment/32875499
has comment: http://stackoverflow.com/comment/32875706
answer count: 1
tagged with: java
has body: There are two databases, each having one table. I am trying to compare the MD5 values. for (int i=0;rs.next();i++ ) { String s=rs.getString(2); System.out.println(i+" "+s); for (int j=1;rs1.next() ;j++ ) { String s1=rs1.getString(1); //int t =s.equals(s1); if (s.equals(s1)) { System.out.println("Found"); } System.out.println(j+" "+s1); } } con.close(); } catch (Exception e) { System.out.println(e); }

http://stackoverflow.com/q/21771074
tagged with: collections
type: Question
accepted answer: http://stackoverflow.com/a/21771156
tagged with: eclipse
tagged with: arraylist
score: 0
has title: ArrayList<Integer> addAll method not adding
possible better answer: http://stackoverflow.com/a/21771127
has answer: http://stackoverflow.com/a/21771127
has body: Im trying to add the contents of this.array to a temp array but when i print the return value its always empty. Class object import java.util.*; public class LetterInventory{ private ArrayList&lt;Integer&gt; array; private int size; public LetterInventory(String input){ size = input.length(); array = new ArrayList&lt;Integer&gt;(); for(int i = 0;i&lt;input.length();i++){ array.add(i,(int)input.charAt(i)); } } public LetterInventory(){ size = 0; array = new ArrayList&lt;Integer&gt;(); } public int size(){ return size; } public LetterInventory add(LetterInventory other){ LetterInventory temp = new LetterInventory(); temp.array.addAll(array); return temp; } public String toString(){ String result = "["; for(int i = 0;i&lt;=size-1;i++){ int temp = array.get(i); result += (char)temp; } return result += "]"; } } and my Client code import java.util.*; public class Practice { public static void main (String[] args){ LetterInventory l1 = new LetterInventory("aaa"); LetterInventory l2 = new LetterInventory("bbb"); System.out.println(l1); System.out.println(l2); LetterInventory sum = l1.add(l2); System.out.println(sum); } } And the output is always [ ] no matter what i do. I despretly need help on this. As i've spent the vast majority of this day trying to fix this issue.
has comment: http://stackoverflow.com/comment/32935921
has answer: http://stackoverflow.com/a/21771217
answer count: 4
has answer: http://stackoverflow.com/a/21771156
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32936099
has comment: http://stackoverflow.com/comment/32935887
has answer: http://stackoverflow.com/a/21771148
tagged with: java

http://stackoverflow.com/a/21728063
has body: Like you said, Queue is an interface, an Abstract Data Type, it specifies operations and their semantics (namely, FIFO discipline). LinkedList is a class provided by the Java.util library, meaning it implements the methods of all interfaces it declares to... implement. The fact that it's name is "Linkedlist" means that it uses a... LinkedList (nodes containing the elements allocated in the heap with pointers from a node to the next one). It's an ordered data structure. If you declare a Queue (left-hand, interface) and instantiate it with a LinkedList (right-hand, class), you'll only have the Queue operations, not the List methods.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21727873
upvote count: 1
has comment: http://stackoverflow.com/comment/32858725
has comment: http://stackoverflow.com/comment/32864961
score: 1

http://stackoverflow.com/a/21804616
type: Answer
has body: The problem is that when foo() returns the list, you don't know what the list has in it. Let's say for example that foo() returns a list of StringBuilder. But now, bar() tries to add Strings to it. You broke the type-safety of this list. If the list doesn't change in bar() I suggest changing bar to accept List&lt;? extends CharSequence&gt; and then you're good.
score: 2
has comment: http://stackoverflow.com/comment/32995279
has comment: http://stackoverflow.com/comment/32995459
answers question: http://stackoverflow.com/q/21804545
has comment: http://stackoverflow.com/comment/32995387
downvote count: 0
has comment: http://stackoverflow.com/comment/32995290
upvote count: 2

http://stackoverflow.com/comment/33045115
comment on: http://stackoverflow.com/q/21832879
type: Comment
type: QuestionComment
has text: Please post only parts of your code that are required for your question.
score: 1

http://stackoverflow.com/q/21786780
score: 0
has comment: http://stackoverflow.com/comment/32964110
answer count: 1
has title: How to read value from bean in applicationContext.xml?
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21790769
has comment: http://stackoverflow.com/comment/32967391
tagged with: spring
linked to: http://stackoverflow.com/q/132231
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21790769
type: Question
has body: I need to set a parameter value interface IP address in my applicationContext.xml I read this setting from properties file and I use it this manner: ${interface.ip_address} Now I need to get this value from a command line parameter. I use Apache Commons CLI parser, parse parameters and create my own bean commandLineConf from it and set it into ApplicationContext. ExternalBeanReferneceFactoryBean.setInstance("commandLineConf", conf); beanFactory.registerBeanDefinition( "commandLineConf", BeanDefinitionBuilder.rootBeanDefinition( ExternalBeanReferneceFactoryBean.class) .getBeanDefinition()); GenericApplicationContext rootAppContext = new GenericApplicationContext( beanFactory); rootAppContext.refresh(); But I don't know how to get value from this bean in applicationContext.xml. I have tried many way, e.g. but it doesn't work for me. #{commandLineConf.ipAddress} What am I doing wrong?

http://stackoverflow.com/a/21686892
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21686702
has body: When comparing not primitive data type (that is not int, double, boolean, etc.) with == you are not comparing their values, but their references. That means you are basically comparing if they point to the same block of memory. To compare the values of these objects you need to override the method equals in their class. You can see in your example code that String also uses equals, not ==, because String is also not primitive type.

http://stackoverflow.com/comment/32864076
comment on: http://stackoverflow.com/q/21731032
score: 0
has text: @MarkoTopolnik thnx, ingore the first part of my comment :)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32932308
has text: I agree with @SotiriosDelimanolis the question title and the explanation in itself do not actually reflect what you wish to achieve ?
comment on: http://stackoverflow.com/q/21769026
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33024751
has text: @Dinesh, it doesn't change my answer. You can use multiple panels each with a different layout manager to achieve your result.
comment on: http://stackoverflow.com/q/21817430
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33092251
type: AnswerComment
comment on: http://stackoverflow.com/a/21859469
type: Comment
has text: now, i puted System.exit(0) before return status; and it's work :)
score: 0

elevated-privileges
tags question: http://stackoverflow.com/q/21749862
type: Tag
tag name: elevated-privileges

http://stackoverflow.com/q/21712360
has answer: http://stackoverflow.com/a/21714029
tagged with: junit
accepted answer: http://stackoverflow.com/a/21714349
has body: What I am trying to do is to test some Lucene code I wrote and would like some information on best practices when using JUnit for testing. Lucene, BTW, is a search engine which you can use to create a flat file to index a bunch of data. So what I would like to test is the creation of this inverted index, then search through the index to verify that some data is present. My question is in the code: public class IndexTest { @Test public void testWriteIndexFromDB() { //run test assertTrue(something in this test); // some test for this method // Is using a function like so a proper way of writing a test? checkSomeDataIsReturned(); } @Test public void testWriteIndexFromExcelFile() { //run test assertTrue(something in this test); // some test for this method // Is using a function like so a proper way of writing a test? checkSomeDataIsReturned(); } @Test public void testRefreshIndexWithNewData() { //run test assertTrue(something in this test); // some test for this method // Is using a function like so a proper way of writing a test? checkSomeDataIsReturned(); } // this function checks that data is returned after writing an index public void checkSomeDataIsReturned(){ // not a test but does a check anyways results = myIndex.searchForStuff(some input); assertTrue(results.length &gt; 0); // if length is zero, there is no data and something went wrong } } To summarize, I have three options to write an index, I am testing that each of them writes. Is the re-usable function that is not a test the proper way to write a test? Or is there a better practice?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21714349
type: Question
has title: JUnit - testing with re-usable functions; validity
answer count: 2
possible better answer: http://stackoverflow.com/a/21714029
score: 0

http://stackoverflow.com/q/21755663
tagged with: spring-mvc
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/21760401
type: Question
type: AnsweredQuestion
score: 3
has title: Want to add New Bean in jhipster
tagged with: jhipster
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21760401
tagged with: spring
has body: i am working on fileupload(Jquery file upload).i want to add a new bean for accept multiple request i.e &lt;bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver" id="multipartResolver"&gt; &lt;property name="maxUploadSize" value="10000000" /&gt; if we using simple Spring mvc application then we hae to add in Servet-context.xml file. but in jhipster i am unable to find any .xml so please help me where we have to enter this bean for file upload. Thanks

http://stackoverflow.com/a/21694982
has body: &lt;url-pattern&gt; specifies the type of urls for which, the servlet given in servlet-name should be called.As per servlet specification SRV.11.2 for string or path in url pattern : A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used for path mapping. A string beginning with a ‘*.’ prefix is used as an extension mapping. A string containing only the ‘/’ character indicates the “default” servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null. All other strings are used for exact matches only. Reference : How to configure Servlet.
answers question: http://stackoverflow.com/q/21694457
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/32887210
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21743599
score: 2
has text: I mean just that. When a user is logged in, rather the "hiding" or "showing" menu items, you would rebuild the entire `JMenu` from scratch, only adding those menu items that the current user can actually use...

http://stackoverflow.com/comment/32809792
score: 0
comment on: http://stackoverflow.com/q/21700655
type: Comment
type: QuestionComment
has text: Do you need a [precondition](https://code.google.com/p/guava-libraries/wiki/PreconditionsExplained) or [predicate](https://code.google.com/p/guava-libraries/wiki/FunctionalExplained#Predicates)? Both are different.

floating-point
tags question: http://stackoverflow.com/q/21726932
tags question: http://stackoverflow.com/q/21716188
type: Tag
tags question: http://stackoverflow.com/q/21817457
tags question: http://stackoverflow.com/q/21754462
tags question: http://stackoverflow.com/q/21749101
tag name: floating-point

http://stackoverflow.com/q/21816005
tagged with: java
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21816321
has title: Transfer data from android to java desktop application
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: asyncsocket
tagged with: sockets
tagged with: android
has body: I run an application in Android and a string value as an answer. Now I want to pass this result to the Java server which is on my localhost, i.e pass the value from Android code to Java desktop application. I tried using this code, but when I run the client it says unfortunately the application has stopped. It says: android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145) libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84) libcore.io.IoBridge.connectErrno(IoBridge.java:127) I found from somewhere that I need to use asynctask for it. Can you please guide me on how to use asynctask here? The IP address is my localhost's IP and port number is any random number. I try to run the server and then the client. I even tried running client on emulator and on the actual device. The app closes. I am new to Android. What I am doing wrong? Here's the code of the client: package com.example.client; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; public class MainActivity extends Activity { private Socket client; private PrintWriter printwriter; private EditText textField; private Button button; private String messsage; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textField = (EditText) findViewById(R.id.editText1); //reference to the text field button = (Button) findViewById(R.id.button1); //reference to the send button //Button press event listener button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { messsage = textField.getText().toString(); //get the text message on the text field textField.setText(""); //Reset the text field to blank try { client = new Socket("10.0.2.2", 4444); //connect to server printwriter = new PrintWriter(client.getOutputStream(),true); printwriter.write(messsage); //write the message to output stream printwriter.flush(); printwriter.close(); …

http://stackoverflow.com/comment/33025674
type: Comment
comment on: http://stackoverflow.com/a/21821681
has text: @Chisx: Just to remove spaces
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32871309
has text: They aren't blocking at all. I just don't want to put asserts all over the place, it looks awful. I think I'll have to do this anyways though. Thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21718773
type: Comment

http://stackoverflow.com/a/21799404
has comment: http://stackoverflow.com/comment/32986422
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21798687
has body: The taskmanager manages the tasks by spawing multiple user threads from the main thread. The main thread is always created by default. The user threads 1-3 are run sequentially, i.e. thread-2 starts only after thread-1 completes, and so on. The user threads 4-6 start and executes concurrently. public class TaskManager { public static void main(String[] args) throws InterruptedException { RunnableTask task = new RunnableTask(); //threads 1-3 are run sequentially Thread thread1 = new Thread(task, "Thread-1"); Thread thread2 = new Thread(task, "Thread-2"); Thread thread3 = new Thread(task, "Thread-3"); thread1.start(); //invokes run() on RunnableTask thread1.join(); // main thread blocks (for 10 seconds) thread2.start(); //invokes run() on RunnableTask thread2.join(); // main thread blocks (for 10 seconds) thread3.start(); //invokes run() on RunnableTask thread3.join(); // main thread blocks (for 10 seconds) Thread thread4 = new Thread(task, "Thread-4"); Thread thread5 = new Thread(task, "Thread-5"); Thread thread6 = new Thread(task, "Thread-6"); thread4.start(); //invokes run() on RunnableTask thread5.start(); //invokes run() on RunnableTask thread6.start(); //invokes run() on RunnableTask } } Notice the times of the output. There is a 10 second difference bewteen threads 1-3. But Threads 4-6 started pretty much the same time. Thread-1 at Fri Mar 02 16:59:22 EST 2012 Thread-2 at Fri Mar 02 16:59:32 EST 2012 Thread-3 at Fri Mar 02 16:59:42 EST 2012 Thread-4 at Fri Mar 02 16:59:47 EST 2012 Thread-6 at Fri Mar 02 16:59:47 EST 2012 Thread-5 at Fri Mar 02 16:59:47 EST 2012

http://stackoverflow.com/comment/32892689
comment on: http://stackoverflow.com/q/21746576
type: QuestionComment
has text: Sorry, could you post your entire `IntDNode` class? I can't find anything wrong in what you've given so far.
score: 0
type: Comment

http://stackoverflow.com/a/21721607
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21720603
upvote count: 2
has body: Original title was a bit misleading, so my answer provides more than one way of accomplishing this task. First part reflects the answer to the new title. 11,120.6 shifted by four decimal places to the left will not create 1.12; more like 1.112 or 1.11 (depending on the number of decimal places). But anyways, here are some thoughts: DecimalFormat way: float num = 11120.6; DecimalFormat numFormat = new DecimalFormat("#.00"); System.out.println(numFormat.format(num)); If it's purely visual, you can just do something like this: float num = 11120.6; System.out.println(String.format("%.2f", num)); That one will give you two decimal places to the right of the decimal point, producing 1.11. Or how about something like this? float num = 11120.6; num /= 10000.0; This will give you 1.11206. You can create if else logic or something similar to divide/multiple by an appropriate amount, based on the number, i.e.: if (num &gt;= 10) { num /= 10.0; } else if (num &gt;= 100) { num /= 100.0; } ...etc... You can also do something like this along with the similar logic to above: BigDecimal num = new BigDecimal("11120.6"); num = num.movePointRight(-4); Unless someone can think of a better way you'll also need to know that the number before was in millions representation and the new number is in billions. Store it in a separate variable as an enumeration, perhaps. Something else you can do, but it's not very efficient, is what we did in my C++ class in college when we were messing around. You can create several arrays or lists (depending on what it is that you do) for certain number sizes. When you want to display a number of say... listBillions, you'd divide any number from that list by 1000000000.0, or format it as a string. So, in the the end you have your lists of dozens, hundreds, thousands, etc., and you'll always know that listBillions[i] can be nothing but a billion in whatever form it is being displayed.
type: Answer
has comment: http://stackoverflow.com/comment/32871005
has comment: http://stackoverflow.com/comment/32853711

http://stackoverflow.com/comment/33073363
has text: If you don't require `myVar` it is better to remove it. But that's not the issue here I guess.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21846588

http://stackoverflow.com/a/21815232
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21815162
upvote count: 1
answers question: http://stackoverflow.com/q/21815162
score: 1
has body: You need to make a custom ViewGroup rather than a custom view if you want it to contain another view. Typically if you do this you extend either RelativeLayout or LinearLayout, so all of the laying out code is written and you would set the appropriate type of LayoutParams. You also have to add the ImageView to the custom ViewGroup via addView
type: AcceptedAnswer

http://stackoverflow.com/comment/32860363
comment on: http://stackoverflow.com/q/21729134
score: 1
has text: @ChristopheRoussy lol. I wrote that tag wiki, should have remembered and linked to it instead of doing an answer. :D
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21702939
has comment: http://stackoverflow.com/comment/32814351
has answer: http://stackoverflow.com/a/21722190
upvote count: 21
has comment: http://stackoverflow.com/comment/32818240
has comment: http://stackoverflow.com/comment/32817009
has comment: http://stackoverflow.com/comment/32817924
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32818864
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32813982
tagged with: microbenchmark
has comment: http://stackoverflow.com/comment/32831658
has comment: http://stackoverflow.com/comment/32828110
has comment: http://stackoverflow.com/comment/32819441
tagged with: java
has comment: http://stackoverflow.com/comment/32832784
has comment: http://stackoverflow.com/comment/32815341
has comment: http://stackoverflow.com/comment/32828825
has comment: http://stackoverflow.com/comment/32814148
has comment: http://stackoverflow.com/comment/32813824
has comment: http://stackoverflow.com/comment/32825882
linked to: http://stackoverflow.com/q/21738690
has comment: http://stackoverflow.com/comment/32837904
has comment: http://stackoverflow.com/comment/32815546
has answer: http://stackoverflow.com/a/21708836
has title: Why the bounds check doesn't get eliminated?
answer count: 3
has comment: http://stackoverflow.com/comment/32814265
tagged with: bounds-check-elimination
has comment: http://stackoverflow.com/comment/32837254
has comment: http://stackoverflow.com/comment/32823788
favorite count: 0
tagged with: optimization
has comment: http://stackoverflow.com/comment/32819490
has comment: http://stackoverflow.com/comment/32831837
has comment: http://stackoverflow.com/comment/32815895
has comment: http://stackoverflow.com/comment/32818156
possible better answer: http://stackoverflow.com/a/21723493
has comment: http://stackoverflow.com/comment/32819260
has comment: http://stackoverflow.com/comment/32814679
has comment: http://stackoverflow.com/comment/32831735
has answer: http://stackoverflow.com/a/21723493
has comment: http://stackoverflow.com/comment/32828548
accepted answer: http://stackoverflow.com/a/21708836
has comment: http://stackoverflow.com/comment/32829145
has comment: http://stackoverflow.com/comment/32818961
has comment: http://stackoverflow.com/comment/32844461
has comment: http://stackoverflow.com/comment/32825282
has body: I wrote a simple benchmark in order to find out if bounds check can be eliminated when the array gets computed via bitwise and. This is basically what nearly all hash tables do: They compute h & (table.length - 1) as an index into the table, where h is the hashCode or a derived value. The results shows that the bounds check don't get eliminated. The idea of my benchmark is pretty simple: Compute two values i and j, where both are guaranteed to be valid array indexes. i is the loop counter. When it gets used as array index, the bounds check gets eliminated. j gets computed as x & (table.length - 1), where x is some value changing on each iteration. When it gets used as array index, the bounds check does not get eliminated. The relevant part is as follows: for (int i=0; i<=table.length-1; ++i) { x += result; final int j = x & (table.length-1); result ^= i + table[j]; } The other experiment uses result ^= table[i] + j; instead. The difference in timing is maybe 15% (pretty consistently across different variants I've tried). My questions: Are there other possible reasons for this besides bound check elimination? Is there some complicated reason I can't see why there's no bound check elimination for j? A summary of the answers MarkoTopolnik's answer shows that it's all more complicated and the elimination of the bounds checks is not guaranteed to be a win, especially on his computer the "normal" code is slower than "masked". I guess this is because of it allowing some additional optimization which shows to be actually detrimental in this case (given the complexity of the current CPUs, the compiler hardly even knows for sure). leventov's answer shows clearly that the array bounds check gets done in "masked" and that it's elimination makes the code as fast as "normal". Donal Fellows points to the fact, that the masking doesn't work for a zero-length table, as x & (0-1) equals to x. So the best thing the compiler can do is to replace the bound check by a zero-length check. …
score: 20
has comment: http://stackoverflow.com/comment/32814088

http://stackoverflow.com/q/21736162
answer count: 1
score: 0
tagged with: android
type: UnansweredQuestion
has title: I dont know how put admob in my android game
has answer: http://stackoverflow.com/a/21743411
tagged with: java
tagged with: admob
type: Question
has body: Hello, i have a mainView. my MainActivity.java package net.canarolab.puzzleroad; import android.app.Activity; import android.content.Intent; import android.media.AudioManager; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; import android.widget.LinearLayout; import android.widget.Toast; import com.google.ads.AdRequest; import com.google.ads.AdSize; import com.google.ads.AdView; public class MainActivity extends Activity { private AdView adView; private MainView mainView; private final int MENU_SELECT_RESET = 1, MENU_SELECT_CONTACT = 2; // MUSICA MediaPlayer mediaPlayer;// para musica de fondo (se declara aqui para que // pueda // utilizarla todos nuestros metodos) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // MUSIC mediaPlayer = MediaPlayer.create(this, R.raw.merry); mediaPlayer.setLooping(true); mediaPlayer.setVolume(100, 100); mediaPlayer.start(); // Apago la barra de título requestWindowFeature(Window.FEATURE_NO_TITLE); // Apago la barra de estado getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); Intent i = getIntent(); // Activity Quiero solo tapa i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); setVolumeControlStream(AudioManager.STREAM_MUSIC); // View Establezca el mainView = new MainView(this); setContentView(mainView); setContentView(R.layout.activity_main); LinearLayout layout = (LinearLayout) findViewById(R.id.linearLayout); // Create the adView // Please replace MY_BANNER_UNIT_ID with your AdMob Publisher ID AdView adView = new AdView(this, AdSize.BANNER, "a14e2f8fe3af5a6"); // Add the adView to it layout.addView(adView); // Initiate a generic request to load it with an ad AdRequest request = new AdRequest(); request.setTesting(true); adView.loadAd(request); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the me…
has comment: http://stackoverflow.com/comment/32873643
tagged with: layout

http://stackoverflow.com/q/21827708
answer count: 4
has body: I wrote an application for using a sftp-client. In the main method, I am calling a method which downloads a file from a sftp server. When the file is downloaded, the program is still running. How can I stop it? public static void main(String[] args) { downloadFile(); }
has answer: http://stackoverflow.com/a/22230544
tagged with: java
has answer: http://stackoverflow.com/a/21828083
type: Question
has comment: http://stackoverflow.com/comment/33036151
has comment: http://stackoverflow.com/comment/33035921
score: 0
has answer: http://stackoverflow.com/a/21859469
has title: Java program is still running. How to stop?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21827732

http://stackoverflow.com/comment/69088732
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21772864
has text: Any idea how to add the custom Work Manager please ?

http://stackoverflow.com/a/21767908
score: 1
has comment: http://stackoverflow.com/comment/32930205
has comment: http://stackoverflow.com/comment/32930504
has body: Use a variable to lock the call of getXY() Declare a new variable Boolean callGetXY = true; Set it to false on ACTION_DOWN and back to true on ACTION_UP View.OnTouchListener flTouch = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // your current content of the method here // ... if (event.getAction() == MotionEvent.ACTION_DOWN) { callGetXY = false; } if (event.getAction() == MotionEvent.ACTION_UP) { callGetXY = true; } } }; Change line 82 to: if (callGetXY) { getXY() }
accepted answer of: http://stackoverflow.com/q/21767103
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32930285
type: Answer
has comment: http://stackoverflow.com/comment/32930666
has comment: http://stackoverflow.com/comment/32975680
upvote count: 1
answers question: http://stackoverflow.com/q/21767103

http://stackoverflow.com/comment/32825846
score: 0
type: Comment
type: QuestionComment
has text: You can create a for look that goes through every index in the row and adds the amount in that index to a running sum.
comment on: http://stackoverflow.com/q/21708330

http://stackoverflow.com/comment/32952931
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21781002
has text: have you tried to google it?

http://stackoverflow.com/a/21834228
downvote count: 0
type: Answer
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/21833854
answers question: http://stackoverflow.com/q/21833854
has body: You might prefer to simplify: List&lt;File&gt; fileList = new ArrayList&lt;&gt;(); List&lt;File&gt; dirList = new ArrayList&lt;&gt;(); while (count &lt; allDocs.length){ if (allDocs[count].isDirectory()){ dirList.add(allDocs[count]); System.out.println("Document " + allDocs[count].getPath() + " sorted into -Directory- array at position " + dirCount); dirCount++; } else{ fileList.add[allDocs[count]); System.out.println("Document " + allDocs[count].getPath() + " sorted into -File- array at position " + fileCount); fileCount++; } count++; } dirs = dirist.toArray(new File[dirList.size()]); dirCount = dirs.length; files = fileList.toArray(new File[fileList.size()]); fileCount = files.length; Using a List&lt;File&gt; instead of File[] seems appropiate, as you do not know the array sizes in advance, and you need: File[] files = new File[n]; if intending to fill in a File: files[fileCount] = ...
type: AcceptedAnswer

http://stackoverflow.com/comment/32769985
comment on: http://stackoverflow.com/q/21678327
type: QuestionComment
has text: not guaranty to call `onStop` method , use `onPause` instead of that
type: Comment
score: 2

http://stackoverflow.com/a/21789352
answers question: http://stackoverflow.com/q/21789090
type: Answer
has body: here is a skeleton ant build with 2 targets. Init simple echoes to the console your class paths (used to debug). The "make-war" task build the actual war archive.You will need to change the locations to match your setup. <property environment="env" /> <property name="build_type" value= "${env.build_type}"/> <property name="version" value="${env.version}"/> <property name="src.dir" value="${basedir}/source"/> <property name="build.classes.dir" value="${basedir}/classes"/> <property name="project.name" value="myproject"/> <delete file="${build.classes.dir}/war/${project.name}.war"/> <webinf dir="${src.dir}/WEB-INF" /> <include name="*.html" /> <include name="/my/package/*.*"/> <include name="some-lib.jar"/> <echo message="Using Source directory=${src.dir}" /> <echo message="Using Build-Classes directory=${build.classes.dir}" /> <echo message="Build Type=${build_type}" /> <echo message="Build Version =${version}" /> I am assuming you have already compiled you classes. You simply want to generate the war archive. I included the html and lib elements as a reference. You can always comment them out. Hope that helps :) UPDATE: I added to COMMAND LINE VARIABLES. You save the above in a file called build.xml. You run the file with the following command line: $> ant -Denv.build_type=PROD -Denv.version=2.01 That sets your build type to "PROD" and version to "2.01". That demonstrated how to use command line arguments in an ANT BUILD FILE (per your elaboration). For someone to incorporate, the command line processing and the "war" target, they need access to your specific build file, build requirements, environment etc. While it is true that the term "PRODUCTION" is common. What "PRODUCTION" means varies from project to project, etc. Thus,all someone can do is show you how to create a ANT script which accepts arguments. Hope that helps.
has comment: http://stackoverflow.com/comment/33195078
has comment: http://stackoverflow.com/comment/33191661
score: 0
has comment: http://stackoverflow.com/comment/33164491
accepted answer of: http://stackoverflow.com/q/21789090
type: AcceptedAnswer

http://stackoverflow.com/comment/33018448
comment on: http://stackoverflow.com/q/21817581
has text: possible duplicate [Android: Alternative to the deprecated Context.MODE_WORLD_READABLE?](http://stackoverflow.com/questions/13856757/android-alternative-to-the-deprecated-context-mode-world-readable)
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/33009015
has text: yes sir . like lst.setBounds(10,10,150,20); you have suggestion what do i need to do . another layout sir ?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21812276

http://stackoverflow.com/a/21693397
score: 1
has body: Basically in that loop the index i starts from 0 and increments by 1 per iteration, while j starts from the last array element and decrements by 1 per iteration. The i &lt; length / 2 condition ensures i only go as far as middle of the array (this is integer divison so odd numbers don't matter (eg: 5/2 == 2)) int temp = array[i]; saves the value of array at index i in a temporary variable, and array[i] = array[j] overwrites the value at i with the value at j. Finally array[j] = temp recover the temporary variable and place it at j.
upvote count: 1
has comment: http://stackoverflow.com/comment/32821213
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21693315
has comment: http://stackoverflow.com/comment/32833729

http://stackoverflow.com/comment/34535459
has text: Heh. We have some active users now, I think we can roll a release within the next week or two.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21785110
type: Comment

http://stackoverflow.com/q/21824922
linked to: http://stackoverflow.com/q/1069992
tagged with: transactions
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/33031504
has answer: http://stackoverflow.com/a/21825975
tagged with: jpa
has comment: http://stackoverflow.com/comment/33031809
score: 0
accepted answer: http://stackoverflow.com/a/21825975
answer count: 1
has title: JPA not persisting entity
has comment: http://stackoverflow.com/comment/33031725
has comment: http://stackoverflow.com/comment/33031464
type: AnsweredQuestion
has body: I am trying to save to database changes made to a detached entity. The object of the entity is passed to the function by argument (named as data): private boolean generate(CommonGameData data) { boolean result = true; EntityManager em = HibernateUtil.currentEntityManager(); try { em.getTransaction().begin(); em.merge(data); em.flush(); ...some changes to data object... em.persist(data); em.flush(); em.getTransaction().commit(); } catch (Exception ex) { ... return false; } return true; } As I have read if I am using the detached entity, I should call merge first. But after commit is done successfully, I don't see any changes in database. Where is the mistake?
has comment: http://stackoverflow.com/comment/33031500

http://stackoverflow.com/comment/32846018
comment on: http://stackoverflow.com/a/21720563
type: AnswerComment
score: 0
has text: it was the `set visible` thing... Could you edit your answer to reflect that?
type: Comment

http://stackoverflow.com/comment/32840105
has text: Sorry I didn't provide enough information about my application. My application is a web server and the thread pool is used to respond to web requests. Let's talk it more specificly. If I want to develop a web server which processes 2000 requests per second, what is the appropriate number of threads in the pool? Can I figure it out theoretically, or do I have to get the number by experiments?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21699592

http://stackoverflow.com/a/21828636
accepted answer of: http://stackoverflow.com/q/21828466
answers question: http://stackoverflow.com/q/21828466
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You can use word boundaries (\\b) to add the constraints you want. This will only match the number if it is immediately after a boundary, and if it is followed by nothing but letters (if anything) before the next word boundary. Note that it uses a dedicated group to catch the number: Pattern p = Pattern.compile("\\b([0-9]+)[a-zA-Z]*\\b"); Matcher m = p.matcher("5N7BS is having a number 33 and 55c"); while (m.find()) { System.out.println(m.group(1)); }
score: 2
upvote count: 2

http://stackoverflow.com/comment/32935392
comment on: http://stackoverflow.com/q/21770137
has text: The signed range for `long` in Java and `BIGINT` in MySQL are both -2^63 to 2^63 - 1. Your issue is on the MySQL side of things, hence the `MySQLDataException`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/78886661
has text: Just add the following line <wls:work-manager><wls:name>CalculatorWorkManager</wls:name></wls:work-manager> to your EJB description (inside the wls:weblogic-enterprise-bean element) in the weblogic-ejb-jar.xml file.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21772864

http://stackoverflow.com/a/21839084
downvote count: 0
has body: These lines for(iCount=0; iCount&lt;52; iCount++) { Card c = new Card(iCount); } don't have much effect. You're not storing the new Card object anywhere, so it will get thrown away by the garbage collection process. They should probably say something line this. for(iCount=0; iCount&lt;52; iCount++) { deck[iCount] = new Card(iCount); }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21838971

http://stackoverflow.com/comment/32792764
type: Comment
type: QuestionComment
has text: that doesnt even look correct. its not handing hex values properly. thats probably why everything is dark
score: 1
comment on: http://stackoverflow.com/q/21689956

http://stackoverflow.com/comment/32880220
comment on: http://stackoverflow.com/a/21713106
type: AnswerComment
has text: Just to follow up, I added a view resolver, moved my JSPs to /WEB-INF/jsp/, created a LoginController, IndexController, and AdminController, autowired my service into the controller... everything is working great! Thanks for the help!
score: 0
type: Comment

http://stackoverflow.com/a/21734168
has comment: http://stackoverflow.com/comment/32870354
has comment: http://stackoverflow.com/comment/32870190
answers question: http://stackoverflow.com/q/21733963
has body: while ( choice != -1 ) { System.out.println( "Enter a homework grade. Press -1 when finished" ); homework = dylan.nextInt(); } This loop will never exit, because the user's entry is put into homework, but you're testing choice in the while loop. The fix: while ( homework != -1 ) { System.out.println( "Enter a homework grade. Press -1 when finished" ); homework = dylan.nextInt(); } Also note that, as stated by @Jack and others, homework (which should really be named something like iTotalGrades) should be accumulating the input, not just overwriting with the next value. It also should not add the -1 (thanks again to @Jack), which is not a grade at all. Meaning this is my recommendation: while (iInput != -1 ) { System.out.println( "Enter a homework grade. Press -1 when finished" ); iInput = dylan.nextInt(); if(iInput != -1) iTotalGrades += iInput; } } There are other problems, as noted by others, but these two are big ones.
has comment: http://stackoverflow.com/comment/32870351
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32869825
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21733963

http://stackoverflow.com/q/21718736
has comment: http://stackoverflow.com/comment/32843829
answer count: 1
has comment: http://stackoverflow.com/comment/32843709
tagged with: serversocket
has comment: http://stackoverflow.com/comment/32861395
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/21719771
tagged with: java
has body: I am having problem reading image bytes in java socket. My iOS client is sending an image here, and it needs to read the total bytes and store that as image on the server end. It works very fine, when i tested through iOS simulator. Because, If I test in simulator, it sends the image upto 46,577 bytes. It reads all very quickly and properly. If I test the same code sending image from an iPhone device, its also sending around "45, 301 bytes", but socket code is able to read only some "21, 720 bytes", so only half of the image is coming, (or) sometimes it reads very less around "4,000 bytes" only. I couldn't understand why it is not able to read the same size data coming from device only? Could someone please guide me on this to solve? InputStream input = socket.getInputStream(); byte[] data = new byte[0]; byte[] buffer = new byte[1024]; try { do { bytesRead = input.read(buffer); System.out.println("Reading..bytesRead: " + bytesRead); // construct an array large enough to hold the data we currently have byte[] newData = new byte[data.length + bytesRead]; // copy data that was previously read into newData System.arraycopy(data, 0, newData, 0, data.length); // append new data from buffer into newData System.arraycopy(buffer, 0, newData, data.length, bytesRead); // set data equal to newData in prep for next block of data data = newData; } while (input.available() != 0); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("data: " + data.length);
has comment: http://stackoverflow.com/comment/32842966
has comment: http://stackoverflow.com/comment/32857370
type: Question
has comment: http://stackoverflow.com/comment/32843376
has comment: http://stackoverflow.com/comment/32843610
has comment: http://stackoverflow.com/comment/32843627
has title: Unable to read all bytes using InputStream read API?
score: 0

http://stackoverflow.com/comment/33016287
type: Comment
type: QuestionComment
has text: Could you give an example of an input that returns an error? I compiled it and it works fine.
score: 0
comment on: http://stackoverflow.com/q/21816246

http://stackoverflow.com/a/21859590
type: Answer
has body: This is now discussed and tracked in the Spring Framework https://jira.springsource.org/browse/SPR-11438.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21802969
downvote count: 0

http://stackoverflow.com/comment/32960520
type: QuestionComment
comment on: http://stackoverflow.com/q/21785140
has text: The UUID is unique, but that is irrelevant. What matters here is the ID of the Post and User entities. If they were globally unique, you could have a base abstract entity (CodeTarget), and two sub-entities (Post and User). But then you could not have a Post having the same ID as a User, since their ID would have to uniquely identify a CodeTarget.
score: 0
type: Comment

http://stackoverflow.com/q/21706812
type: Question
has comment: http://stackoverflow.com/comment/32821409
has body: I use annotations to indicate hibernate that class entity.Item is entity. But seems Hibernate ignore my annotations. Question: What I'm doing wrong? hibernate.cfg.xml: <hibernate-configuration> org.hibernate.dialect.PostgreSQLDialect org.postgresql.Driver postgres Volodumur6894834 jdbc:postgresql://localhost:5432/UParserDB thread 1 create true <mapping package="entity"/> </hibernate-configuration> Item: package entity; @Entity @Table(name = "Item") public class Item { //.. } Stacktrace: Feb 11, 2014 5:57:38 PM org.hibernate.annotations.common.Version <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final} Feb 11, 2014 5:57:38 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.2.1.Final} Feb 11, 2014 5:57:38 PM org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found Feb 11, 2014 5:57:38 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist Feb 11, 2014 5:57:38 PM org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml Feb 11, 2014 5:57:38 PM org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml Feb 11, 2014 5:57:38 PM org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null Feb 11, 2014 5:57:38 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!) Feb 11, 2014 5:57:38 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000115: Hibernate connection pool size: 20 Feb 11, 2014 5:57:38 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000006: Autocommit mode: false Feb 11, 2014 5:57:38 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl c…
has title: Hibernate: org.hibernate.MappingException: Unknown entity: entity.Item
upvote count: 1
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/1413190
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21707297
accepted answer: http://stackoverflow.com/a/21707297
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32821068

http://stackoverflow.com/a/21721262
type: Answer
has comment: http://stackoverflow.com/comment/32846910
has comment: http://stackoverflow.com/comment/32846721
has comment: http://stackoverflow.com/comment/32846882
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32846971
has comment: http://stackoverflow.com/comment/32846756
has comment: http://stackoverflow.com/comment/32846942
has comment: http://stackoverflow.com/comment/32846859
has comment: http://stackoverflow.com/comment/32847193
score: 0
has comment: http://stackoverflow.com/comment/32846847
has comment: http://stackoverflow.com/comment/32847149
answers question: http://stackoverflow.com/q/21721242
has comment: http://stackoverflow.com/comment/32846736
has comment: http://stackoverflow.com/comment/32847183
has comment: http://stackoverflow.com/comment/32846794
has body: You need to have at least one of them as double. You're typecasting the result of the division as double instead. This piece of code will make it: double result = ((double)someValue)/((double)3600); Just in case some people don't trust about code above, refer to this example. Another solution will be using 3600.0 instead: double result = someValue/3600.0;
has comment: http://stackoverflow.com/comment/32846861
has comment: http://stackoverflow.com/comment/32847139
has comment: http://stackoverflow.com/comment/32847086
has comment: http://stackoverflow.com/comment/32846776

http://stackoverflow.com/comment/32834000
type: Comment
type: QuestionComment
has text: @rvillablanca: I don't think your question #2 is answerable. The people who wrote the code had more than one way to write the constants, I think. Asking this question is trying to read their minds. It's just a style preference, I guess.
comment on: http://stackoverflow.com/q/21713466
score: 0

http://stackoverflow.com/comment/32857161
type: Comment
comment on: http://stackoverflow.com/a/21727553
score: 0
type: AnswerComment
has text: it is working but instead of particular tag i want general solution. in place of <ignoreTag> any tag will come.

http://stackoverflow.com/q/21799367
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/21799412
tagged with: return
downvote count: 2
has body: I have a for loop that returns values from an array. public static String getPieces(){ for(int y=0; y&lt;=7; y++) for(int x=0; x&lt;=7; x++) return piece[x][y]; } There is a return statement clearly in the method that will return every time it is called. Why does it say missing return statement?
has comment: http://stackoverflow.com/comment/32985624
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21800057
has comment: http://stackoverflow.com/comment/32985607
has answer: http://stackoverflow.com/a/21800057
tagged with: java
has answer: http://stackoverflow.com/a/21799417
tagged with: methods
has comment: http://stackoverflow.com/comment/32985588
type: Question
upvote count: 4
tagged with: for-loop
accepted answer: http://stackoverflow.com/a/21799417
tagged with: arrays
has comment: http://stackoverflow.com/comment/32985622
has title: Missing return statement in for loop

http://stackoverflow.com/comment/32918701
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21761654
type: QuestionComment
has text: vote to put on hold: unclear what you're asking. Please clarify what you mean by 'how should this be done properly?' by telling us whether or not you actually want the method to be overridable.

http://stackoverflow.com/q/21836473
tagged with: uml
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/21836614
score: 0
answer count: 3
has body: I have a class called "EventManager" and one called "Event". From Eventmanager I can created and store events in a linkedlisted, which then is stored in a hashmap together with "persons" who attend these events. Now, which relationship(UML) between Event and Eventmanager?
has title: What UML relation should I use between these two classes?
tagged with: class-diagram
has answer: http://stackoverflow.com/a/22067298
possible better answer: http://stackoverflow.com/a/22010905
has answer: http://stackoverflow.com/a/21836614
has answer: http://stackoverflow.com/a/22010905
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21746530
has title: Android App: webview to display a restricted (to my domain) Google Sites Page
score: 0
tagged with: android
tagged with: google-sites
has body: I am developing an application that only displays my domains internal Google Sites Page. This page will not do anything further but display the content. I am able to load www.google.com but when I try to access my Google sites page, I am just seeing a blank white page. I am pretty sure this is due to my permissions issue and needing to pull the account information for an SSO (Single Sign On) type access that pulls the account information from the phone. I've added in the manifest file the permissions to access the user account but cannot find any accurate code examples to make this work. Please help! Here's my code: package com.example.site; import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.webkit.WebView; public class MainActivity extends Activity { @SuppressLint("SetJavaScriptEnabled") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView webView = new WebView(this); webView.setWebViewClient(new NoLinkWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); setContentView(webView); webView.loadUrl("https://mysitespage");//this is not my real one. } @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; } } Android Manifest File: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.site" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.GET_ACCOUNTS"/&gt; &lt;uses-permission android:name="android.permission.USE_CRED…
answer count: 0
type: UnansweredQuestion
tagged with: webview
tagged with: java
has comment: http://stackoverflow.com/comment/32894401
type: Question
has comment: http://stackoverflow.com/comment/32893859

http://stackoverflow.com/comment/32956759
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21782789
type: QuestionComment
has text: Yep I know the code looks rough and it doesn't follow the variable conventions (wanted to keep the variables the same as they are in the database). It's difficult with indentation as i'm doing this in notepad. Oh and it's the first time i've used this sort of coding so it wont run perfectly but as it's now being used for any useful purpose then I don't think it matters so much. Care to share where I could enhance it?

http://stackoverflow.com/comment/32877171
type: QuestionComment
comment on: http://stackoverflow.com/q/21737726
score: 0
type: Comment
has text: @Ed Staub from 1 to a few 100,000

http://stackoverflow.com/comment/32844438
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21719878
type: Comment
has text: what is com.example.R.layout.tabs ??? why not R.layout.tabs///

http://stackoverflow.com/comment/32843621
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis I am not very fluent with spring? what you wanted to ask?
comment on: http://stackoverflow.com/q/21719208
score: 0

http://stackoverflow.com/q/21796893
answer count: 2
has title: Error in progress bar
accepted answer: http://stackoverflow.com/a/21796931
tagged with: java
tagged with: eclipse
type: AnsweredQuestion
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21796931
possible better answer: http://stackoverflow.com/a/21797013
has body: i have an error in a progress bar. This is a code: public class BluetoothChat extends Activity { // Debugging private static final String TAG = "BluetoothChat"; private static final boolean D = true; private int progressStatus = 0; private Handler handler = new Handler(); // Message types sent from the BluetoothChatService Handler public static final int MESSAGE_STATE_CHANGE = 1; public static final int MESSAGE_READ = 2; public static final int MESSAGE_WRITE = 3; public static final int MESSAGE_DEVICE_NAME = 4; public static final int MESSAGE_TOAST = 5; // Key names received from the BluetoothChatService Handler public static final String DEVICE_NAME = "device_name"; public static final String TOAST = "toast"; // Intent request codes private static final int REQUEST_CONNECT_DEVICE_SECURE = 1; private static final int REQUEST_CONNECT_DEVICE_INSECURE = 2; private static final int REQUEST_ENABLE_BT = 3; // Layout Views private ListView mConversationView; private EditText mOutEditText; private Button mSendButton; private Button mvc; // Name of the connected device private String mConnectedDeviceName = null; // Array adapter for the conversation thread private ArrayAdapter&lt;String&gt; mConversationArrayAdapter; // String buffer for outgoing messages private StringBuffer mOutStringBuffer; // Local Bluetooth adapter private BluetoothAdapter mBluetoothAdapter = null; // Member object for the chat services private BluetoothChatService mChatService = null; private ProgressBar progressBar; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mvc = (Button) findViewById(R.id.button1); mvc.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub new Thread(new Runnable() { public void run() { while (progressStatus &lt; 1000) { Random r = new Random(); int i1 = r.nextInt(1000); if (i1 &gt; progressStatus){ progressStatus = i1; } else { progressStatus = progressStatus; } …
has answer: http://stackoverflow.com/a/21797013
score: 0

http://stackoverflow.com/q/21835974
tagged with: java
has body: As every Android developer knows, everytime you create a custom Fragment you are not suppose to use it's constructor, as the documentation says. So the way to do this is more like the following: public static BlankFragment newInstance(String param1, String param2) { BlankFragment fragment = new BlankFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } public BlankFragment() { // Required empty public constructor } Is there any particular reason for Fragment to be instantiated through factory method?
has comment: http://stackoverflow.com/comment/33050659
type: Question
has title: Why is Fragment instantiated through factory method?
has answer: http://stackoverflow.com/a/21836204
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21836204
tagged with: android
type: AnsweredQuestion
tagged with: android-fragments

css
tags question: http://stackoverflow.com/q/21808896
tags question: http://stackoverflow.com/q/21721785
tags question: http://stackoverflow.com/q/21740259
tags question: http://stackoverflow.com/q/21791498
tags question: http://stackoverflow.com/q/21713280
type: Tag
tags question: http://stackoverflow.com/q/21762591
tags question: http://stackoverflow.com/q/21830404
tag name: css
tags question: http://stackoverflow.com/q/21758400

http://stackoverflow.com/q/21714188
favorite count: 0
has body: Client : public class FileClient { static int Min = 1050; static int Max = 15000; static int PORT = Min + (int)(Math.random() * ((Max - Min) + 1)); public static void main(String[] args) throws IOException { Socket sock = new Socket("localhost", PORT); if (PORT&gt;=2000&amp;&amp;PORT&lt;=2050) { System.out.println("The rare disconnection"); sock.close(); } System.out.println("Connection Opened"); // sendfile File myFile = new File("input.txt"); byte[] mybytearray = new byte[(int) myFile.length()]; FileInputStream fis = new FileInputStream(myFile); BufferedInputStream bis = new BufferedInputStream(fis); System.out.println("Input Stream Opened"); bis.read(mybytearray, 0, mybytearray.length); OutputStream os = sock.getOutputStream(); os.write(mybytearray, 0, mybytearray.length); System.out.println("Data written to output file"); os.flush(); bis.close(); System.out.println("Input Stream Closed"); sock.close(); System.out.println("Connection Closed"); } } Server: public class FileServer { public static void main (String[] args ) throws IOException { int XPORT = FileClient.PORT; int bytesRead; ServerSocket serverSocket = new ServerSocket(XPORT); System.out.println("Listening for a client"); while(true) { Socket clientSocket = null; clientSocket = serverSocket.accept(); InputStream in = clientSocket.getInputStream(); // Writing the file to disk // Instantiating a new output stream object OutputStream output = new FileOutputStream("output.txt"); byte[] buffer = new byte[1024]; while ((bytesRead = in.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } // Closing the FileOutputStream handle output.close(); } } } Java Socket : I'm trying to generate random port numbers between a range, but connection is refused, but when I'm using a integer, it works. This is working for one value. I want the server to deny the connection for a few port numbers (Ex: 2000-2100) And want the connection to be accepted and file transfer to be completed. When using integers, my file transf…
upvote count: 2
type: UnansweredQuestion
tagged with: sockets
tagged with: port
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/21714393
type: Question
has title: Java Socket : I'm trying to generate random port numbers between a range, but connection is refused, but when I'm using a integer, it works
has comment: http://stackoverflow.com/comment/32835240
downvote count: 0
tagged with: random
answer count: 1

http://stackoverflow.com/comment/32982157
type: AnswerComment
has text: vote down ? not me, but it doesn't work... (jar and database side by side, or database in a folder 'BDD')...
type: Comment
comment on: http://stackoverflow.com/a/21795668
score: 0

http://stackoverflow.com/comment/33047439
type: AnswerComment
has text: do you have yahoo or skype? and help me a bit with teamviewer?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21833908

http://stackoverflow.com/q/21764728
score: 1
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/32969689
type: Question
has title: how to read List<Serializable> XML element
tagged with: jaxb2
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: I have below inner class in my original class which is generated by JAXB (converted xsd to java classes). I want to know how to access the value of element associated with name ="a" below java client? I tried to create java bean and replaced List with my List but when use getA() method, it gives me ClassCastException: can't cast String to MyJavaBean Object. please help me how to read below XMLElementRefs in java client code which is trying to use this class and read the XMLdata. public static class sfdsfs{ @XmlElementRefs({ @XmlElementRef(name = "a", type = JAXBElement.class, required = false), @XmlElementRef(name = "b", type = JAXBElement.class, required = false), @XmlElementRef(name = "c", type = JAXBElement.class, required = false), @XmlElementRef(name = "d", type = JAXBElement.class, required = false), @XmlElementRef(name = "e", type = JAXBElement.class, required = false), @XmlElementRef(name = "f", type = JAXBElement.class, required = false), @XmlElementRef(name = "g", type = JAXBElement.class, required = false), @XmlElementRef(name = "h", type = JAXBElement.class, required = false), @XmlElementRef(name = "i", type = JAXBElement.class, required = false), @XmlElementRef(name = "j", type = JAXBElement.class, required = false) }) @XmlMixed protected List&lt;Serializable&gt; content; @XmlAttribute(name = "name") protected String name;
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/32934027
type: QuestionComment
has text: ah, I didn't see [tag:policyfiles]. Fair enough.
comment on: http://stackoverflow.com/q/21769190
type: Comment
score: 0

http://stackoverflow.com/comment/33012633
has text: adding a string add the end would fix it ?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21814188

http://stackoverflow.com/comment/32886971
comment on: http://stackoverflow.com/a/21741971
score: 1
has text: @KevinMcInerney that's the "trick" - the benefit isn't when you declare your list1 as List vs. ArrayList inside of your own method, it's when you declare method signatures like doSomething(List) vs doSomething(ArrayList). As a side note, some IDEs have a feature where you can type up a function name + return type and if the function doesn't exist, the IDE will give you the option to auto-create it. Using List<T> vs. ArrayList<T> will produce cleaner method signature off the bat.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21700558
has body: Actually there is no functional difference. You'll come to know the difference when you want the returned list List someNewList = someInstnace.modifyMyList(list);
score: 3
type: Answer
answers question: http://stackoverflow.com/q/21700467
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/33059214
score: 0
type: Comment
type: QuestionComment
has text: so I gave it another go and yes the snippet I posted worked fine commented or not, which is strange because I only changed a few lines before posting it, regardless I've edited with the unchanged snippet which does produce the issue. its still confusing why that 1 line effects the loop speed but looking at the printed delta when commented its a steady 3.019E-6, when not commented it flickers wildly from 1.449E-5 to 8.452E-6
comment on: http://stackoverflow.com/q/21840006

http://stackoverflow.com/q/21693139
has answer: http://stackoverflow.com/a/24251993
upvote count: 31
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37128740
has title: Encountered a deprecated javax.persistence.spi.PersistenceProvider
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/44664646
answer count: 8
has comment: http://stackoverflow.com/comment/33154069
tagged with: jpa
linked to: http://stackoverflow.com/q/24520602
has comment: http://stackoverflow.com/comment/33714679
has answer: http://stackoverflow.com/a/41900645
has answer: http://stackoverflow.com/a/22103666
has answer: http://stackoverflow.com/a/31132374
has answer: http://stackoverflow.com/a/35359760
has answer: http://stackoverflow.com/a/26698752
has comment: http://stackoverflow.com/comment/34450912
favorite count: 0
score: 30
has body: when you use spring &amp; Hibernate, have you ever met a log warning that says WARN o.hibernate.ejb.HibernatePersistence - HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead. How to handle that? Thank you for any answer.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33409087
tagged with: spring
has answer: http://stackoverflow.com/a/74652686

http://stackoverflow.com/comment/32823657
has text: @Abhinav Kumar Kindly check http://stackoverflow.com/questions/1413190/hibernate-mapping-package
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21707297

http://stackoverflow.com/a/21719623
has body: You can do either way, but the best way is option 1. i.e. By storing the languages(string.xml) in a folder like values-Fr. Using this will allow android to do the handling automatically instead of you telling database which is the current locale you need.
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21719396

http://stackoverflow.com/a/21786327
type: Answer
score: 7
answers question: http://stackoverflow.com/q/21781667
accepted answer of: http://stackoverflow.com/q/21781667
upvote count: 7
has body: This an be done with a connection handshake interceptor (HttpSessionHandshakeInterceptor), quoting the documentation: The easiest way to customize the initial HTTP WebSocket handshake request is through a HandshakeInterceptor, which exposes "before" and "after" the handshake methods.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33042048

http://stackoverflow.com/q/21819964
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/22151829
tagged with: primitive-types
has answer: http://stackoverflow.com/a/21847944
has comment: http://stackoverflow.com/comment/33062047
accepted answer: http://stackoverflow.com/a/22151829
possible better answer: http://stackoverflow.com/a/21821522
has answer: http://stackoverflow.com/a/21821522
answer count: 4
has title: Java multi-thread scalability issue
score: 1
tagged with: java
tagged with: multithreading
tagged with: visitor-pattern
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33025005
has answer: http://stackoverflow.com/a/21832071
upvote count: 2
has body: more updates As is explained in the selected answer, the problem is in JVM's garbage collection algorithm. JVM uses card marking algorithm to keep track of modified references in object fields. For each reference assignment to a field, it marks an associated bit in the card to be true -- this causes a false-sharing hence blocks scaling. The details are well described in this article: https://blogs.oracle.com/dave/entry/false_sharing_induced_by_card The option -XX:+UseCondCardMark (in Java 1.7u40 and up) mitigates the problem, and makes it scale almost perfectly. updates I found out (hinted from Park Eung-ju) that assigning an object into a field variable makes the difference. If I remove the assignment, it scales perfectly. I think probably it has something to do with Java memory model -- such as, an object reference must point to a valid address before it gets visible, but I am not completely sure. Both double and Object reference (likely) have 8 bytes size on 64 bit machine, so it seems to me that assigning a double value and an Object reference should be the same in terms of synchronization. Anyone has a reasonable explanation? Here I have a weird Java multi-threading scalability problem. My code simply iterates over an array (using the visitor pattern) to compute simple floating-point operations and assign the result to another array. There is no data dependency, nor synchronization, so it should scale linearly (2x faster with 2 threads, 4x faster with 4 threads). When primitive (double) array is used, it scales very well. When object type (e.g. String) array is used, it doesn't scale at all (even though the value of the String array is not used at all...) Here's the entire source code: import java.util.ArrayList; import java.util.Arrays; import java.util.concurrent.CyclicBarrier; class Table1 { public static final int SIZE1=200000000; public static final boolean OBJ_PARAM; static { String type=System.getProperty("arg.type"); if ("double".equalsIgnoreCase(type))…
has comment: http://stackoverflow.com/comment/33062474
downvote count: 1
has comment: http://stackoverflow.com/comment/33022935
has comment: http://stackoverflow.com/comment/33022858

http://stackoverflow.com/comment/32791733
comment on: http://stackoverflow.com/q/21689665
type: Comment
type: QuestionComment
score: 0
has text: I know. Exactly what you say. I believe it works by total Luck :) . I found a workaround. I select the column as: "CONVERT(CONVERT(CONVERT(column_name USING latin1) USING binary) using utf8)" But still I need to make it work in JPA + Hibernate

http://stackoverflow.com/a/21754962
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32906397
has comment: http://stackoverflow.com/comment/32907011
accepted answer of: http://stackoverflow.com/q/21754864
has comment: http://stackoverflow.com/comment/32906769
downvote count: 0
has body: When you map an inheritance relationship into relational database, you have to decide whether each subclass has its own table or there is one single table for the whole class hierarchy where the fields of all subclasses are added up as columns.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21754864

http://stackoverflow.com/comment/32795930
type: AnswerComment
type: Comment
has text: OK just thought I would share... Thanks for the help. I had multiple problems, that I was able to sort threw due to inexperience.. (i know.. your "not going to debug my code" and provide "valuable clues") I took my main function out of my class and put it in its own class. I should have been using Double instead of Int... and netbeans was a little sensitive with the compiling. I just //commented off the line (which was identified by sheltem (thanks again). compiled. it worked... so once I fixed that line... by compiling one class at a time... and fixing my "formalities" (thanks xlm)
comment on: http://stackoverflow.com/a/21691060
score: 0

http://stackoverflow.com/comment/32848404
comment on: http://stackoverflow.com/a/21718940
score: 0
type: Comment
has text: Why does this keep getting upvoted? It doesn't address the issue. The provided solution changes nothing on its own.
type: AnswerComment

http://stackoverflow.com/q/21705769
tagged with: null-pointer
has comment: http://stackoverflow.com/comment/32819694
has answer: http://stackoverflow.com/a/21705953
has comment: http://stackoverflow.com/comment/32819178
accepted answer: http://stackoverflow.com/a/21706047
possible better answer: http://stackoverflow.com/a/21705932
has comment: http://stackoverflow.com/comment/32819456
has answer: http://stackoverflow.com/a/21705932
type: AnsweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32819283
has comment: http://stackoverflow.com/comment/32819197
favorite count: 0
type: Question
has body: In java, one may easily need to do something such as instantiate a BufferedWriter object. This could be done in the following fashion: File outFile = new File("myTestFile.txt"); BufferedWriter w = null; try { w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8")); } catch (FileNotFoundException|UnsupportedEncodingException e) { System.out.println(e.getMessage()); } w.write("Test string"); w.newLine(); Note that w is declared before the try-catch block. This is so that it is within the proper scope to use the variable after the try-catch. It is initialized with a null pointer, otherwise an IDE like netbeans will warn that the variable may have not been assigned. HOWEVER, the IDE still complains that when you reach w.write(), w could possibly have a null value. This makes perfect sense, since the try block might fail! Is there a more elegant and sensible way to do this, in ways which will not cause logical problems like what my IDE reminds me of above? I realize i can wrap EVERYTHING that w does in the try block, but this is not feasible for my task. How else could i initialize w, if there is another option? Thanks!
has comment: http://stackoverflow.com/comment/32818986
has comment: http://stackoverflow.com/comment/32819011
has answer: http://stackoverflow.com/a/21706047
upvote count: 3
tagged with: java
answer count: 3
has title: How to properly assign values to objects, where their assignment throws an exception
has comment: http://stackoverflow.com/comment/32819292
tagged with: try-catch
tagged with: instantiation
tagged with: object
has comment: http://stackoverflow.com/comment/32819470

http://stackoverflow.com/q/21722340
answer count: 1
has comment: http://stackoverflow.com/comment/32855753
has body: I am trying to check all the menu urls of a webpage by checking H1 element on the page. So when the loop runs and encounters an exception loop stops. I want the loop to continue even if it encounters a mismatch of css locator. please help here's my code List&lt;WebElement&gt; dropdown = Driver.findElementsByXPath("//ul[@class='nav']//ul//li//a"); int dropdown_count = dropdown.size(); System.out.println(dropdown_count); for (int i=0; i&lt;dropdown_count; i++) { String page = dropdown.get(i).getAttribute("href"); System.out.println(page); Thread.sleep(2000); Driver1.get(page); try { Driver1.findElement(By.cssSelector("h1")).isDisplayed(); } catch(NoSuchElementException ne) { System.out.println("error page: " + page); } { System.out.println("page heading: " + Driver1.findElement(By.cssSelector("h1")).getText()); } }
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/32890147
has comment: http://stackoverflow.com/comment/32891170
has comment: http://stackoverflow.com/comment/32848812
type: UnansweredQuestion
has title: handle exception while checking links using selenium webdriver
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/32849619
has answer: http://stackoverflow.com/a/21722433

http://stackoverflow.com/comment/32800016
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21693254
score: 0
has text: This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or [include a minimal example in the question](http://stackoverflow.com/help/mcve) itself.

http://stackoverflow.com/comment/32846631
has text: I have updated the question. I think now you can have an idea what I should do.
comment on: http://stackoverflow.com/q/21695004
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21700393
type: Answer
answers question: http://stackoverflow.com/q/21700250
downvote count: 0
score: 1
upvote count: 1
has body: From the JavaDoc String#isEmpty() Returns true if, and only if, length() is 0. So, there are no other cases where isEmpty() will return true

http://stackoverflow.com/comment/32869636
comment on: http://stackoverflow.com/q/21733963
score: 0
type: QuestionComment
type: Comment
has text: `name = dylan.next();` "I named my kid #7"

http://stackoverflow.com/a/21826961
has comment: http://stackoverflow.com/comment/33042577
type: Answer
has comment: http://stackoverflow.com/comment/33042878
upvote count: 2
has comment: http://stackoverflow.com/comment/33040396
downvote count: 1
has comment: http://stackoverflow.com/comment/33042553
score: 1
has comment: http://stackoverflow.com/comment/33040028
has comment: http://stackoverflow.com/comment/33044173
answers question: http://stackoverflow.com/q/21826773
has comment: http://stackoverflow.com/comment/33040332
has body: Try this: QInvoice invoice = QInvoice.invoice; QCompany company = QCompany.company; List&lt;Invoice&gt; list = new HibernateQuery(sessionFactory.getCurrentSession()) .from(invoice).where( new HibernateSubQuery().from(invoice, company).where( invoice.supplier.number.eq(company.number).and( company.active.eq(true))).exists()).list(invoice);
has comment: http://stackoverflow.com/comment/76658533

http://stackoverflow.com/comment/32852121
type: AnswerComment
score: 0
type: Comment
has text: The layout R.id.main , is a basic listView , and i did a custom listView.xml which is fill in AsyncTask and put in SimpleAdapter which is himself pet in setAdapter()
comment on: http://stackoverflow.com/a/21723585

http://stackoverflow.com/a/21782599
answers question: http://stackoverflow.com/q/21782520
has body: It is bascially the same as your second notation. The second line is equivalent to String s[]= new String[]{"FF","RR"}; String n = s[x]; It's just that s is anonymous in this instance.
score: 0
type: Answer

http://stackoverflow.com/q/21836669
has comment: http://stackoverflow.com/comment/33053420
tagged with: runtime
has comment: http://stackoverflow.com/comment/36166130
downvote count: 0
has comment: http://stackoverflow.com/comment/34250969
answer count: 1
favorite count: 0
tagged with: android
has body: My android app keeps crashing before restarting again automatically. When it crashes (after I press Run) the log cat is, 02-17 13:26:59.550: E/AndroidRuntime(1072): FATAL EXCEPTION: main 02-17 13:26:59.550: E/AndroidRuntime(1072): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.IllegalStateException: Unable to get package info for com.example.con4; is package not installed? 02-17 13:26:59.550: E/AndroidRuntime(1072): at android.app.LoadedApk.makeApplication(LoadedApk.java:509) 02-17 13:26:59.550: E/AndroidRuntime(1072): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4417) 02-17 13:26:59.550: E/AndroidRuntime(1072): at android.app.ActivityThread.access$1300(ActivityThread.java:141) 02-17 13:26:59.550: E/AndroidRuntime(1072): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 02-17 13:26:59.550: E/AndroidRuntime(1072): at android.os.Handler.dispatchMessage(Handler.java:99) 02-17 13:26:59.550: E/AndroidRuntime(1072): at android.os.Looper.loop(Looper.java:137) 02-17 13:26:59.550: E/AndroidRuntime(1072): at android.app.ActivityThread.main(ActivityThread.java:5103) 02-17 13:26:59.550: E/AndroidRuntime(1072): at java.lang.reflect.Method.invokeNative(Native Method) 02-17 13:26:59.550: E/AndroidRuntime(1072): at java.lang.reflect.Method.invoke(Method.java:525) 02-17 13:26:59.550: E/AndroidRuntime(1072): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 02-17 13:26:59.550: E/AndroidRuntime(1072): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 02-17 13:26:59.550: E/AndroidRuntime(1072): at dalvik.system.NativeStart.main(Native Method) 02-17 13:26:59.550: E/AndroidRuntime(1072): Caused by: java.lang.IllegalStateException: Unable to get package info for com.example.con4; is package not installed? 02-17 13:26:59.550: E/AndroidRuntime(1072): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:369) 02-17 13:26:59.550: …
type: AnsweredQuestion
score: 3
has title: android app crashes before restarting
upvote count: 3
has comment: http://stackoverflow.com/comment/33055586
tagged with: java
has answer: http://stackoverflow.com/a/23879106
accepted answer: http://stackoverflow.com/a/23879106
has comment: http://stackoverflow.com/comment/33056360
type: Question
tagged with: logcat
tagged with: crash

http://stackoverflow.com/q/21727573
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/63806680
has answer: http://stackoverflow.com/a/57895893
type: Question
answer count: 13
has answer: http://stackoverflow.com/a/73071760
has answer: http://stackoverflow.com/a/23235574
has answer: http://stackoverflow.com/a/31016456
has comment: http://stackoverflow.com/comment/118145668
has answer: http://stackoverflow.com/a/72971963
has answer: http://stackoverflow.com/a/55130094
has answer: http://stackoverflow.com/a/69296951
has answer: http://stackoverflow.com/a/76397051
has answer: http://stackoverflow.com/a/40393724
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/54064374
score: 29
has answer: http://stackoverflow.com/a/57071577
has answer: http://stackoverflow.com/a/50165770
has body: How to resolve "could not execute statement; SQL [n/a]; constraint [numbering];"? org.springframework.dao.DataIntegrityViolationException:could not execute statement; SQL [n/a]; constraint [numbering]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:643) org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:106) org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517) org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755) org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724) org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) com.sun.proxy.$Proxy132.saveListForm(null:-1) sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:333) org.springframework.data.repository.core.support.Repos…
upvote count: 31
has title: How to resolve "could not execute statement; SQL [n/a]; constraint [numbering];"?

http://stackoverflow.com/q/21754540
has comment: http://stackoverflow.com/comment/32905512
tagged with: ascii
answer count: 2
possible better answer: http://stackoverflow.com/a/21754888
has answer: http://stackoverflow.com/a/21754888
favorite count: 0
accepted answer: http://stackoverflow.com/a/21754826
tagged with: multidimensional-array
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32906084
score: 1
tagged with: java
has title: Import ascii world map in Java
has body: I need to import a as ascii map into my Java game to set the world you will be able to move around in. For example. ################### #.................# #......G........E.# #.................# #..E..............# #..........G......# #.................# #.................# ################### Where the # are walls G is gold E is exit and the . are blanks spaces to move around on. I currently have this in a .txt file. I need to create a method to import the map into a 2D char[][] array. How would this work. Whats the best way to do this. I haven't done any work with 2D arrays yet so this is new to me. Thanks, Ciaran.
tagged with: import
type: Question
has answer: http://stackoverflow.com/a/21754826
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/32905513

http://stackoverflow.com/comment/32996712
comment on: http://stackoverflow.com/a/21805404
score: 0
type: AnswerComment
type: Comment
has text: @user3314757: What's the Android equivalent of... what?

http://stackoverflow.com/a/21825975
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21824922
answers question: http://stackoverflow.com/q/21824922
type: AcceptedAnswer
downvote count: 0
has body: As you do not save a new entity (from your comment), you do not need a call to persist(). Also I do not see any reasons to make 'some changes' after calling merge(), so I called merge() after making those changes. So, try the following: em.getTransaction().begin(); ...some changes to data object... em.merge(data); em.flush(); em.getTransaction().commit(); Also very important: if you reuse the EntityManager from the a ThreadLocal variable, you should take care of things like failed past transactions (at least clear it + maybe close it). Also if the bug still persists, try recreating an entityManager.

http://stackoverflow.com/a/21732844
has comment: http://stackoverflow.com/comment/32869953
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21732453
type: Answer
accepted answer of: http://stackoverflow.com/q/21732453
downvote count: 0
score: 1
has body: I'll make a try. This will not be sufficient for all the issues: You'll need one "myFinalList" per View, not one global one. Right now, all your buttons print the contents of one and the same instance of the list. Please elaborate how your "filter" is supposed to be working. Did you expect the following output? View 1 = [1,1,1], View 2 = [2,2,2]

http://stackoverflow.com/q/21796327
has answer: http://stackoverflow.com/a/34911366
type: Question
has body: I just want to access the database in another system from current system. In that second system, i had already created a derby database which is in built in netbeans. I tried to access that database by changing the ip address instead of localhost in "jdbc:derby://localhost:1527/course". But it shows java.net.ConnectException: Error connecting to server 10.6.3.3 on port 1527 with message connection timed out. How can i resolve this.. Please help me
tagged with: derby
upvote count: 2
has title: How to access derby database in another system from current system?
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/32981151
favorite count: 0
has comment: http://stackoverflow.com/comment/32981111
has comment: http://stackoverflow.com/comment/32980559
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/a/21821358
score: 2
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21821275
downvote count: 0
has body: As I understand it, \r\n is a Windows line terminator. Instead of looking for just a single line terminator, you could look for multiples and replace them. For this you could use a regular expressiong and String#replaceAll, for example... //String text = "This is\r\na test\r\nfor some text"; String text = "This is\na test\r\nfor some text"; System.out.println(text); text = text.replaceAll("\r\n|\n", "#!"); System.out.println(text); Which outputs... This is a test for some text This is#!a test#!for some text You should also note, that not all text editors/text files have the \r\n line terminator, but Java does a pretty job of dealing with this...

http://stackoverflow.com/comment/32950365
comment on: http://stackoverflow.com/a/21779575
type: AnswerComment
score: 0
type: Comment
has text: You're absolutely right - [here is the relevant doc](http://docs.spring.io/spring/docs/3.0.5.RELEASE/reference/testing.html#testing-tx). To quote _By default, the framework will create and roll back a transaction for each test_.

http://stackoverflow.com/q/21818625
tagged with: null
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/21818678
favorite count: 0
has body: I have a criteria builder which is defined as returning a Long. If the result set is empty, the whole application fails. How do I handle this to return a set number, e.g. 1000? Long yesterday = new Long(0); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery&lt;Long&gt; q = cb.createQuery(Long.class); Root&lt;CustomerHistory&gt; hist = q.from(CustomerHistory.class); q.multiselect(hist.get("total")); Date yesterDate = new LocalDate().minusDays(1).toDateTimeAtStartOfDay().toDate(); Predicate w1 = cb.equal(hist.&lt;Date&gt;get("date"), yesterDate); Predicate w2 = cb.equal(hist.get("customer"), customer); q.where(w1,w2); yesterday = em.createQuery(q).getSingleResult(); return yesterday &lt; tot;
has comment: http://stackoverflow.com/comment/33030147
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21821012
upvote count: 1
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/21821012
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33020462
has title: Hibernate/JPA handling empty result set
accepted answer: http://stackoverflow.com/a/21818678
answer count: 2

http://stackoverflow.com/q/21767100
has title: Java interface inquiry
has comment: http://stackoverflow.com/comment/32929419
has answer: http://stackoverflow.com/a/21767288
accepted answer: http://stackoverflow.com/a/21767288
type: Question
tagged with: oop
tagged with: java
linked to: http://stackoverflow.com/q/318064
has comment: http://stackoverflow.com/comment/32929230
has comment: http://stackoverflow.com/comment/32929289
answer count: 3
has comment: http://stackoverflow.com/comment/32938707
upvote count: 1
has answer: http://stackoverflow.com/a/21767135
has comment: http://stackoverflow.com/comment/32928706
has body: I am new to Java/Android I have some c++/c# OOP background and from I'm really just trying to understand interfaces a little better. From what I've gathered, they basically act like prototypes that you would declare in c++. Is this at all correct? Or is there a better way of understanding this?
favorite count: 0
has comment: http://stackoverflow.com/comment/32929328
tagged with: interface
has comment: http://stackoverflow.com/comment/32928716
has answer: http://stackoverflow.com/a/21767321
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11945993
downvote count: 0
possible better answer: http://stackoverflow.com/a/21767135
score: 1

http://stackoverflow.com/a/52806174
has body: 1) I couldn't find a ticket for it, and, based on the comment on the other answer, I filed one: https://github.com/rzwitserloot/lombok/issues/1905 So let's see :) 2) For a single collection, it seems that @Delegate could do the job: interface CollectionAdders&lt;E&gt; { boolean add(E e); boolean addAll(Collection&lt;? extends E&gt; c); } interface ListGetters&lt;E&gt; { E get(int index); } class Foo { @Delegate(types={CollectionAdders.class, ListGetters.class}) List&lt;String&gt; names = new ArrayList&lt;&gt;(); } Generates: Foo#add(E e) Foo#addAll(Collection&lt;? extends E&gt; c) Foo#get(int index) See this forum post: https://groups.google.com/forum/#!topic/project-lombok/alektPraJ_Q
downvote count: 0
has comment: http://stackoverflow.com/comment/133620145
score: 5
has comment: http://stackoverflow.com/comment/117375188
has comment: http://stackoverflow.com/comment/92541851
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21776729
answers question: http://stackoverflow.com/q/21776729
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/92600913

http://stackoverflow.com/comment/33059610
type: QuestionComment
comment on: http://stackoverflow.com/q/21840587
score: 0
has text: There is no getLong() or readLong() method in DataOutputStream. Please fix your title.
type: Comment

http://stackoverflow.com/q/21801526
possible better answer: http://stackoverflow.com/a/21801734
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21801734
has body: I already have Eclipse Installed for C/C++ Prgorams. I have the Kepler Service Release 1. I am planning to learn Android App Development so I need java, so is there a way to install java on this version? I don't want to do it manually like going on the website and downloading another eclipser. Is there a plugin for java? If so can someone guide me through?
has answer: http://stackoverflow.com/a/21801882
tagged with: eclipse-plugin
score: 0
accepted answer: http://stackoverflow.com/a/21801795
answer count: 3
tagged with: android
has title: Installing java on Eclipse C/C++ Developers IDE (Kepler)?
tagged with: c++
has answer: http://stackoverflow.com/a/21801795

http://stackoverflow.com/a/21742393
score: 3
upvote count: 3
has body: You create a button for each action in your main class and add these to your JFrame. You also create a two instances of your Animation class. One which you create, setfocusable then do nothing with. Then another which you create and add to the contentPane of the JFrame. In your Animation constructor you again create a button for each action, this time setting the action commands. You then add these to a panel. This panel is never added to anything and so these buttons will never be seen. The buttons you see are not the buttons that you have defined the action commands for. Also you should avoid using setSize() and Use Layout Managers to defines the sizes of your components.
answers question: http://stackoverflow.com/q/21742172
downvote count: 0
type: Answer

http://stackoverflow.com/a/21683494
answers question: http://stackoverflow.com/q/21679357
has body: I would recommend instead of using System.setProperty() to put your drivers in the same folder and point to that folder in System Variables Path. Then you don't need to point to it at all in code and updating your driver won't require a code rewrite.
score: 0
type: Answer

http://stackoverflow.com/comment/33046533
type: Comment
score: 0
has text: @Gimby And my question was more about if the OP is aware that such tools exist. :-)
comment on: http://stackoverflow.com/q/21832945
type: QuestionComment

http://stackoverflow.com/q/21682448
has answer: http://stackoverflow.com/a/21690221
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21682622
possible better answer: http://stackoverflow.com/a/21690221
tagged with: http
has body: I have a File object and I want to get the last modified date of that file into HTTP format. The format is in GMT time and is like: Mon, 10 Feb 2014 16:17:37 GMT I know java.io.File has a method lastModified() which returns the time in milliseconds. I can also pass that time in milliseconds to the constructor of the java.util.Date class. But what is the easiest way to get a string in HTTP format? Thanks.
type: Question
has comment: http://stackoverflow.com/comment/32777725
tagged with: date
has title: Java: Time in milliseconds to HTTP format?
answer count: 2
accepted answer: http://stackoverflow.com/a/21682622
score: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/32933345
score: 6
comment on: http://stackoverflow.com/q/21769600
type: Comment
has text: The problem may be that you're returning `false` when three things in a row are equal, and `true` if they're not. Isn't that kind of backwards? Another issue: What is the value of `tictac[i][j]` if the square is empty? You don't want it returning `Win` if there are three blank squares in a row!!
type: QuestionComment

opencv
tags question: http://stackoverflow.com/q/21761641
type: Tag
tags question: http://stackoverflow.com/q/21821879
tags question: http://stackoverflow.com/q/21832828
tags question: http://stackoverflow.com/q/21721428
tags question: http://stackoverflow.com/q/21740729
tags question: http://stackoverflow.com/q/21809837
tag name: opencv
tags question: http://stackoverflow.com/q/21692890
tags question: http://stackoverflow.com/q/21707223
tags question: http://stackoverflow.com/q/21794703
tags question: http://stackoverflow.com/q/21784023
tags question: http://stackoverflow.com/q/21718952
tags question: http://stackoverflow.com/q/21728804
tags question: http://stackoverflow.com/q/21692013

http://stackoverflow.com/comment/32948095
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21778401
score: 0
has text: You are getting "*unreported exception IOException; must be caught or declared to be thrown*" because there is an unreported exception IOException that must be caught or declared to be thrown :)

http://stackoverflow.com/comment/32875967
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21737644
has text: Use a try/catch block with `FileNotFoundException`.
type: Comment

http://stackoverflow.com/a/21747106
answers question: http://stackoverflow.com/q/21746253
type: AcceptedAnswer
type: Answer
has body: How about just read the file from a URL? Something like URL theFile = new URL("http://www.foobar.com/thefile.txt"); Open an instream BufferedReader in = new BufferedReader(new InputStreamReader(theFile.openStream())); And write its contents to a file. FileWriter fWriter= new FileWriter(file_name); BufferedWriter out = new BufferedWriter(fWriter); out.write(in.readLine()); Good manners. out.close(); in.close(); Finitio!
score: 0
accepted answer of: http://stackoverflow.com/q/21746253

http://stackoverflow.com/a/21688921
accepted answer of: http://stackoverflow.com/q/21688759
type: AcceptedAnswer
downvote count: 0
has body: That isn't actually a problem with intelliJ, you are fighting against the java spec: https://stackoverflow.com/questions/283816/how-to-access-java-classes-in-the-default-package Place the classes into a package and try &lt;alt&gt;&lt;enter&gt; on the red word. Alternatively, do not place your code into a package, just put it in the default package.
has comment: http://stackoverflow.com/comment/32789640
answers question: http://stackoverflow.com/q/21688759
has comment: http://stackoverflow.com/comment/32789569
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/21694865
type: UnansweredQuestion
tagged with: android
has body: Actually I am trying to implement simple SQLiteDatabase program. MainActivity class is working without any problem. when i tried to call DBUserAdapter class methods, my application is terminating. MainActivity btninsert = (Button)findViewById(R.id.insertbtn); btninsert.setOnClickListener(insertListener); OnClickListener insertListener = new OnClickListener() { @Override public void onClick(View v) { username = txtUserName.getText().toString(); password = txtPassword.getText().toString(); DBUserAdapter dbUser = new DBUserAdapter(getApplicationContext()); dbUser.open(); if(username.length()&gt;0||password.length()&gt;0){ if(dbUser.AddUser(username, password)){ Toast.makeText(getApplicationContext(), "User Successfully Inserted", Toast.LENGTH_SHORT).show(); }else { Toast.makeText(getApplicationContext(), "User Already Existed in Records", Toast.LENGTH_SHORT).show(); } }else { Toast.makeText(getApplicationContext(), "Enter The Values", Toast.LENGTH_SHORT).show(); } } }; DBUserAdapter class: public class DBUserAdapter { public static final String KEY_ROWID = "_id"; public static final String KEY_USERNAME = "username"; public static final String KEY_PASSWORD = "password"; public static final String TAG = "DBAdapter"; public static final String DATABASE_TABLE = "users"; public static final String DATABASE_NAME = "userdb"; public static final int DATABASE_VERSION = 1; public static final String DATABASE_CREATE = "CREATE TABLE "+DATABASE_TABLE+" ("+KEY_ROWID+ " INTEGER PRIMARY KEY , "+ KEY_USERNAME+ " TEXT,"+KEY_PASSWORD+"TEXT)"; private Context context; private static SQLiteDatabase db; private static DatabaseHelper DBHelper; public DBUserAdapter(Context c){ this.context = c; DBHelper = new DatabaseHelper(context); } private static class DatabaseHelper extends SQLiteOpenHelper{ DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DATABASE_CREATE); } @Override public void onU…
has comment: http://stackoverflow.com/comment/32800037
has answer: http://stackoverflow.com/a/21695058
has comment: http://stackoverflow.com/comment/32800042
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32800076
has comment: http://stackoverflow.com/comment/32799925
has title: How to call another class object in to MainActivity class?
score: 0
has comment: http://stackoverflow.com/comment/32800834
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/32805610

http://stackoverflow.com/comment/32919560
type: Comment
comment on: http://stackoverflow.com/a/21762102
score: 0
type: AnswerComment
has text: I have never tried in tomcat :S According to this documentation, you may have to do some mangling on the server's configuration files after deploying (or in its admin console) http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

http://stackoverflow.com/comment/32947484
has text: Anyways, you that don't means you need a wrapper, you can achieve the same with a correct inheritance. at any range, if you fix my first point, and the second one is already fixed, and you think that you actually need a wrapper, you can perfectly use it, since is one of the common and easier aproachs (easier than strategy or decorator patterns). Any preference from here is mostly opinion-based
type: AnswerComment
comment on: http://stackoverflow.com/a/21777187
score: 0
type: Comment

http://stackoverflow.com/a/21688949
downvote count: 0
answers question: http://stackoverflow.com/q/21688858
has comment: http://stackoverflow.com/comment/32789708
upvote count: 2
has body: if you are using eclipse try to clean the project. Project -> Clean... -> select your project -> OK
has comment: http://stackoverflow.com/comment/32790285
type: Answer
has comment: http://stackoverflow.com/comment/32789603
score: 2

http://stackoverflow.com/comment/32940713
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21772901
has text: You load all in memory and then compares. For big tables that could be a problem. You can have perfectly more than one JDBC connection in your program and go thru both record sets at same time without storing in memory.

http://stackoverflow.com/q/21810275
has body: First off I have two questions. I am trying to create a simple highscore board in my game, when the user plays a game and finishes a dialog pops up and prompts for a name. From there I need to check if the file is already created, if not then create a file and write the name and score in. If file is already there then I need it to just add the name and score to the file not replace all of it. But I have no idea what to use... Append' or 'println' or 'write'. Second I have a highscore screen, so if the user just wants to check the highscores (this is all on device) he goes into the screen and there I need the file to be read and each line should be put in an item inside a listView. This is what I have for the file reading... try { FileInputStream fi = new FileInputStream(file); InputStreamReader fr = new InputStreamReader(fi); BufferedReader br = new BufferedReader(fr); String test; while(true) { test = br.readLine(); if (test == null) break; //textView.append("\n" + test); fr.close(); fi.close(); br.close(); } } catch (FileNotFoundException e) { Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show(); } catch (IOException e) { Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show(); }
has comment: http://stackoverflow.com/comment/33005556
tagged with: listview
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21810414
tagged with: android
has comment: http://stackoverflow.com/comment/33005469
type: AnsweredQuestion
has title: how to read each line in file and append to listView in android?
tagged with: java
tagged with: file
accepted answer: http://stackoverflow.com/a/21810414
type: Question

http://stackoverflow.com/q/21796293
type: Question
has answer: http://stackoverflow.com/a/21796455
tagged with: libgdx
has title: libgdx CameraInputController is way too sensitive, panning kicks in too early
possible better answer: http://stackoverflow.com/a/21796455
has answer: http://stackoverflow.com/a/21887354
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21887354
type: AnsweredQuestion
has body: Trying to reduce the sensitivity of panning by setting the tap square size, but even setting huge numbers just as in the example below seems to have no effect. On a high-res, small screen phone it is almost impossible to touch something without the panning mode kicking in. What is the right way to do this? The code below doesn't seem to do anything about it. public class CustomCameraInputController extends CameraInputController { public CustomCameraInputController(Camera camera) { super(camera); this.setTapSquareSize(Gdx.graphics.getWidth() / 5); } }
tagged with: java

http://stackoverflow.com/q/21710067
type: Question
possible better answer: http://stackoverflow.com/a/21713103
has title: IllegalBlockSizeException: last block incomplete in decryption in android
has answer: http://stackoverflow.com/a/21713103
score: 0
answer count: 2
has body: Im developing android program which in i want to encrypt an string and then decrypt it as well. but i recieve this exception: javax.crypto.IllegalBlockSizeException: last block incomplete in decryption I searched a lot but i couldn't find the answer. this is my encrypt class which contains two methods Encrypt() and Decrypt(): public class EncryptionClass { public static SecretKey mainKey=null; public static SecretKey GenerateKey() throws NoSuchAlgorithmException { KeyGenerator keygenerator = KeyGenerator.getInstance("DES"); SecretKey myDesKey = keygenerator.generateKey(); return myDesKey; } public static String Encrypt(String plainText) { String encryptedText = ""; try { mainKey=GenerateKey(); Cipher desCipher; // Create the cipher desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); // Initialize the cipher for encryption desCipher.init(Cipher.ENCRYPT_MODE,mainKey); //sensitive information byte[] plainTextAsBytes =plainText.getBytes(); Log.d("Text [Byte Format] : " , plainTextAsBytes.toString()); Log.d("Text : " ,new String(plainTextAsBytes)); // Encrypt the text byte[] cipherText = desCipher.doFinal(plainTextAsBytes); Log.d("Text Encryted : " ,cipherText.toString()); encryptedText=cipherText.toString(); }catch(NoSuchAlgorithmException e){ Log.d("NoSuchAlgorithmException :", e.toString()); }catch(NoSuchPaddingException e){ Log.d("NoSuchPaddingException :", e.toString()); }catch(InvalidKeyException e){ Log.d("InvalidKeyException:", e.toString()); }catch(IllegalBlockSizeException e){ Log.d("IllegalBlockSizeException:", e.toString()); }catch(BadPaddingException e){ Log.d("BadPaddingException:", e.toString()); } finally{ } return encryptedText; } public static String Decrypt(String cipherText) { String decryptedText = ""; try { Log.d("Decrypt MAin Key:",mainKey.getEncoded().toString()); Cipher desCipher; // Create the cipher desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); // Initialize the cipher for encryption desCipher.init(Cipher.DECRYPT_MODE,mainKey); //…
has answer: http://stackoverflow.com/a/21712394
tagged with: android
has comment: http://stackoverflow.com/comment/32832586
has comment: http://stackoverflow.com/comment/32831384
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21712394
tagged with: java
tagged with: encryption

http://stackoverflow.com/comment/32985301
comment on: http://stackoverflow.com/a/21799108
score: 1
type: AnswerComment
has text: No, integer division does not mean rounding, but flooring. (`int x = 8/3; // x = 2`)
type: Comment

http://stackoverflow.com/q/21798924
has body: What is the convention to store jar files inside maven project? I know that I should download jars using maven itself, but this time the case is different. I'm doing a course (coursera.org) and I've got somewhat secret jar file which I'm supposed to use and it's not public - I won't download it with maven. And I do want to store the .jar file in my private repo (bitbucket). The question is just where should I put the file, so that maven project will be able to use this jar.
favorite count: 0
has title: maven - where to store external jar files if needed
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21804324
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21798972
type: Question
has answer: http://stackoverflow.com/a/21798972
answer count: 3
possible better answer: http://stackoverflow.com/a/45381166
upvote count: 1
has answer: http://stackoverflow.com/a/45381166
tagged with: jar

http://stackoverflow.com/comment/32847538
has text: The processing-instruction() node test is also available in XPath 1.0.
type: AnswerComment
comment on: http://stackoverflow.com/a/21716149
type: Comment
score: 0

http://stackoverflow.com/comment/32931781
type: Comment
score: 0
has text: This is a closely related question: http://stackoverflow.com/questions/8853387/clarifications-on-tomcats-temp-and-work-directories
comment on: http://stackoverflow.com/q/21768803
type: QuestionComment

rest
tags question: http://stackoverflow.com/q/21815754
tags question: http://stackoverflow.com/q/21706078
tags question: http://stackoverflow.com/q/21732436
tags question: http://stackoverflow.com/q/21827940
tags question: http://stackoverflow.com/q/21740241
tags question: http://stackoverflow.com/q/21767689
tags question: http://stackoverflow.com/q/21815833
tags question: http://stackoverflow.com/q/21703277
tags question: http://stackoverflow.com/q/21752912
tags question: http://stackoverflow.com/q/21764696
tags question: http://stackoverflow.com/q/21723183
tags question: http://stackoverflow.com/q/21747431
tags question: http://stackoverflow.com/q/21764428
tags question: http://stackoverflow.com/q/21768779
tags question: http://stackoverflow.com/q/21830570
tags question: http://stackoverflow.com/q/21746001
tags question: http://stackoverflow.com/q/21755169
tags question: http://stackoverflow.com/q/21814486
tags question: http://stackoverflow.com/q/21775590
type: Tag
tags question: http://stackoverflow.com/q/21680545
tags question: http://stackoverflow.com/q/21681183
tags question: http://stackoverflow.com/q/21704629
tags question: http://stackoverflow.com/q/21719723
tags question: http://stackoverflow.com/q/21726392
tags question: http://stackoverflow.com/q/21808886
tags question: http://stackoverflow.com/q/21776829
tags question: http://stackoverflow.com/q/21795690
tags question: http://stackoverflow.com/q/21820163
tag name: rest
tags question: http://stackoverflow.com/q/21683335
tags question: http://stackoverflow.com/q/21743194
tags question: http://stackoverflow.com/q/21690429
tags question: http://stackoverflow.com/q/21762888

last-modified
type: Tag
tags question: http://stackoverflow.com/q/21814241
tag name: last-modified

http://stackoverflow.com/comment/32956668
has text: If I use KeyStore.getInstance(KeyStore.getDefaultType()), do I get the keystore that links to cacerts, or a completely new empty keystore with no certificates? Or something else?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21777005

http://stackoverflow.com/q/21802487
has body: I just got a question . I see many quiz apps in the appstore and Im asking myself how these apps have a size of 2-5 mb ... I mean when I put a jpg or png file in the projekt folder my apk gets for exampel 4 mb bigger ... Are they compressing the pictures or are they using a diffrent technic ? Am I able to show the pictures above the internet? For example pictures which are uploaded to a ftp server .. Thank you for your answers Maybe the question is too naiv I dont know ;)
tagged with: java
tagged with: image
type: Question
score: 0
answer count: 1
tagged with: android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21803630
has title: Picture size in Android

http://stackoverflow.com/comment/32894131
has text: Have you used the debugger to check whether the value is set at some time?
comment on: http://stackoverflow.com/q/21747808
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21755980
score: 0
has body: B is a static inner class of A. Need to instantiate B. A.B innerObject = new A.B(); innerObject.show();
type: Answer
answers question: http://stackoverflow.com/q/21755815

http://stackoverflow.com/a/21787073
has body: You should likely not have to resort to renaming with regexp in your case. You should be able to get away with exporting typedefs (and wrapper classes or functions via %inline and the very powerfull %extend if necessary but I can't tell from your post). I've shown in several other SO posts how typemaps can be avoided via other high-level (declarative as opposed to procedural) SWIG functionality. If you post some of your .i code and show which swig_p_f_p etc you get I'll see if I can be more specific.
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21783689

http://stackoverflow.com/q/21795559
has answer: http://stackoverflow.com/a/21795641
favorite count: 0
accepted answer: http://stackoverflow.com/a/21795662
has comment: http://stackoverflow.com/comment/32979171
tagged with: http-redirect
tagged with: php
has comment: http://stackoverflow.com/comment/32979243
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32979262
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32979188
has answer: http://stackoverflow.com/a/21795662
has title: Java redirect all page requests to same JSP file
answer count: 2
has body: Is there any way in Java Web such that whenever a request comes a specific JSP page is called? In PHP i use .htaccess file to redirect all requests to same page. Following is the code I use in .htaccess for PHP apps: RewriteEngine on RewriteRule ^(.*)$ bootstrap.php [L] Does the .htaccess file also works in Java? what is the correct way of doing this in java.
possible better answer: http://stackoverflow.com/a/21795641
downvote count: 0

http://stackoverflow.com/q/21748229
tagged with: jboss
has body: In a JBoss 5 JEE project which I have inherited, the web application (WAR) project contains a JNDI configuration file which seems to be unneccessary. Its content is java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=localhost:1099 Removing it has no obvious effect, deployment and execution works well and unit tests show no errors. Is it safe to delete this file?
has title: Is the jndi.properties file required for a EJB + web application (JBoss 5)?
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/21750220
score: 0
answer count: 1
tagged with: ejb
tagged with: jndi
tagged with: java
has answer: http://stackoverflow.com/a/21750220

http://stackoverflow.com/comment/32831384
type: Comment
comment on: http://stackoverflow.com/q/21710067
type: QuestionComment
has text: You searched a lot? I find that hard to believe. A simple Google search for exactly that exception returns **hundreds** of results for me.
score: 0

http://stackoverflow.com/q/21710632
has body: I created a table in an Oracle database on my personal computer. Then linked it with a Java Application and I am using that table/database to save all the data from the application. But when I deploy my .jar file and run it from another system, that database is not installed on it. Can anyone please tell me or guide me what I am suppose to do? In order for the database and the application to work on other systems too. Thanks
tagged with: java
accepted answer: http://stackoverflow.com/a/21710700
downvote count: 1
type: Question
has title: Oracle Database Deployment
has comment: http://stackoverflow.com/comment/32828088
upvote count: 0
score: -1
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/21710700
favorite count: 0
tagged with: oracle-database
type: AnsweredQuestion

http://stackoverflow.com/comment/32786317
score: 0
type: AnswerComment
type: Comment
has text: @MikeStrobel Verification fails as soon as the `invokespecial`ed method is not in the current class (or its branch of hierarchy).
comment on: http://stackoverflow.com/a/21684077

http://stackoverflow.com/comment/50296724
type: AnswerComment
type: Comment
score: 11
comment on: http://stackoverflow.com/a/31142436
has text: Basically, the truststore parameters in `Connector` are for setting which client certificates you want to trust. The `javax.net.ssl.*` settings in `JAVA_OPTS` affect the default SSL context (typically for connection made from within the servlets, where they act as clients, for example).

http://stackoverflow.com/q/21782535
has answer: http://stackoverflow.com/a/21782640
has comment: http://stackoverflow.com/comment/32955558
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21795288
possible better answer: http://stackoverflow.com/a/21782640
has title: Running exe file with arguments from java program and sending output to text file
tagged with: arguments
has body: I want to run a exe file that accepts a mp3 file as an argument and redirects the output to a text file. I am using the below command from command prompt and its running fine and making a log.txt file in my binary folder however I am unable to do so by java. C:\Users\Desktop\binary&gt;codegen.exe kalimba.mp3 &gt; log.txt I have tried the ProcessBuilder class however cannot see the log.txt made in the binary folder File f = new File("C:/Users/Desktop/binary"); ProcessBuilder pb = new ProcessBuilder("cmd", "/c","start","codegen.exe", "kalimba.mp3", "log.txt"); pb.directory(f); Any idea what I might be doing wrong?
tagged with: exe
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21795288
has answer: http://stackoverflow.com/a/21782689
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/13991007
has comment: http://stackoverflow.com/comment/32964337
linked to: http://stackoverflow.com/q/6295866

http://stackoverflow.com/comment/33087245
type: Comment
has text: I thought the third part of for executes first!
comment on: http://stackoverflow.com/a/21836632
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33018087
comment on: http://stackoverflow.com/q/21817373
type: QuestionComment
type: Comment
has text: Please edit your question. All left-justified code is very difficult to read.
score: 1

http://stackoverflow.com/a/21785802
has comment: http://stackoverflow.com/comment/32985454
type: Answer
has body: Maybe you missed to use Spring in your Test? How the documentService is injected? Add @RunWith(SpringJUnit4ClassRunner.class) to your test class to enable Spring in the test. If you use autowire that should be all. You may also need a @ContextConfiguration annotation to your test and/or add @Resource to the members to be injected.
score: 0
has comment: http://stackoverflow.com/comment/32973242
accepted answer of: http://stackoverflow.com/q/21784642
answers question: http://stackoverflow.com/q/21784642
type: AcceptedAnswer

http://stackoverflow.com/q/21769196
has comment: http://stackoverflow.com/comment/32993341
has comment: http://stackoverflow.com/comment/32991847
linked to: http://stackoverflow.com/q/15981244
has comment: http://stackoverflow.com/comment/32933587
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32934076
has comment: http://stackoverflow.com/comment/32934151
tagged with: java
has comment: http://stackoverflow.com/comment/32933120
has comment: http://stackoverflow.com/comment/32993165
tagged with: servlets
has comment: http://stackoverflow.com/comment/32932901
type: Question
has comment: http://stackoverflow.com/comment/32987498
has comment: http://stackoverflow.com/comment/32989363
has comment: http://stackoverflow.com/comment/32934234
has comment: http://stackoverflow.com/comment/32934041
tagged with: jar
has comment: http://stackoverflow.com/comment/32973418
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32934145
has title: Servlet .jar Dependency Null Pointer
has comment: http://stackoverflow.com/comment/32952651
has comment: http://stackoverflow.com/comment/32989185
tagged with: postgresql
score: 0
has comment: http://stackoverflow.com/comment/32933535
has body: I am getting a seemingly inexplicable nullPointerException from a .jar file that is listed in the classpath as an export dependency. The jar file consists of a database bean that works flawlessly when it is called inside of a normal main method POJO, but when I called the same jar file in a servlet, I get null pointers from the con.prepareStatement of whatever I call. I thought that it might be a SQLException from the pool causing it, so I moved it to our VM server where it can talk directly to the database instance across its cloud environment, and I get the same error. The bean consists of four additional dependent jar files: guava-16.0.1.jar(for weak referenced hashmaps), postgresql-9.3-1100.jdbc41.jar, tomcat-dbcp.jar, tomcat-jdbc.jar that are all wrapped up into a single jar file using FatJar for Eclipse, which is then imported into my servlet which is hosted in a Tomcat8 servlet container (also tested in Tomcat7 and TomEE). The servlet code is as follows: import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletConfig; 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 com.package.DBEngine; @WebServlet("/PrimaryEngine") public class PrimaryEngine extends HttpServlet { private static final long serialVersionUID = 1L; private DBEngine db; public void init(ServletConfig config) throws ServletException{ super.init(config); db = new DBEngine(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); if(request.getParameterMap().containsKey("op")){ out.println("Getting data..."); String test = db.DBdebug(); out.println(test); return; } } protected void doPost(HttpServletRequest request, HttpServletResponse response) th…
answer count: 1
has answer: http://stackoverflow.com/a/21836871
has comment: http://stackoverflow.com/comment/32934187
accepted answer: http://stackoverflow.com/a/21836871

http://stackoverflow.com/comment/32777364
has text: "First, the length is 4. So the bytes are [ 0, 0, 16, -17 ]" - the length of what? The string or the byte array? The fact that a string has a length of 4 certainly doesn't mean that the encoded form will have 4 bytes in every encoding.
score: 0
comment on: http://stackoverflow.com/a/21682326
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32931994
has text: Awesome, thank you, that fixed it! Another thing - the method you helped me with just now, the createArray method - is that 'loading' the students into the array? Because I need to make a method that loads the students, and another that searches for the students. I have a pretty good idea of how to implement the latter, but I'm confused as to how I'm supposed to load the xml file to begin with. Isn't that what the createArray method is doing?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21743543

http://stackoverflow.com/comment/32785738
score: 0
type: Comment
type: QuestionComment
has text: Consider using Jsoup, if you are extracting data here and there in the page.
comment on: http://stackoverflow.com/q/21686984

http://stackoverflow.com/q/21782653
score: 0
has comment: http://stackoverflow.com/comment/32957114
answer count: 1
has comment: http://stackoverflow.com/comment/32958606
tagged with: android
has comment: http://stackoverflow.com/comment/32955914
has comment: http://stackoverflow.com/comment/32955714
has comment: http://stackoverflow.com/comment/32956200
type: AnsweredQuestion
has title: is it possible to make a call back to an outer nested class in java?
tagged with: java
has comment: http://stackoverflow.com/comment/32956388
type: Question
tagged with: nested-class
has answer: http://stackoverflow.com/a/21784590
accepted answer: http://stackoverflow.com/a/21784590
has comment: http://stackoverflow.com/comment/32955744
has comment: http://stackoverflow.com/comment/32955867
tagged with: callback
has body: here's an example of what I'm trying to do public class BookModel { private void update_method() { get_info task = new get_info(this) task.exicute(some args); } public void finishedCallback(some_return_type result) { // do some stuff when finsiehd. } class get_info extends AsyncTask&lt;HashMap&lt;String, String&gt;, Void, dataType&gt; { private BookModel bookModel; public get_info ( BookModel reset) { bookModel = reset; } @Override protected dataType doInBackground(arg...) some procscessing. } protected void onPostExecute(dataType result) { bookModel.finishedCallback(result); } } } How can i get this callback system to work... I tried using an inteface as well, but it did not work. I think it's because you need 3 classes with an interface (correct me if I'm wrong). also I'm open to any suggestions, but Ideally I would like to keep this functionality within the same class if possible. any help with this would be greatly appreciated.

http://stackoverflow.com/q/21771043
has answer: http://stackoverflow.com/a/22260115
score: 1
tagged with: java
tagged with: finalize
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/21772083
accepted answer: http://stackoverflow.com/a/21771999
answer count: 3
has answer: http://stackoverflow.com/a/21771999
downvote count: 0
tagged with: finalizer
tagged with: garbage-collection
has title: Finalizer of Java and C#
has body: Java In Java, there is an idiom called "Finalizer Guardian" which prevents subclasses overriding superclasses finalizer but forgetting to invoke it. Here is an example from Effective Java Item7: // Finalizer Guardian idiom public class Foo { // Sole purpose of this object is to finalize outer Foo object private final Object finalizerGuardian = new Object() { @Override protected void finalize() throws Throwable { ... // Finalize outer Foo object } }; ... // Remainder omitted } With this technique, even if a subclass having a finalizer doesn't invoke superclass's finalizer, the private object would run the finalization code of the superclass. C# However, in C# in a Nutshell, section "Calling Dispose from a Finalizer", there is an example like this: class Test : IDisposable { public void Dispose() // NOT virtual { Dispose (true); GC.SuppressFinalize (this); // Prevent finalizer from running. } protected virtual void Dispose (bool disposing) { if (disposing) { // Call Dispose() on other objects owned by this instance. // You can reference other finalizable objects here. // ... } // Release unmanaged resources owned by (just) this object. // ... } ˜Test() { Dispose (false); } } The author also stated that: The disposing flag means it’s being called “properly” from the Dispose method rather than in “last-resort mode” from the finalizer. The idea is that when called with disposing set to false, this method should not, in general, reference other objects with finalizers (because such objects may themselves have been finalized and so be in an unpredictable state) Question But, when we review the Finalizer Guardian idiom of Java, the inner private guardian object actually referring/finalizing the outer object which could have a finalizer itself. It violates what the author of C# in a Nutshell stated. I am curious about why "referring other finalizable objects in a finalizer" is possible in Java but not in C#. Thanks for answering.
has answer: http://stackoverflow.com/a/21772083
type: Question
tagged with: c#
type: AnsweredQuestion

http://stackoverflow.com/comment/33057328
type: Comment
type: QuestionComment
score: 0
has text: NigelK linked to the correct answer. Personally, I've had good luck with disabling the 'OK' button until the text was valid (using TextWatcher). You can do that as follows: `final AlertDialog dlg = alert.create(); dlg.show(); dlg.getButton( AlertDialog.BUTTON_POSITIVE ).setEnabled( false );`
comment on: http://stackoverflow.com/q/21839357

jms
tags question: http://stackoverflow.com/q/21785073
tags question: http://stackoverflow.com/q/21734014
tags question: http://stackoverflow.com/q/21831578
tags question: http://stackoverflow.com/q/21742707
tags question: http://stackoverflow.com/q/21803299
tag name: jms
tags question: http://stackoverflow.com/q/21739716
type: Tag
tags question: http://stackoverflow.com/q/21837573
tags question: http://stackoverflow.com/q/21823183
tags question: http://stackoverflow.com/q/21783570

http://stackoverflow.com/comment/32935807
type: AnswerComment
has text: O i see, you are saying because he has already assigned a word in the method to vowels rather than passing a parameter or something… how would you suggest I edit that to explain that? I feel I answered his question of determining how many vowels are in a string…He is just making the mistake of hardcoding that string to a set value
type: Comment
comment on: http://stackoverflow.com/a/21770965
score: 0

http://stackoverflow.com/q/21727038
type: Question
has comment: http://stackoverflow.com/comment/32859305
tagged with: apache
answer count: 1
downvote count: 0
has body: I have a working servlet code, which processes some command prompt commands and I have an editor code written in html, now I want to add this html file to servlet. How do I do it? tried moving the html file to WEB-INF. I've looked into this link on How to integrate HTML design into Servlet? but everything seems damn cumbersome as I have a very large html file. Any other fixes?
has comment: http://stackoverflow.com/comment/32856633
has comment: http://stackoverflow.com/comment/32856773
accepted answer: http://stackoverflow.com/a/21729227
has title: integrating html design to servlet
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32856705
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21729227
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32856538
tagged with: servlets

http://stackoverflow.com/comment/32791917
has text: Thank you, not sure how I over-looked something like this.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21687393
type: Comment

http://stackoverflow.com/comment/33064870
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21821210
type: AnswerComment
has text: Thanks for your reply, but i am sorry i am kinda slow, can you explain more or give me some more hint. THanks, appreciated it

http://stackoverflow.com/comment/32909462
type: Comment
comment on: http://stackoverflow.com/a/21756656
has text: I have got error with DateFields. What should I import?
score: 0
type: AnswerComment

http://stackoverflow.com/a/29557558
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21687423
score: 1
upvote count: 1
has body: Hello if you change your code like this it will work. case MotionEvent.ACTION_UP: super.onTouchEvent(event); // your code here. return true;

http://stackoverflow.com/a/21703966
has comment: http://stackoverflow.com/comment/32815568
has comment: http://stackoverflow.com/comment/32815649
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/32816665
has comment: http://stackoverflow.com/comment/32815988
answers question: http://stackoverflow.com/q/21703935
downvote count: 0
has body: Change your query as follows "select CLFPSid from CheckLists where CLFPid = "+ section + " and ActionDate ='"+Date+"'and CLFPSid = 0 or CLFPSid = 3 or CLFPSid = 4 or CLFPSid = 5"
score: 1

http://stackoverflow.com/comment/32815300
type: Comment
type: QuestionComment
score: 0
has text: Hey, your not just going to get solutions here. You need to show that you have made an attempt. What have you tried? What is your problem?
comment on: http://stackoverflow.com/q/21703914

http://stackoverflow.com/a/21720987
score: 19
has body: First, let's review the definition of Singleton Pattern (emphasis mine): In software engineering, the singleton pattern is a design pattern that restricts the instantiation of a class to one object. When you declare a class that implements the Filter interface, it needs a public constructor (usually the default constructor) so the application server could instantiate it. Thus, by doing this, the Filter is not a singleton. Note that the application server will maintain a single instance per application context e.g. per a deployed web application, but this is not the same as having a singleton. Why? Because you or another programmer can carelessly create an instance of this class (even if it doesn't make use of the instance).
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37070322
accepted answer of: http://stackoverflow.com/q/21720663
answers question: http://stackoverflow.com/q/21720663
type: Answer
upvote count: 19

http://stackoverflow.com/q/21819046
tagged with: adapter
score: 0
has title: Adapter notify not working
has comment: http://stackoverflow.com/comment/33021481
has comment: http://stackoverflow.com/comment/33021283
tagged with: android
has comment: http://stackoverflow.com/comment/33022557
tagged with: asynchronous
answer count: 0
has comment: http://stackoverflow.com/comment/33021423
has comment: http://stackoverflow.com/comment/33021569
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33021313
has body: I load images asynchronously on my adapter. But when setting the image (bitmap) nothing happens inside the listview. Any ideas what's wrong? Thanks in advance This is my code that updates the object with an image ( in adapter) : public void setImage(int position ,Bitmap bm){ profielen.get(position).setThumbNail(bm); this.notifyDataSetChanged(); } Adapter : public class LeaderBoardAdapter extends ArrayAdapter&lt;Profile&gt;{ LayoutInflater vi; List&lt;Profile&gt; profielen; Context mContext; int res; public LeaderBoardAdapter(Context context, int resource, List&lt;Profile&gt; objects) { super(context, resource, objects); this.res = resource; this.profielen = objects; mContext = context; vi = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ProfileHolder holder = null; if(convertView == null) { LayoutInflater inflater = ((Activity)mContext).getLayoutInflater(); convertView = vi.inflate(R.layout.item_layout, parent, false); convertView = inflater.inflate(res, parent, false); holder = new ProfileHolder(); holder.name = (TextView)convertView.findViewById(R.id.nameChar); holder.pic = (ImageView)convertView.findViewById(R.id.imageChar); holder.rank = (TextView)convertView.findViewById(R.id.ratingNumber); convertView.setTag(holder); } else { holder = (ProfileHolder)convertView.getTag(); } Profile p = profielen.get(position); holder.name.setText(p.getName()); holder.rank.setText(p.getRating()); holder.pic.setImageBitmap(p.getThumbNail()); return convertView; } public static class ProfileHolder{ TextView name; ImageView pic; TextView rank; } public void setImage(int position ,Bitmap bm){ profielen.get(position).setThumbNail(bm); this.notifyDataSetChanged(); } } And get changed by this : imgurl =imgCharacter+imgurl; ImageLoader imageLoader = getImageLoader(); imageLoader.get(imgurl, new ImageListener() { public void onErrorResponse(…
tagged with: java
tagged with: listview
type: Question
has comment: http://stackoverflow.com/comment/33021735
has comment: http://stackoverflow.com/comment/33021780

http://stackoverflow.com/a/21823998
has comment: http://stackoverflow.com/comment/33030051
type: Answer
has comment: http://stackoverflow.com/comment/33029781
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33029741
has comment: http://stackoverflow.com/comment/33029642
upvote count: 2
has comment: http://stackoverflow.com/comment/33029904
has body: let num = 10 public boolean what (int num) { boolean ans = true; for (int x = 2; (x*x &lt;= num) &amp;&amp; ans; x=x+1) { //^ multiply x with x will give (4,9).. When x = 4, than (16&lt;= num) = false if ((num % x) == 0) // divide 10 by (2,3) if reminder is zero that means 10 is not prime ans = false; // set ans to false so that for loop can be terminated or just break; } return ans; }
has comment: http://stackoverflow.com/comment/33029881
answers question: http://stackoverflow.com/q/21823880
has comment: http://stackoverflow.com/comment/33029954

http://stackoverflow.com/q/21722458
tagged with: android
has answer: http://stackoverflow.com/a/21724813
has body: I need to handle an exception when web service is not available. In my app i am requesting an web service what will return me an XML data. My app is working correctly when web service is available. But when the web service is unavailable then my app become crash.how to catch that exception in java. Please note that i am developing an app for android. when the web service is unavailable the it looks likes the following image
has title: How to handle exception when web service is not available in java
has comment: http://stackoverflow.com/comment/32848852
has answer: http://stackoverflow.com/a/21722533
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
tagged with: try-catch
accepted answer: http://stackoverflow.com/a/21722533
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21724813
tagged with: exception

http://stackoverflow.com/a/21768340
has comment: http://stackoverflow.com/comment/32931186
accepted answer of: http://stackoverflow.com/q/21768235
downvote count: 0
has comment: http://stackoverflow.com/comment/32931218
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
has body: When your cursor is within the item you want to view the docs for, you should be able to open/focus them by pressing F2.
answers question: http://stackoverflow.com/q/21768235

http://stackoverflow.com/q/21682667
tagged with: normal-distribution
upvote count: 2
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/21682831
has body: first of all, i'd like you to know that i really lack knowledge/suck at math. Right now, there is a code algorithm that states the use of a Gaussian random function. I honestly don't know a thing about gaussian random function. All i know in java is math.random(). The equation i would like into the code is in the form: rand = n(m,v); where n(m,v) represents the gaussian random function with mean (m) and variance (v). What is the equivalent for this in java? Thanks!
tagged with: gaussian
tagged with: random
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21682831
has title: Java equivalent of Gaussian random function between two numbers?

http://stackoverflow.com/a/25773773
type: Answer
answers question: http://stackoverflow.com/q/21737644
has body: Code Snippet to help: BufferedReader br = new BufferedReader(new FileReader("filepath")); try { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); sb.append(System.getProperty("line.separator")); line = br.readLine(); } everything = sb.toString(); System.out.println(everything); } finally { br.close(); }
score: 0

http://stackoverflow.com/comment/32789632
type: Comment
comment on: http://stackoverflow.com/q/21688516
score: 0
type: QuestionComment
has text: @CommonsWare How can i add a string resource

http://stackoverflow.com/a/21799603
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21798211
answers question: http://stackoverflow.com/q/21798211
has body: Is there a way for me to tell Spring not to use the name of the method for the bean? Short answer: no. I thought that plugging in a customized BeanNameGenerator would solve your problem, but apparently no BeanNameGenerator is used for generating bean names of beans defined in @Configuration classes (or at least not in spring 3.2.x &amp; spring 4.0.x). When you take a look at ConfigurationClassBeanDefinitionReader (line 184), you'll notice that determining the bean name is pretty hard-coded; if available, the first name defined on the @Bean annotation is used, otherwise the name of the method is used.
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/33047851
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21834285
has text: If the text is very long, yes, I want to display multiple lines
score: 0

http://stackoverflow.com/comment/33037558
comment on: http://stackoverflow.com/q/21828523
score: 0
has text: @nKn EditText editText=(EditText) view.findViewById(R.id.product_count);
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21826205
score: 1
has body: Use HashSet&lt;String&gt;, which have both add(), contains() functionality, but it won't allow duplicate
answers question: http://stackoverflow.com/q/21826167
has comment: http://stackoverflow.com/comment/33035088
has comment: http://stackoverflow.com/comment/33034550
has comment: http://stackoverflow.com/comment/33033742
downvote count: 0
has comment: http://stackoverflow.com/comment/33034045
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32962118
type: Comment
has text: yes ! Thanks a lot ! That's twice you save the day today !
comment on: http://stackoverflow.com/a/21786155
score: 0
type: AnswerComment

http://stackoverflow.com/a/21729588
upvote count: 1
has body: what about //input[contains(@data-bind, "Serial")] //input[contains(@data-bind, "area code")] //input[contains(@data-bind, "Pan No")]
answers question: http://stackoverflow.com/q/21729218
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/21782940
tagged with: jsf
has answer: http://stackoverflow.com/a/21810611
tagged with: java
accepted answer: http://stackoverflow.com/a/21856514
type: Question
has body: When turning on JRebel for my JSF project, CPU usage gets too high on each requests &amp; drops down when request has been served. I did looked though the profiler but it was not caused due to my project classes itself. But I could even figure out the culprit looking at the profiling results. Here are the profiling results : Interestingly the problem disappears when I either disable JRebel, or remove a 3rd party URL rewrite library (com.ocpsoft.pretty.faces.*). But then I created a new fresh netbeans project without disabling either of the above two, &amp; but still the problem is not there, which expectedly should have been. Any idea what may be causing this ? Edit: Seems Prettyfaces (com.ocpsoft.pretty.faces) URL rewrite library is the culprit anyway.. See this snapshot: But why this happens only when Jrebel is on ??
possible better answer: http://stackoverflow.com/a/21810611
tagged with: prettyfaces
score: 0
answer count: 2
has title: High CPU usage when JRebel is on
has comment: http://stackoverflow.com/comment/32961201
has answer: http://stackoverflow.com/a/21856514
tagged with: netbeans
tagged with: jrebel
type: AnsweredQuestion

http://stackoverflow.com/q/21711309
tagged with: java
has answer: http://stackoverflow.com/a/21712846
tagged with: sql
answer count: 1
linked to: http://stackoverflow.com/q/3817785
tagged with: resultset
has body: If someone could assist with this it would be great. I have two identical MS Access databases, only the filenames are different. Fist db is on my local computer, the second db is on a mapped network drive. I can do a search on the second db, return a resultset in a vector and can display the results in a JTable. Question - Does anyone know if it is possible to then transfer this resultset to the database on the local computer?? I can transfer a single record no problem, but an entire resultset I'm not sure. I'm using Java/JDBC. Thanks
duplicate of: http://stackoverflow.com/q/3817785
tagged with: jdbc
has comment: http://stackoverflow.com/comment/32829485
has comment: http://stackoverflow.com/comment/32829443
has comment: http://stackoverflow.com/comment/32829328
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32829869
has comment: http://stackoverflow.com/comment/32829899
type: Question
has title: Transferring Vector Resultset to another database

http://stackoverflow.com/comment/32906281
type: QuestionComment
has text: @Smutje how do I specify name of column of part_number in DB in ProductDetail table? Also is the above setup correct?
type: Comment
comment on: http://stackoverflow.com/q/21754746
score: 0

http://stackoverflow.com/q/21814580
accepted answer: http://stackoverflow.com/a/21825461
has body: While trying to run the code bellow to gain a SAML token (taken from VMWare samples to authenticate with SSO server) I got the following exception. From some reason the request version 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue' and namespace 'http://docs.oasis-open.org/ws-sx/ws-trust/200512' are not supported. Appreciate your help... Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Request version 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue' and namespace 'http://docs.oasis-open.org/ws-sx/ws-trust/200512' are not supported at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178) at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:125) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135) at com.sun.proxy.$Proxy40.issue(Unknown Source) at com.vmware.sso.client.samples.AcquireBearerTokenByUserCredentialSample.getToken(AcquireBearerTokenByUserCredentialSample.java:178) at com.vmware.sso.client.samples.AcquireBearerTokenByUserCredentialSample.main(AcquireBearerTokenByUserCredentialSample.java:210) package com.vmware.sso.client.samples; import java.util.GregorianCalendar; import java.util.Map; import java.util.TimeZone; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLSession; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.ws.BindingProvider; import org.oasis_open.docs.ws_sx.ws_trust._200512.LifetimeType; import org.oasis_open.docs.ws_sx.ws_trust._200512.RenewingType; import org.oasis_open.docs.ws_sx.ws_trust._200512.RequestSecurityTokenType; import org.oasis_open.docs.wss._2004._01.oasis_20…
has title: SOAPFaultException while trying to get SAML2 token
tagged with: java
tagged with: opensaml
type: AnsweredQuestion
tagged with: saml-2.0
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/21825461
tagged with: soap
score: 0

http://stackoverflow.com/q/21679586
downvote count: 1
has title: Find similarity measure for feature vectors having different length
has comment: http://stackoverflow.com/comment/32772458
type: Question
tagged with: text-processing
accepted answer: http://stackoverflow.com/a/21680085
answer count: 1
has comment: http://stackoverflow.com/comment/32772785
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32772823
tagged with: similarity
has body: In Java, how can we find similarity measure between two vectors having different length. Consider we have V1 = [1, 0, 0, 1, 1] V1 = [1, 0, 1, 0, 1, 0, 1, 0] I looking for similarity measure other than Jaccard Coefficient or Sørensen–Dice coefficient
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21680085
has comment: http://stackoverflow.com/comment/32779535

http://stackoverflow.com/q/21709464
has comment: http://stackoverflow.com/comment/32826544
score: 4
has comment: http://stackoverflow.com/comment/32826469
answer count: 2
possible better answer: http://stackoverflow.com/a/21710059
downvote count: 0
has answer: http://stackoverflow.com/a/21710059
favorite count: 0
tagged with: hash
has comment: http://stackoverflow.com/comment/32826728
has answer: http://stackoverflow.com/a/21709601
has title: When are hash functions orthogonal to each other?
has comment: http://stackoverflow.com/comment/32826408
accepted answer: http://stackoverflow.com/a/21709601
has comment: http://stackoverflow.com/comment/32826768
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32825772
tagged with: orthogonal
has comment: http://stackoverflow.com/comment/32826634
has body: When are hash functions orthogonal to each other? And can you provide an example in Java of two hash functions that are orthogonal to each other?
type: Question
upvote count: 4

http://stackoverflow.com/a/21772706
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21772651
answers question: http://stackoverflow.com/q/21772651
type: AcceptedAnswer
has body: You just need to set selector of button in your layout file. and done. Edit Following is button_effect.xml file in drawable directory <?xml version="1.0" encoding="utf-8"?> In this, you can see that there are 3 drawables, you just need to place this button_effect style to your button, as i wrote above. You just need to replace selector_xml_name with button_effect.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32895758
type: Comment
type: QuestionComment
score: 0
has text: No i compared them and everything is the same.
comment on: http://stackoverflow.com/q/21705851

http://stackoverflow.com/comment/33114978
has text: You can just choose "New Module" from the File menu and follow the wizard to add an Android library.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21870436
type: AnswerComment

http://stackoverflow.com/a/21829169
answers question: http://stackoverflow.com/q/21829071
has body: You can use a volatile boolean variable and set it to false. After the completion of thread y make it true. On the condition check stop the desired thread.
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21778987
has answer: http://stackoverflow.com/a/21781471
accepted answer: http://stackoverflow.com/a/21781471
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has body: My current code is printing out the xml like this : <OBJECT_TYPE xmlns="">x3000</OBJECT_TYPE> - a very fast train NULL 0 1 <PICTURE>NULL NULL <MIN_NO>NULL</MIN_NO> <MAX_NO>NULL</MAX_NO> <NAME_FORMAT>NULL</NAME_FORMAT> But I want this output : <OBJECT_TYPE>x3000</OBJECT_TYPE> - a very fast train NULL 0 1 <PICTURE>NULL NULL <MIN_NO>NULL</MIN_NO> <MAX_NO>NULL</MAX_NO> <NAME_FORMAT>NULL</NAME_FORMAT> How to do that ? This is my current code : public void saveXmlToFile(Type objType, Properties property) throws IOException, ParserConfigurationException, SAXException, JDOMException { File xmlFile = new File(XMLEditorService.getXMLEditorService() .getFile()); org.jdom2.Document doc = new SAXBuilder().build(xmlFile); Element root = doc.getRootElement(); Namespace ns = Namespace.getNamespace("http://www.example.com"); Element type = new Element("type"); Element prop = new Element("prop"); // Add as a child of <root> root.addContent(type); // Set namespace on type.setNamespace(ns); type.addContent(new Element("OBJECT_TYPE").setText(objType.getObjectType())); // Turn off namespace on prop.setNamespace(Namespace.NO_NAMESPACE); // Add as a child of type.addContent(prop); prop.addContent(new Element("DESCRIPTION").setText(property.getDescription())); prop.addContent(new Element("PARENT").setText(property.getParent())); prop.addContent(new Element("VIRTUAL").setText(property.getVirtual())); prop.addContent(new Element("VISIBLE").setText(property.getVisible())); prop.addContent(new Element("PICTURE").setText(property.getPicture())); prop.addContent(new Element("HELP").setText(property.getHelp())); prop.addContent(new Element("MIN_NO").setText(property.getMin_no())); prop.addContent(new Element("MAX_NO").setText(property.getMax_no())); prop.addContent(new Element("NAME_FORMAT").setText(property.getName_format())); XMLOutputter xmlOutput = new XMLOutputter(Format.getPrettyFormat()); // Create a new file and write XML to it xmlOutput.output(doc, new FileOutputStream(new File(XMLEditorS…
tagged with: namespaces
has title: namespaces and JDOM
type: AnsweredQuestion
score: 7
tagged with: java
upvote count: 7
type: Question
tagged with: jdom

http://stackoverflow.com/comment/32939422
type: Comment
has text: @kapilchhattani - It assigns 1 to `n` if `n` is `null`; otherwise it assigns `the value of ++n` to `n`. The effect is to treat a new key `w` as having an initial count of 0.
comment on: http://stackoverflow.com/a/21773111
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32875513
has text: @user2985842: Because it is unboxing the value of `true` contained in the `Boolean` object.
comment on: http://stackoverflow.com/a/21737187
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21812712
score: 8
upvote count: 8
type: Answer
has body: Calling those methods only requires that the current thread be the owner of the object`s monitor. However, that could mean calling a method without synchronized from within the context of another synchronized block. For example: public void doWait(Object o) { o.wait(); // you would like the compiler to flag this } // but in this case it is valid synchronized(this) { doWait(this); } In general, there is now way to know at compile time whether any piece of code will be executed when the current thread does not hold a particular monitor, which is likely why the compiler does not even try to flag this.
answers question: http://stackoverflow.com/q/21812653
accepted answer of: http://stackoverflow.com/q/21812653
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/124590155
type: QuestionComment
has text: @SteveCohen did you ever find a solution?
score: 0
comment on: http://stackoverflow.com/q/21688814
type: Comment

http://stackoverflow.com/q/21748687
type: UnansweredQuestion
tagged with: recursion
score: 2
tagged with: java
has title: Recursive Division Maze Generation Algorithm
has answer: http://stackoverflow.com/a/21748768
has answer: http://stackoverflow.com/a/21749191
has body: I currently in processing making a recursive division maze generating algorithm and I think I'm almost there. I currently have a 2-dimensional array, 20 cells wide, 15 cells tall. The array contains cell objects, which holds rows, columns and a boolean variable to indicate whether or not it's a wall. When ever I uncomment generateMaze(height, maxWidth-randomColumn, 1, randomColumn+1); I get a stackoverflow. Without it, it will only traverse left and up, I need to make it traverse right and down as well. I've been staring at this for long time to figure out why but just cannot see to do it. EDIT: I can generate something now, but the maze is often blocked, that is, there are paths that are blocked. So If I set up an random starting location, it might be surrounded by walls. private void generateMaze(int minColumn, int maxColumn, int minRow, int maxRow){ int width = maxColumn - minColumn; int height = maxRow-minRow; if (width &gt; 2 &amp;&amp; height &gt; 2){ if ("VERTICAL".equals(getOrientation(height, width))){ splitVertical(minColumn, maxColumn, minRow, maxRow); } else{ splitHorizontal(minColumn, maxColumn, minRow, maxRow); } } } private void splitVertical (int minColumn, int maxColumn, int minRow, int maxRow){ int randomColumn = getRandomNumber(minColumn, maxColumn); for (int i= minRow; i &lt; maxRow; i++){ maze[i][randomColumn] = new Cell (i+1, randomColumn+1, true); } maze[(getRandomNumber(minRow, maxRow))][randomColumn].setWall(false); generateMaze(minColumn, randomColumn, minRow, maxRow); generateMaze(randomColumn, maxColumn, minRow, maxRow); } private void splitHorizontal (int minColumn, int maxColumn, int minRow, int maxRow){ int randomRow = getRandomNumber(minRow, maxRow); for (int i = minColumn; i &lt; maxColumn; i++){ maze[randomRow][i] = new Cell (randomRow+1, i+1, true); } generateMaze(minColumn, maxColumn, minRow, randomRow); generateMaze(minColumn, maxColumn, randomRow, maxRow); } private String getOrientation(int height, int width) { Random rand = ne…
type: Question
has answer: http://stackoverflow.com/a/21765996
downvote count: 0
tagged with: maze
tagged with: tail-recursion
answer count: 3
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/21720164
has body: Do like this for(int i=1;i&lt;3;i++){ System.out.println("ABC00000"+i); }
score: 0
answers question: http://stackoverflow.com/q/21720130
type: Answer

http://stackoverflow.com/a/21765778
type: Answer
has comment: http://stackoverflow.com/comment/32943506
answers question: http://stackoverflow.com/q/21761007
has body: Don't write code for this. Just add the self-signed certificate to your test environment truststore.
has comment: http://stackoverflow.com/comment/32941575
score: 0

http://stackoverflow.com/comment/32826728
type: QuestionComment
comment on: http://stackoverflow.com/q/21709464
score: 0
has text: Well, there are really not much resources out there, but some stackoverflow crawlers: http://queforum.com/programming-languages-basics/640632-java-what-orthogonal-hash-functions.html
type: Comment

http://stackoverflow.com/a/21791495
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32972410
score: 4
has comment: http://stackoverflow.com/comment/32972396
has comment: http://stackoverflow.com/comment/32973134
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32973289
has comment: http://stackoverflow.com/comment/32972315
has comment: http://stackoverflow.com/comment/32973385
has comment: http://stackoverflow.com/comment/32972561
accepted answer of: http://stackoverflow.com/q/21791472
upvote count: 4
has body: A LinkedList in Java is a doubly linked list, meaning each node has a reference to the next and previous in the list. When the iterator does a remove, it has a reference to the current node and simply reassigns the references in the next and previous (updating the head and tail references for the list itself if needed). So, no; there is no additional iteration performed. Also worth noting is that Java is open source these days. You can view the source for LinkedList here with the code the iterator's remove() calls here Edit to Add: As noted in the comments, an iterator for a singly-linked list implementation could easily keep track of the previous node it iterated over and perform the same operation.
answers question: http://stackoverflow.com/q/21791472

http://stackoverflow.com/comment/32773192
type: QuestionComment
has text: possible duplicate of [How can I programmatically determine my processor type?](http://stackoverflow.com/questions/1020581/how-can-i-programmatically-determine-my-processor-type)
comment on: http://stackoverflow.com/q/21679787
score: 0
type: Comment

timer
tag name: timer
tags question: http://stackoverflow.com/q/21814098
tags question: http://stackoverflow.com/q/21814390
tags question: http://stackoverflow.com/q/21724101
tags question: http://stackoverflow.com/q/21694833
type: Tag
tags question: http://stackoverflow.com/q/21815562
tags question: http://stackoverflow.com/q/21707089
tags question: http://stackoverflow.com/q/21686353
tags question: http://stackoverflow.com/q/21682031
tags question: http://stackoverflow.com/q/21727716
tags question: http://stackoverflow.com/q/21768663
tags question: http://stackoverflow.com/q/21689021
tags question: http://stackoverflow.com/q/21801180

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/21704593
tags question: http://stackoverflow.com/q/21723456
tags question: http://stackoverflow.com/q/21743660
tags question: http://stackoverflow.com/q/21748035
tags question: http://stackoverflow.com/q/21814237
tags question: http://stackoverflow.com/q/21724468
tags question: http://stackoverflow.com/q/21704449
tags question: http://stackoverflow.com/q/21807686
tags question: http://stackoverflow.com/q/21773439
tags question: http://stackoverflow.com/q/21743122
tags question: http://stackoverflow.com/q/21720277
tags question: http://stackoverflow.com/q/21807941
tags question: http://stackoverflow.com/q/21770908
tags question: http://stackoverflow.com/q/21708392
tags question: http://stackoverflow.com/q/21713784
tags question: http://stackoverflow.com/q/21815824
tags question: http://stackoverflow.com/q/21749648
tags question: http://stackoverflow.com/q/21772651
tags question: http://stackoverflow.com/q/21790960
type: Tag
tags question: http://stackoverflow.com/q/21733962
tags question: http://stackoverflow.com/q/21797000
tags question: http://stackoverflow.com/q/21683577
tags question: http://stackoverflow.com/q/21764131
tags question: http://stackoverflow.com/q/21688898
tags question: http://stackoverflow.com/q/21800802
tags question: http://stackoverflow.com/q/21838408
tags question: http://stackoverflow.com/q/21703338
tags question: http://stackoverflow.com/q/21734371
tags question: http://stackoverflow.com/q/21688886
tags question: http://stackoverflow.com/q/21808477
tags question: http://stackoverflow.com/q/21821154
tags question: http://stackoverflow.com/q/21837670
tags question: http://stackoverflow.com/q/21678901
tags question: http://stackoverflow.com/q/21833130
tags question: http://stackoverflow.com/q/21807530
tags question: http://stackoverflow.com/q/21825263
tags question: http://stackoverflow.com/q/21705713
tags question: http://stackoverflow.com/q/21832258
tags question: http://stackoverflow.com/q/21723199
tags question: http://stackoverflow.com/q/21734198
tags question: http://stackoverflow.com/q/21751624
tags question: http://stackoverflow.com/q/21709707
tags question: http://stackoverflow.com/q/21791838
tags question: http://stackoverflow.com/q/21725687
tags question: http://stackoverflow.com/q/21840841
tags question: http://stackoverflow.com/q/21683732
tags question: http://stackoverflow.com/q/21834810
tags question: http://stackoverflow.com/q/21753604
tags question: http://stackoverflow.com/q/21808817
tags question: http://stackoverflow.com/q/21715976
tags question: http://stackoverflow.com/q/21750291
tags question: http://stackoverflow.com/q/21727131
tags question: http://stackoverflow.com/q/21834286
tags question: http://stackoverflow.com/q/21746249
tags question: http://stackoverflow.com/q/21827340
tags question: http://stackoverflow.com/q/21745130
tags question: http://stackoverflow.com/q/21797374
tags question: http://stackoverflow.com/q/21757091
tags question: http://stackoverflow.com/q/21744412
tags question: http://stackoverflow.com/q/21727745
tags question: http://stackoverflow.com/q/21704629
tags question: http://stackoverflow.com/q/21737094
tags question: http://stackoverflow.com/q/21773092
tags question: http://stackoverflow.com/q/21684272
tags question: http://stackoverflow.com/q/21841136
tags question: http://stackoverflow.com/q/21764210
tags question: http://stackoverflow.com/q/21701989
tags question: http://stackoverflow.com/q/21719958
tags question: http://stackoverflow.com/q/21727961
tags question: http://stackoverflow.com/q/21701593
tag name: xml
tags question: http://stackoverflow.com/q/21734173
tags question: http://stackoverflow.com/q/21744002
tags question: http://stackoverflow.com/q/21792899
tags question: http://stackoverflow.com/q/21709127
tags question: http://stackoverflow.com/q/21804054
tags question: http://stackoverflow.com/q/21821272
tags question: http://stackoverflow.com/q/21834285
tags question: http://stackoverflow.com/q/21785120

http://stackoverflow.com/q/21786328
score: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21787634
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has title: How to conditionally select a node in XPath
has answer: http://stackoverflow.com/a/21787111
tagged with: java
upvote count: 1
type: Question
has body: The XSD schema I am working with, calls for either an international or domestic address: "/mns:PhysicalAddress/mns:DomesticAddress/mns:City" or "/mns:PhysicalAddress/mns:InternationalAddress/mns:City" It is being used as a parameter in a Java method as in XMLUtils.BuildField(Document doc, String xpath). I know I can go straight to the Java object that created that doc and use the auto-generated beans to query elements, but I prefer remaining within the concise realm of XPath. Is this possible? If so, how do I write an XPath expression selects mns:City regardless of whether it is international or domestic address? Note: This in Java, not Javascript, HTML or XSLT, so I don't think &lt;xsl:if&gt; is relevant here.
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/32795714
type: Comment
comment on: http://stackoverflow.com/a/21690965
score: 0
type: AnswerComment
has text: So I assumed that the library you were using was a working implementation. Turns out it's broken for all intents and purposes when you use different jdk versions between serialization and deserialization (ref: http://xstream.10960.n7.nabble.com/Can-t-deserialize-old-xml-with-SynchronizedRandomAccessList-td8305.html ).

http://stackoverflow.com/comment/33017534
score: 0
type: Comment
type: QuestionComment
has text: I didn't mean it to be. It's just one of the common questions on here.
comment on: http://stackoverflow.com/q/21816729

http://stackoverflow.com/q/21694299
has title: Make radio button mandatory in JSP
has body: Can somebody please help me to create a mandatory radio button in JSP? Idea is to prompt the user to check the radio box when he parses through the page, and once he checks either of the radio button (Yes or No) we capture the value and save it to Db. By default radio should be blank it should be blank.
has comment: http://stackoverflow.com/comment/32799146
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/32799008
tagged with: java
type: Question
tagged with: jsp
tagged with: javascript
linked to: http://stackoverflow.com/q/1423777
score: -1
has answer: http://stackoverflow.com/a/21695024
accepted answer: http://stackoverflow.com/a/21695024
tagged with: radiobuttonlist
tagged with: radio-button
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/32805849
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21697949
has text: Could you post the code that produced this exception?

http://stackoverflow.com/comment/33017326
has text: You should post the exception stack trace as well. This seems as if the outside code (that calls your ButtonListener) has still references to the last row, which you remove, so, after return from ButtonListener, the your caller that still wants to access the last row gets an error. But the stack trace would be needed to find out what exactly triggers the exception.
comment on: http://stackoverflow.com/q/21816877
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32859856
comment on: http://stackoverflow.com/q/21725398
score: 0
type: QuestionComment
has text: Someone else asked almost this exact question today. I'll try and find it.
type: Comment

http://stackoverflow.com/comment/33061245
has text: Yeah but if I put that in, it removes my button too
comment on: http://stackoverflow.com/a/21841648
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21698737
has comment: http://stackoverflow.com/comment/32806480
score: -1
tagged with: jakarta-mail
answer count: 2
has answer: http://stackoverflow.com/a/56017111
downvote count: 1
favorite count: 0
has body: I am facing problem related to authentication with exchange server 2010. Same was working with 2007. Below is debugging logs. Properties props = System.getProperties(); &lt;br/&gt; props.setProperty("mail.debug.auth", "false"); &lt;br/&gt; Session session = Session.getInstance(props, null); &lt;br/&gt; session.setDebug(debug); &lt;br/&gt; store = session.getStore("pop3"); &lt;br/&gt; store.connect(host, user, password); &lt;br/&gt; The Debug logs are: +OK The Microsoft Exchange POP3 service is ready. CAPA +OK TOP UIDL SASL NTLM GSSAPI PLAIN USER STLS DEBUG POP3: authentication command trace suppressed DEBUG POP3: authentication command failed QUIT +OK Microsoft Exchange Server 2010 POP3 server signing off. javax.mail.AuthenticationFailedException: Logon failure: unknown user name or bad password. at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:209) at javax.mail.Service.connect(Service.java:345)
tagged with: pop3
type: UnansweredQuestion
has title: Javamail issue with authentication using POP3 protocol
has comment: http://stackoverflow.com/comment/32806809
has comment: http://stackoverflow.com/comment/32813945
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21720625
tagged with: authentication
type: Question

http://stackoverflow.com/comment/32891078
score: 0
type: Comment
type: QuestionComment
has text: So in that case it's just a big empty white box eh? That's pretty bad. You could always try digging into the implementation of Wizard/WizardPage to see what draws that area and implement your own version - IWizard and IWizardPage are just interfaces after all...
comment on: http://stackoverflow.com/q/21745814

http://stackoverflow.com/comment/32881096
comment on: http://stackoverflow.com/q/21737981
has text: The calendar add-on is the same as the built in calendar now. In the past it was a add-on, now it's integrated into the core. We did try to use the calendar in one of our projects, but due to the whole thing missing serious documentation and also having restrictions on 30minutes units we now use our own calendar, simply based on a table.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32964700
has text: Why not `setExtendedState(JFrame.MAXIMIZED_BOTH)` instead?
score: 0
comment on: http://stackoverflow.com/q/21785837
type: Comment
type: QuestionComment

authentication
tags question: http://stackoverflow.com/q/21827216
tags question: http://stackoverflow.com/q/21837126
tags question: http://stackoverflow.com/q/21797480
tags question: http://stackoverflow.com/q/21749910
tags question: http://stackoverflow.com/q/21698737
tag name: authentication
type: Tag
tags question: http://stackoverflow.com/q/21713666
tags question: http://stackoverflow.com/q/21696651
tags question: http://stackoverflow.com/q/21815311
tags question: http://stackoverflow.com/q/21680965
tags question: http://stackoverflow.com/q/21720397
tags question: http://stackoverflow.com/q/21734225
tags question: http://stackoverflow.com/q/21819628
tags question: http://stackoverflow.com/q/21752835
tags question: http://stackoverflow.com/q/21804925

http://stackoverflow.com/a/21745962
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21745622
answers question: http://stackoverflow.com/q/21745622
upvote count: 2
type: AcceptedAnswer
has body: Looks like you don't have clear understanding about import statement. Basically there are Java's own libraries means many many jars containing many many classes, by default, only those are accessible to JVM. So using import we can contact with any class that is inside those jars. If you want to use a class that is not from default java libraries you need to add the jar that contains that class and after jvm is able to contact that class then you need to import that class by import a.b.c.d.CSVWriter. Make sense?

http://stackoverflow.com/comment/33025424
type: Comment
type: QuestionComment
has text: Show us, what you have tried.
comment on: http://stackoverflow.com/q/21821492
score: 0

http://stackoverflow.com/q/21799731
tagged with: linux
upvote count: 2
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/32986910
has comment: http://stackoverflow.com/comment/32986867
score: 2
tagged with: java
tagged with: transparent
has body: I want my JFrame as transparent.I'm using below code to make it transparent.It is working well on Windows but on Linux it makes all JComponet as transparent. Here is the look of JFrame on windows and linux My Code: public class NewJFrame extends javax.swing.JFrame { /** * Creates new form NewJFrame */ public NewJFrame() { setUndecorated(true); setBackground(new Color(0,0,0,0)); initComponents(); jLabel1.setIcon(new ImageIcon(getClass().getResource("device_pc.png"))); } /** * 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;//GEN-BEGIN:initComponents private void initComponents() { jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jButton1.setText("jButton1"); jButton2.setText("jButton2"); jButton3.setText("jButton3"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(128, 128, 128) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton3) .addGroup(layout.createSequentialGroup() .addComponent(jButton2) .addGap(59, 59, 59) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jButton1)) .addContainerGap(31, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(25, 25, 25) .addComponent(jButton1) .addGap(18, 18, 18) .addGroup(layout.createPar…
type: Question
linked to: http://stackoverflow.com/q/21771215
has comment: http://stackoverflow.com/comment/32986712
has answer: http://stackoverflow.com/a/21854294
answer count: 1
downvote count: 0
has title: Setting JFrame as transparent makes all JComponet as transparent in Linux
favorite count: 0

http://stackoverflow.com/a/34058580
has comment: http://stackoverflow.com/comment/55939211
type: Answer
has comment: http://stackoverflow.com/comment/55938869
answers question: http://stackoverflow.com/q/21825959
has body: I know that this question already has good answers. But I had some issues with the selected answer. And I just want to help someone who is looking for the same solution. I noticed some strange behaviour with the selected answer. I doesn't keep the Y exis as up. Which is of course very important on a fps. So this one is not perfect but I wanted to put this here. // put into the create() method. Gdx.input.setInputProcessor(new InputProcessor() { private int dragX, dragY; float rotateSpeed = 0.2f; // dont' forget to override other methods. @Override public boolean mouseMoved(int screenX, int screenY) { Vector3 direction = cam.direction.cpy(); // rotating on the y axis float x = dragX -screenX; // change this Vector3.y with cam.up if you have a dynamic up. cam.rotate(Vector3.Y,x * rotateSpeed); // rotating on the x and z axis is different float y = (float) Math.sin( (double)(dragY -screenY)/180f); if (Math.abs(cam.direction.y + y * (rotateSpeed*5.0f))&lt; 0.9) { cam.direction.y += y * (rotateSpeed*5.0f) ; } cam.update(); dragX = screenX; dragY = screenY; return true; } }); NOTE: Don't use any camera controllers. NOTE2: This might come handy: Gdx.input.setCursorCatched(true); EDIT: I just wanted to share the walking function I use to change position of the camera with wasd keys. When W key is down the forward is true. And when the key is up forward is false. Other directions have the same principle. To detect the key down and up, please use the InputProcessor in the above code. This creates movement in the two dimensional space (X-Z axises). The direction of the camera will not change the direction of the movement as we are eliminating the Y axis. of the direction. One must now even if camera is directed to the sky (at a non 90 degree angle with the ground), the length of the direction vector is not fixed to 1.0f. So there will not be any loss of movement speed. To test this I rotated camera up and down (moved the mouse forward and backward) and the x and z values of the…
upvote count: 3
has comment: http://stackoverflow.com/comment/56004229
score: 3
has comment: http://stackoverflow.com/comment/55873072
downvote count: 0
has comment: http://stackoverflow.com/comment/55939253
has comment: http://stackoverflow.com/comment/55939373

http://stackoverflow.com/q/21834521
type: Question
has body: I've been having problems about this: public class Student implements Comparable { private int id; private String name; public int compareTo(Student other) { return 1; // This is just an example value } } This program doesn't compile, as it says that it doesn't override the method "compareTo()" . Now why is that? But if I use the following class header public class Student implements Comparable&lt;Student&gt;{...} it works fine. I need some explanation about this. By the way a lot of internet examples of the "Comparable" interface use the first class header, I mean without the Comparable.
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/2770321
accepted answer: http://stackoverflow.com/a/21834593
tagged with: interface
has answer: http://stackoverflow.com/a/21834593
has title: Difference between "implents Comparable" and "Comparable<T>"
type: AnsweredQuestion
tagged with: java
duplicate of: http://stackoverflow.com/q/2770321
tagged with: comparable

http://stackoverflow.com/comment/32945922
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21771982
score: 0
has text: pardon. that was a typo. corrected now.

http://stackoverflow.com/comment/32961542
type: Comment
type: QuestionComment
has text: So what behavior are you seeing out of the current code that is incorrect? Are you getting an error?
comment on: http://stackoverflow.com/q/21785827
score: 0

http://stackoverflow.com/a/21752414
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33456106
answers question: http://stackoverflow.com/q/21752299
has body: Don't use ${...} ie: &lt;#assign SubSummary = Summary.substring(0,140)&gt; ${...} is for printing to the outputstream
has comment: http://stackoverflow.com/comment/33034806
downvote count: 0
type: Answer

http://stackoverflow.com/q/21691360
answer count: 2
has answer: http://stackoverflow.com/a/21711776
downvote count: 0
has title: Camel and MQTT Route
tagged with: mqtt
has body: I am working on a project and have decided to use Camel and ActiveMQ. I am attempting to create a route using Java and MQTT endpoints. Within this route I have also incorporated a Processor. This is what my route looks like: from("mqtt:test?subscribeTopicName=zaq.avila.send") //.process(new RestProcessor()) .to("mqtt:test?publishTopicName=zaq.avila.receive"); From my understanding, the route is consuming from zaq/avila/send, a processor is applied and then the message is published to zaq/avila/receive. The to() part does not appear to be happening, when I check the console, I see that the processor executes though no message is published to zaq/avila/receive. Also, within the web console I see that the messages in zaq/avila/send for enqueued and dequeued increment even when I only pusblished one message. In addition, if I shutdown ActiveMQ I get the following: INFO | Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 7 seconds. Also: WARN | Error occurred while shutting down service: Endpoint[mqtt://test?publish TopicName=zaq.avila.receive]. This exception will be ignored. java.lang.NullPointerException These exception make me wonder that the exchange is not completing and something is missing. I need help!
favorite count: 0
score: 2
accepted answer: http://stackoverflow.com/a/21711776
has answer: http://stackoverflow.com/a/21692074
upvote count: 2
possible better answer: http://stackoverflow.com/a/21692074
type: AnsweredQuestion
tagged with: java
tagged with: apache-camel
type: Question

http://stackoverflow.com/a/21799608
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21799499
has comment: http://stackoverflow.com/comment/32986589
upvote count: 2
has body: A char array, when constructed, is filled with 0. Your loop sets the output char array element i to the same value as the input char array element i if this element is not a whitespace. Otherwise, it leaves the output element as it is (and its value is thus 0). You need to have seperate indices for your input array and your output array, since you want to skip white spaces. So, assuming the input array has 8 chars and two of them are white spaces, the 6 first elements of your output array should be filled, and the last two ones should be set to whatever you want them to be set. 0 1 2 3 4 5 6 7 8 9 10 input: h e l l o t h e r e output: h e l l o t h e r e ? You see in the above example that the indices of the characters don't match. I assume this is some kind of homework. If it's not, then by all means use a StringBuilder to build your output string.

http://stackoverflow.com/comment/33018342
comment on: http://stackoverflow.com/q/21817509
score: 0
type: Comment
has text: You don't! do your validations/dispatching for `{individual}` inside the controller
type: QuestionComment

http://stackoverflow.com/a/21731487
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21730939
has body: There is nothing in the Driver API mandating that the URL you pass to DriverManager to connect to your database has a host name and a port. If your database does not listen on the network but is just an executable you run, the url could be the path to that url. For an embedded database your url could carry no information bar the prefix necessary to invoke your driver. So don't worry about network connections if your database doesn't work that way. As comments say, embedded databases like SQLite use non network based URLs.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/21730939
type: AcceptedAnswer

http://stackoverflow.com/a/38480149
score: -3
has body: testname testrun ${testname}.log ${testname}.%i.log 1 100 10MB %d{ISO8601} %-5level %C{1} [%M:%L] [%thread] - %msg%n
downvote count: 3
answers question: http://stackoverflow.com/q/21832368
type: Answer
has comment: http://stackoverflow.com/comment/64376164
upvote count: 0

http://stackoverflow.com/comment/33010504
type: AnswerComment
type: Comment
has text: @user3314952 The slider changed the `value` of the instance `pro1 p = new pro1();` that was created in `pro2`. But the progress bar showed the `value` from the `pro1 p = new pro1();` that was created in the main method. So the `value` that was modified with the slider was a different one than the `value` that was shown in the progress bar. (And additionally, the progress bar was not updated)
comment on: http://stackoverflow.com/a/21806602
score: 0

http://stackoverflow.com/q/21689956
has comment: http://stackoverflow.com/comment/32792254
has comment: http://stackoverflow.com/comment/32792308
upvote count: 0
has body: Is there any way to use alpha in a BufferedImage that uses INT_RGB? I'm using a 1D pixel array to render sprites onto the screen but I wanted to be able to use Alpha. Is there any way to mix the colors and achieve some sort of layer system like in photoshop? I've been trying to create some custom alpha by mixing colors, but im not quite sure how to do that either. This is what I have so far: BufferedImage &amp; Pixel array: BufferedImage image = new BufferedImage(width / scale, height / scale, BufferedImage.TYPE_INT_RGB); int[] pixels = ((DataBufferInt)image.getRaster().getDataBuffer()).getData(); Method used to render sprite: public static void drawSprite(Sprite sprite, int coord_x, int coord_y) { int boundsX = (coord_x + sprite.width), boundsY = (coord_y + sprite.height), index = -1, pixels[] = Screen.pixels; for(int y = coord_y; y &lt; boundsY; y++) { for(int x = coord_x; x &lt; boundsX; x++) { index++; if(Screen.pixels[x + y * width] == 0) { Screen.pixels[x + y * width] = sprite.pixels[index]; } else { int[] screenPixel = intToARGB(Screen.pixels[x + y * width]); int[] spritePixel = intToARGB(sprite.pixels[index]); int[] newPixel = new int[4]; newPixel[0] = (screenPixel[0] + spritePixel[0]) / 2; newPixel[1] = (screenPixel[1] + spritePixel[1]) / 2; newPixel[2] = (screenPixel[2] + spritePixel[2]) / 2; newPixel[3] = (screenPixel[3] + spritePixel[3]) / 2; Screen.pixels[x + y * width] = Integer.parseInt((Integer.toString(newPixel[0]) + Integer.toString(newPixel[1]) + Integer.toString(newPixel[2]) + Integer.toString(newPixel[3]))); } } } }
type: UnansweredQuestion
tagged with: colors
has comment: http://stackoverflow.com/comment/32792764
has title: Java: BufferedImage INT_RGB Alpha?
has answer: http://stackoverflow.com/a/21701776
score: -1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/32792300
has comment: http://stackoverflow.com/comment/32792444
has comment: http://stackoverflow.com/comment/32792198
has comment: http://stackoverflow.com/comment/32792130
has comment: http://stackoverflow.com/comment/32792384
has comment: http://stackoverflow.com/comment/32792643
has comment: http://stackoverflow.com/comment/32792552
tagged with: java
tagged with: image-processing
has comment: http://stackoverflow.com/comment/32795033
tagged with: bufferedimage
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32794806
has comment: http://stackoverflow.com/comment/32792410
has comment: http://stackoverflow.com/comment/32792741

http://stackoverflow.com/a/21766686
accepted answer of: http://stackoverflow.com/q/21766247
has comment: http://stackoverflow.com/comment/32928528
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21766247
downvote count: 0
has body: There is a web admin interface to tomcat that allows you to redeploy a single application. You use something like curl to hit the URL's via command line to make your application redeploy.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21793967
has comment: http://stackoverflow.com/comment/32977446
has comment: http://stackoverflow.com/comment/32976416
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32976430
has comment: http://stackoverflow.com/comment/32976439
linked to: http://stackoverflow.com/q/529085
type: UnansweredQuestion
has title: Pass generic type params to syncTask
downvote count: 1
has comment: http://stackoverflow.com/comment/32976440
tagged with: java
has body: I have a need to pass a value of Map&lt;String, String&gt; type to Android's AsyncTask. Unfortunately AsyncTask's callback doInBackground(Params... params) and execute(Params... params) method accept varargs. We know that varargs gets turned into arrays and we cannot create arrays of generic types. How can I pass my parameter to execute?
score: -1
type: Question
linked to: http://stackoverflow.com/q/12462079
upvote count: 0
has answer: http://stackoverflow.com/a/21797908

http://stackoverflow.com/q/21815156
has answer: http://stackoverflow.com/a/21874988
type: Question
linked to: http://stackoverflow.com/q/21869923
answer count: 2
has comment: http://stackoverflow.com/comment/33014362
has comment: http://stackoverflow.com/comment/33014344
has comment: http://stackoverflow.com/comment/33014567
tagged with: arraylist
has answer: http://stackoverflow.com/a/21815653
accepted answer: http://stackoverflow.com/a/21815653
downvote count: 3
has title: Is an arraylist able to function with JOptionPane
favorite count: 0
score: -3
has comment: http://stackoverflow.com/comment/33014651
has comment: http://stackoverflow.com/comment/33014397
possible better answer: http://stackoverflow.com/a/21874988
tagged with: joptionpane
type: AnsweredQuestion
upvote count: 0
has body: I am wondering if an arraylist list will be able to function with a JOptionPane window. I am trying to branch out from just using the command console in windows so I am trying to understand how to work with JOptionPane. for example psudocode : import javax.swing.*; import java.util.*; import java.io.*; public class try1 { private static JPanel panel = new JPanel(); private static try2 testing = new try2 (); public static Integer testnum; public static void main (String[] args) { testnum = Integer.parseInt(JOptionPane.showInputDialog(null, "Please Enter The Amount Of Test To Be Calculated Below ")); tryMe (); } public static void tryMe () { int userInput = 0; Object[] options1 = { " ENTER " , " GET AVERAGE " }; panel.add(new JLabel(" PLEASE ENTER ALL THE FOLLOWING TEST GRADES TO CALCULATE ")); JTextField textField = new JTextField(10); panel.add(textField); if (userInput == JOptionPane.YES_OPTION) { for ( int count = 1; count &lt;= testnum; count++) { userInput = JOptionPane.showOptionDialog(null, panel, " TEST AVERAGE PROGRAM " ,JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE,null, options1, null); try2 testing = new try2 (userInput); // sending this to my class. } } if (userInput == JOptionPane.NO_OPTION) { testing.setAvg (); JOptionPane.showMessageDialog(null,"You average is" + (testing.getAvg())); } } } class try2 { public static ArrayList&lt;Integer&gt;userInput=new ArrayList&lt;Integer&gt;(); public static double avg; public try2() { } public try2(int i) { userInput.add(i); } public static void setAvg () { try { int sum = 0; for ( int x = 0 ; x &lt; userInput.size(); x++) { sum += userInput.size() ; } avg = sum / userInput.size(); if ( avg &lt; 0 || avg &gt; 100) { IllegalArgumentException ex; } } catch ( IllegalArgumentException ex) { } } public static double getAvg () { return avg; } } I started with this example in order to see how this works, can anyone tell me what I am doing wrong. So this is were I am stuck at the Jpanel comes up, so it is go…
tagged with: java

http://stackoverflow.com/comment/32894838
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21733515
has text: and this was always my url: jdbc:oracle:thin...blabla.. so i just have to change the fields name to its value in the prop
score: 0

http://stackoverflow.com/a/21722734
has comment: http://stackoverflow.com/comment/32855546
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32854669
accepted answer of: http://stackoverflow.com/q/21722486
answers question: http://stackoverflow.com/q/21722486
has comment: http://stackoverflow.com/comment/32857154
type: AcceptedAnswer
downvote count: 0
has body: Try with a Webview. With the intent ACTION_VIEW, you have no control over the page you are displaying as you are using an external application (browser) that intercepts your intent. You can check setInitialScale method for instance. A better way to handle this would be to handle the display directly on the asp page if you have control over it.
type: Answer
has comment: http://stackoverflow.com/comment/32858755

http://stackoverflow.com/comment/32853879
score: 0
type: Comment
has text: Ok i removed regular expression. now it is working..thank you
comment on: http://stackoverflow.com/a/21725197
type: AnswerComment

http://stackoverflow.com/comment/32785755
comment on: http://stackoverflow.com/q/21686984
type: Comment
type: QuestionComment
score: 1
has text: [Obligatory "don't do this" link](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags).

http://stackoverflow.com/q/21702573
has answer: http://stackoverflow.com/a/21703449
has title: synchronize jtextfield value into only integer value using document listener
tagged with: swing
has answer: http://stackoverflow.com/a/21702880
has comment: http://stackoverflow.com/comment/32813657
type: AnsweredQuestion
score: 0
possible better answer: http://stackoverflow.com/a/21702880
tagged with: java
tagged with: jtextfield
type: Question
linked to: http://stackoverflow.com/q/6492648
answer count: 2
accepted answer: http://stackoverflow.com/a/21703449
linked to: http://stackoverflow.com/q/9011524
has body: Following the Question Synchronize JTextField values by property change listener I have tried to modify the example from the answer using document listener. What I wanted to modify was to synchronize only integers. For example, if I put '2' in field1 then it would multiply by '5' so that the value would be '10' in the field2. However, I have followed various methods but I am having some errors such as: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "" Moreover, when I delete all values from field1, the last synchronized field2 value remains whereas field2 also supposed to be null as field1. I am not sure which part I have made mistake. Here is my code sample for the UpdateLabel Method: private void updateLabel(DocumentEvent e) { java.awt.EventQueue.invokeLater(new Runnable() { String text = field.getText(); String text1 = field1.getText(); @Override public void run() { if(text == null &amp;&amp; text1 != null){field1.setText(null); }else if(text.contains("-") || text.contains(".") || text.matches(".*[a-zA-Z].*")|| text.matches(".*\\p{Punct}.*")){ {JOptionPane.showMessageDialog(frame = new JFrame(), "Please put appropriate int value from 0-9", "Inane error", JOptionPane.ERROR_MESSAGE); field.setText(null); field1.setText(null); } }else{ int p; p = Integer.parseInt(text); int i = (p*5); String s = String.valueOf(i); field1.setText(s); } } }); } I also want to use the '.' with integers but when I removetext.contains(".") it still shows JOptionPane error message.
has comment: http://stackoverflow.com/comment/32813329
tagged with: documentlistener
linked to: http://stackoverflow.com/q/5662651
linked to: http://stackoverflow.com/q/9477354
has comment: http://stackoverflow.com/comment/32813599

http://stackoverflow.com/a/21767608
answers question: http://stackoverflow.com/q/21767188
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32929834
has body: If you call resultSort(numbers) it works. Your algorithm sorts descending. Here is my testcode I did some small changes to make it all static. I guess the problem is, that resultSort is not called with parameter numbers. static int numbers[] = new int[]{34, 24, 56, 12, 45, 2, 53, 758}; public static void main(String[] args) { resultSort(numbers); for (int i : numbers) { System.out.println(i + " "); } } public static void resultSort(int[] resultSet) { int j; for (int i = 0; i &lt; resultSet.length; i++) { j = i; while (j &gt; 0 &amp;&amp; resultSet[j - 1] &lt; resultSet[j]) { swap(j, j - 1); j = j - 1; } } } public static void swap(int index1, int index2) { int sw = numbers[index1]; numbers[index1] = numbers[index2]; numbers[index2] = sw; }
upvote count: 1
score: 1

http://stackoverflow.com/comment/32859340
has text: It's possible to get SOE's from just recursing too deeply, even if it's not infinite - this is relatively rare in a language like Java because people don't tend to use it for deep recursive stuff, but it can happen. Generally if you need a *really* big stack though, then you've probably screwed up your design.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21728729
score: 0

http://stackoverflow.com/a/21776635
has comment: http://stackoverflow.com/comment/33070137
has comment: http://stackoverflow.com/comment/32945556
has comment: http://stackoverflow.com/comment/32945283
score: 0
type: AcceptedAnswer
has body: There are many validation utils. You can check this example: Spring MVC: How to perform validation? There is also a jsr spec about it: JSR-303 http://beanvalidation.org/1.0/spec/ Enjoy
type: Answer
has comment: http://stackoverflow.com/comment/32945155
accepted answer of: http://stackoverflow.com/q/21776578
answers question: http://stackoverflow.com/q/21776578

http://stackoverflow.com/a/21792926
score: 0
type: Answer
has body: See the below link if it helps. In my opinion it's better to let the platform handle the serializaion/deserialization instead of us doing it. Handling runtime changes
answers question: http://stackoverflow.com/q/21792215

http://stackoverflow.com/comment/49316064
comment on: http://stackoverflow.com/a/30621901
type: AnswerComment
has text: I agree. I just wanted to know how good practice is create as classes as nested objects/arrays are in a Json. Probably this approach would fit better in a huge Json file where you just want an object from it, instead for a small Json. Anyway this answer gives a solution to the original question using retrofit without having to create the root class. @Nilzor make a good point with his comment. Maybe it worth create all these transport classes and group them in a package.
score: 0
type: Comment

http://stackoverflow.com/a/21738077
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21734368
answers question: http://stackoverflow.com/q/21734368
type: Answer
has body: Create an ivy settings file with the following content: <settings defaultResolver='artifactory' /> <ibiblio name='artifactory' m2compatible='true' root="http://my.artifactory.server"/> <artifact pattern='${ivy.settings.dir}/extlib/[artifact]' /> <module organisation='NA' resolver='local' /> And declare your dependencies as follows: <dependency org='org.apache.tomcat' name='tomcat-api' rev='7.0.21' /> .. .. <dependency org='NA' name='myspecial.jar' rev='NA' /> The special "NA" organisation is configured to pull files from the "extlib" directory. The revision attribute is manadatory but generally meaningless when referring to files stored within the project directory.
score: 2

performance
tags question: http://stackoverflow.com/q/21740961
tags question: http://stackoverflow.com/q/21796337
tags question: http://stackoverflow.com/q/21777299
tags question: http://stackoverflow.com/q/21679486
tags question: http://stackoverflow.com/q/21707195
tags question: http://stackoverflow.com/q/21765780
tags question: http://stackoverflow.com/q/21741578
tags question: http://stackoverflow.com/q/21714644
tags question: http://stackoverflow.com/q/21681044
tags question: http://stackoverflow.com/q/21748078
tags question: http://stackoverflow.com/q/21728406
tags question: http://stackoverflow.com/q/21814390
tags question: http://stackoverflow.com/q/21771298
tags question: http://stackoverflow.com/q/21832872
tags question: http://stackoverflow.com/q/21714126
tags question: http://stackoverflow.com/q/21769793
tags question: http://stackoverflow.com/q/21759178
tags question: http://stackoverflow.com/q/21681560
tags question: http://stackoverflow.com/q/21801246
tags question: http://stackoverflow.com/q/21745619
tags question: http://stackoverflow.com/q/21726709
tag name: performance
tags question: http://stackoverflow.com/q/21810059
tags question: http://stackoverflow.com/q/21718384
tags question: http://stackoverflow.com/q/21683752
tags question: http://stackoverflow.com/q/21689219
tags question: http://stackoverflow.com/q/21779690
tags question: http://stackoverflow.com/q/21785544
type: Tag
tags question: http://stackoverflow.com/q/21802073
tags question: http://stackoverflow.com/q/21719396

http://stackoverflow.com/q/21774622
has answer: http://stackoverflow.com/a/21963893
possible better answer: http://stackoverflow.com/a/70541853
downvote count: 0
has answer: http://stackoverflow.com/a/70541853
favorite count: 0
has title: @class getting added even though it's the defaultImpl
accepted answer: http://stackoverflow.com/a/21963893
type: AnsweredQuestion
has body: Using Jackson (the JSON/Object mapper), let's say I have the following interface and classes: @JsonTypeInfo(defaultImpl = Duck.class, use = JsonTypeInfo.Id.CLASS) public interface Animal { } public class Duck implements Animal { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } public class Park { private Animal animal; public Animal getAnimal() { return animal; } public void setAnimal(Animal animal) { this.animal = animal; } } And I try to read (deserialize) this piece of JSON: { "animal": { "name": "Quacky" } } using: Park park = objectMapper.readValue(json, Park.class); It works! Even without any type information (@class or @type) it is able to construct the Duck because I specified a defaultImpl for the Animal interface. Now I expect the same behaviour when doing it the other way around. String json = objectMapper.writeValueAsString(park); But instead I get this JSON: { "animal": { "@class": "com.example.Duck", "name": "Quacky" } } It does not seem to respect the defaultImpl when serializing! I want the "@class" attribute gone from the output file. Does anyone have any idea of how I can tell Jackson not to add the "@class" attribute for my Duck?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 5
upvote count: 5
tagged with: jackson
answer count: 2

http://stackoverflow.com/comment/32869119
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21719559
type: Comment
has text: Deleting the `~/.m2/repository/javax/servlet/` and re-running `mvn clean install` seemed to do the trick. It was able to download version "3.1.0" of javax.servlet. Thank you for the help.

http://stackoverflow.com/q/21748035
possible better answer: http://stackoverflow.com/a/21750141
upvote count: 0
favorite count: 0
has body: I have problem with updating data in my xml file. My xml file looks like this : ..... <OBJECT_TYPE>x2000</OBJECT_TYPE> fast train NULL 0 1 <PICTURE>NULL NULL <MIN_NO>1</MIN_NO> <MAX_NO>1</MAX_NO> <NAME_FORMAT>NULL</NAME_FORMAT> nidbrc <DATA_TYPE>String</DATA_TYPE> super fast <MIN_NO>1</MIN_NO> <MAX_NO>1</MAX_NO> 1 1 NULL 100:45 ... ... Here i am trying to get my first param from type number 1 and updating the first parameter of 9 public static void main(String[] args) { File xml = new File("test.xml"); try { XMLOutputter xmlOut = new XMLOutputter(); Document doc = (Document) new SAXBuilder().build(xml); Element rootNode = doc.getRootElement(); Element typeContent = rootNode.getChildren().get(1); System.out.println("typeContent : " + typeContent.getChildren()); for (int i = 0; i < typeContent.getContentSize(); i++) { List<Element> list = typeContent.getChildren("param"); if (list.size() > 0) { Element element = list.get(1); List paramChilds = element.getChildren("PARAMETER"); for (int j = 0; j < paramChilds.size(); j++) { Element node = (Element) paramChilds.get(j); System.out.println(node.getText()); // xmlOut.setFormat(Format.getPrettyFormat()); // xmlOut.output(doc, new FileWriter("test.xml")); } } } } catch (IOException io) { System.out.println(io.getMessage()); } catch (JDOMException jdomex) { System.out.println(jdomex.getMessage()); } What I find hard is to know how to dig into the xml file and therefore this one aint working but this one is null : node.getChild("PARAMETER").setText("Bla");
accepted answer: http://stackoverflow.com/a/21755224
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21752907
has answer: http://stackoverflow.com/a/21750173
downvote count: 1
type: Question
has title: updating xml node with JDOM
tagged with: jdom
has answer: http://stackoverflow.com/a/21750141
score: -1
has answer: http://stackoverflow.com/a/21755224

http://stackoverflow.com/q/21707550
tagged with: spring-data
tagged with: mysql
tagged with: concurrency
upvote count: 1
type: Question
has body: I have the following repository: public interface PlayerRealBalanceRepository extends JpaRepository&lt;PlayerRealBalance, Long&gt; { @Modifying @Query("update PlayerRealBalance balance set balance.balance = (balance.balance + ?1) where balance.id = ?2") public void increaseBalance(long amount, long balanceId); } My Question - is this query thread safe? what if 2 concurrent queries like this are executed exactly at the same time? Do i have to use a lock method in order for it to work properly? Thanks!
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21707906
type: UnansweredQuestion
has title: Spring data - modifying query concurrency
tagged with: spring
score: 1
tagged with: java

http://stackoverflow.com/comment/32878122
comment on: http://stackoverflow.com/q/21738673
score: 1
type: Comment
type: QuestionComment
has text: Also you can do something like @BackSlash say, but will be better if you can store only the hash and have a call to return this hash on your webservice, so you don't need to do the download just to check the file

http://stackoverflow.com/a/21825515
answers question: http://stackoverflow.com/q/21825252
has comment: http://stackoverflow.com/comment/33032427
downvote count: 1
has comment: http://stackoverflow.com/comment/33032722
has comment: http://stackoverflow.com/comment/33033617
has comment: http://stackoverflow.com/comment/33033527
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33035300
has body: String input = " 12697 26 "; StringBuilder s = new StringBuilder(input); for (int i = 0 ; i&lt;s.length() &amp;&amp; s.charAt(i) == ' ' ; i++) { s.setCharAt(i, '0'); } System.out.printf("'%s'", s.toString()); '00012697 26 '
has comment: http://stackoverflow.com/comment/33034325
score: 1

http://stackoverflow.com/comment/33034478
has text: IMHO, `19611015` means `1961-10-15`. And `19611015 * 1000` overflows.
type: Comment
comment on: http://stackoverflow.com/a/21826750
score: 0
type: AnswerComment

android-canvas
tags question: http://stackoverflow.com/q/21723958
type: Tag
tag name: android-canvas

app-store
tag name: app-store
type: Tag
tags question: http://stackoverflow.com/q/21839357

http://stackoverflow.com/q/21826352
tagged with: jdbc
has title: Unable to get JDBC connection in Spring application to MySQL
possible better answer: http://stackoverflow.com/a/29682302
tagged with: database-connection
has answer: http://stackoverflow.com/a/29682302
accepted answer: http://stackoverflow.com/a/21982522
tagged with: spring
has body: I have following DB Configuration in Spring: <property name="url" value="jdbc:dburl" /> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="username" value="username" /> <property name="password" value="passworf" /> <property name="removeAbandoned" value="true" /> <property name="initialSize" value="3" /> <property name="maxActive" value="5" /> Additional Configuration to load property values from DB. <constructor-arg type="javax.sql.DataSource" ref="dataSource" /> <constructor-arg index="1" value="tablename1" /> <constructor-arg index="2" value="columnname" /> <constructor-arg index="3" value="columnvalue" /> <constructor-arg ref="config1" /> <property name="ignoreUnresolvablePlaceholders" value="false"/> <property name="properties" ref="configFactory1" /> <constructor-arg type="javax.sql.DataSource" ref="dataSource" /> <constructor-arg index="1" value="tablename2" /> <constructor-arg index="2" value="columnname" /> <constructor-arg index="3" value="columnvalue" /> <constructor-arg ref="config2" /> <property name="ignoreUnresolvablePlaceholders" value="false"/> <property name="properties" ref="configFactory2" /> DAO Configuration which gives problem: <property name="dataSource" ref="dataSource" /> When I start application, I am stuck at following line: 17 Feb 2014 15:39:58,981 - main - DEBUG - org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:691) - Executing prepared SQL query 17 Feb 2014 15:39:58,983 - main - DEBUG - org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:625) - Executing prepared SQL statement [ SQL STATEMENT ] 17 Feb 2014 15:39:59,000 - main - DEBUG - org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:110) - Fetching JDBC Connection from DataSource After this line, application hangs and does not respond. It does not throw exception either. I have done following checks: Increased maxActive value. Increased initialSize value. Checked - SQL STATEMENT …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33033906
tagged with: java
has comment: http://stackoverflow.com/comment/33282866
tagged with: mysql
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33287673
has answer: http://stackoverflow.com/a/21982522
score: 0
has comment: http://stackoverflow.com/comment/33034165

http://stackoverflow.com/comment/32796468
comment on: http://stackoverflow.com/q/21692810
type: QuestionComment
has text: The error has nothing to do with a radix sort. That's just the task you're working on - might as well have been writing a Pacman clone. Also, make sure to 1) *search for the error* (there are many duplicates) and, 2) *include the actual error messages* in questions.
score: 0
type: Comment

http://stackoverflow.com/q/21826379
answer count: 2
has comment: http://stackoverflow.com/comment/33033814
score: 0
accepted answer: http://stackoverflow.com/a/21826422
tagged with: android
has body: My Android app has a login screen and the user logs in to his dashboard. But I don't want the user to login every time they close the app and start it (unless they logout from the dashboard). So, I created a class to check if the user logged in CheckLoggedIn.java public class CheckLoggedIn extends Activity { private boolean isLoggedIn = false; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); if(!isLoggedIn){ Intent intent = new Intent(this, MainActivity.class); startActivity(intent); }else{ Intent intent = new Intent(this, AgentHome.class); startActivity(intent); } } public boolean getStatus(){ return this.isLoggedIn; } public void setStatus(boolean status){ isLoggedIn = status; } } When user logs in, I change the boolean isLoggedIn to true and false when logs out. But when I checked it by logging in successfully and closing it and starting it again, it still goes to LoginActivity. Why? Edit : Now, I've understood it's because I set the boolean isLoggedIn to false at the beginning of the CheckLoggedIn.java. How can I achieve what I'm trying to do? EDIT 2 : Preference.java public class Preference { Context context; SharedPreferences sharedPref; public Preference(Context context){ this.context = context; sharedPref = context.getSharedPreferences("LoginState", 0); } public boolean getIsLoggedIn(){ return sharedPref.getBoolean("State", false); } public void setIsLoggedIn(boolean state){ SharedPreferences.Editor editor = sharedPref.edit(); editor.putBoolean("State", state); editor.commit(); } } MainActivity.java public class MainActivity extends Activity { Preference preference = new Preference(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if(preference.getIsLoggedIn()){ Log.d("State", "Already logged in"); } ...... } } Logcat 02-17 16:30:53.063: E/AndroidRuntime(21450): FATAL EXCEPTION: m…
has comment: http://stackoverflow.com/comment/33033805
possible better answer: http://stackoverflow.com/a/21826421
has answer: http://stackoverflow.com/a/21826421
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33033761
linked to: http://stackoverflow.com/q/18843625
tagged with: java
has title: Having trouble skipping an activity
has answer: http://stackoverflow.com/a/21826422
type: Question

http://stackoverflow.com/comment/33090893
score: 0
comment on: http://stackoverflow.com/a/21839997
type: AnswerComment
has text: @Dush - For clean separation DTO Validator classes should not access DAOs. If you need to validate data related constraints like unique key constraint, they should be written as part of service layer. DTO validators should validate only the DTO objects. If you can remove the DTO validator classes dependency on DAO then you can distribute DTOs along with the Validator classes.
type: Comment

http://stackoverflow.com/comment/33042347
type: AnswerComment
type: Comment
score: 2
has text: IMO it would be clearer not to assign a value *at all* in the declaration, as both paths will assign a value. Another alternative would be to use the conditional operator, of course: `String cssClassContainer = group.isControlPanel() ? "container" : "container-fluid";`
comment on: http://stackoverflow.com/a/21831277

http://stackoverflow.com/comment/33014971
has text: I could able to get it.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21802830
type: Comment

http://stackoverflow.com/a/21810583
type: Answer
has comment: http://stackoverflow.com/comment/71803335
has body: JAVA is 'Write Once Run Anywhere' Check the link,It will make you clear about the whole process on which java works How is Java platform-independent when it needs a JVM to run? After the compilation,the code actually have to go through an intermediate state that is called as the bytecode.This bytecode is then taken up by the JVM present on the machine and then is converted into the form that is executable by the machine. The JVM for every different platform is different,But the bytecode generated by the compiler is same everytime.The JVM performs the function of handling the bytecode and producing executable code in the form as is understood by the platform on which you are working on.This is the reason that java is called as "Write Once Run Anywhere".
answers question: http://stackoverflow.com/q/21810538
type: AcceptedAnswer
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21810538
has comment: http://stackoverflow.com/comment/71837728
score: 5

http://stackoverflow.com/q/21761165
has title: I'm trying to write a personclass and a personTester in Java
has answer: http://stackoverflow.com/a/21762466
type: UnansweredQuestion
has body: So far for my personClass, I have the following: package personclass; public class Personclass { private static boolean Personclass; private int PersonCount; public int getPersonCount() { return PersonCount; } private String FirstName; private String LastName; private int Age; private Double Height; private String Gender; public Personclass(String foreName, String surName, int age, Double height, String gender) { FirstName = foreName; LastName = surName; Age = age; Height = height; Gender = gender; } private String getFirstName() { return FirstName; } private void setFirstName(String foreName) { this.FirstName = foreName; } private String getLastName() { return LastName; } private void setLastName(String surName) { this.LastName = surName; } private int getAge() { return Age; } private void setAge(int age) { this.Age = age; } private Double getHeight() { return Height; } private void setHeight(Double height) { this.Height = height; } private String getGender() { return Gender; } private void setGender(String gender) { this.Gender = gender; } /** * * @param FirstName * @param LastName * @param Age * @param Height * @param Gender */ public Personclass(String FirstName, String LastName, int Age, double Height, String Gender) { this.FirstName = FirstName; this.LastName = LastName; this.Age = Age; this.Height = Height; this.Gender = Gender; ++PersonCount; } /** * * @return */ @Override public String toString() { return "Person[forename=" + getFirstName() + ", surname=" + getLastName() + ", age=" + getAge() + ", height=" + getHeight() +"m" + ", gender=" + getGender() +"]"; } public String format() { return String.format("%10s %10s %10d %10.2f %10s", getFirstName() , getLastName() , getAge() , getHeight() , getGender()); } public static void main(String[] args) { } } And for my personTester, I have the following code: package personclass; public class PersonTester { public static void main(String[] args) { Person person1 = new Person("Joe","Smith",25,1.57,"Male"); Person p…
has comment: http://stackoverflow.com/comment/32917595
has answer: http://stackoverflow.com/a/21761430
has comment: http://stackoverflow.com/comment/32918611
favorite count: 0
has comment: http://stackoverflow.com/comment/32917760
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32917597
tagged with: tostring
has comment: http://stackoverflow.com/comment/32917754
has comment: http://stackoverflow.com/comment/32917583
score: 0
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/33004339
type: Comment
comment on: http://stackoverflow.com/a/21805815
has text: The idea is, that an object of any given type knows best how to compare itself with other objects (preferably of the same type) - that's why the responsibility lies with the actual object.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21769785
tagged with: java
has comment: http://stackoverflow.com/comment/32935134
favorite count: 0
tagged with: jboss
has comment: http://stackoverflow.com/comment/32933891
type: Question
has comment: http://stackoverflow.com/comment/35458177
has comment: http://stackoverflow.com/comment/32933872
has title: JBoss 7.1 java.lang.IllegalArgumentException: Child container with name already exists
has comment: http://stackoverflow.com/comment/32972586
upvote count: 1
has answer: http://stackoverflow.com/a/26098680
answer count: 1
has comment: http://stackoverflow.com/comment/32933903
tagged with: jboss7.x
has comment: http://stackoverflow.com/comment/39398561
tagged with: deployment
has body: I am using JBoss AS 7.1 & trying to deploy a war. But i am getting following exception : 17:12:11,146 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.web.deployment.default-host./: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./: Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [classes.jar:1.6.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [classes.jar:1.6.0_51] at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_51] Caused by: java.lang.IllegalArgumentException: Child container with name already exists at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:804) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:792) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:356) at org.jboss.as.web.deployment.WebContextInjector.inject(WebContextInjector.java:62) at org.jboss.as.web.deployment.WebContextInjector.inject(WebContextInjector.java:38) at org.jboss.msc.inject.CastingInjector.inject(CastingInjector.java:55) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl.doInject(ServiceControllerImpl.java:1549) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl.access$1900(ServiceControllerImpl.java:49) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.performInjections(ServiceControllerImpl.java:1780) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1741) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] ... 3 more 17:12:11,356 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "amft.war" was rolled …
has comment: http://stackoverflow.com/comment/32933808
has comment: http://stackoverflow.com/comment/32972803
type: UnansweredQuestion
tagged with: war
linked to: http://stackoverflow.com/q/10081347
downvote count: 0
score: 1

http://stackoverflow.com/comment/32864572
type: Comment
type: QuestionComment
has text: But you will have to... The same way the shell creates an anonymous pipe, you will have to do that in Java. There is no other way around this.
comment on: http://stackoverflow.com/q/21731232
score: 0

http://stackoverflow.com/a/22159128
answers question: http://stackoverflow.com/q/21838130
score: 4
has body: Cool. I decided to just use Apache CXF as my framework and using this it's as easy as adding javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider) port; bp.getRequestContext().put("ws-security.username", username); bp.getRequestContext().put("ws-security.password", password); Wow that's much better. Don't use Axis 1.4 lesson learned.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21838130

http://stackoverflow.com/comment/32936106
type: Comment
type: QuestionComment
has text: I think this is just about finding a creative approach to the problem. It's not a standard problem or anything. What are your own efforts to go on about this?
comment on: http://stackoverflow.com/q/21769112
score: 0

http://stackoverflow.com/q/21823595
has comment: http://stackoverflow.com/comment/33028930
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33028938
has title: Java invalid array size
upvote count: 1
tagged with: string
favorite count: 0
has body: I taking a string input from console. If I input "abcd" and spilt like this way Scanner input = new Scanner(System.in); String[]stringInput = input.nextLine().toLowerCase().trim().split(""); Suppose, I have entered "abcd" as input, stringInput.length is showing 5. But, It should be 4 right ? What's wrong, I am doing here ? Any idea ? How can I solve that ?
has answer: http://stackoverflow.com/a/21823622
answer count: 4
has answer: http://stackoverflow.com/a/21823714
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21823673
has answer: http://stackoverflow.com/a/21825060
possible better answer: http://stackoverflow.com/a/21823622
accepted answer: http://stackoverflow.com/a/21825060
downvote count: 0

http://stackoverflow.com/q/21824402
has comment: http://stackoverflow.com/comment/33040202
has comment: http://stackoverflow.com/comment/33030471
has comment: http://stackoverflow.com/comment/46856840
has answer: http://stackoverflow.com/a/21824485
has answer: http://stackoverflow.com/a/21824614
has answer: http://stackoverflow.com/a/21888353
tagged with: diamond-problem
has answer: http://stackoverflow.com/a/63989389
linked to: http://stackoverflow.com/q/1549743
has title: Java Multiple Inheritance
tagged with: multiple-inheritance
has comment: http://stackoverflow.com/comment/33030939
tagged with: multiple-interface-implem
answer count: 17
has answer: http://stackoverflow.com/a/28698472
favorite count: 0
has answer: http://stackoverflow.com/a/21829872
has answer: http://stackoverflow.com/a/21853996
has answer: http://stackoverflow.com/a/41160282
has answer: http://stackoverflow.com/a/21825376
has body: In an attempt to fully understand how to solve Java's multiple inheritance problems I have a classic question that I need clarified. Lets say I have class Animal this has sub classes Bird and Horse and I need to make a class Pegasus that extends from Bird and Horse since Pegasus is both a bird and a horse. I think this is the classic diamond problem. From what I can understand the classic way to solve this is to make the Animal, Bird and Horse classes interfaces and implement Pegasus from them. I was wondering if there was another way to solve the problem in which I can still create objects for birds and horses. If there was a way to be able to create animals also that would be great but not necessary.
accepted answer: http://stackoverflow.com/a/21824485
possible better answer: http://stackoverflow.com/a/21825368
linked to: http://stackoverflow.com/q/3556652
has answer: http://stackoverflow.com/a/21825368
has comment: http://stackoverflow.com/comment/33030712
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33091408
has answer: http://stackoverflow.com/a/21824978
tagged with: oop
tagged with: java
upvote count: 178
has answer: http://stackoverflow.com/a/21824634
has answer: http://stackoverflow.com/a/21824834
has answer: http://stackoverflow.com/a/21824548
has answer: http://stackoverflow.com/a/21825940
has answer: http://stackoverflow.com/a/21825111
has comment: http://stackoverflow.com/comment/33036926
type: Question
has answer: http://stackoverflow.com/a/21824628
score: 172
has comment: http://stackoverflow.com/comment/33030978

http://stackoverflow.com/comment/32923024
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21764017
type: QuestionComment
has text: Use debugger to see what has null value. Make sure your xml layout for row is correct. It is really simple to debug.

http://stackoverflow.com/comment/32945835
comment on: http://stackoverflow.com/q/21776669
type: Comment
type: QuestionComment
has text: so what is your problem. check condition and replace image??
score: 0

http://stackoverflow.com/q/21693970
tagged with: ajax
has answer: http://stackoverflow.com/a/21820490
tagged with: playframework-2.0
score: 0
accepted answer: http://stackoverflow.com/a/21820490
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: akka
has title: Too many open files (sockets) in Play 2.2 framework
answer count: 1
has body: I'm currently on Play 2.2.1 and after running a production web app during the day, I start getting the following error in my logs. It seems like I'm running out of connections/I must not be closing something correctly, but I can't seem to figure out what it is. 2014-02-11 18:19:24,660 - [ERROR] - from play in play-akka.actor.default-dispatcher-31 Cannot invoke the action, eventually got an error: java.util.concurrent.ExecutionException: java.net.SocketException: Too many open files 2014-02-11 18:19:24,664 - [ERROR] - from application in play-akka.actor.default-dispatcher-31 ! @6h8a5lf50 - Internal server error, for (POST) [/ws-tester/ajaxProcessInput?env=development&amp;token=XXX&amp;dataType=xml] -&gt; play.api.Application$$anon$1: Execution exceptionExecutionException: java.net.SocketException: Too many open files at play.api.Application$class.handleError(Application.scala:293) ~[com.typesafe.play.play_2.10-2.2.1.jar:2.2.1] at play.api.DefaultApplication.handleError(Application.scala:399) [com.typesafe.play.play_2.10-2.2.1.jar:2.2.1] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [com.typesafe.play.play_2.10-2.2.1.jar:2.2.1] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [com.typesafe.play.play_2.10-2.2.1.jar:2.2.1] at scala.Option.map(Option.scala:145) [org.scala-lang.scala-library-2.10.3.jar:na] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [com.typesafe.play.play_2.10-2.2.1.jar:2.2.1] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:257) [com.typesafe.play.play_2.10-2.2.1.jar:2.2.1] at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:344) [org.scala-lang.scala-library-2.10.3.jar:na] at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala…

http://stackoverflow.com/q/21811110
has comment: http://stackoverflow.com/comment/33008967
score: 0
has comment: http://stackoverflow.com/comment/33008108
has comment: http://stackoverflow.com/comment/33010644
tagged with: android
has comment: http://stackoverflow.com/comment/33010617
has comment: http://stackoverflow.com/comment/33007321
has title: Checking whether an object is real JSONArray or JSONObject in Android/Java
has comment: http://stackoverflow.com/comment/33009865
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33009274
has comment: http://stackoverflow.com/comment/33007270
has body: I made some research and I found these two methods of checking, but I dont know which would be slower and cause more overhead? Method 1: public boolean isJSONValid(String test) { try { new JSONObject(test); return true; } catch(JSONException ex) { return false; } } Method 2: if (Law.get("LawSet") instanceof JSONObject) { JSONObject Lawset = Law.getJSONObject("LawSet"); } else if (Law.get("LawSet") instanceof JSONArray) { JSONArray Lawset = Law.getJSONArray("LawSet"); } EDIT: Apparently both methods will not work according to the comments I got below this question, so how do I check whether the incoming string of characters is a valid JSONObject or a JSONArray?
tagged with: java
has comment: http://stackoverflow.com/comment/33010513
has comment: http://stackoverflow.com/comment/33008769
type: Question
has answer: http://stackoverflow.com/a/32459685
has comment: http://stackoverflow.com/comment/33009114
has comment: http://stackoverflow.com/comment/33009450
answer count: 1

http://stackoverflow.com/q/21702227
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32812409
has comment: http://stackoverflow.com/comment/32817119
has body: I have a Servlet which keeps reading the file and stores the search result in response and sends back to the JSP. It is taking huge time. Is there anyway that we can send the processed result like as and when it reached some size to the JSP page and whenever the user selects the next page and return the remaining result? I tried searching for this in other threads but could not find an answer.
tagged with: java
type: UnansweredQuestion
tagged with: servlets
tagged with: jsp
tagged with: jquery
tagged with: ajax
type: Question
has answer: http://stackoverflow.com/a/21702397
has title: Sending processed servlet data in chunks
has answer: http://stackoverflow.com/a/21703697

http://stackoverflow.com/comment/32967583
type: AnswerComment
has text: `m` isn't declared anywhere.
type: Comment
comment on: http://stackoverflow.com/a/21788693
score: 1

http://stackoverflow.com/comment/32952041
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21780468
has text: That sounds nice :). My class is currently on a com.bla.bla.bla.models package while my system is in another one. To make it work I would have to make both of them to be in the same package and be the only two classes in this package. Is this correct?
type: Comment

http://stackoverflow.com/a/21734832
upvote count: 1
has comment: http://stackoverflow.com/comment/32870865
accepted answer of: http://stackoverflow.com/q/21734809
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21734809
has comment: http://stackoverflow.com/comment/32870951
type: Answer
has body: Because you are casting the Textview object to EditText that two are different class android.widget.TextView android.widget.EditText
has comment: http://stackoverflow.com/comment/32870748

http://stackoverflow.com/a/21723493
has comment: http://stackoverflow.com/comment/32878084
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/32873937
has comment: http://stackoverflow.com/comment/32872674
upvote count: 5
downvote count: 0
has body: To start off, the main difference between your two tests is definitely in bounds check elimination; however, the way this influences the machine code is far from what the naïve expectation would suggest. My conjecture: The bounds check figures more strongly as a loop exit point than as additional code which introduces overhead. The loop exit point prevents the following optimization which I have culled from the emitted machine code: the loop is unrolled (this is true in all cases); additionaly, the fetching from the array stage is done first for all unrolled steps, then the xoring into accumulator is done for all the steps. If the loop can break out at any step, this staging would result in work performed for loop steps which were never actually taken. Consider this slight modification of your code: @OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(Mode.AverageTime) @OperationsPerInvocation(Measure.N) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 5, time = 1) @State(Scope.Thread) @Threads(1) @Fork(1) public class Measure { public static final int N = 1024; private final int[] table = new int[N]; @Setup public void setUp() { final Random random = new Random(); for (int i = 0; i < table.length; ++i) { final int x = random.nextInt(); table[i] = x == 0? 1 : x; } } @GenerateMicroBenchmark public int normalIndex() { int result = 0; final int[] table = this.table; int x = 0; for (int i = 0; i <= table.length - 1; ++i) { x += i; final int j = x & (table.length - 1); final int entry = table[i]; result ^= entry + j; if (entry == 0) break; } return result; } @GenerateMicroBenchmark public int maskedIndex() { int result = 0; final int[] table = this.table; int x = 0; for (int i = 0; i <= table.length - 1; ++i) { x += i; final int j = x & (table.length - 1); final int entry = table[j]; result ^= i + entry; if (entry == 0) break; } return result; } } There is just one difference: I have added the check if (entry == 0) break; to give the loop a way to exit prematu…
has comment: http://stackoverflow.com/comment/32871304
answers question: http://stackoverflow.com/q/21702939

http://stackoverflow.com/q/21808790
tagged with: magnolia
tagged with: content-management-system
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21864387
has title: Magnolia cms: resources module proper usage
has body: I am learning magnolia cms. I am trying to use the resources module. I have actually 2 problems. Cannot upload a bunch of files. I have a few files, but in some time I will have to upload some more. Modules import feature wants me to upload an xml file. But I don't know how to generate it properly. Tried to import through JCR, but after that I can't see those files in resources app. Tried to configure the module to search files in file system: I set fileSystemLoader to class info.magnolia.module.resources.loaders.FileSystemResourceLoader and set some path. It did not work for me too. Maybe I just don't understand at what time should be activated files upload feature. At the application start up time it did not work. How to properly use these resources in my template? What ftl tag should I use? I don't use STK module. Thanks for your patience if you decide to help me. Magnolia version: 5.2 CE JDK iced tea: 1.7.0_51 OS: Linux/OpenSUSE 12.3
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21864387
tagged with: java
type: Question

http://stackoverflow.com/a/53297462
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21838872
has body: You can also run it by calling the declared main class directly, no need to extract it and run another java process. So take a look in the X.jars manifest, ther should be a Main declared. then in your activator, simply call: the.package.from.x.MainClassX.main(new String[] {}); inside your thread.

http://stackoverflow.com/q/21700630
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32835591
has body: I'm building a Python UI using Tkinter. For the needs of the program, I've to connect Python with Java to do some stuff, so I'm using a simple Jython script as a linker. I cant use Tkinter with Jython because it's not supported. Python (ui.py) -&gt; Jython (linker.py) -&gt; Java (compiled in jars) To call the Jython function in Python I use subprocess as follows: ui.py: cmd = 'jython linker.py"' my_env = os.environ my_env["JYTHONPATH"] = tons_of_jars subprocess.Popen(cmd, shell=True, env=my_env) Then, in the Jython file, linker.py, I import the Java classes already added on the JYTHONPATH, and I create an object with the name m and call to some functions of the Java class. linker.py: import handler.handler m = handler.handler(foo, moo, bar) m.schedule(moo) m.getFullCalendar() m.printgantt() The thing is that I've created a m object, that will be destroyed after the execution of jython linker.py ends. So the question is: Is possible to save that m object somewhere so I can call it from ui.py whenever I want? If it's not possible, is there any other way to do this? Thanks in advance.
tagged with: python
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/21777912
score: 1
tagged with: java
has title: How to save a Java object in Jython/Python
type: Question
has comment: http://stackoverflow.com/comment/32853081
has answer: http://stackoverflow.com/a/21777912
tagged with: jython
answer count: 1
tagged with: python-2.7

wsdl
tags question: http://stackoverflow.com/q/21778733
tags question: http://stackoverflow.com/q/21763285
tags question: http://stackoverflow.com/q/21782519
tags question: http://stackoverflow.com/q/21784252
type: Tag
tag name: wsdl

http://stackoverflow.com/q/21784023
has title: transform 3x3 OpenCV Mat to Android Matrix
accepted answer: http://stackoverflow.com/a/21785185
score: 0
tagged with: matrix
tagged with: android
tagged with: opencv
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/32944845
has answer: http://stackoverflow.com/a/21785185
has answer: http://stackoverflow.com/a/32944845
tagged with: java
has body: I got a 3x3 matrix in OpenCV format (org.opencv.core.Mat) that I want to copy into android.graphics.Matrix. Any idea how? [EDIT] Here's the final version as inspired by @elmiguelao. The source matrix is from OpenCV and the destination matrix is from Android. static void transformMatrix(Mat src, Matrix dst) { int columns = src.cols(); int rows = src.rows(); float[] values = new float[columns * rows]; int index = 0; for (int x = 0; x &lt; columns; x++) for (int y = 0; y &lt; rows; y++) { double[] value = src.get(x, y); values[index] = (float) value[0]; index++; } dst.setValues(values); }
type: Question
answer count: 2

http://stackoverflow.com/q/21769600
has comment: http://stackoverflow.com/comment/32933280
has answer: http://stackoverflow.com/a/21778710
has comment: http://stackoverflow.com/comment/32936810
type: Question
tagged with: boolean
answer count: 2
has comment: http://stackoverflow.com/comment/32933324
has comment: http://stackoverflow.com/comment/32933396
tagged with: string
score: 0
has comment: http://stackoverflow.com/comment/32933318
has comment: http://stackoverflow.com/comment/32933345
has comment: http://stackoverflow.com/comment/32934097
has answer: http://stackoverflow.com/a/21770121
has comment: http://stackoverflow.com/comment/32933486
has comment: http://stackoverflow.com/comment/32933298
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32933352
has comment: http://stackoverflow.com/comment/32936883
has body: So I'm making a TicTacToe-program, and I made a method for checking if there are 3 pieces in a row, to check if the game is over or not. public boolean hasWon() { if (tictac[0][0].equals(tictac[1][0]) &amp;&amp; tictac[0][0].equals(tictac[2][0]) &amp;&amp; tictac[1][0].equals(tictac[2][0])) { //Vertical return false; } else if (tictac[0][1].equals(tictac[1][1]) &amp;&amp; tictac[0][1].equals(tictac[2][1]) &amp;&amp; tictac[1][1].equals(tictac[2][1])) { //Vertical return false; } else if (tictac[0][2].equals(tictac[1][2]) &amp;&amp; tictac[0][2].equals(tictac[2][2]) &amp;&amp; tictac[1][2].equals(tictac[2][2])) { //Vertical return false; } else if (tictac[0][0].equals(tictac[0][1]) &amp;&amp; tictac[0][0].equals(tictac[0][2]) &amp;&amp; tictac[0][1].equals(tictac[0][2])) { //Horizontal return false; } else if (tictac[1][0].equals(tictac[1][1]) &amp;&amp; tictac[1][0].equals(tictac[1][2]) &amp;&amp; tictac[1][1].equals(tictac[1][2])) { //Horizontal return false; } else if (tictac[2][0].equals(tictac[2][1]) &amp;&amp; tictac[2][0].equals(tictac[2][2]) &amp;&amp; tictac[2][1].equals(tictac[2][2])) { //Horizontal return false; } else if (tictac[0][0].equals(tictac[1][1]) &amp;&amp; tictac[0][0].equals(tictac[2][2]) &amp;&amp; tictac[1][1].equals(tictac[2][2])) { //Diagonal return false; } else if (tictac[0][2].equals(tictac[1][1]) &amp;&amp; tictac[0][2].equals(tictac[2][0]) &amp;&amp; tictac[1][1].equals(tictac[2][0])) { //Diagonal return false; } else { return true; } } The problem here is, with these conditions I figured if, say, all of the indexes "in a row" where f.ex. X, " X X X " it would be a win for the player X. However, my program calls for a winner if any kind of piece fill 3 in a row, f.ex. " X O X " would end the game, which obviously is wrong. Have I misunderstood .equals? EDIT: after the wonderful feedback, is there a way that I can make the if-statements to ignore blank spaces (" ")?
tagged with: java
has title: either a rookie mistake, or misuse of .equals in java

http://stackoverflow.com/a/21816330
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21816247
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33016315
accepted answer of: http://stackoverflow.com/q/21816247
has body: That is because onStart() is called by an event, specifically, it is called when the activity becomes visible to the user. Here's a nice explanation of the lifecycle of Android activities: diagram source Your question about bound services has already been answered here and here.

http://stackoverflow.com/comment/33023236
has text: No, it is not possible. Use a for loop.
score: 4
comment on: http://stackoverflow.com/q/21820176
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32819436
score: 0
comment on: http://stackoverflow.com/q/21705493
has text: Well I found a lot of different answers to the same questions but none worked so I still have hope that there will be a different new answer which does help me.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21755117
has answer: http://stackoverflow.com/a/21756610
has title: What is the best way to create GUI for a crossword puzzle? java
type: Question
answer count: 1
tagged with: user-interface
downvote count: 0
accepted answer: http://stackoverflow.com/a/21756610
favorite count: 0
tagged with: crossword
has body: I am relatively new to Java. I have experience with the logic side of programming but not so much with GUI. I created a CrossWord generator that takes a text file with words and definitions and makes a crossword. Currently I have the solution stored in a 2d array of char(s). I need to figure out how to display the crossword and check the user input against the solution. I was wondering what the "easiest" way to display this using swing or some sort of graphic components. I was thinking of using a TilePane and textboxes but I am so completely new to GUI I have no idea how to code it. In your proposed solution please provide some example code of how to make whatever it is. Thank you so much for your input.
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/21689799
answers question: http://stackoverflow.com/q/21689781
type: Answer
has body: List&lt;String&gt; and List&lt;Integer&gt; are different types and getname(List&lt;String&gt; num) and getname(List&lt;Integer&gt; num) are methods with different signatures. So the second doesn't override the first. So child can not extends parent whit this method.
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/comment/33031582
type: QuestionComment
has text: You can try to hide it better but you can't make it secure. See http://stackoverflow.com/questions/21646688/good-practice-how-to-handle-keystore-passwords-in-android-java/21647060#21647060 for example.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21825029

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/21813105
tags question: http://stackoverflow.com/q/21722461
tags question: http://stackoverflow.com/q/21696476
tag name: android-actionbar

http://stackoverflow.com/q/21735701
tagged with: image
downvote count: 0
has body: I'm sending a mail using JavaMailSenderImpl on Spring. I'm trying to embed a base64 image to the mail as follows. mimeMessageHelper.setTo("some@someone"); mimeMessageHelper.setReplyTo("some@someone"); mimeMessageHelper.setFrom("some@someone"); mimeMessageHelper.setSubject("someSubject"); mimeMessageHelper.setText("&lt;img src='data:image/png;base64,imagebase64here'&gt;",true); image is not appearing in the mail. What am I doing wrong here?
favorite count: 0
has title: Spring JavaMailSenderImpl send base64 image html
tagged with: email
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
type: Question
score: 1
tagged with: java
tagged with: base64

http://stackoverflow.com/comment/33044945
has text: So, there is no reliable way to determine it?
type: AnswerComment
comment on: http://stackoverflow.com/a/21832774
score: 0
type: Comment

http://stackoverflow.com/q/21707570
type: Question
tagged with: tomcat
has answer: http://stackoverflow.com/a/21713559
favorite count: 0
upvote count: 3
has body: I am developing a Web application in Java using Eclipse and Tomcat 6. I need to pass a value to the servlet that is not hard-coded into the .war file. For instance, let's say my servlet needs a filename, and that filename is different on each server. How do I pass it to the servlet, without hardcoding it in the .war file? Please help me with the instructions on how to do this: from within Eclipse (for instance: add xxxx to file yyy and then run) on the server on which I will deploy the application I'm thinking in the direction of getInitParameter, but I haven't found a way to pass init parameters except for the web.xml inside the .war file, which is not an option since it needs to be configurable. So if you could show me how I can set init parameters in an external file, the problem is solved. Note: I'm looking for really exact advice, as in “edit that file on that location”. I have found many related questions and answers, but none of them was specific enough to make it work.
downvote count: 1
accepted answer: http://stackoverflow.com/a/21709703
answer count: 4
has answer: http://stackoverflow.com/a/21714041
has answer: http://stackoverflow.com/a/21709703
has answer: http://stackoverflow.com/a/21707634
possible better answer: http://stackoverflow.com/a/21713559
score: 2
type: AnsweredQuestion
has title: Passing a configuration value to a servlet without hard-coding it in the .war file?
tagged with: java
linked to: http://stackoverflow.com/q/7542506
tagged with: eclipse
tagged with: servlets

http://stackoverflow.com/comment/32994717
score: 0
comment on: http://stackoverflow.com/q/21804268
type: Comment
has text: It is a duplicate of [this question][1] [1]: http://stackoverflow.com/questions/4470787/spring-rest-pathvariable-character-encoding
type: QuestionComment

http://stackoverflow.com/comment/33013391
score: 0
type: AnswerComment
type: Comment
has text: ok then how will last pointer be null , i do not how last pointer should be null in this example ?
comment on: http://stackoverflow.com/a/21814628

http://stackoverflow.com/comment/33059313
type: QuestionComment
has text: Rather than posting ALL of your code, narrow it down to only the relevant section. Put a comment by the line where the exception is thrown. Give us some information about what the debugger says those variables are holding (i.e. show some debugging effort). DO NOT POST STACK TRACES IN THE COMMENTS!
comment on: http://stackoverflow.com/q/21840642
score: 0
type: Comment

http://stackoverflow.com/q/21819901
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21820935
tagged with: collections
type: Question
tagged with: derby
score: 0
has body: Using Netbeans to develop embedded database application (Derby). I am trying to figure out how the many to many relationship works. Netbeans created the entity classes for me. I understand how to retrieve a record and commit new results to the record but I am not familiar with how you would commit a "collection" see the code below. @Entity @Table(name = "MASTER") @XmlRootElement @NamedQueries({.... }) public class Master implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Basic(optional = false) @Column(name = "ID") private Integer id; @Column(name = "SDS_NUMBER") private Integer sdsNumber; @Column(name = "PRODUCT_NAME") private String productName; @Column(name = "PRODUCT_DESCRIPTION") private String productDescription; @Column(name = "SDS_FILE_NAME") private String sdsFileName; @Column(name = "USE_STATUS") private Boolean useStatus; @Column(name = "DATA_UPDATED") @Temporal(TemporalType.DATE) private Date dataUpdated; @Column(name = "PROPER_SHIPPING_NAME") private String properShippingName; @Column(name = "SIGNAL_WORD") private String signalWord; @Column(name = "GHS_COMPLIANT") private Boolean ghsCompliant; @JoinTable(name = "STATEMENT_LOOKUP", joinColumns = { @JoinColumn(name = "SDS_NUMBER", referencedColumnName = "SDS_NUMBER")}, inverseJoinColumns = { @JoinColumn(name = "STATEMENT_ID", referencedColumnName = "STATEMENT_ID")}) @ManyToMany private Collection&lt;Statements&gt; statementsCollection; @ManyToMany(mappedBy = "masterCollection") private Collection&lt;Manufacturers&gt; manufacturersCollection; @JoinTable(name = "PICTOGRAM_LOOKUP", joinColumns = { @JoinColumn(name = "SDS_NUMBER", referencedColumnName = "SDS_NUMBER")}, inverseJoinColumns = { @JoinColumn(name = "PICTOGRAM_ID", referencedColumnName = "PICTOGRAM_ID")}) @ManyToMany private Collection&lt;Pictograms&gt; pictogramsCollection; @ManyToMany(mappedBy = "masterCollection") private Collection&lt;Locations&gt; locationsCollection;…
tagged with: eclipselink
answer count: 1
tagged with: jpa
has title: Javax Persistence Many to Many Collection EclipseLink JPA 2.1

http://stackoverflow.com/q/21789492
tagged with: android
tagged with: android-intent
has body: I'm having an issue with activity launching from the service. It opens the activity with some sort of delay (1sec or so), is there a way to speed things up, just like the window of device administrator pops up almost momentarily? or maybe show some preloader? Thanks
answer count: 0
tagged with: java
has title: How can one open an activity from service faster?
has comment: http://stackoverflow.com/comment/32969392
type: Question
tagged with: android-service
has comment: http://stackoverflow.com/comment/32968928
has comment: http://stackoverflow.com/comment/32968486
score: 0
has comment: http://stackoverflow.com/comment/32968701
tagged with: android-activity
has comment: http://stackoverflow.com/comment/32969319
type: UnansweredQuestion

http://stackoverflow.com/comment/32979221
has text: I just updated the answer see that
comment on: http://stackoverflow.com/q/21795520
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32952900
has text: Check my Edited Answer. It is a sample for your requirement.
comment on: http://stackoverflow.com/q/21779750
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21683783
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32780903
tagged with: arrays
has comment: http://stackoverflow.com/comment/32780707
tagged with: class
has comment: http://stackoverflow.com/comment/32779944
score: 0
has body: Here is my current code of the class file i am using for my project, Im getting two identifier expected errors on the lines with public double highStoreSales(store) and public double averageStoreSales(quarter) What am i missing? import java.io.File; import java.text.DecimalFormat; import java.util.Scanner; import java.io.IOException; import java.util.*; import javax.swing.*; import java.awt.*; public class SalesAnaylzer //extends SalesManager { DecimalFormat pricePattern = new DecimalFormat("$#0.00"); int[][] sales = new int[3][4]; public SalesAnaylzer(String fileName) throws IOException { File inputFile = new File(fileName); Scanner scan = new Scanner(inputFile); for (int row = 0; row &lt; 4; row++) { for (int col = 0; col &lt; 6; col++) { sales[row][col] = scan.nextInt(); } } } public String toString() { String data = ""; for (int row = 0; row &lt; 4; row++) { data = data + "\nStore " + (row + 1) + ": "; for (int col = 0; col &lt; 6; col++) { data = data + "QTR " + (col + 1) + ": " + pricePattern.format(sales[row][col]) + " "; } } return data; } public double totalSales() { double total = 0.0; for (int row = 0; row &lt; 4; row++) { for (int col = 0; col &lt; 6; col++) { total = total + sales[row][col]; } } return total; } public double highStoreSales(store) { double highest = 0.0; for (int row = 0; row &lt; 4; row++) { if (sales[row][store] &gt; highest) highest = sales[row][store]; } return pricePattern.format(highest); } public double averageStoreSales(quarter) { double total = 0.0; double avg = 0.0; for (int col = 0; col &lt; 6; col++) { total = total + sales[quarter][col]; } avg = (total / 4); return pricePattern.format(avg); } }
has title: Error in class file: "Identifier expected"
has answer: http://stackoverflow.com/a/21683836
answer count: 1
has comment: http://stackoverflow.com/comment/32780627
has comment: http://stackoverflow.com/comment/32780571

http://stackoverflow.com/comment/33031464
score: 0
type: QuestionComment
has text: Perhaps related to http://stackoverflow.com/questions/1069992/jpa-entitymanager-why-use-persist-over-merge?
type: Comment
comment on: http://stackoverflow.com/q/21824922

string
tags question: http://stackoverflow.com/q/21839989
tags question: http://stackoverflow.com/q/21701923
tags question: http://stackoverflow.com/q/21757527
tags question: http://stackoverflow.com/q/21828200
tags question: http://stackoverflow.com/q/21678598
tags question: http://stackoverflow.com/q/21841114
tags question: http://stackoverflow.com/q/21771971
tags question: http://stackoverflow.com/q/21747310
tags question: http://stackoverflow.com/q/21716830
tags question: http://stackoverflow.com/q/21738318
tags question: http://stackoverflow.com/q/21792460
tags question: http://stackoverflow.com/q/21776772
tags question: http://stackoverflow.com/q/21793674
tags question: http://stackoverflow.com/q/21834631
tags question: http://stackoverflow.com/q/21781622
tags question: http://stackoverflow.com/q/21815100
tags question: http://stackoverflow.com/q/21684284
tags question: http://stackoverflow.com/q/21782520
tags question: http://stackoverflow.com/q/21778799
tags question: http://stackoverflow.com/q/21757158
tags question: http://stackoverflow.com/q/21768476
tags question: http://stackoverflow.com/q/21717104
tags question: http://stackoverflow.com/q/21743197
tags question: http://stackoverflow.com/q/21759316
tags question: http://stackoverflow.com/q/21783037
tags question: http://stackoverflow.com/q/21685666
tags question: http://stackoverflow.com/q/21813500
tags question: http://stackoverflow.com/q/21698185
tags question: http://stackoverflow.com/q/21828805
tags question: http://stackoverflow.com/q/21840716
tags question: http://stackoverflow.com/q/21761455
tags question: http://stackoverflow.com/q/21831966
tags question: http://stackoverflow.com/q/21827689
tags question: http://stackoverflow.com/q/21781305
tags question: http://stackoverflow.com/q/21791538
tags question: http://stackoverflow.com/q/21682720
tag name: string
tags question: http://stackoverflow.com/q/21771566
tags question: http://stackoverflow.com/q/21729315
tags question: http://stackoverflow.com/q/21822012
tags question: http://stackoverflow.com/q/21723245
tags question: http://stackoverflow.com/q/21817301
tags question: http://stackoverflow.com/q/21829295
tags question: http://stackoverflow.com/q/21711752
tags question: http://stackoverflow.com/q/21809688
tags question: http://stackoverflow.com/q/21823595
tags question: http://stackoverflow.com/q/21799246
tags question: http://stackoverflow.com/q/21780424
tags question: http://stackoverflow.com/q/21693809
tags question: http://stackoverflow.com/q/21721658
tags question: http://stackoverflow.com/q/21817836
tags question: http://stackoverflow.com/q/21687391
tags question: http://stackoverflow.com/q/21765702
tags question: http://stackoverflow.com/q/21746019
tags question: http://stackoverflow.com/q/21817236
tags question: http://stackoverflow.com/q/21838379
tags question: http://stackoverflow.com/q/21737163
type: Tag
tags question: http://stackoverflow.com/q/21839494
tags question: http://stackoverflow.com/q/21788097
tags question: http://stackoverflow.com/q/21717358
tags question: http://stackoverflow.com/q/21735699
tags question: http://stackoverflow.com/q/21820279
tags question: http://stackoverflow.com/q/21792084
tags question: http://stackoverflow.com/q/21776261
tags question: http://stackoverflow.com/q/21758950
tags question: http://stackoverflow.com/q/21798523
tags question: http://stackoverflow.com/q/21799602
tags question: http://stackoverflow.com/q/21743473
tags question: http://stackoverflow.com/q/21820409
tags question: http://stackoverflow.com/q/21693544
tags question: http://stackoverflow.com/q/21800803
tags question: http://stackoverflow.com/q/21823196
tags question: http://stackoverflow.com/q/21736300
tags question: http://stackoverflow.com/q/21805953
tags question: http://stackoverflow.com/q/21776462
tags question: http://stackoverflow.com/q/21776204
tags question: http://stackoverflow.com/q/21797851
tags question: http://stackoverflow.com/q/21717321
tags question: http://stackoverflow.com/q/21796180

regex
tags question: http://stackoverflow.com/q/21686984
tags question: http://stackoverflow.com/q/21808029
tags question: http://stackoverflow.com/q/21729315
tags question: http://stackoverflow.com/q/21727045
tags question: http://stackoverflow.com/q/21820409
tags question: http://stackoverflow.com/q/21723245
tags question: http://stackoverflow.com/q/21732296
tags question: http://stackoverflow.com/q/21695670
tag name: regex
tags question: http://stackoverflow.com/q/21678626
tags question: http://stackoverflow.com/q/21817236
tags question: http://stackoverflow.com/q/21761112
tags question: http://stackoverflow.com/q/21737163
tags question: http://stackoverflow.com/q/21686600
tags question: http://stackoverflow.com/q/21734731
tags question: http://stackoverflow.com/q/21724486
tags question: http://stackoverflow.com/q/21703530
tags question: http://stackoverflow.com/q/21779995
tags question: http://stackoverflow.com/q/21817509
tags question: http://stackoverflow.com/q/21699095
tags question: http://stackoverflow.com/q/21685098
tags question: http://stackoverflow.com/q/21760919
tags question: http://stackoverflow.com/q/21701636
tags question: http://stackoverflow.com/q/21714672
tags question: http://stackoverflow.com/q/21795339
tags question: http://stackoverflow.com/q/21812170
tags question: http://stackoverflow.com/q/21799062
tags question: http://stackoverflow.com/q/21771982
tags question: http://stackoverflow.com/q/21695911
tags question: http://stackoverflow.com/q/21738318
tags question: http://stackoverflow.com/q/21681825
tags question: http://stackoverflow.com/q/21767243
tags question: http://stackoverflow.com/q/21838164
tags question: http://stackoverflow.com/q/21761788
tags question: http://stackoverflow.com/q/21815100
tags question: http://stackoverflow.com/q/21776096
tags question: http://stackoverflow.com/q/21714742
tags question: http://stackoverflow.com/q/21704583
tags question: http://stackoverflow.com/q/21725115
tags question: http://stackoverflow.com/q/21806381
tags question: http://stackoverflow.com/q/21829210
tags question: http://stackoverflow.com/q/21682331
tags question: http://stackoverflow.com/q/21708412
tags question: http://stackoverflow.com/q/21828466
tags question: http://stackoverflow.com/q/21750291
tags question: http://stackoverflow.com/q/21686230
tags question: http://stackoverflow.com/q/21755315
tags question: http://stackoverflow.com/q/21720324
tags question: http://stackoverflow.com/q/21839902
tags question: http://stackoverflow.com/q/21819959
tags question: http://stackoverflow.com/q/21762452
tags question: http://stackoverflow.com/q/21698185
tags question: http://stackoverflow.com/q/21773887
tags question: http://stackoverflow.com/q/21761455
tags question: http://stackoverflow.com/q/21684003
tags question: http://stackoverflow.com/q/21781305
tags question: http://stackoverflow.com/q/21777647
tags question: http://stackoverflow.com/q/21717309
tags question: http://stackoverflow.com/q/21696986
tags question: http://stackoverflow.com/q/21823268
tags question: http://stackoverflow.com/q/21724440
tags question: http://stackoverflow.com/q/21735131
tags question: http://stackoverflow.com/q/21783689
tags question: http://stackoverflow.com/q/21725065
tags question: http://stackoverflow.com/q/21697734
tags question: http://stackoverflow.com/q/21816788
tags question: http://stackoverflow.com/q/21713893
type: Tag

http://stackoverflow.com/a/21792158
has body: You're trying to use textArea before initialising it. Swap line 26 and line 27.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21792140
score: 1
answers question: http://stackoverflow.com/q/21792140

http://stackoverflow.com/a/21695993
answers question: http://stackoverflow.com/q/21695049
accepted answer of: http://stackoverflow.com/q/21695049
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: SAP JCo is a proprietary closed-source library. Unless you work for SAP, you won't get the source files - and you're not allowed to include the source or binary form of JCo anyway.
score: 2
downvote count: 0

http://stackoverflow.com/comment/32964440
type: Comment
has text: @MarkoTopolnik I would have guessed 5-6. I was surprised to see over 20.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21787373

quickblox
tags question: http://stackoverflow.com/q/21679732
type: Tag
tag name: quickblox
tags question: http://stackoverflow.com/q/21725742

http://stackoverflow.com/a/21807021
has body: The checked exception :NullPointerException is thrown when you are trying to call an object through an reference variable where it doesn't has a pointer to the object you're trying to call. In other words: Initialize the variable, before using it.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21806786

http://stackoverflow.com/q/21739578
accepted answer: http://stackoverflow.com/a/21748252
has title: How to disable Spring logging DEBUG messages?
tagged with: log4j
has body: I'm working on a simple desktop app (not webapp). Here is my log4j.properties: log4j.rootCategory=INFO, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L $$$$ %m%n log4j.logger.org.springframework=ERROR,stdout As you can see, in order to eliminate Spring logging messages from the console, I tried this solution: Disabling Spring log, to have readable logs When I call log4j logger from my code, the logging messages are according to the pattern specified above (which is good). However, the bad part is - I still get to the console DEBUG level messages from spring... they look like here: Unable to disable logging messages And they have a different pattern. As if they ignore my settings. I also tried to apply the suggestions I've found here: https://spring.io/blog/2009/12/04/logging-dependencies-in-spring In my pom file: log4j log4j 1.2.17 runtime org.springframework spring-core 3.2.0.RELEASE And no SLF4J. This option was mentioned in the above link as a valid option, if I am not wrong. What might I be missing here? OUTPUT with -Dlog4j.debug=true log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@172aa3f. log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@172aa3f class loader. log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource(). log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@172aa3f. log4j: Using URL [file:/C:/eclipse-workspace/workflow/target/classes/log4j.properties] for automatic log4j configuration. log4j: Reading configuration from URL file:/C:/eclipse-workspace/workflow/target/classes/log4j.properties log4j: Parsing for [root] with value=[INFO, stdout]. log4j: Level token is [INFO]. log4j: Category root set to INFO log4j: Parsing appender named "stdout". log4j: Parsing layout options fo…
favorite count: 0
possible better answer: http://stackoverflow.com/a/60811333
tagged with: spring
has answer: http://stackoverflow.com/a/40793933
has answer: http://stackoverflow.com/a/60811333
score: 25
tagged with: apache-commons-logging
linked to: http://stackoverflow.com/q/18648014
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20957422
upvote count: 25
tagged with: java
has answer: http://stackoverflow.com/a/21748252
type: Question
tagged with: slf4j
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/32814537
has text: check this for basics of parsing xml http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/.... how to access the node and its value
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21703474
score: 1

http://stackoverflow.com/q/21819397
possible better answer: http://stackoverflow.com/a/21819496
score: 0
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/21819496
type: Question
answer count: 2
tagged with: libgdx
has body: So in menu i have 3 buttons and all are with the same code. For the topic only important thing is button2.addListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { game.setGame(); dispose(); return true; } }); Then everything is going fine until: button3.clearListeners(); // MainMenu.java:174 line in exeption and then exeption pops out: Exception in thread "LWJGL Application" java.lang.IllegalStateException: Invalid between begin/end. at com.badlogic.gdx.utils.DelayedRemovalArray.clear(DelayedRemovalArray.java:125) at com.badlogic.gdx.scenes.scene2d.Actor.clearListeners(Actor.java:261) at com.racostyle.avdelux.MainMenu.dispose(MainMenu.java:174) at com.racostyle.avdelux.MainMenu$3.touchDown(MainMenu.java:123) at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:55) at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:165) at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:136) at com.badlogic.gdx.scenes.scene2d.Stage.touchDown(Stage.java:277) at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:300) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:200) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) EDIT: if i don't remove listeners they are still active and can be clickable, afc with exeptions.
has answer: http://stackoverflow.com/a/21819885
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/21819885
has title: How to clear libgdx listeners
type: AnsweredQuestion

http://stackoverflow.com/a/21723067
type: Answer
has comment: http://stackoverflow.com/comment/32850395
answers question: http://stackoverflow.com/q/21723025
score: 0
has body: Normally we are setting the RowHeight when the text in the row goes beyond the height of a row, to set the height of a row we do this: table.setRowHeight(40); I want to put a String in a JTable that is longer than the given cell-width. How can I set the rowHeight dynamically so that I can read the whole String? To read complete string from the jtable row you don't need to set RowHeight you need to set the PreferredWidth of a column as you are already doing so. Just add a line like: textTable.getColumnModel().getColumn(2).setPreferredWidth(300); And you will be able to read the whole string. Output

http://stackoverflow.com/a/21844570
has comment: http://stackoverflow.com/comment/33066114
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33066460
answers question: http://stackoverflow.com/q/21829193
has comment: http://stackoverflow.com/comment/33066410
has body: You have 2 different List, try doing this: Create a constructor without passing a List i mean: CustomListAdapter(MyOrders.this, "", true); Then in the CustomListAdapter create an List Local variable and instatiate it in the constructor: private List&lt;Product&gt; mProductList; public CustomListAdapter(Context context, String type, boolean showQuantity) { layoutInflater = LayoutInflater.from(context); mContext = context; mProductList = new ArrayList&lt;Product&gt;(); mShowQuantity = showQuantity; mType = type; } then create an Add or Delete method in the CustomListAdapter: public void AddItem(Product product){ if(null != product){ mProductList.add(product); } } Then an updateMethod too: public void update(){ mProductList.notifyDataSetChanged(); }
has comment: http://stackoverflow.com/comment/33066309
downvote count: 0
has comment: http://stackoverflow.com/comment/33066082
has comment: http://stackoverflow.com/comment/33066097
type: Answer

http://stackoverflow.com/q/21783321
downvote count: 0
has body: I have created a data-access layer containing Spring Data Neo4j classes which are accessed behind interfaces. For example, I have a Car interface and a CarNode class that uses SDN annotations like @RelatedTo : @RelatedTo(elementClass = CarNode.class, type = "drives", direction = OUTGOING) private Set&lt;Driver&gt; drivers; If you look closely, you'll see that the @RelatedTo refers to the CarNode class and the drivers is defined as Set&lt;Driver&gt; (and not Set&lt;DriverNode&gt;). This works fine. Now I would like to use @Fetch to enable eager-loading. If I simply do : @RelatedTo(elementClass = CarNode.class, type = "drives", direction = OUTGOING) @Fetch private Set&lt;Driver&gt; drivers; I get the following error : Type interface org.my.project.Driver is neither a @NodeEntity nor a @RelationshipEntity Is this possible to tell @Fetch that it should expect DriverNode, just like it is possible with @RelatedTo when we use elementClass attribute? I would like to avoid breaking my current architecture. Thanks for your hints!
has answer: http://stackoverflow.com/a/21784275
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
has title: Making @Fetch work with interfaces
type: Question
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/21784275
favorite count: 0
has answer: http://stackoverflow.com/a/30861648
accepted answer: http://stackoverflow.com/a/30861648
tagged with: neo4j
tagged with: spring-data-neo4j

http://stackoverflow.com/q/21740729
has answer: http://stackoverflow.com/a/21795573
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14958643
tagged with: bufferedimage
has body: I've tried this link and have the code below. My program imports images in a BufferedImage format and then displays it to the users. I'm using the matchingTemplate function in OpenCV which requires me to convert it to a Mat format. The code works if I import the image -> convert it to Mat then save the image using imwrite. The program also allows the user to crop an image and then use the Template matching to compare it to another image. The issue come when I tried to convert the cropped image to Mat I need to convert it from Int to Byte using this code: im = new BufferedImage(im.getWidth(), im.getHeight(),BufferedImage.TYPE_3BYTE_BGR); This however results in a black image. But if I get rid of it it only works with imported images and not cropped. What is going on here? I'm certain it is something to do with the coversion process as I have tested the template matching function using read in images. // Convert image to Mat public Mat matify(BufferedImage im) { // Convert INT to BYTE //im = new BufferedImage(im.getWidth(), im.getHeight(),BufferedImage.TYPE_3BYTE_BGR); // Convert bufferedimage to byte array byte[] pixels = ((DataBufferByte) im.getRaster().getDataBuffer()) .getData(); // Create a Matrix the same size of image Mat image = new Mat(im.getHeight(), im.getWidth(), CvType.CV_8UC3); // Fill Matrix with image values image.put(0, 0, pixels); return image; }
type: Question
tagged with: opencv
tagged with: java
tagged with: image-processing
tagged with: image
upvote count: 2
answer count: 1
duplicate of: http://stackoverflow.com/q/14958643
favorite count: 0
has title: Converting BufferedImage to Mat (OpenCV) in Java
score: 2

http://stackoverflow.com/a/21702791
has body: This question is not what SO is made for. Just to let you know, i think it will soon be closed. Anyways: This 2 are 2 different engines. I am using Libgdx and have never used AndEngine. But i have read some discussions, so i list some of the differences: AndEngine lets you start faster, Libgdx needs some setup and experience (IMHO) Libgdx supports crossplatforming, meaning you can develop 99% on desktop and when you finished you can add a few codelines and it runs on Android to. Libgdx is a bit more flexible and powerful, which is positiv and negativ (to flexible is overkill) Libgdx has most times a better performance as much as i know. Both have a 2D scenegraph and other possibilities to (low level ways) Source: AndEngine vs Libgdx, the developer talk both about their engine.
score: 1
answers question: http://stackoverflow.com/q/21702347
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/21803563
has title: Most simple way to pull JSON URL in Java?
linked to: http://stackoverflow.com/q/4474293
has answer: http://stackoverflow.com/a/32816289
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32994053
tagged with: http://stackoverflow.com/tag/json
score: 0
answer count: 2
tagged with: api
tagged with: url
favorite count: 0
has body: What would be the most basic way to have Java simply print out data from a JSON URL? I just want to be able to call a simple print statement on it if possible. Here is a link to the API I am trying to pull data from: Github - PHP-MPOS API Reference Thanks!
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21803581

http://stackoverflow.com/q/21780438
score: 1
tagged with: sockets
tagged with: android
has title: UDP Packet NPE - Java
favorite count: 0
accepted answer: http://stackoverflow.com/a/21780661
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32951593
tagged with: java
type: Question
tagged with: udp
has body: This is running on an android device emulator which is running on the same PC I am trying to send a UDP Packet to.(Is this the error?) Send code: private byte[] buf = new byte[1]; private DatagramPacket p; private int port = 4442; private InetAddress ip; private DatagramSocket s; try { ip = InetAddress.getByName(Dataholder.ip);//This one is holding the IP , it is confirmed that it is stored } catch (UnknownHostException e) {} try { s = new DatagramSocket(port , ip); } catch (SocketException e) {} private void sendPacket(int num){////NUM IS 1 DIGIT ONLY! buf = Integer.toString(num).getBytes(); p = new DatagramPacket(buf , buf.length, ip,port); try { s.send(p);//Null pointer this line } catch (IOException e) {} } And receiving code: byte[] data = new byte[1]; s = new DatagramSocket(4442); p = new DatagramPacket(data, data.length); while(true){ s.receive(p); } I am actually using the PC's IPv4 address...
answer count: 1
has answer: http://stackoverflow.com/a/21780661
downvote count: 0
has comment: http://stackoverflow.com/comment/32951800

http://stackoverflow.com/comment/32797099
score: 0
type: AnswerComment
type: Comment
has text: No, this will find the *last* pixel with the given color. You need to add a `break` inside the `for-loop` for this to find the *first* pixel.
comment on: http://stackoverflow.com/a/21692861

http://stackoverflow.com/comment/32904300
type: Comment
comment on: http://stackoverflow.com/q/21753252
has text: Unhapply there are no exceptions @Sanjeev
score: 0
type: QuestionComment

http://stackoverflow.com/q/21811030
has comment: http://stackoverflow.com/comment/33008004
score: 0
has title: Bean Spring doesn't work
has comment: http://stackoverflow.com/comment/33006944
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
answer count: 0
tagged with: jsf
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33007076
type: Question
has body: I am working with Spring and I have a problem with a bean, here is my code: import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.grh.bo.ICollaborateurBo; import com.grh.bo.IUserBo; import com.grh.entities.Collaborateur; @Component @Scope("session") public class CollaborateurBean implements Serializable { private static final long serialVersionUID = 1L; @Autowired private ICollaborateurBo collaborateurBo; private String nom; private String prenom; private String sflag = ""; private int currentProjectIndex; private int page = 1; public List&lt;Collaborateur&gt; listOfCollaborateur = new ArrayList&lt;Collaborateur&gt;(); private Collaborateur Collaborateurr = new Collaborateur(); List&lt;Collaborateur&gt; lis = new ArrayList&lt;Collaborateur&gt;(collaborateurBo.getAllCollaborateur()); @PostConstruct public void init() { setListOfCollaborateur(recupererCollaborateur()); Collaborateurr=new Collaborateur(); } public List&lt;Collaborateur&gt; getLis() { return collaborateurBo.getAllCollaborateur(); } public void setLis(List&lt;Collaborateur&gt; lis) { this.lis = lis; } public List&lt;Collaborateur&gt; getCollaborateurList() { return collaborateurBo.getAllCollaborateur(); } private List&lt;Collaborateur&gt; recupererCollaborateur() { List&lt;Collaborateur&gt; ps = collaborateurBo.getAllCollaborateur(); return ps; } public CollaborateurBean() { super(); } public CollaborateurBean(ICollaborateurBo collaborateurBo, String nom, String prenom, String sflag, int currentProjectIndex, int page, List&lt;Collaborateur&gt; listOfCollaborateur, Collaborateur collaborateurr, List&lt;Collaborateur&gt; lis) { super(); this.collaborateurBo = collaborateurBo; this.nom = nom; this.prenom = prenom; this.sflag = sflag; this.currentProjectIndex = currentProjectIndex; this.page = page; this.listOfCollaborateur = listOfCollaborateur; Collaborateurr = collaborateurr; this.lis = li…

http://stackoverflow.com/q/21731699
has comment: http://stackoverflow.com/comment/32865409
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21731951
tagged with: java
has body: I'm writing a program that asks the user if he wants to Average grades or quit, then asks for the students name, then it will allow the user to input grades into 3 different categories, it will loop until he is ready to quit and presses -1. I created my switch and everything is working pretty good, but how can I loop in Case 1, 2, or 3? Case 1 will be to average homework grades, it will average those homework grades and display them, then itll move to case 2, average those grades and display, which is quiz grades. Then it will move to test grades, user enters grades, presses -1, averages them, then after the third case it will Average all of the student's grades using this formula: Final Average = 0.25*HomeworkAvg + 0.25*QuizAvg + 0.50*TestAvg = 64 How can I add a loop to keep asking for grades, then move on? I feel like I'm sort of on the right track. Thanks! import java.util.Scanner; public class Assignment3 { public static void main(String[] args) { Scanner dylan = new Scanner(System.in); double homework; double quiz; double test; int choice; int choiceTwo; String name; System.out.println("Enter 1 or 2: \n 1 - Average grades \n 2 - Quit"); choice = dylan.nextInt(); if (choice == 1) { System.out.println("Enter the students name"); name = dylan.next(); System.out.println(" What would you like to do? \n 1 - Homework grades \n 2 - Quiz grades \n 3 - Test grades \n -1 - Quit"); choiceTwo = dylan.nextInt(); switch (choiceTwo) { case 1: System.out.println("Enter Homework Grades"); break; case 2: break; case 3: break; default: if (choiceTwo == -1 || choiceTwo != 1 || choiceTwo != 2 || choiceTwo != 3) ; System.out.println("Exiting program"); break; } } else if (choice == 2) { System.out.println("Exiting program."); } else { System.out.println("Invalid response, exiting program."); } } }
possible better answer: http://stackoverflow.com/a/21731829
accepted answer: http://stackoverflow.com/a/21731951
has answer: http://stackoverflow.com/a/21731829
type: Question
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/32865281
has title: Gradebook loop during the cases
favorite count: 0

http://stackoverflow.com/comment/32987203
score: 1
type: Comment
type: QuestionComment
has text: Some things need to be learnt, seriously, and not just by picking examples found on some random site. Hibernate is one of them. Read the documentation: http://hibernate.org/orm/documentation/
comment on: http://stackoverflow.com/q/21800213

http://stackoverflow.com/a/21747318
has comment: http://stackoverflow.com/comment/32894332
accepted answer of: http://stackoverflow.com/q/21746094
score: 1
answers question: http://stackoverflow.com/q/21746094
upvote count: 1
has comment: http://stackoverflow.com/comment/32896681
has body: It is working fine with me on eclipse. Modified the code a little for simplicity. If not routing data to some other page then In in this you should have the name of your JSP file which your data should get displayed. Here is the modified code. index.jsp LoginForm Spice Digital Login Page Signup Details Username: Password: select your gender: Male Female select your department: MCA B.Tech Other select your choices: java c++ c sql enter you comments here: new.jsp JSP Page Spice Digital <% // String a=session.getAttribute("username").toString(); // out.println("Welcome "+a+"..!!"); %> <% String b=request.getParameter("myradio"); out.println("Your department is "+b); %> <% String c=request.getParameter("mybox"); out.println("Your choice is "+c); %> Click here to google search LogOut problem could be with you routing as you are sending your form first to logincheck.jsp then to your desired jsp.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32902307
type: Answer

http://stackoverflow.com/comment/32929113
type: Comment
type: QuestionComment
has text: added what i want and what i have
score: 0
comment on: http://stackoverflow.com/q/21767217

matisse
tags question: http://stackoverflow.com/q/21820769
tag name: matisse
type: Tag
tags question: http://stackoverflow.com/q/21771412
tags question: http://stackoverflow.com/q/21704718

list
type: Tag
tags question: http://stackoverflow.com/q/21835855
tags question: http://stackoverflow.com/q/21812448
tags question: http://stackoverflow.com/q/21681044
tags question: http://stackoverflow.com/q/21793275
tags question: http://stackoverflow.com/q/21769112
tags question: http://stackoverflow.com/q/21788591
tags question: http://stackoverflow.com/q/21733705
tag name: list
tags question: http://stackoverflow.com/q/21700467
tags question: http://stackoverflow.com/q/21802544
tags question: http://stackoverflow.com/q/21802195
tags question: http://stackoverflow.com/q/21811872
tags question: http://stackoverflow.com/q/21805999
tags question: http://stackoverflow.com/q/21726344
tags question: http://stackoverflow.com/q/21692873
tags question: http://stackoverflow.com/q/21812209
tags question: http://stackoverflow.com/q/21820575
tags question: http://stackoverflow.com/q/21764943
tags question: http://stackoverflow.com/q/21804362
tags question: http://stackoverflow.com/q/21678430
tags question: http://stackoverflow.com/q/21737726
tags question: http://stackoverflow.com/q/21709875
tags question: http://stackoverflow.com/q/21826763
tags question: http://stackoverflow.com/q/21811972
tags question: http://stackoverflow.com/q/21685959
tags question: http://stackoverflow.com/q/21697520
tags question: http://stackoverflow.com/q/21720173
tags question: http://stackoverflow.com/q/21687576
tags question: http://stackoverflow.com/q/21711489
tags question: http://stackoverflow.com/q/21791194

http://stackoverflow.com/comment/33040820
score: 0
type: Comment
has text: Thank you for the help. But i am getting an error in "SpinnerActivity.this" But if i change to "MainActivity.this" no errors. But it doesnt work that if the first spinner changes other changes with it. I am sorry to ask this basic question. If u could help.
type: AnswerComment
comment on: http://stackoverflow.com/a/21820573

http://stackoverflow.com/a/21824978
downvote count: 0
score: 26
answers question: http://stackoverflow.com/q/21824402
upvote count: 26
type: Answer
has body: May I suggest the concept of Duck-typing? Most likely you would tend to make the Pegasus extend a Bird and a Horse interface but duck typing actually suggests that you should rather inherit behaviour. As already stated in the comments, a pegasus is not a bird but it can fly. So your Pegasus should rather inherit a Flyable-interface and lets say a Gallopable-interface. This kind of concept is utilized in the Strategy Pattern. The given example actually shows you how a duck inherits the FlyBehaviour and QuackBehaviour and still there can be ducks, e.g. the RubberDuck, which can't fly. They could have also made the Duck extend a Bird-class but then they would have given up some flexibility, because every Duck would be able to fly, even the poor RubberDuck.

http://stackoverflow.com/a/21697264
type: Answer
answers question: http://stackoverflow.com/q/21696900
has body: You should specify which cell adds which view in your addView method. This doc about GridLayout.addView may help you.
score: 0

http://stackoverflow.com/comment/32883482
comment on: http://stackoverflow.com/q/21741619
score: 0
type: Comment
type: QuestionComment
has text: @DaveNewton I didn't realize only map-reducing parallel sorting algorithms in O(1) time were the only kinds of questions you should upvote. That being said, why did you take the time to point this out?

http://stackoverflow.com/comment/32948570
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21778431
type: AnswerComment
has text: I didn't think about postfixes

http://stackoverflow.com/a/21784629
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32962273
has comment: http://stackoverflow.com/comment/32959921
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32969297
has comment: http://stackoverflow.com/comment/32961090
has comment: http://stackoverflow.com/comment/32964697
has comment: http://stackoverflow.com/comment/32962214
accepted answer of: http://stackoverflow.com/q/21784527
has comment: http://stackoverflow.com/comment/32961109
has comment: http://stackoverflow.com/comment/32969155
has body: Your current code adds the same list of connections for all the stations added to the map. That can't be right, since every station has its own list of connections. addStation() should add a station to the map, with a new empty list as value. addConnection() should get the list of connections associated to the station in the map, and should add a station to this list. Just a few additional notes: the type of the Map should be Map&lt;String, List&lt;String&gt;&gt; you could use Guava, which has Multimaps, making this process easier: no need to care about initializing an empty list, be able to add directly to the multimap instead of getting the list out of it and adding to the list.
upvote count: 2
has comment: http://stackoverflow.com/comment/32959852
answers question: http://stackoverflow.com/q/21784527
has comment: http://stackoverflow.com/comment/32967249

http://stackoverflow.com/a/21847093
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21837250
downvote count: 0
score: 1
has body: Not sure, why Hover is ignored for you. I can see, that it is tracked (please see screenshot), and mouse stays hovered over composite for at least a second. Your code was used without any modifications. May be it is somehow related to OS? Try to call composite.setEnabled(true); as disabled controls do not receive mouse events.

http://stackoverflow.com/comment/32819281
comment on: http://stackoverflow.com/a/21705002
type: AnswerComment
score: 0
has text: look at in the addprod = benta[]; it is error and also the line you edited its error to me sir .
type: Comment

http://stackoverflow.com/q/21798980
score: -3
has body: Well as the title says.. I have a feeling I did something wrong in my code. import java.util.Scanner; import java.util.Calendar; public class AgePrompt { public static void main(String[] args){ Scanner userInput = new Scanner(System.in); String age; System.out.print("Enter your date of birth here: "); age = userInput.next(); String myDate = java.text.DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime()); System.out.println("Your age is: "+myDate); } } So where did I go wrong?
has comment: http://stackoverflow.com/comment/37890689
type: Question
has comment: http://stackoverflow.com/comment/32985013
linked to: http://stackoverflow.com/q/20233990
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/21799000
linked to: http://stackoverflow.com/q/1116123
has comment: http://stackoverflow.com/comment/32984984
has comment: http://stackoverflow.com/comment/32984949
has comment: http://stackoverflow.com/comment/32985019
duplicate of: http://stackoverflow.com/q/1116123
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/20091877
has title: Java age calculator, not producing right age
tagged with: calculator
has comment: http://stackoverflow.com/comment/32985368
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/33061295
type: Comment
has text: This is utterly and completely incorrect. The OP is using the iterator's `remove()` method. Why do you think `ListIterator` and `Iterator` have `remove()` methods? In fact you *have* to use the iterator's remove() method to remove something from a list while iterating through it so it can deal with the issues you describe.
score: 1
comment on: http://stackoverflow.com/a/21841753
type: AnswerComment

http://stackoverflow.com/comment/33056022
type: Comment
type: QuestionComment
has text: consider removing the setter from the version field and refactoring any code that uses it. this field is for internal hibernate use only, there is good reason to give write access to this field to the aplication
comment on: http://stackoverflow.com/q/21832573
score: 0

http://stackoverflow.com/comment/33028231
type: AnswerComment
comment on: http://stackoverflow.com/a/21823127
score: 0
type: Comment
has text: it is aloocated by kernel as buffers and reclaimable caches

http://stackoverflow.com/comment/32993008
type: Comment
score: 0
type: AnswerComment
has text: "The first (left-most) modifier used lets you control what other classes have access to a member field. For the moment, consider only public and private. Other access modifiers will be discussed later. public modifier—the field is accessible from all classes. private modifier—the field is accessible only within its own class." (http://docs.oracle.com/javase/tutorial/java/javaOO/variables.html)
comment on: http://stackoverflow.com/a/21803285

http://stackoverflow.com/comment/32937875
type: AnswerComment
score: 0
type: Comment
has text: .\test\automation\proxy_launcher.cc(269): error: Value of: WaitForBrowserProcessToQuit( TestTimeouts::action_max_timeout_ms(), &exit_code) Actual: false Expected: true .\test\automation\proxy_launcher.cc(270): error: Value of: exit_code Actual: -1 Expected: 0 org.openqa.selenium.WebDriverException: Unable to either launch or connect to Chrome. Please check that ChromeDriver is up-to-date. Using Chrome binary at: C:\Users\Bnaresh\AppData\Local\Google\Chrome\Application\chrome.exe (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 51.73 seconds
comment on: http://stackoverflow.com/a/21680351

http://stackoverflow.com/q/21730587
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21730631
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/32936345
has body: I have some string stored in String url="*/One Url/*" Document doc = Jsoup.connect(url).get(); Elements paragraphs = doc.select("td"); for(Element p : paragraphs) System.out.println(p.text()); So in p.text() I have some strings. And the output is in several lines. Now is there is any way by which I can handle the output in string array. So that I can use the data in different place.
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21730631
has title: Java String Extraction

http://stackoverflow.com/a/21763595
type: Answer
has body: I would use a Deque (also pronounced Deck) Stack and Vector were designed almost 20 years ago and Deque is a relatively new design (about 8 years) Stack doesn't use an interface allowing it to hide methods which don't make sense for it's intended purpose.
answers question: http://stackoverflow.com/q/21763542
has comment: http://stackoverflow.com/comment/32922042
score: 4
has comment: http://stackoverflow.com/comment/32922045
has comment: http://stackoverflow.com/comment/32922313
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/21771856
has comment: http://stackoverflow.com/comment/32937263
score: 8
has comment: http://stackoverflow.com/comment/32937257
has body: The split() method has a secret, optional 2nd parameter! String[] array = str.split("\\|", -1); // won't discard trailing empty elements By default, split() (with one parameter) discards trailing empty elements from the result. If the second parameter is provided, this default discarding behaviour is turned off and if positive limits the number of elements extracted (but will return less than this if less elements found), or if negative returns unlimited elements. Read about it in the javadoc.
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/21771835
answers question: http://stackoverflow.com/q/21771835

http://stackoverflow.com/q/21780777
downvote count: 9
has answer: http://stackoverflow.com/a/21781146
answer count: 2
tagged with: jsp
has answer: http://stackoverflow.com/a/21780856
favorite count: 0
tagged with: jsp-tags
type: UnansweredQuestion
has title: I need to know what kind of tags now use in JSP?
has body: I need to know what tags are now use in jsp? I heard that using scrip-lets is not a good practice.Please suggest be tags to learn with jsp.
upvote count: 2
tagged with: java
type: Question
score: -7

http://stackoverflow.com/comment/32954472
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21781655
has text: Tell me one thing after run program, what error message do you get?

http://stackoverflow.com/q/21730203
has comment: http://stackoverflow.com/comment/51697137
tagged with: java
has comment: http://stackoverflow.com/comment/32863617
type: Question
tagged with: database
score: 0
has comment: http://stackoverflow.com/comment/32864597
tagged with: tf-idf
type: UnansweredQuestion
has title: Calculating Document Frequency in HashMap java
has comment: http://stackoverflow.com/comment/32863998
has comment: http://stackoverflow.com/comment/32863731
has body: I'm trying to achieve counting TF-IDF in java with DB as the corpus of document. I have done calculating the Term Frequency store in hashmap, but i have a problem, how can i calculate the document frequency each term? eg. the term "president" occurs in which document id? and how many it occurs in other document? i have 3 documents in DB for training, im stuck here, any advice? and thanks for helping, here is my code: try{ Map &lt;String,Integer&gt; kamus = new HashMap&lt;String, Integer&gt;(); k.Koneksi(); String sql = "select * from data_berita"; Statement n = k.koneksi.createStatement(); ResultSet res = n.executeQuery(sql); while(res.next()){ int id = res.getInt("id"); String konten = res.getString("konten"); String f = konten.replaceAll("[-?/&lt;&gt;_+=!@#%&amp;*.“”‘’()$·,';:{}|\"]", "").toLowerCase(); String [] array = f.split("\\s+"); for(String s : array){ int fl = 1; k.Koneksi(); String sq = "Select * from StopWord"; Statement stat = k.koneksi.createStatement(); ResultSet rs = stat.executeQuery(sq); while(rs.next()){ if(s.equals(rs.getString("Stopword"))){ fl=0; } } if (fl!=0){ if(kamus.containsKey(s)){ kamus.put(s, kamus.get(s)+1); } else{ kamus.put(s, 1); } } } for(Map.Entry&lt;String,Integer&gt; en : kamus.entrySet()){ String d = en.getKey(); Integer s = en.getValue(); System.out.println(d+" "+s); } and this is the result of term frequency(not all): alliance=1, president=3, suzhou=3, unloading=1, attended=1, liquefied=1, bright=1
answer count: 0

http://stackoverflow.com/comment/33041640
comment on: http://stackoverflow.com/q/21706565
score: 0
has text: I've updated the original question.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32824485
comment on: http://stackoverflow.com/q/21708702
score: 0
type: QuestionComment
has text: Without seeing logs it's really hard to know what's wrong here
type: Comment

http://stackoverflow.com/a/21859970
type: Answer
has body: I have found the answer. I was testing for the remote user before the chain.doFilter() method was called, in my filter. The authentication process (In Websphere) happens after the doFilter chain happens. So I moved my code that checks if a user is authenticated after the chain.doFilter() method. This fixed the issue.
accepted answer of: http://stackoverflow.com/q/21713666
score: 0
answers question: http://stackoverflow.com/q/21713666
type: AcceptedAnswer

http://stackoverflow.com/q/21771855
tagged with: java
has comment: http://stackoverflow.com/comment/32937280
has title: Base conversion of large integers using java
type: Question
has comment: http://stackoverflow.com/comment/32937377
has comment: http://stackoverflow.com/comment/32938189
has comment: http://stackoverflow.com/comment/32937278
score: 0
tagged with: base-conversion
has body: I have written the following code: public String alphabets = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#$%"; public Integer findBase(String input) { int i = 0; Integer base = 0; Integer temp = 0; while (i != input.length()) { temp = alphabets.indexOf(input.charAt(i)) + 1; if (temp &gt; base) { base = temp; } i ++; } public String convert(String input, Integer to_base, Integer from_base) { int i; Long base_ten = 0L; Integer input_base = 0; // If specified, then consider that base as input from base, or else, // calculate the base of the number if (from_base == 0) { input_base = findBase(input); } else { input_base = from_base; } Integer power = 0; Double temp_power = 0.0; while (!input.equals("")) { temp_power = Math.pow(input_base, power); base_ten = base_ten + alphabets.indexOf(input.charAt(input.length() - 1)) * temp_power.intValue(); input = input.substring(0, input.length() - 1); power = power + 1; } Long rem = 0L; String result = ""; while (base_ten != 0L) { rem = base_ten % to_base; base_ten = base_ten / to_base; result = result + alphabets.charAt(rem.intValue()); } String reverse = new StringBuffer(result).reverse().toString(); return reverse; } Using the above code, it is possible to convert strings like say "suchin" (Base 31) to other bases. But whenever I use something larger, like say "suchind", I get an exception at the following line in above code: result = result + alphabets.charAt(rem.intValue()); saying that the index is -1. When I dug a little deeper, I felt that rem.intValue() is somehow going negative (-1) for some large values. Not sure how to get this solved. Is there a way of converting between bases for large numbers in java? BigInteger version of code is below: public String convert(String input, BigInteger to_base, BigInteger from_base) { int i; BigInteger base_ten = new BigInteger("0"); BigInteger input_base = new BigInteger("0"); if (from_base.equals(BigInteger.valueOf(0))) { input_base = BigInteger.valueOf(findBase(in…
has comment: http://stackoverflow.com/comment/32937242
has comment: http://stackoverflow.com/comment/32938501
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32937328
has comment: http://stackoverflow.com/comment/32937404

http://stackoverflow.com/q/21743873
has title: cordova platform add android get an error in JAVA_HOME
tagged with: android
has body: I just install my cordova 3.3 in my windows 8, when i use the command "cordova platform add android" i receive this error message Error: failed to run 'java -version', make sure your java environment is set up including jdk and jre your JAVA_HOME variable is c:\program files(x86)\java\jdk1.7.0_25\bin Error: Command failed: 'java' is not recognized as an internal or external command, operable program or batch file. here's my system variable for JAVA_HOME C:\Program Files (x86)\Java\jdk1.7.0_25\bin and for the path, i added this one C:\Program Files (x86)\Java\jdk1.7.0_25;C:\Program Files (x86)\Java\jre7 anyone can help me with this issue?
has answer: http://stackoverflow.com/a/21744097
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21744097
score: 3
tagged with: cordova
downvote count: 0
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21744021
has answer: http://stackoverflow.com/a/21744021
upvote count: 3
answer count: 2
favorite count: 0

http://stackoverflow.com/comment/33136576
score: 0
type: AnswerComment
has text: Look at this SST(especially 6 - Pagination control), you can find lots of sample code about getting tweets; http://twitter4j.org/en/code-examples.html
type: Comment
comment on: http://stackoverflow.com/a/21840540

http://stackoverflow.com/comment/33053023
type: Comment
type: QuestionComment
has text: What wrong with `ClassCastException` at runtime??
score: 0
comment on: http://stackoverflow.com/q/21837286

http://stackoverflow.com/comment/32940553
type: Comment
comment on: http://stackoverflow.com/a/21751158
has text: If you have xampp, go in c://yourxampppath/php/ and edit the php.ini, and in the line ;extension=php_curl.dll, delete the ";" and restart
type: AnswerComment
score: 0

http://stackoverflow.com/a/21690221
upvote count: 5
downvote count: 0
type: Answer
has body: java.time Read the below Joda-Time section for details. The Joda-Time project, now in maintenance mode, advises migration to the java.time classes. The Instant class represents a moment on the timeline in UTC with a resolution of nanoseconds (up to nine (9) digits of a decimal fraction). long milliseconds = … ; Instant instant = Instant.ofEpochMilli( milliseconds ); // Or use Instant.now() to experiment. For formatting, convert to OffsetDateTime. OffsetDateTime odt = instant.atOffset( ZoneOffset.UTC ); The DateTimeFormatter class provides a ready-made formatter for your desired format. That format is defined by the RFC 1123 standard. String output = odt.format ( DateTimeFormatter.RFC_1123_DATE_TIME ); Wed, 11 Jan 2017 21:35:19 GMT With other formatters, I would say to always specify the Locale. But that particular formatter for RFC 1123 is hard-coded to English per the RFC requirements. So specifying a Locale has no effect on the output. Joda-Time Just for the heck of it, here's the same kind of code from the correct answer by Meno Hochschild but using the Joda-Time 2.3 library. A couple notes… In date-time work, the milliseconds number must be a long not int (64-bit vs 32-bit). The HTTP spec requires the use of English for name of day and month. So we should specify English explicitly in case our code ever runs on a JVM where English is not the default Locale. Sample Code // Note how the variable for milliseconds is a "long" not "int". long milliseconds = DateTime.now().getMillis(); // Get milliseconds from java.io.File method "lastModified", or wherever. DateTime dateTime = new DateTime( milliseconds, DateTimeZone.UTC ); DateTimeFormatter formatter = DateTimeFormat.forPattern( "EEE, dd MMM yyyy HH:mm:ss 'GMT'" ).withZone( DateTimeZone.UTC ).withLocale( java.util.Locale.ENGLISH ); String httpDateTime = formatter.print( dateTime ); Dump to console… System.out.println( "milliseconds: " + milliseconds ); System.out.println( "dateTime: " + dateTime ); System.out.printl…
score: 5
answers question: http://stackoverflow.com/q/21682448

http://stackoverflow.com/comment/32812666
comment on: http://stackoverflow.com/q/21701636
score: 0
type: Comment
type: QuestionComment
has text: How about using this one, seems to split your input alright: http://stackoverflow.com/questions/5946471/splitting-at-space-if-not-between-quotes

http://stackoverflow.com/a/21816284
has comment: http://stackoverflow.com/comment/33019259
has comment: http://stackoverflow.com/comment/33128354
type: Answer
answers question: http://stackoverflow.com/q/21815478
has comment: http://stackoverflow.com/comment/33135519
has comment: http://stackoverflow.com/comment/33018766
score: 4
upvote count: 4
has body: While I recommend the guide† for professional developers, students and afficionados will want to examine the extant examples and source. org.jfree.chart.demo.TimeSeriesChartDemo1, included in the distribution, is particularly relevant to your use case, and the associated createTimeSeriesChart() methods of ChartFactory show how such a chart is constructed using a DateAxis. †Disclaimer: Not affiliated with Object Refinery Limited; just a satisfied customer and very minor contributor.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21815478

annotation-processing
tags question: http://stackoverflow.com/q/21750913
tag name: annotation-processing
type: Tag
tags question: http://stackoverflow.com/q/21822951

http://stackoverflow.com/a/37657923
has comment: http://stackoverflow.com/comment/137624577
type: Answer
has body: Be careful super can keep its own version of this.i in Java, but self.i always refer to the child in Python. Main.java: class Parent { int i; Parent() { this.i = 5; } void doStuff() { System.out.println(this.i); } } class Child extends Parent { int i; Child() { this.i = 7; } } class Main { public static void main(String[] args) { Child m = new Child(); System.out.println(m.i); //print 7 m.doStuff(); //print 5 } } Main.py: class Parent(object): i = 5; def __init__(self): self.i = 5 def doStuff(self): print(self.i) class Child(Parent, object): def __init__(self): super(Child, self).__init__() self.i = 7 class Main(): def main(self): m = Child() print(m.i) #print 7 m.doStuff() #print 7 m = Main() m.main() Output: $ java Main 7 5 $ python Main.py 7 7 [Update] The reason is because Java's int i declaration in Child class makes the i become class scope variable, while no such variable shadowing in Python subclassing. If you remove int i in Child class of Java, it will print 7 and 7 too.
upvote count: 16
answers question: http://stackoverflow.com/q/21694901
has comment: http://stackoverflow.com/comment/138154521
has comment: http://stackoverflow.com/comment/138080703
downvote count: 0
score: 16

http://stackoverflow.com/comment/32904048
score: 0
has text: What exactly are you trying to achieve?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21753687

http://stackoverflow.com/a/21683686
type: AcceptedAnswer
type: Answer
has body: You have a namespace mismatch between your source XML and your XSL transformation. In the XML, namespace prefix x is bound to ext:extractor. In the XSL, it's bound to http://something//x. Change the stylesheet to match the XML, and your transformation works as intended. Example: http://xsltransform.net/948Fn5d
answers question: http://stackoverflow.com/q/21683577
accepted answer of: http://stackoverflow.com/q/21683577
score: 0

http://stackoverflow.com/q/21742268
has title: Android: How to get/convert long to int?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21742414
score: 4
type: Question
upvote count: 4
tagged with: long-integer
answer count: 1
downvote count: 0
favorite count: 0
tagged with: int
accepted answer: http://stackoverflow.com/a/21742414
tagged with: android
has body: Calendar c = Calendar.getInstance(); long diff = c.getTimeInMillis() - DateSaved.getTimeInMillis(); //result in millis long daysDiff = (diff / (24 * 60 * 60 * 1000)); Everything works fine, when i print diff (integer number of days)... The problem starts here: int daysDiffINT = (int) daysDiff; int daysRemaining = (sumaINT/dailyINT) - daysDiffINT; i need to proceed my long diff with some int values. This above doesn't work.The console gives me an error: "Invalid int" I searched a little bit, there are thousands of converting String to Int etc. But how can I get int from long? Or String from long? It's driving me crazy :( // BIG Thanks for all of you - you've learned me how to make my own app :)

http://stackoverflow.com/comment/32798172
score: 0
type: Comment
has text: it should be fine then. In any of your class, try importing it for test purpose, like `import org.apache.derby.jdbc.` press control+space . Is Eclipse showing you the various classes in the package? Also do you see derby.jar inside the Libraries in Java Resources in your eclipse project?
type: QuestionComment
comment on: http://stackoverflow.com/q/21693422

http://stackoverflow.com/q/21700133
has comment: http://stackoverflow.com/comment/32809049
accepted answer: http://stackoverflow.com/a/21700291
type: Question
has comment: http://stackoverflow.com/comment/32809218
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/32808977
has answer: http://stackoverflow.com/a/21700291
has body: I am trying to do a chaning Job. So to some point I want to access the args (public static void main(String[] args)). say args[0] in mapper. Is there a way to access those values in mapper rather than sending them to function and accessing? Alternative Solution conf.set("args", args[1]); job1.setJarByClass(BinningDriver.class); FileSystem fs1 = FileSystem.get(conf); job1.setOutputKeyClass(Text.class); job1.setOutputValueClass(Text.class); job1.setMapperClass(BinningInput.class); job1.setInputFormatClass(TextInputFormat.class); job1.setOutputFormatClass(TextOutputFormat.class); Path out = new Path(args[1]+"/Indexing"); //Output goes to user output location/indexing if(fs1.exists(out)){ fs1.delete(out,true); } FileInputFormat.addInputPath(job1, new Path(args[0])); FileOutputFormat.setOutputPath(job1, out); } Mapper public void setup(Context context){ Configuration conf = context.getConfiguration(); String param = conf.get("args"); System.out.println("args:"+param); } This Works
tagged with: mapreduce
tagged with: hadoop
has comment: http://stackoverflow.com/comment/32809114
has comment: http://stackoverflow.com/comment/32808952
type: AnsweredQuestion
has title: Access args[0] value in MapReduce

http://stackoverflow.com/comment/32879518
comment on: http://stackoverflow.com/q/21739325
score: 0
has text: @DRastislav I think he just wants help with html formatting and basic file writing.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33118221
type: Comment
has text: @YvesDaoust: That's fine, I just wanted to stress that there's some buffering anyway and that you can minimize the IO simply by using `new BufferedInputStream(is, reallyALot)`. The other optimizations go further than just minimizing IO.
type: AnswerComment
comment on: http://stackoverflow.com/a/21829443
score: 0

http://stackoverflow.com/q/21705024
has title: Adding session synchronization to Spring MVC
tagged with: spring
type: Question
tagged with: model-view-controller
type: AnsweredQuestion
tagged with: session
tagged with: java
accepted answer: http://stackoverflow.com/a/21738309
answer count: 1
has answer: http://stackoverflow.com/a/21738309
favorite count: 0
has comment: http://stackoverflow.com/comment/32818139
upvote count: 3
downvote count: 1
tagged with: synchronization
score: 2
has body: I need to add session synchronization to a Spring MVC application. I'm using Spring 3.1.2. The synchronization is required because I will have multiple AJAX calls updating session data. Rather than synchronize the session data within the web app, the design decision was made to force the incoming calls to be processed synchronously. In my servlet.xml, I have the following: &lt;mvc:annotation-driven /&gt; &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt; &lt;property name="synchronizeOnSession" value="true" /&gt; &lt;/bean&gt; Yet if I do two AJAX calls from the same session to the same request handler, they both will execute at the same time. I was expecting the synchronizeOnSession to prevent this. Am I missing something in the configuration?

http://stackoverflow.com/comment/32885533
score: 0
type: Comment
has text: @fickerra Consider changing to using JDBC prepared statements part of the porting effort. I really don't recommend trying to bypass that.
type: AnswerComment
comment on: http://stackoverflow.com/a/21728276

http://stackoverflow.com/comment/32774640
type: Comment
type: QuestionComment
score: 2
has text: http://en.wikipedia.org/wiki/Leap_year#Algorithm
comment on: http://stackoverflow.com/q/21680781

http://stackoverflow.com/a/27175876
downvote count: 0
type: AcceptedAnswer
has body: We solved this by using the DataStax Java Driver instead of Astyanax.
type: Answer
accepted answer of: http://stackoverflow.com/q/21704289
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21704289

http://stackoverflow.com/q/21686222
score: 0
answer count: 3
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/21686271
tagged with: bitmap
type: AnsweredQuestion
has body: Is there a way to process an image / drawable in Android (Java) to make the last X pixels of the image stretch or repeat to the bottom of the screen. I would like to know if this is possible to achieve and if there is a name for this effect or existing algorithm. Thank you in advance. Just please note that I am aware of 9patch images and it is not the way I want to go with, I explicitly need to apply this in code. Thank you in advance, bellow is an image
tagged with: android-drawable
has title: How can I make this transformation of an image in Android using Java
tagged with: java
has answer: http://stackoverflow.com/a/21686357
has answer: http://stackoverflow.com/a/21686271
possible better answer: http://stackoverflow.com/a/21686355
tagged with: image-processing
has answer: http://stackoverflow.com/a/21686355
type: Question
linked to: http://stackoverflow.com/q/5432495

http://stackoverflow.com/a/21749318
has comment: http://stackoverflow.com/comment/32896739
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32897238
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32898101
accepted answer of: http://stackoverflow.com/q/21748970
has body: If there are three 'l' you only add two and in the next step are two 'l' and you add one of them. Then the same with the two 'o' where you are adding one. You only have to clear the result string when you step to the next letter and before save the result in another variable, but only if its is longer! public String longestSequenceOfChar(String str){ String interimresult=""; String result=""; //final result for(int i=0;i&lt;str.length();i++){ char ch=str.charAt(i); interimresult += ch; //add the letter once for(int j=i+1;j&lt;str.length();j++){ char ch1=str.charAt(j); if(ch!=ch1){ break; } interimresult +=ch; } if(interimresult.length()&gt;result.length())//store the result if it is longer result = interimresult; interimresult = ""; //clear to continue with the next letter } return result; }
type: Answer
has comment: http://stackoverflow.com/comment/32898250
answers question: http://stackoverflow.com/q/21748970
score: 2

http://stackoverflow.com/comment/33364300
has text: That looks like a nice enhancement we could add to wildfly/undertow, could you create jira for this? https://issues.jboss.org/browse/WFLY
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21837506
score: 1

http://stackoverflow.com/a/21755725
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21753639
answers question: http://stackoverflow.com/q/21753639
score: 1
has body: The reason your messages are not displayed because you've added the code to add message in a getter which is not ideal. Why getter gets called multiple times Remove the adding message code and put inside a method which gets called on some action.

http://stackoverflow.com/q/21704431
tagged with: android-wifi
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/21773314
upvote count: 2
tagged with: java
answer count: 1
tagged with: network-programming
has answer: http://stackoverflow.com/a/21773314
has title: How to get scanned wifi networks security type? And what is the network configuration required to connect to particular network using WiFi in android?
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6866153
has body: I am new to android development &amp; I am trying to create an app which connects to available wifi network for data communication. There are various security types for wifi network configuration.(EX WEP, etc). How to know which network is using which security type? &amp; after knowing that, how to connect to particular network. I've searched a lot for my problem, &amp; found this: WEP Network requires: wifiConfigObj.wepKeys[0] = "\"" + networkPass + "\""; wifiConfigObj.wepTxKeyIndex = 0; wifiConfigObj.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); wifiConfigObj.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40); EAP Network requires: wifiConfigObj.preSharedKey = "\""+ networkPass +"\""; Public Network requires wifiConfigObj.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); But still I am unable to get any clarity. Please Let me know how to get through it. Thanks..
downvote count: 0

http://stackoverflow.com/comment/32848958
has text: The Move command which i have added extends to thre Eclipse REfactoring API. I use the LTK Framework, so the move actually performs the operation accordingly. But i need to add few more details /conditions for the move of my domain objects. Even in Eclipse plugin , for Java files the Move does not appear. Only Refactor->move.
comment on: http://stackoverflow.com/q/21722354
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33040071
comment on: http://stackoverflow.com/a/21828069
has text: Then you have to specify your requirements more clearly. You could implement this interface, for example, with a backing array, which would involve the minimal memory overhead. But then, add/contains would no longer be O(1) but O(n)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21705002
has comment: http://stackoverflow.com/comment/32818098
type: Answer
has comment: http://stackoverflow.com/comment/32819330
has comment: http://stackoverflow.com/comment/32820525
has comment: http://stackoverflow.com/comment/32819281
has comment: http://stackoverflow.com/comment/32818867
has body: You might want to check out putting this into a bigger loop. You could set up a loop and then use generic statements to add Labels and size them instead of adding a different Label object for each one. It would cut about 20 lines of code. EDIT: By loops I was talking about how to deal with setting bounds and adding to the panel. An example would be something like while(condition) { panel.add(new JLabel(information).setBounds(bounds)); } This gets rid of the repetition of having code like: JLabel p1 = new JLabel(info); JLabel p2 = new JLabel(info2); ... panel1.add(p1); panel1.add(p2); ... p1.setBounds(bounds1); p2.setBounds(bounds2); ...
score: 0
has comment: http://stackoverflow.com/comment/32821937
has comment: http://stackoverflow.com/comment/32820593
answers question: http://stackoverflow.com/q/21704742
has comment: http://stackoverflow.com/comment/32818330
has comment: http://stackoverflow.com/comment/32819598

http://stackoverflow.com/q/21692890
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22823301
has title: Read and display video from mjpeg stream in java
tagged with: jmf
tagged with: java
tagged with: xuggle
tagged with: opencv
downvote count: 0
type: UnansweredQuestion
has body: I use the following code to broadcast live mjpeg stream from my webcam. import com.github.sarxos.webcam.Webcam; import com.github.sarxos.webcam.WebcamStreamer; public class MjpegStreamingExample { public static void main(String[] args) throws InterruptedException { Webcam w = Webcam.getDefault(); new WebcamStreamer(8080, w, 0.5, true); do { Thread.sleep(5000); } while (true); } How can i receive this live stream and display it with java in another computer?
score: 2
answer count: 1

http://stackoverflow.com/a/21778928
answers question: http://stackoverflow.com/q/21744714
has body: You have to follow a precise semantic rule to make it work, so that GlueGen is able to locate native libraries within the JARs, extract them and load them: http://forum.jogamp.org/Packaging-JOGL-projects-to-be-cross-platform-tp4031261p4031286.html
type: Answer
has comment: http://stackoverflow.com/comment/47392480
has comment: http://stackoverflow.com/comment/47369746
has comment: http://stackoverflow.com/comment/33861063
score: 0

http://stackoverflow.com/q/21792460
has answer: http://stackoverflow.com/a/21792506
tagged with: string
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/21792499
accepted answer: http://stackoverflow.com/a/21792535
has title: Making a program that displays the next year that has no distinctive digits in Java?
type: AnsweredQuestion
has body: I was wanting to know if anyone could help me out with this problem. The purpose of the program is suppose to be that the user enters a year, say 1980 and the program returns the next year that has distinctive digits, distinctive being all the digits are different, for example 2013-2019, 2012 is not distinctive since the number two occurs twice, 2013-2019 are all distinct because the numbers only occur once. User enters year Program calculates next year that has distinctive digits This is the code I have right now. The only purpose of it right now is to return true if the number the user enters is distinct, I could only find a way of doing it with String type and charAt method. I don't think you can increment strings but if it is possible for the user to enter an int and the program keeps incrementing until it finds a number that is distinct but all I could come up with is a function that accepts string. Is there a similar method I could make with int as a parameter or is there a way I could possibly make it work with Strings? public static boolean hasDuplicates(String text){ for(int i = 0; i &lt; text.length() - 1; i++){ for(int j = i + 1; j &lt; text.length(); j ++){ if(text.charAt(i) == text.charAt(j)){ return true; } } } return false; } Any advice is appreciated. Also my apologies for the lack of tags. Edit: Thank you. Full code at http://pastebin.com/FQj1yeCk
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21792503
downvote count: 0
has answer: http://stackoverflow.com/a/21792535
tagged with: int
has answer: http://stackoverflow.com/a/21792499
score: 3

http://stackoverflow.com/q/21819213
has comment: http://stackoverflow.com/comment/33021436
upvote count: 0
has comment: http://stackoverflow.com/comment/33021457
tagged with: arrays
has comment: http://stackoverflow.com/comment/33021465
score: -3
has answer: http://stackoverflow.com/a/21819258
type: AnsweredQuestion
has body: For example, I have 2 char arrays and I want to compare them. If even one of chars doesn't match (is marked as 'false'), program should return 'false' for the whole array.
favorite count: 0
accepted answer: http://stackoverflow.com/a/21819258
type: Question
has comment: http://stackoverflow.com/comment/33021450
answer count: 1
has title: How to check if there is such x (in X) for which y is 'false' and then mark the whole set X 'false'?
tagged with: java
downvote count: 3

http://stackoverflow.com/a/21752954
type: Answer
accepted answer of: http://stackoverflow.com/q/21752766
has body: I believe that this happens because your application server loads web application using separate class loader. You should consult your app server documentation how to make it to use the same class loader for whole enterprise application.
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21752766

http://stackoverflow.com/comment/32942835
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21762955
has text: Thanks vanOekel, this worked! I tried your solution earlier but I wrongly added few more parameter to the httppost object which might have been the problem.

http://stackoverflow.com/q/21689781
tagged with: java
tagged with: overriding
has comment: http://stackoverflow.com/comment/32791292
has answer: http://stackoverflow.com/a/21691292
downvote count: 0
tagged with: generics
tagged with: inheritance
favorite count: 0
has answer: http://stackoverflow.com/a/21689799
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21689881
has title: error in overriding generic collections in Java
has answer: http://stackoverflow.com/a/21689808
score: 1
upvote count: 1
type: Question
has body: When I try to override a method that takes a List&lt;String&gt;, I get the following compile error. Multiple markers at this line: - The method getname(List&lt;Integer&gt;) of type child must override or implement a supertype method - Name clash: The method getname(List&lt;Integer&gt;) of type child has the same erasure as getname(List&lt;String&gt;) of type parent but does not override it I was under the impression, that due to erasure, a method that takes a List&lt;String&gt; and a subclass method that takes a List&lt;Integer&gt; would be considered as overridden, because the signature of both methods are same after erasure. Here is the definition for method signature that involves erasure. I do not understand why this error comes and what exactly it means. My code is below: class parent { public void getname(List&lt;String&gt; num) { System.out.printf("parent class: %s",num); } } class child extends parent { @Override // here is the compile error public void getname(List&lt;Integer&gt; num) { System.out.printf("child class: %s",num); } }
has answer: http://stackoverflow.com/a/21690951

http://stackoverflow.com/q/21755614
type: Question
tagged with: c#
score: 0
answer count: 1
has title: HOW to Sign data in C# in wp8
type: UnansweredQuestion
has body: I am developing wp8 app. I send public key to server in 1st login request.In response server sends token (its simple base64 string with around 1200-1300 characters) which I need to sign with private key and send back to server in next request.Now server verifies that token with corresponding public key I sent in 1st request. I have working java code which does above thing. String privateKey = sharedPref.getString("privateKey", ""); byte [] decoded = Base64.decode(privateKey, Base64.NO_WRAP); KeyFactory kf = KeyFactory.getInstance("RSA"); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(decoded); PrivateKey privateKeyNew = kf.generatePrivate(keySpec); String tokenSp = sharedPref.getString("token", ""); byte[] tokenBytes = tokenSp.getBytes(); Signature dsa = Signature.getInstance("SHA1withRSA"); dsa.initSign(privateKeyNew); dsa.update(tokenBytes); byte[] signedData = dsa.sign(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(tokenBytes); baos.write(signedData); byte[] finalout = baos.toByteArray(); signedToken = new String(Base64.encode(finalout, 0, finalout.length, Base64.NO_WRAP)); I want achieve same in c#. Code I have written is : UnicodeEncoding ByteConverter = new UnicodeEncoding(); CspParameters parameters = new CspParameters(); parameters.KeyContainerName = "MyContainer"; RSACryptoServiceProvider obj = new RSACryptoServiceProvider(parameters); byte[] dataToEncrypt=ByteConverter.GetBytes(s[0]); byte[] SignedData=obj.SignData(dataToEncrypt, "SHA256"); MemoryStream stream = new MemoryStream(); stream.Write(dataToEncrypt,0,dataToEncrypt.Count()); stream.Write(SignedData,0,SignedData.Count()); byte[] finalBytesToSend = stream.ToArray(); string s2 = Convert.ToBase64String(finalBytesToSend); return s2; And to server I send "SHA256" as public key to verify.Is it correct what I have done in c#?
has answer: http://stackoverflow.com/a/21756661
tagged with: java
tagged with: rsa
tagged with: encryption-asymmetric
tagged with: windows-phone-8

http://stackoverflow.com/comment/32883607
type: QuestionComment
comment on: http://stackoverflow.com/q/21741004
score: 0
has text: What are the variables `s` and `c`?
type: Comment

http://stackoverflow.com/q/21751253
tagged with: java-8
has answer: http://stackoverflow.com/a/21751400
type: AnsweredQuestion
tagged with: enums
linked to: http://stackoverflow.com/q/21751830
score: 1
tagged with: java
has body: I have the following already: public enum InvoiceCurrency { EUR( s -&gt; (s.contains("€") || s.contains("EUR")) ), USD( s -&gt; (s.contains("$") || s.contains("USD")) ); private final Predicate&lt;String&gt; predicate; InvoiceCurrency(final Predicate&lt;String&gt; predicate) { this.predicate = predicate; } public boolean matchesString(final String value) { return predicate.test(value); } public static EnumMap&lt;InvoiceCurrency, Integer&gt; createMapping(final Stream&lt;String&gt; valuesStream) { EnumMap&lt;InvoiceCurrency, Integer&gt; mapping = new EnumMap&lt;&gt;(InvoiceCurrency.class); mapping.replaceAll((k, v) -&gt; 0); Stream&lt;InvoiceCurrency&gt; enums = Arrays.stream(InvoiceCurrency.values()); valuesStream.forEach( s -&gt; enums.forEach( e -&gt; { if (e.matchesString(s)) { mapping.compute(e, (k, v) -&gt; v++); } } ) ); return mapping; } } private InvoiceCurrency calculateCurrency() { EnumMap&lt;InvoiceCurrency, Integer&gt; map = InvoiceCurrency.createMapping(data.words.stream().map(w -&gt; w.content)); InvoiceCurrency maximum = map.entrySet().parallelStream(). //how to continue? } This results in a mapping from the enum to the 'number of occurences', so EUR can be mapped to 10 and USD to 1. Possibly, the count may be the same. Now have do I, as concise as possibly and with the ability to use java-8, get the InvoiceCurrency that belongs to the highest number? And is there a concise way to see that the top 2 of the sorted integer count actually has the same value? I know I can program it with loops, etc., but I wish to rely on the java-8 spirit for the most maintainable code.
type: Question
has title: Most concise way to get highest n numbers out of a map?
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21751400
favorite count: 0
tagged with: dictionary
tagged with: java-stream
upvote count: 1

http://stackoverflow.com/q/21745600
score: 3
downvote count: 0
favorite count: 0
type: Question
answer count: 2
tagged with: android
tagged with: expandablelistview
has answer: http://stackoverflow.com/a/21745859
has body: I have implemented ExpandedListView. I have 2 questions for that When I expand and scroll child item ,the group header also scroll ,is any way to keep that group header at top always even we scrolling child item list ? Is any way to fit ExpandableListView (before child items comes) to phone screen , right now in bottom lot of blank space ?
has comment: http://stackoverflow.com/comment/70091620
upvote count: 3
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21745768
has title: ExpandableListViewGroupPosition?
tagged with: android-listview

http://stackoverflow.com/comment/33030995
comment on: http://stackoverflow.com/a/21824538
score: 0
type: AnswerComment
has text: Rehan - Just wanted to add if you are looking to use your res variable outside onCreate() then declare Resources res; at class level i.e. above your onCreate() method and do res = getResources(); inside onCreate(); as @Raghunandan said. :)
type: Comment

http://stackoverflow.com/q/21764305
has answer: http://stackoverflow.com/a/21765498
tagged with: maven
tagged with: jdo
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32925359
score: 0
accepted answer: http://stackoverflow.com/a/21765498
answer count: 1
has body: Recently I have been developing an aplication which uses Google Prediction API. It contains 3 modules: WebApp for frontend part Data parser to process some data and load it to DB Common components like POJO objects, utils, etc. All modules are configured with Maven with parent project on top. Parent project holds all common dependencies. Both webapp and data parser utilize JDO to access DB. Now I have two the same jdoconfig.xml files in webapp and parser module. I tried to put it in src/main/resources of common module but it gave me NucleusUserException: No "persistence.xml" file was found in the CLASSPATH. Is it possible to move it to common module and use it everywhere in whole project?
has title: Storing jdoconfig.xml in Maven's child module and use it in other one
tagged with: java

http://stackoverflow.com/a/34282935
score: 0
type: Answer
has body: +1 for @shayanpourvatan. In my case listView.getSelectedItem() ==null and adapterView.getSelectedItemPosition() == -1. The only way I can is ((ListView) parent).getAdapter().getItem(position) It seems select and click are two different thing in Android.
answers question: http://stackoverflow.com/q/21681152

http://stackoverflow.com/comment/32852792
score: 0
has text: but this query is db specific . is'nt it?
type: AnswerComment
comment on: http://stackoverflow.com/a/21724054
type: Comment

http://stackoverflow.com/q/21739915
score: -1
has answer: http://stackoverflow.com/a/21740031
accepted answer: http://stackoverflow.com/a/21740031
possible better answer: http://stackoverflow.com/a/21740004
tagged with: bash
answer count: 3
has answer: http://stackoverflow.com/a/21740004
has body: I'm attempting to take the contents of one file and the output of ls, remove all repeats (without keeping any of them) and put it back into another file, minus the output of "ls". For example, if file "file.txt" contains: hello world test hi mom And "ls" returns: index test worm folder I want the output to contain: hello world hi mom Omitting test since it was in the output of ls. A major issue is that you can expect the output of ls and the file.txt to be very large, as in...millions of lines in the output of ls, and possibly even millions of lines in the file. I will have that many lines because I am attempting to find every URL/URI on the internet, which is....large :P And before I go into a conversation about diskspace, I did the math, and counted up about 600 GB worth of diskspace (since it's just text), however I may be wrong/off by a couple terabytes. I have several 100 GB of RAM, however, I still want to save as much RAM as possible. And it's going to be crowdsourced so lets not even GO into bandwidth. I have a couple GB/s of that anyway. If that doesn't satisfy you, consider it a theoretical situation, in which I still need to save the most hard drive space at a time (meaning as few temp files at a time as possible) and the most RAM at a time, meaning loading as little of a file at a time as possible.
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21742664
has title: Taking two inputs, remove newline separated repeats, and return output in bash or java
upvote count: 0
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32828085
has text: @Taylor I meant "fake" in how you described, meaning it wasn't java.util :)
comment on: http://stackoverflow.com/q/21710465
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33047549
score: 0
comment on: http://stackoverflow.com/q/21834149
type: Comment
type: QuestionComment
has text: have a look at it http://developer.android.com/reference/android/os/CountDownTimer.html

http://stackoverflow.com/q/21809919
has comment: http://stackoverflow.com/comment/33005208
has title: importing external jar inside eclipse
has comment: http://stackoverflow.com/comment/33004889
linked to: http://stackoverflow.com/q/15103395
has comment: http://stackoverflow.com/comment/33004911
type: Question
has answer: http://stackoverflow.com/a/21810450
has body: I'm writing assignment on coursera.org Java course. I'm using Maven and I have external jars that I have to use in this course (course requirements). This is part of my pom.xml: org.coursera.algs4part1 stdlib 1.0 I can't make java compiler import the external jar file. Below, following errors occur: The import org.coursera.algs4part1.stdlib cannot be resolved But I've successfully added the jar to maven: What am I missing?
linked to: http://stackoverflow.com/q/15305679
has answer: http://stackoverflow.com/a/21810502
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33005285
tagged with: maven
tagged with: java
has comment: http://stackoverflow.com/comment/33005859
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33005468
tagged with: eclipse

http://stackoverflow.com/q/21809134
has comment: http://stackoverflow.com/comment/33003349
tagged with: arraylist
answer count: 3
has comment: http://stackoverflow.com/comment/33004060
has answer: http://stackoverflow.com/a/21809183
downvote count: 0
has comment: http://stackoverflow.com/comment/33003723
favorite count: 0
has comment: http://stackoverflow.com/comment/33004065
has comment: http://stackoverflow.com/comment/33003465
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33004020
has answer: http://stackoverflow.com/a/67088174
has comment: http://stackoverflow.com/comment/33003798
upvote count: 1
score: 1
tagged with: java
has body: I have an ArrayList: List&lt;Integer&gt; array = new ArrayList&lt;Integer&gt;(M); At some point in my code I add a new integer value at this array list at a specific index: array.add(index, value); The documentation says for that method: Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). and that's fine because that is what I actually want to do. The problem is that any time I do this, the size of my array grows by 1. That is, initially I had an array with size M filled in with zeroes. When I add the first value at index 0, I have this value there and M zero values, resulting in an array of size M + 1. When I add the second value at index 0, I have this value at index 0, the previous value shifted to the right at index 1, and M zero values, resulting in an array of size M + 2 etc. My question is, how to add an element at a specific index of my arraylist (in my case, at index 0) shifting the previous elements by 1 index without exceeding the predefined capacity of the arraylist? (I have to say, ArrayList is one of the most common structures in Java and yet one of the most confusing for me ...) EDIT: I have to note that initially I fill in my arraylist with M zero values using a for loop, therefore I have e.g. for M = 5 an arraylist like this. [0, 0, 0, 0, 0]
has comment: http://stackoverflow.com/comment/33003353
has comment: http://stackoverflow.com/comment/33003835
type: Question
has comment: http://stackoverflow.com/comment/33003733
has comment: http://stackoverflow.com/comment/33004100
has comment: http://stackoverflow.com/comment/33003964
has comment: http://stackoverflow.com/comment/33003487
has comment: http://stackoverflow.com/comment/33003647
has answer: http://stackoverflow.com/a/71326370
has title: Inserting Object at Specific Index of ArrayList Without Growing the Capacity of that ArrayList - Java

http://stackoverflow.com/comment/32819716
has text: @Luiggi Mendoza yes, you're right. You solved the problem nicely, I love it. +1
comment on: http://stackoverflow.com/q/21705594
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21765879
has answer: http://stackoverflow.com/a/21765986
has comment: http://stackoverflow.com/comment/32926798
has body: Here i created a program. My main method create many shapes (boxes, triangles ...) I want to have a button that if i click on it I can pick a color from large set of colors? This is the main program ( with only the boxes): import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Kaleidescope extends JFrame implements MouseListener, ActionListener, MouseMotionListener { Box b; Box[] boxes; // 2-d array of Box objects, form a color pallet int boxCount; JButton boxButton; int x1, y1; // mousePressed int w1, z1; // mouseEntered int mode = 1; // 1 = line, 2= boxes, 3 = oval, 4= text, 5 = SG, twoLines = 7. public static void main(String[] args) { System.out.println("hi there."); new Kaleidescope(); setDefaultCloseOperation(EXIT_ON_CLOSE); addMouseListener(this); addMouseMotionListener(this); boxes = new Box[20]; boxCount = 0; setLayout(new FlowLayout()); boxButton = new JButton("Boxes"); add(boxButton); boxButton.addActionListener(this); setSize(new Dimension(500, 500)); setVisible(true); } // returns a random color public Color randomColor() { int red = (int) (Math.random() * 255); int green = (int) (Math.random() * 255); int blue = (int) (Math.random() * 255); return new Color(red, green, blue); } public void mouseClicked(MouseEvent e) { System.out.println("click at x=" + e.getX() + " y=" + e.getY()); // convert window coords to box array indexes. // These were adjusted slightly after the video was made // (no more flakiness, these are right on target). int boxi = (e.getX() - 10) / 20; // convert mouse x to box index int boxj = (e.getY() - 40) / 20; System.out.println("click at boxi=" + boxi + " boxj=" + boxj); // set extra box to the color that we clicked on if (mode == 2) { boxes[boxCount++] = new Box(e.getX(), e.getY(), randomColor()); } repaint(); } public void actionPerformed(ActionEvent e) { if (e.getSource() == boxButton) { mode = 2; repaint(); } } public void mouseEntered(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public v…
type: UnansweredQuestion
tagged with: swing
has title: I want to pick a color from a large set of colors
has comment: http://stackoverflow.com/comment/32926688
downvote count: 7
type: Question
score: -7
tagged with: java
has comment: http://stackoverflow.com/comment/32926317
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32926916
favorite count: 0
has comment: http://stackoverflow.com/comment/32926403

http://stackoverflow.com/comment/32936631
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21771410
has text: do you have any sample project for spring 4

http://stackoverflow.com/comment/32873484
type: Comment
type: QuestionComment
has text: @Bruno After the `keyStore` is loaded, I create a `TrustManagerFactory` object and pass the keyStore as the parameter for its init method: `trustFactory.init(keyStore)`.
score: 0
comment on: http://stackoverflow.com/q/21734900

http://stackoverflow.com/comment/32894319
type: Comment
score: 2
type: AnswerComment
has text: @AimanB - *I want to obtain a value from class A to class B via a setter and getter* - Without using the setter to set the value, its pointless to use the getter to get the value. And you're getting the value from class `A` only.
comment on: http://stackoverflow.com/a/21747829

http://stackoverflow.com/comment/33085527
type: Comment
has text: No it shouldn't be called. I believe there is static initialization logic that is not obvious in CartLine which caused the problem. from your stack trace, `com.mycompany.cart.CartLine.<clinit>` actually means the class init (which means static initialization) for your CartLine class. Check about the static variable inside it with type CartSettings, which is the root cause of the problem
comment on: http://stackoverflow.com/a/21831409
type: AnswerComment
score: 0

http://stackoverflow.com/q/21739141
tagged with: soap
has answer: http://stackoverflow.com/a/56708448
answer count: 4
has answer: http://stackoverflow.com/a/22627735
tagged with: cxf
score: 1
has answer: http://stackoverflow.com/a/24735996
tagged with: java
upvote count: 1
has title: CXF SOAP Client with NTLM to SharePoint
type: Question
tagged with: ntlm
downvote count: 0
tagged with: sharepoint
has body: I am writing a SOAP client using CXF Framework (version: 2.7.8) for SharePoint 2007. I have followed the online documentation for adding NTLM support here. I have the client working and tracing the HTTP session shows that NTLM credentials are being sent, however, I am still receiving a 401 Unauthorized response. Code: Lists listService = new Lists(); ListsSoap port = listService.getListsSoap(); BindingProvider bp = (BindingProvider) port; bp.getRequestContext().put("use.async.http.conduit", Boolean.TRUE); Credentials creds = new NTCredentials(USER, PASS, "", DOMAIN); bp.getRequestContext().put(Credentials.class.getName(), creds); Client client = ClientProxy.getClient(proxy); HTTPConduit http = (HTTPConduit) client.getConduit(); HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnectionTimeout(36000); httpClientPolicy.setAllowChunking(false); httpClientPolicy.setAutoRedirect(true); http.setClient(httpClientPolicy); // Build request and execute Interestingly, I wrote a similar client using HTTP PUT for WebDAV to upload documents using Apache HTTPClient library, and was able to successfully authenticate using NTLM. Also, I was able to use SOAPUI to invoke the same Lists web service I am trying to build the Java client for and it successfully authenticated using NTLM as well. I'm assuming the implementation of NTLM is different between CXF and HTTPClient. Any thoughts on what is wrong with my CXF implementation? Or how I can get it to mirror the HTTPClient implementation?
has answer: http://stackoverflow.com/a/40023881
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32893002
comment on: http://stackoverflow.com/a/21747126
type: Comment
score: 0
type: AnswerComment
has text: mean u want to set the locale as english but getting excetion?

http://stackoverflow.com/comment/33173394
score: 0
comment on: http://stackoverflow.com/a/21828262
type: Comment
has text: ys did. but how to display the actual value?
type: AnswerComment

http://stackoverflow.com/comment/32895668
has text: The rule is very simple **no not access read operations on the `List` while looping**. This rules applies **however you loop**. If you want to `add` use `Iterator.add`. If you want to `remove` use `Iterator.remove`. This is where `LinkedList` shines (see my link above). You are doing **multiple** calls to `add`; you have only commented _one of them_.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21741997

http://stackoverflow.com/q/21734493
tagged with: maven
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32871081
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32870659
linked to: http://stackoverflow.com/q/11345916
score: 0
has title: how to cross reference jars from import errors / ClassNotFoundExceptions?
has comment: http://stackoverflow.com/comment/32872440
has body: Is there an easy way to lookup or otherwise discover what jars (and maven artifacts) are of concern when I get have unresolved import statments or ClassNotFoundException's? Recommended technique for quickly resolving tons of dependencies?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32870814
answer count: 0

http://stackoverflow.com/a/21724499
answers question: http://stackoverflow.com/q/21724304
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: First you need to create package src >right click >new >package Follow the step to move the java files to your new package. select the java file > right click > refactor > move > select your preferred package. or right click on the project package > Refactor > Rename > Enter new name on the given filed of the popup screen. check the update reference check box.. and ok and ok.. clean and build the project

http://stackoverflow.com/a/21729760
answers question: http://stackoverflow.com/q/21729187
has body: Thread objects themselves consume much memory for their stacks. To clean your test from instantiate/free threads, do not use AsyncTask (which creates Thread), but create a fixed threadpool beforehand, start test, wait it to end, and only then shutdown the thread pool.
type: Answer
has comment: http://stackoverflow.com/comment/32864801
score: 0
has comment: http://stackoverflow.com/comment/32868543
has comment: http://stackoverflow.com/comment/34959803

http://stackoverflow.com/comment/111241474
comment on: http://stackoverflow.com/a/21756629
type: Comment
has text: @219CID: Depending on your program's design, the `TableModel` will likely have access to the desired value. Your renderer's implementation of `getTableCellRendererComponent()` will see an instance of this class when called.
score: 1
type: AnswerComment

http://stackoverflow.com/q/21750475
has answer: http://stackoverflow.com/a/21751158
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21750878
tagged with: php
has answer: http://stackoverflow.com/a/21750878
has body: I've been looking for the answer on this page, but I speak little English, so I may have not found the correct answer. Well, I'm programming a cart with jquery to send it to a server in php. On the other hand I have a java api that receives json. My question: how can i send a json from php to java api, as I have to insert a bd (inserted in java)? Pd: it is a class project. Thanks for the answers, I've been looking for the answer 2 days.
accepted answer: http://stackoverflow.com/a/21751158
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32899431
tagged with: api
type: AnsweredQuestion
tagged with: jquery
has title: Send JSON from PHP to JAVA api
has comment: http://stackoverflow.com/comment/32899180
has comment: http://stackoverflow.com/comment/32898811
type: Question
has comment: http://stackoverflow.com/comment/32899231

http://stackoverflow.com/comment/33093564
type: AnswerComment
comment on: http://stackoverflow.com/a/21852900
type: Comment
score: 1
has text: Well, even with hard decisions like with a decision tree, it's possible to output real numbers; Although I don't now all the details of J48 implementation in Weka, I know that the C4.5 algorithm, when run on a corpus, actually compute ratios of instances in the corpus; so I suspect the real numbers that you have seen with J48 actually correspond to such corpus ratio, which cannot really be thought of as probabilities. And I doubt decision-tree based algorithms can give reliable probability distributions from a single example. At least, I wouldn't interpret them as pdf :-)

image
tags question: http://stackoverflow.com/q/21807680
tags question: http://stackoverflow.com/q/21700334
tags question: http://stackoverflow.com/q/21804841
tags question: http://stackoverflow.com/q/21822188
tags question: http://stackoverflow.com/q/21756445
tags question: http://stackoverflow.com/q/21795219
tags question: http://stackoverflow.com/q/21717343
tags question: http://stackoverflow.com/q/21810137
tags question: http://stackoverflow.com/q/21838965
tags question: http://stackoverflow.com/q/21735701
tags question: http://stackoverflow.com/q/21710595
tags question: http://stackoverflow.com/q/21690954
tags question: http://stackoverflow.com/q/21740729
tags question: http://stackoverflow.com/q/21792813
tags question: http://stackoverflow.com/q/21802487
tags question: http://stackoverflow.com/q/21753252
tags question: http://stackoverflow.com/q/21703817
tags question: http://stackoverflow.com/q/21689219
tags question: http://stackoverflow.com/q/21738483
tags question: http://stackoverflow.com/q/21698781
tag name: image
tags question: http://stackoverflow.com/q/21802990
tags question: http://stackoverflow.com/q/21841545
tags question: http://stackoverflow.com/q/21709364
tags question: http://stackoverflow.com/q/21817781
tags question: http://stackoverflow.com/q/21806062
type: Tag
tags question: http://stackoverflow.com/q/21815271
tags question: http://stackoverflow.com/q/21835933
tags question: http://stackoverflow.com/q/21839955

for-loop
tags question: http://stackoverflow.com/q/21811192
tags question: http://stackoverflow.com/q/21716102
tags question: http://stackoverflow.com/q/21740965
tags question: http://stackoverflow.com/q/21799367
tags question: http://stackoverflow.com/q/21687385
tags question: http://stackoverflow.com/q/21761488
tags question: http://stackoverflow.com/q/21717791
tags question: http://stackoverflow.com/q/21691776
tags question: http://stackoverflow.com/q/21779750
tags question: http://stackoverflow.com/q/21776772
tags question: http://stackoverflow.com/q/21768251
tags question: http://stackoverflow.com/q/21788613
tags question: http://stackoverflow.com/q/21819206
tags question: http://stackoverflow.com/q/21816684
tag name: for-loop
tags question: http://stackoverflow.com/q/21688499
tags question: http://stackoverflow.com/q/21731302
tags question: http://stackoverflow.com/q/21791822
tags question: http://stackoverflow.com/q/21812544
tags question: http://stackoverflow.com/q/21814830
tags question: http://stackoverflow.com/q/21805222
tags question: http://stackoverflow.com/q/21685889
tags question: http://stackoverflow.com/q/21792491
tags question: http://stackoverflow.com/q/21813842
type: Tag
tags question: http://stackoverflow.com/q/21755124
tags question: http://stackoverflow.com/q/21808630
tags question: http://stackoverflow.com/q/21793374
tags question: http://stackoverflow.com/q/21691551
tags question: http://stackoverflow.com/q/21734139
tags question: http://stackoverflow.com/q/21830970
tags question: http://stackoverflow.com/q/21823880

http://stackoverflow.com/comment/33024276
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21820769
has text: Take a look at [SwingLabs, SwingX](https://java.net/downloads/swingx/releases/1.6.2/) `VerticalLayout`
type: Comment

http://stackoverflow.com/q/21805739
score: 1
tagged with: java
type: Question
has body: Regarding to the best way to design a system using spring-mvc (REST services) and jQuery . I think exists the following approaches. One war file in which you have spring services and jQuery stuff, with this approach we have all the domain objects available to be used with spring-mvc, we can create initial jsp pages and then refresh some elements using jQuery calls to our services. Two war files, one having the spring services and the other contains spring-mvc stuff and jquery, in this case the creation of pages could be done by jsp pages and also refresh elements with jquery calls to our services, but to make this possible we need to have a common library of domain objects to be used in the second war, also internally use restTemplate in some controllers that need to be created (It sounds like duplicate code). Have one war file running the REST services and a other “package” without any java or spring stuff only jquery, it means all the call and information retrieval must to be done using jquery, initial jsp pages creation cannot be done with this option and all the content are obtained via REST services. (no need of use internal controllers to call services by java) Thinking about it I realized that one and second have the following disadvantages. Have services and web stuff in the same war file sound like a bad idea thinking in SOA, the movement of this war will result in move unneeded jquery and web stuff. Have jsp and jquery stuff mixed not sound like a good idea but I think is a common practice (I wonder why?), using this I think we need to create some controllers in the second war to initially create the web pages, go using restTemplate to obtain initial information and then update or refresh using jquery calls. It feels that a have a controller just to retrieve data to the services, why don’t go directly … I just want to implement the third approach but the question is: there is any disadvantages that I’m not seeing or any advice that I should know before use…
tagged with: jquery
has answer: http://stackoverflow.com/a/21821508
has title: REST spring services and JQUERY web integration best practices
accepted answer: http://stackoverflow.com/a/21821508
answer count: 1
downvote count: 0
favorite count: 0
tagged with: architecture
upvote count: 1
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33025314

http://stackoverflow.com/comment/32806831
comment on: http://stackoverflow.com/q/21698185
has text: This is [my answer](http://stackoverflow.com/questions/21535811/regex-include-and-exclude-escape-sequences/21536109#21536109) from another question that has similar requirement. It handles the case of multiple ``\`` in a row. However, as fge suggested, you might be better off using a library, since my code is written without knowledge of corner cases in CSV format.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32844701
comment on: http://stackoverflow.com/q/21719649
has text: I don't see the big difference between your preferred way and having one single `MesageReceiver` and a synchronized `messageReceived()` to receive from multiple source.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32825940
has text: @SSMA : there is nothing that can throw an exception in this. this is not the code that causes the exception.
comment on: http://stackoverflow.com/q/21708702
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33096164
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21809185
score: 1
has text: So this is not being used directly on Android. This is being used in a Java project that creates an sqlite database that is used on Android. So this is pure java. I'm converting an already working jdbc project to use ormlite.

http://stackoverflow.com/comment/32859354
has text: You might want to look at SPNEGO. There is a java implementation at http://spnego.sourceforge.net/
score: 0
comment on: http://stackoverflow.com/q/21728619
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21715738
has answer: http://stackoverflow.com/a/21715934
has answer: http://stackoverflow.com/a/21715841
upvote count: 1
has body: I have an app that has 4 activities so far. All of these activities have text input from the user (using edit text). All of these user input sections will require the same exact type of 'error checking' to ensure the user enters variables of the correct data type (in this case, numbers). Is it possible (I'm assuming anything is possible) to make another java file in the 'SRC' folder where I could write and store this function to then call in every instance where I would need it? This java file would not have a layout associated with it; it would only be used for this function (and probably others as I work on the app) So far I haven't been able to find a good example of this to reverse engineer, and it seems silly to me to have to write out the same piece of code 4+ times. I didn't post examples of my code, as it seems pointless since I think I just need to how what I would import into each activity.
accepted answer: http://stackoverflow.com/a/21715833
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21715894
tagged with: function
has title: Calling functions from other Java files in the same project
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32837796
has answer: http://stackoverflow.com/a/21715833
possible better answer: http://stackoverflow.com/a/21715849
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/21715849
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/32845620
type: QuestionComment
has text: Input: அஜீத், தமன்னா, விதார்த், நாசர், சந்தானம், பாலா, அதுல் குல்கர்னி, பிரதீப் ராவத், முனீஷ், சோஹைல் ஒளிப்பதிவு - வெற்றி எடிட்டர் - மு காசி விஸ்வநாதன் வசனம் - சிவா, பரதன் தயாரிப்பு - விஜயா புரொடக்ஷன்ஸ் எழுத்து, இயக்கம் - சிவா தமிழ் சினிமாவின் எவர்கிரீன் வெற்றி ஃபார்முலாவான அண்ணன் - தம்பி பாசம், காதலை கமகம பொங்கல் மசாலாவாகத் தந்திருக்கிறார் இயக்குநர் சிவா.
comment on: http://stackoverflow.com/q/21720504
score: 0
type: Comment

http://stackoverflow.com/comment/33030481
type: QuestionComment
comment on: http://stackoverflow.com/q/21821289
has text: The text associated with such a `TextRenderInfo` instance is not necessarily a word; it merely is a text chunk drawn in a single text drawing operation in the PDF; it may be merely part of a word, a whole word or even a whole text line; furthermore it can also be the end of one word and the start of the next, etc. Thus, the `RenderListener` implementation has to recognize words out of this text soup. @BrunoLowagie Maybe you should simply make that pointer towards the `LocationTextExtractionStrategy` an actual answer. What else could be answered?
score: 0
type: Comment

http://stackoverflow.com/q/21719372
answer count: 1
tagged with: exception
type: UnansweredQuestion
has title: Can more than one keylistener event be registered in Java (Swing)?
tagged with: java
has answer: http://stackoverflow.com/a/21719414
tagged with: swing
type: Question
has body: I am trying to validate some textfield input data to be within a range of values. I have two JTextFields in my simple GUI, and have registered the following: ID1_Txt_Input.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { JTextField textField = (JTextField) e.getSource(); String text = validateInput(textField.getText(),1,254); textField.setText(text); } }); ID2_Txt_Input.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { JTextField textField = (JTextField) e.getSource(); String text = validateInput(textField.getText(),0,65535); textField.setText(text); } }); I then have a simple validation method as follows: public String validateInput( String s, int val_min, int val_max ) { String output = ""; int val = 0; try { val = Integer.parseInt(s); } catch(NumberFormatException ne) { output = ""; } if( val &lt; val_min ) { output = ""; } else if( val &gt; val_max ) { val /= 10; output = (String.valueOf(val)); } else{ output = s; } return output; }; What I am seeing: The first textfield is validating properly, only allowing a number between 1-254 to be entered, and auto-clearing when a non-number is entered. The second textfield is NOT validating properly. I am very new to Java, so if I am making a glaring error in how I am approaching this problem, I would appreciate the advice. Thank you,
score: 0

http://stackoverflow.com/a/35914162
answers question: http://stackoverflow.com/q/21746294
type: Answer
has comment: http://stackoverflow.com/comment/129845221
upvote count: 6
score: 6
has body: I faced hot key problem with use Ctrl+Space. I tried to fix the issue first by Windows->Preferences->...->Content Assist-> Advanced and selected Select the proposal kinds contained in the 'default' content assist list: Other Java Proposals, List item SWT Template Proposals Template Proposals Type Proposals but didn't help. Therefore, I tried another solution. There would be multiple languages on your computer which could be eating up your Ctrl command. To solve this Go to Control Panel -> Region and Language -> Keyboards and Languages (tab) and then Change Keyboards. You’ll see a list of languages installed – remove any that you don’t want (click the language and then click the Remove button) until you only have the ones you want left. That fixed it for me, but you can also check the Advanced Key Settings tab to make sure that none of the keyboard short-cuts that are set include Ctrl-Space. Once you’ve done that, Ctrl-Space should work nicely!!!!
downvote count: 0

http://stackoverflow.com/comment/32939945
type: Comment
has text: Just check the source code and adjust it to your needs. You can use @Inject to inject current Configuration object into your action.
comment on: http://stackoverflow.com/a/21753607
type: AnswerComment
score: 0

elasticsearch
tags question: http://stackoverflow.com/q/21778849
type: Tag
tags question: http://stackoverflow.com/q/21753021
tag name: elasticsearch
tags question: http://stackoverflow.com/q/21724836
tags question: http://stackoverflow.com/q/21826766

http://stackoverflow.com/a/25026246
answers question: http://stackoverflow.com/q/21690464
has comment: http://stackoverflow.com/comment/97860734
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: My solutions was to change in all project.properties file javac.source=1.8 javac.target=1.8 to javac.source=1.7 javac.target=1.7

http://stackoverflow.com/q/21764210
score: 0
tagged with: java
answer count: 1
tagged with: xslt
has title: What is the default XSLT transformer used in spring integration xml?
has body: Using Spring Integration XML 3.0.0.RELEASE I have a XSLT transformer as such: &lt;int-xml:xslt-transformer id="tm100Totm120aTransformation" xsl-resource="classpath:xsd/mailxml/xslt/tm120b_to_tm140a.xsl" result-transformer="resultToString" input-channel="validatedtm100Message" output-channel="validatedtm120aMessage"/&gt; Without specifying the transformer-factory-class attribute, how does Spring determine which TransformerFactory is actually used? The JavaDoc for TransformerFactory.newInstance() states: Obtain a new instance of a TransformerFactory. This static method creates a new factory instance This method uses the following ordered lookup procedure to determine the TransformerFactory implementation class to load: Use the javax.xml.transform.TransformerFactory system property. Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to check for its existence. It is not possible to change the value of any property in jaxp.properties after it has been read for the first time. Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.transform.TransformerFactory in jars available to the runtime. Platform default TransformerFactory instance. Once an application has obtained a reference to a TransformerFactory it can use the factory to configure and obtain transformer instances. Does Spring follow this procedure? I can't seem to find the details of how Spring does this in the Spring docs. P.S. Upon debug inspection it appears my …
has answer: http://stackoverflow.com/a/21764512
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/21764512
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/21840869
answers question: http://stackoverflow.com/q/21840812
has comment: http://stackoverflow.com/comment/33059677
upvote count: 2
downvote count: 1
has body: First off, you should ignore the recommendations given to make the data public. You will want to give your Connect4 class public methods that allow other classes controlled access to its data. This means that you can possibly allow outside classes to mutate the data of Connect4, but only if it does so in a logical way. For instance, it would make no sense to allow an outside class to try to change the state of an array item that is out of bounds, and your setter methods can control this. This is one advantage of encapsulating your data, of hiding your class's data as much as possible, and allowing only controlled and moniterable access. For example, public class Connect4 { private char[][] board; private int rows; private int cols; public Connect4(int rows, int cols) { board = new char[rows][cols] this.rows = rows; this.cols = cols; } public void setBoardCell(int row, int col, char value) throws Connect4Exception { // first check value of row and col and if not valid, throw exception // if board is a bound field, then fire property change notification here board[row][col] = value; } public char getBoardCell(int row, int col) { return board[row][col]; } } And... class Connect4Exception extends Exception { // default constructor // String constructor }
has comment: http://stackoverflow.com/comment/33059717
type: Answer
score: 1

http://stackoverflow.com/comment/33001839
has text: But that's what you're doing.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21808202

http://stackoverflow.com/q/21821140
has title: How to move jslider its start position to end postion automatically when pressing a button in java
downvote count: 1
type: Question
has body: I have a code below jSlider1.setValue(0); int i =0; while (i &lt;= jSlider1.getMaximum()) { jSlider1.setValue(i); // JOptionPane.showMessageDialog(rootPane,"deded"); Thread.sleep(2000); i++; } What I want is I want to move JSlider automatically its min to max value. I have writeen above code. But I can not get the output. But when I remove the comment of "JOptionPane.showMessageDialog(rootPane,"deded"); " , It's work properly with the message. Please help me. I am in big trouble. I like to have a sample code if any one know the sollution. Thank you
score: -1
accepted answer: http://stackoverflow.com/a/21821398
upvote count: 0
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: jslider
has answer: http://stackoverflow.com/a/21821398
tagged with: java

http://stackoverflow.com/comment/32827587
type: QuestionComment
comment on: http://stackoverflow.com/q/21710465
type: Comment
score: 9
has text: Could it be the creation of the extra `List` object that is returned by `Arrays.asList`?

http://stackoverflow.com/comment/34283789
comment on: http://stackoverflow.com/a/22142109
score: 0
type: AnswerComment
type: Comment
has text: not the answer I hoped for, but as there seems to be no better way I thank you very much for the good explanation, and I'll except the answer!

http://stackoverflow.com/a/21834334
upvote count: 1
has body: Make a loop until they enter a stop character (for example a blank character) case 2: System.out.println( "Enter grades" ); boolean isDone = false; while(isDone == false) { grade = input.nextDouble(); if(grade == '') { isDone = true; } } total = total + grade; gradeCounter = gradeCounter + 1; gradeAvg = (double) total / gradeCounter;
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33047721
has comment: http://stackoverflow.com/comment/33047913
answers question: http://stackoverflow.com/q/21834235

http://stackoverflow.com/q/21801872
downvote count: 1
has answer: http://stackoverflow.com/a/21801897
upvote count: 0
type: UnansweredQuestion
has body: towers=new ArrayList&lt;&gt;(); towers.add(new Stack&lt;Integer&gt;()); towers.add(new Stack&lt;Integer&gt;()); towers.add(new Stack&lt;Integer&gt;()); Why would this return true? towers.get(1).equals(towers.get(2)) Did they somehow implement equals for stacks to check elements instead of the default behaviour which is reference
tagged with: stack
tagged with: java
score: -1
has title: Different reference stacks return equals true
type: Question
answer count: 1
tagged with: data-structures
favorite count: 0

http://stackoverflow.com/comment/32779416
comment on: http://stackoverflow.com/q/21681257
has text: I'm not sure I understand your question. Are you asking if you're allowed to have a foreign key contraint on UserGroup.userId, referencing User.id? If so, of course you can. You should.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/21808727
type: Question
tagged with: outlook
has comment: http://stackoverflow.com/comment/33086703
has comment: http://stackoverflow.com/comment/33017078
has title: Jacob Export Outlook Contact Pictures (Java, Jacob)
has comment: http://stackoverflow.com/comment/33087737
tagged with: jacob
has body: Good Morning, I’am using Jacob 1.17 o read all my Outlook Contact Pictures and save them to an File. The Procedure works pretty fine for the first 199 Contatcs. After that the Dispatch.call fails and terminates with the following Exception: Exception in thread "main" com.jacob.com.ComFailException: Invoke of: SaveAsFile Source: Microsoft Outlook Description: Cannot save the attachment. Cannot create file: ContactPicture.jpg. Right-click the folder you want to create the file in, and then click Properties on the shortcut menu to check your permissions for the folder. at com.jacob.com.Dispatch.invokev(Native Method) at com.jacob.com.Dispatch.invokev(Dispatch.java:625) at com.jacob.com.Dispatch.callN(Dispatch.java:453) at com.jacob.com.Dispatch.call(Dispatch.java:541) at outlookStuff.ManageContactsOutlook.tmpTest(ManageContactsOutlook.java:217) at mainPackage.Main.main(Main.java:32) I’m really not sure way. I tested a different set of Contacts – same Error. Set all Objects to null to make shore that the Garbage Collector is involved but it doesn’t help. The piece of Code which makes the trouble: public void tmpTest(int intOutlookFolder, String strWorkingDir) { Dispatch dipNamespace = this.axc.getProperty("Session").toDispatch(); Dispatch dipContactsFolder = Dispatch.call(dipNamespace, "GetDefaultFolder", (Object) new Integer(intOutlookFolder)).toDispatch(); Dispatch dipContactItems = Dispatch.get(dipContactsFolder, "items").toDispatch(); @SuppressWarnings("deprecation") int count = Dispatch.call(dipContactItems, "Count").toInt(); for (int i=1; i&lt;=count; i++) { Dispatch dipContact; dipContact = Dispatch.call(dipContactItems, "Item", new Integer(i)).toDispatch(); String strEntryID = Dispatch.get(dipContact, "EntryID").toString().trim(); //For Testing Status.printStatusToConsole("Outlook Contact "+strEntryID+" loaded"); byte[] byteContactPicture = null; String strPathToTmpPicture = null; Dispatch dipAttachments = Dispatch.get(dipContact, "Attachments").toDispatch(); @S…
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/32980481
comment on: http://stackoverflow.com/q/21796238
type: Comment
type: QuestionComment
score: 0
has text: Did you install java on your windows?

http://stackoverflow.com/comment/33013322
type: Comment
has text: um , can you elaborate in easy way ?
comment on: http://stackoverflow.com/a/21814628
score: 0
type: AnswerComment

http://stackoverflow.com/q/21788091
accepted answer: http://stackoverflow.com/a/21788420
type: AnsweredQuestion
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/32966374
has comment: http://stackoverflow.com/comment/32966196
has comment: http://stackoverflow.com/comment/32965747
type: Question
score: 0
answer count: 1
tagged with: junit
has answer: http://stackoverflow.com/a/21788420
has body: I am trying to run a selenium test case file written in java using Apache Ant. To setup this configuration, i followed this tutorial. below is my ant config in build.xml <?xml version="1.0" encoding="UTF-8"?> <pathelement path="lib\junit-4.10.jar" /> <formatter type="plain"/> <formatter type="xml"/> But it is showing error like : Testsuite: com.lo.test.selenium.AssignCampaignTestCase Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec Caused an ERROR com.lo.test.selenium.AssignCampaignTestCase java.lang.ClassNotFoundException: com.lo.test.selenium.AssignCampaignTestCase at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) Test case code in AssignCampaignTestCase.java package com.lo.test.selenium; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.Properties; import java.util.ResourceBundle; import javax.mail.Flags; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.NoSuchProviderException; import javax.mail.Session; import javax.mail.Store; import javax.ws.rs.core.MediaType; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter; import com.sun.jersey.multipart.FormDataMultiPart; import com.sun.jersey.multipart.impl.MultiPartWriter; /** * @author Ashutosh * */ public class As…
has comment: http://stackoverflow.com/comment/32966277
has comment: http://stackoverflow.com/comment/32966961
has comment: http://stackoverflow.com/comment/32967330
has title: Apache Ant: java.lang.ClassNotFoundException:
tagged with: selenium

http://stackoverflow.com/comment/33411052
has text: onActivityResult() is also available in fragments
type: AnswerComment
comment on: http://stackoverflow.com/a/22037179
score: 0
type: Comment

http://stackoverflow.com/comment/86178081
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21678614
score: 5
has text: Why Sort ? The problem is to group the elements !

pre-commit-hook
tag name: pre-commit-hook
type: Tag
tags question: http://stackoverflow.com/q/21796264

http://stackoverflow.com/comment/32874035
type: Comment
type: QuestionComment
has text: Indeed a String.removeFromTail(int n) is missing in String.
comment on: http://stackoverflow.com/q/21736300
score: 0

http://stackoverflow.com/comment/32883325
score: 0
type: Comment
type: AnswerComment
has text: @GEARZ: Please don't try to edit my answer as that invalidates it. Instead please edit **your question**, and then notify me in comment about your edit.
comment on: http://stackoverflow.com/a/21740968

http://stackoverflow.com/comment/32907395
type: Comment
type: QuestionComment
has text: See [my answer in similar question](http://stackoverflow.com/a/8439744/708434) and also [vote here](https://code.google.com/p/guava-libraries/issues/detail?id=394) to have BiMultimap in Guava (which, [according to some discussions on Google Groups](https://groups.google.com/forum/#!topic/guava-discuss/K0edXSa3k7A), is implemented internally at Google but not open-sourced yet).
comment on: http://stackoverflow.com/q/21754560
score: 1

http://stackoverflow.com/comment/33157946
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21799487
has text: ummmm yes you didn't understand me clearly I mean I have now my own java program that uses a connection of JDBC to connect to MYSQL to get data I want a way to only have a small .db file with the jar file data that have those data I get from the JDBC so instead I use a big connection from java to mysql I only make a small connection to a small .db file that is located with the data of my JAVA (jar) program understood ?

http://stackoverflow.com/q/21794411
has comment: http://stackoverflow.com/comment/32977290
answer count: 3
has title: Thread Priority for more than 10 Threads in JAVA
upvote count: 2
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/21794486
downvote count: 1
has answer: http://stackoverflow.com/a/21794488
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21794463
tagged with: thread-priority
has answer: http://stackoverflow.com/a/21794463
type: Question
has body: I know that Threads can have Priority ranging from MIN_PRIORITY(1) to MAX_PRIORITY(10). However, if I have more than 10 threads to execute, how will I assign priority to them ? Can the priority be more than 10 ?
favorite count: 0
has answer: http://stackoverflow.com/a/21794486

http://stackoverflow.com/comment/32813404
type: QuestionComment
comment on: http://stackoverflow.com/q/21702634
score: 0
type: Comment
has text: it will need to load the .txt data collected into a 2d array once so the GUI and play with the data.

http://stackoverflow.com/comment/32848021
type: AnswerComment
has text: @MickJ Just fixed the parameters.
type: Comment
comment on: http://stackoverflow.com/a/21710120
score: 0

http://stackoverflow.com/a/21722857
type: Answer
has comment: http://stackoverflow.com/comment/32850561
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32851356
has comment: http://stackoverflow.com/comment/32849614
answers question: http://stackoverflow.com/q/21722354
downvote count: 0
has comment: http://stackoverflow.com/comment/99708990
has body: You can use the org.eclipse.ui.activities extension point to define a disabled activity and match this with the menu id you want to suppress. Note: The activities are shown in Preferences &gt; General &gt; Capabilities so the user can enable them again.

http://stackoverflow.com/comment/34450912
score: 0
comment on: http://stackoverflow.com/q/21693139
has text: I get this in `4.3.4.Final`. Bootstrapping with `Persistence.createEntityManagerFactory("Foo")` and nothing else.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21737688
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21736883
downvote count: 0
has comment: http://stackoverflow.com/comment/32877622
upvote count: 2
has body: The best way for this to happen would be that the last 'step' in your program (the last piece of executable code) would be a Runtime.exec("Whatever.exe"); type command. this way, immediately after your next program launches, your current program would finish it's current execution and 'gracefully' close. (that is, it closes without you explicitly saying something like System.exit(0) )
has comment: http://stackoverflow.com/comment/32876926

http://stackoverflow.com/comment/33049032
type: Comment
comment on: http://stackoverflow.com/a/21834894
type: AnswerComment
score: 0
has text: i have used it in every radio button , but no effect

http://stackoverflow.com/a/21685623
type: Answer
upvote count: 1
score: 1
has body: System.out.println(names); This works for all objects inside the collection that have overriden its toString() method, which is true for many built-in java classes. .
answers question: http://stackoverflow.com/q/21685566
downvote count: 0

http://stackoverflow.com/a/21759832
type: AcceptedAnswer
score: 0
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21759451
accepted answer of: http://stackoverflow.com/q/21759451
has body: Chances are that there is some kind of race condition you are not taking into account. Debugging race conditions can be tricky since you'll end up changing the timing by adding any code. The best thing to do is go back and really think through it where the data is being corrupted. I will add one thing though that caught me up with synchronization. I don't know about your third-party stuff, but I was using objects for synchronization (an android thing?). I made the mistake of using a Boolean object which only ever points to one of two objects (True or False). So while my objects were named different things, I was really synchronizing on the same objects that they pointed to! Not sure if this helps at all, but good luck! Multi-Threading can be tricky! We'd likely need the major code parts to really look into the issue.
upvote count: 1

http://stackoverflow.com/comment/33030073
type: Comment
comment on: http://stackoverflow.com/q/21823880
score: 0
type: QuestionComment
has text: A reversed eng. just try some inputs and try to use some common sense, no other optional way.

http://stackoverflow.com/comment/32974930
type: QuestionComment
comment on: http://stackoverflow.com/q/21693262
has text: @ChrisMartin hi there. yeah I am using that library.
score: 0
type: Comment

http://stackoverflow.com/comment/32859293
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21728276
has text: Thanks for the reply, but PREPARE and EXECUTE are not what is internally used by the driver. I'm trying to use Postgres's prepared statements feature (see the link at the top of my question). To use this feature, you have to send PREPARE and then EXECUTE to Postgres. I know it's a bit confusing since JDBC has a function named "prepareStatement" but that's actually just a coincidence, this isn't related to Postgres's prepared statements.
type: AnswerComment

http://stackoverflow.com/a/21833815
has comment: http://stackoverflow.com/comment/33048330
answers question: http://stackoverflow.com/q/21826937
has comment: http://stackoverflow.com/comment/33080137
score: 1
has body: The statement restarts the IDENTITY sequence declared inside the table: TRUNCATE TABLE T RESTART IDENTITY AND COMMIT NO CHECK This statement does the above for all the tables in the schema, as well as resetting the sequences that are outside the tables: TRUNCATE SCHEMA PUBLIC RESTART IDENTITY AND COMMIT NO CHECK The statement to drop the sequence drops it permanently. There is no trace of it left when you create it again. All the above can be tested with the latest HSQLDB 2.3.X It is possible that you are using an older version, or possibly one of your statements is not actually executed. Note you should drop the sequence with one statement and create it again with another statement.
has comment: http://stackoverflow.com/comment/33048248
upvote count: 1
has comment: http://stackoverflow.com/comment/33048833
has comment: http://stackoverflow.com/comment/33048164
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32828101
type: Comment
has text: If I add MultipleOutputs.addNamedOutput(job, FileName1.toString(), TextOutputFormat.class,NullWritable.class,Text.class); in generateOutput() method, how do i get the job in reducer. I have just started this might be a very basic question ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21703569

http://stackoverflow.com/comment/33830290
type: QuestionComment
has text: I experienced exactly the same under Linux (so I had to copy the .so to the library path). Do you actually know whether there are sources available for this Rift wrapper? On first sight I though it is the same as [this](https://github.com/38leinaD/JRift/tree/master/JRift/src/de/fruitfly/ovr) (same namespace), but it looks like it has some more functionality.
comment on: http://stackoverflow.com/q/21760342
score: 0
type: Comment

http://stackoverflow.com/a/21679389
answers question: http://stackoverflow.com/q/21678993
score: 0
type: AcceptedAnswer
has body: Replace the offending line with sqldb = ctx.openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null); where ctx is a context you will pass as a parameter to your CheckIsDataAlreadyInDBorNot method. i.e.: public boolean CheckIsDataAlreadyInDBorNot(Context ctx, long hpnumberID) { and DB_NAME is a string containing your db name, i.e.: private final static String DB_NAME = "rec_nums.db"; public static final String DATABASE_TABLE2 = "receivernumber"; public static final String KEY_ROWID2 = "hpnumberID2"; public static final String KEY_NAME2 = "hpNumber2";
type: Answer
accepted answer of: http://stackoverflow.com/q/21678993

http://stackoverflow.com/q/21749386
tagged with: java
has comment: http://stackoverflow.com/comment/32896826
has title: Duplicate key in TreeMap
has comment: http://stackoverflow.com/comment/32896797
downvote count: 1
has answer: http://stackoverflow.com/a/21749432
has comment: http://stackoverflow.com/comment/32896783
type: Question
has comment: http://stackoverflow.com/comment/32896753
score: 12
answer count: 2
has comment: http://stackoverflow.com/comment/32896800
accepted answer: http://stackoverflow.com/a/21749432
favorite count: 0
has answer: http://stackoverflow.com/a/21749443
possible better answer: http://stackoverflow.com/a/21749443
upvote count: 13
type: AnsweredQuestion
has body: I have the below code for tree map where I store duplicate key and it seems overwrite the existing one. TreeMap&lt;String, Integer&gt; tm=new TreeMap&lt;&gt;(); tm.put("vivek", 1); tm.put("vivek", 2); System.out.println(tm); It prints {vivek=2} So it means map allow to overwrite on key basis?

http://stackoverflow.com/comment/32831075
score: 2
comment on: http://stackoverflow.com/a/21711961
type: AnswerComment
has text: You get the compiler error because Java generics are invariant, unlike arrays. That is, a `List<BB>` is _not_ a `List<AA>`, even though a `BB` is an `AA`. This must be caught at compile time, because there is no equivalent of the `ArrayStoreException` for collections. The JVM cannot catch such an error, so the compiler must prevent it with a compiler error. See [Is List<Dog> a subclass of List<Animal>? Why aren't Java's generics implicitly polymorphic?](http://stackoverflow.com/questions/2745265/is-listdog-a-subclass-of-listanimal-why-arent-javas-generics-implicitly-p) for more detail.
type: Comment

http://stackoverflow.com/comment/47265379
has text: I am a bit confused after gone through [@Vlad Mihalcea Answer on this post](http://stackoverflow.com/questions/23925322/delete-child-from-parent-and-parent-from-child-automatically-with-jpa-annotation/23926548#23926548). In his answer, `Child` has `many toys` then *why he has annotated `List<Toy> toys` with `OneToOne(mappedBy = "child")` ? Why not with `OneToMany` ?* Also you have specified `JoinColumn` on `User` in `Status` & Vlad Mihalcea didn't on `Child` in `Toy`. *What is the objective of `mappedBy` with/without `JoinColumn` ?* Will you please clear my doubt ?
type: AnswerComment
comment on: http://stackoverflow.com/a/21762450
score: 0
type: Comment

http://stackoverflow.com/a/21779341
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21778799
has comment: http://stackoverflow.com/comment/32950535
upvote count: 1
has body: This version does not allocate new objects (substrings, etc) and just look for the characters where they are supposed to be. public static void main(String[] args) { System.out.println(countRepeat("abcabcabc", "abc")); // 3 System.out.println(countRepeat("abcabcdabc", "abc")); // 2 System.out.println(countRepeat("abcabcabcx", "abc")); // 3 System.out.println(countRepeat("xabcabcabc", "abc")); // 0 } public static int countRepeat(String s, String t){ int n = 0; // Ocurrences for (int i = 0; i &lt; s.length(); i ++) { // i is index in s int j = i % t.length(); // corresponding index in t boolean last = j == t.length() - 1; // this should be the last char in t if (s.charAt(i) == t.charAt(j)) { // Matches? if (last) { // Matches and it is the last n++; } } else { // Do not match. finished! break; } } return n; }
has comment: http://stackoverflow.com/comment/32950408
type: Answer

http://stackoverflow.com/comment/32951353
type: QuestionComment
comment on: http://stackoverflow.com/q/21780231
type: Comment
score: 0
has text: Hi Mureinik, there is nothing to share the code. i have fetch the data from DB as well as from JSP. and unable to set that value. please suggest me, how can I do that ? And, thanks for correcting the question.

http://stackoverflow.com/q/21709217
tagged with: java
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/21710224
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21709289
has answer: http://stackoverflow.com/a/21709270
linked to: http://stackoverflow.com/q/767372
has body: I have two activities; the first activity starts the second one with some data passed through the intent. Intent i = new Intent(this,BActivity.class); i.putExtra("identify", "c2f"); startActivityForResult(i, 1); In the second activity, I want to make some TextViews/EditTexts visible (which are initially set to invisible) based on the information passed from the first activity. Here's the code for that: tv1 = (TextView)findViewById(R.id.textView2); tv2 = (TextView)findViewById(R.id.textView3); et1 = (EditText)findViewById(R.id.editText1); et2 = (EditText)findViewById(R.id.editText2); button = (Button)findViewById(R.id.send_result); Bundle extras = getIntent().getExtras(); String identifier = extras.getString("identify"); if(identifier == "c2f") { tv1.setVisibility(0); tv1.setText("Celcius"); et1.setVisibility(0); } else if(identifier == "f2c") { tv1.setVisibility(0); tv1.setText("Fahrenheit"); et1.setVisibility(0); } else if(identifier == "currency") { tv1.setVisibility(0); tv1.setText("Amount"); tv2.setVisibility(0); tv2.setText("Conv. Rate"); et1.setVisibility(0); et2.setVisibility(0); } Now when the second activity starts, none of these TextViews or EditTexts seem to get visible! identifier (string) holds the correct value passed from first activity and it even goes into the if conditions, but it doesn't make any view visible. Am I making any mistake in trying to make these views visible?
favorite count: 0
type: Question
upvote count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/21709270
has title: Making a TextView visible at runtime in java (Android)
accepted answer: http://stackoverflow.com/a/21709289

http://stackoverflow.com/comment/32815685
has text: @alex1111 You'll simply have to replace in the input string any occurrence of the string `"${" + name + "}"` by the *real* value. See [`String#replaceAll`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String)) (don't forget to escape the first argument using [`Pattern#quote`](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#quote(java.lang.String))).
type: Comment
comment on: http://stackoverflow.com/a/21703889
score: 0
type: AnswerComment

http://stackoverflow.com/a/22262225
has body: The problem here is that the redirection does not get executed in the bash command you are invoking. Try using passing the command to execute as a string usin the -c option for bash: sudo bash -c "/home/me/path/myscript.sh arg1 arg2 arg3 &gt;&gt; /var/log/path/myscript.log 2&gt;&amp;1" In order to use the java ProcessBuilder with this command I would try construct it like this: new ProcessBuilder("sudo", "bash", "-c", "/home/me/path/myscript.sh arg1 arg2 arg3 &gt;&gt; /var/log/path/myscript.log 2&gt;&amp;1"); With this use of ProcessBuilder you are basically asking it to execute the command sudo and provide to it 3 parameters. In return sudo will invoke your command like this: bash -c "...". You might still have a problem when the process will prompt for the sudo password.
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/21820343
upvote count: 4

http://stackoverflow.com/comment/32906508
comment on: http://stackoverflow.com/a/21754170
has text: Update: It seems like I didnt't close the database correctly. After creating a new one it works perfectly. Tank you :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32947309
type: Comment
type: QuestionComment
has text: Why not just rename it? http://stackoverflow.com/questions/1158777/renaming-a-file-using-java
comment on: http://stackoverflow.com/q/21777883
score: 0

http://stackoverflow.com/q/21699676
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21701427
tagged with: spring
tagged with: jasypt
has answer: http://stackoverflow.com/a/21779479
type: UnansweredQuestion
upvote count: 1
has body: I have added this in my application context file <property name="algorithm" value="PBEWithMD5AndDES" /> <property name="password" value="contactKey" /> <property name="registeredName" value="jasyptHibernateEncryptor" /> <property name="encryptor" ref="stringEncryptor" /> ` This below coded added in hibernate mapping file ` jasyptHibernateEncryptor We are using spring with Hibernate in to my application,but we want to implenting jasyptHibernateEncryptorin in to my application. It's working fine when storing a new entry into database table and fetching the same entry, but problem here its how to encrypt my old data.
score: 1
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has title: encrypting old data in database

http://stackoverflow.com/comment/32782496
comment on: http://stackoverflow.com/a/21684938
type: Comment
score: 0
type: AnswerComment
has text: I see what you mean, but I would like to break up the URL into the filename and the QUERY_STRING before breaking up the QUERY_STRING itself.

http://stackoverflow.com/a/21699371
has body: Since each thread uses the same network port, I would not assume the multi-threading will speed up the sending - on the contrary, I think the overhead of negotiating the usage .
answers question: http://stackoverflow.com/q/21699227
type: Answer
score: 0

http://stackoverflow.com/a/21758121
upvote count: 1
has comment: http://stackoverflow.com/comment/32950342
has body: You intended to declare 2 functions, f and df before the main function, then define both f and df. You're allowed to do this kind of things in C, but this is not C, is Java. In Java, you can only declare classes and interfaces at the top level, and the methods are defined inside them. So, these functions are invalid, along with their definitions below the class: import Scanner.java.util; //invalid double f = (double); //invalid double df = (double); public class NewtRaphEx { //class content... } //invalid // Creating Function f = x - cos(3.5x) double f(double x) { return (x - cos(3.5 * x)) } //invalid double df (double x) { return (1 + sin(3.5 * x)) } To make your application work, one way would be to redefine these functions as static methods inside your class. import Scanner.java.util; public class NewtRaphEx { //valid // Creating Function f = x - cos(3.5x) static double f(double x) { return (x - cos(3.5 * x)) } //valid static double df (double x) { return (1 + sin(3.5 * x)) } //class content... } I highly recommend you to review the basics of Java programming by following The Java Tutorials.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/21757897

http://stackoverflow.com/q/21751865
answer count: 1
has answer: http://stackoverflow.com/a/21775821
has body: I am trying to run the Amazon AWS S3 example code on JBoss. It runs fine as a JSE app. I add the same amazon dependency to my POM in both projects. The call to instantiate teh client always throws an exception when running on JBoss AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); AmazonS3 conn = new AmazonS3Client(credentials); Throws this exception: NoClassDefFoundError: org/apache/http/conn/scheme/SchemeSocketFactory I think this is related to the http-client.jar but I have no idea how to fix this, tell JBoss where to pick up the correct dependency etc? ref: http://aws.amazon.com/developers/getting-started/java/
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32901715
tagged with: amazon-s3
tagged with: java
tagged with: jboss
accepted answer: http://stackoverflow.com/a/21775821
type: Question
tagged with: jakarta-ee
has title: Running AmazonS3Client from JBoss 7.1
tagged with: amazon-web-services
score: 0
has comment: http://stackoverflow.com/comment/32927393

http://stackoverflow.com/q/21732436
has comment: http://stackoverflow.com/comment/32866988
has answer: http://stackoverflow.com/a/21732552
accepted answer: http://stackoverflow.com/a/21732552
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32866378
type: Question
has title: Ajax post call to a rest service through servlet
has body: I have a little problem: I'm developing a jQuery Mobile app and i need to make an ajax post call to a rest service. I create the pages dynamically using servlets. I tried to make the ajax call to the rest url: http://localhost:8181/myRestServicePath/func?key=value from a page whit the following url: http://localhost:8080/Mypage but i get a cross-orign error from the browser. So i'm tryng to perform this call, passing through a Java servlet using the doPost() method. Now, my intent is to make an ajax post call from http://localhost:8080/Mypage to: http://localhost:8080/myServletPath/func?key=value and this servlet should redirect the POST request to my RestService: http://localhost:8181/myRestServicePath/func?key=value How can i perform this redirection?
tagged with: jquery
tagged with: servlets
tagged with: ajax
score: 0
answer count: 1
tagged with: rest

http://stackoverflow.com/comment/32856460
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21726709
has text: Did you run JConsole from `JBOSS_HOME/bin/jconsole.sh`?
score: 0

http://stackoverflow.com/a/21787651
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32964944
has comment: http://stackoverflow.com/comment/32965013
has body: Use break if you don't want to continue the loop. for (int i = 1; i &lt;= 10; i++) { try { .. // some other code here if (!checkValue()) { Thread.sleep(2000 * 60); } else { break; } } catch (Exception e) { e.printStackTrace(); } }
answers question: http://stackoverflow.com/q/21787413

http://stackoverflow.com/comment/33023855
score: 0
has text: Many of your if conditions are problem because your code enters multiple if conditions and overwrites the values set by previous if conditions. Either use switch-case or use if..else to make the paths exclusive.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21820419

http://stackoverflow.com/comment/32870361
comment on: http://stackoverflow.com/a/21733174
score: 0
type: AnswerComment
type: Comment
has text: how do I do that? i'm not familiar with this. sorry.

http://stackoverflow.com/q/21759456
answer count: 2
tagged with: clock
favorite count: 0
accepted answer: http://stackoverflow.com/a/21760337
has answer: http://stackoverflow.com/a/75247078
tagged with: android
possible better answer: http://stackoverflow.com/a/75247078
has body: I really don't think this question is a duplicate. Most answers to similar questions say to use System.currentTimeMillis() as the most accurate time, but I've noticed that two Android devices side-by-side may be off up to 5 seconds or more from each other or (more importantly) the real time, and I believe currentTimeMillis() will reflect that difference. So what I'm really looking for is a comprehensive solution to get the most accurate time possible in a given moment. For example, it would start with the GPS and, if that's not available or there's no signal, fall back to SNTP, or if that doesn't work ask Android to refresh its wall clock with via its own SNTP or carrier NITZ. My goal is accuracy within .1 seconds. Is that possible? Thanks.
downvote count: 1
has comment: http://stackoverflow.com/comment/32915090
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21760337
tagged with: java
upvote count: 10
has title: How do I get the most accurate time with Android?
score: 9
type: Question

http://stackoverflow.com/a/21821234
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21821154
has comment: http://stackoverflow.com/comment/33025355
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21821154
has body: If u want tag can occurs many times in server tag use this. &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:complexType name="Disk"&gt; &lt;xs:attribute name="index" type="xs:int"&gt;&lt;/xs:attribute&gt; &lt;xs:attribute name="providerId" type="xs:int"&gt;&lt;/xs:attribute&gt; &lt;xs:attribute name="size" type="xs:int"&gt;&lt;/xs:attribute&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Server"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Disks" maxOccurs="unbounded" type="Disks"&gt;&lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Disks"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Disk" maxOccurs="unbounded" type="Disk"&gt;&lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; Or if you want Disks tag only once use following XSD &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:complexType name="Disk"&gt; &lt;xs:attribute name="index" type="xs:int"&gt;&lt;/xs:attribute&gt; &lt;xs:attribute name="providerId" type="xs:int"&gt;&lt;/xs:attribute&gt; &lt;xs:attribute name="size" type="xs:int"&gt;&lt;/xs:attribute&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Server"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Disks" minOccurs="0" maxOccurs="1" type="Disks"&gt;&lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="Disks"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Disk" maxOccurs="unbounded" type="Disk"&gt;&lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt;
type: Answer
score: 2

http://stackoverflow.com/a/21781154
has body: You should flush and close the PrintWriter like this: File file = new File("testFile.txt"); PrintWriter filePrint = new PrintWriter(new BufferedWriter(new FileWriter(file, true))); try { try { filePrint.println("testing, testing, printing into a file (apparently)"); filePrint.flush(); } finally { filePrint.close(); } } catch (IOException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/32953357
score: 0
answers question: http://stackoverflow.com/q/21781002
type: Answer
has comment: http://stackoverflow.com/comment/32953269

http://stackoverflow.com/a/21799029
has body: Your linked code is fairly large, so it's hard to isolate where everything is happening... but here's a few things I had to deal with when I was getting the WebSocket stuff working with Spring: (As a side note, I originally had a problem similar to yours where the initial handshake would fail with various error messages) Make sure you're using the latest Spring 4 These are the specific spring dependencies I'm using. From your pom, it looks like you're good here, but I'm including them in the list for reference (these are Gradle dependency declarations). compile "org.springframework:spring-websocket:4.0.1.RELEASE" compile "org.springframework:spring-messaging:4.0.1.RELEASE" Make sure you're using the servlet 3.0 spec web.xml should declare the servlet spec version as 3.0, not 2.3. It looks like you're using 2.3. <web-app 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"> Not sure if this is a strict requirement, but I had to switch to get mine working. Here's the documentation reference: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html. I also had to add the "async-supported" element to all servlet definitions and filter definitions: true Also, you need to use a compatible servlet container. I had to upgrade to Tomcat 7.0.50 (I think the minimum is 7.0.47). The Spring documentation lists other compatible containers. Setup the server stuff correctly Here's my Spring XML config: <websocket:message-broker application-destination-prefix="/rt"> <websocket:stomp-endpoint path="/endpoint" > <websocket:sockjs /> </websocket:stomp-endpoint> <websocket:simple-broker prefix="/topic" /> </websocket:message-broker> So, I've made a topic at the endpoint "endpoint". The "application-destination-prefix" is not really being used AFAICT because I'm only pushing from server to client.…
upvote count: 9
type: Answer
has comment: http://stackoverflow.com/comment/32993217
has comment: http://stackoverflow.com/comment/32993299
downvote count: 0
score: 9
answers question: http://stackoverflow.com/q/21795322

http://stackoverflow.com/q/21744266
type: Question
tagged with: java
has body: I just switched from Eclipse to IntelliJ IDEA, and I imported all of my old projects, but I'm getting insane warnings. For example, when looking at the image pasted above, it gives warnings on abstract methods not being used, classes not being used, even imports that aren't being used when they clearly are. Finally, what is the hotkey for importing? Like in Eclipse it's Shift + O. Any additional tips if all is resolved that I should know that is different from IntelliJ and Eclipse?
tagged with: eclipse
upvote count: 1
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/32888005
tagged with: ide
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32888116
downvote count: 0
answer count: 0
score: 1
has title: IntelliJ IDEA warning highlighting on not using an abstract method?

http://stackoverflow.com/comment/32929180
has text: in the error is stated that it cannot find the method in the main activity but i moved it to main activity and then i get te error: 100 frames skipped maybe to much running on your main activity
type: AnswerComment
comment on: http://stackoverflow.com/a/21766734
score: 0
type: Comment

http://stackoverflow.com/comment/33017570
type: Comment
comment on: http://stackoverflow.com/a/21804170
has text: @WindDweller This page explain how to easily pass arguments to `gradle run` : http://simonharrer.wordpress.com/2013/09/17/building-command-line-apps-with-gradle/
score: 0
type: AnswerComment

user-interface
tags question: http://stackoverflow.com/q/21820705
tags question: http://stackoverflow.com/q/21781911
tags question: http://stackoverflow.com/q/21833367
tags question: http://stackoverflow.com/q/21798819
tags question: http://stackoverflow.com/q/21701413
tags question: http://stackoverflow.com/q/21813279
tags question: http://stackoverflow.com/q/21823435
tags question: http://stackoverflow.com/q/21820118
tags question: http://stackoverflow.com/q/21697341
tags question: http://stackoverflow.com/q/21816110
tags question: http://stackoverflow.com/q/21693721
tags question: http://stackoverflow.com/q/21838565
tags question: http://stackoverflow.com/q/21808264
tags question: http://stackoverflow.com/q/21704718
tags question: http://stackoverflow.com/q/21813300
tags question: http://stackoverflow.com/q/21712998
tags question: http://stackoverflow.com/q/21782877
type: Tag
tags question: http://stackoverflow.com/q/21818640
tags question: http://stackoverflow.com/q/21709375
tags question: http://stackoverflow.com/q/21819406
tags question: http://stackoverflow.com/q/21704742
tags question: http://stackoverflow.com/q/21734867
tags question: http://stackoverflow.com/q/21812276
tags question: http://stackoverflow.com/q/21709997
tags question: http://stackoverflow.com/q/21742694
tags question: http://stackoverflow.com/q/21780427
tags question: http://stackoverflow.com/q/21693525
tags question: http://stackoverflow.com/q/21694117
tags question: http://stackoverflow.com/q/21736324
tags question: http://stackoverflow.com/q/21795681
tags question: http://stackoverflow.com/q/21768462
tags question: http://stackoverflow.com/q/21741492
tags question: http://stackoverflow.com/q/21813609
tags question: http://stackoverflow.com/q/21832206
tags question: http://stackoverflow.com/q/21770342
tags question: http://stackoverflow.com/q/21771233
tags question: http://stackoverflow.com/q/21800147
tags question: http://stackoverflow.com/q/21755100
tags question: http://stackoverflow.com/q/21709160
tags question: http://stackoverflow.com/q/21707481
tags question: http://stackoverflow.com/q/21832879
tags question: http://stackoverflow.com/q/21688332
tags question: http://stackoverflow.com/q/21753769
tags question: http://stackoverflow.com/q/21724467
tags question: http://stackoverflow.com/q/21790254
tags question: http://stackoverflow.com/q/21755117
tags question: http://stackoverflow.com/q/21795514
tags question: http://stackoverflow.com/q/21691683
tags question: http://stackoverflow.com/q/21803807
tags question: http://stackoverflow.com/q/21734374
tags question: http://stackoverflow.com/q/21765337
tags question: http://stackoverflow.com/q/21703276
tags question: http://stackoverflow.com/q/21779912
tags question: http://stackoverflow.com/q/21734961
tag name: user-interface
tags question: http://stackoverflow.com/q/21795703
tags question: http://stackoverflow.com/q/21810634
tags question: http://stackoverflow.com/q/21687370

http://stackoverflow.com/a/21834173
type: Answer
has comment: http://stackoverflow.com/comment/33047914
has comment: http://stackoverflow.com/comment/33048543
has comment: http://stackoverflow.com/comment/33050007
answers question: http://stackoverflow.com/q/21834029
has body: Try this code for comparison if(a.getAnswer().equals("")) { Log.d("Way 1", "successfully"); } This will work as expected
score: 0

http://stackoverflow.com/a/21740436
upvote count: 3
answers question: http://stackoverflow.com/q/21738336
has body: when(listaFilmes.get(anyInt())).thenReturn(any(Filme.class)); There's your problem. You can't use any in a return value. any is a Matcher—it's used to match parameter values for stubbing and verification—and doesn't make sense in defining a return value for a call. You'll need to explicitly return a Filme instance, or leave it null (which is the default behavior, which would defeat the point of stubbing). I should note that it's often a good idea to use a real List instead of a mock List. Unlike custom code you've developed, List implementations are well-defined and well-tested, and unlike mock Lists a real List is very unlikely to break if you refactor your system under test to call different methods. It's a matter of style and testing philosophy, but you may find it advantageous just to use a real List here. Why would the above rule cause that exception? Well, this explanation breaks some of Mockito's abstractions, but matchers don't behave like you think they might—they record a value onto a secret ThreadLocal stack of ArgumentMatcher objects and return null or some other dummy value, and in the call to when or verify Mockito sees a non-empty stack and knows to use those Matchers in preference to actual argument values. As far as Mockito and the Java evaluation order are concerned, your code looks like the following: when(listaFilmes.get(anyInt())).thenReturn(null); when(filmeDao.listAll(any())).thenReturn(listaFilmes); // nonsense Naturally Mockito sees an any matcher, and listAll doesn't take an argument, so there are 0 matchers expected, 1 recorded.
accepted answer of: http://stackoverflow.com/q/21738336
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32881884
downvote count: 0
has comment: http://stackoverflow.com/comment/32922456
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/32882172

http://stackoverflow.com/q/21688519
has body: I am a new to Guice dependecy injection, hope someone could explain me why my code doesn't work. here is the class that extends AbstractModule: public class WebCoreModule extends AbstractModule { @Provides public SomeFactory getSomeFactory() { return new SomeFactoryImpl(); } } and in the other class i have a private member private static @Inject SomeFactory factory; I'd like to invoke methods on factory object, but it is always null. Also I set a breakpoint on getSomeFactory() method and it is never being invoked. What am I doing wrong?
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/32788916
has title: Google Guice. Methods annotated with @Provides annotation are not invoked
tagged with: java
has comment: http://stackoverflow.com/comment/32789340
tagged with: guice
answer count: 1
has answer: http://stackoverflow.com/a/21732889
score: 0
has comment: http://stackoverflow.com/comment/32788844
accepted answer: http://stackoverflow.com/a/21732889
has comment: http://stackoverflow.com/comment/32789072
tagged with: guice-3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32789226
type: Question

http://stackoverflow.com/comment/32801193
comment on: http://stackoverflow.com/q/21695516
type: Comment
type: QuestionComment
has text: Well, you have to loop through the elements of the list until you find the one with the given ID, and then print its details. It would be much easier if you used a `Map<String, Contact>`, storing each Contact as a value associated with its ID as a key.
score: 0

jstl
tags question: http://stackoverflow.com/q/21758612
tags question: http://stackoverflow.com/q/21707723
tags question: http://stackoverflow.com/q/21786747
tags question: http://stackoverflow.com/q/21683021
tags question: http://stackoverflow.com/q/21812352
tags question: http://stackoverflow.com/q/21759969
type: Tag
tag name: jstl
tags question: http://stackoverflow.com/q/21738281
tags question: http://stackoverflow.com/q/21684988
tags question: http://stackoverflow.com/q/21787750
tags question: http://stackoverflow.com/q/21813005
tags question: http://stackoverflow.com/q/21686063
tags question: http://stackoverflow.com/q/21777756

http://stackoverflow.com/comment/32812147
has text: Hi, we should avoid answers with just a link. Or see how to reference it correctly: http://stackoverflow.com/help/referencing. Anyway, thanks for answer and welcome on SO.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21701741
type: Comment

http://stackoverflow.com/comment/33026511
comment on: http://stackoverflow.com/q/21821275
score: 0
has text: `replaceAll` - Java is case sensitive, I'm assuming your using Java 1.4+
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21758317
has comment: http://stackoverflow.com/comment/32912552
answers question: http://stackoverflow.com/q/21758138
has comment: http://stackoverflow.com/comment/32912325
has body: String s = "ABC114.553111.325785.658EFG114.256114.589115.898"; Matcher prefixes = Pattern.compile("([A-Z]{3})").matcher(s); for (String part : s.split("[A-Z]{3}")) { if (part.equals("")) { continue; } prefixes.find(); System.out.println(prefixes.group(0)); for (int i = 0; i &lt; part.length(); i += 7) { System.out.println(part.substring(i, i + 7)); } } Output: ABC 114.553 111.325 785.658 EFG 114.256 114.589 115.898
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21754078
type: Question
has title: DataInputStream readLine() deprecated
score: 3
has answer: http://stackoverflow.com/a/21754553
tagged with: deprecated
has comment: http://stackoverflow.com/comment/32904821
tagged with: java
accepted answer: http://stackoverflow.com/a/21754553
linked to: http://stackoverflow.com/q/11331744
answer count: 2
has answer: http://stackoverflow.com/a/21754554
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21754554
has body: I need to use the DataInputStream, since I need the deprecated readLine() functionality and I don't know the exact file format of the input file (i.e. what line ending is used), but also need to read binary encoded primitives. This is similar to this question: Is there a class that exposes an unbuffered readLine method in Java? My suggestion is to use something like this public class SaveDataInputStream extends DataInputStream { public SaveDataInputStream(InputStream in) {super(in);} public String readLineSave() throws IOException { // ??? } } and to use the readLine() method content that can be found in the DataInputStream class (this is similar to the accepted answer in the referred question). However I don't fully understand why the method was deprecated and would prefer to know if it is relevant for my code. The javadoc says: This method does not properly convert bytes to characters. But what does that mean? Should I worry about that and what could happen in the worst case? Is it possible to write my own method that fixes the issue (efficiency is not really a concern)? Hint: new BufferedReader(new InputStreamReader(..)); is not the correct answer...
tagged with: io
tagged with: readline
type: AnsweredQuestion
upvote count: 3
tagged with: datainputstream

http://stackoverflow.com/q/21825215
has comment: http://stackoverflow.com/comment/33035234
has answer: http://stackoverflow.com/a/21826078
answer count: 4
linked to: http://stackoverflow.com/q/5908581
tagged with: c++
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21825338
tagged with: collections
has title: C++ map collision resolution as java HashMap
type: Question
tagged with: java
has body: I have already working, good and fast algorithm in java that uses Hashmap. Hashmap&lt;Point, Float&gt;map; //point object as a key. no nulls objects in key and values Point class has a following structure static public class Point { private int x; private int y; int hashCode() { int hash = 5; hash = 59 * hash + this-&gt;x; hash = 59 * hash + this-&gt;y; return hash; } boolean equals(Point p){ return x==p.x&amp;&amp;y==p.y; } } I should reimplement my algorithm in c++. I decided to use c++ stl hashmap. I just copied Point class with small changes according to c++ syntax, and wrote map in following way: std::map&lt;long, float&gt;mymap;//key-hashcode of the point mymap[point.hashcode()]=45;//example of using But I have found, that sometimes c++ version of algorithm returns wrong result. After a lot of debugging, I found, that some points returns equal hashcodes: Point(8,89).hashcode()==17966; //x=8,y=89 Point(9,30).hashcode()==17966; //x=9,y=30 java Hashmap resolves this conflict with equals function inside hashmap as a hash conflict resolution, but I do not know, how to implement this in c++... May be I should write better hash function, but I think this will not fully resolve my problem, only remove some collision, but will create new. Can you help me? UPD: added to Point class the following code: bool operator &lt;(const Point&amp; rhs) const { return getX()&lt;rhs.getX()|| (!(rhs.getX()&lt;getX()) &amp;&amp; getY()&lt;rhs.getY()); } and declared map as following: std::map&lt;Point, float&gt;mymap; and all started to work as intended
has answer: http://stackoverflow.com/a/21825332
has comment: http://stackoverflow.com/comment/33040987
score: 0
possible better answer: http://stackoverflow.com/a/21825338
has answer: http://stackoverflow.com/a/43817623
accepted answer: http://stackoverflow.com/a/43817623

http://stackoverflow.com/comment/32829784
score: 0
type: Comment
has text: Post tagged as C, not, ... whatever that is. (java?)
comment on: http://stackoverflow.com/a/21711354
type: AnswerComment

http://stackoverflow.com/a/21764242
has body: If you throw an exception it can't be easily ignored, whereas a return code can. On the other hand, a return code is easier to deal with when handling an "expected" error, and the return code is cheaper to handle (though the overhead when no error occurs may actually be higher than with the exception). Each has its merits.
answers question: http://stackoverflow.com/q/21763789
score: 0
type: Answer

http://stackoverflow.com/a/21823171
answers question: http://stackoverflow.com/q/21819026
has body: You have to open the CMD from the main path and run the java command with full package details. Ex: If your Start.class is in C:\EampleProj\com\test\Start.class. then you should try C:\EampleProj>java com.test.Start
score: 0
type: Answer

http://stackoverflow.com/q/21767292
tagged with: scala-java-interop
tagged with: scala
score: 5
has answer: http://stackoverflow.com/a/21767699
upvote count: 5
tagged with: java
has body: I have this in scala: object Tester { def apply[T : Manifest](description: String, initValue: T) = new Tester[T](description, initValue) implicit def TesterToValue[T](j: Tester[T]): T = j.value } class Tester[T : Manifest](someData: String, initValue: T) { private var value = initValue def getValue : T = value } which allows me to do val t1 = JmxValue("some data", 4) I'm trying to create an instance of this is java, so far I've had no luck I've tried: Tester t1 = Tester&lt;Integer&gt;("data", 0); Tester&lt;Integer&gt; t1 = Tester&lt;Integer&gt;("data", 0); Tester t1 = Tester("data", 0); Tester t1 = new Tester&lt;Integer&gt;("data", 0); Tester&lt;Integer&gt; t1 = new Tester&lt;Integer&gt;("data", 0); Is there some limitation in using scala generic classes in java? Or am I just doing something horribly wrong
has title: Using a scala generic class in java
type: AnsweredQuestion
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21767699
type: Question
has comment: http://stackoverflow.com/comment/32929779

http://stackoverflow.com/a/21717223
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21716671
has comment: http://stackoverflow.com/comment/32840788
has body: Puting the RadioGroup's work in @Override public void onCheckedChanged(RadioGroup radioGroup, int checkedId) { //I would like to do things here but when I try to for example add the reference to a radio button it gives cannot resolve method findViewById error } }
has comment: http://stackoverflow.com/comment/32841749

http://stackoverflow.com/q/21710655
downvote count: 0
type: Question
has comment: http://stackoverflow.com/comment/32828511
tagged with: debugging
has body: I have written an old app long time ago on another computer. This one does not exist any more - and with it all the source is gone - but I still have the app in form of jar files. Now I need to check my old code what I have done in a particular place in code. I know I can create a Java from it - but I need to check it while it's running... I have tried javasnoop - but it can not attach. It keeps trying but forever - other apps I can attach to and debug. is there any other way/tool that can attach to a running jar and debug it? If that makes a difference: the application is being started with an EXE file and then uses the jar libs...
score: 1
tagged with: java
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/376201
has title: How to attach to a running jar and debug it?
has comment: http://stackoverflow.com/comment/32828262
favorite count: 0
duplicate of: http://stackoverflow.com/q/376201
has comment: http://stackoverflow.com/comment/32828191
has answer: http://stackoverflow.com/a/21710728
accepted answer: http://stackoverflow.com/a/21710728
type: AnsweredQuestion

http://stackoverflow.com/q/21819917
has title: How to override iterator `next()` to return Set<E> rather than E?
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21819922
tagged with: iterator
answer count: 1
score: 0
has body: I am in a certain scenario where I want to return a Set&lt;E&gt; rather than a E from next function in an iterator. Is there any design pattern / known fix, to work around such a scenario ? To explain my usecase, I am writing a code to join all levels of a tree more details here: Now I want an iterator whose next() would return a set of all nodes in that row, then the next row, and then the next row till last. Any pointers to proceed ?
accepted answer: http://stackoverflow.com/a/21819922
has comment: http://stackoverflow.com/comment/33022751

http://stackoverflow.com/a/21759051
answers question: http://stackoverflow.com/q/21758920
downvote count: 0
has body: Since you cannot use arrays, and assuming that other collections are out of the question as well, your only option is to print the numbers under ten as you get them. You also need to change the code to call result = isNum(input); inside the loop for each input, not just for the first number that you get: input = EasyIn.getInt(); result = isNum(input); if(result) // == true is implied { numCount++; System.out.println("Number under ten: "+input); } A note on the coding style: do not compare boolean with true or false. Another note: it is OK to return results of Boolean expressions without assigning them to variables or if statements. This whole block of code boolean returnValue; returnValue = false; if(num &gt;= 0 &amp;&amp; num &lt; 10) { returnValue = true; } return returnValue; is equivalent to return num &gt;= 0 &amp;&amp; num &lt; 10;
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/33055349
type: Comment
type: QuestionComment
has text: ... i see.. i was about to whine and say that it isn't possible. but there are ringtone apps that allow you to cut a piece that you want. I'll just have to put on my thinking cap and create and solve another problem . I've spent too much time on this problem and it's getting me no where. Just venting. Maybe I'll go play with some Fragments or something.. ionno
comment on: http://stackoverflow.com/q/21833356
score: 0

mysql
tags question: http://stackoverflow.com/q/21686563
tags question: http://stackoverflow.com/q/21779327
tags question: http://stackoverflow.com/q/21785544
tags question: http://stackoverflow.com/q/21682386
tags question: http://stackoverflow.com/q/21694627
tags question: http://stackoverflow.com/q/21734397
tags question: http://stackoverflow.com/q/21787028
tags question: http://stackoverflow.com/q/21703935
tags question: http://stackoverflow.com/q/21788792
tags question: http://stackoverflow.com/q/21774894
tag name: mysql
tags question: http://stackoverflow.com/q/21777205
tags question: http://stackoverflow.com/q/21782852
tags question: http://stackoverflow.com/q/21826352
tags question: http://stackoverflow.com/q/21830570
tags question: http://stackoverflow.com/q/21773472
tags question: http://stackoverflow.com/q/21735561
tags question: http://stackoverflow.com/q/21770137
tags question: http://stackoverflow.com/q/21788443
tags question: http://stackoverflow.com/q/21824330
tags question: http://stackoverflow.com/q/21796596
tags question: http://stackoverflow.com/q/21707550
tags question: http://stackoverflow.com/q/21792122
tags question: http://stackoverflow.com/q/21826724
tags question: http://stackoverflow.com/q/21681257
tags question: http://stackoverflow.com/q/21781920
tags question: http://stackoverflow.com/q/21778163
tags question: http://stackoverflow.com/q/21772852
tags question: http://stackoverflow.com/q/21712194
tags question: http://stackoverflow.com/q/21800213
tags question: http://stackoverflow.com/q/21722660
tags question: http://stackoverflow.com/q/21730939
tags question: http://stackoverflow.com/q/21698344
tags question: http://stackoverflow.com/q/21769793
tags question: http://stackoverflow.com/q/21756711
tags question: http://stackoverflow.com/q/21829023
tags question: http://stackoverflow.com/q/21752628
tags question: http://stackoverflow.com/q/21703851
tags question: http://stackoverflow.com/q/21716839
tags question: http://stackoverflow.com/q/21837724
tags question: http://stackoverflow.com/q/21828734
type: Tag
tags question: http://stackoverflow.com/q/21820695
tags question: http://stackoverflow.com/q/21737173
tags question: http://stackoverflow.com/q/21833573
tags question: http://stackoverflow.com/q/21787047
tags question: http://stackoverflow.com/q/21786799
tags question: http://stackoverflow.com/q/21743880
tags question: http://stackoverflow.com/q/21721449
tags question: http://stackoverflow.com/q/21729755
tags question: http://stackoverflow.com/q/21769224
tags question: http://stackoverflow.com/q/21799384
tags question: http://stackoverflow.com/q/21687646
tags question: http://stackoverflow.com/q/21813425
tags question: http://stackoverflow.com/q/21792484
tags question: http://stackoverflow.com/q/21802350
tags question: http://stackoverflow.com/q/21737884
tags question: http://stackoverflow.com/q/21832738
tags question: http://stackoverflow.com/q/21773527
tags question: http://stackoverflow.com/q/21813069
tags question: http://stackoverflow.com/q/21696619
tags question: http://stackoverflow.com/q/21786943
tags question: http://stackoverflow.com/q/21745313
tags question: http://stackoverflow.com/q/21745146
tags question: http://stackoverflow.com/q/21707689
tags question: http://stackoverflow.com/q/21757180
tags question: http://stackoverflow.com/q/21798710
tags question: http://stackoverflow.com/q/21783262
tags question: http://stackoverflow.com/q/21789413
tags question: http://stackoverflow.com/q/21695896
tags question: http://stackoverflow.com/q/21763790
tags question: http://stackoverflow.com/q/21710200
tags question: http://stackoverflow.com/q/21796497
tags question: http://stackoverflow.com/q/21683212

http://stackoverflow.com/q/21679926
tagged with: amqp
tagged with: servicebus
tagged with: qpid
has answer: http://stackoverflow.com/a/21914371
has title: ServiceBus over AMQP looses redelivered messages
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21864141
has body: We have on-premise installation of ServiceBus. I noticed strange behavior when dealing with redelivery. I created sample application, see bellow. This application will post 5 messages to topic with persistent queue and than tries to read all the messages. For each message it will create new session and start/stop message delivery (the timeouts are needed for graceful start/stop of qpid background thread). I suppose that prefetch will make note read messages peek locked. I expect to eventually get all messages, but some messages are being lost. Max delivery count is set to 10. The queue was examined by Serviuce Bus Explorer, it is empty after the test and the missing messages are not in Dealetter queue. The test used to manifest the behavior, this is not the way one should consume messages: private static final long RECEIVE_TIMEOUT_MS = 5000; private static final long SLEEP_BETWEEN_SESSIONS_MS = 1000; private static final long SLEEP_PEEK_TIMEOUT_MS = 70000; private static final int MAX_SUBSEQUENT_FAILURES = 3; private static final int MESSAGES_TO_TEST = 5; // send some messages to empty queue for (int i = 0; i &lt; MESSAGES_TO_TEST; i++) { testSendToTopic(connection, context, Integer.toString(i)); Thread.sleep(SLEEP_BETWEEN_SESSIONS_MS); } // wait for message OUTER: for (int i = 0; i &lt; MESSAGES_TO_TEST; i++) { Thread.sleep(SLEEP_BETWEEN_SESSIONS_MS); int subsequentFailures = 0; while (!testReceiveFromQueue(connection, context)) { log.info("Waiting for peek lock timeout"); Thread.sleep(SLEEP_PEEK_TIMEOUT_MS); subsequentFailures++; if (subsequentFailures &gt; MAX_SUBSEQUENT_FAILURES) { log.info("Giving up"); break OUTER; } } } This is log, message 1, 2 and 4 were lost: 19:05:51,012 [ main] INFO [Qpid] Message sent, id: 0 19:05:52,039 [ main] INFO [Qpid] Message sent, id: 1 19:05:53,055 [ main] INFO [Qpid] Message sent, id: 2 19:05:54,074 [ main] INFO [Qpid] Message sent, id: 3 19:05:55,088 [ main] INFO [Qpid] Message sent, id: 4 19:05:57,131 [ main] INFO [Qpid] Rece…
possible better answer: http://stackoverflow.com/a/21864141
type: Question
accepted answer: http://stackoverflow.com/a/21914371
tagged with: java
score: 0
tagged with: azureservicebus
answer count: 2

http://stackoverflow.com/q/21747247
answer count: 0
tagged with: transactions
tagged with: java
has comment: http://stackoverflow.com/comment/32893451
type: Question
score: 0
has comment: http://stackoverflow.com/comment/32893876
has comment: http://stackoverflow.com/comment/32893752
has comment: http://stackoverflow.com/comment/32893669
has body: I am trying to execute the following code in java: void method(Connection conn) { // Make no auto-commits conn.setAutoCommit(false); // Create a savepoint just in case of rollback Savepoint point = conn.setSavepoint(); try { // Do something with database } catch (Exception e) { System.out.println("[ERROR] Something went wrong, so rolling back..."); conn.rollback(point); return; } // If everything ok, do the commit System.out.println("[INFO] Everything OK..."); conn.commit(); // The problem line } Now, the problem is the last line - all the queries to the database inside try block work fine, but the commit seems to make a pause - it stops the program, and that's all. What could possibly cause the delay for the transaction commit? The interesting thing is, that my colleague seems to run my code fine on his machine (we both have Java 6 installed), so what could possibly be wrong on my machine? '''UPDATE'''. Turns out this is not the mysql problem, there is a problem with instantianting connection before the call of this method. So the question should be closed, I guess
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32898417
has title: Why does commit to mysql in java take so long?

foreground
type: Tag
tags question: http://stackoverflow.com/q/21809348
tag name: foreground

http://stackoverflow.com/a/21784232
answers question: http://stackoverflow.com/q/21784200
type: Answer
has comment: http://stackoverflow.com/comment/103591375
has comment: http://stackoverflow.com/comment/103591435
has body: In Java, methods are virtual by default. In C#, they are not, and must be marked as virtual in order for polymorphism to work. It's a difference in philosophy. Java's philosophy is that a virtual-by-default approach makes it easy for you to extend classes at-will. C#, on the other hand, figures that you should only have virtual functions when you explicitly say you need them (so a function can be overriden only if explicitly allowed to.) There's a slight performance consideration, since a virtual function requires an additional level of indirection.
score: 22
downvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21784200
upvote count: 24

http://stackoverflow.com/comment/41461399
comment on: http://stackoverflow.com/q/21679149
type: Comment
type: QuestionComment
has text: I've answered the other question ...
score: 0

http://stackoverflow.com/a/21773156
downvote count: 0
type: Answer
has body: You can use Collection.frequency to find all possible duplicates in any collection using Collections.frequency(list, "a") Here is a proper example Most generic method to find Set&lt;String&gt; uniqueSet = new HashSet&lt;String&gt;(list); for (String temp : uniqueSet) { System.out.println(temp + ": " + Collections.frequency(list, temp)); } References from above link itself
score: 1
answers question: http://stackoverflow.com/q/21772966
upvote count: 1
has comment: http://stackoverflow.com/comment/32940023

http://stackoverflow.com/comment/32902030
score: 1
comment on: http://stackoverflow.com/a/21751955
type: AnswerComment
type: Comment
has text: Maybe. You may incur a capture cost if you need to pass data from the calling method into `Callable.call`. This might be better than string concatenation but will still likely be more expensive than wrapping the `fine` call in an _if_ statement that checks if the level is enabled. [Goetz discusses capture costs here](http://www.youtube.com/watch?v=C_QbkGU_lqY).

http://stackoverflow.com/comment/32829726
type: Comment
has text: @DavidWallace: Not sure about the Persian calendar, but I believe you can get a Buddhist calendar for Thailand, for example...#
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21711063

http://stackoverflow.com/comment/32934597
has text: .-. .............
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21770342

http://stackoverflow.com/comment/32906480
comment on: http://stackoverflow.com/q/21755067
score: 1
type: Comment
has text: "I do not have all features of that library" <-- what do you mean? Why don't you use a build system such as gradle, for instance?
type: QuestionComment

http://stackoverflow.com/comment/32974986
comment on: http://stackoverflow.com/q/21792237
type: Comment
type: QuestionComment
score: 0
has text: thanks @Marc for sharing the terminology for what I am looking!! Here are some relevant links http://stackoverflow.com/questions/16010701/how-push-notification-java-servlet-for-web-application and http://stackoverflow.com/questions/11077857/what-are-long-polling-websockets-server-sent-events-sse-and-comet?lq=1

http://stackoverflow.com/a/21786554
has comment: http://stackoverflow.com/comment/32963580
type: Answer
has comment: http://stackoverflow.com/comment/32964005
score: 2
downvote count: 0
has body: The toString() implementation for java.sql.Date will only give you the date in the format year-month-day. This is also precised in the documentation: Formats a date in the date escape format yyyy-mm-dd. If you want to keep the time in your print statement, you can use a SimpleDateFormat instead. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println(sdf.format(labIn));
upvote count: 2
answers question: http://stackoverflow.com/q/21786478
has comment: http://stackoverflow.com/comment/32963959
has comment: http://stackoverflow.com/comment/32963636

http://stackoverflow.com/comment/32872773
comment on: http://stackoverflow.com/q/21735946
type: Comment
type: QuestionComment
has text: You are correct, `x` is just a label. What exactly do you want to know? Are you asking about the internal implementation details?
score: 0

http://stackoverflow.com/a/21804937
score: 1
upvote count: 1
has body: Since you asked for an example, here we go. Topic: package com.answer.stack.overflow.questionnaire; import java.util.Set; import java.util.TreeSet; public class Topic { private String title; private Set&lt;Question&gt; questions = new TreeSet&lt;Question&gt;(); public Topic(String title) { this.title = title; } public String getTitle() { return title; } public void addQuestion(Question question) { questions.add(question); } public Set&lt;Question&gt; getQuestions() { return questions; } @Override public String toString() { String text = "Topic is ... " + title + "\n"; for (Question question : questions) { text += question.toString() + "\n"; } return text; } } Question: package com.answer.stack.overflow.questionnaire; public class Question implements Comparable&lt;Question&gt; { private String text; private String code; private Answer correctAnswer; public Question(String code, String text, String correctAnswerText) { this.code = code; this.text = text; this.correctAnswer = new Answer(code, correctAnswerText); } public String getText() { return text; } public String getCode() { return code; } public boolean isCorrect(String answer) { return correctAnswer.getText().equalsIgnoreCase(answer); } @Override public int compareTo(Question o) { return code.compareToIgnoreCase(o.code); } @Override public String toString() { return code + ": " + text + " (" + correctAnswer.getText() + ")"; } } Answer: package com.answer.stack.overflow.questionnaire; public class Answer { private String code; private String text; public Answer(String code, String text) { this.code = code; this.text = text; } public String getText() { return text; } @Override public String toString() { return code + ": " + text; } } Questionnaire: package com.answer.stack.overflow.questionnaire; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Questionnaire { private List&lt;Topic&gt; topics = new ArrayList&lt;Topic&gt;(); public void addTopic(Topic t…
downvote count: 0
answers question: http://stackoverflow.com/q/21803719
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21803719
type: Answer

http://stackoverflow.com/q/21734496
type: Question
tagged with: bing-api
tagged with: search
tagged with: bing
accepted answer: http://stackoverflow.com/a/24115033
answer count: 1
downvote count: 0
favorite count: 0
has body: I am successfully downloading images from the Bing's-Search-API in Java. However, I don't understand how to handle responses. For instance, if images are not found, or if the user tries to search for adult content (even if it is set to moderate), how should I catch theses responses? Thank you very much. Here is my code: public void SearchWithBing(String search){ search = search.replaceAll(" ", "%20"); String accountKey="acKey"; byte[] accountKeyBytes = Base64.encodeBase64((accountKey + ":" + accountKey).getBytes()); String accountKeyEnc = new String(accountKeyBytes); URL url; try { url = new URL( "https://api.datamarket.azure.com/Bing/Search/Image?Query=%27" + search + "%27&amp;$top=50&amp;$format=json"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Authorization", "Basic " + accountKeyEnc); conn.setRequestProperty("Accept", "application/json"); BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { gsonParser(output); System.out.println(output); } conn.disconnect(); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //EndOfBingSearch }
type: AnsweredQuestion
has title: How to correctly handle a response from the Bing Search API in Java?
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24115033
upvote count: 1

http://stackoverflow.com/a/21780543
has body: out of the top of my head: class A { protected State state public State getState(){ return state; } } class B extends A { public void setState( State s ){ this.state = s } } so the property remains read-only for all users of class A, but writable if you cast the instance to B. UPDATE: to use the callback-mechanismus: interface StateChanger(){ public void call( State state ); } class A { protected State state public State getState(){ return state; } public void setState( StateChanger stateChanger ){ stateChanger.call( state ); } } then you can use it as: classAInstance.setState( new StateChanger(){ @Override public void call( State state ){ //do stuff } } ); Perhaps you need to include in the StateChanger.call() also the this as a parameter in dynamic languages like Groovy it looks really compact
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32961578
score: 1
answers question: http://stackoverflow.com/q/21780416
has comment: http://stackoverflow.com/comment/32957267
has comment: http://stackoverflow.com/comment/32957857
upvote count: 1
has comment: http://stackoverflow.com/comment/32954609
has comment: http://stackoverflow.com/comment/32951890
accepted answer of: http://stackoverflow.com/q/21780416

http://stackoverflow.com/comment/33047999
type: QuestionComment
has text: In my opinion both are acceptable approaches. As @unluddite says, for large datasets, having data duplicated might be unacceptable. For small datasets I prefer the approach you're using.
score: 0
comment on: http://stackoverflow.com/q/21834353
type: Comment

http://stackoverflow.com/q/21802776
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32991944
has comment: http://stackoverflow.com/comment/32992477
type: Question
accepted answer: http://stackoverflow.com/a/21802830
has answer: http://stackoverflow.com/a/21802882
has answer: http://stackoverflow.com/a/21802832
score: 0
answer count: 3
has title: Store multiple values in HashMap and get it later
linked to: http://stackoverflow.com/q/1066589
possible better answer: http://stackoverflow.com/a/21802832
has body: I am storing a data in HashMap and getting the value in later stage. HashMap&lt;String, byte[]&gt; hm = new HashMap&lt;String, byte[]&gt;(); Now, I want to store two more values into it. For example, I want to store info like below. Could someone please advise me, how can i modify the Hashmap to ahieve this way? I also require to read all these stored values and find some value from it in later stage. Key 1 IPAddress RandomNumber Byte data Key 2 IPAddress RandomNumber Byte data Thank you!
tagged with: java
linked to: http://stackoverflow.com/q/21823938
has answer: http://stackoverflow.com/a/21802830

http://stackoverflow.com/comment/32917076
score: 0
comment on: http://stackoverflow.com/q/21760531
has text: Why is that Question Down voted that Much?? he just need a suggestion ,
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33042995
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21831615
type: AnswerComment
has text: Then I need to have setter for a_instance which (I mean setter method) I am gonna use only in test purposes. It's not very good practice to have code which is being used only for tests within class which contains some business logic for example.

http://stackoverflow.com/comment/33004375
has text: You can add arguments by adding `run { args 'your', 'arguments' }` to your build.gradle
type: Comment
comment on: http://stackoverflow.com/a/21804170
score: 0
type: AnswerComment

file-format
tags question: http://stackoverflow.com/q/21815556
type: Tag
tag name: file-format

http://stackoverflow.com/comment/32881348
comment on: http://stackoverflow.com/a/21738513
has text: Yes its a very old version... actually its 2.2... i know i should flash a newer version...
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/32924482
has text: then `getItem(position);` might return null for that position. Review how you set the items in your code. Anyhow check `if(rowItem != null) {...}` before calling .getpid() on it
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21764246
type: Comment

http://stackoverflow.com/comment/33023245
has text: This is the best way to do this.
comment on: http://stackoverflow.com/a/21820115
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21800606
has answer: http://stackoverflow.com/a/21800937
type: Question
answer count: 2
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/21800651
has comment: http://stackoverflow.com/comment/32988511
has comment: http://stackoverflow.com/comment/32987967
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has body: Im new to java and just wondering how do i get rid of this error: Exception in thread "main" java.lang.NumberFormatException: empty String at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1011) at java.lang.Double.parseDouble(Double.java:540) at fksdfs.test1.assign(test1.java:69) at fksdfs.test1.main(test1.java:60) I'm trying to get the Value from the textfield and convert it into a double to perform calculations on but it is not working. Can anyone help me? Sorry for the messy coding. public class test1 { private JTextField tField; public static void main(String[] args) { JLabel Age = new JLabel("Age"); JTextField textField = new JTextField(10); JLabel Overall = new JLabel("Overall: "); JTextField age = new JTextField(10); JLabel shoot = new JLabel("Shooting: "); JTextField shooting = new JTextField(10); JLabel dribble = new JLabel("Dribbling: "); JTextField dribbling = new JTextField(10); JLabel pass = new JLabel("Passing : "); JTextField passing = new JTextField(10); JLabel defend = new JLabel("defending : "); JTextField defending = new JTextField(10); JLabel head = new JLabel("Heading : "); JTextField heading = new JTextField(10); JLabel pace = new JLabel("Pace: "); JTextField pacey = new JTextField(10); JPanel panel = new JPanel(); panel.add(Age); panel.add(textField); panel.add(Overall); panel.add(age); panel.add(shoot); panel.add(shooting); panel.add(dribble); panel.add(dribbling); panel.add(pass); panel.add(passing); panel.add(defend); panel.add(defending); panel.add(head); panel.add(heading); panel.add(pace); panel.add(pacey); String age1 = textField.getText(); String overall1 = age.getText(); String shooting1 = shooting.getText(); String dribbling1 = dribbling.getText(); String passing1 = passing.getText(); String heading1 = heading.getText(); String defending1 = defending.getText(); String pace1 = pacey.getText(); JOptionPane.showMessageDialog(null, panel); } public static void assign(String s) { Double.parseDouble(s); } }
has comment: http://stackoverflow.com/comment/32988259
has comment: http://stackoverflow.com/comment/32988000
has title: Error when using Double.parseDouble
has comment: http://stackoverflow.com/comment/32987940
tagged with: java
has comment: http://stackoverflow.com/comment/32987960

http://stackoverflow.com/comment/32905084
has text: I have no `persistence.xml` file, I have used hibernate.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21752308
score: 0

http://stackoverflow.com/comment/32928265
comment on: http://stackoverflow.com/a/21766452
type: Comment
has text: Would I do something like Comparator<Integer> comparator= new Comparator<Integer>(); for the Comparator?And then I would then make a comparator class that would do what I needed it to do?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32976398
type: Comment
comment on: http://stackoverflow.com/a/21793923
has text: I apologize, my phone messes with code sometimes. Looking back on it, it looks pretty good to me. I would suggest saving the value of the current margin and then the new one and making sure the numbers change as expected. Disregard the actual answer I put.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21798497
has comment: http://stackoverflow.com/comment/32985836
has comment: http://stackoverflow.com/comment/32984260
score: 0
has body: I'm developing a Java GUI and I need: A label in first row(only one label). Starting 2nd row need to add say 100 buttons which extends to multiple lines(width shouldn't go beyond the visible screen) In a new line one more Label From next line say 100 buttons which extends to multiple lines(width shouldn't go beyond the visible screen)... [OPTIONAL] If the components exceeds JFrame height then need a scroll facility to the main window (only vertical) I have a strange results with flow layout, sometimes it stick to visible width, sometimes it sets even 500 buttons in a single row. I have tried every layout and also multipanes. Still no luck. Please guide.. just need an idea, No need of code Updated with code: Sorry guys, that was my first question to stackoverflow Thanks for prompt response Infact i tried many, here is a simple one. setLayout(new FlowLayout()); setTitle("JAVA GUI"); setSize(500,500); setVisible(true); add(new JLabel("row 1")); JPanel panel1 = new JPanel(new FlowLayout()); for(int i=0;i&lt;200;i++){ panel1.add(new JButton("b"+i)); } add(panel1); Here the panel1 is appearing in a sigle row which goes beyond the visible part of the screen. I think this can be solved by setting maximumsize to Jframe, but no idea how to set its size to FULL SCREEN.
answer count: 3
has answer: http://stackoverflow.com/a/21799468
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32985514
has comment: http://stackoverflow.com/comment/32985449
has comment: http://stackoverflow.com/comment/32985152
has comment: http://stackoverflow.com/comment/32985833
tagged with: java
has answer: http://stackoverflow.com/a/21799306
type: Question
has comment: http://stackoverflow.com/comment/32985904
has comment: http://stackoverflow.com/comment/32985500
has comment: http://stackoverflow.com/comment/32985879
has answer: http://stackoverflow.com/a/21798584
has comment: http://stackoverflow.com/comment/32984233
has title: Java swing GUI creation

http://stackoverflow.com/a/21790639
score: 6
has comment: http://stackoverflow.com/comment/32971167
has comment: http://stackoverflow.com/comment/32970738
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21790541
type: Answer
upvote count: 6
has body: But in this clase how I can add GameField to JPanel? Can I solve this problem by compisition? You do this by adding a simple getter like this: public class GameField{ private JButton button; public GameField(String text) { button = new JButton(text); // do your stuff here } public JButton getButton() { return button; } } Then in your GUI: public void createAndShowGUI() { JPanel panel = new JPanel(new GridLayout(5,5)); panel.add(new GameField("Button # 1").getButton()); panel.add(new GameField("Button # 2").getButton()); ... JFrame frame = new JFrame("Game"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().add(panel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } Edit You've stated in a comment: Thanks, but in this case if I'd like to access this field (i.e. panel.getComponent(i)), I can get only a JButton, and not a GameField. You can keep a list with your GameField objects or you can use putClientProperty() method to keep a reference to the GameField object as shown in the example below: import java.awt.GridLayout; 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.SwingUtilities; public class Demo { private void createAndShowGUI() { ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JButton button = (JButton)e.getSource(); GameField gameField = (GameField)button.getClientProperty("GameField"); if(gameField != null) { System.out.println(gameField.getText()); } } }; GameField gameField1 = new GameField("Button # 1"); gameField1.getButton().addActionListener(actionListener); GameField gameField2 = new GameField("Button # 2"); gameField2.getButton().addActionListener(actionListener); JPanel content = new JPanel(new GridLayout()); content.add(gameField1.getButton()); content.add(gameField2.getButton()); JFrame frame = new JFrame("…
accepted answer of: http://stackoverflow.com/q/21790541

http://stackoverflow.com/a/21755417
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21755335
has body: The error is in this statement: for (Integer x : list) { System.out.println(list.get(x)); } You're trying to access the element in the list with index x, which will throw ArrayIndexOutOfBoundsException if x = 1000 and it's the only element in the list (for example). You probably meant: for (Integer x : list) { System.out.println(x); }
type: Answer
downvote count: 0

http://stackoverflow.com/q/21779083
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/32954371
tagged with: spring-mvc
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32949295
has comment: http://stackoverflow.com/comment/32949654
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32949324
has body: OptionsTag E org.springframework.web.servlet.tags.RequestContextAwareTag doStartTag Bean object must not be null java.lang.IllegalArgumentException: Bean object must not be null at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:213) at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:202) at org.springframework.beans.BeanWrapperImpl.&lt;init&gt;(BeanWrapperImpl.java:152) at org.springframework.beans.PropertyAccessorFactory.forBeanPropertyAccess(PropertyAccessorFactory.java:37) at org.springframework.web.servlet.tags.form.OptionWriter.doRenderFromCollection(OptionWriter.java:199) at org.springframework.web.servlet.tags.form.OptionWriter.renderFromCollection(OptionWriter.java:180) at org.springframework.web.servlet.tags.form.OptionWriter.writeOptions(OptionWriter.java:133) at org.springframework.web.servlet.tags.form.OptionsTag.writeTagContent(OptionsTag.java:168) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79) at com.ibm._jsp._searchNAV._jspx_meth_form_options_0(_searchNAV.java:262) at com.ibm._jsp._searchNAV._jspx_meth_form_select_0(_searchNAV.java:304) at com.ibm._jsp._searchNAV._jspx_meth_form_form_0(_searchNAV.java:442) I am getting above error message, which I have not seen before . please help me in this regard.
favorite count: 0
has answer: http://stackoverflow.com/a/31404507
has comment: http://stackoverflow.com/comment/32949462
has title: Bean object must not be null in Spring MVC
has comment: http://stackoverflow.com/comment/33034452

http://stackoverflow.com/comment/32959373
score: 1
has text: @John: the logic, in this case, would still be exactly the same: you would still have to get a Connection object (instead of a List) from the map, and add a station to it (instead of adding it to the List). Naming "Connection" a list of stations looks even more confusing to me. What should be in the map as value is a Station object, having a name property, and a list of connected stations. And the logic would still be identical.
comment on: http://stackoverflow.com/q/21784527
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21738363
tagged with: methods
has comment: http://stackoverflow.com/comment/32877488
type: Question
has answer: http://stackoverflow.com/a/21738669
score: 5
downvote count: 0
has title: Why doesn't java have .field and .method reflection keywords like .class?
answer count: 3
tagged with: field
favorite count: 0
has comment: http://stackoverflow.com/comment/32878794
type: UnansweredQuestion
has body: Let's say we have this class: public abstract class A { int x; public int foo(); public int foo(int x); } As we all know, A.class has a distinct advantage over Class.forName("A"): it will still work if the name of A is changed by refactoring or obfuscation. However, there is no way to get this advantage with fields and methods. Have you ever wished that you could do this: (see a better proposed syntax in the edit below!) Field xField = A.x.field; Method fooMethod = A.foo().method; Method fooIntMethod = A.foo(int).method; Instead of this? Field xField = A.getField("x"); Method fooMethod = A.getMethod("foo"); Method fooIntMethod = A.getMethod("foo", int.class); So here's my question: does anyone know if this feature has been planned or discussed or if Sun/Oracle specifically decided against it for some reason? EDIT: How about this syntax? It avoids problems people have mentioned: Field xField = A..x; Method fooMethod = A..foo(); Method fooIntMethod = A..foo(int); Example use case I recently created an AbstractTableModel class called EasyTableModel that allows you to define your own POJO row type. Its getValueAt(...) and setValueAt(...) etc. use reflection to get/set the values of the fields in the POJO. public class EasyTableModel&lt;T&gt; extends AbstractTableModel { private RowFormat&lt;T&gt; prototypeFormat; private final ArrayList&lt;T&gt; rows = new ArrayList&lt;T&gt;(); ... public static interface RowFormat&lt;T&gt; { Object getValueAt(T row, int columnIndex); void setValueAt(T row, Object value, int columnIndex); ... } ... public static class ReflectionRowFormat&lt;T&gt; implements RowFormat&lt;T&gt; { private Field[] fields; ... public Object getValueAt(T row, int column) { try { return fields[column].get(row); } catch (Exception e) { throw new RuntimeException(e); } } public void setValueAt(T row, Object value, Field field) { if (!field.getDeclaringClass().isInstance(this)) { throw new IllegalArgumentException("field is not a member of this class"); } setValu…
has comment: http://stackoverflow.com/comment/32877972
has answer: http://stackoverflow.com/a/21738604
tagged with: keyword
has comment: http://stackoverflow.com/comment/32877973
has answer: http://stackoverflow.com/a/21738456
tagged with: reflection
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/32877429

http://stackoverflow.com/comment/32794858
comment on: http://stackoverflow.com/a/21690600
score: 0
type: Comment
has text: The erasures of the methods counts for overloading. We know it's not overriding, but the erasure of both methods is `List`, so it's not overloading either. You have found the no-man's land between overriding and overloading. Example 4 is neither overloading nor overriding, because you have found signatures that are different enough for it not to be overriding, yet too similar to be overloading.
type: AnswerComment

http://stackoverflow.com/q/21824684
tagged with: awt
favorite count: 0
tagged with: drag-and-drop
has title: Can I listen for all drag & drop events in java?
has comment: http://stackoverflow.com/comment/33032557
has answer: http://stackoverflow.com/a/21827146
has comment: http://stackoverflow.com/comment/33032213
has comment: http://stackoverflow.com/comment/33031476
tagged with: swing
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33031966
accepted answer: http://stackoverflow.com/a/21827146
upvote count: 5
tagged with: java
has body: I would like to listen for all the drag and drop events on Swing. One way I managed to listen for drag events was by adding: final long mask = AWTEvent.MOUSE_EVENT_MASK + AWTEvent.MOUSE_MOTION_EVENT_MASK; AWTEventListener eventListener = new AWTEventListener() { public void eventDispatched(final AWTEvent event) {} }; Toolkit.getDefaultToolkit().addAWTEventListener(eventListener, mask); but this does not get drop events, not even release events from the mouse when dropping. Is there a way to intercept all drag and drop events in the application, not on each component separately?
has comment: http://stackoverflow.com/comment/33032131
score: 5
downvote count: 0
answer count: 1

http://stackoverflow.com/q/21833854
duplicate of: http://stackoverflow.com/q/2843366
has comment: http://stackoverflow.com/comment/33046980
has body: First, let me show you the code I have so far: public void populateArray(){ //NOTE: THIS METHOD SHOULD BE RUN FIRST. Many of the methods in this class rely on a populated file array to function. // This method will populate our file array. // First, we note the directory we want to pull files from. File folder = new File("HR"); File dir = new File(""); File file = new File(""); //Then we fill an array with the list of documents in that directory //This will also include folders. int count = 0; allDocs = folder.listFiles(); int fileCount = 0; int dirCount = 0; System.out.println("Displaying contents of directory..."); while (count &lt; allDocs.length){ System.out.println("Found: " + allDocs[count]); count++; } System.out.println("Sorting directories and files separately..."); count = 0; while (count &lt; allDocs.length){ if (allDocs[count].isDirectory()){ dir = new File(allDocs[count].getPath()); dirs[dirCount] = dir; System.out.println("Document " + allDocs[count].getPath() + " sorted into -Directory- array at position " + dirCount); dirCount++; } else{ file = new File(allDocs[count].getPath()); files[fileCount] = file; System.out.println("Document " + allDocs[count].getPath() + " sorted into -File- array at position " + fileCount); fileCount++; } count++; } return; } files, dirs, and allDocs are arrays declared within the class outside of any methods. allDocs is the array I use to get every directory and file in the directory of interest, HR. I do this with allDocs = folder.listFiles(); I want files to be the array to store all of the files in the directory HR, and I want dirs to be the array to store all of the directories in HR, but I don't want to store any of the contents of the directors in HR. I try to do this with the loop under the println "Sorting directories and files separately." The problem is here: else{ file = new File(allDocs[count].getPath()); files[fileCount] = file; System.out.println("Document " + allDocs[count].getPath() + " sorted into -File- a…
possible better answer: http://stackoverflow.com/a/21834007
type: AnsweredQuestion
score: 7
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/33047027
downvote count: 1
has answer: http://stackoverflow.com/a/21834228
type: Question
accepted answer: http://stackoverflow.com/a/21834228
linked to: http://stackoverflow.com/q/2843366
tagged with: arrays
has comment: http://stackoverflow.com/comment/33046928
has answer: http://stackoverflow.com/a/21834007
has comment: http://stackoverflow.com/comment/33047015
has title: Add a File object to an array of File objects
answer count: 2
has comment: http://stackoverflow.com/comment/33047056
has comment: http://stackoverflow.com/comment/33046898
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/33046998
has comment: http://stackoverflow.com/comment/33046829

http://stackoverflow.com/q/21679998
has comment: http://stackoverflow.com/comment/32773393
has comment: http://stackoverflow.com/comment/32774285
possible better answer: http://stackoverflow.com/a/21684077
has comment: http://stackoverflow.com/comment/32778235
has comment: http://stackoverflow.com/comment/32775610
has answer: http://stackoverflow.com/a/21684077
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32773789
tagged with: bytecode
has comment: http://stackoverflow.com/comment/32774221
downvote count: 0
has comment: http://stackoverflow.com/comment/32777719
has comment: http://stackoverflow.com/comment/32786149
has answer: http://stackoverflow.com/a/21680444
favorite count: 0
has title: Does it matter for runtime performance if a method is called by its explicit type?
has body: I am currently writing an application that creates Java byte code and also writes method calls. Until now, the module writing this byte code does not have information on the actual type of the instance a method call is invoked on but it does know the type for which a particular method was defined for. For example: class Foo { public void foo() { } } class Bar extends Foo { public void bar() { } } the current version of the engine would execute INVOKEVIRTUAL Foo.foo even on objects of type Bar because it knows that foo was defined in Foo. This is legal in the JVM (of course) but the Java compiler would translate it to INVOKEVIRTUAL Bar.foo when it was "normal" Java source code. I am currently wondering if the JVM actually uses the information of the explicit subtype or if this is ignored / optimized when the class is loaded. I was wondering since the verifier is figuring out the actual type anyways and will not let me write illegal method calls and I wonder why the runtime would not make use of this information when it already is available. I am in particularly wondering if it has a performance impact when super types are interfaces (INVOKEINTERFACE) where the virtual method table cannot be used if the JVM would not figure out the actual type. I can of course extend my module but I would need to provide additional information to it which would bloat my code and which I do not want to do if it did not have an effect. So I ask: Does the type effect performance or does the JVM take care of this explicit resolution?
tagged with: jvm
upvote count: 13
has comment: http://stackoverflow.com/comment/32785727
has comment: http://stackoverflow.com/comment/32784716
accepted answer: http://stackoverflow.com/a/21680444
has comment: http://stackoverflow.com/comment/32775392
score: 13
has comment: http://stackoverflow.com/comment/32781063
has comment: http://stackoverflow.com/comment/32788666
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32773285
has comment: http://stackoverflow.com/comment/32804777
has comment: http://stackoverflow.com/comment/32777937
tagged with: java

http://stackoverflow.com/comment/32815267
comment on: http://stackoverflow.com/a/21703799
type: AnswerComment
type: Comment
has text: I'm seriously debating whether to -1 this based on doing the OP's homework for them. =)
score: 1

http://stackoverflow.com/comment/32971119
type: Comment
comment on: http://stackoverflow.com/a/21790764
has text: Yes that is correct. You've cleaned and rebuilt? You have the correct imports? Seems like you're on the right path.
type: AnswerComment
score: 0

imessagefilter
type: Tag
tag name: imessagefilter
tags question: http://stackoverflow.com/q/21762743

http://stackoverflow.com/comment/33018747
score: 0
type: Comment
type: QuestionComment
has text: Do have some kind dealy within your main loop which is controlling the frame rate?
comment on: http://stackoverflow.com/q/21817745

http://stackoverflow.com/a/29494551
has body: If you're still stuck with this I set up an example project that uses Espresso and Robotium test independently! https://github.com/hitherejoe/Android-Boilerplate
answers question: http://stackoverflow.com/q/21713660
score: 0
type: Answer

http://stackoverflow.com/q/21720706
has comment: http://stackoverflow.com/comment/32846385
tagged with: java
has title: "Unfortunately app has stopped" error?
upvote count: 1
has comment: http://stackoverflow.com/comment/32846113
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21720775
has comment: http://stackoverflow.com/comment/32845788
has comment: http://stackoverflow.com/comment/32847020
has answer: http://stackoverflow.com/a/21720776
score: 0
possible better answer: http://stackoverflow.com/a/21720737
has answer: http://stackoverflow.com/a/21720737
has comment: http://stackoverflow.com/comment/32846231
has answer: http://stackoverflow.com/a/21720746
favorite count: 0
has body: I'm trying to write a basic drawing Android app for android and test it on Genymotion, but I can't click on the app icon (it says "Unfortunately [app] has stopped.") I'm not sure if the three private variables should be under the MainActivity class? Or that it has to do with my AndroidManifest.xml file. Can someone look over my code? My MainActivity.java file: package edu.berkeley.cs160.opalkale.prog2; import android.os.Bundle; import android.app.Activity; import android.graphics.Paint; import android.view.Menu; import android.view.View; import android.widget.ImageButton; import android.widget.LinearLayout; public class MainActivity extends Activity { private Paint myPaint; private ImageButton currPaint; private myView drawView; public void paintClicked(View view) { if (view != currPaint) { // update color ImageButton imgView = (ImageButton) view; String color = view.getTag().toString(); drawView.setColor(color); imgView.setImageDrawable(getResources().getDrawable(R.drawable.paint_pressed)); currPaint.setImageDrawable(getResources().getDrawable(R.drawable.paint)); currPaint = (ImageButton)view; } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); myView mV = new myView(this, null); setContentView(mV); drawView = (myView) findViewById(R.id.drawing); LinearLayout paintLayout = (LinearLayout) findViewById(R.id.paint_colors); currPaint = (ImageButton) paintLayout.getChildAt(0); currPaint.setImageDrawable(getResources().getDrawable( R.drawable.paint_pressed)); } @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 AndroidManifest.xml file: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="13" android:targetSdkVersion="18" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Logcat: [2014-02-11 23…
has answer: http://stackoverflow.com/a/21720845
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/21720775
tagged with: android-manifest
type: AnsweredQuestion

http://stackoverflow.com/a/21805283
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21805181
has body: 0 - To covert String ==> Binary try this : (String=> Hexa decimal ==> Decimal ==>Binary number ) 1 - Converting String to Hexa decimal in java: public String toHex(String arg) { return String.format("%x", new BigInteger(1, arg.getBytes(/*YOUR_CHARSET?*/))); } 2 - Converting Hexa decimal number to Decimal in Java int decimal = Integer.parseInt(hexadecimal, 16); 3 - Converting Decimal number to binary in Java String binary = Integer.toBinaryString(decimal); PS : Hexadecimal can have following: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E and F.

http://stackoverflow.com/a/28506655
has body: As an alternative, you could use the aui tag lib. Note that the generated id will be the portlet name space followed by the name of the element. &lt;%@ taglib uri="http://alloy.liferay.com/tld/aui" prefix="aui" %&gt; &lt;portlet:actionURL var="saveChartURL" name="saveChart" /&gt; &lt;aui:form action='${saveChartURL}' method='post' name='form'&gt; &lt;aui:button type='button' name='save' value="Save" /&gt; &lt;aui:input id='json' type='textarea' name='jsonData' label='' spellcheck='false' cssClass='json' style='disply:none;' /&gt; &lt;/aui:form&gt; &lt;script&gt; (function(run){run(window.jQuery)}( function($){ $(document).ready(function(){ var pNS = '&lt;portlet:namespace/&gt;'; $('#'+pNS+'save').click(function(){ var dataserialized = $('#'+pNS+'form').serialize(); $.post( "${saveChartURL}", dataserialized ); }); }); }) ); &lt;/script&gt; And in the Controller.... @ActionMapping(value="saveChart") public void saveChart( @RequestParam(defaultValue="{}") String jsonData, @RequestParam(defaultValue="doughnut2d") String chartType, PortletPreferences pp) { /* TODO do Action */ }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21832537
downvote count: 0

http://stackoverflow.com/a/21841725
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21841421
has body: Sweet I fixed it! In case you want to know the answer, this is how you fix it. AdRegistration.setAppKey("APPKEY"); AdRegistration.enableTesting(test); adView = new AdLayout(UnityPlayer.currentActivity); LinearLayout layout = new LinearLayout(UnityPlayer.currentActivity.getApplicationContext()); layout.setGravity(Gravity.BOTTOM); UnityPlayer.currentActivity.addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); layout.addView(adView, new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL));
downvote count: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21841421
score: 1

http://stackoverflow.com/q/21686984
has comment: http://stackoverflow.com/comment/32785996
has comment: http://stackoverflow.com/comment/32786125
linked to: http://stackoverflow.com/q/4231382
linked to: http://stackoverflow.com/q/1732348
has title: Java regex hot to match meta tags content attribute value
tagged with: regex
has comment: http://stackoverflow.com/comment/32785738
has comment: http://stackoverflow.com/comment/32785755
has body: I have a regex and want it to match html meta tags content attribute and get its content. For example: &lt;meta name="description" content="Some website description."&gt; In this case to get Some website description. and nothing more. In my case I am using this pattern: private static Pattern siteMetaTagDescriptionAttributePattern = Pattern.compile("name=\"description\"(\\s*)content=\"(.*)\""); Matcher matcher = siteMetaTagDescriptionAttributePattern.matcher(siteContentLine); String siteDescription = ""; while(matcher.find()) { siteDescription = matcher.group(2); } And getting Till the end of the line, in this case this: Some website description."&gt; What should I do to get only inner content of the content attribute, in this case Some website description. Thanks a lot.
has comment: http://stackoverflow.com/comment/37193767
score: 0
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21687185
answer count: 2
has answer: http://stackoverflow.com/a/21687193

http://stackoverflow.com/comment/32855559
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21725681
type: Comment
has text: I think it's clear that the OP is confused about his/her concerns and what is important. Guilty of premature optimization, in my view. Build something, measure, test scalability, and decide if it's acceptable.

http://stackoverflow.com/comment/32916782
score: 0
type: Comment
type: QuestionComment
has text: I have parsed the file correctly. I am looking into a more elegant way of creating my entity objects. Anything inside Entity will be an object its self and added to either a list of objects or an object within entity. I believe I can get by with a switch statement and looping through the whole entire document. But I feel that is a terrible implementation.
comment on: http://stackoverflow.com/q/21760609

http://stackoverflow.com/comment/32823429
score: 0
type: Comment
has text: What happens when you call [`Environment.getExternalStorageState()`](http://developer.android.com/reference/android/os/Environment.html#getExternalStorageState())?
comment on: http://stackoverflow.com/a/21708040
type: AnswerComment

http://stackoverflow.com/q/21708350
tagged with: session
tagged with: java
type: UnansweredQuestion
tagged with: grails
tagged with: intellij-idea
answer count: 0
type: Question
has body: The session variable isn't loading in Intellij IDEA. In controllers, the variable seems null value. If I create a watch in Debug Mode, Intellij returns session = Cannot find local variable 'session' I'm using Intellij IDEA 11.1.5 but it seems this problem was solved in IDEA 10. I found an issue http://youtrack.jetbrains.com/issue/IDEA-63227 In comments, a person advise to create a watch with this workaround: getProperty("session") But the error persists. My Grails version is 2.1.1 and JSDK version is 1.7u40 What I do?
has comment: http://stackoverflow.com/comment/32823888
score: 0
has title: Intellij IDEA isn't loading 'session' variable on debug mode in Grails Project
has comment: http://stackoverflow.com/comment/32823708

http://stackoverflow.com/comment/32936511
type: Comment
has text: I commented out just the if statement and the bracket closing it. Everything still compiles, it's just that more items get added to the childGenes hashmap than intended.
score: 1
comment on: http://stackoverflow.com/q/21771298
type: QuestionComment

http://stackoverflow.com/comment/33027760
score: 0
comment on: http://stackoverflow.com/q/21822526
has text: No I cant use textviews, because I have to set that drawable as tab background. See updated ques.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/28570906
has body: In case you need to access the context from within a HttpServlet which itself is not instantiated by Spring (and therefore neither @Autowire nor ApplicationContextAware will work)... WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); or SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); As for some of the other replies, think twice before you do this: new ClassPathXmlApplicationContext("..."); // are you sure? ...as this does not give you the current context, rather it creates another instance of it for you. Which means 1) significant chunk of memory and 2) beans are not shared among these two application contexts.
has comment: http://stackoverflow.com/comment/112392909
has comment: http://stackoverflow.com/comment/95657144
has comment: http://stackoverflow.com/comment/60513985
has comment: http://stackoverflow.com/comment/83088220
downvote count: 0
answers question: http://stackoverflow.com/q/21827548
has comment: http://stackoverflow.com/comment/105549215
score: 54
type: Answer
upvote count: 54
has comment: http://stackoverflow.com/comment/118878441

http://stackoverflow.com/q/21756203
has comment: http://stackoverflow.com/comment/32913853
tagged with: android
has comment: http://stackoverflow.com/comment/32908485
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/21756694
tagged with: java
has title: Error in android code
type: Question
has comment: http://stackoverflow.com/comment/32908500
has answer: http://stackoverflow.com/a/21756694
downvote count: 6
has comment: http://stackoverflow.com/comment/32908553
has comment: http://stackoverflow.com/comment/32908709
answer count: 1
has body: i'm in need of some help here.....i'm planning to create a flames app in android ...i got messed up with the coding. can any one help me.I'm trying to print the number of letters which are not in common. This is the coding.i need to find some way to find the number of common chars. `package com.rajzflames; //import com.kct.health_maintainer.Chk; import android.os.Bundle; import android.app.Activity; import android.text.Editable; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { int i = 0; int j = 0, k; String p; Editable st1; Editable st2; // final int i=0; // final int j=0; // String,p; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity1); final TextView t = (TextView) findViewById(R.id.tv1); Button bt1 = (Button) findViewById(R.id.bt1); final EditText e1 = (EditText) findViewById(R.id.et1); EditText e2 = (EditText) findViewById(R.id.et2); st1 = e1.getText(); st2 = e2.getText(); bt1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { while (i &lt; st1.length()) { while (j &lt; st2.length()) { if (st1.charAt(i) == st2.charAt(j)) { st1.delete(i, i); st2.delete(j, j); i++; // j++; } j++; } i++; } k = st1.length() + st2.length(); p = Integer.toString(k); Toast.makeText(MainActivity.this, p, Toast.LENGTH_LONG).show(); } }); } }
score: -6
favorite count: 0

http://stackoverflow.com/comment/32934726
type: AnswerComment
score: 0
has text: I saw some examples (e.g. in Android NDK which weren't using a header file). I have added the error message in my original post. Thanks.
type: Comment
comment on: http://stackoverflow.com/a/21769801

http://stackoverflow.com/a/21705605
score: 1
has comment: http://stackoverflow.com/comment/32818827
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/54567697
answers question: http://stackoverflow.com/q/21705493
upvote count: 1
has body: Try removing the qoutes from around cls on the second option, you are still just passing the string. Without the quotes you are using the String[] you defined. String[] cls = new String[] {"cmd.exe", "/c", "cls"}; Runtime.getRuntime().exec(cls);

http://stackoverflow.com/a/21697345
has body: Maybe if it's static and it will be always be 3 items you can set a LinearLayout in the xml with orientation horizontal.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21696900

http://stackoverflow.com/comment/32905155
comment on: http://stackoverflow.com/q/21754274
score: 0
type: Comment
has text: you don't need to create one. it will be automatically created. perhaps you've created with `root` or another user which leads tomcat to not open it.
type: QuestionComment

http://stackoverflow.com/comment/33035423
score: 0
type: Comment
type: QuestionComment
has text: When I say 'polling the 12 ports continuously', I mean that information on the 12 ports is broadcasted simultaneously, and that once read, I go for another round of wait and read. The read timeout is around 5 seconds on each port. Indeed, I'm not doing the whole creation and binding each time.
comment on: http://stackoverflow.com/q/21826013

http://stackoverflow.com/comment/32966544
comment on: http://stackoverflow.com/q/21788321
score: 0
type: QuestionComment
type: Comment
has text: EDIT (fixed old comment): For better help sooner, please post a [Minimal, Complete, Tested and Readable example](http://stackoverflow.com/help/mcve) that demonstrates the problem. Many times, just creating the example will reveal the problem.

http://stackoverflow.com/comment/32801928
comment on: http://stackoverflow.com/a/21690962
has text: Don't worry about who's marked correct and whatnot, the important part is that your problem got solved. Glad we could help. ;)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21834772
has title: Log4j is working but hibernate logs is not create in to the hibernate.log file
has body: My log4j is working but the hibernate log is not crating in to my hibernate.log file I am using jobss 7.1.1 final so 1)I have crated module in jobss 7.1.1 final so my module.xml is as follw <?xml version="1.0" encoding="UTF-8"?> <resource-root path="log4j-1.2.16.jar"/> 2) jboss-deployment-structure.xml is as follw <?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure> <ear-subdeployments-isolated>false</ear-subdeployments-isolated> </jboss-deployment-structure> 3) my log4j.xml (/WEB_INF/log4j.xml) is as follow <?xml version="1.0" encoding="UTF-8" ?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE" /> <level value="TRACE"/> <appender-ref ref="hibernateAppender"/> <level value="TRACE"/> <appender-ref ref="hibernateAppender"/> <level value="debug"/> <appender-ref ref="springAppender" /> <appender-ref ref="allAppender" /> </log4j:configuration> 4) I added the logging listener in web.xml org.springframework.web.util.Log4jConfigListener log4jConfigLocation /WEB-INF/log4j.xml 5) I have putted following jar files in class path. i) log4j-1.2.16.jar ii) slf4j-api-1.6.4.jar iii) slf4j-log4j12-1.5.10.jar Please suggest me what is the additional configuration for the hibernate logging I have to do. All log file is creating, all logs is creating except hibernate log in hibernate.log file.
type: UnansweredQuestion
tagged with: log4j
type: Question
tagged with: logging
score: 0
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26021910
answer count: 1

http://stackoverflow.com/a/21720563
answers question: http://stackoverflow.com/q/21720013
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/32846018
score: 6
has body: Before anything, as a side note, setVisible should be the last thing you do after adding all components Also check the below Works fine for me using getClass().getResource() String path = "/images/stackoverflow2.png"; ImageIcon pawnW = new ImageIcon(getClass().getResource(path)); Check all below, then when correct it, build it, then run it. File Structure after Build. Images should get copied to class path import java.awt.Color; import java.awt.GridLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class GUI { JFrame frame; JPanel squares[][]; public GUI() { frame = new JFrame("Chess"); squares = new JPanel[8][8]; frame.setSize(500, 500); frame.setLayout(new GridLayout(8, 8)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); for (int i = 0; i &lt; 8; i++) { for (int j = 0; j &lt; 8; j++) { squares[i][j] = new JPanel(); if ((i + j) % 2 == 0) { squares[i][j].setBackground(Color.white); } else { squares[i][j].setBackground(Color.orange); } frame.add(squares[i][j]); } } String path = "/images/stackoverflow2.png"; ImageIcon pawnW = new ImageIcon(getClass().getResource(path)); ImageIcon knightW = new ImageIcon(getClass().getResource(path)); ImageIcon bishopW = new ImageIcon(getClass().getResource(path)); ImageIcon rookW = new ImageIcon(getClass().getResource(path)); ImageIcon queenW = new ImageIcon(getClass().getResource(path)); ImageIcon kingW = new ImageIcon(getClass().getResource(path)); ImageIcon pawnB = new ImageIcon(getClass().getResource(path)); ImageIcon knightB = new ImageIcon(getClass().getResource(path)); ImageIcon bishopB = new ImageIcon(getClass().getResource(path)); ImageIcon rookB = new ImageIcon(getClass().getResource(path)); ImageIcon queenB = new ImageIcon(getClass().getResource(path)); ImageIcon kingB = new ImageIcon(getClass().getResource(path)); squares[0][0].add(new JLabel(rookW)); squares[1][0].add(new JLabel(knightW)); squares[2][0].ad…
has comment: http://stackoverflow.com/comment/32845841
accepted answer of: http://stackoverflow.com/q/21720013

http://stackoverflow.com/q/21764700
has title: Class.forName("org.sqlite.JDBC") throws ClassNotFoundException in Android project, but not in normal Java project
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32924784
type: Question
has comment: http://stackoverflow.com/comment/32924260
linked to: http://stackoverflow.com/q/7221620
has comment: http://stackoverflow.com/comment/32924248
has body: I want to read data from an external .db file in my android app. So I have a .db file and added it to my project folder. Now I want to access to this file by JDBC, so I added a JDBC.jar file and connected to my DB with Class.forName("org.sqlite.JDBC"); Connection conn = DriverManager.getConnection("jdbc:sqlite:myDatabase.db"); and it works fine in a normal java project. But when I want to do it in an activity in my android project, I always get a ClassNotFoundException. I checked the class's existence in my android project. It's: 'myProject/Referenced Liberaries/sqlitejdbc-v056.jar/org.sqlite/JDBC.class', so the right path I think. What's the reason for that exception?
tagged with: classnotfoundexception
tagged with: sqlite
tagged with: jdbc
has comment: http://stackoverflow.com/comment/32925022
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/21809860
answer count: 2
tagged with: playframework
has comment: http://stackoverflow.com/comment/33004926
downvote count: 0
has title: Problems installing Play framework on OSX
has comment: http://stackoverflow.com/comment/33014600
favorite count: 0
has comment: http://stackoverflow.com/comment/33006589
linked to: http://stackoverflow.com/q/21798391
has answer: http://stackoverflow.com/a/21815380
tagged with: macos
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21810933
score: 2
has comment: http://stackoverflow.com/comment/33006723
has body: I am trying to install the Play! framework onto my OSX Mavericks laptop. Everything installs and works fine using the default install paths until I try to convert a new application to an eclipse project. I can convert Scala projects just fine. But when I try to convert a Java application to an eclipse project I get the following error from the Play! console: [TestAppOne] $ eclipse [info] About to create Eclipse project files for your project(s). [info] Compiling 2 Scala sources and 1 Java source to /Users/mcd/play/TestAppOne/target/scala-2.10/classes... [error] could not find scala-library.jar [error] Use 'last' for the full log. I can see the scala-library.jar (2.10.3) and I even added it to /etc/paths; no luck. I am using Java 1.7 and Kepler eclipse and Play 2.2.2-RC3. Any suggestions to help convert the Play! project to eclipse?
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/a/21717751
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32841478
has body: I'm guessing you're using a filename with spaces inside of it. scan.next() takes the next "token" which is delimited by spaces. If your file name is for example: C:\User\John Smith\Documents\file.ext, then the fileName variable would only contain C:\User\John. Instead, use scan.nextLine() to grab everything up to the Enter key. Unless you post your full stacktrace with it (every line of error output from the exception), we can't really see exactly what the issue is, so I'm going to make another guess at what the issue might be. You may be using a filename without a full path and the program doesn't know where to find it. If you're using an IDE, the file should be in the same directory are your "src" and "classes" folders. If you're using the command-line, make sure that the file is in your "classpath". This is where the JVM looks for filenames that don't have full paths. This is often the same location as the .class or .jar file you're executing. I can't think of anything else that could be wrong with your code, if nothing I mentioned fixes your issue, edit your main post to include the full stacktrace. Edit: From the comment thread on this answer, we concluded that the issue the user was having was that they were excluding the file extension from the filename. CompuDataSales should have been CompuDataSales.txt. Other users having a similar issue should check to make sure that extensions are present in filenames.
has comment: http://stackoverflow.com/comment/32841359
type: Answer
has comment: http://stackoverflow.com/comment/32841343
has comment: http://stackoverflow.com/comment/32841273
downvote count: 0
answers question: http://stackoverflow.com/q/21717568
score: 1
has comment: http://stackoverflow.com/comment/32841156
has comment: http://stackoverflow.com/comment/32841264
has comment: http://stackoverflow.com/comment/32841334
accepted answer of: http://stackoverflow.com/q/21717568
has comment: http://stackoverflow.com/comment/32841194
has comment: http://stackoverflow.com/comment/32841425
has comment: http://stackoverflow.com/comment/32841351
has comment: http://stackoverflow.com/comment/32841229
upvote count: 1
has comment: http://stackoverflow.com/comment/32841171

http://stackoverflow.com/comment/32840236
has text: yea, its supposed to be send to a file called names.txt
comment on: http://stackoverflow.com/q/21717030
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21702368
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21702509
type: Question
answer count: 2
has body: I have a custom interceptor. I would like this interceptor to run on all action invocations except a few. I would like to program this (for extendibility/clarity) rather than using if/else statements checking the action's name inside the interceptor's intercept() method itself. I think it might be done with the "exclude method" capacities of Struts2, but I'm stuck with the exact details. I think my interceptor needs to extend the MethodFilterInterceptor, but it has 2 intercept methods and the API is not very helpful in saying what each should do: protected abstract String doIntercept(ActionInvocation invocation) Subclasses must override to implement the interceptor logic. String intercept(ActionInvocation invocation) Override to handle interception
has answer: http://stackoverflow.com/a/21702516
accepted answer: http://stackoverflow.com/a/21702516
has title: Struts2 letting an interceptor not run for certain classes
tagged with: struts2
score: 0
possible better answer: http://stackoverflow.com/a/21702509

http://stackoverflow.com/comment/33008873
score: 0
type: Comment
type: QuestionComment
has text: "The algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations." I would guess this is why. Other than that, you would have to ask the people who included it in the library.
comment on: http://stackoverflow.com/q/21812128

http://stackoverflow.com/q/21691977
type: UnansweredQuestion
has title: 2 way ssl tomcat stateless service scale
tagged with: java
has body: I have a stateless service in java, deployed in a tomcat web server and I also have configured the 2 way ssl autentication. Up to this point everything works fine. When a I have a new client, I only have to put a new client certificate into my trustore and restart my service and the new client can use my service. But I need to horizontal scaling, as my service is stateless, no problem with that, but if I have 10 servers I don't want to go to each one and make this change in each trustore file. Any ideas?
type: Question
linked to: http://stackoverflow.com/q/7635380
tagged with: ssl
has answer: http://stackoverflow.com/a/21694371
score: 0
tagged with: horizontal-scaling
answer count: 1
tagged with: tomcat

http://stackoverflow.com/q/21821751
type: Question
tagged with: enums
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/21821863
has body: I have an interface ParentInterface and have multiple enums that implement it: ChildEnum1 and ChildEnum2. I have a method to which I pass the ParentInterface as a parameter. Based on what ChildEnum is passed to this method, I want to get the size of the enum. How can I do this? The values.length() method works only on enums, but we are only passing in the ParentInterface to the caller. How can we achieve this?
answer count: 1
has title: Get enum size from parent interface in java
has comment: http://stackoverflow.com/comment/33025875
has comment: http://stackoverflow.com/comment/33025789
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21821863
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/33025965

http://stackoverflow.com/a/21722196
score: 0
answers question: http://stackoverflow.com/q/21717824
type: Answer
has body: To set the property for tests/main method running from IDE add -Denvironment=env to Run -&gt; Edit configurations -&gt; (select your configuration in left menu) -&gt; VM Options You can save this to defaults (last item in the left menu) for all new configurations - very useful when running new tests.

http://stackoverflow.com/q/21680971
answer count: 1
tagged with: fonts
has body: i created a chat in java with jtext area. when some one write a new message, the message appear in the chat in that form: time username: message (example: 17:00 TheMan: Whats up) My question is how can i change the font and add bold only in specific places in the text area ( the time and username) while leaving the rest as it was. hope someone will be able to help.... tnx
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/14400946
tagged with: chat
tagged with: jtextarea
has title: creating a chat in java with JTextArea
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32775044
has answer: http://stackoverflow.com/a/21681162
type: Question

http://stackoverflow.com/q/21680957
has body: Currently I have my project uploaded onto my svn. I also have other users that access this svn and download the project. The problem I have currently is that I have to provide an absolute path to my WebEngine.load(); The html that I load is in my eclipse project under a certain package. I am trying to find a solution where I don't have to provide an absolute path but a relative path to the html file. My call to load the html via relative path: engine.load("file:///com.interpro.emmeclipse/src/com/interpro/emmeclipse/html/PageCreator.html"); relative path: /com.interpro.emmeclipse/src/com/interpro/emmeclipse/html/PageCreator.html Absolute path: C:\Users\dparker.INTERPRO\Desktop\emmeclipse\src\com\interpro\emmeclipse\html\PageCreator.html
tagged with: javafx-2
type: AnsweredQuestion
tagged with: svn
tagged with: java
tagged with: javafx
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21683183
has answer: http://stackoverflow.com/a/21683183
has title: Loading local html into webengine while using svn
has answer: http://stackoverflow.com/a/21683187
score: 0
accepted answer: http://stackoverflow.com/a/21683187

http://stackoverflow.com/a/21819432
score: 5
downvote count: 0
has body: You create the JPanel, panel, but add nothing to it, and then never add the panel to your JFrame. You should add your components to the JPanel, panel, and then add the panel object to your JFrame. Note that a JPanel uses FlowLayout by default, and so it will more easily accept multiple other components without special add methods. The JFrame's contentPane uses BorderLayout which is slightly more complicated to use.
type: Answer
answers question: http://stackoverflow.com/q/21819406
upvote count: 5

http://stackoverflow.com/comment/32817743
type: Comment
has text: That I used `Connection.unwrap` did not imply that it was a static method... Every JDBC 4 compliant implementation of `Connection` should have a basic implementation of `unwrap`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21690747

http://stackoverflow.com/comment/33028064
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21820469
has text: Yes 2nd argument is also interpreted by regex engine due to potential presence of back-references and that is same regex rules apply for replacement string. (May be I should clearly add this line in my answer).

http://stackoverflow.com/comment/42281945
type: QuestionComment
has text: @Onizuka, Did you ever manage to resolve this issue?
comment on: http://stackoverflow.com/q/21738543
score: 0
type: Comment

http://stackoverflow.com/q/21697855
has body: i am trying to pass some values in to a function and compare some values and get the array list. calling the Collect function in Dbhand class. TextView result = (TextView) findViewById(R.id.textviewres); result.setText(dbhand.collect( getIntent().getExtras().getString("temple_type"), getIntent().getExtras().getString("notemples")) ); collect() Function in dbhand class. public String collect(String temptype, String limit){ SQLiteDatabase ourDatabase = this.getWritableDatabase(); String result=""; String []column =new String[]{KEY_ID,KEY_TMPNAME,KEY_TMPTYPE,KEY_LATITUDE,KEY_LONGITUDE,KEY_IMGNAME,KEY_YEARBUILD,KEY_ADDRESS,KEY_CITY,KEY_EMAIL,KEY_WEB,KEY_TEL1,KEY_TEL2,KEY_DESCRI}; Cursor c=ourDatabase.query("templ", column, null, null, null, null,null, limit); c.moveToFirst(); int iKEY_ID = c.getColumnIndex(KEY_ID); int iKEY_TMPNAME= c.getColumnIndex(KEY_TMPNAME); int iKEY_TMPTYPE= c.getColumnIndex(KEY_TMPTYPE); for (c.moveToFirst();!c.isAfterLast();c.moveToNext()){ if (c.getString(iKEY_TMPTYPE) == temptype){ result = result+c.getString(iKEY_ID)+"\t\t"+c.getString(iKEY_TMPNAME)+"\t\t"+c.getString(iKEY_TMPTYPE)+" \n"; } } return result; } i didn't get any error, since the if condition is not compared. it does not return any value. can anyone help me to fix this plz.
has comment: http://stackoverflow.com/comment/32805074
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/32805213
possible better answer: http://stackoverflow.com/a/21698213
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21698213
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32805545
has title: if condition not working, while trying to compare values in array list. Android
has answer: http://stackoverflow.com/a/21697912
has comment: http://stackoverflow.com/comment/32805018
favorite count: 0
has answer: http://stackoverflow.com/a/21697952
linked to: http://stackoverflow.com/q/513832
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/21697912
duplicate of: http://stackoverflow.com/q/513832

http://stackoverflow.com/comment/32970049
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21790137
has text: @PaulBellora: And now, so do I. (Comment deleted, but here's the link: http://ideone.com/mCBYAV) How weird. Well, IDEOne's UI is so disjointed, I probably misread it. (Still a very handy tool.) Weird that it returns an empty array, but I just read your now-deleted comment ("Splitting on `.` means splitting on any character, and by default `split` leaves off trailing empty strings, and splitting on any character gives you *only* empty strings" or something like that) on JB's answer, and that explains it nicely!

http://stackoverflow.com/a/21694959
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21694457
has body: i will explain you with following sample example code. // enter description of servlet GetCascadParamServlet // the name which display in url GetCascadParamServlet // Actual servlet name com.agileinfotech.bsviewer.servlet.GetCascadParamServlet // this is package name , where exactly your servlet locate GetCascadParamServlet // servlet name which exact declare same as your servlet name /GetCascadParamServlet // if we want to call another servlet or class we can declare it here when it will see that url redirect it to the that configuration. Hope that you will understood the whole mapping of servlet.

http://stackoverflow.com/q/21723280
has comment: http://stackoverflow.com/comment/32850394
tagged with: jface
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: hint
tagged with: java
tagged with: swt
has title: How to create a yellow hint with Java swt?
type: Question
linked to: http://stackoverflow.com/q/7807411
possible better answer: http://stackoverflow.com/a/21733332
has body: Can someone explain me something? How can I create a yellow hint/notification with Java swt? I want that popup a small notice when I move over a cell in a table. Something like this: This is my Java-Code: protected void checkAction() throws Exception { //Erstellen einer neuen Shell Shell shell = new Shell(); shell.setSize(280, 300); shell.setText("Testtabelle"); //Erstellen einer neuen Tabelle final Table table = new Table(shell, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION); table.setLinesVisible(true); table.setHeaderVisible(true); //Einlesen der Überschriften und Vergabe der Namen String[] titles = {"Element", "Stage", "Type", "Generate-User", "Change-User" }; for (int i = 0; i &lt; titles.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(titles[i]); } // Inhalte hinzufügen final int count = 4; for (int i = 0; i &lt; count; i++) { TableItem item = new TableItem(table, SWT.NONE); item.setText(0, "Test "+i); item.setText(1, ""+(i+1)); item.setText(2, "Testtype"); item.setText(3, "562910"); item.setText(4, "423424"); } // Tabelle und Shell Packen for (int i = 0; i &lt; titles.length; i++) { table.getColumn(i).pack(); } table.setSize(table.computeSize(SWT.DEFAULT, 200)); shell.pack(); //MouseListener table.addListener(SWT.MouseHover, new Listener() { public void handleEvent(Event event) { Rectangle clientArea = table.getClientArea(); Point pt = new Point(event.x, event.y); int index = table.getTopIndex(); // System.out.println("TopIndex: "+index); while (index &lt; table.getItemCount()) { boolean visible = false; TableItem item = table.getItem(index); for (int i = 0; i &lt; (table.getItemCount()+1); i++) { Rectangle rect = item.getBounds(i); if (rect.contains(pt)) { String selected = table.getItem(index).getText(i); if (selected.equals("562910")){ String real = "Jonas"; System.out.println(real); } else{ System.out.println("Ausgewählt: "+selected); } } if (!visible &amp;&amp; rect.intersects(clientArea)) { visible = true; } } if (!vis…
upvote count: 2
has comment: http://stackoverflow.com/comment/32850809
answer count: 2
linked to: http://stackoverflow.com/q/21727182
favorite count: 0
has answer: http://stackoverflow.com/a/21724318
accepted answer: http://stackoverflow.com/a/21724318
has answer: http://stackoverflow.com/a/21733332

http://stackoverflow.com/q/21775120
tagged with: java
accepted answer: http://stackoverflow.com/a/23273109
has title: Google Maps and java.lang.SecurityException
possible better answer: http://stackoverflow.com/a/21775329
type: Question
has comment: http://stackoverflow.com/comment/32942814
answer count: 2
has answer: http://stackoverflow.com/a/21775329
tagged with: google-maps
has comment: http://stackoverflow.com/comment/32943006
score: 0
has body: 02-14 13:09:38.184: E/DatabaseUtils(2348): Writing exception to parcel 02-14 13:09:38.184: E/DatabaseUtils(2348): java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL 02-14 13:09:38.184: E/DatabaseUtils(2348): at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140) 02-14 13:09:38.184: E/DatabaseUtils(2348): at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038) 02-14 13:09:38.184: E/DatabaseUtils(2348): at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607) 02-14 13:09:38.184: E/DatabaseUtils(2348): at android.content.ContentProvider$Transport.call(ContentProvider.java:279) 02-14 13:09:38.184: E/DatabaseUtils(2348): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273) 02-14 13:09:38.184: E/DatabaseUtils(2348): at android.os.Binder.execTransact(Binder.java:388) 02-14 13:09:38.184: E/DatabaseUtils(2348): at dalvik.system.NativeStart.run(Native Method) I've updated my app. But I can't use Google Maps API. When I open activity used Google Maps it shows the log above. android.permission.INTERACT_ACROSS_USERS_FULL added to permissions. &lt;permission android:name="my.app.name.permission.MAPS_RECEIVE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="android.permission.GET_TASKS" /&gt; &lt;uses-permission android:name="android.permission.VIBRATE" /&gt; &lt;uses-permission android:name="my.app.name.permission.MAPS_RECEIVE" /&gt; &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/&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_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permissi…
has comment: http://stackoverflow.com/comment/32942755
has answer: http://stackoverflow.com/a/23273109
has comment: http://stackoverflow.com/comment/32942836
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/108657641
score: 0
type: Comment
has text: xml config is legacy
comment on: http://stackoverflow.com/a/25474428
type: AnswerComment

http://stackoverflow.com/q/21815666
downvote count: 0
score: 1
has body: look at this simple code: Main.java : package CarManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class Main extends JFrame { private static final long serialVersionUID = 1L; static int width = 400; static int height = width / 16 * 9; static String title = "Car Manager"; JButton viewTables = new JButton("View tables"); JButton clients = new JButton("Clients"); JButton search = new JButton("Search"); JButton viewCars = new JButton("View all"); JButton viewRent = new JButton("Rent a car"); JButton viewBuy = new JButton("Buy a car"); JButton viewAccessory = new JButton("Accessory"); public Main() { setLayout(null); setLocationRelativeTo(null); setTitle(title); setSize(width, height); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); JLabel background = new JLabel(new ImageIcon("res\\background2.jpg")); add(background); background.setSize(width, height); add(viewTables); add(clients); add(search); viewTables.setBounds(20, 20, 110, 30); clients.setBounds(20, 70, 110, 30); search.setBounds(20, 120, 110, 30); viewTables.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { add(viewCars); viewCars.setBounds(260, 20, 110, 20); add(viewRent); viewRent.setBounds(260, 50, 110, 20); add(viewBuy); viewBuy.setBounds(260, 80, 110, 20); add(viewAccessory); viewAccessory.setBounds(260, 110, 110, 20); } }); viewCars.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { View view = new View(); view.addWindowListener(new WindowPlug(Main.this)); setVisible(false); } }); } public static void main(String args[]) { new Main(); } } View.java: package CarManager; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class View extends JFrame { private static final long serialVersionUID = 1L; int width = 400; int he…
tagged with: java
has comment: http://stackoverflow.com/comment/33016987
type: Question
has answer: http://stackoverflow.com/a/21815752
upvote count: 1
answer count: 1
favorite count: 0
has title: Java buttons repaint
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/q/21714533
answer count: 5
has body: I have an ArrayList which I want to grab a random value from. To do this I thought of two simple methods: Method 1: Uses Random to generate a random number between 0 and the size of the ArrayList and then use that number for arrayList.get(x) Method 2: Use arrayList.shuffle() and then arrayList.get(0). Is one method preferable to the other in terms of randomness, I know it is impossible for one to be truly random but I want the result to be as random as possible. EDIT: I only need one value from that ArrayList
has comment: http://stackoverflow.com/comment/32835661
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21714591
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21714699
possible better answer: http://stackoverflow.com/a/21714620
has answer: http://stackoverflow.com/a/21714620
has answer: http://stackoverflow.com/a/21714587
tagged with: arraylist
tagged with: random
has title: Random vs Shuffle
downvote count: 0
has answer: http://stackoverflow.com/a/21714563
favorite count: 0
accepted answer: http://stackoverflow.com/a/21714587

http://stackoverflow.com/a/21762955
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21759592
has comment: http://stackoverflow.com/comment/32942835
type: Answer
has body: You can find the basic example for a "chunk encoded POST" on the Apache HttpClient example page. For the form-based post you also need org.apache.httpcomponents:httpmime:4.3.2 With that you get the org.apache.http.entity.mime.MultipartEntityBuilder which you can use like so: MultipartEntityBuilder meb = MultipartEntityBuilder.create(); meb.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); meb.addPart("to", new StringBody("The recipient", ContentType.TEXT_PLAIN)); meb.addPart("from", new StringBody("The sender", ContentType.TEXT_PLAIN)); FileBody fb = new FileBody(new File("path/to/your/file"), ContentType.create("image/jpeg")); meb.addPart("file", fb); meb.addPart("footer", new StringBody("The footer", ContentType.TEXT_PLAIN)); httppost.setEntity(meb.build()); That should help you on your way.
answers question: http://stackoverflow.com/q/21759592

http://stackoverflow.com/q/21721197
tagged with: java
tagged with: string-to-datetime
type: Question
accepted answer: http://stackoverflow.com/a/21721424
has comment: http://stackoverflow.com/comment/32846561
tagged with: date
score: 0
answer count: 2
has body: I have date like mm-dd-yyy in string format and I am trying to convert the same to Date object in java, Two ways I tried in sending the date format as "mm-dd-yyy" which is returning the wrong date, it always returns month Jan even though the month in the string is not "01" sending the date format as "MM-dd-yyy" will return the correct date as expected. But I want to understand why the first approach returning wrong? Can any body tell me the reason.
possible better answer: http://stackoverflow.com/a/21721239
has answer: http://stackoverflow.com/a/21721239
has answer: http://stackoverflow.com/a/21721424
has comment: http://stackoverflow.com/comment/32846522
has title: Parse String to Date in java
type: AnsweredQuestion

http://stackoverflow.com/a/21743090
answers question: http://stackoverflow.com/q/21742765
has comment: http://stackoverflow.com/comment/32885995
has comment: http://stackoverflow.com/comment/32886010
score: 0
has body: I edited your code already. if (array[9] == 'x') //Line 1 { array[9] = 10; // Line 2 } On Line 1 you said ===. Java uses == to check if two primitive values are equal in value. On Line 2 you used three equal signs again. If you want to reassign a variable, you will need to use ONE equal sign.
type: Answer

http://stackoverflow.com/comment/32984604
score: 1
has text: That was as much details as I could ve hoped for. It answers my queries and also serves as a good starting point for my further research. Thanks.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21794279

keypress
tags question: http://stackoverflow.com/q/21738837
tags question: http://stackoverflow.com/q/21801180
tags question: http://stackoverflow.com/q/21791999
type: Tag
tag name: keypress

http://stackoverflow.com/a/21842197
has comment: http://stackoverflow.com/comment/45277130
type: Answer
has body: Looks like you need to use the "low level SimpleConsumer API" For most applications, the high level consumer Api is good enough. Some applications want features not exposed to the high level consumer yet (e.g., set initial offset when restarting the consumer). They can instead use our low level SimpleConsumer Api. The logic will be a bit more complicated and you can follow the example in here. This example worked for getting all messages from a topic with the following arguments: (note that the port is the Kafka port, not the ZooKeeper port, topics set up from this example): 10 my-replicated-topic 0 localhost 9092 Specifically, there is a method to get readOffset which takes kafka.api.OffsetRequest.EarliestTime(): long readOffset = getLastOffset(consumer,a_topic, a_partition, kafka.api.OffsetRequest.EarliestTime(), clientName); Here is another post may provide some alternate ideas on how to sort this out: How to get data from old offset point in Kafka?
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/21762406
upvote count: 5

http://stackoverflow.com/q/21816364
has answer: http://stackoverflow.com/a/21816573
has comment: http://stackoverflow.com/comment/33016775
accepted answer: http://stackoverflow.com/a/21816573
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33016558
type: Question
has answer: http://stackoverflow.com/a/21816456
has body: This program is for converting ISO dates (ex: 2014-02-15) and being able to convert this into "February 15 2014" but I am having trouble with the constructor, here is what I have so far: public SimpleDate(String isoDate) { // test print System.out.println(isoDate); Scanner sc = new Scanner(isoDate); sc.useDelimiter("­-"); this.year = sc.nextInt(); this.month = sc.nextInt(); this.day = sc.nextInt(); System.out.println(year); }//constructor I have a test in main: public static void main(String[] args) { SimpleDate date = new SimpleDate("2014-12-12"); }//main When running the code as it is I get the test print in the constructor to execute but I get this error soon afterwards: Test Print: 2014-12-12 Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at SimpleDate.&lt;init&gt;(SimpleDate.java:19) at SimpleDate.main(SimpleDate.java:68)
possible better answer: http://stackoverflow.com/a/21816655
has title: Exception in thread "main" java.util.InputMismatchException for SimpleDate class
has answer: http://stackoverflow.com/a/21816655
has comment: http://stackoverflow.com/comment/33017168
answer count: 3
has comment: http://stackoverflow.com/comment/33016657
has comment: http://stackoverflow.com/comment/33016421

http://stackoverflow.com/comment/33023124
has text: This is not required if the OP is using m2eclipse, which he indicates he is.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21820117
score: 0

http://stackoverflow.com/comment/32856635
score: 0
has text: Font has Attributes (required to iterate), btw [DYM??? this Helvetica Neue from....](http://crossgraphicideas.wordpress.com/2012/08/14/helvetica-neue-font-free-download-complete-family/)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21725269

http://stackoverflow.com/comment/32888318
comment on: http://stackoverflow.com/a/21744406
type: AnswerComment
score: 0
has text: Also I feel like my final averaging line is incorrect, is there any place to find the correct code? Or is that what you meant about finding it in the JDK docs
type: Comment

http://stackoverflow.com/comment/33046248
comment on: http://stackoverflow.com/q/21833537
type: QuestionComment
has text: Then you have to use anonymous classes only. Introduction of lambda doesn't make them deprecated. Lambdas can be used only with functional interfaces.
type: Comment
score: 25

http://stackoverflow.com/comment/32920920
type: Comment
comment on: http://stackoverflow.com/a/21762425
has text: Moreover, I don't see where you are doing anything to the variable "Array" that is being passed in either.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32927590
comment on: http://stackoverflow.com/a/21765972
type: AnswerComment
score: 0
type: Comment
has text: Finally made it work.. But im still wondering how this 100% works.. Well, thanks for your help, i appreciate it :-)!

http://stackoverflow.com/a/21778423
has comment: http://stackoverflow.com/comment/32948341
type: Answer
has comment: http://stackoverflow.com/comment/32950284
has comment: http://stackoverflow.com/comment/32948621
score: 8
has comment: http://stackoverflow.com/comment/32948198
has comment: http://stackoverflow.com/comment/32948281
has comment: http://stackoverflow.com/comment/32951402
answers question: http://stackoverflow.com/q/21778266
has comment: http://stackoverflow.com/comment/32948157
has comment: http://stackoverflow.com/comment/32948645
accepted answer of: http://stackoverflow.com/q/21778266
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32948425
upvote count: 8
has body: This is defined in the JLS #5.2 (Assignment conversion): If the expression is a constant expression (§15.28) of type byte, short, char, or int, a narrowing primitive conversion may be used if the type of the variable is byte, short, or char, and the value of the constant expression is representable in the type of the variable. so: byte b = 5; //ok: b is a byte and 5 is an int between -128 and 127 byte b = 1000; //not ok: 1000 is an int but is not representable as a byte (&gt; 127) byte b = 5L; //not ok: 5L is a long (and not a byte, short, char or int) int i = 5L; //not ok: i is not a byte, short or char int i = 5; byte b = i; //not ok: i is not a constant final int i = 5; byte b = i; //ok: i is a constant and b is a byte

http://stackoverflow.com/comment/32954124
comment on: http://stackoverflow.com/q/21781703
score: 0
type: Comment
has text: Can you show how can I acheive that? I am iterating over each object.
type: QuestionComment

http://stackoverflow.com/comment/32859524
has text: Looks like you need a `CellEditor`. Look at `DefaultCellEditor` and how to write your own. I'm not sure where to start myself, catching input events in a JTable isn't something I've had to do before.
type: QuestionComment
comment on: http://stackoverflow.com/q/21728158
score: 0
type: Comment

http://stackoverflow.com/a/52378228
answers question: http://stackoverflow.com/q/21694901
type: Answer
downvote count: 0
score: 1
has body: From my perspective, the most obvious difference is that in java class, in the constructor, you need to specify the field this.radius = radius While in the python code, you don't have to do so, it's implicit.
has comment: http://stackoverflow.com/comment/115413936
upvote count: 1

http://stackoverflow.com/a/21742380
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32889475
answers question: http://stackoverflow.com/q/21742186
has body: This line retrieves sentence annotations. List&lt;CoreMap&gt; sentences = document.get(SentencesAnnotation.class); But your pipeline contains only the tokenizer, not the sentence splitter. Change the following line: props.put("annotators", "tokenize, ssplit"); // add sentence splitter
upvote count: 1

http://stackoverflow.com/a/21762472
score: 1
upvote count: 1
has body: If sourceImage must be a distinct array, you can loop through both dimensions and copy each item: sourceImage = new int[image.length][]; // Initialize the first dimension. for (int i=0; i&lt;sourceImage.length; i++) { sourceImage[i] = new int[image[i].length]; // Initialize the 2nd dimension. for (int j=0; j&lt;sourceImage[i].length; j++) { sourceImage[i][j] = image[i][j]; // Copy each value. } } You can do this a little quicker by making use of System.arraycopy, but explicit loops are better for learning :-) If it's okay that the object's sourceImage is the same array as the one passed to the constructor, then you can simply assign it. Doing it this way means that any changes to one of the arrays (image or sourceImage) will affect them both, because they are just two references to the same array object. sourceImage = image;
type: Answer
answers question: http://stackoverflow.com/q/21762375
downvote count: 0

http://stackoverflow.com/q/21680608
linked to: http://stackoverflow.com/q/9671546
has body: I have this button that when clicked saves the details entered in my textfields to Google App Engine, right after the call to that onClickListener, i have an intent that starts a new activity, which displays the details I just entered. Here is the code for this: submitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(v.getId() == R.id.userDetailsCaptureButton) { new EndpointsTask().execute(getApplicationContext()); } startActivity(userProfileDisplayIntent); } }); Now i want to be able to wait for a couple of seconds before making a call to startActivity after new EnpointsTask().execute(getApplicationContext) has been called. I read that using Thread.sleep causes the UI to freeze and as such isn't best suited for this. What other options are there?
type: Question
has answer: http://stackoverflow.com/a/21680858
type: AnsweredQuestion
score: 4
upvote count: 4
has title: Alternative to Thread.sleep method in Android
answer count: 3
possible better answer: http://stackoverflow.com/a/21681052
has comment: http://stackoverflow.com/comment/32774361
downvote count: 0
has answer: http://stackoverflow.com/a/21681052
has comment: http://stackoverflow.com/comment/32774647
accepted answer: http://stackoverflow.com/a/21680858
has comment: http://stackoverflow.com/comment/32774617
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/32774526
has comment: http://stackoverflow.com/comment/32793330
has answer: http://stackoverflow.com/a/21680762
tagged with: java
has comment: http://stackoverflow.com/comment/32774609

http://stackoverflow.com/comment/32911584
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21757897
score: 3
has text: You have declared variables outside of the class

http://stackoverflow.com/comment/32879419
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21739030
type: Comment
has text: Thanks for the response. I understand the order of the projects in modules. The matter is that I don't know how to extract my generated sources out of my main project. They are in my generated-sources directory but how can I tell maven to package it in the "generated" project you suggest?(I wouldn't like to copy paste those files) Thanks again!

http://stackoverflow.com/a/21755793
upvote count: 2
has comment: http://stackoverflow.com/comment/32910598
downvote count: 1
has comment: http://stackoverflow.com/comment/32908118
score: 1
has body: Do you test your code? With testing, the disfavor of static become obvious: you can't mock static methods1: If you Util class opens a file, then you must have that file when testing. you can't replace static methods. you can't make more specialized versions of those methods through subclassing the Util classes (and then changing what class is injected by the CDI container). Unless you are building a true utility library that is unlikely to change (such as Apache Commons), do use instance methods and do use singletons. Whoever picks your code in the future and needs to change it will thank you. Follow up: Static Methods are Death to Testability 1: Actually, you can mock static methods with tools such as PowerMock. But they are way too invasive and the tests they generate are so brittle they miss the purpose of testing. The very need of such a tool is a strong indicator of problems in your codebase. (In time, those tools are useful for legacy systems testing.)
has comment: http://stackoverflow.com/comment/32912039
answers question: http://stackoverflow.com/q/21755470
has comment: http://stackoverflow.com/comment/32914024
type: Answer
has comment: http://stackoverflow.com/comment/32908990
has comment: http://stackoverflow.com/comment/32907892

http://stackoverflow.com/comment/32996950
type: Comment
type: QuestionComment
has text: Why is it so important you use a switch statement? Just use an `if` statement instead. Sounds like it'd prevent an unnecessary headache.
comment on: http://stackoverflow.com/q/21805534
score: 1

http://stackoverflow.com/a/21797928
has comment: http://stackoverflow.com/comment/32983224
type: AcceptedAnswer
downvote count: 0
has body: Return the name of the view without the .jsp file extension. The resolution of the view name is handled by the InternalResourceViewResolver. public String sample(Model model){ return "sample"; } This snippet of your configuration: &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" /&gt; takes the view name sample and applies the appropriate prefix (/WEB-INF/jsp/) and suffix (.jsp) to form the entire view name used for resolution of the view. Also make sure the sample.jsp is located at /WEB-INF/jsp/sample.jsp. Also when using the @RequestMapping annotation you must enable these annotations in the configuration for the dispatcher serlvet by including &lt;mvc:annotation-driven/&gt;. You must also add component scanning within the dispatcher configuration so that the controllers are registered with the dispatcher servlet. Currently, you perform component scanning within the applicationContext.xml configuration file using: &lt;context:component-scan base-package="com.mindedges" /&gt; However, since this component scanning occurs within the applicationContext file the registered beans (assuming they are your controllers) will not be available to the dispatcher serlvet. You must place this configuration snippet within dispatcher-context.xml. You many want to consult one of my previous answers regarding the differences between the dispatcher configuration and the context configuration. There was also some whitespace in your dispatcher-context.xml file and a the mvc namespace was missing. I have corrected these issues and provided them in this GitHub Gist.
has comment: http://stackoverflow.com/comment/32983197
has comment: http://stackoverflow.com/comment/32983498
has comment: http://stackoverflow.com/comment/32983451
has comment: http://stackoverflow.com/comment/32983266
type: Answer
has comment: http://stackoverflow.com/comment/32983531
accepted answer of: http://stackoverflow.com/q/21797916
upvote count: 7
has comment: http://stackoverflow.com/comment/32983395
has comment: http://stackoverflow.com/comment/32983428
answers question: http://stackoverflow.com/q/21797916
has comment: http://stackoverflow.com/comment/32983325
score: 7
has comment: http://stackoverflow.com/comment/32983549

http://stackoverflow.com/comment/32964087
type: QuestionComment
comment on: http://stackoverflow.com/q/21787185
score: 2
has text: Are you attempting to shuffle a real deck of cards? If so you should look into a real shuffling algorithm (http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle is a good one) and also should probably not have a test case that tests for a specific a output after shuffling. Shuffling should be at least somewhat random.
type: Comment

http://stackoverflow.com/q/21812623
tagged with: java
has body: If I filter a sorted set or map based on a certain maximum or minimum, will Java 8 mindlessly check the condition on each element or does it employ an optimization using the "sortedness"? If not, is there a better way that still uses the Java 8 parallelism? SortedSet&lt;Integer&gt; numbers = getNumbers(); numbers.parallelStream().filter(n -&gt; n &lt;= 100).forEach(...); P.S.: To clarify as requested: Let's suppose "numbers" is very large. If we check for each element, if it is &lt;= 100 (or any other number), we waste a big amount of time. An efficient implementation would binary search over the sorted set and identify the cutoff in log time instead of linear time and then use some internal set feature to create a subset at this cutoff.
tagged with: sortedset
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21813463
favorite count: 0
tagged with: filter
has title: Java 8 maximum filter optimized for SortedSet?
has answer: http://stackoverflow.com/a/21813104
has comment: http://stackoverflow.com/comment/33122990
upvote count: 1
tagged with: java-8
has answer: http://stackoverflow.com/a/21813463
possible better answer: http://stackoverflow.com/a/21813104
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/32839451
type: Comment
type: QuestionComment
score: 0
has text: Make GetTL, GetTR, etc instead. Then you can say `GetTR().x`. Or just make TL, TR, etc public.
comment on: http://stackoverflow.com/q/21716802

http://stackoverflow.com/a/21705250
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21704544
has body: The property name is currentFunctionPath: jdbc:db2://host:50000/dbname:currentSchema=schemaname;currentFunctionPath=blah http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_r0052607.html
answers question: http://stackoverflow.com/q/21704544
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32818699

http://stackoverflow.com/a/21759096
answers question: http://stackoverflow.com/q/21758811
score: 2
accepted answer of: http://stackoverflow.com/q/21758811
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: You might be having a problem with the domain. You should try to isolate the case where it works and where it doesn't, i.e. do a Cookies.getCookie("myapp-tour-done") directly after you set it. If your application changes domains (i.e. from example.com to myapp.example.com) or hierarchy (example.com/bigscope to example.com/bigscope/smallscope) there might be issues with cookie permissions. This means that if your application sets a cookie in one domain or hierarchy, it might not be readable from another one. You can read up more here: http://msdn.microsoft.com/en-us/library/ms970178.aspx
type: Answer

http://stackoverflow.com/q/21728502
downvote count: 0
tagged with: expression
score: 1
tagged with: math
tagged with: java
has body: My task is to create an android application where the user is presented with four levels of game diﬃculty. Is there an easier way to produce this project to include all other difficulties? Any help is appreciated, Mark
type: Question
answer count: 2
tagged with: random
upvote count: 1
has answer: http://stackoverflow.com/a/21728912
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Random Arithmetic Expressions (Android)
has answer: http://stackoverflow.com/a/21729086

http://stackoverflow.com/comment/32851389
type: Comment
type: QuestionComment
has text: [DecimalFormat](http://docs.oracle.com/javase/6/docs/api/java/text/DecimalFormat.html) class you can check...
comment on: http://stackoverflow.com/q/21723972
score: 0

http://stackoverflow.com/q/21757947
tagged with: instrumentation
has comment: http://stackoverflow.com/comment/32911680
tagged with: java-bytecode-asm
has title: java - how do i save the classes created after JIT to a file on the disk
has comment: http://stackoverflow.com/comment/32911621
has comment: http://stackoverflow.com/comment/33077276
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32913073
tagged with: decompiler
tagged with: bytecode
tagged with: java
has comment: http://stackoverflow.com/comment/32912910
type: Question
score: 0
has body: Sometimes I am using frameworks that instrument my code (byte code inject). I remember that there is a way to tell the JVM to save the class after the instrumentation with the new byte codes (so I can view it with a decompiler). How do I do it? (What are the parameters ) Thanks.

specifications
type: Tag
tag name: specifications
tags question: http://stackoverflow.com/q/21779535

http://stackoverflow.com/q/21706260
possible better answer: http://stackoverflow.com/a/21706881
has answer: http://stackoverflow.com/a/21706881
tagged with: oracle-database
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/32820270
downvote count: 0
has title: Oracle: Read-only access to the schema for another user?
has answer: http://stackoverflow.com/a/21721420
favorite count: 0
has comment: http://stackoverflow.com/comment/32831368
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32830289
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/21721420
tagged with: oracle11g
linked to: http://stackoverflow.com/q/3780046
has comment: http://stackoverflow.com/comment/32846711
has body: I have a schema and a user with the same name: products. For development I would like to use it in a read-only mode from a java application. Therefore, I created a new user for the read-only application. CREATE USER PRODUCTS_READONLY IDENTIFIED BY PRODUCTS_READONLY; GRANT CREATE SESSION to PRODUCTS_READONLY; BEGIN FOR tab IN (SELECT table_name FROM all_tables WHERE owner = 'PRODUCTS') LOOP EXECUTE IMMEDIATE 'GRANT SELECT ON PRODUCTS.'||tab.table_name||' TO PRODUCTS_READONLY'; END LOOP; END; Running the application I got the error that the table did not exist. Searching on the internet for solution, I came across SYNONYM. So I added synonym to the schema: CREATE SYNONYM PRODUCTS_READONLY FOR PRODUCTS; Now, I am getting this error in my java application: ERROR org.hibernate.util.JDBCExceptionReporter - ORA-17074 invalid name pattern.: PRODUCTS_READONLY.PRODUCT_TYPE What is wrong with my approach? --UPDATE-- Seems like creating synonyms for schema was removed in 10g (Oracle: is it possible to create a synonym for a schema?). If I create schema for each object in the target schema, I would have to do the same every time a table is added to the target schema or any other changes to the any other objects in the target schema? That sounds cumbersome... --UPDATE 2-- Seems like a trigger with alter session is a possible solution, but will it make the tables read-only so long the user has only SELECT privilege?

http://stackoverflow.com/q/21707618
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21707749
score: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/21707749
has title: How to show buttons in a list item on long press
tagged with: android-listview
type: AnsweredQuestion
has body: I'm trying to mimic the behavior of twitter application. When you long press an item (tweet) four buttons show up on that list item. Any of those buttons can be pressed to take the user to another screen. Similarly, I have a list like this: lv.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View view, int arg2,long arg3) { startActivityWhenListItemClicked(view); } }); The above code works when a list item is clicked. How can I implement long-press and show few buttons on the list item? I would appreciate any tutorial or an example.
linked to: http://stackoverflow.com/q/21710562

http://stackoverflow.com/q/21768611
has comment: http://stackoverflow.com/comment/32931420
type: Question
has body: I read that java.util.HashSet doesn't sort. However when I execute this code import java.util.*; public class Example { public static void main(String[] args) { Set set = new HashSet(); set.add(newInteger(5)); set.add(new Integer(2)); set.add(new Integer(1)); System.out.println(set); } } the output is [1, 2, 5] Why are the values sorted?
answer count: 1
has comment: http://stackoverflow.com/comment/32931450
has title: Sorting in HashSet
duplicate of: http://stackoverflow.com/q/21750004
has comment: http://stackoverflow.com/comment/32931446
score: 0
has comment: http://stackoverflow.com/comment/32931526
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21750004
tagged with: collections
has answer: http://stackoverflow.com/a/21768673
tagged with: java

http://stackoverflow.com/comment/32897062
type: Comment
type: QuestionComment
has text: anyone could help? thx!
score: 0
comment on: http://stackoverflow.com/q/21749282

http://stackoverflow.com/q/21791317
has comment: http://stackoverflow.com/comment/32972101
has comment: http://stackoverflow.com/comment/32971962
has answer: http://stackoverflow.com/a/21791366
has comment: http://stackoverflow.com/comment/32971932
type: AnsweredQuestion
has body: I am trying to use formatted output and would like to know how would I use %10s in this code package formattedoutput; public class FormattedOutput { public static void main(String[] args) { double amount; amount = 43.676; int spaces; spaces = 77; String adding; adding = "check me out"; System.out.printf( "%1.2f%n", amount ); System.out.println(); System.out.printf("%12d", spaces ); System.out.println(); System.out.printf("%10s", adding ); } } From what I did I don't see any difference it says that "The letter "s" at the end of a format specifier can be used with any type of value. It means that the value should be output in its default format, just as it would be in unformatted output. A number, such as the "10" in %10s can be added to specify the (minimum) number of characters. " Am I using it properly ? If so why it says "s" specifier can be used with any type of value ?
has answer: http://stackoverflow.com/a/21791454
accepted answer: http://stackoverflow.com/a/21791366
type: Question
has title: Formatted Output in Java
possible better answer: http://stackoverflow.com/a/21791454
score: 0
tagged with: java
answer count: 2

http://stackoverflow.com/q/21721154
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32846704
possible better answer: http://stackoverflow.com/a/21721295
tagged with: java
has comment: http://stackoverflow.com/comment/32846641
has comment: http://stackoverflow.com/comment/32846718
has comment: http://stackoverflow.com/comment/32846739
has comment: http://stackoverflow.com/comment/32846586
has comment: http://stackoverflow.com/comment/32846629
type: Question
has comment: http://stackoverflow.com/comment/32846682
has comment: http://stackoverflow.com/comment/32846992
accepted answer: http://stackoverflow.com/a/21721378
has body: The application now is crashing due to nullpointerexception. I have found many different similar problems on google, however, none of the solutions worked. This app is supposed to forward a call, where the number to receive the forwarded calls are stored within the shared preferences. As for the numbers to forward are stored within a database. If possible, do guide me on how to get data from the database as well. Thanks These are the logcats: 02-12 15:09:07.745: E/AndroidRuntime(4827): Caused by: java.lang.NullPointerException 02-12 15:09:07.745: E/AndroidRuntime(4827): at com.example.awkwardpanda_redirectcall.MainActivity.onCreate(MainActivity.java:33) 02-12 15:09:07.745: E/AndroidRuntime(4827): at android.app.Activity.performCreate(Activity.java:5158) 02-12 15:09:07.745: E/AndroidRuntime(4827): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 02-12 15:09:07.745: E/AndroidRuntime(4827): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 02-12 15:09:07.745: E/AndroidRuntime(4827): ... 11 more This is my mainactivity.java public class MainActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Switch switch1 = (Switch) findViewById(R.id.switch1); EditText editText1 = (EditText) findViewById(R.id.editText1); SharedPreferences preferences; preferences = PreferenceManager.getDefaultSharedPreferences(this); final String streditText1 = preferences.getString("Number", ""); editText1.setText(streditText1); // set the switch to OFF switch1.setChecked(false); // attach a listener to check for changes in state switch1.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { Toast.makeText(getApplicationContext(), "Call Forwarding is activated",Toast.LENGTH_SHORT).show(); callforward("*63*" + streditText1 + "#…
score: 0
has title: App crashes on start up due to shared preferences
has comment: http://stackoverflow.com/comment/32846642
answer count: 2
has comment: http://stackoverflow.com/comment/32846906
has answer: http://stackoverflow.com/a/21721295
has comment: http://stackoverflow.com/comment/32846489
has comment: http://stackoverflow.com/comment/32846591
has answer: http://stackoverflow.com/a/21721378
has comment: http://stackoverflow.com/comment/32846639
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/32846748
has comment: http://stackoverflow.com/comment/32846541

http://stackoverflow.com/comment/32935965
type: QuestionComment
score: 1
has text: It's not dangerous when _you_ use it. It's dangerous for anyone else that has access to your code that may use it differently than you intended.
comment on: http://stackoverflow.com/q/21771185
type: Comment

http://stackoverflow.com/q/21774615
score: 0
has comment: http://stackoverflow.com/comment/32944894
has title: Openfaces pagination not working correctly
linked to: http://stackoverflow.com/q/5694350
answer count: 0
tagged with: openfaces
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32942928
tagged with: java
tagged with: pagination
has comment: http://stackoverflow.com/comment/32942446
type: Question
tagged with: jsf-2
has body: I am testing the Openfaces framework. and did a small example through the use of a datatable. The problem is that the pagination is not always working as it supposed to work i.e by clicking the next button, the page displayed is a blank page without records inside the datatable. it manifests itself like this in an on off pattern therefore if I press next the bug would display but on the next click the next set would be diplayed correctly. Please refer to the pics attached below. clicking the next set button will result in the following repsonse by the pagination. re-clicking the next button will make the pagination properly as shown below: This sort of pattern would repeat itself along the whole set of records. This is the code used to produce the datatable: &lt;o:dataTable var="current" value="#{transformer.people}" pageSize="6"&gt; &lt;f:facet name="below"&gt; &lt;o:dataTablePaginator id="paginator"/&gt; &lt;/f:facet&gt; &lt;o:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Name" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{current.name}" /&gt; &lt;/o:column&gt; &lt;o:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Surname" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{current.surname}" /&gt; &lt;/o:column&gt; &lt;o:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Age" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{current.age}" /&gt; &lt;/o:column&gt; &lt;o:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Phone Number" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{current.phone}" /&gt; &lt;/o:column&gt; &lt;/o:dataTable&gt; I cant pick out what is missing in my code.

http://stackoverflow.com/comment/139847018
comment on: http://stackoverflow.com/a/21717900
type: AnswerComment
type: Comment
has text: While your answer does help OP get on with their learning, @gene's answer is more thorough, gives details, and answers the original spirit of the question. Not everyone reading this is a newbie learning for the first time, and I appreciated the information Gene provided about the parser, byte code instruction encodings, context free grammars, as well as information that the literal Python code is interpreted into a graph data structure, the order of instructions of which can then be optimized during run time, that I found on [Wikipedia](https://en.m.wikipedia.org/wiki/CPython)
score: 0

http://stackoverflow.com/comment/32807081
type: Comment
has text: also, you are returning InputStream but also closing it in finally (read Audrius Meškauskas answer), so you will get closed InputStream in onPostExecute.
comment on: http://stackoverflow.com/a/21698884
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33006723
comment on: http://stackoverflow.com/q/21809860
score: 0
type: QuestionComment
has text: I tried "play compile"; it worked and returned [success]. My project conversion to an eclipse project still fails, however.
type: Comment

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/21790894
tags question: http://stackoverflow.com/q/21758112

http://stackoverflow.com/q/21685529
has body: Ok so basically i have a list or an array of integers List = (1,3,22,17,22,4,15,40) And i need to find two lists like this: List1 = (1,3,17,4,15,22) ... Sum = 62 List2 = (22,40) ... Sum = 62 All integers should be used, an integer should be in either List1 or List2 ---- my first thought ---- Choose the largest nb i.e 40 and try to find integers equal to 40 and add to the second list ... But that's not the way ... The above list is an example list ... I should be able to find List1 and List2 if possible for any given list.
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/21685698
has answer: http://stackoverflow.com/a/21686757
has title: Find 2 lists of equal sum out of a larger list
has comment: http://stackoverflow.com/comment/32783263
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21685698
possible better answer: http://stackoverflow.com/a/21686757

http://stackoverflow.com/comment/32879499
comment on: http://stackoverflow.com/a/21715401
has text: Ok. So I added a class similar to the one you put in your answer. I then created the handler [SharedFileHandler handler = new SharedFileHandler());] and added it to my logger [logger.addHandler(handler)]. I did this in my "setupLogger" method. However, it is still writing to multiple logs. I have a feeling I am doing something wrong. Ideas?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21752991
has comment: http://stackoverflow.com/comment/32903524
upvote count: 4
has comment: http://stackoverflow.com/comment/32902912
downvote count: 0
score: 4
has body: The previous line ends , 0}, and it should end with , 0}}; See your first link which has {5, 8, 1, 2, 0}}; I suggest you try developing using an IDE like IntelliJ CE as it will help you format the code and errors much easier.
type: Answer
answers question: http://stackoverflow.com/q/21752900

http://stackoverflow.com/q/21679203
tagged with: scroll
upvote count: 1
tagged with: swing
type: Question
tagged with: jtree
has answer: http://stackoverflow.com/a/21679258
has title: scrollPathToVisible does not behave properly
tagged with: jscrollpane
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has body: I have a JTree and I want it to scroll down to the latest child entry. I used scrollPathToVisible in the following manner statusTree_.scrollPathToVisible(new TreePath(childNode.getPath())); Where childNode is the latest added child to the tree. The problem I have is whenever root is added then the scroll does not move down when the first child is added, but starts moving down only from the second child. User can observe that there is a gap below in the scroll pane and needs to scroll manually, I need the scroll to move automatically for the first child also.
score: 1
accepted answer: http://stackoverflow.com/a/21679258
tagged with: java

http://stackoverflow.com/comment/32975134
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21792746
has text: Why do you want to do that?
type: QuestionComment

http://stackoverflow.com/a/21827502
score: 0
answers question: http://stackoverflow.com/q/21819835
type: Answer
has body: addMarker method returns a Marker object. For your location marker, save if as a field e.g. myLocationMarker and in the callback do if (!marker.equals(myLocationMarker)) { // ...

http://stackoverflow.com/comment/33051861
has text: Most likely you're using the BigDecimal totalCost and it has not been initialized so you're getting a null pointer exception.
comment on: http://stackoverflow.com/q/21836538
score: 0
type: Comment
type: QuestionComment

jpa-2.0
tags question: http://stackoverflow.com/q/21693071
tags question: http://stackoverflow.com/q/21698585
tags question: http://stackoverflow.com/q/21754562
tags question: http://stackoverflow.com/q/21793532
tags question: http://stackoverflow.com/q/21769860
type: Tag
tag name: jpa-2.0
tags question: http://stackoverflow.com/q/21719164

http://stackoverflow.com/a/21764813
score: 3
has body: Well, you can put the below dependency in your pom.xml if you use Maven. com.github.axet vget 1.1.5 Otherwise, you could download the archive from https://github.com/axet/vget/releases and build it yourself. If you want the latest (unreleased) version, you'll have to clone the repository on your machine and build it yourself.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21764784
has comment: http://stackoverflow.com/comment/32924404
downvote count: 0

http://stackoverflow.com/comment/32910069
type: AnswerComment
comment on: http://stackoverflow.com/a/21741589
has text: @Jgoodwyn Updated my answer so you can hopefully start to think for yourself. StackOverflow is not a homework service.
type: Comment
score: 0

http://stackoverflow.com/comment/32924353
has text: @HovercraftFullOfEels Not with this one since the zip file is an archive of source files. The OP will have to extract, build and then bundle into a JAR file.
type: QuestionComment
comment on: http://stackoverflow.com/q/21764784
score: 0
type: Comment

http://stackoverflow.com/comment/33030147
type: QuestionComment
has text: Ah, it would make sense! I will learn one day!
comment on: http://stackoverflow.com/q/21818625
score: 0
type: Comment

http://stackoverflow.com/comment/32883837
score: 0
type: Comment
has text: replace String name = input.next() by s_name[s_nextGame] = input.next()
comment on: http://stackoverflow.com/a/21741712
type: AnswerComment

http://stackoverflow.com/a/21742701
type: Answer
accepted answer of: http://stackoverflow.com/q/21742174
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21742174
type: AcceptedAnswer
has body: Making the href of your anchor tag point to a 'tel' URI should do the trick: Call Us! If your WebView is using a custom WebViewClient, you may need to implement some special logic in 'shouldOverrideUrlLoading'. See: Common Intents - Phone WebView - Handling Navigation
upvote count: 1
has comment: http://stackoverflow.com/comment/32887117

http://stackoverflow.com/q/21818582
score: 0
tagged with: jscrollpane
accepted answer: http://stackoverflow.com/a/21818617
answer count: 1
tagged with: jframe
has title: Why isn't my JScrollPane working?
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has body: I'm trying to make my JPanel scrollable but it's not working. I made a JPanel, added components to it, then added my JPanel to a JScrollPane. This is what you're supposed to do, right? What am I doing wrong? import java.awt.Dimension; import java.awt.Font; import java.awt.SystemColor; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.ScrollPaneLayout; import javax.swing.SwingConstants; public class RegisterPane extends JPanel { private JTextField txtJohnDoe; private JTextField txtExampledomaincom; private JPasswordField passwordField; private JPasswordField passwordField_1; /** * Create the panel. */ public RegisterPane() { setLayout(null); JPanel panel = new JPanel(); panel.setBounds(6, 36, 300, 450); panel.setLayout(null); JLabel lblFirstName = new JLabel("First Name"); lblFirstName.setBounds(28, 6, 92, 16); panel.add(lblFirstName); txtJohnDoe = new JTextField(); txtJohnDoe.setText("John Doe"); txtJohnDoe.setBounds(124, 0, 251, 28); panel.add(txtJohnDoe); txtJohnDoe.setColumns(10); txtExampledomaincom = new JTextField(); txtExampledomaincom.setText("Example@domain.com"); txtExampledomaincom.setColumns(10); txtExampledomaincom.setBounds(124, 40, 251, 28); panel.add(txtExampledomaincom); JLabel lblEmail = new JLabel("Email"); lblEmail.setBounds(28, 46, 92, 16); panel.add(lblEmail); JLabel lblGender = new JLabel("Gender"); lblGender.setBounds(28, 89, 55, 16); panel.add(lblGender); JRadioButton rdbtnMale = new JRadioButton("Male"); rdbtnMale.setBounds(124, 85, 92, 23); panel.add(rdbtnMale); JRadioButton rdbtnFemale = new JRadioButton("Female"); rdbtnFemale.setBounds(283, 85, 92, 23); panel.add(rdbtnFemale); JLabel lblPassword = new JLabel("Password"); lblPassword.setBounds(28, 157, 55, 16); panel.add(lblPassword); JLabel passDirections = new JLabel(); passDirections.setHorizontalAlignmen…
has answer: http://stackoverflow.com/a/21818617
tagged with: jpanel

http://stackoverflow.com/comment/49885421
has text: wasn't expecting to need ` false `. Thanks!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28367894
score: 2

http://stackoverflow.com/comment/32904401
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21753155
score: 0
has text: Perhaps this library already does what you need? [JTablet](http://jtablet.cellosoft.com/develop.html) "provides a simple open-source (zlib license) interface for accessing tablet input in your Java applications."

http://stackoverflow.com/comment/32866057
comment on: http://stackoverflow.com/q/21732272
type: QuestionComment
type: Comment
score: 1
has text: Cast it to Apple, then call `getAge`?

http://stackoverflow.com/q/21803408
type: Question
has body: I am trying to establish a Java method to calculate the x and y coordinate based off of three given coordinates and distances. I used the following post:Determining The Coordinates Of A Point Based On Its Known Difference From Three Other Points for guidance. I just can't get this to work properly and don't really understand the math. With my given inputs I should be outputting (1,4), but instead output a bunch of different results depending on what I make d1, d2, d3. public class Driver { public static void main (String[] args) { double x1 = 1; double y1 = 1; double x2= 2; double y2 = 1; double x3= 3; double y3 = 1; double d1 = 3; double d2 = 2; double d3 = 1; Main control = new Main(); control.GET_POINT(x1,y1,x2,y2,x3,y3,d1,d2,d3); } } Class w/ Method: public class Main { public void GET_POINT(double x1, double y1,double x2,double y2,double x3,double y3, double r1, double r2, double r3){ double A = x1 - x2; double B = y1 - y2; double D = x1 - x3; double E = y1 - y3; double T = (r1*r1 - x1*x1 - y1*y1); double C = (r2*r2 - x2*x2 - y2*y2) - T; double F = (r3*r3 - x3*x3 - y3*y3) - T; // Cramer's Rule double Mx = (C*E - B*F) /2; double My = (A*F - D*C) /2; double M = A*E - D*B; double x = Mx/M; double y = My/M; System.out.println(x); System.out.println("and "); System.out.println( y); } }
tagged with: algorithm
has answer: http://stackoverflow.com/a/21807258
has comment: http://stackoverflow.com/comment/32993518
linked to: http://stackoverflow.com/q/2507148
tagged with: triangulation
has comment: http://stackoverflow.com/comment/33010664
answer count: 1
downvote count: 0
favorite count: 0
tagged with: geometry
accepted answer: http://stackoverflow.com/a/21807258
has title: Creating a System of Equations Method in Java
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/32828785
type: Comment
type: QuestionComment
score: 0
has text: You have the date from here: `Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(fieldAsString);`
comment on: http://stackoverflow.com/q/21711030

http://stackoverflow.com/q/21777087
tagged with: junit
has answer: http://stackoverflow.com/a/21778585
tagged with: maven-3
favorite count: 0
has answer: http://stackoverflow.com/a/21782343
has body: When i am creating a new maven project in eclipse kepler, eclipse automatically adds junit 3.8 dependency in pom.xml like junit junit 3.8 test I want to be available newer version like: 4.10, Where can i configure to use newer version instead of old?
has comment: http://stackoverflow.com/comment/32947553
has title: how to configure maven to add junit 4.10 instead of 3.8 dependency in new project
tagged with: eclipse-kepler
has comment: http://stackoverflow.com/comment/32946833
has comment: http://stackoverflow.com/comment/32946152
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32947009
has answer: http://stackoverflow.com/a/21778280
downvote count: 2
has comment: http://stackoverflow.com/comment/32946032
upvote count: 7
linked to: http://stackoverflow.com/q/14505377
type: Question
has comment: http://stackoverflow.com/comment/32947233
tagged with: java
has comment: http://stackoverflow.com/comment/32947002
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/21778280
score: 5
answer count: 3
possible better answer: http://stackoverflow.com/a/21778585
has comment: http://stackoverflow.com/comment/32946757
has comment: http://stackoverflow.com/comment/32945976

http://stackoverflow.com/a/21699637
answers question: http://stackoverflow.com/q/21699599
type: Answer
has body: I don't think the pool itself keeps those sort of figures. You can do it yourself fairly easily though: Have an AtomicInteger, have each task increment the AtomicInteger when it starts running.
score: 0

http://stackoverflow.com/comment/33117630
has text: No idea about GAE's own plugin using what is basically an RDBMS extension point; it was a bad design decision by GAE and certainly won't help the situation. But suggest you can easily check whether that is the problem by removing the aforementioned datanucleus-appengine jar from your CLASSPATH. If it isn't that then get back to your real problem.
comment on: http://stackoverflow.com/a/21859042
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21721715
type: Answer
has body: I've got two answers for you- First, I think this function does what you're looking for: addWrappedText(java.lang.CharSequence str, float x, float y, float wrapWidth) (javadoc). Second, you might want to look into using the built-in GUI components instead of building your own. I'd recommend you look at scene2d ui, which is a library that comes with libgdx and allows you to quickly put together flexible GUIs. It will take a little bit of work to set up, but it gives you a lot of options later since you get things like skins and ninepatches for free this way, so I highly recommend you look at it.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21718873
downvote count: 0
has comment: http://stackoverflow.com/comment/32853142

http://stackoverflow.com/q/21773085
type: Question
has answer: http://stackoverflow.com/a/21773188
has body: I have tried and succeed moving files from one folder to another folder using java . Here is my code File source = new File("D:\\polo\\"); File desc = new File("E:\\polo2\\"); try { FileUtils.copyDirectory(source, desc); } catch (IOException e) { e.printStackTrace(); } But i would like to move specific files from one folder to the other not all the files. Is this possible to do in java. Please help us on this
score: -1
has comment: http://stackoverflow.com/comment/32939296
downvote count: 2
upvote count: 1
has title: How to move specific files from one folder to another using java
favorite count: 0
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/21773164
has answer: http://stackoverflow.com/a/21773143
has comment: http://stackoverflow.com/comment/32939453
tagged with: java
has comment: http://stackoverflow.com/comment/32939428
has answer: http://stackoverflow.com/a/21773204
has comment: http://stackoverflow.com/comment/32939293

http://stackoverflow.com/comment/32792332
comment on: http://stackoverflow.com/q/21690313
has text: You mean 'println' rather than 'printIn'. Fix that and the braces and this will, at least, compile.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33034422
type: Comment
has text: Please show us, what you have got so far.
type: QuestionComment
comment on: http://stackoverflow.com/q/21826432
score: 0

http://stackoverflow.com/q/21719396
tagged with: java
possible better answer: http://stackoverflow.com/a/21719623
has answer: http://stackoverflow.com/a/21719623
type: Question
has comment: http://stackoverflow.com/comment/32843723
tagged with: android-layout
tagged with: performance
has body: I am developing an android application in which the user requirement is to have that app in multi language. I need to know which is the best way to do so. By storing the languages(string.xml) in a folder. For eg: For french in a folder named as value-fr. By storing all labels and respective languages in a Db table and retrieving those on different language selection. From the above two method which is the best way to be done considering the app performance.
tagged with: database
accepted answer: http://stackoverflow.com/a/21719677
has comment: http://stackoverflow.com/comment/32843845
has answer: http://stackoverflow.com/a/21719410
downvote count: 0
has answer: http://stackoverflow.com/a/21719819
favorite count: 0
has title: Multilanguage support for android application
has comment: http://stackoverflow.com/comment/32843813
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/21719677
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32845485
has comment: http://stackoverflow.com/comment/32844136
upvote count: 2

http://stackoverflow.com/comment/33032844
comment on: http://stackoverflow.com/q/21825629
score: 0
has text: Why two while loops? can u please explain me?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21806778
answer count: 5
has answer: http://stackoverflow.com/a/44379017
has comment: http://stackoverflow.com/comment/33000157
has answer: http://stackoverflow.com/a/21807595
type: AnsweredQuestion
tagged with: java
has body: I'm having the same issue as in this question, but the answers there doesn't solve my problem. I didn't create project by gdxsetup.jar, I just included gdx.jar and gdx-backend-android.jar. I added the libgdx.so to libs/x86, but it stills throws an exception. How should I solve this? Logcat: 02-16 11:59:45.604: E/AndroidRuntime(14788): FATAL EXCEPTION: main 02-16 11:59:45.604: E/AndroidRuntime(14788): java.lang.ExceptionInInitializerError 02-16 11:59:45.604: E/AndroidRuntime(14788): at java.lang.Class.newInstanceImpl(Native Method) 02-16 11:59:45.604: E/AndroidRuntime(14788): at java.lang.Class.newInstance(Class.java:1130) 02-16 11:59:45.604: E/AndroidRuntime(14788): at android.app.Instrumentation.newActivity(Instrumentation.java:1078) 02-16 11:59:45.604: E/AndroidRuntime(14788): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210) 02-16 11:59:45.604: E/AndroidRuntime(14788): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) 02-16 11:59:45.604: E/AndroidRuntime(14788): at android.app.ActivityThread.access$700(ActivityThread.java:159) 02-16 11:59:45.604: E/AndroidRuntime(14788): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 02-16 11:59:45.604: E/AndroidRuntime(14788): at android.os.Handler.dispatchMessage(Handler.java:99) 02-16 11:59:45.604: E/AndroidRuntime(14788): at android.os.Looper.loop(Looper.java:176) 02-16 11:59:45.604: E/AndroidRuntime(14788): at android.app.ActivityThread.main(ActivityThread.java:5419) 02-16 11:59:45.604: E/AndroidRuntime(14788): at java.lang.reflect.Method.invokeNative(Native Method) 02-16 11:59:45.604: E/AndroidRuntime(14788): at java.lang.reflect.Method.invoke(Method.java:525) 02-16 11:59:45.604: E/AndroidRuntime(14788): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) 02-16 11:59:45.604: E/AndroidRuntime(14788): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) 02-16 11:59:45.604: E/AndroidRuntime(14788): at dalv…
possible better answer: http://stackoverflow.com/a/22927050
has comment: http://stackoverflow.com/comment/32999693
has answer: http://stackoverflow.com/a/22927050
upvote count: 10
has title: Couldn't load shared library 'gdx' for target
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/74730429
downvote count: 0
score: 10
has comment: http://stackoverflow.com/comment/32999868
has comment: http://stackoverflow.com/comment/33000159
accepted answer: http://stackoverflow.com/a/21807595
tagged with: android
has answer: http://stackoverflow.com/a/64630578
favorite count: 0
has comment: http://stackoverflow.com/comment/33000022

http://stackoverflow.com/comment/32895648
has text: This is most probably related to the Machine Learning model called here "classifier", and its incorrect usage. SO is not the good place for asking for such help, you should include more details regarding construction and training of `classifier` and repost this question to ai.stackexchange.com or cross-validated.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21748254

http://stackoverflow.com/comment/32965209
type: AnswerComment
has text: Hm, okay. I'm thinking about setting it up so that the functions take variables for the image placement, and they redraw everytime draw() runs. I feel like that would be kind of cpu intensive for how simple the program should be.
comment on: http://stackoverflow.com/a/21781788
type: Comment
score: 0

http://stackoverflow.com/q/21831118
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/21833142
tagged with: javascript
favorite count: 0
has answer: http://stackoverflow.com/a/21831187
has answer: http://stackoverflow.com/a/21849660
has answer: http://stackoverflow.com/a/21831157
answer count: 4
has body: <% HttpSession s = request.getSession(); s.setAttribute("user", userLogin.getUsername()); String itemCode = (String) s.getAttribute("user"); %> MembersList function test() { alert(<%out.println(itemCode);%>); } In my example, the alert does not appear. I'm trying to print to the java variable in a javascript alert in a JSP page.
type: UnansweredQuestion
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33042566
tagged with: alert
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33041949
has title: How to display java variable in javascript?

http://stackoverflow.com/comment/32889528
type: Comment
type: QuestionComment
has text: Do you have to use `SpringLayout`?
comment on: http://stackoverflow.com/q/21745118
score: 0

http://stackoverflow.com/comment/32902714
type: QuestionComment
comment on: http://stackoverflow.com/q/21752628
has text: Could you show the code for you GUI? (the relevant parts)
score: 0
type: Comment

http://stackoverflow.com/q/21798312
has body: I readed a lot about putExtra but my application still doesn´t works(applicaton shutdown) I just want to send my string value in my editText from the MainActivity to the AnotherActivity textView. Here is my MainActivity.java. public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText et = (EditText)findViewById(R.id.tv); Button bn = (Button)findViewById(R.id.button1); bn.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { Intent intent = new Intent(getApplicationContext(), AnotherActivity.class); intent.putExtra("text", et.getText().toString()); startActivity(intent); } }); }} Here is my activity_main.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: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;EditText android:id="@+id/et" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignRight="@+id/button1" android:ems="10" android:inputType="text" android:text="@string/hello_world" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/et" android:layout_marginLeft="18dp" android:text="@string/hello_world" /&gt; Here is my AnotherActivity.java enter code here public class AnotherActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.l…
tagged with: string
type: Question
type: AnsweredQuestion
tagged with: android
tagged with: send
accepted answer: http://stackoverflow.com/a/21798369
answer count: 1
has title: How to use putExtra and putIntent for string
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21798369
has comment: http://stackoverflow.com/comment/32983874

http://stackoverflow.com/a/21840931
has body: Look at How to display line graph using JFreeChart in jsp? and build your solution around createXYLineChart. For database access there is already a JDBCXYDataset. XYDataset supports multiple series of data while the CategoryDataset you are useing does not (as far as I know).
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21840448
downvote count: 0
type: Answer

http://stackoverflow.com/a/21779219
answers question: http://stackoverflow.com/q/21779145
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21779145
has body: In general if you are changing the behavior of the object then you may be implementing the Strategy Pattern not the Observer Pattern. Modifying the model itself in response to observed events on it can lead to very complicated behavior so I wouldn't really recommend it but it is valid. Generally try to think about the "flow" of data and operations through your system. If you can make the flow always go in one direction (or at least have as few loops as possible) then the whole thing becomes a lot more simple to manage and understand. Adding an observer is "down flow" from the original data. If that observer then goes back and modifies the original data then that is flowing upstream and makes the behavior of your whole program a lot more complicated. For example what happens if that change then triggers another event, which then comes back into the same observer again, etc? Someone tracing through the execution is going to find unexpected data changes until they find that observer and you run into the potential for recursive loops that stack overflow and all sorts of similar fun and games.

http://stackoverflow.com/a/21692457
has body: From your code I see exceptions are already being thrown by Java run time. You have to handle them and show appropriate error message to the user. However, right thing to do is to validate the user input before executing the expression. That will avoid making the call, getting the exception and handling it later. Validate the user inputs and show a message to the user if the inputs are not correct.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21692390
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21692390
has comment: http://stackoverflow.com/comment/32795871
type: Answer

http://stackoverflow.com/comment/32911986
comment on: http://stackoverflow.com/q/21757897
has text: Just for the record; outside your programming errors, your derivative `df` is also wrong. ;)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32879915
comment on: http://stackoverflow.com/a/21735516
has text: `TDistribution t = new TDistribution(5); double value = t.inverseCumulativeProbability((1-0.9545) / 2);` Produces the correct result, but in negative. I imagine that I can simply flip it to positive whenever this produces a negative value. Correct?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33026025
comment on: http://stackoverflow.com/a/21778268
has text: how it decides which beans should be instantiated ?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21781975
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/32954945
answers question: http://stackoverflow.com/q/21781920
has body: You can do joins in UPDATE statements. UPDATE L SET L.Playcount = P.Playcount FROM Playlist P INNER JOIN LibraryTable L ON P.SongID = L.SongID
accepted answer of: http://stackoverflow.com/q/21781920
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/33055230
type: Comment
type: QuestionComment
score: 1
has text: See http://stackoverflow.com/questions/5315330/matching-e-g-a-unicode-letter-with-java-regexps for why your regex isn't quite sufficient. You need `\p{L}\p{M}*`
comment on: http://stackoverflow.com/q/21838164

http://stackoverflow.com/a/21790405
type: Answer
answers question: http://stackoverflow.com/q/21790347
has body: This all depends on what you're comparing. The reason to override compareTo is to define a custom ordering for your Object. The contract for compareTo(Object another) is that you must return: a negative integer if this instance is less than another; a positive integer if this instance is greater than another; 0 if this instance has the same order as another. So if you have a student and you want to sort by their age, and you have an integer age field, you could just use Integer.compare(age, another.age) as shown above. If your requirements are more complicated, you just have to define your logic for what determines the natural ordering of your objects.
score: 0

http://stackoverflow.com/comment/32906108
comment on: http://stackoverflow.com/q/21754607
has text: The SQL statements map together - So I call select * from a specific database, then for the value at each line of the result set for a specific column (which is read from a JTable) I then call a different SQL statement after each line is read, using the value obtained from the desired column to retrieve the records required
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32853711
comment on: http://stackoverflow.com/a/21721607
type: Comment
has text: By using decimal format i am able to do it now.thank you all for your help.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32958099
type: Comment
comment on: http://stackoverflow.com/a/21778065
score: 0
type: AnswerComment
has text: i will clarify to you the steps to do , when you add a row to jtable in reality you are adding row to your txt file , so you have to get data from you file and then add it to object with two dimensions so you have to repeat your first code to get the news object[][] after that you add your object to the model with this method : model.setDataVector(data, header); then add your model to your jtable as bellow jtable1.setmodel(model); it's so easy just follow the logic of code

http://stackoverflow.com/comment/32970545
type: AnswerComment
has text: @MarkW Yes, as long as you can load Java 64 bit from 32 bit Eclipse there is no problem. (Some libraries have associated native plugins though - that's why I suggested 64 bit Eclipse also)
comment on: http://stackoverflow.com/a/21788872
type: Comment
score: 0

http://stackoverflow.com/comment/32980393
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21796121
type: Comment
has text: is der any other way of doing this?

http://stackoverflow.com/q/21802694
has title: Java connection to database
favorite count: 0
has comment: http://stackoverflow.com/comment/32991840
has answer: http://stackoverflow.com/a/21802854
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has body: I have exhausted all avenues to sort out this problem, but to no avail. I have installed "SQL Management Studio 2012" and created a dummy database and methods, but I'm still getting a "null point exception pointer". Java and JDBC is set under user variables. Here are the screen shots and code. Static { // standard code to open a connection and statement to SQL Server database try { // Create a variable for the connection string. String connectionUrl = "jdbc:sqlserver://SQL-SERVER;" + "databaseName=ItunesDB;integratedSecurity=true;"; // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); con = DriverManager.getConnection(connectionUrl); } // Handle any errors that may have occurred. catch (SQLException sqle) { System.out.println("Sql Exception :" + sqle.getMessage()); } catch (ClassNotFoundException e) { System.out.println("Class Not Found Exception :" + e.getMessage()); } } public static String listAll() { String output = ""; try { stmt = con.createStatement(); ResultSet res = stmt.executeQuery("SELECT * FROM LibraryTable"); while (res.next()) { // there is a result // the name field is the thrid one in the ResultSet // Note that with ResultSet we count the fields starting from 1 output += res.getString(1) + " " + res.getString(2) + " - " + res.getString(3) + " " + res.getString(4) + " " + res.getString(5) + "\n"; } } catch (Exception e) { System.out.println(e); return null; } return output; } public static String getName(String key) { try { SELECT * FROM LibraryTable WHERE key = '04' stmt = con.createStatement(); ResultSet res = stmt.executeQuery("SELECT * FROM LibraryTable WHERE ID = '" + key + "'"); if (res.next()) { // there is a result // the name field is the second one in the ResultSet // Note that with ResultSet we count the fields starting from 1 return res.getString(2); } else { return null; } } catch (Exception e) { System.out.println(e); return null; }`enter code here` The database information: Dummy Database ID Name …
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/33016791
type: Question
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/32991805

http://stackoverflow.com/comment/32948426
has text: @kleopatra I wasn't able to correct my answer to your standards. Please consider ansering this question for a bounty (not that points are of major importance to you) ad I would love to see your approach to this. Or for anyone else who wants to take on this challenge, feel free!
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21723025
type: Comment

http://stackoverflow.com/comment/32912915
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21758112
has text: @DanielBarbarian I am not sure you understood the question correctly. For the modules, the correct JRE is chosen, the problem only occurs when I want to build the "parent" project. (Actually, so far the relation is only one way: The aggregator project defines modules, but the modules do not define a parent project.) Do you really think the configuration of the modules matters?

http://stackoverflow.com/a/21747952
has body: As @M.Deinum noticed in his comment: There is no bean of the type EmbeddedDatabase there is a DataSource. The embedded-database eventually creates a DataSource not an EmbeddedDatabase.
answers question: http://stackoverflow.com/q/21732187
score: 0
type: Answer

http://stackoverflow.com/q/21723474
tagged with: java
has body: I have a problem with Android sqlite and cursor, I want to verify that the value entered in a text box is not in my database. ContenuBDD contenuBdd = new ContenuBDD(MainActivity.this); contenuBdd.open(); if(contenuBdd.recherche(text.getText().toString())== true) { System.out.println("ok"); } else { System.out.println("not ok"); } contenuBdd.close(); code of search method : public boolean recherche(String titre){ Cursor c = bdd.query(TABLE_CONTENU, new String[] {COL_ID, COL_VALEUR}, COL_VALEUR + " LIKE \"" + titre +"\"", null, null, null, null); if(c == null) { return true; } else { return false; } } For now, even if I enter a value that is not in the database, "not ok" is displayed my request : String query = new String( "select valeur from table_contenu where valeur = "+titre); my logcat : 02-12 10:51:02.338: E/AndroidRuntime(11642): android.database.sqlite.SQLiteException: near "=": syntax error (code 1): , while compiling: select valeur from table_contenu where valeur =
has comment: http://stackoverflow.com/comment/32850527
has answer: http://stackoverflow.com/a/25380714
type: Question
has comment: http://stackoverflow.com/comment/32850931
has comment: http://stackoverflow.com/comment/32850690
score: 0
tagged with: sqlite
has answer: http://stackoverflow.com/a/21723610
has comment: http://stackoverflow.com/comment/32850815
has comment: http://stackoverflow.com/comment/39580132
has comment: http://stackoverflow.com/comment/32850790
has comment: http://stackoverflow.com/comment/32850621
has answer: http://stackoverflow.com/a/21723829
tagged with: android
has comment: http://stackoverflow.com/comment/32850689
answer count: 4
has title: Android SQLlite database search method
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25380400
linked to: http://stackoverflow.com/q/24142830
has comment: http://stackoverflow.com/comment/32850766

http://stackoverflow.com/comment/33035746
comment on: http://stackoverflow.com/a/21816316
type: Comment
score: 0
has text: If I take System.out.println outside the for it doesn't recognize the variable p my code for System.out.println is System.out.println("Person" + p.getFullName() + "is the oldest:" + p.getAge());
type: AnswerComment

http://stackoverflow.com/a/21747615
has body: If your object state is not going to serialized, then it doesn't matter else you will have to generate serialVersionUID everytime class structure changes (u can use eclipse default UID generation policy).
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/32929859
answers question: http://stackoverflow.com/q/21747238
has comment: http://stackoverflow.com/comment/32947950
upvote count: 1
score: 0

http://stackoverflow.com/a/21812457
has comment: http://stackoverflow.com/comment/138505276
has body: In general, synchronized methods are used to protect access to resources that are accessed concurrently. When a resource that is being accessed concurrently belongs to each instance of your class, you use a synchronized instance method; when the resource belongs to all instances (i.e. when it is in a static variable) then you use a synchronized static method to access it. For example, you could make a static factory method that keeps a "registry" of all objects that it has produced. A natural place for such registry would be a static collection. If your factory is used from multiple threads, you need to make the factory method synchronized (or have a synchronized block inside the method) to protect access to the shared static collection. Note that using synchronized without a specific lock object is generally not the safest choice when you are building a library to be used in code written by others. This is because malicious code could synchronize on your object or a class to block your own methods from executing. To protect your code against this, create a private "lock" object, instance or static, and synchronize on that object instead.
answers question: http://stackoverflow.com/q/21812396
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/138504987
type: Answer
upvote count: 114
score: 114
accepted answer of: http://stackoverflow.com/q/21812396

http://stackoverflow.com/comment/32951111
comment on: http://stackoverflow.com/a/21780179
score: 0
type: AnswerComment
has text: so does this mean that it can take any kind of object, such as string, integer, double ...etc ?
type: Comment

http://stackoverflow.com/q/21743599
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24194189
accepted answer: http://stackoverflow.com/a/21743933
has title: how to remove JMenu.addSeparator() after it is being called
has comment: http://stackoverflow.com/comment/32887210
answer count: 2
has comment: http://stackoverflow.com/comment/32887339
downvote count: 0
has comment: http://stackoverflow.com/comment/32887514
has comment: http://stackoverflow.com/comment/32887181
favorite count: 0
has comment: http://stackoverflow.com/comment/32887294
has comment: http://stackoverflow.com/comment/32887156
has answer: http://stackoverflow.com/a/21743933
has body: Hello guys, I just want to ask something if is it possible to remove JMenu.addSeparator() after it is being called? for example in my form there is a menu bar and inside the menu bar lets say there are three JmenuItems and each of it has JMenu.addSeparator(). What i want to do is, if a different user is log in I want to setVisible(false) one of JMenuItem because that particular user in not authorize to use that JMenuItem. The problem is when I setVisible(false) one of the JMenuItem the JMenu.addSeparator() still exist which kinda awkward to watch since there are no JMenuItem exist in the middle of two JMenu.addSeparator(). Hope you can help me with this problem. Thanks in advance
score: 2
upvote count: 2
tagged with: java
tagged with: jseparator
tagged with: swing
tagged with: jmenu
possible better answer: http://stackoverflow.com/a/24194189

systemmenu
tags question: http://stackoverflow.com/q/21688814
tag name: systemmenu
type: Tag

http://stackoverflow.com/a/21688443
answers question: http://stackoverflow.com/q/21687815
type: Answer
has body: I have a Jtable of strings and I want to change the colour of certain cells according to their string value The same renderer is used for all cells so you need to reset the background every time. You will need an if condition in your custom renderer code. Something like: if (!isSelected) if (value.equals(...)) y.setBackground(new Color(255,0,0)); else y.setBackground(table.getBackground())
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/32791317

http://stackoverflow.com/q/21710493
tagged with: log4j
has comment: http://stackoverflow.com/comment/32827781
upvote count: 1
tagged with: logging
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: logback
has answer: http://stackoverflow.com/a/21710625
has body: Is there any way I can use SLF4J to only set my log files location at runtime and independently of logging framework? Because I already saw other posts that present a solution, but they are for a specific framework, either logbak or log4j.
downvote count: 0
answer count: 1
score: 1
favorite count: 0
tagged with: slf4j
has title: Changing log files location dynamically with SLF4J and independently of logging framework
accepted answer: http://stackoverflow.com/a/21710625

http://stackoverflow.com/comment/33005917
score: 0
type: Comment
type: QuestionComment
has text: thanks for your input, I provided the solution as an answer.
comment on: http://stackoverflow.com/q/21782378

http://stackoverflow.com/comment/32947457
has text: you need a plugin to read your text and synthesize some voice to create an audio file or stream for you.
comment on: http://stackoverflow.com/q/21777884
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32805320
type: Comment
comment on: http://stackoverflow.com/a/21696239
has text: your code is very direct. Though its helpful. Still i could not solve my issue. It will be helpful if you can demonstrate with an example
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32889792
has text: i am working in eclipse. and there is no Weblogic.xml file in my project,should i create a new one??
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21724319

http://stackoverflow.com/a/21698792
type: Answer
accepted answer of: http://stackoverflow.com/q/21698695
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32813539
type: AcceptedAnswer
downvote count: 0
has body: The code passes a reference of the same instance of Issue to both instances of one and two. Title one = new Title(name, beginn, new LocalDate(1922, 6, 5)); Issue morningIssue = new Issue("Morning issue", true, true, true, true, true, true, false); morningIssue.setExclusions(geschlossen); one.addIssue(morningIssue); one.optimise(); Title two = new Title(name, new LocalDate(1922, 6, 6), nameChange.minusDays(1)); two.addIssue(morningIssue); Since both Title instances refer to the same Issue instance calling optimize() modifies the same instance of Issue that one and two have references to.
answers question: http://stackoverflow.com/q/21698695

http://stackoverflow.com/comment/32996078
has text: with -keep class ru.ensemplix.** { *; } i have same problem
comment on: http://stackoverflow.com/a/21802777
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32971789
comment on: http://stackoverflow.com/q/21790781
score: 0
type: QuestionComment
has text: Also, why is the line just before the while loop clearing the entire document's highlighting as I expect it to? I thought that when I used that method it would make everything black again then the matcher would find hellos in the string
type: Comment

http://stackoverflow.com/q/21813851
has body: This is the code I written but width is not setting for VBox items. I'm getting all the panels same size. I need some help. private void initComponents() { this.setPadding(new Insets(0,70,0,70)); this.setSpacing(10); red1 = new StackPane(); red1.setStyle("-fx-background-color:red;"); red1.setPrefHeight(60); red1.setPrefWidth(260); this.setVgrow(red1, Priority.ALWAYS); this.getChildren().add(red1); red2 = new StackPane(); red2.setStyle("-fx-background-color:red;"); red2.setPrefHeight(60); red2.setPrefWidth(240); this.setVgrow(red2, Priority.ALWAYS); this.getChildren().add(red2); } private StackPane red1; private StackPane red2; }
type: Question
tagged with: vbox
score: 1
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/21821559
answer count: 1
downvote count: 0
has title: width is not setting for javafx VBox items?
favorite count: 0
accepted answer: http://stackoverflow.com/a/21821559
tagged with: javafx-2
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/a/21727480
has comment: http://stackoverflow.com/comment/32859888
has comment: http://stackoverflow.com/comment/32865525
has comment: http://stackoverflow.com/comment/32858156
score: 0
has comment: http://stackoverflow.com/comment/32859541
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32857891
has comment: http://stackoverflow.com/comment/32858000
has comment: http://stackoverflow.com/comment/32862267
downvote count: 1
has comment: http://stackoverflow.com/comment/32856993
has comment: http://stackoverflow.com/comment/32857677
has comment: http://stackoverflow.com/comment/32862610
has comment: http://stackoverflow.com/comment/32863022
has comment: http://stackoverflow.com/comment/32859450
answers question: http://stackoverflow.com/q/21727346
has body: Try This double d = 4.85999999999; long l = (int)Math.round(d * 100); // truncates d = l / 100.0;

http://stackoverflow.com/q/21773472
has title: how to make DB connection in Ear project with mysql hibernate with glassfish 4.0
has comment: http://stackoverflow.com/comment/32939972
tagged with: glassfish
has body: I am trying to add multiple war files in an ear file and when I am running the application I get below error. WARNING: RAR5038:Unexpected exception while creating resource for pool DerbyPool. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: A network protocol error was encountered and the connection has been terminated: A PROTOCOL Data Stream Syntax Error was detected. Reason: 0x3. Plaintext connection attempt to an SSL enabled server? WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ DerbyPool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: A network protocol error was encountered and the connection has been terminated: A PROTOCOL Data Stream Syntax Error was detected. Reason: 0x3. Plaintext connection attempt to an SSL enabled server? WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Connection could not be allocated because: A network protocol error was encountered and the connection has been terminated: A PROTOCOL Data Stream Syntax Error was detected. Reason: 0x3. Plaintext connection attempt to an SSL enabled server?]
has comment: http://stackoverflow.com/comment/32940936
has comment: http://stackoverflow.com/comment/32941934
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question

http://stackoverflow.com/q/21711839
answer count: 1
tagged with: arrays
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32830954
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21712337
has comment: http://stackoverflow.com/comment/32830551
has comment: http://stackoverflow.com/comment/32831595
has title: Remove lines from one-dimensional Array
tagged with: java
has body: I need to remove a whole few lines and separate a data sheet from a URL to fix what I need to print. What do I need to use? So far, I have this: while (input.hasNext()) { String line = input.nextLine(); //String trimStr = line.trim(); StringTokenizer tokenizer = new StringTokenizer(line, " , "); int numberOfTokens = tokenizer.countTokens(); String[] splitArr = new String[numberOfTokens]; for (int i=0; i&lt;numberOfTokens; i++) splitArr[i]=tokenizer.nextToken(); System.out.println(Arrays.toString(splitArr)); I have a whole data list from a URL. How do I remove like 10 lines out of 20 so that is not shown in the output. Input is the URL site in print view. Expected Output is: STATION: DENVER, CO MONTH: JUNE YEAR: 2012 Day Min &lt;----(Minimum temperature) 1 59 2 51 3 34 4 26 5 28 6 34 7 42 8 31 9 31 10 37 11 38 etc......
type: Question
has comment: http://stackoverflow.com/comment/32830765
has comment: http://stackoverflow.com/comment/32831114

http://stackoverflow.com/q/21815289
tagged with: conventions
has answer: http://stackoverflow.com/a/21815328
type: AnsweredQuestion
has body: I understand that Java ignores indentation and that curly-brace hierarchies are recommended to increase readability of code. I come from Python with decent experience and I am learning Java right now. I am completely new to Java and I don't yet know the "Good Coding Practice" that comes with writing while loops. Here are 2 ways to create a basic while loop: while ( booleanCondition = true ) { // do stuff } And the second way: while (booleanCondition = true ) { // do stuff } I am not one for splitting hairs over the number of lines of code, so the fact that the first loop is one line shorter is irrelevant to me. Personally, I like the second better because the loop is left-justified with only the condition on the top line. However, I don't want to start using this format if it is not recommended for Good Practice. Is the first way to do the while loop more/less recommended? What is the most common format if there is one?
tagged with: java
has answer: http://stackoverflow.com/a/21815395
possible better answer: http://stackoverflow.com/a/21815328
has answer: http://stackoverflow.com/a/21815317
type: Question
has answer: http://stackoverflow.com/a/21815439
has answer: http://stackoverflow.com/a/21815407
score: -1
has title: Where to put braces in Java While loop?
tagged with: while-loop
accepted answer: http://stackoverflow.com/a/21815317
favorite count: 0
answer count: 5
downvote count: 2
upvote count: 1

http://stackoverflow.com/q/21761914
tagged with: ios
possible better answer: http://stackoverflow.com/a/21761974
has answer: http://stackoverflow.com/a/21762929
has answer: http://stackoverflow.com/a/21761974
has comment: http://stackoverflow.com/comment/32919665
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21762929
tagged with: objective-c
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32919037
tagged with: android
has title: Position Of Views in Android vs iOS?
has comment: http://stackoverflow.com/comment/32920038
type: AnsweredQuestion
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/32919057
tagged with: java
has comment: http://stackoverflow.com/comment/32919688
type: Question
has body: I am new to Android development. I have been working in iOS since long. As in iOS when we want to put VIEW on xib on some exact position, we simply put it there, drag it up to that point. For example say Two buttons at lower area in iOS, which look like below As, I simply want them in middle, I will put them their. as below Now same thing in Android environment, I go for following code, <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/myAwesomeTextView" android:layout_width="wrap_content" android:layout_height="1dip" android:layout_centerInParent="true" android:text="Veer Suthar" /> <TextView android:id="@+id/myAwesomeTextView1" android:layout_width="wrap_content" android:layout_height="100dip" android:layout_below="@id/myAwesomeTextView" android:layout_centerInParent="true" /> It shows Activity Screen, like below Now If I want to drag buttons, using GRAPHICAL LAYOUT, I can't move them as I want, and for spacing to put them into lower area, I need to put extra TextView . Is there any better way to organise Android Activity GUI properly, like iOS?

http://stackoverflow.com/comment/32882712
type: Comment
comment on: http://stackoverflow.com/a/21741085
has text: I can see how to compare two things, but how can I sort by 3 things?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32964993
type: QuestionComment
has text: what's the output of `which java`?
comment on: http://stackoverflow.com/q/21787198
score: 0
type: Comment

macos
tags question: http://stackoverflow.com/q/21779136
tags question: http://stackoverflow.com/q/21764824
tags question: http://stackoverflow.com/q/21731754
tags question: http://stackoverflow.com/q/21799119
tags question: http://stackoverflow.com/q/21698917
tags question: http://stackoverflow.com/q/21792332
tags question: http://stackoverflow.com/q/21822268
tags question: http://stackoverflow.com/q/21721969
tags question: http://stackoverflow.com/q/21726216
tags question: http://stackoverflow.com/q/21804233
tags question: http://stackoverflow.com/q/21796238
type: Tag
tags question: http://stackoverflow.com/q/21698317
tags question: http://stackoverflow.com/q/21814778
tags question: http://stackoverflow.com/q/21688823
tags question: http://stackoverflow.com/q/21763243
tags question: http://stackoverflow.com/q/21809860
tag name: macos
tags question: http://stackoverflow.com/q/21739139
tags question: http://stackoverflow.com/q/21759781
tags question: http://stackoverflow.com/q/21798275
tags question: http://stackoverflow.com/q/21837462

http://stackoverflow.com/comment/33203400
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21758597
has text: The tanuki wrapper does not allow "free" use in a 64 bit environment; their paid version does. If you stick with 32 bit java you should be fine.
score: 0

http://stackoverflow.com/a/21782104
score: 4
upvote count: 4
downvote count: 0
has body: No; there is not a new thread for each incoming message; it has a thread per consumer. If you use a ThreadPool executor, it needs to have enough threads for the configured number of consumers. The default task executor is usually sufficient. The consumer thread invokes your listener; if your listener takes, on average 1 second to process a message, then with a concurrency of 1, your max throughput is 1 per second; concurrency of 2, 2 per second. Etc, etc.
type: Answer
answers question: http://stackoverflow.com/q/21779690

http://stackoverflow.com/comment/32893518
type: Comment
comment on: http://stackoverflow.com/q/21747363
type: QuestionComment
has text: Why don't you post the error...?
score: 0

http://stackoverflow.com/comment/32912215
type: Comment
type: QuestionComment
score: 0
has text: @Keppil simply google "why java site:stackoverflow.com"
comment on: http://stackoverflow.com/q/21758081

http://stackoverflow.com/a/21796216
accepted answer of: http://stackoverflow.com/q/21796141
upvote count: 1
has body: I do not know what in which pattern you want but I tried in my way This code is for Thu, 13 Feb 2014 13:03:50 GMT format String DateStr="Thu, 13 Feb 2014 13:03:50 GMT"; SimpleDateFormat sim=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date d = new SimpleDateFormat("EEE,dd MMM yyyy HH:mm:ss").parse(DateStr); System.out.println(sim.format(d)); output 2014/02/13 13:03:50 And the following code is for 13 Feb 2014 13:03:50 GMT format String DateStr="13 Feb 2014 13:03:50 GMT"; SimpleDateFormat sim=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date d = new SimpleDateFormat("dd MMM yyyy HH:mm:ss").parse(DateStr); System.out.println(sim.format(d)); output 2014/02/13 13:03:50
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32980489
answers question: http://stackoverflow.com/q/21796141
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33023562
has comment: http://stackoverflow.com/comment/33029365
has comment: http://stackoverflow.com/comment/33029500
has comment: http://stackoverflow.com/comment/32984380

http://stackoverflow.com/comment/32955945
type: AnswerComment
type: Comment
has text: Just fyi, you can also try adding the dependencies using Maven. http://maven.apache.org/ . The advantage is that Maven resolve the dependencies for you. you can read more about Maven and try out your same project with Maven, instead of adding jars to the lib folder yourself.
comment on: http://stackoverflow.com/a/21734385
score: 0

http://stackoverflow.com/comment/32959429
comment on: http://stackoverflow.com/a/21784369
type: Comment
type: AnswerComment
has text: I've tried setting the z-index, but it didn't work, as I have no control over the source of the facebook page
score: 0

titanium
type: Tag
tag name: titanium
tags question: http://stackoverflow.com/q/21798063

http://stackoverflow.com/a/21736156
downvote count: 0
has body: AtTask uses lazy loading of return fields with only a small subset of fields returned by default. You can specify which fields you want in your result by passing a comma-separated list of field names as the fields parameter like this: https://mydomain.com/attask/api/company?id=52cc12f0000b053291be85eb0fb10da0&amp;method=get&amp;fields=name,entryDate Which will return the name and entryDate of the company record.
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32885996
answers question: http://stackoverflow.com/q/21683335
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21683335
type: Answer

http://stackoverflow.com/a/21802768
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21802616
has comment: http://stackoverflow.com/comment/32992064
type: Answer
upvote count: 1
has body: Here is some information on where to start from: Step #1 - Download and use the following JAR files in your project: selenium-java-2.xx.0.jar selenium-server-standalone-2.xx.0.jar At present, xx is 39. Step #2 - Emulate a client browser in order to access the web-page, using the following example class: import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; class MyClass { private WebDriver webDriver = null; public void open() throws Exception { webDriver = new FirefoxDriver(); } public void close() throws Exception { webDriver.quit(); } public void doStuff(String url) throws Exception { webDriver.get(url); // Use 'webDriver' in order to access the web-page, for example: WebElement inputBox = webDriver.findElement(By.id("someInputBox")); WebElement inputBtn = webDriver.findElement(By.id("someInputBtn")); inputBox.sendKeys("myUserId"); inputBtn.click(); String pageSource = webDriver.getPageSource(); ... } }

http://stackoverflow.com/comment/32892637
has text: @akash you don't need to `trim` `cell.toString()` its already _trimmed_ . you need to `trim()` each `elements` inside the `list`
score: 1
comment on: http://stackoverflow.com/q/21746724
type: QuestionComment
type: Comment

callable
tags question: http://stackoverflow.com/q/21836211
type: Tag
tags question: http://stackoverflow.com/q/21784102
tag name: callable

instantiation
type: Tag
tags question: http://stackoverflow.com/q/21741405
tags question: http://stackoverflow.com/q/21705769
tags question: http://stackoverflow.com/q/21686970
tags question: http://stackoverflow.com/q/21781911
tag name: instantiation

http://stackoverflow.com/q/21753162
accepted answer: http://stackoverflow.com/a/21753255
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21753255
has answer: http://stackoverflow.com/a/21753240
tagged with: android
type: AnsweredQuestion
has title: Is it possible to merge these two methods in one, possibly using.. polymorphism?
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21753240
has body: In my android application I have ItemCategory POJO and ItemSubcategory POJO that both extend Category POJO holding some common characteristics. I have a custom Load Spinner method that I pass an ArrayList of Objects to, and it loads them into a spinner (the Android name for drop-down/select) I tried passing an ArrayList to a single method loadCategoriesIntoSpinner( that accepts an ArrayList as a parameter) and I expected it to sort out that what Im passing is an ArrayList but it didnt. public static void loadCategoriesIntoSpinner(Context context, ArrayList&lt;ItemCategory&gt; array, Spinner spinner) { // Creating adapter for spinner ArrayAdapter&lt;ItemCategory&gt; dataAdapter = new ArrayAdapter&lt;ItemCategory&gt;(context, R.drawable.simple_spinner_item, array); // Drop down layout style - list view with radio button dataAdapter .setDropDownViewResource(R.drawable.simple_spinner_dropdown_item); // Attaching data adapter to spinner spinner.setAdapter(dataAdapter); } public static void loadSubcategoriesIntoSpinner(Context context, ArrayList&lt;ItemSubcategory&gt; array, Spinner spinner) { // Creating adapter for spinner ArrayAdapter&lt;ItemSubcategory&gt; dataAdapter = new ArrayAdapter&lt;ItemSubcategory&gt;(context, R.drawable.simple_spinner_item, array); // Drop down layout style - list view with radio button dataAdapter .setDropDownViewResource(R.drawable.simple_spinner_dropdown_item); // Attaching data adapter to spinner spinner.setAdapter(dataAdapter); } Here are the Category objects: Main class Category: abstract public class Category { private int id; 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; } @Override public String toString() { return this.name; } } // End of Class inheriting class ItemCategory public class ItemCategory extends Category { private String logo; public String getLogo() { return logo; } public vo…

http://stackoverflow.com/q/21694805
has answer: http://stackoverflow.com/a/21695854
has comment: http://stackoverflow.com/comment/32802158
upvote count: 2
type: UnansweredQuestion
tagged with: android
has title: I used the getHostAddress() with try- catch, but when I run this it just doesnt run What is wrong in this?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32800740
linked to: http://stackoverflow.com/q/2416316
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32800403
has comment: http://stackoverflow.com/comment/32799773
has body: public class MainA extends Activity { WifiManager wifi=(WifiManager)getSystemService(Context.WIFI_SERVICE); WifiInfo info=wifi.getConnectionInfo(); String ip; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button bt=(Button)findViewById(R.id.b1); try{ InetAddress ownIP=InetAddress.getLocalHost(); ip=ownIP.getHostAddress(); //System.out.println("IP of my Android := "+ownIP.getHostAddress()); }catch (Exception e){ //System.out.println("Exception caught ="+e.getMessage()); } bt.setOnClickListener(new OnClickListener(){ public void onClick(View v) { // TODO Auto-generated method stub TextView tv1=(TextView)findViewById(R.id.tv1); tv1.setText(ip); } }); } } It stops with the dialog, should I use other method or any other way of using it.I used the getHostAddress() with try- catch, but when I run this it just doesnt run What is wrong in this?
answer count: 1
favorite count: 0

http://stackoverflow.com/q/21712652
upvote count: 2
has comment: http://stackoverflow.com/comment/32850888
has title: switch behaviour - java
accepted answer: http://stackoverflow.com/a/21712709
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 1
tagged with: switch-statement
has comment: http://stackoverflow.com/comment/32850335
type: Question
answer count: 2
has body: Why doens't the following code throw a runtimeException? public class Test2 extends Test { public static void main(String[] args) { char[] array = new char[]{'A', '\t', 'e', 'I', 'O', 'u', '\n', 'p'}; int count = 0; for (char c : array) { switch (c) { case 'A': continue; case 'E': count++; break; case 'I': count++; continue; case 'o': break; case 'u': count++; continue; } } System.out.println("length of array: " + array.length); System.out.println("count= " + count); } } notice that 'E' and 'e' isn't equal and it is in the switch.. The same for 'p'. It does compile and run en prints: length of array: 8 count= 2 I completed my OCA certificate today and got the above question. But I can't figure out why it doesn't throw a runtime when 'e' or 'p' is checked.. This means there is an empty "default" in every switch or something?
possible better answer: http://stackoverflow.com/a/21712744
has comment: http://stackoverflow.com/comment/32832027
has comment: http://stackoverflow.com/comment/32832138
has answer: http://stackoverflow.com/a/21712744
has comment: http://stackoverflow.com/comment/32857447
has answer: http://stackoverflow.com/a/21712709
favorite count: 0

http://stackoverflow.com/comment/125390825
has text: Links no longer work, can you provide valid link or sample code please
type: Comment
comment on: http://stackoverflow.com/a/21811336
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33253766
comment on: http://stackoverflow.com/a/21772362
type: AnswerComment
has text: Turns out the savedInstanceState i was assuming is not null only on screen orientation situations, i did not antecipate i would run not null! How can i diferenciate between orientation changes and other kinds of changes?
type: Comment
score: 0

http://stackoverflow.com/comment/33051551
score: 0
type: AnswerComment
has text: Hi Manish, I analyzed your answer and your sample project on Github. I edited my question a while ago by adding some details to it, because I suppose that you didn't understand what I had previously meant in my question. I forked your repository and made a small change to it in order to show you what I meant in my question: [https://github.com/krzysztof-michalski/maven-multi-module](forked example). I added a reference to the Greeter class from the implementation module in the GreetingService class in the sample-service module. Just uncomment that line and run maven build to see the error.
comment on: http://stackoverflow.com/a/21770757
type: Comment

gwt
tags question: http://stackoverflow.com/q/21771982
tags question: http://stackoverflow.com/q/21824367
tags question: http://stackoverflow.com/q/21781675
tags question: http://stackoverflow.com/q/21734020
tags question: http://stackoverflow.com/q/21724166
tags question: http://stackoverflow.com/q/21682666
tag name: gwt
tags question: http://stackoverflow.com/q/21771831
tags question: http://stackoverflow.com/q/21775370
tags question: http://stackoverflow.com/q/21758811
tags question: http://stackoverflow.com/q/21734117
type: Tag
tags question: http://stackoverflow.com/q/21747986
tags question: http://stackoverflow.com/q/21767731
tags question: http://stackoverflow.com/q/21700988
tags question: http://stackoverflow.com/q/21699200
tags question: http://stackoverflow.com/q/21828476
tags question: http://stackoverflow.com/q/21686978
tags question: http://stackoverflow.com/q/21719444
tags question: http://stackoverflow.com/q/21776941
tags question: http://stackoverflow.com/q/21828751
tags question: http://stackoverflow.com/q/21702971
tags question: http://stackoverflow.com/q/21799640
tags question: http://stackoverflow.com/q/21748079
tags question: http://stackoverflow.com/q/21702198
tags question: http://stackoverflow.com/q/21811347
tags question: http://stackoverflow.com/q/21828269
tags question: http://stackoverflow.com/q/21753656
tags question: http://stackoverflow.com/q/21758437
tags question: http://stackoverflow.com/q/21750203
tags question: http://stackoverflow.com/q/21758400
tags question: http://stackoverflow.com/q/21763096
tags question: http://stackoverflow.com/q/21697881

http://stackoverflow.com/q/21719208
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/32843485
has comment: http://stackoverflow.com/comment/32848475
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/32843621
has comment: http://stackoverflow.com/comment/32844019
has comment: http://stackoverflow.com/comment/32843427
has comment: http://stackoverflow.com/comment/32843511
has answer: http://stackoverflow.com/a/21720084
answer count: 1
has comment: http://stackoverflow.com/comment/32843801
has body: public class DateCreation { public static void main(String[] args) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String format = sdf.format(date); System.out.print("date is:"+format); } } This is working fine and output is: date is:2014-02-11 But when I use same syntax in Service layer of spring MVC than it results as: date is:????-??-?? Here is code in spring. There is an @Override function in which I have used it. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String format = sdf.format(date); logger.info("current date is:"+format); What could be the error?
has comment: http://stackoverflow.com/comment/32843502
tagged with: date-format
has comment: http://stackoverflow.com/comment/32843940
has comment: http://stackoverflow.com/comment/32843665
has title: Date Format not working in service class of spring?
score: 0
has comment: http://stackoverflow.com/comment/32843430
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32844243
has comment: http://stackoverflow.com/comment/32843955

http://stackoverflow.com/q/21824367
answer count: 1
has answer: http://stackoverflow.com/a/21854413
downvote count: 0
tagged with: playn
has title: Add plugin to a PlayN project
favorite count: 0
tagged with: plugins
tagged with: gwt
type: AnsweredQuestion
score: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/21854413
tagged with: java
type: Question
has body: Is it possible to display a HTML page in a PlayN game? More generally, is it possible to add a plugin (native iOS code) to an iOS build of a PlayN project? (child browser, Accelerometer,..), same as the phonegap plugins ? Thank you for your help.

http://stackoverflow.com/q/21761720
tagged with: listadapter
has body: I call a function createTheList that sends my layout, and array adapter. Then within the method I create my custom setListAdapter. Well, I want to change my list based on filters within my program. ie, if a person clicks a button, it shows a different list. So, I want to call the createTheList method again, and re-create the list while replacing my old list. I am having a real tough time figuring this out. If I call createTheList again with a different adapter, it just appends to the old list. Can anyone please walk me through this? public void createTheList(final int num, String[] Array ){ setListAdapter(new ArrayAdapter&lt;String&gt;(getActivity(), layoutName, R.id.myText, Array){ @Override public View getView(int position, View convertView, ViewGroup parent){ final View row = super.getView(position, convertView, parent); Button commentButton = (Button) row.findViewById(R.id.button1); Button missingButton = (Button) row.findViewById(R.id.button2); Button rideAlongButton = (Button) row.findViewById(R.id.button3); if (arrayOfShifts[position].getRideAlongCount()&gt;0 &amp;&amp; arrayOfShifts[position].positionOnList == position){ rideAlongButton.setVisibility(row.VISIBLE); } else{ rideAlongButton.setVisibility(row.GONE); } if (arrayOfShifts[position].getMissingCnt() &gt; 0 &amp;&amp; arrayOfShifts[position].positionOnList == position){ missingButton.setVisibility(row.VISIBLE); } else{ missingButton.setVisibility(row.GONE); } if (arrayOfShifts[position].getHasComment() &gt; 0 &amp;&amp; arrayOfShifts[position].positionOnList == position){ commentButton.setVisibility(row.VISIBLE); } else{ commentButton.setVisibility(row.GONE); } return row; } }); Where createTheList is being called from: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); layoutName = R.layout.fragtest1; //My values to call a function cache.put("Value1", "02-12-2014"); cache.put("Value2", 1); //getShifts method returns an array. String[] adapterArray = getShifts("GetSh…
answer count: 3
tagged with: android-listview
has comment: http://stackoverflow.com/comment/32918949
tagged with: android
has title: How can I replace my old list adapter with a new one on Android? It keeps appending new to old one
type: UnansweredQuestion
tagged with: android-arrayadapter
tagged with: java
has comment: http://stackoverflow.com/comment/32919274
has answer: http://stackoverflow.com/a/21762267
type: Question
has answer: http://stackoverflow.com/a/21762425
score: 0
has answer: http://stackoverflow.com/a/21762470
has comment: http://stackoverflow.com/comment/32919437

http://stackoverflow.com/a/21990392
has body: I got answer after reading some of PDFLib examples, posting below one for your reference PDFLib Example You can use this to generate output related to your standard.
type: Answer
accepted answer of: http://stackoverflow.com/q/21826843
answers question: http://stackoverflow.com/q/21826843
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/21690429
downvote count: 0
has answer: http://stackoverflow.com/a/21690699
tagged with: rest
possible better answer: http://stackoverflow.com/a/22925662
tagged with: azure
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22925662
has body: we are working on our graduation project project that has two main block 1- A website that is written in ASP.NET 2- A webservice that access the database (mySQL DB) , do some processing on data and communicate with that website to show the results. We are using a java library [Apache Mahout] in that webservice to help us do that processing and that's why we need to write this webservice in JAVA How can we create and host a Restful java webservice on Windows Azure ? What are the available options ? Also , Is it possible to start the processing and stop it depending on a request that is sent from the website or another block (another webservice for example) ? I hope the situation is now clear.I would appreciate if you could provide us with any resources that could help us understand how Restful java Webservice in Azure works :)
favorite count: 0
type: Question
answer count: 2
tagged with: web-services
has title: Creating Java Restful webservice on Windows Azure
accepted answer: http://stackoverflow.com/a/21690699
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/32779944
type: QuestionComment
comment on: http://stackoverflow.com/q/21683783
has text: Step 1: Format your code with consistent, reasonable indentation. *Edit*: I've done it for you on this occasion.
score: 2
type: Comment

http://stackoverflow.com/comment/43345829
type: Comment
type: QuestionComment
has text: hi. were you able to find a solution for this? i seem to be getting black screenshots as well (only for streamed video). When the video is already on the device, the screenshot is OK.
score: 0
comment on: http://stackoverflow.com/q/21698010

http://stackoverflow.com/comment/111051875
has text: 97 is the integer value of the 'a' character.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/61355878

http://stackoverflow.com/a/21710506
type: Answer
answers question: http://stackoverflow.com/q/21710168
has body: Closing a Scanner causes the underlying InputStream to be closed also. As there is only one System.in, any newly created Scanner objects will not be able to read from the same stream: keyboard.close(); Close the Scanner in the last.
score: 0

http://stackoverflow.com/comment/32818994
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21693868
type: AnswerComment
has text: What makes JNI inherently insecure?

http://stackoverflow.com/comment/33044026
type: Comment
has text: I tried calling it again. Still the same. The first print would be 0 and the second would be 1. (called again by Timer Class), still 0 and 1. @AndréStannek
type: AnswerComment
comment on: http://stackoverflow.com/a/21831958
score: 0

http://stackoverflow.com/a/21825563
upvote count: 8
has comment: http://stackoverflow.com/comment/33034376
has comment: http://stackoverflow.com/comment/33072028
has body: This is the error with MySQL. The most easy way to resolve &amp; avoid deadlocks is to reorder the DB operations happening in the application. Deadlock mostly occurs when more than one resource/connection try to acquire more than one lock at opposite orders, as below: connection 1: locks key(1), locks key(2); connection 2: locks key(2), locks key(1); In the scenario when both the connections execute at the same time, connection 1 will acquire lock on key(1), and connection 2 on key(2). After that both the connections will wait for other to release the lock on the key. This results in deadlock. But, a little tweak in the order of the transactions, then deadlocks can be avoided. connection 1: locks key(1), locks key(2); connection 2: locks key(1), locks key(2); Above re-order is deadlock proof. Other ways to avoid deadlocks is to have a transaction management mechanism. Transaction management by Spring is almost plug-n-play. Moreover, you can have a deadlock retry policy in place. An interesting deadlock retry via Spring AOP can be found here. This way you just need to add the annotation to the method you want to retry in case of deadlock. For more debug logs on deadlock to find out which statements are suspicious, try running the "show engine innodb status" diagnostics. Also, you can have a look at How to Cope with Deadlocks. UPDATE: A scenario for deadlocks in transactional DB operations. In a transactional database, a deadlock happens when two processes each within its own transaction updates two rows of information but in the opposite order. For example, process A updates row 1 then row 2 in the exact time-frame process B updates row 2 then row 1. Process A can't finish updating row 2 until process B is finished, but it cannot finish updating row 1 until process A finishes. No matter how much time is allowed to pass, this situation will never resolve itself and because of this database management systems will typically kill the transaction of the process that has …
has comment: http://stackoverflow.com/comment/33070695
has comment: http://stackoverflow.com/comment/33041409
score: 8
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21777205

uri
tags question: http://stackoverflow.com/q/21815525
tag name: uri
tags question: http://stackoverflow.com/q/21714679
tags question: http://stackoverflow.com/q/21746574
type: Tag
tags question: http://stackoverflow.com/q/21835709

http://stackoverflow.com/comment/33216955
comment on: http://stackoverflow.com/a/21781869
score: 0
type: AnswerComment
has text: So it turns out this was more or less it, the bit I was missing was that they thought I would be able to checkout the project from SVN, but I didn't in fact have access to that specific project. After that was done, I just needed to add it as module and then use that local snapshot version as dependency. Thanks for the answer!
type: Comment

http://stackoverflow.com/a/21832764
answers question: http://stackoverflow.com/q/21702971
upvote count: 1
has body: Finally I have found a solution which is good for me: I create a container with fixed size and an internal container which can spread inside it. The overflow of the top container is hidden. Thus, when I add next widget that cannot be displayed because it is out of the bounds of my top container - well, it is not displayed.. just because overflow is hidden. The only thing that remains is to insert a "SHOW MORE" widget. To do it I calculate whether the last inserted widget bounds are out of the bounds of top container. I.e. whether the last inserted widget overflows top container, or not. If yes, I insert "SHOW MORE" widget in place if previous (the one before last) widget. Thats it!
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21702971
type: Answer

http://stackoverflow.com/a/21760867
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32917104
upvote count: 1
answers question: http://stackoverflow.com/q/21760609
has body: More elegant way of doing that would be to pass just the node, since your nodelist is traversed through individual object. This way, you would avoid a redundant parameter. Also, you can make el a static String of the nodename which you want to capture: public static void parse(Node node) { NodeList children = node.getChildNodes(); for (int i = 0; i &lt; children.getLength(); i++) { Node currentNode = children.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) parse(currentNode); } if (node.getNodeName().equals(EL_NAME)) { System.out.println("This -&gt; " + node.getTextContent()); } }
has comment: http://stackoverflow.com/comment/32917262

http://stackoverflow.com/comment/32777754
score: 0
has text: I have PagerAdapter that extends BaseAdapter, but I do everything in a Fragment class which inflates different kind of views for every page. So, I need to call a method in this fragment from an Activity
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21682263

http://stackoverflow.com/a/21695710
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/21694887
upvote count: 1
answers question: http://stackoverflow.com/q/21694887
has body: Here is the partial code with comments: public class Tree { private Node root; public int findDepth(int searchNodeValue) { List&lt;Node&gt; nodesAtCurrentLevel = Collections.singletonList(root); return recursiveSearch(0, searchNodeValue, nodesAtCurrentLevel); } public int recursiveSearch(int level, int searchNodeValue, List&lt;Node&gt; nodesAtCurrentLevel) { List&lt;Node&gt; nodesAtNextLevel = new ArrayList&lt;Node&gt;(); // Check if searchNode matches any node at current level for (Node node : nodesAtCurrentLevel) { // If it matches, we have found the node, return current level if (node.getValue() == searchNodeValue) { return level; } // Add children of all nodes at current level in nodesAtNextLevel if (node.hasChildren()) { nodesAtNextLevel.addAll(node.getChildren()); } } // searchNode is not found at current level, increment level and continue search at next level if next level exists in tree if (!nodesAtNextLevel.isEmpty()) { return recursiveSearch(level + 1, searchNodeValue, nodesAtNextLevel); } // We have traversed entire tree. Node not found. Return -1 return -1; } } class Node { private int value; private List&lt;Node&gt; children = new ArrayList&lt;Node&gt;(); public Node(int value) { this.value = value; } public boolean hasChildren() { return children.isEmpty(); } public int getValue() { return value; } public List&lt;Node&gt; getChildren() { return children; } }
type: AcceptedAnswer

http://stackoverflow.com/comment/33003222
type: QuestionComment
has text: I would like to see the logs. Kindly paste the startup/shutdown logs
score: 0
comment on: http://stackoverflow.com/q/21809065
type: Comment

http://stackoverflow.com/comment/32820729
type: AnswerComment
has text: Thanks go to @BrianAgnew (http://stackoverflow.com/a/1149712/1532705) for the `StringWriter` `PrintWriter` idea.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21706723

http://stackoverflow.com/comment/32846679
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21721242
score: 0
has text: "precise value" may not be possible in either binary or decimal. What would you expect if, say the long were 10 and the int were 3?

http://stackoverflow.com/a/21688223
has comment: http://stackoverflow.com/comment/32794326
score: 8
answers question: http://stackoverflow.com/q/21684236
downvote count: 0
has body: There are multiple ways of doing it. Here's an article you might want to have a look. Test WYSIWYG editors using Selenium WebDriver Code snippets below are not tested, only provide the logic in Java. Send keys directly. Same as Richard's answer above. inputWebDriver.switchTo().frame("input-data_ifr"); WebElement element = inputWebDriver.findElement(By.cssSelector("body")); element.sendKeys("Send keys"); Set innerHTML inputWebDriver.switchTo().frame("input-data_ifr"); WebElement element = inputWebDriver.findElement(By.cssSelector("body")); (JavascriptExecutor)driver.executeScript("arguments[0].innerHTML = ' Set text using innerHTML '", element); Use TinyMCE's native API // no need to switch iframe (JavascriptExecutor)driver.executeScript("tinyMCE.activeEditor.setContent(' Native API text TinyMCE')");
accepted answer of: http://stackoverflow.com/q/21684236
upvote count: 8
has comment: http://stackoverflow.com/comment/73032381
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32794050
has comment: http://stackoverflow.com/comment/68536312
type: Answer

http://stackoverflow.com/q/21797614
answer count: 1
type: AnsweredQuestion
tagged with: jung
has answer: http://stackoverflow.com/a/21800794
tagged with: java
type: Question
has body: I am looking for an efficient way of finding the set of all nodes that are reachable from specific collection of nodes in JUNG. I am not sure how to do that. One solution would be to get the neighbors of each node of specific collection and do that until no new node added regarding to this process. But I think probably a more efficient way would be available. Could you please tell me what would it be? (below is the code of my implementation) private HashSet&lt;Customer&gt; getReachableNodes(Collection&lt;Customer&gt; churners, DirectedSparseGraph&lt;Customer, Transaction&gt; net) { HashSet&lt;Customer&gt; reachableNode = new HashSet&lt;Customer&gt;(); for (Customer churner : churners) { for(Customer neighbor:net.getVertices()){ if(isNeighbor(neighbor,churners,net)) reachableNode.add(neighbor) } } return reachableNode ; }
score: 0
accepted answer: http://stackoverflow.com/a/21800794
has title: Set of reachable nodes in graph using JUNG
tagged with: reachability

http://stackoverflow.com/q/21719571
has title: EJB Interceptors vs CDI Interceptors
type: AnsweredQuestion
tagged with: java
tagged with: ejb-3.1
type: Question
upvote count: 4
downvote count: 0
answer count: 1
score: 4
accepted answer: http://stackoverflow.com/a/21723420
tagged with: java-ee-6
favorite count: 0
tagged with: cdi
has answer: http://stackoverflow.com/a/21723420
has body: Is there any difference between EJB Interceptors declared in ejb-jar.xml file vs CDI interceptors declared in beans.xml file? Both interceptors are declared using annotation @Interceptors. If CDI interceptors apply to EJBs as well then why do EJB interceptors exists?

http://stackoverflow.com/q/21763096
tagged with: gwt
tagged with: intellij-idea
has title: Run gwt from maven - IntelliJ
answer count: 1
downvote count: 0
favorite count: 0
tagged with: maven
has body: When trying to run gwt:run from IntelliJ Maven projects panel, this is what I get: [WARNING] GWT plugin is configured to detect modules, but none were found. [ERROR] Missing required argument 'module[s]' [ERROR] Google Web Toolkit 2.4.0 [ERROR] DevMode [-noserver] [-port port-number | "auto"] [-whitelist whitelist-string] [-blacklist blacklist-string] [-logdir directory] [-logLevel level] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort port-number | "auto"] [-server servletContainerLauncher[:args]] [-startupUrl url] [-war dir] [-deploy dir] [-extra dir] [-workDir dir] module[s] [ERROR] What is the work around for this for IntelliJ?
has answer: http://stackoverflow.com/a/21764731
accepted answer: http://stackoverflow.com/a/21764731
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/q/21745158
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32889598
upvote count: 1
tagged with: transition
type: Question
tagged with: adt
downvote count: 0
favorite count: 0
has title: code to turn on transition setting on phone within app
type: UnansweredQuestion
tagged with: android
has body: I have this app where when it navigates to another activity it does a transition animation. Now I have already got that working properly but, to get it to work i have to turn the animation setting on my phone on. I have been searching on Google and I can"t seem to find solution to my problem. So my problem is this,is it possible to turn this setting on from within the app, with a code, instead of having to manually do it? Here is the code but as i have said above this works perfectly and I'm using a Telstra next G Huawei phone, just want to no if i can code it so i can turn the animation setting on if i decide to put it on a different phone. //Button to restart from beginning: //Declaring the button for OnClickListener and EditText to send data: private void Restart() { Button Next = (Button)findViewById(R.id.restart3); Next.setOnClickListener(new View.OnClickListener() { //The action the button takes when clicked: @Override public void onClick(View v) { //Goes back to the start of app: Intent i = new Intent(Height.this, Page_1.class); //clears the stack of all Activities that were open before this one so that they don't stack up: i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(i); //The transition animation when going onto next page: overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out); // to end the current activity: finish(); } }); }

http://stackoverflow.com/q/21681258
type: Question
has title: Exception while parsing command line options using args4j
downvote count: 0
tagged with: command-line-interface
accepted answer: http://stackoverflow.com/a/21684782
answer count: 1
favorite count: 0
has body: I am trying to work with args4j. I created a dummy project that contains one single command line option called 'enableAuth'. See Features.java. I tried to run this in eclipse with run configuration > program arguments as --enableAuth=true, -enableAuth=true, -enableAuth true etc., But none of them work for me. I run into CmdLineException always. Any help is appreciated. Github project: https://github.com/seshumadhav/java-projects/tree/master/args4j-demo
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21684782
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse

http://stackoverflow.com/comment/32807175
score: 0
type: Comment
type: QuestionComment
has text: @pshemek: I was wondering if there is any where in we can decide the time out feature of the application at one place
comment on: http://stackoverflow.com/q/21698992

http://stackoverflow.com/a/21805080
has comment: http://stackoverflow.com/comment/32997578
has comment: http://stackoverflow.com/comment/32997485
has comment: http://stackoverflow.com/comment/32996646
has body: When dividing integer values, always check for floating point division - 10/100 will be 0 by Java integer division terms, 10.0/100 circumcises this.
downvote count: 0
has comment: http://stackoverflow.com/comment/32996745
answers question: http://stackoverflow.com/q/21805043
type: Answer
has comment: http://stackoverflow.com/comment/32996816
score: 2
has comment: http://stackoverflow.com/comment/32996408
upvote count: 2
has comment: http://stackoverflow.com/comment/32996529
has comment: http://stackoverflow.com/comment/32996495
has comment: http://stackoverflow.com/comment/32997451
has comment: http://stackoverflow.com/comment/32996905
has comment: http://stackoverflow.com/comment/33004485

http://stackoverflow.com/q/21819208
downvote count: 0
tagged with: awt
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21821143
type: AnsweredQuestion
has title: Is there an equivalent of AffineTransform.createTransformedShape(Shape) in JavaFX?
score: 1
has body: In JavaFX 2.2, it seems like you can't do much with Transform objects except add them to Nodes. In particular, there's no algebraic operations so that you can compose one transformation with another. I suppose the reason is that most of the calculations should be done by the GPU directly, so not letting people try to do it programmatically prevents some slowdown. But sometimes you really do want to know what the final result of applying a transformation is. In particular, java.awt.geom.AffineTransform has this nice method createTransformedShape that would turn a java.awt.Shape into the equivalent shape under the given transformation. I can't find anything equivalent in JavaFX, and I can't think of a workaround. Am I missing something or does anyone have a clever idea that doesn't involve re-implementing the Shape class?
tagged with: java
tagged with: javafx
upvote count: 1
accepted answer: http://stackoverflow.com/a/21821143
type: Question

datetime-conversion
tags question: http://stackoverflow.com/q/21840006
type: Tag
tag name: datetime-conversion

http://stackoverflow.com/a/21698576
has comment: http://stackoverflow.com/comment/32807041
answers question: http://stackoverflow.com/q/21697945
score: 0
type: Answer
has body: Reflection API does not provide such information. Use third-party libraries to analyze class files.

http://stackoverflow.com/q/21715647
tagged with: email
downvote count: 0
answer count: 0
tagged with: google-groups
type: UnansweredQuestion
type: Question
score: 3
has title: Sending an email via Google Groups
has comment: http://stackoverflow.com/comment/81092202
tagged with: java
has comment: http://stackoverflow.com/comment/81140326
tagged with: google-apps
tagged with: smtp
favorite count: 0
upvote count: 3
has body: We has successfully managed to send emails from a java web application via the Google Apps SMTP server. That of course means that we need to add a paying user to the Google Apps as you need a username and password to have access to the SMTP server. Is there any way we can make this work with a Google Groups and avoid adding an extra user?

http://stackoverflow.com/a/31840758
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21753155
has body: You could try using the Robot class in java to simulate native system input events. Then store local variables to test input against and fire those events through the Robot class. Basically, for Windows Paint, whenever your pressure is greater than the previous pressure, fire a Robot event that sends the key combination CTRL and + to increase brush width. If you're also testing what application is open, then you can have a separate section of code set up to determine which key combination to send(since in photoshop the keybind is [ and ]), or have a section that allows users to specify what their keybinding is. While the current iteration uses awt, Robot is being added to JavaFX/Lombard in 3.0. I'm sure there are better solutions, but this is what I would do until I had something better. :)

http://stackoverflow.com/a/23273109
answers question: http://stackoverflow.com/q/21775120
score: 1
accepted answer of: http://stackoverflow.com/q/21775120
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Make sure the uses-permission element is not in the application element. I accidentally pasted it in there once, and Android Studio doesn't tell you that's a problem. Once I moved it out, it fixed the issue. Example: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.someapp.app" &gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;application ...&gt; ...
type: Answer

http://stackoverflow.com/comment/33036531
comment on: http://stackoverflow.com/a/21826871
type: AnswerComment
score: 0
type: Comment
has text: Ahhh ok now I see sorry again ;-)

http://stackoverflow.com/a/21761062
has comment: http://stackoverflow.com/comment/32919022
has comment: http://stackoverflow.com/comment/32919379
has comment: http://stackoverflow.com/comment/32917608
score: 0
has comment: http://stackoverflow.com/comment/32917876
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32917712
has comment: http://stackoverflow.com/comment/32917692
has comment: http://stackoverflow.com/comment/32918276
type: Answer
answers question: http://stackoverflow.com/q/21760869
has body: Clearly, data is an Object (as you declared in your first line). You first need to declare it as Object[][] data. You then need to initialize your values. You need to say data = new Object[size][] once you know how big 'size' will be (that is, how many lines you expect to parse). Then for each line you'll need to say data[k] = line.split(","); - I'm assuming the '8' in your code is the number of comma-separated values that you expect in each line. You don't need to call split multiple times; one call with split the string and provide however many substrings are separated by commas. Then, your call to JTable table = new JTable(data, Object[] { "col1", "col2", "col3", "col4", "col5", "col6", "col7", "col8" } ); should be straightforward.
accepted answer of: http://stackoverflow.com/q/21760869
has comment: http://stackoverflow.com/comment/32920497

http://stackoverflow.com/q/21728702
favorite count: 0
has answer: http://stackoverflow.com/a/25938740
type: UnansweredQuestion
score: 1
tagged with: java
has body: I want to create the following test class with JUnit4: import junitparams.JUnitParamsRunner; import org.junit.runner.RunWith; import de.bechte.junit.runners.context.HierarchicalContextRunner; @RunWith(JUnitParamsRunner.class) @RunWith(HierarchicalContextRunner.class) public class MultipleRunWithTest { //... } I want to use both facilities of HierarchicalContextRunner and JUnitParamsRunner, because they are handy in creating readable unit tests. JUnit gives this compile error: Duplicate annotation @RunWith MultipleRunWith.java What could be a resonable solution?
upvote count: 1
tagged with: junit-runner
has title: Using JUnit 4 with HierarchicalContextRunner and JUnitParamsRunner
type: Question
answer count: 1
tagged with: junit
downvote count: 0

http://stackoverflow.com/q/21840688
answer count: 2
has comment: http://stackoverflow.com/comment/33059982
favorite count: 0
has answer: http://stackoverflow.com/a/21866411
has body: I am making an app that uses tts to synthesize wav files every time a broadcastreceiver is triggered. Im working on AndroidStudio (latest) and using API level 19 with min 15. I have a Service with a BroadcastListener. Every time the BroadcastListener onReceive method is executed, I use tts.synthesizeToFile(playing, null, storagePath + "/" + "tst.wav"); The file is created successfully, but the onDone() method of the UtteranceProgressListener is never called. public void onCreate() { super.onCreate(); //Get TTS capabilities //TODO: Use TextToSpeech.Engine.ACTION_CHECK_TTS_DATA to check if tts is available tts = new TextToSpeech(PresenterService.this, new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { //If the TTS engine was started successfully if (status != TextToSpeech.ERROR) { tts.setLanguage(Locale.US); tts.setPitch(PRESENTER_PITCH); tts.setSpeechRate(PRESENTER_RATE); } } }); tts.setOnUtteranceProgressListener(new TtsUtteranceListener()); IntentFilter filter = new IntentFilter(); filter.addAction("xxxxxxxxxxxxxxxxxx"); mReceiver = new TrackChangedReceiver(tts); registerReceiver(mReceiver, filter); } And the TtsUtteranceListener class: public class TtsUtteranceListener extends UtteranceProgressListener { @Override public void onDone(String utteranceId) { Log.d("TtsUtteranceListener", "utterance Done: " + utteranceId); } @Override public void onStart(String utteranceId) { Log.d("TtsUtteranceListener", "utterance Start: " + utteranceId); } @Override public void onError(String utteranceId) { Log.d("TtsUtteranceListener", "utterance Error: " + utteranceId); } } The method on the listener: public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action != null) { if (action.equalsIgnoreCase("xxxxxxxxxxxxxxxxx")) { String playing = "test string"; tts.synthesizeToFile(playing, null, storagePath + "/" + "tst.wav"); } } } I'm using AndroidStudio, and with the debug mode I can see that the mUtteranceProgress…
tagged with: text-to-speech
score: 5
tagged with: android
possible better answer: http://stackoverflow.com/a/46287460
has answer: http://stackoverflow.com/a/46287460
type: AnsweredQuestion
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/21866411
type: Question
has title: UtteranceProgressListener not working for Android TTS
downvote count: 0

http://stackoverflow.com/a/28624902
has body: // difference between "key = val" or "key=val" ini.getConfig().setStrictOperator(true);
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/21828143
type: Answer

http://stackoverflow.com/comment/32834522
comment on: http://stackoverflow.com/a/21713571
score: 0
type: AnswerComment
has text: in read object's finally block try catch should be added. i have modified the code.
type: Comment

http://stackoverflow.com/q/21681066
score: 4
type: Question
accepted answer: http://stackoverflow.com/a/21681498
has body: I know that it is possible that every line you print can be tagged with date (and also saved as a log file). For example in Minecraft: [16:21:43 INFO]: Minecraft Launcher 1.3.9 (through bootstrap 5) started on windows... How do I do that? Maybee with Logger? Or are external librarys required?
has answer: http://stackoverflow.com/a/21690610
has title: Show date in 'System.out.println()' statement automatically
tagged with: java
answer count: 3
upvote count: 4
tagged with: minecraft
downvote count: 0
has answer: http://stackoverflow.com/a/21681498
has comment: http://stackoverflow.com/comment/32775089
has answer: http://stackoverflow.com/a/21681125
has comment: http://stackoverflow.com/comment/32775145
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21681125
favorite count: 0

http://stackoverflow.com/comment/32950894
score: 0
type: Comment
has text: we are back to that old question. I need to retrieve itemProdutoLista.get(0).get(0) for valorTotal and itemProdutoLista.get(0).get(1) for id. I know thats not exists get(x).get(y) but is what I need to @JB Nizet
type: AnswerComment
comment on: http://stackoverflow.com/a/21779840

http://stackoverflow.com/comment/32950535
type: AnswerComment
has text: I tried to write clean code and not fastest code but I expected this to be faster at least with this short strings and most of them being positive matches.
type: Comment
comment on: http://stackoverflow.com/a/21779341
score: 0

http://stackoverflow.com/a/21803640
has body: You can try with Oracle ADF. It comes included with JDeveloper IDE. You can easily create a CRUD application within a day (as a Fusion application) using drag &amp; drop feature for UI components and deploy it to the internal WebLogic Server , or to any other application server: http://www.oracle.com/technetwork/developer-tools/adf/overview/index.html
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21799640
downvote count: 0

http://stackoverflow.com/comment/32831272
has text: but how can i call my AsyncTask(Activity activity) ??? I called it from another class like - BackGroundTask doItInBackGround = new BackGroundTask(); doItInBackGround.execute();
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21686187

http://stackoverflow.com/comment/32881987
comment on: http://stackoverflow.com/a/21737048
has text: IT WORKED!! Now all I have to do it figure out how to make it operate faster.. i think i need to put it on a runnable running on a separate thread. I already having a countdowntimer in place. the problem was calling the mp.pause(); followed by mp.reset(); i wanted to preview different parts of a song using buttons. i mp.seekTo(10000) into the song and then 20000 with another.. i just couldnt get it to reset. but now that it is, because i have so much running on the clock. i may need another thread
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21771152
accepted answer of: http://stackoverflow.com/q/21771003
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32936382
type: Answer
has body: Search on how to compile Java files. In your case it will be javac Server.java to compile it, and then java Server to run. The same goes for Client.
answers question: http://stackoverflow.com/q/21771003
downvote count: 0
score: 1

http://stackoverflow.com/a/21805571
answers question: http://stackoverflow.com/q/21805536
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/33009155
accepted answer of: http://stackoverflow.com/q/21805536
has body: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project flexjson: Failed to deploy artifacts: Could not transfer artifact net.sf.flexjson:flexjson:jar:3.2 from/to sonatype-nexus-staging (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Failed to transfer file: https://oss.sonatype.org/service/local/staging/deploy/maven2/net/sf/flexjson/flexjson/3.2/flexjson-3.2.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1] regenerate your maven master password and encrypt your password for your nexus repository and configure it in your ~/.m2 settings.xml
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32888762
type: Comment
has text: typecast jtable to DefaultTableModel then try. like ((DefaultTableModel)jbable).setModel(......)
comment on: http://stackoverflow.com/a/21744102
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32928147
score: 1
type: AnswerComment
has text: thats fine, im suggesting to change the logger call to `log.fine("%s", this::getValue)`. requires you roll your own logger class.
comment on: http://stackoverflow.com/a/21763074
type: Comment

http://stackoverflow.com/comment/32787518
type: Comment
type: AnswerComment
has text: need to wait 2 days until possible
comment on: http://stackoverflow.com/a/21687745
score: 0

http://stackoverflow.com/q/21695358
tagged with: java
has answer: http://stackoverflow.com/a/21695420
type: Question
upvote count: 4
tagged with: arrays
has answer: http://stackoverflow.com/a/21695406
accepted answer: http://stackoverflow.com/a/21695396
linked to: http://stackoverflow.com/q/5785745
linked to: http://stackoverflow.com/q/12157300
downvote count: 0
tagged with: training-data
answer count: 7
duplicate of: http://stackoverflow.com/q/5785745
linked to: http://stackoverflow.com/q/14149733
has title: How to return a copy of an array?
favorite count: 0
tagged with: return
has body: public void addStudent(String student) { String [] temp = new String[students.length * 2]; for(int i = 0; i &lt; students.length; i++){ temp[i] = students[i]; } students = temp; students[numberOfStudents] = student; numberOfStudents++; } public String[] getStudents() { String[] copyStudents = new String[students.length]; return copyStudents; } I'm trying to get the method getStudents to return a copy of the array that I made in the addStudent method. I'm not sure how to go about this.
has comment: http://stackoverflow.com/comment/32800882
possible better answer: http://stackoverflow.com/a/21695382
has answer: http://stackoverflow.com/a/21695405
has answer: http://stackoverflow.com/a/21695382
score: 4
has answer: http://stackoverflow.com/a/21695425
has answer: http://stackoverflow.com/a/21695396
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21695415

http://stackoverflow.com/comment/43443622
type: AnswerComment
type: Comment
has text: why 1000 ? is there a way to recycle the 'httpclient' ?
comment on: http://stackoverflow.com/a/21746629
score: 0

http://stackoverflow.com/a/21682932
upvote count: 1
has comment: http://stackoverflow.com/comment/32778706
downvote count: 1
has comment: http://stackoverflow.com/comment/32779032
answers question: http://stackoverflow.com/q/21682761
score: 0
has comment: http://stackoverflow.com/comment/32778433
has body: You have to set the text of the text area..try doing so: { line = br.readLine(); if(line == null) Thread.sleep(); else textArea.append(line + "\n"); } this will append (put text at end) of the file, meaning that you will not have to worry about text being deleted each time it runs that should work, hope it helps
type: Answer

http://stackoverflow.com/comment/69149480
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/40954024
has text: Indeed, forgot about posting that here

http://stackoverflow.com/a/21759480
type: Answer
has comment: http://stackoverflow.com/comment/32920686
has comment: http://stackoverflow.com/comment/32916062
has body: &lt;src path="${javac.srcdir}"/&gt; means that ${javac.srcdir} is interpreted as a path (colon- or semicolon-separated depending on your platform) rather than a single directory. So you could provide more than one directory in here. &lt;path id="module.srcdir.path"&gt; &lt;pathelement location="docroot/WEB-INF/src" /&gt; &lt;pathelement location="docroot/WEB-INF/services" /&gt; &lt;/path&gt; &lt;property name="module.srcdir" refid="module.srcdir.path" /&gt; &lt;antcall target="compile-java"&gt; &lt;param name="javac.classpathref" value="plugin.classpath" /&gt; &lt;param name="javac.destdir" value="docroot/WEB-INF/classes" /&gt; &lt;param name="javac.srcdir" value="${module.srcdir}" /&gt; &lt;reference refid="plugin-lib.classpath" torefid="plugin-lib.classpath" /&gt; &lt;/antcall&gt;
answers question: http://stackoverflow.com/q/21757825
score: 0

http://stackoverflow.com/comment/32886912
type: QuestionComment
has text: Just use parser, I agree with Sotirios, No need of reflection.
score: 0
comment on: http://stackoverflow.com/q/21743587
type: Comment

http://stackoverflow.com/a/21835952
has body: Okay. That &lt;? extends Whatever&gt; is called a bounded wildcard. It will only match your ArrayList&lt;YourObject&gt; if YourObject belongs to a class implements Map&lt;String, Something&gt;, where Something can be any class (that one will match the unbounded wildcard ?). Your ArrayList is totally fine, since that implements the List interface. It's your custom MyOwnObject that needs to satisfy the above restrictions. Read more about wildcards here.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40452771
accepted answer of: http://stackoverflow.com/q/21835855
type: Answer
answers question: http://stackoverflow.com/q/21835855
has comment: http://stackoverflow.com/comment/33052991

http://stackoverflow.com/a/21741922
has comment: http://stackoverflow.com/comment/32884331
score: 0
type: AcceptedAnswer
has body: You aren't getting a result because your program is still running. Think about the size of the numbers you are calculating there in that method. 11 iterations is a stretch on my machine, 20 is probably far outside the reach of a common PC. Try running 5 iterations and optimizing your algorithm before going higher again. Aside from that, lejlot is correct, you should negate the sign, not just substract it from one iteration to the next. Edit: For 10 iterations I get the following result: Pi: 3.140598667726060313997433309223757530269291966682082323... Since we all know from memory that Pi starts out as 3.14159265358979323846264... that's not all that accurate yet.
has comment: http://stackoverflow.com/comment/32884314
answers question: http://stackoverflow.com/q/21709874
type: Answer
accepted answer of: http://stackoverflow.com/q/21709874

http://stackoverflow.com/a/21723829
has comment: http://stackoverflow.com/comment/32853093
upvote count: 1
has comment: http://stackoverflow.com/comment/32851341
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32851213
has comment: http://stackoverflow.com/comment/32852608
type: Answer
has body: You should prefer to test : if(c.getCount() == 0) instead of if(c == null) And maybe your could manage it with a raw query like : String q = "SELECT * FROM your_table WHERE titre = titre"; Cursor c= mDb.rawQuery(q, null);
has comment: http://stackoverflow.com/comment/32851559
answers question: http://stackoverflow.com/q/21723474

selenium-webdriver
tags question: http://stackoverflow.com/q/21720075
tags question: http://stackoverflow.com/q/21746224
tags question: http://stackoverflow.com/q/21729218
tags question: http://stackoverflow.com/q/21812867
tags question: http://stackoverflow.com/q/21694279
tags question: http://stackoverflow.com/q/21759479
tags question: http://stackoverflow.com/q/21713345
tags question: http://stackoverflow.com/q/21687354
tags question: http://stackoverflow.com/q/21801124
tags question: http://stackoverflow.com/q/21714977
tags question: http://stackoverflow.com/q/21679357
tags question: http://stackoverflow.com/q/21770373
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/21684236
tags question: http://stackoverflow.com/q/21721061
tags question: http://stackoverflow.com/q/21703831
tags question: http://stackoverflow.com/q/21699441
tags question: http://stackoverflow.com/q/21827531
tags question: http://stackoverflow.com/q/21785324
tags question: http://stackoverflow.com/q/21713280
tags question: http://stackoverflow.com/q/21757746
tags question: http://stackoverflow.com/q/21743350
tags question: http://stackoverflow.com/q/21793914
tags question: http://stackoverflow.com/q/21722340
type: Tag
tags question: http://stackoverflow.com/q/21839183
tags question: http://stackoverflow.com/q/21747726
tags question: http://stackoverflow.com/q/21730990
tags question: http://stackoverflow.com/q/21702007
tags question: http://stackoverflow.com/q/21747223
tags question: http://stackoverflow.com/q/21703405
tags question: http://stackoverflow.com/q/21744552

http://stackoverflow.com/q/21813434
answer count: 2
has comment: http://stackoverflow.com/comment/33011088
has body: This following code is to run a command in cmd and to produce a text file with the output from the command line. The code below shows the correct information in the output window in Eclipse, but only one last line is printed in the text file. Can anyone help me with this? import java.io.*; public class TextFile { public static void main(String[] args) throws IOException { try { Process p = Runtime.getRuntime().exec("git log"); BufferedReader in = new BufferedReader( new InputStreamReader(p.getInputStream())); BufferedWriter writer = null; String line = null; while ((line = in.readLine()) != null) { writer = new BufferedWriter(new FileWriter("textfile.txt")); writer.write(line); System.out.println(line); writer.close(); } } catch (IOException e) { e.printStackTrace(); } } }
downvote count: 0
has answer: http://stackoverflow.com/a/21813503
favorite count: 0
has answer: http://stackoverflow.com/a/46087268
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/80213814
score: 3
upvote count: 3
tagged with: java
has title: Write multiple lines in a text file ( java)
type: Question

http://stackoverflow.com/q/21723749
favorite count: 0
score: -1
tagged with: http://stackoverflow.com/tag/xml
has body: We have a project with a lot of MyBatis XML sqlmaps. Is there any tool/plugin/trick to comment them and generate documentation in Javadoc style?
has answer: http://stackoverflow.com/a/21943736
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21943736
tagged with: java
tagged with: javadoc
type: Question
upvote count: 0
answer count: 1
tagged with: mybatis
has title: Any Javadoc style documentation tool for MyBatis XML sqlmaps?

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/21688861
tag name: tablemodel
tags question: http://stackoverflow.com/q/21732755

http://stackoverflow.com/comment/32776689
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21679765
has text: That's precisely the point - is logging something Java can do on my behalf as a system function, without me needing to write on your local system explicitly? By running an applet, you allow Java to download whatever resources the applet needs so a sandboxed applet is still putting files on your system somewhere.
score: 0

http://stackoverflow.com/q/21718467
upvote count: 2
has body: I am pretty new to JPA and using eclipselink as JPA engine in my Struts 2 project. I am having problems while committing my records as it throws an exception: javax.persistence.RollbackException: Transaction rolled back because transaction was set to RollbackOnly. Here is my Action:- public class CreateTour extends ActionSupport implements UserAware, PersistAware { private Tour tour; private List&lt;Integer&gt; noOfPlaces; private List&lt;String&gt; country; private List&lt;String&gt; city; private List&lt;String&gt; hotel; private List&lt;String&gt; checkIn; private List&lt;String&gt; checkOut; private List&lt;String&gt; prerequisites; private String categoryName; private UserInfo user; private EntityManager em; public String getCategoryName() { return categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } public Tour getTour() { return tour; } public void setTour(Tour tour) { this.tour = tour; } public List&lt;Integer&gt; getNoOfPlaces() { return noOfPlaces; } public void setNoOfPlaces(List&lt;Integer&gt; noOfPlaces) { this.noOfPlaces = noOfPlaces; } public List&lt;String&gt; getCountry() { return country; } public void setCountry(List&lt;String&gt; country) { this.country = country; } public List&lt;String&gt; getCity() { return city; } public void setCity(List&lt;String&gt; city) { this.city = city; } public List&lt;String&gt; getHotel() { return hotel; } public void setHotel(List&lt;String&gt; hotel) { this.hotel = hotel; } public List&lt;String&gt; getCheckIn() { return checkIn; } public void setCheckIn(List&lt;String&gt; checkIn) { this.checkIn = checkIn; } public List&lt;String&gt; getCheckOut() { return checkOut; } public void setCheckOut(List&lt;String&gt; checkOut) { this.checkOut = checkOut; } public List&lt;String&gt; getPrerequisites() { return prerequisites; } public void setPrerequisites(List&lt;String&gt; prerequisites) { this.prerequisites = prerequisites; } @Override public String execute() { return …
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22861989
has comment: http://stackoverflow.com/comment/32868140
tagged with: eclipselink
has comment: http://stackoverflow.com/comment/32874898
answer count: 1
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/32878758
has title: JPA eclipselink: Error while commit: Transaction rolled back because transaction was set to RollbackOnly
favorite count: 0
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/32870728

http://stackoverflow.com/comment/72154010
type: QuestionComment
comment on: http://stackoverflow.com/q/21764196
has text: You might find this app very helpfull(assuming you have android) to help you understand how something works: https://play.google.com/store/apps/details?id=wiki.algorithm.algorithms
score: 0
type: Comment

http://stackoverflow.com/comment/32883932
score: 0
comment on: http://stackoverflow.com/a/21741712
type: Comment
type: AnswerComment
has text: I tried to change it but it says an "int" is required after input.next() probably because of the declaration at the top. What should I change it to?

http://stackoverflow.com/q/21724910
has body: I have below shell script to stop/stop the tomcat. #!/bin/bash export BASE=/home/programs/jakarta-tomcat-5.0.28/bin prog=jakarta-tomcat-5.0.28 stat() { if [ `ps auxwwww|grep $prog|grep -v grep|wc -l` -gt 0 ] then echo Tomcat is running. else echo Tomcat is not running. fi } case "$1" in start) if [ `ps auxwwww|grep $prog|grep -v grep|wc -l` -gt 0 ] then echo Tomcat seems to be running. Use the restart option. else $BASE/startup.sh 2&gt;&amp;1 &gt; /dev/null fi stat ;; stop) $BASE/shutdown.sh 2&gt;&amp;1 &gt; /dev/null if [ `ps auxwwww|grep $prog|grep -v grep|wc -l` -gt 0 ] then for pid in `ps auxwww|grep $prog|grep -v grep|tr -s ' '|cut -d ' ' -f2` do kill -9 $pid 2&gt;&amp;1 &gt; /dev/null done fi stat ;; restart) if [ `ps auxwwww|grep $prog|grep -v grep|wc -l` -gt 0 ] then for pid in `ps auxwww|grep $prog|grep -v grep|tr -s ' '|cut -d ' ' -f2` do kill -9 $pid 2&gt;&amp;1 &gt; /dev/null done fi $BASE/startup.sh 2&gt;&amp;1 &gt; /dev/null stat ;; status) stat ;; *) echo "Usage: tomcat start|stop|restart|status" esac Now above script works with local tomcat. Now how can i modify above script to stop/start remote tomcat? Thanks!
tagged with: unix
has comment: http://stackoverflow.com/comment/32852932
has title: Tomcat start and stop using shell script?
tagged with: java
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/21725129
score: -2
has comment: http://stackoverflow.com/comment/32852864
has comment: http://stackoverflow.com/comment/32852999
has comment: http://stackoverflow.com/comment/32852933
upvote count: 0
answer count: 1
tagged with: shell
tagged with: tomcat
favorite count: 0
tagged with: linux
type: UnansweredQuestion

http://stackoverflow.com/q/21750708
downvote count: 0
favorite count: 0
tagged with: postgresql
score: 5
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21772062
has body: I have using then following query in my Hibernate i.e createSQLQuery SELECT to_char(dd, 'Mon YYYY') FROM generate_series('2013-01-01'::date, date_trunc('month', now()), '1 month') as dd which produces output when run in PostgreSQL as "Jan 2013" "Feb 2013" . . "Feb 2014" However while using it through createSQLQuery as below , it throws "org.hibernate.QueryException: Not all named parameters have been set: [:date]" Please note that date has been used like '2013-01-01'::date try{ session = HibernateSessionFactory.getSession(); tx = session.beginTransaction(); Query query = session.createSQLQuery("SELECT to_char(dd, 'Mon YYYY') FROM generate_series('2013-01-01'::date, date_trunc('month', now()), '1 month') as dd"); monthList = new ArrayList&lt;String&gt;(); monthList = query.list(); tx.commit(); } Please suggest
type: Question
has title: Not all named parameters have been set in specific conditions
has comment: http://stackoverflow.com/comment/32899734
upvote count: 5
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/40751058
accepted answer: http://stackoverflow.com/a/21772062
answer count: 2
possible better answer: http://stackoverflow.com/a/40751058

http://stackoverflow.com/q/21691551
accepted answer: http://stackoverflow.com/a/21691587
favorite count: 0
has body: so im trying to create a program in java which will create a 10 by 10 matrix, with each element displaying either a 1 or a 0 randomly. Here is what i have so far: package random.matrix; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JLabel; class ex2 extends JFrame { class Random { GridLayout setLayout= new GridLayout(10, 10); for (int i = 0; i &lt; 10; i++) { int number = (int) (Math.random() * 2); String str = Integer.toString(number); add(new JLabel(str, JLabel.CENTER)); } } public static void main(String[] args) { JFrame frame = new ex2(); frame.setTitle("RandomMatrix"); frame.setSize(400, 400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } As far as I can tell, this program should run perfectly. However, every time I try, it says something along the lines of "illegal start of type," referring specifically to the for loop line. Can anyone help me troubleshoot this? I've never encountered an error quite like this one.
has answer: http://stackoverflow.com/a/21691583
upvote count: 4
score: 2
type: AnsweredQuestion
has title: for loop gets error "illegal start of type"
tagged with: java
tagged with: loops
type: Question
answer count: 2
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/21691583
linked to: http://stackoverflow.com/q/3653625
downvote count: 2
has comment: http://stackoverflow.com/comment/32794779
has answer: http://stackoverflow.com/a/21691587

http://stackoverflow.com/comment/33050404
has text: Yes, i did.The problem is not a missing file, it is the "missing" path to the file.
comment on: http://stackoverflow.com/q/21816153
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33092845
type: AnswerComment
comment on: http://stackoverflow.com/a/21770757
score: 0
type: Comment
has text: I know. It was not my question how to remove the compile error, because I want to see such compile error. Nobody should reference a class from the implementation module in the sample-service module in the production code (src/main/java) of the sample-service module. I'm copying here the last sentence of my main question: "Is it possible to see the compile error immediately after the Eclipse's compile?" I can't copy the whole text of my main question here, therefore please read it if you don't understand what I mean.

http://stackoverflow.com/comment/32914174
has text: so there will be no difference in using request1 & request2, if I declare `final HttpServletRequest request1` or `HttpServletRequest request2`
score: 0
comment on: http://stackoverflow.com/q/21759275
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33054183
type: Comment
comment on: http://stackoverflow.com/a/21837153
score: 0
type: AnswerComment
has text: i edit my code again you can check in below. But when i click to buton worker not executed and progressbar not coming this time. I suspect progressbar not fired anywhere. Am i wrong ?

http://stackoverflow.com/a/21800350
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21800092
has body: Since you cannot make two requests at once, you can alternatively do the following: First, in your activity, create your AsyncTask instance and execute it with an argument like "firstImage" and then in doInBackground(), simply check to see if that is the value of the argument passed and if so, download the first image. After the image is downloaded, save it somewhere in a local variable or whatever you want. Then return a string like "firstImage". Inside onPostExecute, just check the value of result and pass back the image to the activity which will update the UI. Secondly, once you have updated the UI with the first Image, make a second Async call with a string like "secondImage" and repeat the same process as before and update the UI - this will add the second image to the UI. You won't need a library for this!
upvote count: 2

http://stackoverflow.com/a/21789515
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21787967
has body: Here is a link to the ProcessBuilder definition on Oracle, which explains how to use this class. Typically, this is used for executing non-java processes, e.g. .BAT or .EXE processes, but I suppose you could use it to execute any process you wish. http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

http://stackoverflow.com/q/21802719
answer count: 3
has body: I found the problem. Apparently, there were random spaces in some of the names in the csv file, which was causing breaks at the 257th entry, as well as several others later on. So, I just took out the spaces and everything works fine now. Thanks to all who tried to help. I have this code that reads from a csv file, puts the values in String array, and prints them for me to see. It runs fine until it reaches the 257th member of the array (each member has 3 values: last name, first name, and birth year). Here is a functioning version of the code: package testing.csv.files; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Test { public static void main(String[] args) { //.csv comma separated values String fileName = "C:/Users/Owner/Desktop/Data.csv"; File file = new File(fileName); // TODO: read about File Names try { Scanner inputStream = new Scanner(file); inputStream.next(); //Ignore first line of titles while (inputStream.hasNext()){ String data = inputStream.next(); // gets a whole line String[] values = data.split(","); System.out.println(data); } inputStream.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Now, when I change the line System.out.println(data); To this: System.out.println(values[2]); What I expected to happen was for only the birth years (3rd column) to be printed for every person in the array. However, it only prints out until the 257th person's birth year (out of over 18,000), and gives me the following error message: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at testing.csv.files.Test.main(Test.java:22) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds) The "java: 22" seems to be referring to the above snippet of code I posted above that I changed. I am not really sure what the problem is. If my syntax is wrong, why did it print at all? The only thing I can think of is that perhaps a string array can only h…
tagged with: arrays
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/21802791
has answer: http://stackoverflow.com/a/21802822
has title: Java NetBeans: Why does my string array terminate prematurely?
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32993181
score: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21802867
type: Question

http://stackoverflow.com/comment/32909711
score: 0
type: Comment
type: QuestionComment
has text: 53 degrees looks about right. What value did you expect?
comment on: http://stackoverflow.com/q/21756252

http://stackoverflow.com/comment/32921806
type: Comment
has text: Basically the flow goes like this: I get an array of data into "arrayAdapter". I send arrayAdapter to my createTheList method which has a setListAdapter that takes in "arrayAdapter" and creates a listview based on the contents. Later on in my program I want to have a filter option so that if they click a button, the list will be reduced. I figured for testing purposes, I can create a new array of data called "adapterArray2" and send that to createTheList() so that it will re-create a list and replace the old one.
comment on: http://stackoverflow.com/a/21762425
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32884120
has text: I know, i've looked and i tried to do some modifications like doing data.add() after the iteration, not in the middle but nothing changed.
comment on: http://stackoverflow.com/q/21741997
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33020518
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21818461
has text: Is it necessary to keep the classes with the same names? You could create some sort of script or a small Java program to rename them (file name + class name). Or go for the other solution and make the program add the package declaration for you.
type: AnswerComment

http://stackoverflow.com/comment/32939261
score: 0
type: AnswerComment
type: Comment
has text: No, `code` is the FQN of the JApplet class. Read further here: http://docs.oracle.com/javase/tutorial/deployment/applet/html.html
comment on: http://stackoverflow.com/a/21747276

http://stackoverflow.com/comment/32916998
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21747669
has text: Thanks for letting me know about the SQL logging, that will be useful in future. Turned out the problem was a tired programmer, the username I was passing into the findByUserName method ended in .com not .co.uk like the username in the database. Stupidity on my part! Your suggestions helped me get there so thanks for taking the time to answer!

http://stackoverflow.com/q/21780964
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/21781092
answer count: 2
has comment: http://stackoverflow.com/comment/32952720
has comment: http://stackoverflow.com/comment/32952664
score: 0
has comment: http://stackoverflow.com/comment/32952819
tagged with: android-activity
has body: For some reason when I design this Android app, the .java file is not finding the main_activity and will not run the app. Where it says: R.activity.main_activity there is a red line under "Main_Activity". Does anyone know why, how can I fix this? Thanks! package com.test.helloworld; import android.R; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.EditText; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); EditText num = (EditText)findViewById(R.id.num); }
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21781092
has answer: http://stackoverflow.com/a/21781054
accepted answer: http://stackoverflow.com/a/21781054
tagged with: java
has title: Eclipse not finding Main_Activity

http://stackoverflow.com/comment/132220766
type: Comment
comment on: http://stackoverflow.com/a/74920295
has text: It would be nice to give a brief explanation of how this works / how it solves the problem, and how it's different than existing answers.
score: 1
type: AnswerComment

http://stackoverflow.com/q/21813720
tagged with: cdi
has answer: http://stackoverflow.com/a/21829576
has title: Use CDI to load Beans dynamically - EJB3
tagged with: ejb-3.0
type: AnsweredQuestion
tagged with: java
has body: I am using EJB3 in my application and I want to know can I inject beans dynamically at runtime based on some parameter ? Because I have a @Local interface which extends several beans which works in different manner. So at run time I want to load each bean depend on the logic. So far I used usual JNDI lookup But I would like to do it with @Inject. Is there a way that I can inject the bean dynamically? Here is my existing lookup code. I pass the bean name as jndi here and build the instance dynamically. IService bean = (IService) initialContext.lookup(jndi+"Bean/local"); bean.initializeTimer(firstDate, period, request); UPDATE I have three beans for the moment. first bean is SingleServiceBean @Stateless public class SingleServiceBean implements IService{ @Override public void doSomething (){ log.debug("inside do something"); } private final Log log = LogFactory.getLog(SingleServiceBean.class.getName()); } Second bean is PeriodicService @Stateless public class PeriodicServiceBean implements IService{ @Override public void doSomething (){ log.debug("inside do something"); } private final Log log = LogFactory.getLog(PeriodicServiceBean.class.getName()); } Third bean @Stateless public class AsyncServiceBean implements IService{ @Override public void doSomething (){ log.debug("inside do something"); } private final Log log = LogFactory.getLog(AsyncServiceBean.class.getName()); } 2nd Update Qualifier : @Qualifier @Target({ TYPE, METHOD, PARAMETER, FIELD }) @Retention(RUNTIME) @Documented public @interface Services { String type(); } AnnotationLiteral public class ServiceQualifier extends AnnotationLiteral&lt;Services&gt; implements Services{ private static final long serialVersionUID = 6471734834552932687L; private String type; public String TypeQualifier(String t) { this.type = t; return type; } public String type() { return type; } } And new bean class like below @Services(type = "SingleService" ) @Stateless public class SingleServiceBean implements IService{ ..... } then…
type: Question
possible better answer: http://stackoverflow.com/a/21825026
tagged with: jndi
accepted answer: http://stackoverflow.com/a/21829576
has answer: http://stackoverflow.com/a/21825026
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35874119

http://stackoverflow.com/comment/33057862
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21839821
score: 1
has text: I don't think so, without code example showing what did you try.

http://stackoverflow.com/comment/32903208
has text: Actually my friend asked me this question. This question was asked to him in the interview and interviewer told him that explain the program and expected output.- Fildor
comment on: http://stackoverflow.com/q/21752747
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/58135728
score: 0
type: Answer
has body: This can also be caused by accidentally including Spring deps in a thin war's WEB-INF/lib, if the jars are already in the ear's META-INF/lib. This is common if you use maven.
answers question: http://stackoverflow.com/q/21828799

http://stackoverflow.com/q/21745622
has body: So here is a code I wanted to test..(This is for understanding how to convert to CSV file) String csv = "C:\\output.csv"; CSVWriter writer = new CSVWriter(new FileWriter(csv)); String [] country = "India#China#United States".split("#"); writer.writeNext(country); writer.close(); Here is the class I imported , import au.com.bytecode.opencsv.CSVWriter; , I made sure the path is built. Im trying out that code so I can understand its working but its confusing me now. ANY sort of help is appreciated. I know there are so many similar questions, I did have read through some and got confused. I am getting CSVWrite cannot be resolved to type. Here is my ENTIRE code: I am learning how to take content off web and convert it into a csv file. import java.net.*; import java.io.*; import au.com.bytecode.opencsv.CSVWriter; public class InfoGather { private static BufferedWriter out; /*private static String csv; private static BufferedReader csvin;*/ public static void main(String[] args) throws IOException { try{ URL blog = new URL("http://protectidentite.blogspot.ca/2014/02/mobile-phones-are-one-of-most-popular.html"); URLConnection connect= blog.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(connect.getInputStream())); FileWriter fstream = new FileWriter("out.txt"); out = new BufferedWriter(fstream); String inputLine; while((inputLine = in.readLine())!= null) { out.write(inputLine); out.newLine(); } /* csv = "C:\\output.csv"; csvin = new BufferedReader(new FileReader("out.txt")); */ String csv = "C:\\output.csv"; CSVWriter writer = new CSVWriter(new FileWriter(csv)); String [] country = "India#China#United States".split("#"); writer.writeNext(country); writer.close(); } catch(IOException e) { System.out.println("error"); } } } Majority of it is taken from the web. I also created another class which generates an excel file.
has answer: http://stackoverflow.com/a/21745962
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/32890392
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32890428
accepted answer: http://stackoverflow.com/a/21745962
type: AnsweredQuestion
has title: "Cannot be resolved to type" error
favorite count: 0
type: Question

http://stackoverflow.com/a/21687206
has comment: http://stackoverflow.com/comment/32797887
has body: Say you have a string, abcabc, and you want to figure out whether the first part of the string matches the second part. You can do this with a single regex by using capturing groups and backreferences. Here is the regex I would use: (.+)\1 The way this works is .+ matches any sequence of characters. Because it is in parentheses, it is caught in a group. \1 is a backreference to the 1st capturing group, so it is the equivalent of the text caught by the capturing group. After a bit of backtracking, the capturing group matches the first part of the string, abc. The backreference \1 is now the equivalent of abc, so it matches the second half of the string. The entire string is now matched, so it is confirmed that the first half of the string matches the second half. Another use of backreferences is in replacing. Say you want to replace all {...} with [...], if the text inside { and } is only digits. You can easily do this with capturing groups and backreferences, using the regex {(\d+)} And replacing with that with [\1]. The regex matches {123} in the string abc {123} 456, and captures 123 in the first capturing group. The backreference \1 is now the equivalent of 123, so replacing {(\d+)} in abc {123} 456 with [\1] results in abc [123] 456. The reason non-capturing groups exist is because groups in general have more uses that just capturing. The regex (xyz)+ matches a string that consists entirely of the group, xyz, repeated, such as xyzxyzxyz. A group is needed because xyz+ only matches xy and then z repeated, i.e. xyzzzzz. The problem with using capturing groups is that they are slightly less efficient compared to non-capturing groups, and they take up an index. If you have a complicated regex with a lot of groups in it, but you only need to reference a single one somewhere in the middle, it's a lot better to just reference \1 rather than trying to count all the groups up to the one you want. I hope this helps!
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21686230
accepted answer of: http://stackoverflow.com/q/21686230

http://stackoverflow.com/comment/32998783
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21806505
has text: You're forgetting about the possible first + sign

http://stackoverflow.com/comment/98313549
type: Comment
type: QuestionComment
has text: Please, what tutorial did you use? For I cannot make Eclipse to show an error called i the Processor.
comment on: http://stackoverflow.com/q/21822951
score: 0

http://stackoverflow.com/a/21800667
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21800573
has body: The second dimension of the array are the columns. You seem to be using 9 columns. So try: Object[][] data = new Object[books.size()][9];
answers question: http://stackoverflow.com/q/21800573
upvote count: 2

http://stackoverflow.com/q/21817303
type: Question
has body: I am new to android and have a very silly doubt. I have a android file, a java desktop application file and an asynctask code. I want to transfer data from android to java desktop server. all three are java files. SO, my silly doubt is should I keep them under one project, but java and android cant be kept under one. So should i keep android file and asynctask file under one project ? If no, then i should make a different android project for asynctask ? How should i run it ? First Asynctask , then server(java desktop app) and then client(android). I just want to pass data from android device to java desktop server. Hope I am clear. I am a newbie, so asked it. Edited: My asynctask code is : public class Asynctask extends AsyncTask&lt;View, Integer, Socket&gt; { private static final String IP_ADDRESS = "134.190.162.165"; // Toshiba laptop private static final int DEST_PORT = 4444; private EditText mTextField; /** * Store provided views (used later in onPostExecute(...)). * * Create socket to communicate with server (blocking call). */ protected Socket doInBackground(View... params) { // Store provided views. if (params.length != 1) throw new IllegalArgumentException(); mTextField = (EditText) params[0]; // Create socket. Socket client = null; try { client = new Socket(IP_ADDRESS, DEST_PORT); // connect to server } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return client; } /** * Write to server. */ protected void onPostExecute(Socket client) { try { PrintWriter printwriter; String messsage; messsage = mTextField.getText().toString(); // get the text message on the text field mTextField.setText(""); // Reset the text field to blank printwriter = new PrintWriter(client.getOutputStream(), true); printwriter.write(messsage); // write the message to output stream printwriter.flush(); printwriter.close(); client.close(); } catch (IOException e) { e.printStackTrace(); } } } Is the line protected Socket doInBackgroun…
linked to: http://stackoverflow.com/q/21816005
tagged with: android
answer count: 1
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: sockets
linked to: http://stackoverflow.com/q/21818076
score: 0
tagged with: java
has title: Where should I keep Async file in Eclipse?
has answer: http://stackoverflow.com/a/21817370

http://stackoverflow.com/comment/33025646
type: AnswerComment
comment on: http://stackoverflow.com/a/21821508
type: Comment
has text: I see no reason to use both... In my experience (which is limited) I have yet to see this done. RestTemplate is made for client calls in the server... If RestTemplate is being used to make calls to an internal api inside the existing controller... I would be very confused as to why this was done. If JQuery is present, in a jsp.. that makes sense becuase the browser would load all the data, and make http calls to the server after the data was loaded. Which would make sense... but to chain them ... JQuery ---> Controller --> rest call --> controller --> JQuery, that doesn't make sense.
score: 0

http://stackoverflow.com/a/21791895
has body: In order to be serialized, an object must: Implement Serializable All non-transient and non-static fields must be primitive or serializable. Arrays are consider serializable, but its elements must be serializable
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32974466
answers question: http://stackoverflow.com/q/21791872

http://stackoverflow.com/comment/32866493
type: AnswerComment
has text: An instance is created and passed to the sort method. Read the javadoc for `sort`.
type: Comment
comment on: http://stackoverflow.com/a/21732468
score: 0

http://stackoverflow.com/comment/32819116
comment on: http://stackoverflow.com/a/21705864
type: AnswerComment
has text: which function do I have to use to split up the pipes?
score: 0
type: Comment

http://stackoverflow.com/q/21687708
has answer: http://stackoverflow.com/a/21717658
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15803096
tagged with: netty
tagged with: executorservice
upvote count: 6
score: 6
has body: I would like to reuse an ExecutorService across my application. Reusing a NioWorkerPool across multiple server and client bootstraps I tried to reproduce the code posted above with netty 4 but i didn't find a way to do it, i also googled quit a lot but it seems we can't provide ExecutorService to a bootstrap or NioEventLoopGroup object. For example with netty 3 here is how you can share executorservice : ExecutorService executor = Executors.newCachedThreadPool(); NioClientBossPool clientBossPool = new NioClientBossPool(executor, clientBossCount); NioServerBossPool serverBossPool = new NioServerBossPool(executor, serverBossCount); NioWorkerPool workerPool = new NioWorkerPool(executor, workerCount); ChannelFactory cscf = new NioClientSocketChannelFactory(clientBossPool, workerPool); ChannelFactory sscf = new NioServerSocketChannelFactory(serverBossPool, workerPool); ... ClientBootstrap cb = new ClientBootstrap(cscf); ServerBootstrap sb = new ServerBootstrap(sscf); But with netty 4, as far as i know you can't use a executorservice ... You must provide a EventLoop implementation like NioEventLoopGroup, but i really would like to use a generic executorService that i will use across my application. Because i want in one thread-pool to have threads doing different kind of work : computation, networks with netty ... EventLoopGroup bossGroup = new NioEventLoopGroup(); // (1) EventLoopGroup workerGroup = new NioEventLoopGroup() ServerBootstrap b = new ServerBootstrap(); // (2) b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) // (3) .childHandler(new ChannelInitializer&lt;SocketChannel&gt;() { // (4) @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new DiscardServerHandler()); } }) .option(ChannelOption.SO_BACKLOG, 128) // (5) .childOption(ChannelOption.SO_KEEPALIVE, true); // (6)
type: Question
tagged with: java
tagged with: nio
has title: Netty 4, use of ExecutorService
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/39255778
type: QuestionComment
comment on: http://stackoverflow.com/q/21780709
has text: @MichałCiołczyk , thanks for the reply. I'm still on the shadow though. Can you expound on "loading it only once"? To illustrate, my web.xml is very similar to what you have posted above, I have a listener tag for ContextLoaderListener and a servlet tag for DispatcherServlet. What should I do to them to make it work? Thanks for your assistance! :)
score: 0
type: Comment

http://stackoverflow.com/comment/32931311
score: 0
type: Comment
type: QuestionComment
has text: So, throw an exception in your `try` that isn't specified in any of your `catch` clauses?
comment on: http://stackoverflow.com/q/21768543

http://stackoverflow.com/comment/32825044
type: Comment
type: QuestionComment
has text: Anyone got any ideas?
score: 0
comment on: http://stackoverflow.com/q/21708405

http://stackoverflow.com/comment/32784168
comment on: http://stackoverflow.com/q/21686149
score: 0
type: Comment
has text: seems a bit broad at this point. can you narrow down?
type: QuestionComment

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/21787586
tags question: http://stackoverflow.com/q/21758008
type: Tag

akka
type: Tag
tag name: akka
tags question: http://stackoverflow.com/q/21832131
tags question: http://stackoverflow.com/q/21686327
tags question: http://stackoverflow.com/q/21693970
tags question: http://stackoverflow.com/q/21681784

http://stackoverflow.com/q/21736324
score: 0
tagged with: jlist
type: UnansweredQuestion
has body: I'm having trouble actually retrieving items that I have stored in a JList. I am using Eclipse, which urges me to parametrize the JList, which I did (String), and I need a way to retrieve the values and store them in a String variable. Initialization: JList&lt;String&gt; songlist; songlist = new JList&lt;String&gt;(list); //list is a DefaultListModel User fills up JList with songs... Then I try to retrieve selected song to display information about it: String value = songlist.getSelectedItem().toString(); ...and I get the error: The method getSelectedItem() is undefined for the type JList Same happens when I try getSelectedValue() and getElementAt() (paired with getSelectedIndex())
tagged with: swing
has answer: http://stackoverflow.com/a/21736428
tagged with: java
has title: How to get selected item in JList into a string
has answer: http://stackoverflow.com/a/21737885
type: Question
answer count: 2
tagged with: user-interface

http://stackoverflow.com/q/21796503
tagged with: netbeans
tagged with: maven
type: Question
has answer: http://stackoverflow.com/a/28320723
tagged with: java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32981727
has comment: http://stackoverflow.com/comment/32980769
has body: This is what I am getting when I am trying to create a new Maven Web Application in Netbeans: 15.02.2014 11:48:13 com.google.inject.internal.MessageProcessor visit INFO: An exception was caught and reported. Message: java.util.NoSuchElementException java.util.NoSuchElementException at java.util.AbstractList$2.next(libgcj.so.14) at com.google.inject.spi.InjectionPoint.forMember(InjectionPoint.java:116) at com.google.inject.spi.InjectionPoint.&lt;init&gt;(InjectionPoint.java:73) at com.google.inject.spi.InjectionPoint$InjectableMethod.toInjectionPoint(InjectionPoint.java:459) at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:725) at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:358) at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:377) at com.google.inject.internal.BindingBuilder.toInstance(BindingBuilder.java:84) at org.codehaus.plexus.DefaultPlexusContainer$ContainerModule.configure(DefaultPlexusContainer.java:803) at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229) at com.google.inject.spi.Elements.getElements(Elements.java:103) at com.google.inject.spi.Elements.getElements(Elements.java:80) at org.sonatype.guice.bean.binders.MergedModule.configure(MergedModule.java:54) at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229) at com.google.inject.spi.Elements.getElements(Elements.java:103) at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104) at com.google.inject.Guice.createInjector(Guice.java:94) at com.google.inject.Guice.createInjector(Guice.java:71) at com.google.inject.Guice.createInjector(Guice.java:61) at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:470) at org.codehaus.plexus.DefaultPlexusContainer.&lt;init&gt;(DefaultPlexusContainer.java:196) …
type: UnansweredQuestion
has title: Maven web application doesn`t work anymore (Netbeans)

http://stackoverflow.com/comment/32836250
has text: @user2789116 Yo have a foucs issue. `KeyListener` will only respond to key events if the component it is registered is focusable AND has focus. This is well known issue with `KeyListener`. A better solution would be to use the [Key Bindings API](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) as it gives more flexibility in defining the focus level required to generate key events...
comment on: http://stackoverflow.com/a/21714486
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21757387
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32916223
tagged with: asn.1
type: Question
tagged with: rsa
tagged with: public-key
has title: RSA algorithm in Java : How works getEncoded method on java.security.Key interface?
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21762521
has body: I would like to be more familiar with the RSA algorithm and I have made small project for that. Actually everithing works fine, I can encrypt and decrypt a message correctly but I don't know if my key generation is performed correctly (my objective is to obtain a public key with a byte array representation that I can export for other parts). Here comes how my keys are generated: KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN"); random.nextBytes(new byte[128]); keyGen.initialize(1024, random); KeyPair keyPair = keyGen.generateKeyPair(); PublicKey pubKey = keyPair.getPublic(); PrivateKey privKey = keyPair.getPrivate(); byte[] publicKeyEncoded = pubKey.getEncoded(); byte[] privateKeyEncoded = privKey.getEncoded(); My question is about the getEncoded method, each time my program is executed a new key pair seems to be generated (according my trace) but when I call this method I have still the same value, it seems fixed. The value is changed when the method is called a second times and is changed each times that I call it in my program, but if a new execution is performed, the first value is the same as first value of the previous execution event if the keys differs. According the documentation it seems that it "Returns the key in its primary encoding format ...", I have checked my key format, it is X.509, but there is nothing about the described behavior. Can you please give me more details about that ?
favorite count: 0
type: UnansweredQuestion
score: 2

http://stackoverflow.com/q/21781911
has comment: http://stackoverflow.com/comment/32954363
tagged with: user-interface
has body: What is the advantage of declaring + instantiating variables in the constructor, instead of declaring outside and just instantiate in the constructor, or even declaring + instantiation both of them outside? public class GUIview extends JFrame { public GUIview() { JPanel pan = new JPanel(); JSplitPane splitPane = new JSplitPane(); } public static void main(String[] args) { GUIview view = new GUIview(); view.setVisible(true); } } or public class GUIview extends JFrame { JPanel pan; JSplitPane splitPane; public GUIview() { pan = new JPanel(); splitPane = new JSplitPane(); } public static void main(String[] args) { GUIview view = new GUIview(); view.setVisible(true); } }
tagged with: constructor
has answer: http://stackoverflow.com/a/21782835
type: UnansweredQuestion
tagged with: declaration
has answer: http://stackoverflow.com/a/21782521
has title: Advantage of declaring and instantiating variables in java GUI constructor
tagged with: java
type: Question
tagged with: instantiation
score: 0
answer count: 2

http://stackoverflow.com/comment/33151482
has text: If you're really up for it, you could create your own print dialog and setting the printer attributes directly...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21765437

http://stackoverflow.com/a/36423769
answers question: http://stackoverflow.com/q/21745697
has body: def testCSV() { when: def A = inputValues.split(",")[0] def B = inputValues.split(",")[1] then: println A println B where: inputValues &lt;&lt; new File( "\\src\\test\\resources\\test.txt").readLines().toList() /* To get specific Rows inputValues &lt;&lt; new File( "\\src\\test\\resources\\test.txt").readLines().toList().subList(1,10) */ }
score: 0
type: Answer

http://stackoverflow.com/comment/32778180
type: Comment
has text: `java.util.ArrayList[Int]` does not conform to `java.util.List[_ <: java.lang.Comparable[_ >: Any]]` simply because `Int` is not a sub-type of `java.lang.Comparable` (but `java.lang.Integer` is). So the compiler is entrely right to complain if you pass an instance of `java.util.ArrayList[Int]` to `binarySearch`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21681810

http://stackoverflow.com/q/21761987
answer count: 1
favorite count: 0
downvote count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/32920137
tagged with: netbeans
type: UnansweredQuestion
type: Question
tagged with: java
has body: I've followed the tutorial link below, so to create an android project within Netbeans but I can't find the design view even when I click on the XML files. Am I missing something? https://blogs.oracle.com/geertjan/entry/dummy_guide_to_netbeans_android Any tutorials explaining this would be great :-) The reason I would rather use Netbeans over Eclipse, is that netbeans allows the use of a pallet to drag "buttons" or "listbox-es" over to the design view. And on click open up the buttons functions i.e. "on click" or "on item state change"
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32920337
has answer: http://stackoverflow.com/a/21762490
has title: Stuck on making Android apps with NetBeans, missing functions I normally love
upvote count: 1
score: -2

http://stackoverflow.com/comment/32920980
comment on: http://stackoverflow.com/q/21762987
type: Comment
type: QuestionComment
score: 2
has text: I don't know of a library, but you can simply implement your own helper using these tables: http://en.wikipedia.org/wiki/Web_colors#HTML_color_names

http://stackoverflow.com/comment/33906444
type: Comment
type: QuestionComment
has text: Is this issue still open?
comment on: http://stackoverflow.com/q/21833155
score: 0

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/21801129
tags question: http://stackoverflow.com/q/21814390
type: Tag
tags question: http://stackoverflow.com/q/21836154

http://stackoverflow.com/comment/32898344
type: AnswerComment
comment on: http://stackoverflow.com/a/21750173
has text: Are you sure it's null, not an empty list?
type: Comment
score: 0

http://stackoverflow.com/comment/32970181
comment on: http://stackoverflow.com/a/21774137
type: Comment
has text: As Paul Sandoz said, if we were starting over we might consider putting more implementations into default methods on Collection/List/Set, but this could be problematic. Interfaces cannot have state (though the Abstract* classes don't have any); nor can interfaces define protected or private interfaces, which are used in the abstract classes. Bottom line is that interfaces and default methods don't provide mixins, and this wasn't the design goal of default methods anyway.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/76338252
has text: How do i do that in Android Studio ? @AbdelazizMirad Did you find a solution ?
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21812046

http://stackoverflow.com/comment/33004886
type: AnswerComment
has text: Yes I really want to move and not to copy but I messed up with the imports. How would I move to D:\Dev my current projects in C:\Users\krato\workspace?
comment on: http://stackoverflow.com/a/21809944
score: 0
type: Comment

http://stackoverflow.com/comment/32980024
has text: Are you attempting to remove the whole table and create another one then add it back?
score: 0
comment on: http://stackoverflow.com/q/21796021
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21742049
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/21742528
has comment: http://stackoverflow.com/comment/32884315
has answer: http://stackoverflow.com/a/21742100
tagged with: java
linked to: http://stackoverflow.com/q/9361623
has comment: http://stackoverflow.com/comment/32884763
tagged with: tomcat6
type: Question
has comment: http://stackoverflow.com/comment/32884224
upvote count: 0
score: -2
tagged with: tomcat
has body: I've installed Tomcat7, set the systems environmental variables for both JAVA_HOME and CATALINA_HOME. However, when I try and run startup from command prompt I'm getting the following error. CATALINA_HOME environmental veriable is not defined correctly. This environmental variable is needed to run this program. Here's the command prompt: Also I've set the enviromental veriables like this: I don't understand why this is happening?
has comment: http://stackoverflow.com/comment/32884192
has answer: http://stackoverflow.com/a/21743731
has title: CATALINA_HOME environmental veriable is not defined correctly
answer count: 3
has comment: http://stackoverflow.com/comment/32884199

http://stackoverflow.com/q/21723766
has body: I am just a newbie in Java. I have this following code snippets: class Canvas extends JPanel{ int x=-10,y=-10,z=-10; public Canvas() { } public void setCoordinates(int x,int y, int z){ this.x=x; this.y=y; this.z=z; } public void paintComponent(Graphics g) { for(int i=0; i&lt;50 ;i++){ if(p[i].z==1) g.setColor(Color.red); else if (p[i].z==2) g.setColor(Color.green); else g.setColor(Color.blue); g.fillArc(p[i].x-5,p[i].y-5,10,10,0,360); } } } I have this class, it's a separate class from the one where p belongs. public class Frame extends JFrame{ ...... public static Points[] p = new Points[50]; .... } How can I call the points I have in the class Frame so that I can use it in the class Canvas??
has answer: http://stackoverflow.com/a/21723851
has answer: http://stackoverflow.com/a/21723837
accepted answer: http://stackoverflow.com/a/21723826
has answer: http://stackoverflow.com/a/21723874
tagged with: swing
has title: Accessing variable from another class
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21723955
possible better answer: http://stackoverflow.com/a/21723874
has answer: http://stackoverflow.com/a/21723821
tagged with: java
tagged with: jpanel
type: Question
has answer: http://stackoverflow.com/a/21723826
answer count: 6
tagged with: variables
tagged with: class
score: 0

http://stackoverflow.com/a/21792856
downvote count: 0
score: 1
upvote count: 1
has body: Always initialization of the variable declared to class is important Image wall = null;
type: Answer
answers question: http://stackoverflow.com/q/21792813

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/21841283
tags question: http://stackoverflow.com/q/21815468
tags question: http://stackoverflow.com/q/21778279
tags question: http://stackoverflow.com/q/21722612
tags question: http://stackoverflow.com/q/21691402

http://stackoverflow.com/q/21768803
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8853387
tagged with: tomcat7
tagged with: java
type: Question
has title: Which temp directory should I use in Tomcat?
has body: I'm developing a tomcat webapp. When run, my webapp generates data files that I'd like to be persistent between tomcat restarts, or at least I'd like to control when they're deleted. Both workDir (i.e., javax.servlet.context.tempdir) and the java temp dir (i.e. java.io.tmpdir) are implied to be temporary. Is there some other directory I could use?
has answer: http://stackoverflow.com/a/21769841
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32931781
tagged with: tomcat

http://stackoverflow.com/a/21735675
accepted answer of: http://stackoverflow.com/q/21735432
has comment: http://stackoverflow.com/comment/32896329
type: Answer
answers question: http://stackoverflow.com/q/21735432
has comment: http://stackoverflow.com/comment/32875911
type: AcceptedAnswer
has body: boolean isFinished = true; if (drawArray[ROW][COL+1] == ' ' &amp;&amp; drawArray[ROW][COL+2] == 'E') { move(ROW,COL,ROW,COL+2); } else if (drawArray[ROW][COL-1] == ' ' &amp;&amp; drawArray[ROW][COL-2] == 'E') { move(ROW,COL,ROW,COL-2); } else if (drawArray[ROW+1][COL] == ' ' &amp;&amp; drawArray[ROW+2][COL] == 'E') { move(ROW,COL,ROW+2,COL); } else if (drawArray[ROW-1][COL] == ' ' &amp;&amp; drawArray[ROW-2][COL] == 'E') { move(ROW,COL,ROW-2,COL); } else { isFinished = false; } int foundOpen = 0; if (!isFinished) { That should do. If you do this kind of looking at naybors more often: static final int[][] naybors = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 }, }; boolean isFinished = false; for (int[] nb : naybors) { if (drawArray[ROW + nb[0]][COL + nb[1]] == ' ' &amp;&amp; drawArray[ROW + 2*nb[0]][COL + 2*nb[1]] == 'E') { move(ROW, COL, ROW + 2*nb[0], COL + 2*nb[1); isFinished = true; break; } } Also saw: else if(drawArray[ROW][COL-1] == ' ' &amp;&amp; drawArray[ROW][COL-2] != '*'){ drawArray[ROW][COL-2] = '*'; prevCol = COL; prevRow = ROW; //Wrong: ROW-= 2; COL -= 2; // Good? foundOpen = 1; }
score: 0

http://stackoverflow.com/comment/32791820
type: Comment
type: QuestionComment
has text: Is converting the tables to utf8 an option?
comment on: http://stackoverflow.com/q/21689665
score: 0

http://stackoverflow.com/comment/113545226
score: 2
has text: @mystdeim Because Arrays.asList returns an unmodifiable list, meaning trying to add/remove an element it will throw an UnsupportedOperationException.
comment on: http://stackoverflow.com/a/21696844
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21684794
has body: This is exactly why the animalsniffer-maven-plugin was introduced: Animal Sniffer provides tools to assist verifying that classes compiled with a newer JDK/API are compatible with an older JDK/API.
downvote count: 0
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21683738
answers question: http://stackoverflow.com/q/21683738
type: Answer
upvote count: 4

http://stackoverflow.com/q/21681071
has comment: http://stackoverflow.com/comment/32776145
type: Question
has comment: http://stackoverflow.com/comment/32788697
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/32794362
has comment: http://stackoverflow.com/comment/32783183
answer count: 2
has comment: http://stackoverflow.com/comment/32861997
has answer: http://stackoverflow.com/a/21730892
has comment: http://stackoverflow.com/comment/32775196
has answer: http://stackoverflow.com/a/26790406
has title: Java Swing screen artifacts
tagged with: artifact
has comment: http://stackoverflow.com/comment/32777547
downvote count: 0
has comment: http://stackoverflow.com/comment/32783551
possible better answer: http://stackoverflow.com/a/26790406
tagged with: repaint
favorite count: 0
accepted answer: http://stackoverflow.com/a/21730892
has comment: http://stackoverflow.com/comment/32778844
tagged with: swing
has comment: http://stackoverflow.com/comment/32777716
has comment: http://stackoverflow.com/comment/32862162
type: AnsweredQuestion
has body: I have a Swing application with some sort of repaint issue. When a screen (JFrame) is closed, artifacts from that screen are sometimes painted over other screens. It is completely unreproducible on the 100+ developer machines at our office and most of the thousands of users using this software. For the past several years, there have been scattered reports of the issue, but we have always blamed in on the graphics card or driver. The number of reports of the issue have risen sharply, though, in the last several months, so we need to figure out the real cause. Almost all of our clients run on Windows, and it affects both Windows 7 and 8 machines. We typically run on JRE 1.6.0_29, but the issue also happens on 1.6.0_45 and 1.7.0_51. The picture below illustrates the issue. I outlined the artifact in red - this is part of another JFrame that was closed. When the JFrame was visible, it wasn't at that location on the screen. Also note that the columns of the JTable just above the artifacts are out of line. Lastly, notice that the artifact isn't painted just over the JTable, but over its parent JScrollPane and a separate JPanel at the very bottom of the screen. Anybody have any ideas what could cause this?
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/32780197
upvote count: 7

http://stackoverflow.com/a/21834412
has body: I have implemented a page curl effect in an OpenGL ES 2.0 vertex shader and I will share this code with you. It uses the texture coordinates to control the rotation angle of the page. This way, the rotation is not affected by the position of the triangle mesh in the scene, only how far down the vertices are on the curled page. This works well, but I eventually abandoned this approach for a much simpler implementation where the curl was faked with just a few triangles rendered flat over the page and using textures to fake some shadow effects. Having done it both ways, I suspect that probably all of the page curl effects out there are done the fake way because it is just much simpler to implement and debug. uniform mat4 transform_matrix; uniform highp float radius; uniform mediump vec2 axis; uniform mediump vec2 axis_origin; uniform highp float tex_size; attribute vec2 texCoord; varying vec2 texCoordVarying; varying float shadeVarying; mat4 rotationxy(float angle, vec2 axis); mat4 translationThenRotationZ(float x, float y, float z, float angle); void main() { vec3 axisOrigin = vec3(axis_origin, radius); vec2 offsetTexCoord = texCoord - axis_origin; float angle = dot(offsetTexCoord, vec2(axis.y, -axis.x)) / radius; vec4 coord; vec4 myNormal = vec4(0.0, 0.0, 1.0, 1.0); if (angle &lt;= 0.0) { // Flat section before curl coord = vec4(texCoord, 0.0, 1.0); } else { vec2 proj = dot(offsetTexCoord , axis) * (axis); const float PI = 3.14159265358979323846264; if (angle &gt;= PI) { // Flat section after curl float axisAngle = asin(axis.x); proj += axis_origin; mat4 tr = translationThenRotationZ(proj.x, proj.y, 0.0, axisAngle); coord = vec4((PI - angle) * radius, 0.0, (radius + radius), 1.0); coord = tr * coord; myNormal.z = -1.0; } else { // Curl mat4 r = rotationxy(angle, axis); myNormal = r * myNormal; coord = vec4(proj, -axisOrigin.z, 1.0); r[3][0] = axisOrigin.x; r[3][1] = axisOrigin.y; r[3][2] = axisOrigin.z; coord = r * coord; } } gl_Position = transform_matrix * coord; s…
downvote count: 0
upvote count: 6
answers question: http://stackoverflow.com/q/21783446
accepted answer of: http://stackoverflow.com/q/21783446
type: AcceptedAnswer
score: 6
type: Answer

http://stackoverflow.com/comment/32901085
has text: Movie is not a custom class. You can see the whole project [here](http://iamvijayakumar.blogspot.in/2012/06/android-animated-gif-example.html). Now how to draw a image which fits the canvas in this project.?
score: 0
comment on: http://stackoverflow.com/a/21751419
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21832803
tagged with: java
tagged with: save
type: Question
has answer: http://stackoverflow.com/a/21833210
has comment: http://stackoverflow.com/comment/33045050
accepted answer: http://stackoverflow.com/a/21833292
has body: In my android app, when the back button is pressed I want the app to save. This is my code: @Override public void onBackPressed() { super.onBackPressed(); Log.d("VIVZ", counter + "Was Saved"); } So when i press the back button It exits the app and then when I go back into the app It has not saved.
score: 0
possible better answer: http://stackoverflow.com/a/21832858
has answer: http://stackoverflow.com/a/21833292
answer count: 3
tagged with: button
tagged with: android
has comment: http://stackoverflow.com/comment/33045054
has comment: http://stackoverflow.com/comment/33044995
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21832858
has title: Save when back button is pressed

http://stackoverflow.com/q/21701405
has answer: http://stackoverflow.com/a/21702075
has comment: http://stackoverflow.com/comment/32811680
has comment: http://stackoverflow.com/comment/32811303
tagged with: class
answer count: 1
downvote count: 0
tagged with: awtrobot
favorite count: 0
tagged with: include
has comment: http://stackoverflow.com/comment/32812724
has title: Java -> including robot class in eclipse
type: UnansweredQuestion
has body: I would like to work with this robot class : http://docs.oracle.com/javase/1.5.0/docs/api/java/awt/Robot.html for generating native system input´s, thats why i created this file: import java.awt.Robot; public class MouseClass { public static void main(String[] args) throws Exception { Robot robot = new Robot(); // SET THE MOUSE X Y POSITION robot.mouseMove(300, 550); } } but i got this error-msg: Exception in thread "main" java.lang.NoClassDefFoundError: robot/robot_v1 Caused by: java.lang.ClassNotFoundException: robot.robot_v1 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) I thought, the awt.robot is already integrated in eclipse? ok if not..i dont know where to download this robot-class, the only page i found is: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/awt/Robot.java but thats "Robot.java" and the error-message doent change when i include this in my "src". Any advices how i can use this robot-class? SOLVED ,but: i get a compilation problem Exception in thread "main" java.lang.Error: Unresolved compilation problem: at robot.robot_v1.main(robot_v1.java:5) For this line: public static void main(String[] args) throws Exception { do i have to change name´s here as well in this case? greetings => SOLDED with package robot;
has comment: http://stackoverflow.com/comment/32811594
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/21720074
score: 0
has body: If they are different processes, better do not share anything directly, but connect them via TCP/IP. Let one of them be a server and another a client. If you really need to share, put both native and java parts in the same process. Traditional way is to make java part the main one, and add native part as a library. But opposite way to load JVM as a library is also possible:http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/invocation.html.
answers question: http://stackoverflow.com/q/21719346
type: Answer

http://stackoverflow.com/a/21803601
answers question: http://stackoverflow.com/q/21802451
type: Answer
has body: Well, i analysed your code thoroughly and there does not seem to be any problem in it. But, i guess the problem is this : When you call Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -5f, 0f, 0f, 0f, 0f, 1.0f, 0.0f); You are setting the camera at Z = -5 and looking towards origin i.e towards the +ve Z direction. (I guess initially the vertices of the triangle must be in XY plane and hence the triangle is visible.) Then when you call Matrix.setRotateM(zRotationMatrix, 0, anguloZ, 0, 0, 1); It rotates the triangle about Z axis which is fine. But then you call Matrix.setRotateM(xRotationMatrix, 0, anguloX, 1, 0, 0); Matrix.setRotateM(yRotationMatrix, 0, anguloY, 0, 1, 0); Here you are rotating the triangle about X and Y axis and since triangles have no thickness, It becomes invisible. Possible fixes : 1) Remove the rotations about X and Y axis and check if it works. OR 2) Put a cube instead of triangle and see if it works. OR 3) If neither works, give me the full code.I will debug and run it. Best of Luck
score: 0

http://stackoverflow.com/q/21790021
has body: My program contains a label with the caption “Choose a coffee” and four check boxes – Americano, Espresso, Double Espresso and Latte. Note: A JCheckBox array is recommended here) I need to add event handling code to allow the user to purchase one or more items. The bill amount is displayed in a label after the user has made their selections. The prices are Americano €3.75, Espresso €4.00, Double Espresso €4.50 and Latte €3.50. An array is suitable here also. As the user makes a choice a label is displayed showing the bill. I cant figure out how to add the cost when the check box is selected and remove the cost when it is de selected using the arrays. Any help appreciated. This is my code so far: package Lab4EventHandling; import java.awt.*; import java.awt.event.*; import javax.swing.*; class Frame3 extends JFrame implements ActionListener { private Container cPane; private JLabel tMsg, bMsg; private JCheckBox americano, espresso, doubleEspresso, latte; JCheckBox[] boxes = new JCheckBox[]{americano, espresso, doubleEspresso, latte}; private JPanel checkPanel = new JPanel(new GridLayout(0,1)); private Color cl; private double cost = 0; private final int WINDOW_WIDTH = 200; private final int WINDOW_HEIGHT = 200; private final int x = 550; private final int y = 400; public Frame3() { cPane = getContentPane(); cl = new Color(150, 150, 250); cPane.setBackground(cl); this.setLayout(new BorderLayout(0,1)); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocation(x,y); this.add(checkPanel, BorderLayout.CENTER); tMsg = new JLabel("Choose a coffee:" ,SwingConstants.CENTER); tMsg.setBorder(BorderFactory.createEmptyBorder(4,4,4,4)); this.add(tMsg, BorderLayout.PAGE_START); americano = new JCheckBox("Americano", false); checkPanel.add(americano); americano.addActionListener(this); espresso = new JCheckBox("Espresso", false); checkPanel.add(espresso); espresso.addActionListener(this); doubleEspresso = new JCheckBox("Double Espresso", false); checkPanel.add(doubleEspr…
tagged with: jcheckbox
has title: Add values when JCheckBox clicked
has comment: http://stackoverflow.com/comment/32969756
answer count: 3
has comment: http://stackoverflow.com/comment/32969792
has answer: http://stackoverflow.com/a/21790480
has comment: http://stackoverflow.com/comment/32969789
downvote count: 0
favorite count: 0
tagged with: jframe
possible better answer: http://stackoverflow.com/a/21790475
has comment: http://stackoverflow.com/comment/32969685
has answer: http://stackoverflow.com/a/21790475
has comment: http://stackoverflow.com/comment/32969650
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21790480
has answer: http://stackoverflow.com/a/21792361
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question

http://stackoverflow.com/comment/32981096
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21796055
score: 0
has text: absolutely right and the files may be having at max 10 lines

http://stackoverflow.com/q/21825348
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: How to implement progress bar in javafx with time elapsed and estimated time remaining values?
has answer: http://stackoverflow.com/a/21827153
score: 2
tagged with: java
tagged with: javafx
has body: How to implement a progress bar in javafx with time elapsed and time remaining values in the bar? Kindly provide any sample programs if possible.
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33047623
has comment: http://stackoverflow.com/comment/34456274

http://stackoverflow.com/q/21757312
accepted answer: http://stackoverflow.com/a/21760114
has comment: http://stackoverflow.com/comment/32915018
tagged with: jsf-2
score: 0
has answer: http://stackoverflow.com/a/21760114
answer count: 1
has title: jsf passing a string made from one bean to a string in another bean
has comment: http://stackoverflow.com/comment/32915136
type: AnsweredQuestion
tagged with: jsf
tagged with: java
type: Question
has body: In my jsf 2.0 code when you complete a form it takes account of all the "error" values you your stated in one form and adds it to a string buffer when the commandbutton is pressed then i covert it to a string. Now what i want is for this string to go to the next bean as a value so that the text area input on the next jsf page would have that information already added there. But sadly I am drawing a blank on how i would like to make this happen Here is what i have written down so far. I am not getting any kind of error from either pages or beans its just nothing is showing up any help would be appreciated and very well love. public String fillForm(){ boolean failTest = false; String errorCodeForNcpForm = ""; StringBuffer buffer = new StringBuffer(); buffer.append (" "); if (!unitSerialValue.equalsIgnoreCase("P")) { buffer.append (1 + unitSerialValue ); failTest = true; buffer.append(" "); } if(!screenProValue.equalsIgnoreCase("P")) { buffer.append (2 + unitSerialValue ); failTest = true; buffer.append(" "); } if(failTest) { //gets the whole error code errorCodeForNcpForm = buffer.toString(); NcpFormBean ncpForm = new NcpFormBean(); //Sets the error code to the value ncpForm.setproblemQcValue(errorCodeForNcpForm); return "ncpFormQc"; } else return "index"; } here is the xhtml section that contains the code for the value. Problem Description: <h:inputTextarea value="#{ncpFormBean.problemQcValue}" id="problemDec" required="true" cols="30" rows="10"> <f:validateLength minimum="1" maximum="30" /> </h:inputTextarea> <h:message for="problemDec" style="color:red" /> The second bean "ncpFormBean" has nothing currently but the standard getters and setters,and both beans are session scope.

entitymanager
tags question: http://stackoverflow.com/q/21821958
tag name: entitymanager
tags question: http://stackoverflow.com/q/21746637
type: Tag
tags question: http://stackoverflow.com/q/21746791
tags question: http://stackoverflow.com/q/21759197

http://stackoverflow.com/comment/32895308
type: Comment
comment on: http://stackoverflow.com/a/21748434
has text: Can you please point me to a resource which says this "enum are initialised in a static initialiser block generated by the compiler." officially? I mean tried finding but could get one.
score: 1
type: AnswerComment

http://stackoverflow.com/q/21734508
accepted answer: http://stackoverflow.com/a/21737765
linked to: http://stackoverflow.com/q/2011264
has comment: http://stackoverflow.com/comment/32876124
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32878231
possible better answer: http://stackoverflow.com/a/21734637
has answer: http://stackoverflow.com/a/21737765
has comment: http://stackoverflow.com/comment/32870117
has title: check file permissions on remote user with credentials using java
has answer: http://stackoverflow.com/a/21734637
has comment: http://stackoverflow.com/comment/32878974
has comment: http://stackoverflow.com/comment/32870267
has comment: http://stackoverflow.com/comment/32870109
has body: I wanted to check if the given file path(can be shared path,local path on remote windows server) on remote windows machine is existing,is directory and has write permissions from windows machine. I will be supplied with remote host name, userid,password and file path. I am using java 1.6 for example: from my windows machine, I need to access \\ABDCDMACHINE\DDRIVE\FFOLDER\XXFILE I know this can be done using File API. methods in this API, takes parameter of URI/URL, but I want to know how form URL with user name and password included in it.
has comment: http://stackoverflow.com/comment/32873661
has comment: http://stackoverflow.com/comment/32870469
has comment: http://stackoverflow.com/comment/32876287
linked to: http://stackoverflow.com/q/11724576
has comment: http://stackoverflow.com/comment/32870300
has comment: http://stackoverflow.com/comment/32870240
tagged with: file
has comment: http://stackoverflow.com/comment/32876118
type: AnsweredQuestion
tagged with: network-programming
has comment: http://stackoverflow.com/comment/32870204
linked to: http://stackoverflow.com/q/10599999
has comment: http://stackoverflow.com/comment/32873128
has comment: http://stackoverflow.com/comment/32870239
tagged with: java

http://stackoverflow.com/q/21829193
tagged with: android
score: 1
possible better answer: http://stackoverflow.com/a/21829458
has body: I have two tabs in my app and there are listviews in this tabs. I set List data to each listvew. I want to delete form list, and from listview when I click [x] image. Item deleted from list In my code , but I dont know how to update listview,I use notifyDataSetChanged() in my customadapter, but not update. Activity for first tab: public static List&lt;Product&gt; mCartList; mCartList = AllProducts.getCartList(); listViewCatalog = (ListView) findViewById(R.id.my_order_list); mProductAdapter = new CustomListAdapter(MyOrders.this, mCartList, "", true); listViewCatalog.setAdapter(mProductAdapter); my Custom List Adapter: public class CustomListAdapter extends BaseAdapter { private LayoutInflater layoutInflater; private Context mContext; private List&lt;Product&gt; mProductList; private String mType; private boolean mShowQuantity; public CustomListAdapter(Context context, List&lt;Product&gt; list, String type, boolean showQuantity) { layoutInflater = LayoutInflater.from(context); mContext = context; mProductList = list; mShowQuantity = showQuantity; mType = type; } @Override public int getCount() { return mProductList.size(); } @Override public Object getItem(int position) { return mProductList.get(position); } @Override public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder item; final int finalMPosition = position; if (convertView == null) { convertView = layoutInflater.inflate(R.layout.list_row, null); item = new ViewHolder(); item.imageView = (ImageView) convertView.findViewById(R.id.product_image); item.name = (TextView) convertView.findViewById(R.id.name); item.pid = (TextView) convertView.findViewById(R.id.pid); item.price = (TextView) convertView.findViewById(R.id.price); item.description = (TextView) convertView.findViewById(R.id.description); item.removeProduct = (ImageView) convertView.findViewById(R.id.removeProduct); item.addToCart = (TextView) convertView.findViewById…
has answer: http://stackoverflow.com/a/21845520
has answer: http://stackoverflow.com/a/21844570
has answer: http://stackoverflow.com/a/21829458
has answer: http://stackoverflow.com/a/21925382
upvote count: 1
accepted answer: http://stackoverflow.com/a/21845520
has comment: http://stackoverflow.com/comment/33065923
has comment: http://stackoverflow.com/comment/33038412
answer count: 9
has answer: http://stackoverflow.com/a/21845274
tagged with: java
has answer: http://stackoverflow.com/a/21830503
tagged with: listview
has answer: http://stackoverflow.com/a/21925584
has answer: http://stackoverflow.com/a/21829575
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21844477
downvote count: 0
tagged with: adapter
has title: How to update listview in tab?
favorite count: 0
has comment: http://stackoverflow.com/comment/33039146
type: Question

http://stackoverflow.com/q/21816440
favorite count: 0
tagged with: int
has title: Java int issue while intializtion
answer count: 5
linked to: http://stackoverflow.com/q/10920432
has comment: http://stackoverflow.com/comment/33016498
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/33016497
has answer: http://stackoverflow.com/a/21816588
has answer: http://stackoverflow.com/a/21816485
has body: I have been working on a project and i saw some references on web and they initialized : int val= 0x000; output 0 int val1= 0x001; output 1 How exactly java is converting this? Thanks
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21816492
type: Question
has answer: http://stackoverflow.com/a/21816468
downvote count: 0
has comment: http://stackoverflow.com/comment/33016437
has answer: http://stackoverflow.com/a/21816462

http://stackoverflow.com/a/21805673
upvote count: 3
score: 3
has body: You already noticed that this is an abstraction. Namely that there is no real work performed. Instead, the work is just "imitated" by a set of Integers that represent the amount of work. The question about how to run or stop the processes is somewhat hidden in the algorithm itself: The LinkedList stores the "active" processes. They are all started at the beginning. In each turn, they receive a short time slot in which they can do some of their work. When all their work is done, they are removed from the list. In the simplest form, when the Integer values are replaced by real tasks, you could replace the line if(process.peek() == 0 ){ ... } with something like Task task = process.peek(); if (task.isFinished()) { ... } Otherwise (in the else case), when there is work to be done, you could replace the lines temp = process.pop(); process.push(temp - 1); with something like Task task = process.peek(); task.doALittleBitOfWork(); The code that you posted was originally part of a question, so one has to assume that there's still something wrong with it, but maybe it is sufficient to get the basic idea.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21803545

http://stackoverflow.com/comment/33033067
score: 0
type: Comment
has text: @VishalSanthrama I thought the 2 loops are necesarry to a) not stop until interrupted (outer loop) and b) even if interrupted not stop until the List is empty (inner loop). If i´m wrong correct me.
comment on: http://stackoverflow.com/q/21825629
type: QuestionComment

http://stackoverflow.com/comment/33021064
score: 0
has text: @SotiriosDelimanolis That would implicitly violate both the Java Language Specification #4.5 and the Java Virtual Machine Specification #2.5 (same wording in each).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21818618

http://stackoverflow.com/comment/32994096
type: Comment
comment on: http://stackoverflow.com/a/21803957
type: AnswerComment
has text: Then please search SO for yourself, this topic is as old as Java.
score: 1

http://stackoverflow.com/q/21825252
has comment: http://stackoverflow.com/comment/33032144
has title: java left pad zeros in a string with spaces in the middle
has comment: http://stackoverflow.com/comment/33032009
type: UnansweredQuestion
tagged with: pad
has comment: http://stackoverflow.com/comment/33032135
upvote count: 1
tagged with: spaces
has comment: http://stackoverflow.com/comment/33032236
has comment: http://stackoverflow.com/comment/33032061
tagged with: java
has comment: http://stackoverflow.com/comment/33032373
duplicate of: http://stackoverflow.com/q/4469717
has comment: http://stackoverflow.com/comment/33032097
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21825515
answer count: 2
has comment: http://stackoverflow.com/comment/33032291
has comment: http://stackoverflow.com/comment/33031974
score: 0
has body: I'm looking for a performance solution in multi threading processes in JSE 1.7.0.52 for this problem: I have a String for example: " 12697 26 " I need to have a string as "00012697 26 " This means that I can't use String.formatter method as: String c = " 12697 26 ";&lt;br /&gt; String.format( "%1$15s", c);&lt;br /&gt;&lt;br /&gt; Because the result will be the same of the input. The 15s fill the string on left with spaces but I need to fill by zeros.... Some performace solution exists in new version of Java ? Kind regards
linked to: http://stackoverflow.com/q/4469717
has answer: http://stackoverflow.com/a/21825679
has comment: http://stackoverflow.com/comment/33031905
has comment: http://stackoverflow.com/comment/33032062
favorite count: 0

http://stackoverflow.com/comment/32775607
score: 0
type: Comment
type: QuestionComment
has text: if i open downloaded images of type jpg,png it does not open and other files contain data but not complete data.
comment on: http://stackoverflow.com/q/21681173

http://stackoverflow.com/comment/33180975
comment on: http://stackoverflow.com/q/21839302
score: 0
has text: @Vjeetje as BennX said you can only sort Actors inside a Group. So the only solution i can think about is: If that special order is needed rremove that `Actor` from the group, add it to the `Stage`, order the `Actor`s and `Group`s and draw them. As soon as you need the `Actor` back in the `Group` again, for some reason, remove it from the `Stage` and add it to the `Group`. It is pretty complicated, but should work. Otherwise, don't use Scene2D. I also like Scene2D but everything has a disadvantage to...
type: QuestionComment
type: Comment

drawable
tags question: http://stackoverflow.com/q/21813661
tags question: http://stackoverflow.com/q/21800802
tag name: drawable
tags question: http://stackoverflow.com/q/21822526
type: Tag

http://stackoverflow.com/a/21710758
answers question: http://stackoverflow.com/q/21710072
score: 0
type: Answer
has body: BufferedReader will deal well with huge files that won't fit in memory, it's pretty fast and deal with both \r and \n import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class ReadByLine { /** * @param args * @throws FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException { File f = new File("xyz.txt"); int lineNumber = 666; BufferedReader br = new BufferedReader(new FileReader(f)); String line = null; int count = -1; try { while((line = br.readLine())!=null){ count++; if (count == lineNumber){ //get the line, do what you want break; } } } catch (IOException e) { e.printStackTrace(); } finally{ try { br.close(); } catch (IOException e) { br = null; } } //do what you want with the line } }

http://stackoverflow.com/comment/62016588
score: 0
type: Comment
type: QuestionComment
has text: I described how to change or, for your case, remove the dialog icon for **non** native print dialogs for a previous question of this same topic. [**Here**](http://stackoverflow.com/a/37243645/1718678) is the answer with the code.
comment on: http://stackoverflow.com/q/21765437

http://stackoverflow.com/q/21823938
score: 0
answer count: 3
has title: HashMap data not appending new data into ArrayList
has answer: http://stackoverflow.com/a/21825292
has body: I am using the following code to connect with java socket from an Applet client. I store Client's IP Address and some random number in every NEW connection happening in addNewClient() function in the below code. I store this info in HashMap. I add more client info in the ArrayList of this HashMap. If there is already some client info in ArrayList, I need to read through it. I am trying that in SocketConnection class below using Iterator. The problem I see is, I am adding some 3 client info into the ArrayList. But, when i read through it using Iterator, it can get only last added Client info, and other KEYS are just getting empty. But, at the same time, its giving the ArrayList size correctly as 3 Could some experts please refer my below complete code, and advise me what could be the problem in there? public class DataSharingSocketListner { public static void main(String[] args) { System.out.println("client trying to connect before thread creation"); Thread thr = new Thread(new SocketThread()); thr.start(); } } class SocketThread implements Runnable { HashMap&lt;String, ClientInfo&gt; clientInfo = new HashMap&lt;String, ClientInfo&gt;(); ArrayList&lt;HashMap&lt;String, ClientInfo&gt;&gt; myList = new ArrayList&lt;HashMap&lt;String, ClientInfo&gt;&gt;(); @Override public void run() { try { System.out.println("client trying to connect after thread creation"); ServerSocket server = new ServerSocket(8080); while (true) { SocketConnection client = new SocketConnection(server.accept(), clientInfo, myList); client.start(); } } catch (IOException e) { e.printStackTrace(); } } } class SocketConnection extends Thread { InputStream input; PrintWriter output; Socket socket; ObjectOutputStream out = null; OutputStream clientOutput; Scanner scannerObj; HashMap&lt;String, byte[]&gt; hm; InetAddress addr; HashMap&lt;String, ClientInfo&gt; clientinfo; ArrayList&lt;HashMap&lt;String, ClientInfo&gt;&gt; clientList; public SocketConnection(Socket socket, HashMap&lt;String, ClientInfo&gt…
tagged with: sockets
accepted answer: http://stackoverflow.com/a/21824968
type: AnsweredQuestion
tagged with: serversocket
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21824968
possible better answer: http://stackoverflow.com/a/21824199
has answer: http://stackoverflow.com/a/21824199

http://stackoverflow.com/a/21758351
answers question: http://stackoverflow.com/q/21758138
type: Answer
has body: You can use the following regexp: ([^\.]){3}(\....)? Here a program... import java.util.regex.Matcher; import java.util.regex.Pattern; public class C { public static void main(String[] args) { String a = "([^\\.]){3}(\\....)?"; String b = "ABC114.553111.325785.658EFG114.256114.589115.898"; Pattern pattern = Pattern.compile(a); Matcher matcher = pattern.matcher(b); while (matcher.find()) { System.out.println("found: " + matcher.group(0)); } } } Output found: ABC found: 114.553 found: 111.325 found: 785.658 found: EFG found: 114.256 found: 114.589 found: 115.898
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/21715151
score: 0
answer count: 1
tagged with: google-plus
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21716380
has body: What's the right way to configure an Eclipse Java project (NOT Android!!! it's going to be a CLI application), based on Java Quick Start app, to add the libraries and documentation to its build path? First of all, I created a new project. Then, I moved the source from the original directory (from Google) to my project's src. After this, I copied the "lib" directory to the root of my project and refreshed. I did "configure build path" but: 1) adding lib as "Class folder" doesn't take the import errors out 2) adding all the files (via Cmd-A on "Add External JARs...") makes the project runnable but the documentation isn't loaded (mouse-over method does not show the javadoc for it).
tagged with: google-api
type: Question
tagged with: java
has title: Configure Eclipse build path and javadoc Google+
tagged with: eclipse

http://stackoverflow.com/a/21826996
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21826695
has comment: http://stackoverflow.com/comment/33035552
has comment: http://stackoverflow.com/comment/33035508
has comment: http://stackoverflow.com/comment/33036109
has body: In any typed language int/number values have no format. The way Java stores int values is as 4 byte number using Two's complement, so 0 or 0x0 or 00 (octal) or 0b is the same value: 32 zeros in a binary word. SECOND EDIT: I think you are over-engineering. What you should use is a Map&lt;String,int[]&gt; map; then, if you write map.get(key), you'll obtain what you're looking for. NEW EXPLANATION: The previous solution worked because when you read the XML stored the values as decimal ones: String s="80"; int i= Integer.valueOf(s); //it stores 80 (decimal value) int value= Integer.valueOf(String.valueOf(i),16); //It stores 128, or 0x80 (hex value)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33035327
type: Answer
has comment: http://stackoverflow.com/comment/33036917
score: 2
has comment: http://stackoverflow.com/comment/33035249
upvote count: 3
answers question: http://stackoverflow.com/q/21826695
has comment: http://stackoverflow.com/comment/33035184

http://stackoverflow.com/a/21714362
answers question: http://stackoverflow.com/q/21714061
accepted answer of: http://stackoverflow.com/q/21714061
type: Answer
has comment: http://stackoverflow.com/comment/32835373
has body: instead of scanner.nextLine(), you could use scanner.next() .... This will get a string from the scanner when it does not have an end of line character. You can also call scanner.hasNextLine() to check if you have reached the line at the end that you are worried about!
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/32901937
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21752074
has text: I don't believe you can develop android apps with Matlab.
score: 0

http://stackoverflow.com/a/21789331
type: Answer
has comment: http://stackoverflow.com/comment/33054895
has body: If I understand the question correctly, you want to make sure that when Session reads from dstruct it can see all the Sessions that the Server has put in the list? The easiest thing to do would be to use the classes from java.util.concurrent, such as a ConcurrentLinkedQueue or a ConcurrentLinkedDeque. Try defining dstruct as ConcurrentLinkedQueue&lt;Session&gt;.
has comment: http://stackoverflow.com/comment/32971850
has comment: http://stackoverflow.com/comment/32969390
has comment: http://stackoverflow.com/comment/33104395
score: 0
answers question: http://stackoverflow.com/q/21788676
has comment: http://stackoverflow.com/comment/33103920
has comment: http://stackoverflow.com/comment/32969480

http://stackoverflow.com/a/21767749
has comment: http://stackoverflow.com/comment/32933371
answers question: http://stackoverflow.com/q/21766703
has comment: http://stackoverflow.com/comment/32930093
has comment: http://stackoverflow.com/comment/32930025
score: 0
type: Answer
has body: I guess, when you press back button, you want to refresh the previous activity. It is pretty simple, you can just put your method in onResume(), and it should do the trick.

http://stackoverflow.com/q/21776772
has answer: http://stackoverflow.com/a/21789855
tagged with: string
has body: I currently have an ArrayList (mapArray) such that each element of the ArrayList contains a String such as: ################ So the ArrayList could look as such: ################ #..............# #........G.....# #..............# ################ So each element is: Element 0: ################ Element 1: #..............# Element 2: #........G.....# Element 3: #..............# Element 4: ################ How would i go about adding this data to a multidimensional array so that the first element would be the row number and the second element would be the character e.g. 2DArray[2][9] = G So far i have for(int i = 0; i &lt; length; i++){ String element = mapArray.get(i); elementSplit = element.split("(?!^)"); for(int j = 0; j &lt; elementSplit.length; j++){ TwoDArray [i][j] = [i][elementSplit[j]]; } } This doesn't seem to work. Thanks for any help :) And sorry for the long post.
has answer: http://stackoverflow.com/a/21777372
tagged with: multidimensional-array
type: UnansweredQuestion
tagged with: java
has title: Adding elements to a multidimensional Array
type: Question
tagged with: arrays
score: 0
answer count: 2
tagged with: for-loop

http://stackoverflow.com/q/21714436
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19909958
has answer: http://stackoverflow.com/a/21714486
accepted answer: http://stackoverflow.com/a/21714486
downvote count: 0
score: 1
tagged with: java
tagged with: keylistener
type: Question
answer count: 2
upvote count: 1
has title: Key Listener isn't working
favorite count: 0
possible better answer: http://stackoverflow.com/a/21714497
has body: I've been experimenting with creating a java game but I've hit a roadblock, I can't get java to listen to any of my keys even when I'm just using print statements to test it out. From what I understand I've implemented KeyListener correctly and added the key listener to the Applet but it still isn't working. My main class: import java.awt.*; import javax.swing.*; public class Container extends JApplet implements Runnable { private static final long serialVersionUID = 1L; public static Dimension size = new Dimension(720,560); //Size of Screen private static final int PIXELSIZE = 2; public static Dimension pixel = new Dimension(size.width/PIXELSIZE, size.height/PIXELSIZE); // Dimesions of screen in terms of pixels public static final String NAME = "Game"; public static boolean isRunning = false; private Image screen; public static Level level; public static MainCharacter p1; public Container(){ setPreferredSize(size); addKeyListener(p1); } public void start(){ new Tile(); level = new Level(); p1 = new MainCharacter(20,40); isRunning = true; new Thread(this).start(); } public void tick(){ p1.tick(); } public void render(){ Graphics g = screen.getGraphics(); g.setColor(new Color(130,160,255)); g.fillRect(0, 0, pixel.width, pixel.height); level.render(g); p1.render(g); g = getGraphics(); g.drawImage(screen, 0, 0, size.width, size.height, 0, 0, pixel.width, pixel.height, null); g.dispose(); } public void run() { screen = createVolatileImage(pixel.width,pixel.height); while(isRunning){ tick(); render(); try{ Thread.sleep(5); }catch(InterruptedException e){} } } public static void main(String[] args){ Container container = new Container(); JFrame frame = new JFrame(); frame.add(container); frame.pack(); frame.setTitle(NAME); frame.setResizable(true); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); container.start(); } public static void right(){ p1.right(); } public static void left(){ p1.left(); } } My charac…
has answer: http://stackoverflow.com/a/21714497
has comment: http://stackoverflow.com/comment/32835536
tagged with: swing

http://stackoverflow.com/comment/32951450
type: Comment
has text: Then the query you're using is not the one I told you to use, three times already.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21779840

http://stackoverflow.com/comment/32939330
type: Comment
type: QuestionComment
has text: But the fact that you have multiple threads all of which synchronize on the same object for the entirety of their `run` method means that you're *effectively* running the code in series, not in parallel... but making your life vastly more complicated in order to do so.
score: 1
comment on: http://stackoverflow.com/q/21772414

http://stackoverflow.com/a/21699355
answers question: http://stackoverflow.com/q/21699288
score: 1
downvote count: 0
type: Answer
upvote count: 1
has body: Can you not just schedule it on a single server? E.g. you have ServerA and ServerB, just add the crontab entry to ServerA? Is it actually a cron job, or are you using something like Quartz?

http://stackoverflow.com/comment/32770513
has text: Take a look at this: http://stackoverflow.com/questions/21489289/what-is-the-equivalent-of-stringbyfoldingwithoptionslocale-in-java/21489947#21489947
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21678598
type: Comment

http://stackoverflow.com/a/21694296
answers question: http://stackoverflow.com/q/21693212
downvote count: 0
has body: This will do.. return firstString.substring(0,firstString.indexOf(strPrevString))+strNextString+firstString.substring(firstString.indexOf(strPrevString)+strPrevString.length(),firstString.length()); where strPrevString=Life is practical; and strNextString=Everything in the world
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/21804263
type: Question
has title: Can't read a file for strange reason
upvote count: 1
answer count: 1
tagged with: android-activity
has body: I have these methods for reading and writing to a file: /* Write content to a file */ private void writeToFile(ArrayList&lt;String&gt; list) { File file = new File("jokesBody1.bjk"); FileOutputStream fos; if(list != null){ try { file.createNewFile(); fos = openFileOutput("jokesBody1.bjk",Context.MODE_PRIVATE); ObjectOutputStream out = new ObjectOutputStream(fos); out.writeObject(list); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }else{ try { file.createNewFile(); fos = openFileOutput("jokesBody1.bjk",Context.MODE_PRIVATE); ObjectOutputStream out = new ObjectOutputStream(fos); out.writeObject(""); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } /* Read file's content */ private ArrayList&lt;String&gt; readFromFile() { File file = new File("jokesBody1.bjk"); ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); try { file.createNewFile(); ObjectInputStream ois = new ObjectInputStream( new FileInputStream( file ) ); try { list = (ArrayList)ois.readObject(); } catch (ClassNotFoundException e) { e.printStackTrace(); } ois.close(); } catch (IOException e) { Log.e("log activity", "Can not read file: " + e.toString()); } return list; } Everyrhing seems to be fine to me, but when I run the code I'm getting the following error: 02-15 17:02:07.655: E/log activity(1882): Can not read file: java.io.IOException: open failed: EROFS (Read-only file system) Why the system is read only? Should I do something when I'm creating the file if it does not exist by file.createNewFile();? I know that I'm missing something extremely small, but as a total beginner, I'm not able to spot it.
favorite count: 0
duplicate of: http://stackoverflow.com/q/21810399
linked to: http://stackoverflow.com/q/18418930
tagged with: android
has comment: http://stackoverflow.com/comment/32995983
linked to: http://stackoverflow.com/q/15711098
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21804294
linked to: http://stackoverflow.com/q/21810399

http://stackoverflow.com/comment/32979610
comment on: http://stackoverflow.com/q/21790033
score: 0
type: Comment
type: QuestionComment
has text: Have you tried using the `provided` scope instead of `compile`? Should be available starting from plugin version 0.8.0.

http://stackoverflow.com/comment/32896215
comment on: http://stackoverflow.com/a/21749057
type: Comment
score: 1
type: AnswerComment
has text: I was going to suggest a more OOP approach to it. Have a `Letter` class with the value, and the frequency. That provides some direct mapping and might make cleaner code. Only commenting to give OP another angle.

http://stackoverflow.com/comment/120605895
has text: your answer should be a comment as its not answering the question
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21787144

http://stackoverflow.com/a/21758232
has body: "Then I have a Source class that checks which category is selected." - I don't see any code checking the type of the Enum. This is how I use my Enums, you can do something similar. Declare your enum: public enum Media { IMAGE, VIDEO, AUDIO; } Create a the method which takes the enum as the parameter: public selectStuff(Media m) { switch(m) { case IMAGE: //Do image stuff break; case VIDEO: //Do video stuff break; case AUDIO: //Do audio stuff break; default: break; } } And this is how you would use it: selectMedia(Media.IMAGE); There is a similar example in the Oracle Docs.
score: 1
has comment: http://stackoverflow.com/comment/33027339
accepted answer of: http://stackoverflow.com/q/21757251
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21757251
type: Answer
upvote count: 1

http://stackoverflow.com/q/21723125
tagged with: smooks
has comment: http://stackoverflow.com/comment/32851589
tagged with: maven
has title: Smooks - Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
has comment: http://stackoverflow.com/comment/32851329
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21723231
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32850725
has comment: http://stackoverflow.com/comment/32852503
has comment: http://stackoverflow.com/comment/32849994
has comment: http://stackoverflow.com/comment/32849858
score: 0
has answer: http://stackoverflow.com/a/21723231
has comment: http://stackoverflow.com/comment/32849886
answer count: 1
has body: Currently, I am working with Smooks (1.5 version). In my last step, I changed names of packages in my project and the following error has been raised: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project JavaBindings: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1] There is my POM.xml file : <?xml version="1.0" encoding="UTF-8"?> 4.0.0 SmooksConversion org.smooksservices JavaBindings 1.0 <smooks.version>1.4</smooks.version> org.milyn milyn-smooks-javabean ${smooks.version} org.milyn milyn-smooks-csv ${smooks.version} org.milyn milyn-smooks-json ${smooks.version} org.milyn milyn-smooks-edi ${smooks.version} org.milyn milyn-smooks-templating ${smooks.version} org.milyn milyn-smooks-scripting ${smooks.version} org.milyn milyn-smooks-validation ${smooks.version} maven-compiler-plugin 1.5 1.5 src/main/java **/*.java src/main/resources codehaus.m2.snapshots http://snapshots.repository.codehaus.org false Thanks!

http://stackoverflow.com/a/21742138
type: Answer
has comment: http://stackoverflow.com/comment/32913988
score: 1
has body: Look under 'Markers' tab, do you see any java build path issues there? Sometimes it complains about not having src/test/resources or other directories.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21741992

executable-jar
tags question: http://stackoverflow.com/q/21781622
tags question: http://stackoverflow.com/q/21721119
tags question: http://stackoverflow.com/q/21761664
tag name: executable-jar
type: Tag

http://stackoverflow.com/q/21795676
has title: Getting Null values from Bean class in Android ?
answer count: 1
accepted answer: http://stackoverflow.com/a/21797017
has comment: http://stackoverflow.com/comment/32979415
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32979663
tagged with: javabeans
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21797017
has body: Here is how i am inserting data in Bean class and inserting Bean Class in ArrayList but when i am trying to get values from Bean getter methods i am getting NULL values. public ArrayList&lt;QuestionBean&gt; GetClickedIdImagesQuranHadeesBean(String topic_id) { ArrayList&lt;QuestionBean&gt; questionImageNameList = new ArrayList&lt;QuestionBean&gt;(); String [] splits = topic_id.split("-"); Integer [] realNumbers = new Integer [splits.length]; String sqlSelect = "SELECT topic_question.id,topic_question.question_image_name,topic.topic_name,topic_question.topic_id FROM topic_question,topic WHERE topic.id=topic_question.topic_id AND topic_question.topic_id IN "; String whereStatement = "("; for (int i = 0; i&lt;splits.length; i++) { realNumbers[i] = Integer.parseInt(splits[i]); whereStatement += realNumbers[i]+((i == splits.length -1) ? "" :","); } whereStatement += ");"; sqlSelect += whereStatement + "ORDER BY topic_question.topic_id"; Cursor cursor = database.rawQuery(sqlSelect,null); Log.i("Cursor Query Print:",""+sqlSelect); if(cursor != null) { cursor.moveToFirst(); while (!cursor.isAfterLast()) { Log.d("cursor",""+cursor); QuestionBean questionBeanInstance = new QuestionBean(); questionBeanInstance.setQuestionId(cursor.getInt(0)); Log.d("questionBeanInstance id",""+cursor.getInt(0)); questionBeanInstance.setQuestionImageName(cursor.getString(1)); Log.d("questionBeanInstance QuestionImageName",""+cursor.getString(1)); questionBeanInstance.setQuestionTopicName(cursor.getString(2)); Log.d("questionBeanInstance setQuestionTopicName",""+cursor.getString(2)); questionBeanInstance.setQuestionTopicId(cursor.getInt(3)); Log.d("questionBeanInstance setQuestionTopicId",""+cursor.getInt(3)); questionImageNameList.add(questionBeanInstance); } } else { Log.d("", "Cursor is Null"); Log.d("retrieving all parameters", "count &lt; 0"); } cursor.close(); return questionImageNameList; } // when i am trying to get values from bean class i am getting null values.Can someone please point …
type: Question
tagged with: android

http://stackoverflow.com/q/21799366
type: Question
linked to: http://stackoverflow.com/q/18037576
has title: Java 2D game character walking?
has answer: http://stackoverflow.com/a/21799596
has body: I am using keybinds, like this, for example the bottom arrow key: public class Bottom extends AbstractAction { private GameScreen gameScreen; public Bottom (GameScreen p) { this.gameScreen = p; this.gameScreen.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "Bottom"); } @Override public void actionPerformed(ActionEvent e) { this.gameScreen.getMovement().moveDown(); } } And then I detect them via movement.java: public class Movement { private Player player; public Movement(Player p) { this.player = p; } public void moveRight() { } public void moveLeft() { } public void moveUp() { } public void moveDown() { } public void jump() { this.player.jump(); } } and handled here: public class Keybinds { private GameScreen panel; public Keybinds(GameScreen game) { this.panel = game; this.addKeybinds(); } private void addKeybinds() { addKey("Bottom", new Bottom(this.panel)); addKey("Space", new Space(this.panel)); } private void addKey(String bind, AbstractAction a) { this.panel.getActionMap().put(bind, a); } } Anyway, the OS by default have a repeat timer for keys, so when I click on a key, it was 1.3 or so seconds and then continues repeating. I am trying to make a smooth walking for my game. My game doesn't have running, just walking, but I am not sure how would I do this. I can add walking queue so it adds what direction was requested &amp; then a loop that loops through walking queues and does it, but when the keys will start to repeat every millisecond or something idk the repeat delay after the main delay, it will add so many walking queues that you know, my character will get so far away. I thought of adding a timer, so it can add new queue every 1 second or something, but how would I do this? or is there a better way of adding walking system?
score: 0
has answer: http://stackoverflow.com/a/21800281
answer count: 2
accepted answer: http://stackoverflow.com/a/21800281
possible better answer: http://stackoverflow.com/a/21799596
type: AnsweredQuestion
tagged with: 2d
tagged with: java

http://stackoverflow.com/comment/32825040
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21708330
has text: We're here to help with specific problems, but we don't just write all the code for you. It looks like you've started and you've built a matrix. Are you stuck on how to sum the numbers in the matrix? Have you tried anything that didn't work?

http://stackoverflow.com/comment/32859148
score: 0
type: QuestionComment
has text: I hv modified the question. please check it.
type: Comment
comment on: http://stackoverflow.com/q/21720613

http://stackoverflow.com/a/21745371
has body: You have any number of options depending on your needs. I prefer GridBagLayout, but that's cause I've been using for 15 years. import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class FormLayout { public static void main(String[] args) { new FormLayout(); } public FormLayout() { 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 { public TestPane() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new Insets(8, 8, 8, 8); gbc.anchor = GridBagConstraints.EAST; add(new JLabel("Label 1"), gbc); gbc.gridy++; add(new JLabel("Label 2"), gbc); gbc.anchor = GridBagConstraints.WEST; gbc.gridy = 0; gbc.gridx++; gbc.gridwidth = GridBagConstraints.REMAINDER; add(new JTextField(20), gbc); gbc.gridy++; add(new JTextField(20), gbc); gbc.gridy++; gbc.gridx++; gbc.gridwidth = 1; gbc.anchor = GridBagConstraints.EAST; gbc.weightx = 1; add(new JButton("Save"), gbc); gbc.weightx = 0; gbc.gridx++; add(new JButton("Close"), gbc); } } } The problem with this, for me, is the buttons will stay in the middle of form, near the fields, as the window is resized You might not mind this, but it annoys me. I'd prefer to…
score: 2
accepted answer of: http://stackoverflow.com/q/21745118
downvote count: 0
answers question: http://stackoverflow.com/q/21745118
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/32921370
type: AnswerComment
score: 0
has text: it keeps telling me that class NegativeNumberException does not exist.
type: Comment
comment on: http://stackoverflow.com/a/21763111

http://stackoverflow.com/comment/32897582
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21749815
type: Comment
has text: Your question is unclear. Please elaborate more.

http://stackoverflow.com/comment/33027042
type: Comment
comment on: http://stackoverflow.com/q/21776669
type: QuestionComment
has text: @mcd In your answer, it shows images only ontouch. I do not understand why??
score: 0

http://stackoverflow.com/a/21770159
type: Answer
upvote count: 1
has body: You take a parent LinearLayout with orientation Vertical. Then you add a LinearLayout with orientation horizontal and put your radio buttons in it. Then add image as 2nd child of parent Linear layout. Something like this. put your radio buttons here <ImageView />
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21770094

http://stackoverflow.com/a/21751767
has comment: http://stackoverflow.com/comment/32901357
type: Answer
score: 2
upvote count: 2
has body: Because MarshallerObj.marshal(student, new FileOutputStream("User.xml")); creating new file o/p stream everytime and that clears prev contents. create this instance of o/p stream out of your while loop. that should help.
has comment: http://stackoverflow.com/comment/32901717
has comment: http://stackoverflow.com/comment/32901659
has comment: http://stackoverflow.com/comment/32901243
downvote count: 0
has comment: http://stackoverflow.com/comment/32901877
answers question: http://stackoverflow.com/q/21751624
has comment: http://stackoverflow.com/comment/32901036

http://stackoverflow.com/comment/32925988
type: QuestionComment
comment on: http://stackoverflow.com/q/21764299
has text: first check the file size (file.length()) are same or not . if its not same any way your files are not going to match..
score: 0
type: Comment

http://stackoverflow.com/comment/33233845
has text: Again, thank you so much for marking my answer as accepted :) Glad to have helped :) Good Luck.
comment on: http://stackoverflow.com/q/21789090
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21816483
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21810891
type: Answer
has comment: http://stackoverflow.com/comment/33049209
upvote count: 3
has body: All the other answers are missing the point that the string representation of the date-time needs to be localized. Joda-Time The Joda-Time 2.3 library makes this work much easier. Joda-Time leverages a java.util.Locale to determine proper formatting of a date-time's string representation. The DateTimeFormat class offers an option for "style" pattern as a way of generating a DateTimeFormatter. You specify a two character style pattern. The first character is the date style, and the second character is the time style. Specify a character of 'S' for short style, 'M' for medium, 'L' for long, and 'F' for full. A date or time may be omitted by specifying a style character '-'. If you do not specify a Locale or time zone, the JVM's default will be used. Locale To create a java.util.Locale, you need: Language code (either, see combined list) ISO 639 alpha-2 ISO 639 alpha-3 Country Code (either) ISO 3166 alpha-2 country code UN M.49 numeric-3 area code Example Code // Simulate input. long millisecondsSinceEpoch = DateTime.now().getMillis(); // Proceed with a 'long' value in hand. DateTime dateTimeUtc = new DateTime( millisecondsSinceEpoch, DateTimeZone.UTC ); DateTimeZone timeZone = DateTimeZone.forID( "Asia/Riyadh" ); DateTime dateTimeRiyadh = dateTimeUtc.withZone( timeZone ); // 'ar' = Arabic, 'SA' = Saudi Arabia. java.util.Locale locale = new Locale( "ar", "SA" ); // ( language code, country code ); DateTimeFormatter formatter = DateTimeFormat.forStyle( "FF" ).withLocale( locale ).withZone( timeZone ); String output = formatter.print( dateTimeUtc ); Dump to console… System.out.println( "millisecondsSinceEpoch: " + millisecondsSinceEpoch ); System.out.println( "dateTimeUtc: " + dateTimeUtc ); System.out.println( "dateTimeRiyadh: " + dateTimeRiyadh ); System.out.println( "output: " + output ); When run… millisecondsSinceEpoch: 1392583624765 dateTimeUtc: 2014-02-16T20:47:04.765Z dateTimeRiyadh: 2014-02-16T23:47:04.765+03:00 output: 16 فبراير, 2014 AST 11:47:04 م
score: 3
accepted answer of: http://stackoverflow.com/q/21810891

http://stackoverflow.com/a/21821795
has comment: http://stackoverflow.com/comment/33027364
has body: You are passing a Double value and trying to get a String value so you are getting null Replace getIntent().getStringExtra("Intent"); with getIntent().getDoubleExtra("Intent", 0);
has comment: http://stackoverflow.com/comment/33028983
answers question: http://stackoverflow.com/q/21821763
has comment: http://stackoverflow.com/comment/33029013
score: 0
has comment: http://stackoverflow.com/comment/33028096
has comment: http://stackoverflow.com/comment/33028055
type: Answer
has comment: http://stackoverflow.com/comment/33027282

http://stackoverflow.com/comment/32904405
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21753252
has text: I don't know where is Toolkit. I just called it as is shown in Oracle Examples. Have I to do something else? @maddening
score: 0

http://stackoverflow.com/comment/32867345
comment on: http://stackoverflow.com/a/21728835
score: 0
type: AnswerComment
has text: @cookiemonster: Why not post the follow-up as a separate question?
type: Comment

http://stackoverflow.com/q/21720075
has comment: http://stackoverflow.com/comment/32845107
has comment: http://stackoverflow.com/comment/32844796
linked to: http://stackoverflow.com/q/17369629
has comment: http://stackoverflow.com/comment/32845666
answer count: 1
has body: Currently working on Selenium WebDriver and using Java. I have a project calledTest. In that Project i have many Java Programs such as Login.java, Testing1.java etc.,. The scenario is 1st the Login.java need to run once it completed then next file start to run i.e Testing1.java. -Is there any possible to run like this in Eclipse. I'm using FF 26.0 for execution. ** TestNG** frame work.
has title: How to run two java files one by one- Eclipse?
has answer: http://stackoverflow.com/a/21755808
has comment: http://stackoverflow.com/comment/32844799
has comment: http://stackoverflow.com/comment/32908020
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/32844805
tagged with: eclipse
linked to: http://stackoverflow.com/q/9003337
type: Question
accepted answer: http://stackoverflow.com/a/21755808
has comment: http://stackoverflow.com/comment/32845075

http://stackoverflow.com/q/21732520
tagged with: java
tagged with: activity-lifecycle
has body: This is my first issue with the Android lifecycleand I feel somewhat helpless: In Activity A there's onCreate. That's the spot where I create an ArrayList called playerNames and ArrayList called moves. Also there's some more stuff happening in oncreate. In A's onStart I create a flag so I know which Activity is running in case I'd like to close all at once. In onDestroy the flag is set back to null. Eventually I make an intent to get to Activity B where I take the moves list along. Works fine. Now I'd like to make an intent from B to get back to A. What happens in the lifecycle when I attempt that? Obviously onCreate of A is called and leads to a NullPointerException regrding the playerNames list. I'd like to store this ArrayList while B is running and get it back when I come back to A. Which method is the right one (onResume? onRestart?) and how do I store it? Do I really need SharedPreferences? Thanks in advance for your kind help
upvote count: 1
accepted answer: http://stackoverflow.com/a/21733769
has comment: http://stackoverflow.com/comment/32866508
downvote count: 0
has comment: http://stackoverflow.com/comment/32867322
has comment: http://stackoverflow.com/comment/32867444
possible better answer: http://stackoverflow.com/a/21733028
has answer: http://stackoverflow.com/a/21733028
tagged with: arraylist
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32868839
score: 1
has comment: http://stackoverflow.com/comment/32866511
favorite count: 0
has answer: http://stackoverflow.com/a/21733769
has title: How to pass and manipulate objects between activities using intents
type: Question
has comment: http://stackoverflow.com/comment/32868803
has comment: http://stackoverflow.com/comment/32867041
answer count: 2
tagged with: android

http://stackoverflow.com/q/21794159
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21794320
has title: How can I get the context of a class (non-activity) in Android?
score: 1
duplicate of: http://stackoverflow.com/q/7666589
tagged with: java
has answer: http://stackoverflow.com/a/21794197
has body: I have come across this question on StackOverflow but I can't use the solutions suggested. One of the most common solutions was to extend the Application class but I can't do that because the class I am in already extends another class. Is there any other way of getting the context of a class? public class SMSReceiver extends BroadcastReceiver { ....... ....... CreateDB dc = new CreateDB(mcontext); dc.addBook(new Book(senderPhoneNumber,ang)); } Basically, I need to receive a message and add the sender's number and the message to a database and I need to get the context to create an instance of the database. I am a beginner in android so it would be great if you could keep the language simple.
type: Question
upvote count: 2
answer count: 3
favorite count: 0
tagged with: class
tagged with: android-context
linked to: http://stackoverflow.com/q/7666589
tagged with: android
tagged with: sqlite
downvote count: 1
possible better answer: http://stackoverflow.com/a/21794197
has answer: http://stackoverflow.com/a/21794178
accepted answer: http://stackoverflow.com/a/21794178

http://stackoverflow.com/q/21746094
has answer: http://stackoverflow.com/a/21747318
has answer: http://stackoverflow.com/a/60546562
accepted answer: http://stackoverflow.com/a/21747318
score: 0
answer count: 4
has answer: http://stackoverflow.com/a/21746816
has answer: http://stackoverflow.com/a/21747766
has title: How can I get the selected radio button value on another jsp page?
possible better answer: http://stackoverflow.com/a/21746816
type: AnsweredQuestion
has body: This is the 1st page. I'm facing problem with the radio button value being NULL on the submission handling page. LoginForm Spice Digital Login Page Signup Details Username: Password: select your gender: Male Female select your department: MCA B.Tech Other select your choices: java c++ c sql enter you comments here: This is the 2nd page. I'm unable to get the selected value here. Am I using request.getParameter() wrong?. JSP Page Spice Digital <% String a=session.getAttribute("username").toString(); out.println("Welcome "+a+"..!!"); %> <% String b=request.getParameter("myradio"); out.println("Your department is "+b); %> <% String c=request.getParameter("mybox"); out.println("Your choice is "+c); %> Click here to google search LogOut
tagged with: java
has comment: http://stackoverflow.com/comment/32891066
has comment: http://stackoverflow.com/comment/32892010
type: Question
has comment: http://stackoverflow.com/comment/32892366
tagged with: jsp
has comment: http://stackoverflow.com/comment/32891818

http://stackoverflow.com/q/21709041
score: 4
has comment: http://stackoverflow.com/comment/32825007
downvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21709063
has comment: http://stackoverflow.com/comment/32825026
upvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32843604
has title: need easy way to create comparator class used for sorting
has comment: http://stackoverflow.com/comment/32825019
tagged with: java
has comment: http://stackoverflow.com/comment/32825015
has comment: http://stackoverflow.com/comment/32825011
type: Question
has body: I was going through the following Java tutorial which showed how to sort on 'age' for a Person object. In order to do this, you must create a class as follows: class PersonAgeComparator implements Comparator&lt;Person&gt; { public int compare(Person a, Person b) { return a.getBirthday().compareTo(b.getBirthday()); } } My question is, is there an easy way, such as a wizard which can generate this code for me ? I know there is a wizard which can generate hashcode and equals, but what about a Comparator class used for sorting. This could really be helpful... what if we had to sort on age and name ?I would have no idea how to create that compare method on my own. A wizard could really help here.

http://stackoverflow.com/comment/32783730
type: Comment
comment on: http://stackoverflow.com/a/21685272
type: AnswerComment
has text: @vipulmittal u did it as user wants. +1.
score: 0

http://stackoverflow.com/comment/32931264
type: Comment
has text: count should start at 1 at the very beginning of the method as well.
comment on: http://stackoverflow.com/a/21768387
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32961098
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21785120
has text: The image that I have is in Image.java which has other attributes url etc. this is in RSS 2.0
score: 0

http://stackoverflow.com/comment/33028351
type: Comment
type: QuestionComment
has text: You should read a basic tutorial.
score: 6
comment on: http://stackoverflow.com/q/21823196

http://stackoverflow.com/comment/32804745
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21697428
has text: How are the arrays going to be updated? Will there be some mathematical function through which all the values are processed, or will the actual size of the array also be affected?

http://stackoverflow.com/a/21758910
has body: The error means that a native library named rxtxSerial cannot be found. You need to have a native library for the Raspberry Pi with that name, and set the system property java.library.path so that it points to the directory that contains the native library. That means you have to start your Java program with the -D option, for example: java -Djava.library.path=/some/dir com.mypackage.MyProgram where /some/dir is the directory that contains the native library. You'll have to find out if there is a native library that is suitable for the Raspberry Pi for the RXTX library that you are trying to use.
type: Answer
answers question: http://stackoverflow.com/q/21758821
score: 0

http://stackoverflow.com/a/21831929
answers question: http://stackoverflow.com/q/21831795
score: 0
type: Answer
has body: Method 'main' should be 'static' public static void main(String[] args)

http://stackoverflow.com/q/21730349
downvote count: 1
has answer: http://stackoverflow.com/a/21730610
type: Question
has comment: http://stackoverflow.com/comment/32862592
has answer: http://stackoverflow.com/a/21730698
linked to: http://stackoverflow.com/q/27581
has answer: http://stackoverflow.com/a/21730656
has body: I have list of objects in an arraylist and I need to compare every objects with other objects available in the arraylist; For Example: Class Employee { private String empname; private Long empid; private boolean empsex; public String getEmpname() { return empname; } public void setEmpname(String empname) { this.empname = empname; } public Long getEmpid() { return empid; } public void setEmpid(Long empid) { this.empid = empid; } public boolean isEmpsex() { return empsex; } public void setEmpsex(boolean empsex) { this.empsex = empsex; } } public list&lt;Employee&gt; getEmpList() { List&lt;Employee&gt; empList = new ArrayList&lt;Employee&gt;(); Employee emp = new Employee(); for(...) { //insert values to emp object for n number of times; } empList.add(emp); //add emp.object to empList; return empList; } Now while inserting these values to UI; Need to compare objects in the list; where any two or more objects matches with each other or not?
tagged with: java
has comment: http://stackoverflow.com/comment/32862562
score: 0
has comment: http://stackoverflow.com/comment/32862787
favorite count: 0
has comment: http://stackoverflow.com/comment/32862857
type: UnansweredQuestion
has title: Compare arraylist objects in java
has comment: http://stackoverflow.com/comment/32862614
answer count: 4
has comment: http://stackoverflow.com/comment/32862497
has answer: http://stackoverflow.com/a/21730639
upvote count: 1

http://stackoverflow.com/a/27513627
answers question: http://stackoverflow.com/q/21687022
upvote count: 20
has body: It's not the cleanest, but it works: public class MyTestListener extends AbstractTestExecutionListener { @Value("${my.value}") private String myValue; @Autowired private MyBean myBean; @Override public void beforeTestClass(TestContext testContext) throws Exception { testContext.getApplicationContext() .getAutowireCapableBeanFactory() .autowireBean(this); } }
score: 20
downvote count: 0
type: Answer

http://stackoverflow.com/a/21697616
type: Answer
accepted answer of: http://stackoverflow.com/q/21697349
has comment: http://stackoverflow.com/comment/52395977
downvote count: 0
upvote count: 142
has comment: http://stackoverflow.com/comment/112213035
type: AcceptedAnswer
has body: Method references can be used when you have a method (or constructor) that fits the shape of the target you're trying to satisfy. You can't use a method reference in this case because the shape you're targeting is a Supplier, which takes no arguments, but what you have is a TreeSet constructor, which does take an argument, and you need to specify what that argument is. So you have to take the less concise approach and use a lambda expression: TreeSet&lt;Report&gt; toTreeSet(Collection&lt;Report&gt; reports, long timestamp) { return reports.stream().filter(report -&gt; report.timestamp() &gt;= timestamp).collect( Collectors.toCollection( () -&gt; new TreeSet&lt;&gt;(Comparator.comparingLong(Report::timestamp)) ) ); }
has comment: http://stackoverflow.com/comment/112198350
has comment: http://stackoverflow.com/comment/59553345
answers question: http://stackoverflow.com/q/21697349
score: 142

http://stackoverflow.com/comment/32946135
has text: The issue is that if I pass in a `BigDecimal` you are abs-ing it's `doubleValue()` and returning a `Double`. You are getting a type `T` but returning a `Double`. You they try and cast it to a `(T)` which will obviously be a `ClassCastException`. You _can_ cast to generic types in Java 7 - you are obviously using an earlier version - but that won't help you here.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21777139

http://stackoverflow.com/q/21796954
tagged with: java
has comment: http://stackoverflow.com/comment/32981557
type: Question
has comment: http://stackoverflow.com/comment/32981578
upvote count: 2
has comment: http://stackoverflow.com/comment/32981488
tagged with: api
answer count: 1
has comment: http://stackoverflow.com/comment/32981539
favorite count: 0
has answer: http://stackoverflow.com/a/21797036
type: UnansweredQuestion
score: 2
has body: I tried importing the following APIs to use this method but for some reason, it Java does not recognize this method. import org.apache.http.entity.ContentType; import javax.mail.internet.ContentType; StringEntity(payload,ContentType.create("application/json"); Here is the complete Java code: public void testCustomerApiIsExposed() throws JSONException { try { @SuppressWarnings("deprecation") HttpClient c = new DefaultHttpClient(); HttpPost p = new HttpPost("http://myURL"); String payload = "{id:\"" + 1 + "\"," + "method:\"" + "customerApi.getApiToken" + "\", params [\"DELETED\", \"DELETED\", \"\", \"\", \"\",\"\", \"\", false, \"\", \"\"" + "]}"; /*What API do I need to import for this method???????*/ p.setEntity(new StringEntity( payload, ContentType.create("application/json"))); 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); String apiToken = (String) o.get("result"); } catch(IOException e) { System.out.println(e); } } Can someone guide me here? Thanks
has title: What API do I require to use this method in Java?
has comment: http://stackoverflow.com/comment/32981594
downvote count: 0

http://stackoverflow.com/q/21701636
has comment: http://stackoverflow.com/comment/32812344
score: 0
has comment: http://stackoverflow.com/comment/32812223
has comment: http://stackoverflow.com/comment/32811864
has answer: http://stackoverflow.com/a/21704371
has answer: http://stackoverflow.com/a/21702098
has body: I tried to split a line based on spaces not enclosed between double quotes. My regex is (([\"]([^\\\"]|\\.)+[\"]|[^ ]+))+ My Code Pattern regex = Pattern.compile("(([\"]([^\\\"]|\\.)+[\"]|[^ ]+))+"); Matcher regexMatcher = regex.matcher(line); List&lt;String&gt; rule = new ArrayList&lt;String&gt;(); while(regexMatcher.find()) rule.add(regexMatcher.group()); Input for which it is failed. SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "(?i:\b(?:(?:s(?:t(?:d(?:dev(_pop|_samp)?)?|r(?:_to_date|cmp))|u(?:b(?:str(?:ing(_index)?)?|(?:dat|tim)e)|m)|e(?:c(?:_to_time|ond)|ssion_user)|ys(?:tem_user|date)|ha(1|2)?|oundex|chema|ig?n|pace|qrt)|i(?:s(null|_(free_lock|ipv4_compat|ipv4_mapped|ipv4|ipv6|not_null|not|null|used_lock))?|n(?:et6?_(aton|ntoa)|s(?:ert|tr)|terval)?|f(null)?)|u(?:n(?:compress(?:ed_length)?|ix_timestamp|hex)|tc_(date|time|timestamp)|p(?:datexml|per)|uid(_short)?|case|ser)|l(?:o(?:ca(?:l(timestamp)?|te)|g(2|10)?|ad_file|wer)|ast(_day|_insert_id)?|e(?:(?:as|f)t|ngth)|case|trim|pad|n)|t(?:ime(stamp|stampadd|stampdiff|diff|_format|_to_sec)?|o_(base64|days|seconds|n?char)|r(?:uncate|im)|an)|m(?:a(?:ke(?:_set|date)|ster_pos_wait|x)|i(?:(?:crosecon)?d|n(?:ute)?)|o(?:nth(name)?|d)|d5)|r(?:e(?:p(?:lace|eat)|lease_lock|verse)|o(?:w_count|und)|a(?:dians|nd)|ight|trim|pad)|f(?:i(?:eld(_in_set)?|nd_in_set)|rom_(base64|days|unixtime)|o(?:und_rows|rmat)|loor)|a(?:es_(?:de|en)crypt|s(?:cii(str)?|in)|dd(?:dat|tim)e|(?:co|b)s|tan2?|vg)|p(?:o(?:sition|w(er)?)|eriod_(add|diff)|rocedure_analyse|assword|i)|b(?:i(?:t_(?:length|count|x?or|and)|n(_to_num)?)|enchmark)|e(?:x(?:p(?:ort_set)?|tract(value)?)|nc(?:rypt|ode)|lt)|v(?:a(?:r(?:_(?:sam|po)p|iance)|lues)|ersion)|g(?:r(?:oup_conca|eates)t|et_(format|lock))|o(?:(?:ld_passwo)?rd|ct(et_length)?)|we(?:ek(day|ofyear)?|ight_string)|n(?:o(?:t_in|w)|ame_const|ullif)|(rawton?)?hex(toraw)?|qu(?:arter|ote)|(pg_)?sleep|year(week)?|d?count|xmltype|hour)\W*\(|\b(?:(?:s(?:elect\b(?:.{1,100}?\b(?:(?:…
has answer: http://stackoverflow.com/a/21701909
has title: Stackoverflow in pattern matching in java
has comment: http://stackoverflow.com/comment/32812004
has comment: http://stackoverflow.com/comment/32812041
linked to: http://stackoverflow.com/q/2127217
tagged with: regex
has comment: http://stackoverflow.com/comment/32811434
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21751221
tagged with: java
has comment: http://stackoverflow.com/comment/32812666
has comment: http://stackoverflow.com/comment/32811691
possible better answer: http://stackoverflow.com/a/21702098
has comment: http://stackoverflow.com/comment/32812010
linked to: http://stackoverflow.com/q/5946471
type: Question
linked to: http://stackoverflow.com/q/5319840
tagged with: regex-greedy
accepted answer: http://stackoverflow.com/a/21704371
has comment: http://stackoverflow.com/comment/32811398
has comment: http://stackoverflow.com/comment/32811561
has comment: http://stackoverflow.com/comment/32811662

notnull
type: Tag
tag name: notnull
tags question: http://stackoverflow.com/q/21700655

readonly
tag name: readonly
tags question: http://stackoverflow.com/q/21825843
type: Tag

http://stackoverflow.com/comment/32964862
comment on: http://stackoverflow.com/a/21780191
has text: Wait, Karaf doesn't implement OSGi Subsystems yet, does it? In what sense then does Karaf provide additional isolation of "applications" over what is provided by core OSGi?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21736376
favorite count: 0
has title: How to configure C3p0.properties file in a jar file's classpath to read C3P0-config.xml outside the classpath
has answer: http://stackoverflow.com/a/21738021
accepted answer: http://stackoverflow.com/a/21738021
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has body: May be I have phrased the question wrongly but here's the issue. I have a library called util, inside util we have a database class that will be using C3P0 for database connectivity. This util library is used by different devs within the team . To make life easier for everyone since we have a modular system, each module in the system can specify it's own database connection and properties as it sees fit for their module. The only reason we are doing this is because the methods for calling executing queries are all defined in this libraries and so instead of everyone rewriting the same code over and over it's much efficient to use a shared lib with that functionality. The current set up is that I have the C3P0.properties file inside my util library classpath and inside it I have defined the path of the C3P0-config.xml file like this. com.mchange.v2.c3p0.cfg.xml=./conf/c3p0-config.xml I then build and the jar and give it to the rest of the devs . They then create a conf directory in their application and add the c3p0-config.xml. The Strucuture of the Directory looks like this Parent directory - module name { Sub directories -lib -&gt; {Util.jar &amp; other jars} -conf -&gt; {c3p0-config.xml &amp; other config files} -logs -modulename.jar } On executing the jar file we get the error 2014-02-12 20:50:59 INFO MLog:124 - MLog clients using log4j logging. 2014-02-12 20:50:59 DEBUG MLog:101 - Could not find resource path text file for path '/com/mchange/v2/cfg/vmConfigResourcePaths.txt'. Skipping. 2014-02-12 20:50:59 DEBUG MLog:101 - Added paths from resource path text file at '/mchange-config-resource-paths.txt' 2014-02-12 20:50:59 DEBUG MLog:101 - Reading VM config for path list /com/mchange/v2/log/default-mchange-log.properties, /mchange-commons.properties, /c3p0.properties, hocon:/reference,/application,/c3p0,/, /mchange-log.properties, / 2014-02-12 20:50:59 DEBUG MLog:101 - The configuration file for resource identifier '/mchange-commons.properties' could not be found.…
answer count: 1
downvote count: 0
tagged with: c3p0

http://stackoverflow.com/a/21705008
score: 3
accepted answer of: http://stackoverflow.com/q/21704696
type: AcceptedAnswer
has body: Obviously no,Both super and this must be the first statement of constructor body.And there can be only one first statement
downvote count: 1
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/21704696

http://stackoverflow.com/comment/32938247
type: Comment
type: QuestionComment
score: 1
has text: What's your end goal in doing this?
comment on: http://stackoverflow.com/q/21772414

http://stackoverflow.com/a/21818931
accepted answer of: http://stackoverflow.com/q/21818893
answers question: http://stackoverflow.com/q/21818893
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33058911
upvote count: 6
has comment: http://stackoverflow.com/comment/33027417
has comment: http://stackoverflow.com/comment/33027930
has comment: http://stackoverflow.com/comment/33027762
has comment: http://stackoverflow.com/comment/33025973
type: Answer
has comment: http://stackoverflow.com/comment/33025720
has comment: http://stackoverflow.com/comment/33022213
downvote count: 0
has comment: http://stackoverflow.com/comment/33028433
has comment: http://stackoverflow.com/comment/33053817
score: 6
has comment: http://stackoverflow.com/comment/33027878
has comment: http://stackoverflow.com/comment/33054828
has body: This is a simple NullPointerException, which should have being fixed by checking the nearest line to the cause of the exception within your source code and/or debugging the program When I ran the program, I got the following exception... Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at dicerollgui.DiceRollGUI$RollButton.actionPerformed(DiceRollGUI.java:55) Which pointed me to label.setText(" "); within the actionPerformed method... if(rolldie.equals("Roll")) { label.setText(" "); This automatically suggested to me that label has not yet being initialised (and therefore is null). Updated... This... JFrame frame = new JFrame(); frame.add(dice6); Seems very weird to me. Basically on each dice roll, you are creating a new JLabel and a new JFrame but you're not showing the resulting frame... Instead, you should have a single JLabel which maintains the value of the last roll and simply use either setText or setIcon to change it's state based on your requirements. Updated with example import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class DiceRoll { public static void main(String[] args) { new DiceRoll(); } public DiceRoll() { 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 DicePane()); frame.pack(); frame.setLocatio…
has comment: http://stackoverflow.com/comment/33025410

http://stackoverflow.com/a/21704645
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21704193
has comment: http://stackoverflow.com/comment/32817562
answers question: http://stackoverflow.com/q/21704193
has body: import java.util.Scanner; public class NewClass { public static void main(String[] args) { int[] numArr = new int[3]; int sum=0,x; Scanner keyboard = new Scanner(System.in); for(int i=0; i&lt;numArr.length; i++) { //check if between 1 and 10 System.out.println("Enter a number in the range 1 to 10: "); //check if integer while (!keyboard.hasNextInt()) { System.out.println("Invalid entry, please try again "); keyboard.next(); } x = keyboard.nextInt(); if(x&gt;0 &amp;&amp; x&lt;=10) numArr[i]=x; else{ System.out.println("Retry Enter a number in the range 1 to 10:"); i--; } } for (int counter=0; counter&lt;numArr.length; counter++) { sum+=numArr[counter]; } System.out.println("The sum of these numbers is "+sum); } }
type: Answer
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/32817738
upvote count: 3

http://stackoverflow.com/q/21834029
has answer: http://stackoverflow.com/a/21834101
tagged with: android
duplicate of: http://stackoverflow.com/q/513832
score: -1
has title: Java not getting the right condition
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21834173
tagged with: object
tagged with: java
has comment: http://stackoverflow.com/comment/33047244
has comment: http://stackoverflow.com/comment/33047552
has body: I trying to get info in database and sending for an object called Question. When i got null in database and send it to the field of the object.. I suppose that field will be "null", cause the field is an String. But i tried all ways to verify it and i cant... I tried: Question a = new Question(); a.setAnswer(database.getAnswer(id)); // Way 1 if(a.getAnswer() == null) { Log.d("Way 1", "successfully"); } // Way 2 if(a.getAnswer() == "null") { Log.d("Way 2", "successfully"); } //Way 3 if(a.getAnswer().equals(null)) { Log.d("Way 3", "successfully"); } // Way 4 if(a.getAnswer().equals("")) { Log.d("Way 4", "successfully"); } But I didn't got result... I put in log to log my Question.getAnswer() too: And here's the result: D/Here == &gt;: null
answer count: 2
linked to: http://stackoverflow.com/q/513832
upvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/113164344
has text: Your answer is about configuring TLS enabled *connector*, which accepts *incoming* connections, but the question is about trusting certificates of *outgoing* connections, i.e. when servers connects to database—totally different thing
type: AnswerComment
comment on: http://stackoverflow.com/a/21833913
type: Comment
score: 1

http://stackoverflow.com/comment/32883647
type: Comment
type: QuestionComment
score: 2
has text: Did you see the `scheduleWithFixedDelay` method right after that one?
comment on: http://stackoverflow.com/q/21741672

http://stackoverflow.com/comment/33019204
has text: This question is too broad. Are you just interested in designing a service oriented API or a persistence model or both?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21817936
score: 0

http://stackoverflow.com/comment/32807708
comment on: http://stackoverflow.com/q/21690747
score: 0
type: Comment
type: QuestionComment
has text: I am not sure why you'd think that would compile. There is no method with the signature `getConnection(java.sql.Connection)` defined on [`DataSource`](http://docs.oracle.com/javase/7/docs/api/javax/sql/DataSource.html). Maybe you are looking for [`Connection.unwrap(...)`](http://docs.oracle.com/javase/7/docs/api/java/sql/Wrapper.html#unwrap(java.lang.Class))

http://stackoverflow.com/comment/33041639
has text: There is no Synthesizer that satisfies your requirements. http://docs.oracle.com/cd/E17802_01/products/products/java-media/speech/forDevelopers/jsapi-doc/javax/speech/Central.html#createSynthesizer%28javax.speech.EngineModeDesc%29 Have you tried Central.createSynthesizer(null); for the default?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21747089

http://stackoverflow.com/a/21685667
type: Answer
upvote count: 1
has body: What hadoop version is installed? Are you using the examples jar that came with the distribution? The errors indicate that hadoop is using the old MR API and the jar is using the new MR API.
score: 1
accepted answer of: http://stackoverflow.com/q/21685189
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21685189
has comment: http://stackoverflow.com/comment/32783819

http://stackoverflow.com/q/21761878
upvote count: 2
has title: Is it possible to use volatile variables to allow consistent write-only synchronisation?
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21762017
tagged with: locking
tagged with: volatile
linked to: http://stackoverflow.com/q/11385763
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32918996
has body: Is it possible to use volatile variables to allow consistent write-only synchronisation? This is the code: public class Controller { Container cont = new Container(); ... public Object get(){ if(!cont.isLocked()){ return cont.getObject(); //many threads can read at the same time } else synchronized(cont){ return cont.getObject(); //threads wait until write is finished } } public void set(Object o){ synchronized(cont){ cont.lock(); cont.setObject(o); cont.unlock(); } } } public class Container { private volatile boolean lock = false; private Object data; public Container(){ } public void lock() { lock = true; } public void unlock() { lock = false; } public boolean isLocked() { return lock; } public void setObject(Object o) { data = o; } public Object getObject() { return data; } } Will it work, or will it break, what do you think?
tagged with: synchronized
favorite count: 0
accepted answer: http://stackoverflow.com/a/21762017
tagged with: synchronization
score: 2

http://stackoverflow.com/comment/32861547
type: QuestionComment
has text: @kajacx yeah i know it's not necessary but i can't set it to `null` because i need it to appear at the center of the screen? Because I've tried setting a component once to null and it was a little off center
comment on: http://stackoverflow.com/q/21729529
score: 0
type: Comment

http://stackoverflow.com/comment/32854463
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21725065
type: QuestionComment
has text: does domain name have a fix pattern???

http://stackoverflow.com/a/21780356
has body: We declare constants because we will always need some "magic numbers" that are fixed in the code. Using constants means that they are easier to spot, and that when you change them you will change all of them with a edit. Imagine that your code defines that your window will show 15 records, and that you will consider people as adults when they are 15 years old. Without constants, changing the size of the windows means that you will have to find the 15 ocurrences, do not miss any, and do not change a 15 that means age by mistake. The static part is because you do not want to instantiate an object to get a data that is not related to a particular instance (that is exactly what static means, btw, not only when used for constants).
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21780195

http://stackoverflow.com/comment/33018998
score: 2
type: Comment
has text: Use `Arrays.binarySearch()`, you will know where to insert it
type: QuestionComment
comment on: http://stackoverflow.com/q/21817877

http://stackoverflow.com/a/21735327
type: AcceptedAnswer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21733132
type: Answer
answers question: http://stackoverflow.com/q/21733132
score: 2
has body: At least two problems: You cannot return an instance of the matcher anyObject(). Instantiate an object to return instead. Depending on your mocking framework, you'll need to initialise mocking first. For example, in Mockito, use: MockitoAnnotations.initMocks(this);
has comment: http://stackoverflow.com/comment/32906935
has comment: http://stackoverflow.com/comment/32872277
downvote count: 0

http://stackoverflow.com/a/21761537
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21760930
type: Answer
has body: I believe what is suggested in the previous answer is perfectly OK. Just to avoid all confusions and make it much obvious, here is the full code: package com.test; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; public class TestGSON { public static void main(String[] args) { Gson gson = new Gson(); try{ Object fromJson = gson.fromJson("{\"name\":\"Dharam\"}", Class.forName("com.test.MyClass")); if(fromJson instanceof MyClass){ System.out.println(fromJson); } } catch (JsonSyntaxException | ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class MyClass { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "MyClass [name=" + name + "]"; } } Output from the above code: MyClass [name=Dharam]
answers question: http://stackoverflow.com/q/21760930
score: 0

http://stackoverflow.com/comment/33038920
score: 0
type: Comment
type: QuestionComment
has text: bellabax, thanks for providing the link. In my case do i need my bean in prototype scope?
comment on: http://stackoverflow.com/q/21829162

http://stackoverflow.com/comment/32860298
comment on: http://stackoverflow.com/q/21728965
score: 0
has text: Take a look at the [Drag and Drop](http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html) trail, maybe you can find something there will help you out.
type: QuestionComment
type: Comment

kinect
type: Tag
tags question: http://stackoverflow.com/q/21753968
tag name: kinect

http://stackoverflow.com/q/21678901
tagged with: java
has answer: http://stackoverflow.com/a/25133142
has title: Build non trivial XML file with StaxEventItemWriter
type: Question
has body: I need to dump content of some database tables to XML file with this structure value value value ... ... The real number of records for every table in unknown, so I can't store all data for a single table in memory and dump to XML. My job now is defined as: <chunk reader="dumpReader" processor="dumpProcessor" writer="dumpWriter" commit-interval="100" /> RecordBean public class RecordBeanRowMapper implements RowMapper<RecordBean> { final static RowMapper<Map<String, Object>> columnMapRowMapper = new ColumnMapRowMapper(); private String tableName; public void setTableName(String tableName) { this.tableName = tableName; } @Override public RecordBean mapRow(ResultSet rs, int rowNum) throws SQLException { final RecordBean b = new RecordBean(); b.setTableName(tableName); b.setColumnValues(Maps.transformValues(columnMapRowMapper.mapRow(rs, rowNum), new Function<Object, String>() { @Override public String apply(Object input) { return (input == null ? "NULL" : input.toString(); } } } @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(namespace="") class RecordBean { private String tableName; @XmlJavaTypeAdapter /* Entries are written using an adapter to write data as * value * value * ... */ public Map<String,String> entries = new HashMap<String,String>(); } /* Use to build item node name using dynamic tableName as * * value * value * */ public class RecordBeanToJaxbElementProcessor implements ItemProcessor<RecordBean, JAXBElement<?>> { @Override public JAXBElement<?> process(RecordBean item) throws Exception { return new JAXBElement<RecordBean>(new QName(item.getTableName()), RecordBean.class, item); } } This job is incomplete and doesn't cover my needs because the output looks like <?xml version="1.0" encoding="UTF-8"?> <TABLE_ONE> Code one A record xyz NULL <is_persistent>false</is_persistent> <keep_history_data>false</keep_history_data> </TABLE_ONE> <TABLE_TWO> Code 2 Another record <his_name>no_name</his_name> </TABLE_TWO> I think I have to enrich writer and/or marsh…
score: 3
accepted answer: http://stackoverflow.com/a/25133142
tagged with: jaxb2
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/32776899
has comment: http://stackoverflow.com/comment/32776661
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/a/21808645
has comment: http://stackoverflow.com/comment/33002542
has comment: http://stackoverflow.com/comment/33002523
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33002503
score: 0
answers question: http://stackoverflow.com/q/21808602
type: Answer
accepted answer of: http://stackoverflow.com/q/21808602
has body: That's because the RL method doesn't do anything. It just creates temporary variables name temp. EDIT: This will rotate an array to the left one, wrapping around the first value. Now all you need to do is apply it to the 2D array, which is trivial (match it to the input). int[] arr = {1,2,3,4,5,6}; System.out.println("Before:"); for (int i = 0; i &lt; arr.length; i++) { System.out.print(arr[i] + ", "); } System.out.println(): if (arr.length &gt; 0) { int first = arr[0]; for (int i = 0; i &lt; arr.length-1; i++) { arr[i] = arr[i+1]; } arr[arr.length-1] = first; } System.out.println("After:"); for (int i = 0; i &lt; arr.length; i++) { System.out.print(arr[i] + ", "); }

http://stackoverflow.com/q/21815558
answer count: 2
accepted answer: http://stackoverflow.com/a/21815699
downvote count: 0
has title: Generics cannot cast Object to interface class java
score: 1
tagged with: generics
favorite count: 0
has body: I thought to use Reflections library to get the class that implements a manager with a specific annotation value. I wrote the code like this: public enum Reflection { INSTANCE; Reflection() { managersRef = new Reflections("com.company.manager"); } private final Reflections managersRef; public Manager getManagerImplWithName(String name, Class&lt;? extends Manager&gt; subType) { Set&lt;?&gt; managers = managersRef.getSubTypesOf(subType); for (Object clazz : managers) { Service serviceAnno = ((Class&lt;?&gt;) clazz).getAnnotation(Service.class); if (serviceAnno != null &amp;&amp; !StringUtils.isEmpty(serviceAnno.name()) &amp;&amp; serviceAnno.name().equals(name)) return (Manager) clazz; } return null; } } Manager is an interface. SubType is class that implements Manager e.g. ProductManager/OfficeManager I am looking for any class that implements it with annotation @Service(name=name). This works fine until the line return (Manager) clazz. I get: java.lang.ClassCastException: java.lang.Class cannot be cast to com.mycompany.manager.Manager What is wrong? In the inspect I can see that the type of clazz is ProductManager that implements Manager
has comment: http://stackoverflow.com/comment/33015069
possible better answer: http://stackoverflow.com/a/21815758
has comment: http://stackoverflow.com/comment/33015163
has answer: http://stackoverflow.com/a/21815758
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21815699
type: Question
has comment: http://stackoverflow.com/comment/33015097
tagged with: java
has comment: http://stackoverflow.com/comment/33015183

http://stackoverflow.com/comment/32858613
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21728274
has text: yes otherwise you only upload one screenshot because the code is executed only one time. at server you have to read the socket more often (create a timer with 5 seconds or so...).

http://stackoverflow.com/comment/32920052
score: 0
has text: what do you mean make it strongly typed? I believe I have access to it, yes.
type: Comment
comment on: http://stackoverflow.com/a/21762425
type: AnswerComment

http://stackoverflow.com/q/21724419
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/21725230
has comment: http://stackoverflow.com/comment/32851912
type: Question
answer count: 2
has body: Hi I have the String array String version[] = {"3.1.2","2.1.7","3.1.1","3.7.3","2.6.4","1.3.4.7"}; I want to find the latest version among these. Which approach will be good? It should print 3.7.3
downvote count: 0
has title: String Version Comparison
linked to: http://stackoverflow.com/q/198431
has answer: http://stackoverflow.com/a/21725903
favorite count: 0
duplicate of: http://stackoverflow.com/q/198431
has answer: http://stackoverflow.com/a/21725230
possible better answer: http://stackoverflow.com/a/21725903

http://stackoverflow.com/comment/32902433
score: 0
type: QuestionComment
has text: ssplit only works in conjunction with `"-tokenize.whitespace true"`. Try to take "ssplit" out: `props.put("annotators", "tokenize, pos, lemma, ner, parse, dcoref");`
type: Comment
comment on: http://stackoverflow.com/q/21752448

http://stackoverflow.com/comment/32897943
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21749930
type: Comment
has text: [link](http://imgur.com/a/HpNKJ#0) here are the Screenshots how it looks and everything is just fine.

http://stackoverflow.com/comment/32791467
comment on: http://stackoverflow.com/a/21689685
has text: @user550 using a thread won't solve anything because they will write into the same disk.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32923582
has text: At a guess this is because the `StyledCellLabelProvider` does a lot more of the table drawing itself rather than delegating to the platform dependent code. Since I don't think there is any defined behavior for selection in a disabled control the code is free to do nothing. As I said on a Mac selection does not work at all in a disabled table regardless of which label provider is used.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21760988

http://stackoverflow.com/comment/33021097
type: Comment
has text: @user2517185, check my latest edit. It is based off of your current code. All you have to do now is add the checks for which date is larger.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21818881

http://stackoverflow.com/q/21735430
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21746084
tagged with: eclipse
answer count: 1
tagged with: liferay
accepted answer: http://stackoverflow.com/a/21746084
has title: How to configure project in Eclipse so that jsps can be validated properly including <%@page import="...%>in <@include file="...">
type: AnsweredQuestion
tagged with: liferay-ide
tagged with: jsp
type: Question
has body: Let there be a (Liferay hook plugin) eclipse project xyz-hook. And let there be the file a.jsp &lt;% @include file="/html/portal/init.jsp" %&gt; &lt;% InitImportedClass.yxz(); %&gt; and let there be the included init.jsp in another (referenced) project. &lt;% @page import="de.company.InitImportedClass" %&gt; For a.jsp in project xyz-hook we get a warning in line 1 Fragment "/html/portal/init.jsp" was not found at expected path /xyz-hook/src/main/webapp/html/portal/init.jsp and an error in line 2 InitImportedClass cannot be resolved Is there any way to tell Eclipse to go looking for init.jsp in the other project? The project (Liferay portal trunk) containing the init.jsp is already referenced. I also created an synthetic jar containing the jsp as well, added it to the local maven repository and as dependency to project xyz-hook. PS: For those wondering, this is a typical setup for Liferay hooks when replacing jsps, that are provided by the portal core. PPS: I'm aware that I could deactivated jsp validation altogether, but that is something I'd like to avoid, since otherwise imports that are really missing won't be shown as error either.

http://stackoverflow.com/comment/33022557
type: Comment
type: QuestionComment
has text: Was using another imageview class. Changed to ImageView and works better now ...
comment on: http://stackoverflow.com/q/21819046
score: 0

http://stackoverflow.com/q/21829081
has title: Set Java Endpoint timeout duration
has comment: http://stackoverflow.com/comment/33080429
answer count: 0
downvote count: 0
score: 1
favorite count: 0
has body: I am implementing a simple Java web service using JAX-WS exposing my service using @WebService and @WebMethod To publish the service I am using a simple Endpoint.publish() implementation Endpoint.publish( "http://urlToService" , new WebServiceImp() ); all of which is working correctly. I am now in a situation where I need to set the timeout duration of a users connection. From my searching I have found many instances of people implementing this on client side applications on their requests, I also found way of changing config files for application servers like Tomcat. But not a way to set values for the endpoint So my question is, a) How can I set the default timeout for communicating with the endpoint b) How can I see the current timeout value for endpoint communication. Many Thanks
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/3130913
tagged with: jax-ws
upvote count: 1
tagged with: web-services
has comment: http://stackoverflow.com/comment/33059474
tagged with: timeout
type: UnansweredQuestion

http://stackoverflow.com/q/21699559
has title: API for finding the category of a domain
has comment: http://stackoverflow.com/comment/32808188
type: Question
tagged with: categories
has answer: http://stackoverflow.com/a/21700196
upvote count: 3
has answer: http://stackoverflow.com/a/34736345
accepted answer: http://stackoverflow.com/a/34736345
has comment: http://stackoverflow.com/comment/83074754
answer count: 3
has answer: http://stackoverflow.com/a/21796120
favorite count: 0
tagged with: web-services
possible better answer: http://stackoverflow.com/a/21700196
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/32808664
downvote count: 0
tagged with: java
has body: Is there an API for finding the category of a domain? I'm looking for an alternative to reading the website's meta tags with jsoup. For example a query with allmusic.com should yield music, while one for arsenal.com should yield sports. The ideal candidate can be used easily with Java. :-) P. S: The system does not have to be perfect.

http://stackoverflow.com/q/21734517
has title: paintComponent calling a variable
tagged with: paintcomponent
has body: Here is the situation. I have this code. When you remove the variable a in the second class. Program is working. It just draw a line. But I want to put a variable is "a". Then in first class I want to declare it. Then I want to use it. How can I do that. Basically Where can I put the variable a in the first class(Grafik3) to work in second class in NewLabel method ? public class Grafik3 extends JFrame{ /** * */ private static final long serialVersionUID = 1L; public Grafik3() { add(new YeniLabel("Paint component.............. ")); } public static void main(String[] args){ Grafik3 cer = new Grafik3(); cer.setTitle("Paint component"); cer.setLocationRelativeTo(null); // çerçevenin merkezi cer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); cer.setSize(300,120); cer.setVisible(true); } } class YeniLabel extends JLabel { /** * */ private static final long serialVersionUID = 1L; public YeniLabel(String s){super(s); } protected void paintComponent(Graphics g,int a){ super.paintComponent(g); g.drawLine(a, 0, 70, 70); } }
score: 0
tagged with: java
answer count: 2
tagged with: swing
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21734573
has answer: http://stackoverflow.com/a/21734603
tagged with: variables
type: Question

http://stackoverflow.com/q/21733303
has answer: http://stackoverflow.com/a/21750348
score: 1
tagged with: java
has body: I set up my javaagent in the like this: -javaagent:/usr/pkg/tomcat/lib/aspectjweaver-1.7.3.jar But it does not work, so I would be interested to have a look at the logs. What can I add to javaagent if I want to get log messages? (stacktrace, which classes were loaded etc...) I beleive "options" should be used for this. The documentation says: implementations with a command-line interface, an agent is started by adding this option to the command-line: -javaagent:jarpath[=options] jarpath is the path to the agent JAR file. options is the agent options What exactly should I write within the square brackets? "Log"? "Debug"? Something else? I know its lame but I can't find the correct syntax.
upvote count: 1
type: Question
tagged with: debugging
has title: How to log(debug) javaagent with agent options
answer count: 1
downvote count: 0
favorite count: 0
tagged with: javaagents
type: UnansweredQuestion
tagged with: logging

http://stackoverflow.com/q/21752156
has answer: http://stackoverflow.com/a/21752239
tagged with: sql
has title: Java JDBC cannot connect to MSSQL Server
tagged with: connection
type: UnansweredQuestion
tagged with: jdbc
has body: I tried many ways to solve my issue, none of them worked, so here i am with the question. I created a local database with SQL Server Management Studio. It's name is CallCenter, i created a user account for it, granted every privileges and i can log into the DB with it, in the Managemenet Studio, everything works just fine here. Now i use NetBeans, to create the connection. I downloaded the Microsoft JDBC driver, set up everything, the JDBC seems to be working fine. The problem is, it cannot connect to the Database. I set the log in options to both Windows &amp; SQL. I tried to log in, with integrated sequrity ( windows account ) aswell as the created ( and working ) SQL user account. None of them worked, i keep getting this exception: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'admin'. ClientConnectionId:1ce0b951-5ecb-49b4-a4d0-ff4a96af4ed2 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)...... Here is the code: import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Try { public static void main(String[] args) { try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String url="jdbc:sqlserver://localhost:1434;databaseName=CallCenter;integratedSecurity=true;"; Connection conn = DriverManager.getConnection(url); } catch (ClassNotFoundException e) { System.err.println("SQL Driver class does not exist!"); } catch (SQLException ex) { ex.printStackTrace(); } } } I've been browsing the internet for hours, tried many solutions, but none of solved this problem for me. Please help me out here!
tagged with: java
has comment: http://stackoverflow.com/comment/32901598
has answer: http://stackoverflow.com/a/21752420
type: Question
linked to: http://stackoverflow.com/q/1229691
has comment: http://stackoverflow.com/comment/32901753
tagged with: sql-server
score: 0
has answer: http://stackoverflow.com/a/21752245
answer count: 3

http://stackoverflow.com/comment/32940618
has text: okay i got it the problem is in this line txtCustRecCardRouteNo.setText(vectorCustRecipetDB.get(i).route_No); i am getting route no as null.
score: 0
comment on: http://stackoverflow.com/q/21773836
type: Comment
type: QuestionComment

finalize
type: Tag
tags question: http://stackoverflow.com/q/21771043
tags question: http://stackoverflow.com/q/21809922
tag name: finalize

http://stackoverflow.com/comment/32977545
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21793617
has text: You can provide both with little work, have one controller method eat form data and one eat application/json

http://stackoverflow.com/comment/32869584
comment on: http://stackoverflow.com/q/21731138
has text: About the first part, it depends on your device compute capability and existence of cache in your device. Have a look at [this](http://devblogs.nvidia.com/parallelforall/how-access-global-memory-efficiently-cuda-c-kernels/) post that examines different scenarios using different devices.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/139847036
type: Comment
has text: [This link that Gene provided](https://www.codeproject.com/Articles/10115/Crafting-an-interpreter-Part-1-Parsing-and-Grammar) was helpful for learning more about how the interpreter is actually implemented
score: 0
comment on: http://stackoverflow.com/q/21717660
type: QuestionComment

http://stackoverflow.com/q/21738837
upvote count: 0
tagged with: stringreader
has title: Java KeyPressed for all keys
tagged with: awt
has answer: http://stackoverflow.com/a/21738900
favorite count: 0
score: -1
type: UnansweredQuestion
has body: In java I'm making an application that, when activated (if wantCommand = true), it will read what ever key you press it reads and adds it to a string, and then using Java.awt.Graphics, it draws the string to the screen... Can someone help me with the code to getting the String to what you type (and possibly a deleting also in case you messed up what you were typing) Here is what I have so far: import java.awt.Color; import java.awt.Font; import java.awt.Graphics; public class slashCommand { public static boolean wantCommand = false; public static String commandLine = "kill"; public static String getText () { //get the string in a for loop or something maybe return commandLine; } public static void render(Graphics g) { if (wantCommand) { g.setColor(new Color(0, 0, 0, 130)); g.fillRect(Inventory.inv_bag[0].x - 100, Inventory.inv_bag[0].y + 116, Component.size.width, 10); g.setColor(new Color(255, 255, 255)); g.setFont(new Font("Arial", Font.PLAIN, 10)); g.drawString("/ " + commandLine, Inventory.inv_bag[0].x - 69, Inventory.inv_bag[0].y + 125); } } }
tagged with: input
downvote count: 1
has answer: http://stackoverflow.com/a/21738933
tagged with: java
type: Question
answer count: 2
tagged with: keypress

http://stackoverflow.com/comment/33018074
comment on: http://stackoverflow.com/a/21816320
type: AnswerComment
has text: public static void oldestPerson(ArrayList<Person> aList) { Person oldest= null; for (Person p : aList) { if(p.getAge() > oldest.getAge()) { oldest = p; } System.out.println("Person" + p.getFullName() + "is the oldest:" + p.getAge()); } }
score: 0
type: Comment

http://stackoverflow.com/comment/32787264
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21687776
has text: Yes. That's what I suspect. Is there a way to get around this?

http://stackoverflow.com/q/21686237
has body: I wrote a JUnit test which is executing successfully in Intellij and it is passed. But if I run mvn clean test that particular test is failing. To be more specific the task is to check if the request is sent or not. So when I run the test in IntelliJ the test passes with Status code 201(Successful). But when I run mvn clean install it is showing it as status code 400(Bad request). I searched online regarding this, but couldn't find solution. Please help me. Below is the code. It is failing at the first assertion: assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());: @Test public void testUpdateMultiValueAttributes() throws URISyntaxException { String createPayload = "{\n" + " \"id\": 9,\n" + " \"email\": \"" + "ismith@zzz.com" + "\",\n" + " \"profile\": {\"userAttrs\":[" + " {\"CUST_ATTR_MULTI_VALUE\": \"CUST_ATTR_MULTI_VALUE_3\"}" + " ]}" + "}"; MockHttpRequest request = MockHttpRequest.put("/subscribers/9"); request.contentType(MediaType.APPLICATION_JSON); request.content(createPayload.getBytes()); MockHttpResponse response = new MockHttpResponse(); dispatcher.invoke(request, response); LOG.error(response.getContentAsString()); response.toString(); assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode()); SubscriberDto subscriber = null ; try { subscriber = MarshallingUtils.unmarshallJSON(new TypeReference&lt;SubscriberDto&gt;() { }, response.getContentAsString()); } catch (Exception e) { fail(e.getMessage()); } Collection&lt;SubscriberAttributeDto&gt; customAttributes = subscriber.getProfile().getUserAttrs(); if (customAttributes!=null) assertTrue(customAttributes.contains(new SubscriberAttributeDto("CUST_ATTR_MULTI_VALUE", "CUST_ATTR_MULTI_VALUE_3")));
tagged with: maven
has comment: http://stackoverflow.com/comment/32789448
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32784373
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32784821
has title: JUnit test is successful in IntelliJ but failed in Maven
upvote count: 4
tagged with: intellij-idea
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/32785664
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/32784893
has comment: http://stackoverflow.com/comment/32784402
has comment: http://stackoverflow.com/comment/32785008
has comment: http://stackoverflow.com/comment/32785293
score: 4
has answer: http://stackoverflow.com/a/21708659
has comment: http://stackoverflow.com/comment/32786118

http://stackoverflow.com/q/21818380
tagged with: jframe
score: 1
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/21818578
type: Question
tagged with: java
tagged with: jpanel
has title: JPanel not displaying in JFrame
has comment: http://stackoverflow.com/comment/33020087
has comment: http://stackoverflow.com/comment/33020110
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21818578
favorite count: 0
has comment: http://stackoverflow.com/comment/33020010
has comment: http://stackoverflow.com/comment/33020266
type: AnsweredQuestion
has body: I know that the same question has been asked many times, but I really don't seem to find the error in my code that hinders the object of type JPanel to be displayed in the JFrame. Here is the constructor of the class that extends JFrame: import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Game extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; private Board board; public Game() { super("Game"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBackground(Color.WHITE); board = new Board(); add(board, BorderLayout.CENTER); JButton button = new JButton("Start new game"); button.setFocusPainted(false); button.addActionListener(this); JPanel control = new JPanel(); control.setBackground(Color.WHITE); control.add(button); add(control, BorderLayout.SOUTH); pack(); setResizable(false); setVisible(true); } And this one is the constructor of the class that extends JPanel: public class Board extends JPanel implements ActionListener { public Board() { setBackground(Color.WHITE); setLayout(new GridLayout(NUMBER_OF_ROWS, NUMBER_OF_COLUMNS)); setBorder(BorderFactory.createEmptyBorder(20, 20, 0, 20)); board = new Cell[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS]; for (int row = 0; row &lt; NUMBER_OF_ROWS; row++) { for (int column = 0; column &lt; NUMBER_OF_COLUMNS; column++) { board[row][column] = new Cell(this, row, column); add(board[row][column]); } } } When I run the main method (which I didn't show here), it shows only the frame and the button. If someone could give a hint on this, I would be very thankful.

http://stackoverflow.com/comment/33045386
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21830297
has text: @GloryOfSuccess - it looks like your json and xml do not match. your json shows a single array with multiple objects, but your xml seems to be breaking each object into a separate array. are you sure the code, json, and xml you posted is correct?

http://stackoverflow.com/comment/32986867
type: QuestionComment
comment on: http://stackoverflow.com/q/21799731
has text: Tried.But no luck.Same problem.
score: 0
type: Comment

http://stackoverflow.com/a/21797937
type: Answer
has comment: http://stackoverflow.com/comment/32984532
has comment: http://stackoverflow.com/comment/32983338
has comment: http://stackoverflow.com/comment/32983412
has body: DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd"); String text = date.toString(formatter); LocalDate date = LocalDate.parse(text, formatter); more info here or, if you're not using java8 here
upvote count: 3
has comment: http://stackoverflow.com/comment/59524874
answers question: http://stackoverflow.com/q/21797897
has comment: http://stackoverflow.com/comment/32984472
downvote count: 0
has comment: http://stackoverflow.com/comment/32983288
has comment: http://stackoverflow.com/comment/32988084
score: 3

http://stackoverflow.com/q/21817600
has answer: http://stackoverflow.com/a/21817624
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33018481
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/2429062
type: Question
answer count: 2
duplicate of: http://stackoverflow.com/q/2429062
accepted answer: http://stackoverflow.com/a/21817624
has answer: http://stackoverflow.com/a/21817683
has comment: http://stackoverflow.com/comment/33018765
linked to: http://stackoverflow.com/q/13848176
tagged with: this
possible better answer: http://stackoverflow.com/a/21817683
favorite count: 0
has title: What does "this" do in Java?
has body: k, I am going through few Game Development Tutorials of Java, and I have to work with Threads and there is a "this" thing Thread thread = new Thread(this); that I am unable to understand, I am implementing my Class by "Runnable". What I think about it, is that "this" refers to Runnable to seek for the Run Method that I have defined in MY Class. And If I don't do this, It won't be looking for Run() Method here in my Class. Don't really know If M-Effed, but please correct me If I am wrong....
upvote count: 2

http://stackoverflow.com/q/21759404
score: 2
type: AnsweredQuestion
has body: I understand JVM is a standard process and each JVM has it's own heap, threads and each Java application uses an independent JVM. I want to know if how does Garbage Collection in one JVM impact other JVMs in the machine? My aim: Study GC STW pauses against an application I wrote. Ques 1: If an application in a JVM is leaking memory, will GC in that JVM stop threads running in other JVMs too? My instinct says no, but I would like to confirm. Ques 2: How do I study the GC pauses of my application? Do I run a canary thread to measure the pause time and fire load to my application in the same JVM? How can I do so (in terms of number of threads)? I'd really appreciate an example.
tagged with: java
type: Question
has title: Is Garbage Collection in java, specific to a JVM, what happens to other JVMs if an application in one JVM is leaking memory
accepted answer: http://stackoverflow.com/a/21759543
downvote count: 0
answer count: 1
tagged with: jvm
favorite count: 0
upvote count: 2
tagged with: multithreading
tagged with: memory-leaks
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/21759543

http://stackoverflow.com/comment/32841625
has text: @Radiodef, the problem is, I can't figure out a way to make a new Graphics() outside of a class, so I won't be able to call my method.
comment on: http://stackoverflow.com/q/21717775
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/21790827
upvote count: 1
has body: This is an Eclipse Juno project using JDK7 and I can't get JBoss7 to start up. The error mentions LoopLimitCheck, but that's a red herring, other devs on the same project have that option and it is fine. I've tried all the obvious stuff like paths and making sure everyone is using the same JVM, etc. to no avail. Here is the output of the ant script: Buildfile: C:\workspaces\tee_git\tee_build\build\build.xml [echo] Loaded user specified filters from: C:\tee/tee.localhost.filter.properties confirm-jboss-mgmt: start-jboss: [exec] Calling "C:\workspaces\tee_git\tee_build\jboss7\bin\standalone.conf.bat" [exec] Running JBoss in debug mode [exec] =============================================================================== [exec] JBoss Bootstrap Environment [exec] JBOSS_HOME: C:\workspaces\tee_git\tee_build\jboss7 [exec] JAVA: C:\Program Files\Java\jdk1.7.0_51\bin\java [exec] JAVA_OPTS: -XX:+TieredCompilation -Dprogram.name=debug.bat -Xms512m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=128m -Xrs -Dhibernate.dialect=org.hibernate.dialect.SQLServer2005Dialect -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djboss.server.default.config=standalone.xml -XX:-UseLoopPredicate -XX:-LoopLimitCheck -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n [exec] =============================================================================== [exec] Error: Could not create the Java Virtual Machine. [exec] Error: A fatal exception has occurred. Program will exit. [exec] Improperly specified VM option 'LoopLimitCheck' [exec] Press any key to continue . . . BUILD SUCCESSFUL Total time: 1 second
score: 1
tagged with: java
tagged with: jboss
tagged with: eclipse
type: Question
has title: JBoss 7 Statup Fails
answer count: 1
has answer: http://stackoverflow.com/a/21790946
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32986526
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21799576
has text: @fge Can you elaborate?
score: 0

http://stackoverflow.com/q/21763829
type: UnansweredQuestion
tagged with: java-ee-7
score: 13
tagged with: jakarta-ee
tagged with: java
has title: JSR-356: How to abort a websocket connection during the handshake?
linked to: http://stackoverflow.com/q/23599185
has body: I need to be able to abort a websocket connection during the handshake in case the HTTP request does not meet certain criteria. From what I understand, the proper place to do that is inside the ServerEndpointConfig.Configurator.modifyHandshake() method of my own Configurator implementation. I just can't figure out what to do to abort the connection. There's a HandshakeResponse parameter which allows adding headers to the response but I couldn't find any header that does the job. So how can I abort a websocket connection during the handshake? Is that even possible?
type: Question
has answer: http://stackoverflow.com/a/21766822
has answer: http://stackoverflow.com/a/23641852
tagged with: java-7
tagged with: websocket
linked to: http://stackoverflow.com/q/25994023
downvote count: 0
has answer: http://stackoverflow.com/a/24285252
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/34740737
upvote count: 13
has answer: http://stackoverflow.com/a/79039300

http://stackoverflow.com/comment/33000515
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21806829
has text: it is giving error when i extend TabActivity. Android Replaced TabActivity with FragmentActivity
score: 0

http://stackoverflow.com/comment/32971415
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21790869
score: 0
has text: You're not putting it at the end of the format string, then. Perhaps you're putting in an extra parameter instead of adding the `%n` to the first string.

http://stackoverflow.com/comment/124299582
type: Comment
type: AnswerComment
score: 1
has text: thanks. It's my first time use macOS(M1). 1. make /opt/homebrew visible in Finder `>open /opt` and then drag homebrew folder to left area in Finder 2. in IDEA choose the right path `/opt/homebrew/Cellar/openjdk/17.0.1/libexec/openjdk.jdk/Contents/Home`.
comment on: http://stackoverflow.com/a/69410018

http://stackoverflow.com/comment/32794880
type: QuestionComment
comment on: http://stackoverflow.com/q/21690954
has text: Just use an AffineTransform.
score: 0
type: Comment

http://stackoverflow.com/a/21766452
answers question: http://stackoverflow.com/q/21765870
has comment: http://stackoverflow.com/comment/32928265
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32927543
accepted answer of: http://stackoverflow.com/q/21765870
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32931291
has body: How you can do this with standard Java libraries: Integer[] ints = new Integer[]{3,2,1}; // For reverse of natural order i.e. largest to smallest // If you want the natural order don't use the Collections.reverseOrder() comparator Queue&lt;Integer&gt; queue = new PriorityQueue&lt;Integer&gt;(ints.length, Collections.reverseOrder()); queue.addAll(Arrays.asList(ints)); while (queue.size() &gt; 0) { System.out.println(queue.poll()); }
has comment: http://stackoverflow.com/comment/32927649

http://stackoverflow.com/comment/32941812
comment on: http://stackoverflow.com/a/21773188
score: 0
type: AnswerComment
has text: Does that allow a move in stead of a copy?
type: Comment

http://stackoverflow.com/comment/33016872
has text: Ah! You never said Sierpinski earlier! To get that, just remove the last call to `inscribeTriangles`. I did that by commenting out.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21815098
type: AnswerComment

http://stackoverflow.com/comment/32816010
type: AnswerComment
comment on: http://stackoverflow.com/a/21704150
type: Comment
has text: I was asking about the implementation of the base class, but thank you anyway for your time.
score: 0

http://stackoverflow.com/a/21728113
has comment: http://stackoverflow.com/comment/32859773
type: Answer
has comment: http://stackoverflow.com/comment/32860929
score: 1
has comment: http://stackoverflow.com/comment/32862654
has comment: http://stackoverflow.com/comment/32863454
has body: Try this DecimalFormat format = new DecimalFormat("#"); format.setMinimumFractionDigits(2); answer.setText(format.format(data2));
upvote count: 1
has comment: http://stackoverflow.com/comment/32862761
has comment: http://stackoverflow.com/comment/32864430
answers question: http://stackoverflow.com/q/21727346
downvote count: 0
has comment: http://stackoverflow.com/comment/32864295

http://stackoverflow.com/q/21679153
type: Question
tagged with: java
tagged with: hibernate
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21684672
tagged with: jersey
accepted answer: http://stackoverflow.com/a/21689823
has title: bean validation together with Spring
has answer: http://stackoverflow.com/a/21684672
has answer: http://stackoverflow.com/a/21689823
tagged with: spring
type: AnsweredQuestion
has body: Tomcat application, and I use Spring for dependency injection. I also use Jersey for rest calls, now I need to do some bean validation. I found examples that it is easy to to if I were using Spring MVC @RequestMapping for rest calls. But using Jersey and hibernate validator together things got ugly. @POST @Path("/addSomething") public void addSomething(Something something) { Set&lt;ConstraintViolation&lt;Something&gt;&gt; violations = validator.validate(something); if(violations.size()&gt;0){ throw new BadRequestException("illegal input"); } .. } This works, but I need to repeat this for every post request. Which is ugly. Is there a way to neatly handle bean validation here?

http://stackoverflow.com/q/21829233
favorite count: 0
has answer: http://stackoverflow.com/a/21829638
tagged with: powermock
has answer: http://stackoverflow.com/a/21831615
has comment: http://stackoverflow.com/comment/33038437
tagged with: testng
has body: Let's look at this piece of code : public class A { public void doSmth() { // pay attention - void method // impl } } public class B { private A a_instance; // null public void doSmthElse() { a_instance.doSmth(); // NPE here without mock // also do smth. else } } Now, I have B b = new B(); and I want to test b.doSmthElse() , but I need to create a mock for a_instance object before, otherwise I will get NullPointerException ! How can I achieve this with EasyMock or PowerMock ???
has answer: http://stackoverflow.com/a/21830762
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33039719
tagged with: unit-testing
type: Question
tagged with: easymock
has title: EasyMock + PowerMock : How to mock field?
answer count: 3
downvote count: 0

http://stackoverflow.com/q/21805082
tagged with: ubuntu
has answer: http://stackoverflow.com/a/21805106
tagged with: bash
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21805172
has body: I want to make a reading entry for my java application to get some data from a bash script which runs regularly, so that my application can store the data in a database each time . any ideas please ?
tagged with: shell
accepted answer: http://stackoverflow.com/a/21805106
favorite count: 0
score: -1
tagged with: command-line
type: Question
answer count: 2
downvote count: 1
tagged with: java
has title: How to let a java application deal with a bash script in ubuntu
upvote count: 0
has answer: http://stackoverflow.com/a/21805172

http://stackoverflow.com/q/21694277
tagged with: applet
has answer: http://stackoverflow.com/a/21694436
type: UnansweredQuestion
tagged with: java
has body: What is the best way to handle events (enable or disable button) or share parameters across different windows that are opened of the same applet ? I am not referring to the browser window, instead (run as applet) window in the local IDE. Which can be the best method to handle this scenario and let the other window know that the event has occurred already and proceed to the next step ? Here, there are no multiple applets. Just one applet, one code base, but multiple instances created.
tagged with: jbutton
type: Question
has title: Handling events in multiple windows of the same applet
score: 0
answer count: 1
tagged with: events

http://stackoverflow.com/comment/32937280
has text: Yes looks like that is the problem. While converting long to int, it is failing and returning -1
score: 0
comment on: http://stackoverflow.com/q/21771855
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21825064
accepted answer of: http://stackoverflow.com/q/21821915
has comment: http://stackoverflow.com/comment/33032980
type: Answer
has comment: http://stackoverflow.com/comment/33033206
has comment: http://stackoverflow.com/comment/33032708
score: 9
has body: 1: The first approach will always return a pixel in int ARGB format, and in the sRGB color space. Regardless of the image's internal representation. This means that unless the image's internal representation is TYPE_INT_ARGB, some conversion has to be done. This is sometimes useful, because it's predictable, but just as often it's quite slow. As an example, color space conversion is quite expensive. Also, if the image has higher precision than 8 bits per sample and/or 4 samples per pixel, precision loss occurs. This may or may not be acceptable, given your use case. 2: The second approach may give you a pixel value, but not in all cases, as it gives you the sample value at (x,y) for the the band 0 (the first band). For TYPE_INT_ARGB this will be the same as the pixel value. For TYPE_BYTE_INDEXED this will be the index to use in the look up table (you need to look it up to get the pixel value). For TYPE_3BYTE_BGR this will give you the blue value only (you need to combine it with the samples in band 1 and 2 to get the full pixel value). Etc. for other types. For samples that are not internally represented as an int, data type conversion occurs (and in rare cases precision loss). It might work for you, but I've never had much use for the getSample(...) methods. Instead I suggest you look into what I believe to be the fastest way to get at pixel data. That is using the getDataElements method: Object pixel = null; // pixel initialized on first invocation of getDataElements for (y) { for (x) { pixel = raster.getDataElements(x, y, pixel); } } This will give you the "native" values from the data buffer, without any conversion. You then need to have special handling for each transfer type (see the DataBuffer class) you want to support, and perhaps a common fallback for non-standard types. This will have the same "problem" as your approach 2 for pixel values vs normalized RGB values, so you might need to convert/look up "manually". What approach is better, as always, depends…
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21821915
downvote count: 0
upvote count: 9

http://stackoverflow.com/comment/41178061
type: AnswerComment
type: Comment
has text: @SotiriosDelimanolis Could you answer this question, http://stackoverflow.com/questions/26250337/why-does-the-controller-return-0-and-displays-it-in-ui-in-the-spring-validation Please.
comment on: http://stackoverflow.com/a/21821213
score: 0

http://stackoverflow.com/comment/33009450
type: Comment
has text: why would I check whether a JSON object is a JSON object
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21811110

http://stackoverflow.com/q/21691967
tagged with: jline
type: Question
tagged with: visual-c++
has title: Redirect input whith pipe and java
downvote count: 0
favorite count: 0
score: 3
tagged with: windows
has body: I have read Creating a Child Process with Redirected Input and Output in MSDN. And I have redirected output.But redirect input is different from this example in my case. I have run java -jar xxx.jar in child process.And redirect the input to the stdinPipe is successful.But I found that child process , the jar , doesn't read the the input. I have redirected the input handle like this: ZeroMemory( &amp;siStartInfo, sizeof(STARTUPINFO) ); siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.hStdError = g_hChildStd_OUT_Wr; siStartInfo.hStdOutput = g_hChildStd_OUT_Wr; siStartInfo.hStdInput = g_hChildStd_IN_Rd; siStartInfo.dwFlags |= STARTF_USESTDHANDLES; // Create the child process. bSuccess = CreateProcess(NULL, szCmdline, // command line which I use "java -jar xxx.jar" NULL, // process security attributes NULL, // primary thread security attributes TRUE, // handles are inherited 0, // creation flags NULL, // use parent's environment NULL, // use parent's current directory &amp;siStartInfo, // STARTUPINFO pointer &amp;piProcInfo); // receives PROCESS_INFORMATION When I using bSuccess = WriteFile(g_hChildStd_IN_Wr, pCmd, strlen(pCmd), &amp;dwWritten, NULL);.It run perfect on my little test jar file which used System.out.println() and System.in.read() to output and input. But when I run the jar server, the input is invalid and redirection is failed.The only thing I know is the jar use ConsoleReader(System.in, System.out).I'm not familiar with java.So can anyone know what have forbidden me to redirect the input? Thanks a lot!! P.S. The source code is same as the link given at beginning. Finally I found that the jline.console.ConsoleReader.readLine("&gt;",null) is the problem lies.I run java with arg -nojline and everything is all right! I haven't read the jline.console.ConsoleReader's source code.I'm very glad anyone can tell my the difference between the System.in.read() and jline.console.ConsoleReader.readLine("&gt;",null). The problem code is below: if (!useConsole) { retu…
answer count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: pipe
tagged with: java

http://stackoverflow.com/a/21762468
type: Answer
has comment: http://stackoverflow.com/comment/32920029
has body: The string literal "\\s\\s*" is equivalent to the regular expression syntax \s\s* which matches "a whitespace character followed by zero or more whitespace characters". A whitespace character is defined as [ \t\n\x0B\f\r], which includes spaces and newlines.
has comment: http://stackoverflow.com/comment/32920101
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21762452
has comment: http://stackoverflow.com/comment/32920075
answers question: http://stackoverflow.com/q/21762452
type: AcceptedAnswer
score: 5

http://stackoverflow.com/comment/33212554
score: 0
has text: I dont see any problem with your code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21813516

http://stackoverflow.com/comment/32901268
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21745619
has text: I don't think anything specifically prevents the optimization; they just haven't implemented it yet.

http://stackoverflow.com/q/21828133
type: UnansweredQuestion
has title: Call 2 Ajax calls in one using Jquery Ajax
tagged with: java
favorite count: 0
type: Question
has body: I have a problem in posting the selected values to the database with mismatching values.Here is the scenario where the ajax call maps to the respective Java function. The problem is, I am not getting correct selected values in the DB when the user logs in for the first time. Kindly provide a solution.... Here is my Jquery Ajax if(selectedproductIds != '') { $.ajax({ url : "selectedProducts", data : "selectedproducts="+selectedproductIds, type : "POST", success : function(data) { } }); $.ajax({ url : "&lt;c:out value= "${saveDemoURL}"/&gt;", data : request, type : "POST", success : function(data) { showNotification({ message : "", type : "success", autoClose : true, duration : 5 }); resetForm(); alert("Demo Request Saved Successfully"); } }); The first ajax call maps to this java function @RequestMapping(value = "/selectedProducts") public @ResponseBody String getSelectedProducts( @RequestParam(value = "selectedproducts") String[] selectedproducts, Map&lt;Object, Object&gt; map) { List&lt;Product&gt; selectedProd = new ArrayList&lt;Product&gt;(); for (String prod : selectedproducts) { Product product = new Product(); product.setId(Integer.parseInt(prod)); selectedProd.add(product); } if (!Util.isEmpty(selectedProd)) { map.put("selectedproducts", selectedProd); } for (Product product: selectedProd) { LOGGER.info("Demo ID:"+ " List of selected products:"+product.getId()); } selectedProdList = selectedProd; return "success"; } The second Ajax call maps to this java function @RequestMapping(value = "/saveDemo") public @ResponseBody Map&lt;Object, Object&gt; saveDemo(@ModelAttribute("demoBean") DemoBean demoBean, Model model, Map&lt;Object, Object&gt; map) { Map&lt;Object, Object&gt; output = null; Demo demo = new Demo(); try{ ...... } catch{.....} return output; }
answer count: 2
has answer: http://stackoverflow.com/a/21828901
tagged with: jquery
linked to: http://stackoverflow.com/q/7252451
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21828194
tagged with: ajax

http://stackoverflow.com/q/21704779
score: 1
tagged with: java
tagged with: jpanel
has title: Icon in Java - how to add icon in a panel
answer count: 2
has body: Refer to this link to see the image: https://www.dropbox.com/s/byeah81vg1cck5m/output.jpg I want a panel like the picture above. hello , i am a beginner on Java , i would like to know how is it possible to add this icon within a panel with the scrollbar . I have tried with JLabel, here is my code: JPanel panel = new JPanel(); panel.setLayout(null); JScrollPane txtstmtPane = new JScrollPane(panel,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); ImageIcon icon=new ImageIcon ( "icon/filter.jpg" ); JLabel label = new JLabel(); label.setIcon(icon); label.setBounds(600, 600, 40, 30); panel.add(label); txtstmtPane.setViewportView(panel); add(txtstmtPane);
has answer: http://stackoverflow.com/a/21724575
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32817178
linked to: http://stackoverflow.com/q/299495
has answer: http://stackoverflow.com/a/21707066
type: UnansweredQuestion
upvote count: 1
tagged with: swing
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/32948329
has text: @gstackoverflow So you are laughing at the point you are missing?? :) range of value `-128 to 127` fits in one byte.
type: AnswerComment
comment on: http://stackoverflow.com/a/21778431
score: 0
type: Comment

http://stackoverflow.com/a/21686515
accepted answer of: http://stackoverflow.com/q/21685974
answers question: http://stackoverflow.com/q/21685974
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: Maven only allows to depend on a project's artifacts. Exploded dependencies are not permitted: you can't store them in a repository, you need to zip/package them first. Maven emphasizes build consistency over speed and developer convenience, so features like incremental builds, unrolled dependencies or runtime code replacement are not available with standard maven. However, other tools and IDE cheat by using unrolled dependencies when they can - for instance m2e (Eclipse's maven integration) uses the unrolled version of a project when it's opened in the workspace. But those tools are built on top (and around) maven.

http://stackoverflow.com/a/21706055
answers question: http://stackoverflow.com/q/21705912
type: AcceptedAnswer
has body: Taking into consideration Artoo Detoo answer you should also do the following Change this: c.moveToFirst(); while (c.moveToNext()) { ... } For this: if(c != null) { c.moveToFirst(); do { Contenu contenu = new Contenu(); contenu.setValeur(c.getString(c.getColumnIndex("valeur"))); test.add(contenu); }while(c.moveToNext()); c.close(); } If not you will be skipping the first row.
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21705912
upvote count: 2

http://stackoverflow.com/a/21782429
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21782233
answers question: http://stackoverflow.com/q/21782233
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Question: How should I decide on the server side WHEN to remove peers? In browser applications clients can vanish without explicit logout. This is usually handled so that in addition to explicit logout, a client is also considered logged out if it hasn't made a call to the server in the last x minutes (x often being 10 or 15 minutes). If you want clients to stay logged on for longer than that you can have the client make "keep alive" calls every (x-1) minutes for as long as the browser stays on the current website.
score: 1

http://stackoverflow.com/a/21693001
answers question: http://stackoverflow.com/q/21692923
upvote count: 1
downvote count: 0
has body: You'll want to create and register a SensorListener: mSensorManager.registerListener(mSensorListener, sensor, SensorManager.SENSOR_DELAY_GAME); Then in the SensorListener's onSensorChanged(SensorEvent event) method, get the sensor readings from the event.values array. This will get you the gravity values, which you then use to move the ImageView. As for how to move the ImageView, it depends a lot on what sort of Layout the view is in, but you could play around with setting the ImageView's margins.
type: Answer
score: 1

http://stackoverflow.com/comment/32800763
type: QuestionComment
has text: is createResult is an instance of your Search class?
type: Comment
comment on: http://stackoverflow.com/q/21695377
score: 3

http://stackoverflow.com/q/21767188
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/32929293
has comment: http://stackoverflow.com/comment/32929082
has comment: http://stackoverflow.com/comment/32929168
has comment: http://stackoverflow.com/comment/32929374
has comment: http://stackoverflow.com/comment/32929135
has comment: http://stackoverflow.com/comment/32929086
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21767479
has comment: http://stackoverflow.com/comment/32929120
possible better answer: http://stackoverflow.com/a/21767608
has body: I've been debugging this piece of code for a while now and I simply can't figure out why it doesn't work. It's an attempt at implementing a sequential insertion sort in Java. public void resultSort(int[] resultSet){ int j; for(int i = 0; i &lt; resultSet.length; i++){ j = i; while(j &gt; 0 &amp;&amp; resultSet[j-1] &lt; resultSet[j]){ swap(j, j-1); j = j-1; } } } public void swap(int index1, int index2){ int sw = numbers[index1]; numbers[index1] = numbers[index2]; numbers[index2] = sw; } If somebody could point out the error here, I'd be very happy. Thanks in advance!
has answer: http://stackoverflow.com/a/21767608
has comment: http://stackoverflow.com/comment/32928848
has title: Broken insertion sort
accepted answer: http://stackoverflow.com/a/21767479
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32928964
tagged with: insertion-sort
has comment: http://stackoverflow.com/comment/32929074

http://stackoverflow.com/a/21695374
score: 3
answers question: http://stackoverflow.com/q/21693422
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: In Lab4DWP's WebContent/WEB-INF/lib copy paste all the Derby jars and try
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21693422

http://stackoverflow.com/comment/32800627
comment on: http://stackoverflow.com/q/21695205
has text: here is your answer : http://stackoverflow.com/a/8080701/2764279
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21725023
score: 2
downvote count: 0
has body: You can use a BigInteger type.
type: Answer
answers question: http://stackoverflow.com/q/21724945
upvote count: 2

http://stackoverflow.com/q/21778859
has answer: http://stackoverflow.com/a/21779210
tagged with: webview
type: Question
has comment: http://stackoverflow.com/comment/32949488
tagged with: java
has title: Stop form data being remembered
score: 0
accepted answer: http://stackoverflow.com/a/21779210
answer count: 1
tagged with: android
has body: I have an android app, and i open webViews within it. now if someone types something into a textbox within my webView, the next time it is opened, it shows the suggestions (what the previous user typed). How can i stop my webViews from storing the previous users entries? The only way i can get rid of them is to delete all the data from my app, but i store other things in here, so dont want to delete all the data for my app. Thanks in advance
type: AnsweredQuestion
tagged with: android-webview

http://stackoverflow.com/q/21714594
has comment: http://stackoverflow.com/comment/32843101
possible better answer: http://stackoverflow.com/a/53636385
score: 23
favorite count: 0
tagged with: scala-option
has title: Difference between Java Optional and Scala Option
has answer: http://stackoverflow.com/a/53636385
has comment: http://stackoverflow.com/comment/32844869
tagged with: scala
has answer: http://stackoverflow.com/a/21719777
upvote count: 23
has body: At the very end, this article introducing to new Java 8 Optional, states that Optional is not nearly as powerful as Option[T] in Scala (but at least it doesn’t allow wrapping null). The API is not as straightforward as null-handling and probably much slower. But the benefit of compile-time checking plus readability and documentation value of Optional used consistently greatly outperforms disadvantages I have a very basic knowledge of Scala and I'm getting familiar with Java 8 Optional, so at a first sight, it's not clear to me what are the differences between the two, if any. I know, for example, that in Scala I can use pattern matching to test Option and make my life easier. But, excluding what are the features of Scala's syntax, I would like to know if there's something I can do with Option in Scala that I cannot do with Optional in Java. Hope this is not marked as silly question, but every time I read that 'powerful', question marks fly over my head.
type: AnsweredQuestion
tagged with: java
tagged with: option-type
type: Question
accepted answer: http://stackoverflow.com/a/21719777
has comment: http://stackoverflow.com/comment/32847341
answer count: 2
downvote count: 0

http://stackoverflow.com/q/21833155
has comment: http://stackoverflow.com/comment/33906444
score: 0
tagged with: java
answer count: 1
has body: I have an HTML document with a number of meta tags &lt;meta name="donald" content="duck" /&gt; &lt;meta name="micky" content="mouse" /&gt; &lt;meta name="daisy" content="duckling" /&gt; &lt;meta name="scrooge" content="macduck" /&gt; I am able to get the content values ok but wish to change "mouse" to "horse" say.
type: UnansweredQuestion
has title: Use jsoup to set the content value of a meta tag
has answer: http://stackoverflow.com/a/21834216
tagged with: jsoup
type: Question
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/21708783
has comment: http://stackoverflow.com/comment/32824608
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21709114
upvote count: 2
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22482032
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22482032
has answer: http://stackoverflow.com/a/21708876
has body: I have a link that has a space in it, but when i paste it to the browser, it loads the page and the link changes slightly, here is the link: http://www.marketimyilmazlar.com/image/cache/data/DUZELTME/dvm/screenshot 7-500x500.jpg But it returns into the following when browser loas the page: http://www.marketimyilmazlar.com/image/cache/data/DUZELTME/dvm/screenshot%207-500x500.jpg Here is what i do in java: public static Drawable LoadImageFromWeb(String link) throws URISyntaxException { try { URI uri = new URI(link); URL url = new URL(uri.toASCIIString()); InputStream is = (InputStream) url.getContent(); Drawable d = Drawable.createFromStream(is, "src name"); return d; } catch (IOException e) { Log.e("HATA", "THERE is an error", e); return null; } } But the problem is, I get the following exception: java.net.URISyntaxException: Illegal character in path at index 73: So, can anyone help me with this? Thanks
answer count: 3
has answer: http://stackoverflow.com/a/21709114
tagged with: url
favorite count: 0
has title: How to convert a url that has a space in it to a valid url in java?

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/21741672
tags question: http://stackoverflow.com/q/21836211
tags question: http://stackoverflow.com/q/21790621
tags question: http://stackoverflow.com/q/21762826
tags question: http://stackoverflow.com/q/21719649
tags question: http://stackoverflow.com/q/21808814
tags question: http://stackoverflow.com/q/21816985
tags question: http://stackoverflow.com/q/21739080
tags question: http://stackoverflow.com/q/21834661
tags question: http://stackoverflow.com/q/21707550
tags question: http://stackoverflow.com/q/21817095
tags question: http://stackoverflow.com/q/21709473
tags question: http://stackoverflow.com/q/21790835
tags question: http://stackoverflow.com/q/21759499
tags question: http://stackoverflow.com/q/21823455
tags question: http://stackoverflow.com/q/21708065
tags question: http://stackoverflow.com/q/21728406
tags question: http://stackoverflow.com/q/21692732
type: Tag
tags question: http://stackoverflow.com/q/21800550
tags question: http://stackoverflow.com/q/21733432
tags question: http://stackoverflow.com/q/21719346
tags question: http://stackoverflow.com/q/21786548

http://stackoverflow.com/a/21769198
upvote count: 3
has comment: http://stackoverflow.com/comment/32932741
answers question: http://stackoverflow.com/q/21769060
downvote count: 0
has comment: http://stackoverflow.com/comment/32932589
type: Answer
has body: It sounds like you just want some formula to calculate the modifiers. Guessing from your question, the formula would be something along the lines of: int modifier = Math.floor((skillLevel - 10) / 2); If you want different formulas for different types of skills, then you're probably going to want a Skill class with different constants stored in it, used to calculate the formula. For instance, if strength is calculated as above, but intelligence needs to be at 15 before you start gaining a modifier, you could do this: public class Skill { int baseLevel; public Skill(int level) { this.baseLevel = level; } public int getModifier(int skillLevel) { return Math.floor((skillLevel - baseLevel) / 2); } } Create the strength instance of Skill with a baseLevel of 10 and the intelligence instance of Skill with a baseLevel of 15. If your formula for calculating the modifier is more complicated, you can change this class accordingly.
score: 3

http://stackoverflow.com/comment/32892387
has text: show _current output_ and _expected output_.
score: 0
comment on: http://stackoverflow.com/q/21746724
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21821915
upvote count: 5
tagged with: javax.imageio
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21825064
accepted answer: http://stackoverflow.com/a/21825064
tagged with: image-processing
has title: BufferedImage getRGB vs Raster getSample
type: Question
score: 5
has body: I am trying to do some image processing in Java. I used ImageIO library for reading and writing images. I can read the image pixel value in two ways as follows (there might be other methods which do not know). Using BufferedImage's getRGB method: pixel = image.getRGB(x,y); Using Raster's getSample method: WritableRaster raster = image.getRaster(); pixel = raster.getSample(x,y,0); What is the difference in the above two approaches?
answer count: 1
favorite count: 0

http://stackoverflow.com/a/60546562
score: 0
answers question: http://stackoverflow.com/q/21746094
has body: My answer may be of use for others: I will show it with an example for both radio and drop-down buttons as both are used to select a singular response from a list: File: index.jsp Student Course Group <%for (int i = 1; i <= 6; i++) {%> <option value= "1ITF<%=i%>">1ITF<%=i%> <%}%> Preference at the moment: <%String[] chosenArray = {"APP", "BIT", "EMDEV", "INFRA", "ANDR"}; for (int j = 0; j < chosenArray.length; j++) {%> <input type="radio" name="studentPreference" value="<%=chosenArray[j]%>" id="<%=chosenArray[j]%>"/> <label for="<%=chosenArray[j]%>"><%=chosenArray[j]%> <%}%> File: StudentServlet.java protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String studentCourse = request.getParameter("studentCourses"); String studentPreference = request.getParameter("studentPreference"); Student coursePreference= new Student(studentCourse, studentPreference); if (request.getParameter("studentFormSubmit") != null) { request.setAttribute("coursePreference", coursePreference); request.getRequestDispatcher("DisplayResult.jsp").forward(request, response); } } And in file DisplayResult.jsp Course Details <% Student coursePreference= = (Student) request.getAttribute("coursePreference"); %> Student Course: <%=coursePreference.getStudentCourse()%> Student Preference: <%=coursePreference.getStudentPreference()%>
type: Answer

http://stackoverflow.com/a/21687155
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32786438
has comment: http://stackoverflow.com/comment/32786715
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32798416
answers question: http://stackoverflow.com/q/21687044
has body: Assume you have your object transformation matrix: protected final float[] mTransformMatrix = new float[16]; When you create object you just use Matrix.setIdentityM(mTransformMatrix, 0); To rotate you need: Matrix.rotateM(mTransformMatrix, 0, angle, 0, 0, 1.0f); Here are some methods for object positioning, sizeing and rotating: public Sprite setSize(float sizeX, float sizeY) { setCenterSizeRotation(this.mPositionX, this.mPositionY, sizeX, sizeY, this.mAngle); this.mSpriteWidth = sizeX; this.mSpriteHeight = sizeY; return this; } public Sprite setCenter(float posX, float posY) { setCenterSizeRotation(posX, posY, this.mSpriteWidth, this.mSpriteHeight, this.mAngle); this.mPositionX = posX; this.mPositionY = posY; return this; } public Sprite setRotation(float angle) { setCenterSizeRotation(this.mPositionX, this.mPositionY, this.mSpriteWidth, this.mSpriteHeight, angle); this.mAngle = angle; return this; } public Sprite setCenterSizeRotation(float posX, float posY, float sizeX, float sizeY, float angle) { reset(); float oX = UtilsGL.getStepX() * posX - 1.0f; float oY = UtilsGL.getStepY() * posY - 1.0f; float scaleX = sizeX / (UtilsGL.getSurfaceWidth()); float scaleY = sizeY / (UtilsGL.getSurfaceHeight()); translate(oX, oY); scale(scaleX, scaleY); rotate(angle); this.mSpriteWidth = sizeX; this.mSpriteHeight = sizeY; this.mPositionX = posX; this.mPositionY = posY; this.mAngle = angle; return this; } public Sprite translate(float x, float y) { Matrix.translateM(mTransformMatrix, 0, x, y, 0); return this; } public Sprite scale(float x, float y) { Matrix.scaleM(mTransformMatrix, 0, x, y, 1.0f); return this; } public Sprite rotate(float d) { Matrix.rotateM(mTransformMatrix, 0, d, 0, 0, 1.0f); return this; } public Sprite reset() { Matrix.setIdentityM(mTransformMatrix, 0); return this; } Don't be afraid of returns, that's just a bit of code from my Sprite class UtilsGL part: private static int mSurfaceWidth; private static int mSurfaceHeight; private static float mStepX; privat…

http://stackoverflow.com/q/21708478
accepted answer: http://stackoverflow.com/a/21709378
answer count: 1
upvote count: 1
tagged with: swing
has title: java - two images in FLowLayout() will disappear when moved
type: AnsweredQuestion
has body: I have the following code that produces two seperate .pngs on the screen. These .pngs are meant to be moved by the mouse and all is working well except for when they are dragged the are seemingly under some type of layer and the disappear when dragged more than an inch. Any advice so appreciated. import java.awt.*; import javax.swing.*; import java.awt.event.MouseEvent; import java.awt.event.MouseAdapter; public class TestMouseDrag { public static void main(String[] args) { new TestMouseDrag(); } public TestMouseDrag() { EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new FlowLayout()); frame.add(new DragMyIcon("C:\\Users\\anon\\Desktop\\Hobbit.png")); frame.add(new DragMyIcon("C:\\Users\\anon\\Desktop\\alien.png")); frame.setSize(800,800); frame.setVisible(true); } }); } public class DragMyIcon extends JPanel { public static final long serialVersionUID = 172L; private JLabel label; public DragMyIcon(String path) { ImageIcon icon = null; icon = new ImageIcon(path); label = new JLabel(icon); add(label); MouseHandler handler = new MouseHandler(); label.addMouseListener(handler); label.addMouseMotionListener(handler); } } protected class MouseHandler extends MouseAdapter { private boolean active = false; private int xDisp; private int yDisp; @Override public void mousePressed(MouseEvent e) { active = true; JLabel label = (JLabel) e.getComponent(); xDisp = e.getPoint().x - label.getLocation().x; yDisp = e.getPoint().y - label.getLocation().y; label.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); } @Override public void mouseReleased(MouseEvent e) { active = false; JLabel label = (JLabel) e.getComponent(); label.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } @Override public void mouseDragged(MouseEvent e) { if (active) { JLabel label = (JLabel) e.getComponent(); Point point = e.getPoint(); label.setLocation(point.x - xDisp,…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21709378
type: Question
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/32916170
type: QuestionComment
has text: Yes, token is null in the case I tested. I will test with a non-null token.
comment on: http://stackoverflow.com/q/21760352
score: 0
type: Comment

http://stackoverflow.com/q/21818640
has comment: http://stackoverflow.com/comment/33020404
tagged with: jtable
score: 0
has body: I am just trying to add some stuff to a combobox here the thing is that some of the items I'm adding are repeated throughout. The only way I can think of avoiding adding duplicate items to the box is using 1 loop to add all the items to 2 array lists and then another 2 separate loops to loop through both lists to see if any of the items are duplicates (I haven't actually tried this yet so it's possible my logic is wrong). Can somebody suggest a quick and easy fix?
tagged with: user-interface
tagged with: jcombobox
has answer: http://stackoverflow.com/a/21818691
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33020485
tagged with: swing
has comment: http://stackoverflow.com/comment/33020520
has answer: http://stackoverflow.com/a/21820286
tagged with: java
type: Question
has title: removing duplicate items java gui
answer count: 2

http://stackoverflow.com/comment/33052136
comment on: http://stackoverflow.com/a/21836756
type: AnswerComment
has text: Thank you. I did not realise how to initialise the global variable version of bigdecimal. I hope my basic question wasnt too annoying.
score: 0
type: Comment

http://stackoverflow.com/comment/32820463
comment on: http://stackoverflow.com/a/21689595
type: Comment
has text: yes thats the main reason to have diplicated data, removing the static references you can have the correct data. If it works mark as solved =) hihi
score: 0
type: AnswerComment

http://stackoverflow.com/q/21720397
has comment: http://stackoverflow.com/comment/32845370
type: Question
has comment: http://stackoverflow.com/comment/32845318
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/3776327
has comment: http://stackoverflow.com/comment/32845312
has comment: http://stackoverflow.com/comment/32845475
tagged with: java
tagged with: authentication
has answer: http://stackoverflow.com/a/21720945
has comment: http://stackoverflow.com/comment/32845694
tagged with: jsp
type: UnansweredQuestion
tagged with: servlets
has title: How to write custom exceptions for login in java
has body: I am building a web application i ve a login jsp form which will be redirected to a servlet... My servlet code: Login login=new Login(); login.setUserName(request.getParameter("txtUsername")); login.setPassWord(request.getParameter("txtPassword")); LoginService ls=new LoginService(); ls.loginValidate(login); RequestDispatcher rd=request.getRequestDispatcher("/Login.jsp"); rd.forward(request, response); } and from their to service class: My service class code: public class LoginService { Login login=null; public Login loginValidate(Login login) { validateLogin(login); return login; } private void validateLogin(Login login) { this.login=login; if(login!=null){ LoginDAO ld=new LoginDAO(); DataSource dataSource=new DataSource(); ld.setDataSource(dataSource); ld.validate(login); } } } } and from their to DAO My LoginDAO: public class LoginDAO { private DataSource dataSource; public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } public boolean validate(Login login){ boolean status=true; String sql="select * from Login where UserName=? and PassWord=?"; Connection conn = null; try{ conn = dataSource.createConnection(); PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1,login.getUserName()); ps.setString(2,login.getPassWord()); ResultSet rs=ps.executeQuery(); status=rs.next(); } catch (SQLException e) { throw new RuntimeException(e); } finally { if (conn != null) { try { conn.close(); } catch (SQLException e) {} } } return status; } } But when i type the correct username and password its redirecting to success page(Login.jsp in this context) and even if i type wrong un and pw its redirecting i do understand why because after method call in servlet i have dispatched it to login.jsp so in any condition it will redirect me. But one of my friend to resolve this suggested me to add custom exception class when the un and pw are typed wrongly.. now i wanna know how to write this custom exception class for this app. So please some one help…
has answer: http://stackoverflow.com/a/21720705
linked to: http://stackoverflow.com/q/9238180

http://stackoverflow.com/comment/32920446
type: AnswerComment
type: Comment
has text: Ah, so I will use volatile fields to enable fast reads and just synchronize the writes. Thanks a lot!
comment on: http://stackoverflow.com/a/21762017
score: 0

http://stackoverflow.com/q/21797000
has comment: http://stackoverflow.com/comment/32981877
type: AnsweredQuestion
tagged with: java
has body: Following code sends a request to a web service and receive the results. It successfully sends the request and show the results on console, the problem is that I can not parse the xml into object. Code Request req = new Request(); req.setLanguage(lang); webser webs = new webser(); webs.setRequest(req); JAXBContext context = JAXBContext.newInstance(webser.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); URL url = new URL("http://example.com"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setInstanceFollowRedirects(false); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/xml"); OutputStream os = connection.getOutputStream(); m.marshal(webs, os); WebResponse result = (WebResponse) JAXB.unmarshal(connection.getInputStream(), WebResponse.class); System.err.println(">>>>>>" + result.getResponse().getInfogetPersons().get(0).getId()); //does not return anything //**** populating the object manually **** String edd = ">"; person p1 = new Person(); p1.setId(1); Person p2 = new Person(); p2.setId(2); Info info = new linfo(); info.getPersons().add(p1); info.gePersons().add(p2); Response r = new Response(); r.setinfo(info); WebResponse result2 = new WebResponse(); result2.setResponse(r); JAXB.marshal(result2, edd); System.err.println("Result:" + edd); << does not return anything connection.disconnect(); } catch (IOException e) { return e.getMessage(); } catch (JAXBException e) { return e.getMessage(); } WebResponse.java @XmlRootElement public class WebResponse { @XmlElement(name = "Response") private Response response = null; public Response getResponse() { return response; } public void setResponse(Response response) { this.response = response; } } Response.java @XmlRootElement public class Response { @XmlRootElement (name = "Info") private Info info; ... } Info.java @XmlRootElement public class Info…
has comment: http://stackoverflow.com/comment/32982046
tagged with: jaxb
has title: How to parse xml result received from client
type: Question
accepted answer: http://stackoverflow.com/a/21797447
has comment: http://stackoverflow.com/comment/32981742
has comment: http://stackoverflow.com/comment/32981943
has comment: http://stackoverflow.com/comment/32981641
has comment: http://stackoverflow.com/comment/32981774
score: 0
tagged with: xml-parsing
answer count: 1
has comment: http://stackoverflow.com/comment/32981731
has comment: http://stackoverflow.com/comment/32982070
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21797447
has comment: http://stackoverflow.com/comment/32982226
has comment: http://stackoverflow.com/comment/32981808

http://stackoverflow.com/a/21720240
downvote count: 0
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/21720157
has body: From JLS Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21720157

http://stackoverflow.com/comment/33357785
has text: Why don't you use org.hibernate.dialect.PostgreSQL9Dialect?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21780017

http://stackoverflow.com/a/21688461
answers question: http://stackoverflow.com/q/21688327
score: 0
has body: You should use a Servlet Filter to create the SessionFactory and open/close sessions. Hibernate calls this the Open-Session-In-View pattern and implementation is described here: https://community.jboss.org/wiki/OpenSessionInView?_sscc=t
type: Answer

http://stackoverflow.com/a/27476843
score: 0
type: Answer
has body: I had the same issue after copying a class which had been created by Window Builder. I found that I had been missing the following file: \src\org\eclipse\wb\swinger\FocusTraversalOnArray.java this seems to be the only file which Window Builder adds externally. I'll post the code here in case anybody needs it. /******************************************************************************* * Copyright (c) 2011 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Google, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.wb.swing; import java.awt.Component; import java.awt.Container; import java.awt.FocusTraversalPolicy; /** * Cyclic focus traversal policy based on array of components. * &lt;p&gt; * This class may be freely distributed as part of any application or plugin. * * @author scheglov_ke */ public class FocusTraversalOnArray extends FocusTraversalPolicy { private final Component m_Components[]; //////////////////////////////////////////////////////////////////////////// // // Constructor // //////////////////////////////////////////////////////////////////////////// public FocusTraversalOnArray(Component components[]) { m_Components = components; } //////////////////////////////////////////////////////////////////////////// // // Utilities // //////////////////////////////////////////////////////////////////////////// private int indexCycle(int index, int delta) { int size = m_Components.length; int next = (index + delta + size) % size; return next; } private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i &lt; m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentCom…
answers question: http://stackoverflow.com/q/21777998
has comment: http://stackoverflow.com/comment/43430753

http://stackoverflow.com/q/21808909
score: -5
has comment: http://stackoverflow.com/comment/33002985
has body: I can't process with my code. I want to start my application if local Internet Protocol is equal to "XXX" What i have wrote already wrote Code: InetAddress IP=InetAddress.getLocalHost(); System.out.println("SYSTEM IP = "+IP.getHostAddress()); Console : SYSTEM IP= 192.168.0.69 How can i check: if my Internet Protocol is equal to 192.168.0.69 (or any i will get on other PC) code executes; else: stops? Thanks for advice if any!
type: AnsweredQuestion
tagged with: java
downvote count: 5
type: Question
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/21808936
has answer: http://stackoverflow.com/a/21808948
favorite count: 0
has answer: http://stackoverflow.com/a/21808938
has title: Get IP and execute on IF statement
possible better answer: http://stackoverflow.com/a/21808936
accepted answer: http://stackoverflow.com/a/21808938

http://stackoverflow.com/comment/32804291
type: QuestionComment
comment on: http://stackoverflow.com/q/21697386
has text: Well look at the types involved - the `share` and `cost` parameters are `int` and `double` respectively; `rand1` and `rand2` are `Random`. How did you expect that to work, and what do you *want* to happen? (Hint: look at the methods available on `Random`...)
score: 0
type: Comment

http://stackoverflow.com/comment/43056516
type: AnswerComment
type: Comment
score: 1
has text: Awesome! It makes POJO jars! Gr8!
comment on: http://stackoverflow.com/a/23213557

http://stackoverflow.com/a/21778886
answers question: http://stackoverflow.com/q/21777826
score: 0
type: Answer
has body: if record count great then 1000 StringBuilder sb = new StringBuilder(); foreach (var item in req) { sb.AppendLine("insert into Table_Name(column1, column1, column1 , column1) values "); sb.AppendFormat("({0},{1},{2},'{3}') ;", item.val1, item.val2, item.val3, item.val4); } sb = sb.Remove(sb.Length - 1, 1); ExecuteNonQuery(sb.ToString()); return true;

http://stackoverflow.com/comment/33831131
type: Comment
comment on: http://stackoverflow.com/a/21909443
has text: Thanks but, cobertura based coverage is based on Java 6. I am talking about unit test coverage of Java 7 and Netbeans 7 based module project. But anyway thanks for the answers
score: 0
type: AnswerComment

http://stackoverflow.com/q/21713345
tagged with: selenium-webdriver
tagged with: selenium
has comment: http://stackoverflow.com/comment/32833899
has answer: http://stackoverflow.com/a/21713629
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23287334
has comment: http://stackoverflow.com/comment/32833939
tagged with: java
tagged with: wysiwyg
has answer: http://stackoverflow.com/a/55726967
upvote count: 10
possible better answer: http://stackoverflow.com/a/23287334
has comment: http://stackoverflow.com/comment/32833868
linked to: http://stackoverflow.com/q/21684236
downvote count: 0
accepted answer: http://stackoverflow.com/a/21713629
has title: Can't sendKeys() to TinyMCE with Selenium WebDriver
favorite count: 0
has comment: http://stackoverflow.com/comment/32833544
tagged with: tinymce
answer count: 3
has body: I am using Selenium WebDriver in Eclipse and I am trying to insert text into a tinymce box on a web page. This is the code I am using. //find tinymce iframe editorFrame = driver.findElement(By.cssSelector(".col_right iframe")); //switch to iframe driver.switchTo().frame(editorFrame); driver.findElement(By.className("mceContentBody")).sendKeys("YOOOO"); driver.switchTo().defaultContent(); The cursor is blinking inside of the editor, however no text is sent. I have also tried this slight variation without any luck. //find tinymce iframe editorFrame = driver.findElement(By.cssSelector(".col_right iframe")); //switch to iframe driver.switchTo().frame(editorFrame); WebElement body = driver.findElement(By.className("mceContentBody")); body.sendKeys("YOOOO"); driver.switchTo().defaultContent();
score: 10

http://stackoverflow.com/comment/32861936
type: AnswerComment
has text: How do you call ``windowClosing``?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21729654

http://stackoverflow.com/comment/33010809
comment on: http://stackoverflow.com/q/21812505
score: 0
type: Comment
has text: My understanding of this question is: "I have a frame, and this frame should contain a JScrollPane AND some other components". But of course, when you set the ScrollPane as the ContentPane of the Frame, then ONLY the ScrollPane will be visible. For the case that my interpretation of the question is correct, I'll leave this pointer here: http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html
type: QuestionComment

http://stackoverflow.com/a/21776727
type: Answer
score: 0
has body: This won't work for random mappings of characters to other characters, but since yours has a pattern you can make a function that will convert each character using their char/int values, for example: static char convert(char c){ int n = c; n = n - 70; // Adjust for capital F n = n * -1; // So earlier letters become larger numbers n += 48; // Adjust back to zero return (char)n; } This method will take any of the letter characters and return the equivalent number character (and the equivalent function for number characters should be clear), so just loop through converting each one individually. If you care about speed, this should be pretty fast, especially if you can use char arrays instead of strings.
answers question: http://stackoverflow.com/q/21776261

http://stackoverflow.com/a/21680536
score: 1
has comment: http://stackoverflow.com/comment/32775169
accepted answer of: http://stackoverflow.com/q/21678542
has body: This folder is wrong https://github.com/dozortsev/AdviceExchange/tree/master/service/src/test/resource the maven convention is "resources" - with s at the end, so the test application context is not at the classpath. Because you have classpath*:/spring/test-app-context... with * the missing file is ignored and then it can't find any beans because the context is empty. Just fix the folder name.
answers question: http://stackoverflow.com/q/21678542
has comment: http://stackoverflow.com/comment/32775407
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32775263
has comment: http://stackoverflow.com/comment/32775308
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32849957
has text: Your English sounds like Chinese to me. Also: I've updated my answer with a solution that allows anyone to copy/paste the text. Please read the answer, try it and accept the answer (so that it gets a green check mark).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21720802

custom-type
tag name: custom-type
tags question: http://stackoverflow.com/q/21836555
type: Tag

http://stackoverflow.com/q/21811667
has body: I have a char array {'H','e','l','l','o',' ','W','i','n'}; I want to do the reverse of order of sentence in array like {Win Hello}. How can i do this in java. Thanks
tagged with: arrays
has answer: http://stackoverflow.com/a/21812254
score: 0
has answer: http://stackoverflow.com/a/21811988
duplicate of: http://stackoverflow.com/q/15390846
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/117630777
has title: Reverse of Words in Character Array
tagged with: java
has comment: http://stackoverflow.com/comment/33007923
linked to: http://stackoverflow.com/q/15390846
type: Question
answer count: 2

http://stackoverflow.com/q/21796653
has comment: http://stackoverflow.com/comment/33006118
has body: Open Directory Project like dmoz , very finely categorizes each and every website. Though said to be the starting point for any crawler project. I am confused. I just cannot figure, how to use dmoz as a tool in indexing ? What do I scan in each directory that has many sub directories and so on ? I understand scanning a webpage like stackoverflow but I cannot figure this with dmoz. Note - I want to make my own search engine for the learning purpose.I have tried to emulate dmoz as a part of it.
has comment: http://stackoverflow.com/comment/33005817
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32981128
tagged with: search-engine
has comment: http://stackoverflow.com/comment/32981380
answer count: 0
has comment: http://stackoverflow.com/comment/32981006
has comment: http://stackoverflow.com/comment/32989329
has comment: http://stackoverflow.com/comment/32981543
has title: How do I start indexing with dmoz?
type: Question
tagged with: indexing
has comment: http://stackoverflow.com/comment/32981297
tagged with: java
has comment: http://stackoverflow.com/comment/33027038
tagged with: database
has comment: http://stackoverflow.com/comment/33005584
tagged with: web-crawler
score: 0
has comment: http://stackoverflow.com/comment/32981020

http://stackoverflow.com/comment/32934244
has text: @Jskandhari: There is no `R.id.prof_uname` in `R.layout.activity_cab_detail`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21755945

http://stackoverflow.com/comment/32944285
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21773398
has text: That's changing business requirements, but might be the only option... And actually I didn't think about that, so thank You :)

http://stackoverflow.com/a/21755326
type: Answer
downvote count: 0
has body: Try returning a list from the method: @RequestMapping("/greetings") public @ResponseBody List&lt;Greeting&gt; greetings( @RequestParam(value="name", required=false, defaultValue="World") String name) { return Arrays.asList(new Greeting(counter.incrementAndGet(),String.format(template, name))); }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21755169

nio
tags question: http://stackoverflow.com/q/21687708
tags question: http://stackoverflow.com/q/21811761
tag name: nio
tags question: http://stackoverflow.com/q/21718588
type: Tag

http://stackoverflow.com/comment/32996946
type: Comment
has text: @user3314757: There is no direct analogue to a messagebox, though you can create one via an `AlertDialog`. Note that displaying modal dialogs is not considered especially good form for mobile apps, so you may want to consider some alternative UI.
comment on: http://stackoverflow.com/a/21805404
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33006587
comment on: http://stackoverflow.com/a/21810767
type: AnswerComment
score: 0
type: Comment
has text: Yes, but I mean that you don't have an instance of each sample.

http://stackoverflow.com/comment/33174020
type: Comment
has text: Weld is a CDI container. You need an EJB container in order to handle EJBs. That's why you're facing this issue. Using a real container solves this issue. In addition, embedded containers are simulation environments. You might want to read this Arquillian blog http://arquillian.org/blog/2012/04/13/the-danger-of-embedded-containers/. I hope this helps.
comment on: http://stackoverflow.com/a/21887439
score: 2
type: AnswerComment

http://stackoverflow.com/comment/32892279
score: 9
type: AnswerComment
has text: So, this means that HK2 can't pull annotations directly off the class? Whats the point of annotating the class then?
type: Comment
comment on: http://stackoverflow.com/a/21745809

http://stackoverflow.com/comment/32992009
type: QuestionComment
comment on: http://stackoverflow.com/q/21802761
has text: Try using just `rs.getString("dev_name")`. You only need to specify the column name you want to retrieve. You also need to do at least one `rs.next()` before you can retrieve data from the ResultSet.
score: 0
type: Comment

http://stackoverflow.com/comment/32981380
type: QuestionComment
has text: These are questions which are specific to your use case. Analyze the categories and their structure and decide what's relevant for your purpose.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21796653

http://stackoverflow.com/q/21697500
has answer: http://stackoverflow.com/a/35307419
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/33217191
tagged with: duplicates
has comment: http://stackoverflow.com/comment/32810698
has answer: http://stackoverflow.com/a/21699297
has answer: http://stackoverflow.com/a/36227257
type: Question
accepted answer: http://stackoverflow.com/a/22061647
has title: jdbc: oracle database change notification & duplicate events
downvote count: 0
possible better answer: http://stackoverflow.com/a/36227257
score: 2
answer count: 7
has body: I need some Listener for any change(update, insert, delete) of Oracle database table. Problem: I get many detection by single update on my table. I think its oracle cache etc. Is it possible only real changes to detect? my code: import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; import oracle.jdbc.OracleConnection; import oracle.jdbc.OracleDriver; import oracle.jdbc.OracleStatement; import oracle.jdbc.dcn.DatabaseChangeEvent; import oracle.jdbc.dcn.DatabaseChangeListener; import oracle.jdbc.dcn.DatabaseChangeRegistration; public class OracleDCN { static final String USERNAME = "scott"; static final String PASSWORD = "tiger"; static String URL = "jdbc:oracle:thin:@localhost:1521:stingdev"; public static void main(String[] args) { OracleDCN oracleDCN = new OracleDCN(); try { oracleDCN.run(); } catch (Exception ex) { ex.printStackTrace(); } } private void run() throws Exception{ OracleConnection conn = connect(); Properties prop = new Properties(); prop.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS, "true"); DatabaseChangeRegistration dcr = conn.registerDatabaseChangeNotification(prop); try{ dcr.addListener(new DatabaseChangeListener() { public void onDatabaseChangeNotification(DatabaseChangeEvent dce) { System.out.println("Changed row id : "+dce.getTableChangeDescription()[0].getRowChangeDescription()[0].getRowid().stringValue()); } }); Statement stmt = conn.createStatement(); ((OracleStatement) stmt).setDatabaseChangeRegistration(dcr); ResultSet rs = stmt.executeQuery("select * from EXAMPLE where ID=1"); while (rs.next()) { } rs.close(); stmt.close(); }catch(SQLException ex){ if (conn != null) { conn.unregisterDatabaseChangeNotification(dcr); conn.close(); } throw ex; } } OracleConnection connect() throws SQLException { OracleDriver dr = new OracleDriver(); Properties prop = new Properties(); prop.setProperty("user", OracleDCN.USERNAME); prop.setProperty("password", OracleDCN.PASSWORD); return (OracleConn…
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/22061647
tagged with: oracle-database
has answer: http://stackoverflow.com/a/33238010
has answer: http://stackoverflow.com/a/35307348

http://stackoverflow.com/q/21794693
has comment: http://stackoverflow.com/comment/32977839
tagged with: java
has answer: http://stackoverflow.com/a/21794729
type: Question
tagged with: android-inflate
has answer: http://stackoverflow.com/a/21802510
score: 0
answer count: 2
has title: Android application crashes on Inflater.inflate
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32979804
type: UnansweredQuestion
has body: Ok, so here is the thing, I watched tons of videos and read tons of articles but I could'nt find a solution... Basically, my application is crashing because I'm inflating, and I can't figure out a solution. JAVA: package com.iweto; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.InflateException; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; public class TestScreen extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); MyFragment frag = new MyFragment(); transaction.add(R.id.fragment_container, frag); transaction.commit(); setContentView(R.layout.test_screen); } @Override protected void onStart() { super.onStart(); } public static class MyFragment extends Fragment { private View view; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (view != null) { ViewGroup parent = (ViewGroup) view.getParent(); if (parent != null) parent.removeView(view); } try { return inflater.inflate(R.layout.main, container, false); } catch (InflateException e) { /* map is already there, just return view as it is */ e.getStackTrace(); } return view; } } } XMLS: test_screen.xml: <?xml version="1.0" encoding="utf-8"?> and finally, the main.xml file: <?xml version="1.0" encoding="utf-8"?> More to that, this is the logcat: 02-15 09:45:59.566: D/AndroidRuntime(1086): Shutting down VM 02-15 09:45:59.566: W/dalvikvm(1086): threadid=1: thread exiting with uncaught exception (group=0xa628d288) 02-15 09:45:59.570: E/AndroidRuntime(1086): FATAL EXCEPTION: main 02-15 09:45:59.570: E/AndroidRuntime(1086): java.lang…
tagged with: android

http://stackoverflow.com/a/21811235
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21811192
has body: It only matters if in some case you break one of the loops. In that case I'd put the break on the one that is expected to be longer. This longer list would be the inner one (because if you break the other one you break the whole thing).

http://stackoverflow.com/a/21695396
accepted answer of: http://stackoverflow.com/q/21695358
score: 12
upvote count: 12
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21695358
type: Answer
has body: 1) Arrays.copyOf public String[] getStudents() { return Arrays.copyOf(students, students.length);; } 2 System.arraycopy public String[] getStudents() { String[] copyStudents = new String[students.length]; System.arraycopy(students, 0, copyStudents, 0, students.length); return copyStudents; } 3 clone public String[] getStudents() { return students.clone(); } Also see the answer about performance of each approach. They are pretty the same

http://stackoverflow.com/q/21735018
has comment: http://stackoverflow.com/comment/32871982
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: hibernate
has answer: http://stackoverflow.com/a/21767816
has comment: http://stackoverflow.com/comment/32872660
linked to: http://stackoverflow.com/q/799280
has comment: http://stackoverflow.com/comment/32871503
has comment: http://stackoverflow.com/comment/32871586
has body: I'm modifying an exising POJO to include a boolean field, and want to display said Categories based on the boolean value. To do so, I have updated the Hibernate XML configuration and added the fields to the database. My issue is that a HibernateQueryError is thrown on the Criteria.list() method when returning the data because Hibernate cannot resolve the new field. Category POJO: public class Category implements java.io.Serializable { private long id; private String name; private Short displayOrder; private Boolean enabled; private Set&lt;Submission&gt; submissions = new HashSet&lt;Submission&gt;(0); //getters and setters public Boolean getEnabled(){ return this.enabled; } public void setEnabled(Boolean enabled){ this.enabled = enabled; } Added mapping to hibernate config: &lt;hibernate-mapping&gt; &lt;class name="com.jason.app.hibernate.Category" table="CATEGORY" lazy="false"&gt; ... other properties &lt;property name="enabled" type = "java.lang.Boolean"&gt; &lt;column name="IS_ENABLED" /&gt; &lt;/property&gt; ... set mapping configuration &lt;/hibernate-mapping&gt; and this is the trouble spot: private boolean hasDisplayOrder; private boolean isEnabled; public List&lt;V&gt; list() { try { Criteria criteria = getSession().createCriteria(returnedClass()); if (hasDisplayOrder &amp;&amp; isEnabled){ criteria = criteria.add(Restrictions.eq("enabled", true)) .addOrder(Order.asc("displayOrder")); log.info("Category object is enabled, added to criteria"); } else if (hasDisplayOrder ) { criteria = criteria.addOrder(Order.asc("displayOrder")); log.info("Object does not contain enabled method"); } return criteria.list(); } catch (RuntimeException re) { log.error("Could not retrieve list results for class " + returnedClass.getSimpleName(), re); } return null; } The logging statement inside the first conditional triggers in the logs, and then an error message is printed out. 2014-02-12 12:02:49,482 INFO [com.jason.app.manager.BaseManager] Category object is enabled, added to c…
downvote count: 0
answer count: 1
has title: Hibernate - Unable to resolve property error when accessing new data field
favorite count: 0
has comment: http://stackoverflow.com/comment/32872523
type: UnansweredQuestion
tagged with: hibernate-mapping
tagged with: spring

http://stackoverflow.com/a/21794308
has comment: http://stackoverflow.com/comment/33010657
has comment: http://stackoverflow.com/comment/32997471
has comment: http://stackoverflow.com/comment/32997795
has comment: http://stackoverflow.com/comment/32997624
has comment: http://stackoverflow.com/comment/33283694
has comment: http://stackoverflow.com/comment/33248758
accepted answer of: http://stackoverflow.com/q/21793532
has comment: http://stackoverflow.com/comment/33270469
has comment: http://stackoverflow.com/comment/33010242
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21793532
has comment: http://stackoverflow.com/comment/33017858
score: 0
has comment: http://stackoverflow.com/comment/33267439
has body: Now look I have some points : Three Entites you have : School , Workshop , Teacher. School have oneTomany with - workshop &amp; teacher. So once we are persisting school we'll have entries in both the tables - workshop &amp; teacher.And also you wanted to have A Workshop Entity has a single Host School so we achieved that also while persisting as per below code. Your School Entity : @Entity public class School { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long ID; @OneToMany(cascade = CascadeType.PERSIST, mappedBy="school") private List&lt;Teacher&gt; teachers; @OneToMany(cascade = CascadeType.PERSIST,mappedBy="school") private List&lt;Workshop&gt; workshops; // Getters and Setters and some methods } Your Teacher Entity: @Entity public class Teacher { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key key; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="key") private School school; // Getters and Setters and some methods} Your WorkShop Entity: @Entity public class Workshop { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key key; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="key") private School school; and then : em.getTransaction().begin(); School schoolObj = new School(); schoolObj.setName("School 1"); List &lt;Teacher&gt; teachers = new ArrayList&lt;Teacher&gt;(); List &lt;Workshop&gt; workshopList = new ArrayList&lt;Workshop&gt;(); Teacher teacher = new Teacher(); teacher.setSchool(schoolObj); teacher.setName("Teacher 1"); teachers.add(teacher); Teacher teacher1 = new Teacher(); teacher1.setSchool(schoolObj); teacher1.setName("Teacher 2"); teachers.add(teacher1); teacher teacher2 = new Teacher(); teacher2.setSchool(schoolObj); teacher2.setName("Teacher 3"); teachers.add(teacher2); Workshop ws = new Workshop(); ws.setSchool(schoolObj); //By this you setted schoolObj in workshop entity ws.set(some attribute); workshopList.add(ws); school.setTeachers(teachers); //By this you setted teachers through scho…
has comment: http://stackoverflow.com/comment/32997635
has comment: http://stackoverflow.com/comment/33283643
has comment: http://stackoverflow.com/comment/33010675
has comment: http://stackoverflow.com/comment/33009651
has comment: http://stackoverflow.com/comment/33093275
has comment: http://stackoverflow.com/comment/32997565
type: Answer

http://stackoverflow.com/comment/32974892
score: 0
type: Comment
has text: Thanks for your help, its 3:20am here so im off but please if you have any further thoughts don't hesitate i'm all ears. I'll leave it 24 hours before accepting your answer just in case anyone else has some input, Thanks again.
comment on: http://stackoverflow.com/a/21792687
type: AnswerComment

http://stackoverflow.com/comment/33002037
comment on: http://stackoverflow.com/q/21808315
has text: i need it 10 per line . but i cant let it show 10 per line..it appears everything in one line..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32992475
score: 0
type: QuestionComment
has text: For problems like this, you can often approach them by going back to the code that works, then changing small pieces. When it stops working, you only have to examine that one small change.
type: Comment
comment on: http://stackoverflow.com/q/21802451

http://stackoverflow.com/comment/32916255
type: QuestionComment
comment on: http://stackoverflow.com/q/21760352
score: 1
has text: @MRenauld Always read the doc of the class you are using. This is clearly stated: _"Like Hashtable but unlike HashMap, this class does not allow null to be used as a key or value."_
type: Comment

http://stackoverflow.com/a/47909826
has body: You could use OmniFaces Beans to get a CDI managed bean instance in your ExceptionMapper: Beans.getInstance(Bean.class) I'm using this with @javax.ejb.Stateless beans containing @javax.persistence.PersistenceContext.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21682365

http://stackoverflow.com/q/21828327
has body: I am doing an assignment in Eclipse Indigo with Java. I have to create a program for a school and that program is a spelling test program. I have been able to allow staff &amp; students to log on and also change their passwords and edit their accounts. I have also been able to create tests and also access them to edit. But one thing I cannot do is access the available tests in a list to see how many tests have been set. I don't know what to change in my code to fix this problem. To display the tests I have created a method called displayTest. I have created storage for the tests using a HashFile. Here I have saved storage for the tests in a HashFile. String test_FILENAME = "datafiles/test.dat"; HashFile testFile = new HashFile(test_FILENAME, 100, new Test()); I have continued to add a test ( I have storage for the variable test at the top of my coding document) using: public void addTest() { Test test = new Test();// create storage for a teacher test.input(); // read the teacher details in through the keyboard testFile.store(test); // store the teacher in the teacher file I have also been able to edit the account (the PC etc. is from another class I use) using: public void editTest() { String testNo; PC_Dialog editTests = new PC_Dialog("Edit Test", "Test No", "Find");// create a dialog box to ask for the teacher number editTests.choice();// display the dialog box testNo = editTests.getField(21); // get the teacherNo that has been entered test = (Test) testFile.retrieve(testNo); // retrieve the teacher from the file if (test != null) {// check if the teacher is found test.edit();// yes so display it for editing testFile.store(test); // store the teacher back in the teacher file } else JOptionPane.showMessageDialog(null, "Unable to find the test!");// not found so give an error message }// end of method But in displayTest() I have some problems. The displayTest is meant to allow the teachers to view all the tests set to see which ones to edit and which ones remove at …
tagged with: eclipse-indigo
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21832202
score: 0
answer count: 1
tagged with: java
has title: Displaying from database issue
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/21832202

http://stackoverflow.com/q/21741405
has title: Java - Passing a parameter to a class constructor, when an array of that class is being created
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21741457
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: instantiation
tagged with: arrays
has body: I know I can instantiate an object of another class, with an argument in its constructor like below: public class A{ B myB; myB = new B(this); } public class B{ A instanceThatCreatedMe; B(A myA){ instanceThatCreatedMe = myA; } } I want to do the same thing, but when B is created in a 2D array. In other words, to create a 2D array of B objects, with (this) as parameter in their constructor Something like this: public class A{ B[][] myBArr; myBArr = new B[][](this); //&lt;--- That isn't allowed! Neither is myBArr = new B(this)[][] } public class B{ //No change A instanceThatCreatedMe; B(A myA){ instanceThatCreatedMe = myA; } } Is there a way to do it without having to go through the whole array and setting the instanceThatCreatedMe in each object? Thank you everyone!
has comment: http://stackoverflow.com/comment/32883175
has comment: http://stackoverflow.com/comment/32882979
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32883194
tagged with: constructor
accepted answer: http://stackoverflow.com/a/21741457

http://stackoverflow.com/comment/32902563
type: Comment
comment on: http://stackoverflow.com/a/21752163
has text: Thank you, but my question pertains to the first step. I need to invoke the browser (or activate an open browser) and get the HTML content of the page. And I have to use Java or JavaScript (jQuery). I know I can use selenium WebDriver api to get the page's HTML content, but that is something I am forbidden to use.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21809065
type: Question
has comment: http://stackoverflow.com/comment/33003305
has comment: http://stackoverflow.com/comment/33004223
upvote count: 5
has comment: http://stackoverflow.com/comment/33003939
has comment: http://stackoverflow.com/comment/33003272
has body: I am unable to shutdown tomcat. When I do ./shutdown.sh, I don't see any error, but the process still seems to be running. When I kill the process (kill -9), the process gets killed. After this, if I do a startup, and shutdown again, I see the same problem. How do I gracefully shut it down? Why is this happening in the first place? Please help me. devServer:bin dev$ ps -ef|grep tomcat 501 34933 1 0 11:24PM test 0:02.02 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Djava.util.logging.config.file=/Users/dev/admin/runtime/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/Users/dev/admin/runtime/endorsed -classpath /Users/dev/admin/runtime/bin/bootstrap.jar:/Users/dev/admin/runtime/bin/tomcat-juli.jar -Dcatalina.base=/Users/dev/admin/runtime -Dcatalina.home=/Users/dev/admin/runtime -Djava.io.tmpdir=/Users/dev/admin/runtime/temp org.apache.catalina.startup.Bootstrap start 501 34982 33786 0 11:45PM test 0:00.00 grep tomcat devServer:bin dev$ ./shutdown.sh Using CATALINA_BASE: /Users/dev/admin/runtime Using CATALINA_HOME: /Users/dev/admin/runtime Using CATALINA_TMPDIR: /Users/dev/admin/runtime/temp Using JRE_HOME: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Using CLASSPATH: /Users/dev/admin/runtime/bin/bootstrap.jar:/Users/dev/admin/runtime/bin/tomcat-juli.jar devServer:bin dev$ ps -ef|grep tomcat 501 34933 1 0 11:24PM test 0:02.03 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Djava.util.logging.config.file=/Users/dev/admin/runtime/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/Users/dev/admin/runtime/endorsed -classpath /Users/dev/admin/runtime/bin/bootstrap.jar:/Users/dev/admin/runtime/bin/tomcat-juli.jar -Dcatalina.base=/Users/dev/admin/runtime -Dcatalina.home=/Users/dev/admin/runtime -Djava.io.tmpdir=/Users/dev/admin/runtime/temp org.apache.catalina.startup.Bootstrap…
score: 4
has title: Tomcat is not shutting down
has comment: http://stackoverflow.com/comment/33003222
has comment: http://stackoverflow.com/comment/33003198
has comment: http://stackoverflow.com/comment/33003207
has comment: http://stackoverflow.com/comment/33003998
answer count: 1
has comment: http://stackoverflow.com/comment/33003586
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/33003831
has answer: http://stackoverflow.com/a/21809259
has comment: http://stackoverflow.com/comment/33003509
has comment: http://stackoverflow.com/comment/33003877
has comment: http://stackoverflow.com/comment/33003324
has comment: http://stackoverflow.com/comment/33003529
has comment: http://stackoverflow.com/comment/33003762
has comment: http://stackoverflow.com/comment/33003807
has comment: http://stackoverflow.com/comment/33003555
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33003642
downvote count: 1

http://stackoverflow.com/comment/32836509
has text: First i cant see `dummyMonth` declare, second please put the trace log
comment on: http://stackoverflow.com/q/21714964
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33001462
has text: @Naren thank you for your reply. I corrected my mistake. I mentioned it above. now it's working.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21762748

http://stackoverflow.com/q/21782448
has comment: http://stackoverflow.com/comment/32956646
linked to: http://stackoverflow.com/q/3802370
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21782677
tagged with: java
has title: Java: remove collection elements if they are inactive for specific timeout
tagged with: collections
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/32956004
has comment: http://stackoverflow.com/comment/32955826
has answer: http://stackoverflow.com/a/21782677
has answer: http://stackoverflow.com/a/21782733
accepted answer: http://stackoverflow.com/a/21782733
tagged with: timeout
has body: I've got a web application. I store user sessions in collection. I also want to has an ability to renew user session. So I need to store even inactive user connections for some period, and if they are inactive for about a day, I should remove them. Like: expirationList.add(userSesion, timeout);, but each time I invoke userSesion's method I have to reset timeout. Question: Are there any implementations of such collection?
has comment: http://stackoverflow.com/comment/32955763
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32956059
has comment: http://stackoverflow.com/comment/32956242
has comment: http://stackoverflow.com/comment/32955976

http://stackoverflow.com/comment/32956388
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21782653
has text: thanks guys... I appreciate all the help. I'll give it a go.
score: 0

http://stackoverflow.com/a/21684304
upvote count: 2
has comment: http://stackoverflow.com/comment/32781175
has body: Yes it is, using an Intent filter. I guess you want to receive only pages of a particular site. Add something like this to your activity in AndroidManifest.xml: If the app is not installed, a webbrowser will also be able to open the site. You can get the actual url using getIntent().getData()
has comment: http://stackoverflow.com/comment/32783694
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21684260
answers question: http://stackoverflow.com/q/21684260
type: Answer
score: 2

http://stackoverflow.com/q/21704593
has comment: http://stackoverflow.com/comment/32817348
upvote count: 1
has comment: http://stackoverflow.com/comment/32817557
has body: There is a Video-game app and when I test with Samsung N-8010(1024*768) and Galaxy S2(640*480) it works fine however with Note 3(1920*1080) logcat showing me inflating error and out of memory. I read others about this but none of them was helpful. Can someone find my problem and solution ? I need to cut my xml but in line 212 it's just one of button and each run it's referring one of button in xml LogCat : 02-11 15:30:50.484: E/dalvikvm-heap(15795): Out of memory on a 2250016-byte allocation. 02-11 15:30:50.489: I/dalvikvm(15795): "main" prio=5 tid=1 RUNNABLE 02-11 15:30:50.489: I/dalvikvm(15795): | group="main" sCount=0 dsCount=0 obj=0x417b6578 self=0x417a1648 02-11 15:30:50.489: I/dalvikvm(15795): | sysTid=15795 nice=0 sched=0/0 cgrp=apps handle=1074192380 02-11 15:30:50.489: I/dalvikvm(15795): | state=R schedstat=( 662807416 95096167 570 ) utm=36 stm=29 core=2 02-11 15:30:50.489: I/dalvikvm(15795): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 02-11 15:30:50.489: I/dalvikvm(15795): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596) 02-11 15:30:50.489: I/dalvikvm(15795): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444) 02-11 15:30:50.489: I/dalvikvm(15795): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:832) 02-11 15:30:50.489: I/dalvikvm(15795): at android.content.res.Resources.loadDrawable(Resources.java:2988) 02-11 15:30:50.489: I/dalvikvm(15795): at android.content.res.TypedArray.getDrawable(TypedArray.java:602) 02-11 15:30:50.489: I/dalvikvm(15795): at android.view.View.&lt;init&gt;(View.java:3563) 02-11 15:30:50.489: I/dalvikvm(15795): at android.widget.TextView.&lt;init&gt;(TextView.java:879) 02-11 15:30:50.489: I/dalvikvm(15795): at android.widget.Button.&lt;init&gt;(Button.java:108) 02-11 15:30:50.489: I/dalvikvm(15795): at android.widget.Button.&lt;init&gt;(Button.java:104) 02-11 15:30:50.489: I/dalvikvm(15795): at java.lang.reflect.Constructor.constructN…
type: UnansweredQuestion
has title: android.view.InflateException: Binary XML file & Out of memory on a ...byte allocation
has comment: http://stackoverflow.com/comment/32827384
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
tagged with: java

http://stackoverflow.com/comment/33060714
type: Comment
comment on: http://stackoverflow.com/a/21841367
has text: is there anything else I can use except for HashMap? I'm sorry to say that I'm not allowed to use it in this assignment...
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38158806
score: 0
type: Comment
has text: This link requires a login.
comment on: http://stackoverflow.com/a/22078957
type: AnswerComment

http://stackoverflow.com/q/21690220
has comment: http://stackoverflow.com/comment/32792035
has body: I create private boolean method isMp3() but java say me that this method is undefined for such type. if (directoryItem.isFile() &amp;&amp; directoryItem.isMp3()){ resultListOfFiles.add(directoryItem); } I don't want to sand to method any values. I want use it like boolean method 'isDirectory()'. I know, I do something wrong, show me my mistake, please. private boolean isMp3(){ Pattern pattern; final String FILE_PATTERN = "([^\\s]+(\\.(?i)(mp3))$)"; pattern = Pattern.compile(FILE_PATTERN); Matcher matcher = pattern.matcher(this.toString()); if (matcher.find()){ return true; } else{ return false; } } If I use "this" statement correctly?
tagged with: boolean
score: 0
has comment: http://stackoverflow.com/comment/32792088
answer count: 3
possible better answer: http://stackoverflow.com/a/21690302
has comment: http://stackoverflow.com/comment/32792114
has answer: http://stackoverflow.com/a/21690860
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21690302
tagged with: java
tagged with: file
accepted answer: http://stackoverflow.com/a/21690797
tagged with: methods
type: Question
has title: Method is undefined for the type. Help me fix it
has comment: http://stackoverflow.com/comment/32792358
has comment: http://stackoverflow.com/comment/32792176
has answer: http://stackoverflow.com/a/21690797

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/21827923
tag name: grouplayout

http://stackoverflow.com/comment/32881959
score: 0
has text: so , what's the problem you face ??
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21716624

http://stackoverflow.com/a/21795792
answers question: http://stackoverflow.com/q/21795408
type: Answer
has comment: http://stackoverflow.com/comment/32981593
has comment: http://stackoverflow.com/comment/32981796
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32981954
has comment: http://stackoverflow.com/comment/32981655
has body: .jar files are executable on at least Windows and Mac OS. (There are not native code but they have an association with the program that will be used to open them, in this case Java) So if you double-click on a jar file on those operating systems, they will internally invoke java as if you typed java -jar with the jar file as the argument. However, if you have multiple versions of Java installed on your computer, it is possible that double-clicking opens the jar file with a different version of Java than if you typed java -jar on the command line. How this works exactly depends on your operating system so you would need to specify that in your question. .jar files have exactly the same format as .zip files (because they are .zip files with a different extension). Inside the jar/zip file there is a file called META-INF/MANIFEST.MF and this file specifies which class should be invoked when you double-click or type java -jar. It helps if you can show what is inside that file. If you have the unzip command installed you can show the contents of this file using: unzip -pfilename.jar META-INF/MANIFEST.MF Without unzip, you can extract the entire jar file and look inside META-INF/MANIFEST.MF: jar xffilename.jar Which operating system are you using? Do you have multiple versions of Java installed? What is inside the META-INF/MANIFEST.MF file?
has comment: http://stackoverflow.com/comment/32981232

http://stackoverflow.com/a/21775274
has comment: http://stackoverflow.com/comment/32943798
answers question: http://stackoverflow.com/q/21775138
score: 0
has body: For cols: System.out.println(AreaTuple[0].length); For rows: System.out.println(AreaTuple.length);
type: Answer

http://stackoverflow.com/comment/32959457
type: Comment
has text: Can you mark a single method as final in java (and not making whole class final)?
type: QuestionComment
comment on: http://stackoverflow.com/q/21784200
score: 0

http://stackoverflow.com/q/21728511
linked to: http://stackoverflow.com/q/5082175
downvote count: 0
linked to: http://stackoverflow.com/q/2155376
has comment: http://stackoverflow.com/comment/32859210
has comment: http://stackoverflow.com/comment/32866576
favorite count: 0
possible better answer: http://stackoverflow.com/a/21728726
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/32859139
type: AnsweredQuestion
has title: How to return max of identity column via Hibernate accessing Oracle DB?
tagged with: java
tagged with: hibernate
has body: Since it seems that HQL (createQuery) doesn't support scalar queries, I used a raw query via createSQLQuery: session.beginTransaction(); Query query = session.createSQLQuery("select nvl(max(id), 0) + 1 from empty_table_for_now"); session.getTransaction().commit(); List listL = query.list(); Iterator iterator = listL.iterator(); while (iterator.hasNext()) { LOG.info("Infinite loop. This is disgusting!"); } The query itself doesn't fail, but it seems to be returning a list with an infinite number of results? This doesn't make sense... Any idea why I am getting this? Even better yet, is there a better, more elegant way, of getting the intended scalar, without having to confuse whoever maintains my code with a "list" (that should always contain one element)?
has comment: http://stackoverflow.com/comment/32859491
linked to: http://stackoverflow.com/q/787722
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/21728726
has comment: http://stackoverflow.com/comment/32861264
score: 4
has answer: http://stackoverflow.com/a/21728595
accepted answer: http://stackoverflow.com/a/21728595
has comment: http://stackoverflow.com/comment/32858927
tagged with: sql

http://stackoverflow.com/q/21789317
upvote count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21791653
favorite count: 0
tagged with: jaxb-xew-plugin
type: Question
linked to: http://stackoverflow.com/q/15246950
score: 4
has body: I have just successfully used a wsimport/xjc plugin named xew with maven, using this post. Using Maven for this at my company is currently not an option, so I'm trying to use the wsimport utility from the Java 7 SDK. How do I tell wsimport to include the xew xjc plugin when importing my WSDL? My current command line is: wsimport -Xdebug -s src\main\java -d target\classes -extension -B-extension -B-classpath target\dependency\*:. -B-Xxew:instantiate lazy -B-Xxew:delete src\main\java\test.wsdl It won't eat the -B parameters yet though: no such JAXB option: -Xxew. The xew plugin and jaxb-xjc.jar are in the working directory and on the system CLASSPATH.
accepted answer: http://stackoverflow.com/a/21791653
tagged with: web-services
has title: wsimport/xjc command line plugins
answer count: 1
tagged with: java
tagged with: wsimport
tagged with: jaxb

http://stackoverflow.com/comment/33035384
has text: what is your problem ?
comment on: http://stackoverflow.com/q/21827289
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21690215
downvote count: 0
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/40397112
answer count: 3
has answer: http://stackoverflow.com/a/40397112
has answer: http://stackoverflow.com/a/21718600
favorite count: 0
tagged with: maven
score: 11
tagged with: spring
upvote count: 11
type: AnsweredQuestion
has body: Well here is an interesting experience i had since last couple of weeks structuring my maven multi module project. When i decided to use maven for my build life cycle management i had couple of reason that i wished to choose maven. a. Mostly development teams are divided so that each team can work on separate Module within the project like Team-A to work on User Management System, Team-B to work on Authorization System, Team-C to work on Document Management System...and so on. Each team has java developers, testers, UI experts etc. So the maven Project structure should be such that each team can independently work on their respective modules. They must be able to code, compile, build, test, deploy their module without having to compile, test modules belonging to other teams. And thus i came to conclusion that each development module of the maven multi-module project must represent a Functional Module After some discussions on forums i found people suggesting me to follow layered approach were child modules must be layers like controller-layer,service-layer,dao-layer etc. I did not pay heed to this advice because this not solving my purpose of teams working on individual module. This way for large project the build and deployment time for each team during development increases which does impact the project time-lines. sometimes the build and deploy time is upto 30 minutes say if there are 10 to 11 modules in the project. But i did pay heed to a suggestion that keeping DAO layer separate for each module is not a good idea as DAO is highly granular and reused by other modules. and so the dependency of one module on other would would any how become greater. I found a solution to this problem by creating a common module and moving DAOs and DOMAIN to the common module which will be inherited as a dependency by each module. And this seems to be a more viable option. Now the Project Structure looks like this. Now when i build the project and run the webapp on server, It com…
has comment: http://stackoverflow.com/comment/32810763
tagged with: java
has answer: http://stackoverflow.com/a/21691580
accepted answer: http://stackoverflow.com/a/21718600
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32794385
type: Question
has comment: http://stackoverflow.com/comment/32797359
has title: Maven Multi Module Project Structuring Issues

http://stackoverflow.com/q/21707059
has title: How to convert String to an Array In Java?
has comment: http://stackoverflow.com/comment/32821418
has comment: http://stackoverflow.com/comment/32821321
answer count: 1
score: -6
has body: I have a String and I want convert it to a String array without using a JsonObject. I searched many topics, but I can't solve my problem. My String is like: String str="[{"India":{"State":"Gujarat","City":"Rajkot","Pin":360330,"Place":"AT Rajkot"}}]"; And I want output As Array like: India Gujarat Rajkot 360330 AT Rajkot How can I get an array like that output, without using jsonObject?
favorite count: 0
type: UnansweredQuestion
downvote count: 6
has answer: http://stackoverflow.com/a/21707139
tagged with: java
has comment: http://stackoverflow.com/comment/32821332
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32821990
type: Question
upvote count: 0

jpanel
tags question: http://stackoverflow.com/q/21840006
tags question: http://stackoverflow.com/q/21710929
tags question: http://stackoverflow.com/q/21812501
tags question: http://stackoverflow.com/q/21762112
tags question: http://stackoverflow.com/q/21818582
tags question: http://stackoverflow.com/q/21836225
type: Tag
tags question: http://stackoverflow.com/q/21697601
tags question: http://stackoverflow.com/q/21681846
tags question: http://stackoverflow.com/q/21837899
tags question: http://stackoverflow.com/q/21725745
tags question: http://stackoverflow.com/q/21704779
tags question: http://stackoverflow.com/q/21683347
tags question: http://stackoverflow.com/q/21820161
tags question: http://stackoverflow.com/q/21753365
tags question: http://stackoverflow.com/q/21784537
tags question: http://stackoverflow.com/q/21813660
tags question: http://stackoverflow.com/q/21771233
tags question: http://stackoverflow.com/q/21723766
tags question: http://stackoverflow.com/q/21818380
tag name: jpanel
tags question: http://stackoverflow.com/q/21734380
tags question: http://stackoverflow.com/q/21709619
tags question: http://stackoverflow.com/q/21813610

http://stackoverflow.com/q/21823383
has body: public String displayType(int side1, int side2,int side3) { if(( side1+side2 &gt; side3)) if(( side1==side2) &amp;&amp; (side2==side3))//tell if equalateral { return ("Equalateral Triangle."); } else if (( side1==side2) &amp; (side2 != side3) || (side1 == side3) &amp; (side3 != side1))//tells if isosceles { return ("Isosceles Triangle."); } else if ((side1 != side2) &amp; (side2 != side3))//tells if scalene { return ("Scalene Triangle."); } } // missing return statement here error I'm making a program that determines triangles. This is where I'm getting my error When I compile this. It gives an missing return statement at the end. How would fix this?
has comment: http://stackoverflow.com/comment/33029272
tagged with: return
type: UnansweredQuestion
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/21823417
type: Question
has title: Missing return statement making triangle program
has answer: http://stackoverflow.com/a/21823408
score: 0
has comment: http://stackoverflow.com/comment/33028604
has answer: http://stackoverflow.com/a/21823478
has comment: http://stackoverflow.com/comment/33028587
has comment: http://stackoverflow.com/comment/33028784
has answer: http://stackoverflow.com/a/21823552

http://stackoverflow.com/a/21816579
answers question: http://stackoverflow.com/q/21803935
has body: If your only problem is that it's printing the rows in the opposite order from what you'd like you can just change the order in which you print the rows: for(int r=size-1;r&gt;=0;r--) Also, I'm a little confused by your code. The method magicSq is accepting an int[][]table as a parameter but then never does anything at all with it. Is the code supposed to do something with that table?
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/33101986
accepted answer of: http://stackoverflow.com/q/21803935
type: Answer

http://stackoverflow.com/a/21779168
accepted answer of: http://stackoverflow.com/q/21778947
has body: So, say you have this delegate class: class DelegateClass { String create( args ) { "create ${args.join(',')}" } String edit( args ) { "edit ${args.join(',')}" } } Then you could use methodMissing in your App class: class App { DelegateClass delegate = new DelegateClass() def methodMissing( String name, args ) { if( name.startsWith( 'create' ) ) { delegate.create( args ) } else if( name.startsWith( 'edit' ) ) { delegate.edit( args ) } } } So all the following works: def app = new App() assert app.editDetails() == 'edit ' assert app.editDetails( 'foo' ) == 'edit foo' assert app.editDetails( 'foo', 'bar' ) == 'edit foo,bar' assert app.createDetails( 'tim' ) == 'create tim' assert app.createOtherDetails() == 'create ' With java, there's no such thing as methodMissing, so you'd need to send strings describing the method to call to a centralised handler method, and have that call the method you want.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21778947
type: Answer

appassembler
type: Tag
tag name: appassembler
tags question: http://stackoverflow.com/q/21708311

http://stackoverflow.com/comment/32944080
has text: Do you mean I can choose either Eclipse or STS as I wish and there haven't any special things on both ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21775839

http://stackoverflow.com/q/21721648
has answer: http://stackoverflow.com/a/21721959
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32847662
downvote count: 0
tagged with: java
score: 16
accepted answer: http://stackoverflow.com/a/21721904
type: Question
has title: R.id.container not resolved
has body: I bought book Bill Phillips &amp; Brian Hardy "Android programming the big nerd ranch guide". And in the first chapter, I created Gradle solution using idea instead eclipse. This project generated by idea doesn't compile. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quiz); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new DummyFragment()) .commit(); } } 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:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".QuizActivity$DummyFragment"&gt; &lt;TextView android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; error: cannot find symbol variable container I have not changed anything, but project doesn't compile Please help me.
upvote count: 16
has comment: http://stackoverflow.com/comment/32847305
has answer: http://stackoverflow.com/a/21721904
has comment: http://stackoverflow.com/comment/32847386
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/21721959

http://stackoverflow.com/comment/32807627
type: Comment
comment on: http://stackoverflow.com/a/21699131
score: 0
has text: @nhahtdh: Having the two calls available makes sense. Calling the "match entire region" call `matches` may be a mistake though.
type: AnswerComment

http://stackoverflow.com/comment/32807913
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Granting Android application the android.permission.INTERNET permission while debugging on device](http://stackoverflow.com/questions/5279076/granting-android-application-the-android-permission-internet-permission-while-de) or this http://stackoverflow.com/questions/2169294/how-to-add-manifest-permission-to-android-application
comment on: http://stackoverflow.com/q/21699463

http://stackoverflow.com/a/21709419
has comment: http://stackoverflow.com/comment/32825769
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21709219
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32831858
answers question: http://stackoverflow.com/q/21709219
score: 22
type: Answer
has body: The Gson object is explicitly safe to use from multiple threads, as it doesn't keep any internal state, so yes, declare a private static final Gson GSON = new Gson();, or even make it public. Note that if you want your client code to be able to customize the rendering by using GsonBuilder, you should accept a Gson object as a parameter.
has comment: http://stackoverflow.com/comment/32830615
upvote count: 22

http://stackoverflow.com/comment/32839909
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21717050
has text: Store the `values()` in it's own field. This will improve efficiency.
type: AnswerComment

http://stackoverflow.com/comment/32972007
score: 0
type: Comment
type: QuestionComment
has text: It would be very nice of you, if you could show classes that you're using.
comment on: http://stackoverflow.com/q/21791365

http://stackoverflow.com/q/21829916
has comment: http://stackoverflow.com/comment/33041651
tagged with: swing
has title: Exception handling in external jar
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33039780
has body: I’ve written two java desktop applications. One of them(I call it launcher) starts another(client) application. Both applications were compiled under java 1.6.0_32 [oracle jvm, hot spot]. The Exception handler was specified in the main thread of client app. When the launcher is started under java 1.6.0_32 everything is OK, But when it started under 1.7x_xx and later, the exception handler begin work unproperly. It does not catch any exceptions. I have write the test example, the source code was listed The launcher app source: Start.java: import javax.swing.*; import java.io.File; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; public class Start { private ClassLoader classLoader; private List&lt;URL&gt; urls = new ArrayList&lt;URL&gt;(); private LauncherFrame launcherFrame = new LauncherFrame(); private Start() { urls = generateUrls(); } public static void main(String[] args) { new Start().initClassLoader(args); } public void initClassLoader(String[] args) { launcherFrame.initComponents(); this.classLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]), Start.class.getClassLoader()); try { Class&lt;?&gt; mainClass = classLoader.loadClass("my.example.Runner"); Object instance = mainClass.newInstance(); Method runMethod = mainClass.getMethod("run", null); runMethod.invoke(instance); } catch (Exception e) { System.out.println("exception: "); e.printStackTrace(); } } public List&lt;URL&gt; generateUrls() { File jarFile = new File("prog2.jar"); List&lt;URL&gt; urls = new ArrayList&lt;URL&gt;(); if (jarFile.exists()) { try { urls.add(jarFile.toURI().toURL()); } catch (MalformedURLException e) { } } return urls; } class LauncherFrame extends JFrame { public void initComponents() { // if i comment next line, everything works fine in java 6 and 7 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); } } } The clien…
score: 0
tagged with: exception
type: UnansweredQuestion

http://stackoverflow.com/q/21715533
accepted answer: http://stackoverflow.com/a/21715742
tagged with: java
downvote count: 1
type: Question
answer count: 2
upvote count: 0
has body: I am creating a battleship game inside a GUI using Java Swing. For now I am just trying to get this grid working so that a user may drag and drop the battleship from the bottom of the grid onto a spot within the grid above. I would like to save the X &amp; Y integer values inside a DropListener class so that after a button is dropped on the grid I may retrieve the X &amp; Y values and automatically place the rest of the ship buttons (pieces of the ship) accordingly by adding 1,2,and 3 to the X value respectively. You will need to put in pictures for the Battleship, the water, and the red marker for this to work. public class ButtonGrid extends JFrame JFrame frame=new JFrame(); //creates frame JButton[][] grid; //names the grid of buttons ImageIcon waterImage = new ImageIcon( "Water.png" ); ImageIcon redImage = new ImageIcon( "Red.png" ); ImageIcon battleship1 = new ImageIcon( "BattleShip1.png" ); ImageIcon battleship2 = new ImageIcon( "BattleShip2.png" ); ImageIcon battleship3 = new ImageIcon( "BattleShip3.png" ); ImageIcon battleship4 = new ImageIcon( "BattleShip4.png" ); public ButtonGrid(int width, int length) //constructor { frame.setLayout(new GridLayout(width,length)); //set layout grid=new JButton[width][length]; //allocate the size of grid for(int y=0; y&lt;length; y++) { for(int x=0; x&lt;width-1; x++) { grid[x][y]=new JButton( waterImage ); //creates new button grid[x][y].setBackground(Color.BLUE); grid[x][y].setContentAreaFilled(false); grid[x][y].setOpaque(true); grid[x][y].setRolloverIcon( redImage ); grid[x][y].setFocusable(false); grid[x][y].setTransferHandler(new TransferHandler("icon")); new DropListener(grid[x][y], x, y); frame.add(grid[x][y]); //adds button to grid } } //=================================================================BattleShip grid[10][0]=new JButton( battleship1 ); //creates new button grid[10][0].setBackground(Color.YELLOW); grid[10][0].setContentAreaFilled(false); grid[10][0].setOpaque(true); MouseListener listener1 = new Dra…
has answer: http://stackoverflow.com/a/21743455
has title: DropListener that retrieves X & Y from JButton[X][Y] after a Drag and Drop onto JButton[][] Grid
score: -1
possible better answer: http://stackoverflow.com/a/21743455
has answer: http://stackoverflow.com/a/21715742
has comment: http://stackoverflow.com/comment/32837560
favorite count: 0
tagged with: actionevent
tagged with: swing
tagged with: jbutton
type: AnsweredQuestion

http://stackoverflow.com/a/21779703
type: Answer
accepted answer of: http://stackoverflow.com/q/21779290
answers question: http://stackoverflow.com/q/21779290
score: 5
upvote count: 5
has body: Something like this should do it: Display display = new Display(); Shell shell = new Shell(display); private static final String lorem = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ips"; public GridLayoutSample() { shell.setLayout(new GridLayout(1, false)); Composite row = new Composite(shell, SWT.NONE); row.setLayout(new GridLayout(1, false)); row.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createButton(row, lorem, SWT.CHECK | SWT.WRAP); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } public void createButton(final Composite parent, String text, int style) { final GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); layoutData.widthHint = 175; final Button testButton = new Button(parent, style); testButton.setText(text); testButton.setLayoutData(layoutData); parent.getParent().addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event arg0) { layoutData.widthHint = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; parent.pack(); } }); } public static void main(String[] args) { new GridLayoutSample(); } It will resize the Button based on the parent's size. This is what it looks like after starting: And after resizing:
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21721110
favorite count: 0
has answer: http://stackoverflow.com/a/21994288
tagged with: audio
type: UnansweredQuestion
score: 1
tagged with: java
has body: I am a newbie in programming and I want to learn more. I want to record sound from my microphone in real-time. Below is my code for recording. while (true) { int numBytesRead = line.read(data, 0, data.length); out.write(data, 0, numBytesRead); } I tried to enter some codes there and I got to play some chunks of data but after a few seconds, the recording delays for about 3 seconds. Also, when I tried to talk, it plays backs in loop what I tried to say while (true) { int numBytesRead = line.read(data, 0, data.length); out.write(data, 0, numBytesRead); try { byte audio[] = out.toByteArray(); InputStream input = new ByteArrayInputStream(audio); final SourceDataLine line1 = (SourceDataLine) AudioSystem.getLine(info1); final AudioInputStream ais = new AudioInputStream(input, format, audio.length / format.getFrameSize()); int bufferSize = (int) format.getSampleRate() * format.getFrameSize(); line1.open(format); line1.start(); byte buffer[] = new byte[bufferSize]; try { while (true) { numBytesRead = ais.read(buffer, 0, buffer.length); if (numBytesRead == -1) break; line1.write(buffer, 0, numBytesRead); } } catch (IOException e) { System.err.println("I/O problems: " + e); System.exit(-3); } } Could somebody help me with my project.
upvote count: 1
type: Question
has title: How to playback sound simultaneously after recording Java
has answer: http://stackoverflow.com/a/22464658
answer count: 2
tagged with: real-time
downvote count: 0

http://stackoverflow.com/comment/32842483
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21718489
has text: You could do anything you want inside each compute method, I though it could be useful in this case, but anyway I am out of your business context.
score: 0

http://stackoverflow.com/a/21794696
has body: try this... choosenext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter++; if (counter &gt;= allquotes.length || counter &lt; 0) { counter = 0; } display.setText(allquotes[counter]); } }); chooseprevious.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub counter--; if (counter &lt; 0 || counter &gt;= allquotes.length) { counter = 0; } display.setText(allquotes[counter]); } });
upvote count: 1
has comment: http://stackoverflow.com/comment/32977669
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21794614
score: 1

http://stackoverflow.com/q/21824879
has title: Overriding a method with generic Map parameter
answer count: 1
tagged with: generics
has comment: http://stackoverflow.com/comment/33031428
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33031650
has answer: http://stackoverflow.com/a/21824887
tagged with: java
tagged with: overriding
type: Question
has comment: http://stackoverflow.com/comment/33031344
has comment: http://stackoverflow.com/comment/33031587
linked to: http://stackoverflow.com/q/1678122
score: 0
has body: I have following code: class Key{ --Some Implementation } class A{ public void grpMap(ConcurrentMap&lt;Key,List&lt;Key&gt; keyList){ --Some Implementation } } public class B extends A{ --Edited @Override -- [Made "O" capital case after kocko's reply] public void grpMap(ConcurrentMap&lt;Key,List&lt;Key&gt; keyList){ --Some Implementation } } With above code i get following error in class B The method grpMap(ConcurrentMap) of type B must override or implement a supertype method My problem is i can't change the way classes key, B and C are declared as these are legacy classes. Any suggestion on how to get rid of this error? EDIT--- JDK version used is 1.6.43 I am using eclipse which will auto generate annotations.

http://stackoverflow.com/a/21835632
answers question: http://stackoverflow.com/q/21835530
type: Answer
has body: How about something like this? public class GCD { private static int callCount = 0; public static int GCD(int m, int n){ if (n==0) return m; callCount++; return GCD(n,m%n); } public static void main(String[] args) { System.out.println(GCD(10, 15)); System.out.println(callCount); } }
accepted answer of: http://stackoverflow.com/q/21835530
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21783334
possible better answer: http://stackoverflow.com/a/21783433
tagged with: java
has answer: http://stackoverflow.com/a/21783433
has answer: http://stackoverflow.com/a/21783447
answer count: 2
tagged with: sqlite
has body: I have three java files, the Main activity calls an AsyncTask by: AsyncTaskRunner backgroundTask = new AsyncTaskRunner(); backgroundTask.execute(); This executes the task (http connect to pho files and returns JSON file). On the PostExcecute im trying to write the result to the SQLlite DB on the android device by running: class AsyncTaskRunner extends AsyncTask&lt;Void, Void, String&gt; { protected void onPostExecute(String result) { // super.onPostExecute(result); DatabaseHandler db = new DatabaseHandler(this); try{ JSONArray arr = new JSONArray(result); db.dropAll(); for (int i=0; i&lt;arr.length(); i++){ JSONObject jObj = arr.getJSONObject(i); db.addEvent(new Event(jObj.getString("course"), jObj.getString("date"), jObj.getString("time"), jObj.getString("event"))); } } catch (JSONException e) {e.printStackTrace();} } The problem arises here = new DatabaseHandler(this), as I need to pass the Context to the DatabaseHandler. Here is the start of the DatabaseHandler: public DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } DatabaseHandler db = new DatabaseHandler(this) works fine when called from the MainActivity.
tagged with: android-context
score: 0
accepted answer: http://stackoverflow.com/a/21783447
tagged with: android
type: AnsweredQuestion
has title: How to pass Context from AyncTask to DatabaseHandler
type: Question

http://stackoverflow.com/a/21834858
type: Answer
has comment: http://stackoverflow.com/comment/33089908
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21834661
score: 0
has comment: http://stackoverflow.com/comment/33070076
has comment: http://stackoverflow.com/comment/33050616
has body: You usually use stateless beans in Spring MVC, so concurrency shouldn't be an issue. See here: spring mvc declaring all beans singleton

http://stackoverflow.com/comment/32869550
type: Comment
comment on: http://stackoverflow.com/a/21733878
type: AnswerComment
score: 0
has text: I think you misunderstood Elenasys, the url exists but doesn't do anything when you go to it because its php and dies if you haven't passed in values it needs. Thus the empty page. I was telling Tyler that because all he did was quote the log cat which is neither helpful or explained. It is as i fear he is... worthless.

http://stackoverflow.com/a/21728088
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32862100
type: Answer
has body: To explain with a (perhaps somewhat flawed) metaphor - think of a LinkedList as a piece of paper. Think of the assignment to a Queue as covering all but a little part of this piece of paper which reveals that it's a Queue. If you call a Queue method on it, it will still do things like a LinkedList normally would, since that that's what the piece of paper is. Given that most of it is covered, you can't see it's a LinkedList, all you can see is that it's a Queue, so you can only call the Queue methods on it. The whole piece of paper is still there - you could simply remove the covering, which would be synonymous to casting it back to a LinkedList, which would then allow you to call any LinkedList method on it again. Now for a bit more technical details: By the way a LinkedList "normally would" do things I mentioned above, I mean a LinkedList is always a linked-list, even if you assign it to a Queue - it doesn't suddenly start using an array as the underlying implementation, as an ArrayDeque would (which also implements Queue), or something else. Queue doesn't actually need to be FIFO (see the docs) (if it needed to be, a LinkedList would also need to be), so LinkedList would have quite a bit of freedom in this regard, so let's continue this explanation using Deque - it has methods to support addition and removal from either the front or the back. Because LinkedList implements Deque, it needs to implement the addFirst function. Based on the docs, the addFirst function needs to add to the front of the Deque, and indeed, with a LinkedList, it will add to the front of the LinkedList (while the front of the LinkedList doesn't need to be the front of the Deque, by looking at the Deque methods implemented in LinkedList, we see that the front of the Deque is the front of the LinkedList, and all the methods add to / remove from one of the sides, do so from the correct side). Now for an important albeit somewhat confusing note - LinkedList can, for example, implement Deque and …
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/21727873
has comment: http://stackoverflow.com/comment/32859109
answers question: http://stackoverflow.com/q/21727873

http://stackoverflow.com/comment/33024241
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21820626
has text: I give up, I'm just going to do it this way. Thank you for the help!!
type: AnswerComment

http://stackoverflow.com/comment/91318599
type: Comment
has text: This really helped me to understand the semantics an implications of "removeAbandoned". From my observations, I suspect that the abandonedTimeout is cumulated over multiple leases of the same connection.
comment on: http://stackoverflow.com/a/24295070
score: 0
type: AnswerComment

android-wheel
tags question: http://stackoverflow.com/q/21807286
tag name: android-wheel
type: Tag

http://stackoverflow.com/comment/32976880
has text: just that? @InnocentKiller but in which class?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21794192
score: 0

http://stackoverflow.com/comment/40544246
type: Comment
comment on: http://stackoverflow.com/a/21685952
type: AnswerComment
has text: @AlexWien Ever since I saw your comment on multiple returns in a method, I stopped doing them. But I'm wondering, why is it a bad programming practice? When I googled it, I got this: http://programmers.stackexchange.com/a/118717
score: 0

http://stackoverflow.com/q/21704449
accepted answer: http://stackoverflow.com/a/21704588
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32816868
tagged with: maven
possible better answer: http://stackoverflow.com/a/21722573
tagged with: spring
has answer: http://stackoverflow.com/a/21723057
has answer: http://stackoverflow.com/a/21722573
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: hibernate
type: Question
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/32816538
has answer: http://stackoverflow.com/a/21704588
favorite count: 0
has body: I am having a problem with spring , I am a newbie using this framework with Hibernate , JPA and Maven , I am following a tutorial on pluralsight but when launching the app in the server I have this error message. Grave: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [jpaContext.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [jpaContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.postgresql.driver] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.…
has title: Error creating bean with name 'entityManagerFactory' defined in class path resource [jpaContext.xml]
answer count: 3

http://stackoverflow.com/comment/32868462
score: 0
type: Comment
type: QuestionComment
has text: Maybe its a hardware issue? Have you tried that for CPU or discrete gpu?
comment on: http://stackoverflow.com/q/21733031

http://stackoverflow.com/q/21805670
has title: What happens by calling HttpURLConnection.getInputStream() more than twice
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32998073
has body: Does the HttpURLConnection.getInputStream() method fetch the contents with connecting to the server each time, or save the contents in the memory first time and give it back again from the second time? I'm building a function that takes in an HttpURLConnection instance and judges if the contents satisfy some criteria to be processed by another function later. Thank you!
accepted answer: http://stackoverflow.com/a/21805711
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/32997211
tagged with: java
upvote count: 1
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/21805711

http://stackoverflow.com/comment/33010623
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21806929
has text: Oh ok. By the way it wasn't cut and pasted. just felt logical(Obviously wasn't xD). Last time I touched Java was a couple of years ago this will explain my issues. Thanks.

http://stackoverflow.com/comment/32875803
comment on: http://stackoverflow.com/q/21731138
has text: Regarding your second comment, they are placed exactly in the way you mentioned, however, it seems that currently, they do not meet the word alignment requirement that the documentation has specified. I just find the wording of the quoted paragraph a little bit confusing, that's why I'm asking about it here again...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21800032
has answer: http://stackoverflow.com/a/21800143
type: Question
has answer: http://stackoverflow.com/a/21800098
has comment: http://stackoverflow.com/comment/32986943
accepted answer: http://stackoverflow.com/a/21800167
answer count: 6
has title: Calculate divisors of a number in Java
has answer: http://stackoverflow.com/a/59035440
possible better answer: http://stackoverflow.com/a/21800098
score: 0
has answer: http://stackoverflow.com/a/21800125
has body: I´m looking for help for my code. I want to know all the divisors of a number using recursion in Java, but my program only calculates 1 or 2 divisors, not all of them. Here is my code: import java.io.*; public class Ejercicio { static void Divisor(int num, int presuntoDivisor){ if (num%presuntoDivisor == 0) { System.out.println("un divisor es "+ presuntoDivisor); presuntoDivisor++; Divisor(num, presuntoDivisor); } } public static void main(String[] args) throws NumberFormatException, IOException { int num, presunto=1; BufferedReader linea = new BufferedReader(new InputStreamReader(System.in)); System.out.print("introduce un numero: "); num = Integer.parseInt(linea.readLine()); Divisor(num, presunto); } }
has comment: http://stackoverflow.com/comment/32986953
tagged with: recursion
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21800162
tagged with: java
has answer: http://stackoverflow.com/a/21800167

http://stackoverflow.com/a/21788872
has comment: http://stackoverflow.com/comment/32967991
score: 2
has comment: http://stackoverflow.com/comment/32970545
downvote count: 0
has comment: http://stackoverflow.com/comment/32968884
has body: You need a 64-bit version of Java to match the 64-bit version of your shared library.
answers question: http://stackoverflow.com/q/21788821
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/32968981

http://stackoverflow.com/a/21737816
score: 3
type: Answer
upvote count: 3
has body: I would go with @HovercraftFullOfEels' comment. To expand a bit: Replace your Set with a HashMap. Use the ID of the object as the key, and the object itself as the value. Then whenever you need to remove an object, it's a simple matter of map.remove(id); Generally speaking, any time you need random access to any form of Collection you're probably better off using some variation of Map instead (HashMap being the most common)
accepted answer of: http://stackoverflow.com/q/21737726
answers question: http://stackoverflow.com/q/21737726
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33557124
type: Comment
has text: The implementation itself is not currently supporting the write(int) method in NativeGCMCipherOutputStream. You need to either implement that method, or alternatively write all of your objects to a memory buffer of bytes and then write to the encrypted output stream.
type: AnswerComment
comment on: http://stackoverflow.com/a/21692093
score: 0

http://stackoverflow.com/comment/33039474
score: 0
type: AnswerComment
type: Comment
has text: Can you explain me how `StandardWatchEventKinds.ENTRY_CREATE` relate with holding a file which is going to be created there in my code?I have not used any FileWriter or reader here
comment on: http://stackoverflow.com/a/21828551

jena
tags question: http://stackoverflow.com/q/21782861
tag name: jena
tags question: http://stackoverflow.com/q/21723533
tags question: http://stackoverflow.com/q/21778770
type: Tag

http://stackoverflow.com/comment/33036605
has text: Mude seu código para este formato : Change your code to this format
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21828194
type: AnswerComment

http://stackoverflow.com/comment/32893945
comment on: http://stackoverflow.com/a/21747695
score: 0
type: AnswerComment
type: Comment
has text: That's the problem. You don't have the answer. A HashSet or LinkedHashSet is O(1). A TreeSet is O(log n) and is used to have sorted entries in the set, which is not what the suer asked for. You just picked the less efficient data structure for no good reason.

http://stackoverflow.com/comment/32851024
has text: everything works fine just want to do control on continuous click and want to control over exception
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21723557
score: 0

http://stackoverflow.com/a/22037147
upvote count: 1
has body: Declare your filter to implement ISymmetricEngineAware, declare a field engine and a method @Override public void setSymmetricEngine(ISymmetricEngine engine) { this.engine = engine; } Then use the field engine to fetch the sql template: ISqlTemplate sqlTemplate = engine.getSymmetricDialect(). getPlatform().getSqlTemplate(); Use ISqlTemplate sqlTemplate = AbstractSymmetricEngine. findEngineByName("my.symmetric.ds.engine"). getSymmetricDialect().getPlatform().getSqlTemplate(); to query the database using one of the templates from NodeService.
answers question: http://stackoverflow.com/q/21797480
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33421278
score: 1

http://stackoverflow.com/comment/32908189
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21755226
has text: Do you have the control on the code that changes the states programmatically or not? If you have, who prevents to set the flag to true at the start of modification and back to false after you are done? If (then I misunderstand) the user clicks on the checkbox and you do not want to have the on change listener fired - what is the purpose of such event listener, then?
type: AnswerComment

http://stackoverflow.com/q/21808532
favorite count: 0
accepted answer: http://stackoverflow.com/a/21808723
has comment: http://stackoverflow.com/comment/33002289
score: -2
has comment: http://stackoverflow.com/comment/33002338
type: AnsweredQuestion
tagged with: java
downvote count: 2
has body: I am extracting specific data about a place.That is if I select a location and choose a particular date it should display all events,exhibitions etc of that particular place. So for that I have to make an user interface. How can I make user interface in eclipse Juno using Java.
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/21808723
has comment: http://stackoverflow.com/comment/33002795
has title: Adding user interface using java in eclipse
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/33002327
answer count: 1

http://stackoverflow.com/comment/32807809
score: 0
comment on: http://stackoverflow.com/a/21697725
type: Comment
has text: I see. My problem also seems to be that I have one method and no return types.
type: AnswerComment

http://stackoverflow.com/q/21697696
type: AnsweredQuestion
has body: Does any one know a very simple method to do that. Ex: List&lt;String[]&gt; myList=new ArrayList&lt;String[]&gt;(); myList.add(s1); myList.add(s2); List&lt;String[]&gt; newList=new ArrayList&lt;String[]&gt;(); newList.add(n1); newList.add(n2); myList.addAll(newList); will print out: s1 s2 n1 n2 Can we make a method like addAllToTop so that myList.addAllToTop(newList); will print out: n1 n2 s1 s2
score: 1
favorite count: 0
type: Question
answer count: 2
upvote count: 1
has title: How to myList.addAll(newList) will put new items of newList to top & push the existing items of myList to the bottom?
tagged with: java
has answer: http://stackoverflow.com/a/21697775
possible better answer: http://stackoverflow.com/a/21697733
has answer: http://stackoverflow.com/a/21697733
accepted answer: http://stackoverflow.com/a/21697775
downvote count: 0

http://stackoverflow.com/a/21814429
has body: In your subarray, particularly the first one, you only have 19 items in it. Because of the fact that array indices are zero-based, meaning they start at zero, your available indices for k are 0 - 18. When you attempted to use 19, you got an ArrayIndexOutOfBoundsException, which basically means that you were attempting to access an invalid index. If you change the following line: for(int k = 0; k &lt; 20; k++) { to this: for(int k = 0; k &lt; grid[i].length; k++) { it should solve your problem. The reason you should use grid[i].length instead of just a hardcoded number such as 19 is because that if you change the grid array, your code will adapt for you, and won't just ignore any entries after index 19. Whant the code, grid[i].length does, is gets the current subarray, and retrieves it's length. This means that even if the subarrays are different lengths, the for loop won't break. (Though why you would want subarrays with different sizes for this purpose is beyond me.) Hope this helped.
score: 0
answers question: http://stackoverflow.com/q/21814389
type: Answer

http://stackoverflow.com/q/21702251
has comment: http://stackoverflow.com/comment/32831134
has answer: http://stackoverflow.com/a/21702564
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21702461
upvote count: 1
has comment: http://stackoverflow.com/comment/32832770
downvote count: 1
has title: Java Connect 4 Algorithm Checking for a win
tagged with: algorithm
score: 0
tagged with: java
has body: I am trying to check for a win in a connect 4 game, I managed to check diagonall right, But I need help with checking diagonally left, vertically and horizontally, Its a matter of changing the algorithm I have already created and tweaking it. How do you check vertically, horizontally and diagonally left? public class Game { private static final int COLS = 7; private static final int ROWS = 6; public State[][] count = new State[COLS][ROWS]; boolean player1Turn = true; public static final int LEN = 4; protected Context context; public enum State { RED, YELLOW, BLANK; } public State checkWinner() { for (int col = 0; col &lt; count.length; ++col) { for (int row = 0; row &lt; count[col].length; ++row) { State result = checkWinner(col, row); if (result != null) { return result; } } } return null; } //This method is called in a another class public State checkWinner(int col, int row) { State cell = count[col][row]; if (cell == null || cell == State.BLANK) { return null; } // Here I am checking for a win Diagonally Right // The next step is to check vertically and horizontelly and Diagnollly left // There needs to be a pattern of four reds or yellow counters either horizontelly or vertically // My guess to check horizentally or vertically and diagonally left would be to copy this algorithm and possibly change the coordinates // Checking four up for horizontal and four across for vertical, four for diagnoally left if ((col + LEN &lt;= COLS) &amp;&amp; (row + LEN &lt;= ROWS)) { boolean same = true; for (int i = 1; i &lt; LEN; ++i) { if (count[col + i][row + i] != cell) { same = false; break; } } if (same) { return cell; } } // TODO Auto-generated method stub return null; } }
has comment: http://stackoverflow.com/comment/32820245
linked to: http://stackoverflow.com/q/7033165
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32825301
favorite count: 0
has comment: http://stackoverflow.com/comment/32812589
has comment: http://stackoverflow.com/comment/32812838

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/21792491
type: Tag

http://stackoverflow.com/comment/32846456
score: 0
has text: Do you have a `doPost` method in your Servlet? Your JSP code should be making a POST request because of `conn.setDoOutput(true);`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21720952

http://stackoverflow.com/comment/33045723
type: Comment
comment on: http://stackoverflow.com/q/21832567
has text: No, standard... Nice tip! I'll give it a try, I'm struggling with this for far too long
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32932319
type: AnswerComment
comment on: http://stackoverflow.com/a/21751689
type: Comment
has text: Thanks for the code! But I solved my problem. I was supposed to use low instead of mid for my bSearch.
score: 0

http://stackoverflow.com/a/21712377
has body: My guess: you have program logic present in your paint(...) or paintComponent(...) method override. If so, get the logic out of these methods, because as you're finding out, you do not have full control over when or even if they are called. The logic belongs elsewhere, perhaps in a Swing Timer, hard to say without code or a more detailed question. If this doesn't help, then you'll need to show us the bugs in your code by creating and posting a minimal, runnable, example program as well as tell us more of the details of your program and its misbehavior. After looking at your code, I see that my assumption/guess was correct: you are selecting your random numbers inside of the paint method, and so they will change with each repaint. You will want to Create a class that extends JPanel. Create your random numbers in this class's constructor, and use the random numbers to set class instance fields. Override this class's paintComponent method Don't forget to call the super's paintComponent method inside this method. Use the numbers generated in the constructor in the paintComponent method override to draw your rectangle. Place your JPanel into a JFrame. e.g., import java.awt.Color; import java.awt.Graphics; import java.util.Random; import javax.swing.*; @SuppressWarnings("serial") public class RandomRect extends JPanel { private static final int MAX_INT = 100; private static final Color RECT_COLOR = Color.black; private Random random = new Random(); private int randomX; private int randomY; public RandomRect() { randomX = random.nextInt(MAX_INT); randomY = random.nextInt(MAX_INT); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(RECT_COLOR); g.fillRect(randomX, randomY, MAX_INT, MAX_INT); } private static void createAndShowGui() { JFrame frame = new JFrame("RandomRect"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new RandomRect()); //frame.pack(); // frame.setLocationRelativeTo(null); frame.se…
score: 2
has comment: http://stackoverflow.com/comment/32831543
has comment: http://stackoverflow.com/comment/32831491
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21712310
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21712310

http://stackoverflow.com/q/21838408
has comment: http://stackoverflow.com/comment/33138233
type: Question
tagged with: shibboleth
tagged with: java
tagged with: opensaml
has comment: http://stackoverflow.com/comment/33170808
has comment: http://stackoverflow.com/comment/33077519
has comment: http://stackoverflow.com/comment/33131998
score: 0
has body: I am trying to write a service provider in java. I am using Shibboleth IdP. I am able to send request to the IdP and when I am trying to read the response I am getting the error : java.lang.IndexOutOfBoundsException: Index: 0 at java.util.Collections$EmptyList.get(Unknown Source) at org.opensaml.xml.util.LazyList.get(LazyList.java:93) just before: Assertion assertion = response.getAssertions().get(0); Map resutls = new HashMap(); Any suggestion or pointer will be helpful.
has comment: http://stackoverflow.com/comment/33119939
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33173571
has comment: http://stackoverflow.com/comment/33076731
answer count: 0
has title: Error while reading SAML Response from Shibboleth IdP in java
type: UnansweredQuestion

http://stackoverflow.com/a/21755633
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21755470
has body: You're quite right that ultimately everything is run from a static main() method. And many functions are suitable for being made static, e.g. simple methods like those on java.lang.Math. Speed and memory-use are non-issues - a static method does not take up any more memory or run slower than any other method. Internally, it's exactly the same as any other method but is defined and runs on a class-instance instead of an instance of the class. A problem I've found with static methods is that it's easy inadvertently to slip in some specific assumptions (e.g. where a directory is) which makes it harder to reuse the function elsewhere. It also can become much harder to test the code. When you're unit testing, you usually want to be able to test without doing *time-consuming) I/O - e.g. by mocking or stubbing out the I/O parts. If your method doesn't allow that, it's much harder. Singleton classes can cause similar testing difficulties. Static methods tend to lead to functional or procedural, rather than object-oriented code. I find static methods useful as a functional layer of "syntactic sugar" above a rich domain model of objects. It's also worth mentioning that there are loads of existing utilities classes around, such as Apache Commons IO, Google Guava etc. They are well-written, heavily used and well-tested. You might consider looking at them before reinventing the wheel.
answers question: http://stackoverflow.com/q/21755470
type: Answer
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/32960100
comment on: http://stackoverflow.com/q/21777139
score: 0
has text: No, we do not need any such tag. Please refrain from creating [blatant meta tags](http://blog.stackoverflow.com/2010/08/the-death-of-meta-tags/).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21802139
has body: This is not Saxon-specific but rather a fundamental part of how namespaces work. In your examples 1 and 2 the RESPONSE element is not in a namespace but in case 3 it (and all its descendants) are in the http://www.abc.com/ namespace. With the javax.xml.xpath API you need to define a NamespaceContext if you want to be able to match nodes in a specific namespace, or since you're in XPath 2.0 you can use the *:localName notation to match all nodes with a given local name regardless of their namespace. /*:RESPONSE/*:HEADER/*:HITS
has comment: http://stackoverflow.com/comment/33025095
accepted answer of: http://stackoverflow.com/q/21801754
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32992876
has comment: http://stackoverflow.com/comment/33029425
has comment: http://stackoverflow.com/comment/32990965
type: Answer
answers question: http://stackoverflow.com/q/21801754
score: 7
upvote count: 7

http://stackoverflow.com/comment/32852303
type: AnswerComment
comment on: http://stackoverflow.com/a/21723585
type: Comment
has text: So the problem is that it is trying to find your test LinearLayout in the main.xml file. You need to make sure that call is done on the inflated listview.xml file
score: 0

http://stackoverflow.com/comment/32805274
type: QuestionComment
has text: You've declared the method to return a `List`; change it to return `int` or `char` or whatever.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21698020

http://stackoverflow.com/q/21795261
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/19915535
downvote count: 0
answer count: 1
favorite count: 0
has body: I am trying really hard to draw a sprite with LibGDX, but I fail. If you need more than the snippets, the source is here: https://github.com/reisi007/Planes2DLibGDX/blob/master/Main/src/com/reisisoft/Planes2D/Planes2D.java So, what am I doing? I am loading a PNG (1024x1024) and creating sprites, which I put in a Map. This map I put in a map again (later different resolutions) private void putTextures(Resolutions resolutions) { Map&lt;GObjects, Sprite&gt; map; switch (resolutions) { case MidRes: map = new EnumMap&lt;GObjects, Sprite&gt;(GObjects.class); map.put(GObjects.PlaneR, new Sprite(txtMidRes, 0, 0, 600, 278)); map.put(GObjects.PlaneG, new Sprite(txtMidRes, 0, 278, 600, 278)); map.put(GObjects.PlaneB, new Sprite(txtMidRes, 0, 556, 600, 104)); map.put(GObjects.Grass, new Sprite(txtMidRes, 0, 834, 600, 104)); map.put(GObjects.Bullet, new Sprite(txtMidRes, 600, 834, 299, 138)); all.put(Resolutions.MidRes, map); break; } } There is a function I get a sprite from the current resolutions: private boolean setCurrentResolutions(Resolutions resolution) { if (resolution == null) return false; currentResolution = resolution; currentResolutionSprites = all.get(Resolutions.MidRes); return true; } private Sprite requestSprite(GObjects gObject) { return currentResolutionSprites.get(gObject); } I am testing the Winows build, whichs size is 800x480. The origin of the sprite I want to draw is: X 300.0 Y 139.0 The width is 300, height is 140. Next the render function: public void render() { camera.update(); spriteBatch.setProjectionMatrix(camera.combined); Update(); spriteBatch.begin(); Draw(); spriteBatch.end(); } As this is not really helping, here the Draw method: public void Draw() { s.draw(spriteBatch); } What I see is just black. I tried with OpenGL 1,1.1,2 and various solution from StackOverflow Finally the "create" method: // On creation public void create() { curH = Gdx.graphics.getHeight(); curW = Gdx.graphics.getWidth(); camera = new OrthographicCamera(curW, curH); spr…
has answer: http://stackoverflow.com/a/21796168
accepted answer: http://stackoverflow.com/a/21796168
upvote count: 1
type: Question
type: AnsweredQuestion
has title: Libgdx fail to draw sprite
tagged with: libgdx

http://stackoverflow.com/q/21805043
type: Question
has answer: http://stackoverflow.com/a/21805120
tagged with: java
answer count: 3
has title: My Java program is outputting the wrong answer when finding tax for a salary
favorite count: 0
has answer: http://stackoverflow.com/a/21805087
has body: There is no tax on the first 20% of salary entered. i.e for 20000..it would tax for 16000 with 10% on 15000 and 20% on the remaining 1000 which would be 1700 total tax. My program incorrectly outputs 14500.... import java.util.*; public class taxable { public static void main (String[] args) { Scanner in=new Scanner(System.in); System.out.println("Enter your salary:"); double salary=in.nextDouble(); double taxDue=0; double tempTaxDue=0; if (salary &lt; 15000) { System.out.println("No tax applicable"); }else if (salary &gt;=15000 &amp;&amp; salary &lt;20000) { taxDue=(15000*0.1); }else if (salary &gt;=20000 &amp;&amp; salary &lt;=35000) { tempTaxDue=(salary*0.8); taxDue=15000*0.1+tempTaxDue-15000*0.2; }else if (salary &gt; 35000) { tempTaxDue=salary*0.8; taxDue=(15000*0.1)+(20000*0.2)+(tempTaxDue-35000*0.35); taxDue=(salary*0.8)+(20000*0.2)+(salary-35000*0.35); } System.out.printf("The amount of tax due is: " + taxDue + " "); double avTaxRate; avTaxRate=taxDue/salary*100; System.out.printf("The average tax rate: " + avTaxRate + "%%"); } }
downvote count: 4
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21805080
score: -4

http://stackoverflow.com/comment/32924064
type: Comment
has text: (It would be clearer if you used a standard `for` loop instead of the `while`.)
type: QuestionComment
comment on: http://stackoverflow.com/q/21764624
score: 0

http://stackoverflow.com/comment/33027596
type: AnswerComment
comment on: http://stackoverflow.com/a/21822764
score: 0
type: Comment
has text: Wow i looking for lower case letter but in the wrong place, thank you so much!

http://stackoverflow.com/comment/32985737
type: Comment
comment on: http://stackoverflow.com/a/21799417
score: 0
type: AnswerComment
has text: Do I need to import any classes for `ArrayList`?

http://stackoverflow.com/a/21703449
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32814600
type: Answer
has comment: http://stackoverflow.com/comment/32859575
has comment: http://stackoverflow.com/comment/32859295
upvote count: 2
answers question: http://stackoverflow.com/q/21702573
has body: You're getting NumberFormatException because nothing can't be converted to a number, when you clear the text from field so you need to check if the field is empty. if (!text.isEmpty()) { int p = Integer.parseInt(text); int i = (p * 5); String s = String.valueOf(i); field1.setText(s); } else { field1.setText(null); } Also as I noted in the comments, with links, just use a DocumentFilter allow only numbers. Here is a refactor of your code. It works without the NumberFormatException. I added the DocumentFilter import java.awt.GridLayout; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.AbstractDocument; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.DocumentFilter; import javax.swing.text.DocumentFilter.FilterBypass; public class TestLabelMirror { private JPanel mainPanel = new JPanel(); private JTextField field = new JTextField(20); private JTextField field1 = new JTextField(20); private JFrame frame; public TestLabelMirror() { field.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { updateLabel(e); } @Override public void insertUpdate(DocumentEvent e) { updateLabel(e); } @Override public void removeUpdate(DocumentEvent e) { updateLabel(e); } private void updateLabel(DocumentEvent e) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { String text = field.getText(); String text1 = field1.getText(); if (!text.isEmpty()) { int p = Integer.parseInt(text); int i = (p * 5); String s = String.valueOf(i); field1.setText(s); } else { field1.setText(null); } } }); } }); ((AbstractDocument) field.getDocument()).setDocumentFilter(new DocumentFilter() { @Override public void insertString(FilterBypass fb, int off, String str, AttributeSet attr) throws BadLocationException { fb.insertString(off, str.replaceAll("\\D++", ""), attr); // remove non-digits } @Override …
accepted answer of: http://stackoverflow.com/q/21702573
score: 2

http://stackoverflow.com/a/21818006
has comment: http://stackoverflow.com/comment/33019590
has comment: http://stackoverflow.com/comment/33021722
has comment: http://stackoverflow.com/comment/33020839
has comment: http://stackoverflow.com/comment/33021618
has comment: http://stackoverflow.com/comment/33019804
score: 1
answers question: http://stackoverflow.com/q/21817925
has comment: http://stackoverflow.com/comment/33020693
has body: Give TestPane setGridX(int x) and setGridY(int y) methods. Give any class that needs to call these methods a reference to the displayed TestPane instance. Call the methods when an event that triggers a change occurs. Then call repaint() on the TestPane instance. Edit New code that actually demonstrates my recommendations: import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.swing.*; public class Grid { private static final int TIMER_DELAY = 200; private int current_x; private int current_y; private TestPane testPane = new TestPane(); private Random random = new Random(); public Grid() { 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.add(testPane); // !! frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); new Timer(TIMER_DELAY, new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { current_x = random.nextInt(TestPane.MAX_X); current_y = random.nextInt(TestPane.MAX_Y); testPane.setGridX(current_x); testPane.setGridY(current_y); testPane.repaint(); } }).start(); } public void getCurrentValues(int x, int y) { this.current_x = x; this.current_y = y; } public static void main(String[] args) { new Grid(); } } class TestPane extends JPanel { public static final int MAX_X = 8; public static final int MAX_Y = MAX_X; private static final int CELL_WIDTH = 50; private static final int PREF_W = CELL_WIDTH * MAX_X; private static final int PREF_H = CELL_WIDTH * MAX_Y; private static final Color FILL_COLOR = Color.yellow; private static final Color GRID_COLOR = Color.black…
accepted answer of: http://stackoverflow.com/q/21817925
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33019879
has comment: http://stackoverflow.com/comment/33019689
has comment: http://stackoverflow.com/comment/33021191
has comment: http://stackoverflow.com/comment/33021572
has comment: http://stackoverflow.com/comment/33019300
type: Answer
has comment: http://stackoverflow.com/comment/33020034
has comment: http://stackoverflow.com/comment/33020794
has comment: http://stackoverflow.com/comment/33020561
upvote count: 1

http://stackoverflow.com/a/21773276
has body: The max value of int is 2,147,483,647 use long if you need higher values
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21773224
score: 1
upvote count: 1

http://stackoverflow.com/comment/45277130
type: AnswerComment
has text: What you used to achieve it? to read all the messages from topic.
type: Comment
comment on: http://stackoverflow.com/a/21842197
score: 0

http://stackoverflow.com/a/21795068
has body: It was dependency, I was missing.So I added following dependency - org.springframework spring-context-support 4.0.1.RELEASE
upvote count: 19
accepted answer of: http://stackoverflow.com/q/21711462
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21711462
score: 19
type: Answer

http://stackoverflow.com/comment/32958840
score: 0
type: AnswerComment
has text: @ClickUpvote, Updated code, see if that satisfies your needs.
type: Comment
comment on: http://stackoverflow.com/a/21783191

http://stackoverflow.com/comment/32885531
has text: Instead try for(i=0; i<LEN; i++)... count[col-i][row-i] for the diagonal left and down. Use count[col-i][row
score: 0
comment on: http://stackoverflow.com/a/21734440
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32973026
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21791892
has text: Are your methods in the "test" group?

http://stackoverflow.com/comment/65639664
has text: What is the configuration to do a URL rewrite in web.xml or somewhere else. I have angularjs in a sub-directory and when doing a request the application breaks with 404 error. I want to use html5 mode and am not able to due to configuration of URL rewrite not being there. Any help?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/32532075
type: Comment

http://stackoverflow.com/comment/32957075
score: 0
type: AnswerComment
has text: This solution is better. I'm sorry to move my accepted answer from the previous one to yours, but I have to do it for the sake of clarity.
type: Comment
comment on: http://stackoverflow.com/a/21782768

http://stackoverflow.com/a/21757164
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21756796
has body: You need to set your EditText to respond to focus change event, and hide keyboard manually, public class Activity1 extends Activity implements OnFocusChangeListener { protected void onCreate( Bundle b ) { ..... txtX = (EditText) findViewById(R.id.text_x); txtX.setOnFocusChangeListener(this); } public void hideKeyboard(View view) { InputMethodManager inputMethodManager =(InputMethodManager)context.getSystemService(Activity.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); } @Override public void onFocusChange(View view, boolean arg1) { if(! view.hasFocus()) hideKeyboard(view); } } and in xml set your layout to focusable &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true" android:focusableInTouchMode="true" &gt; &lt;EditText android:id="@+id/text_x" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt;

http://stackoverflow.com/a/21837646
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33426114
downvote count: 0
type: Answer
has body: One of the most simple solutions will be adding a JMX controlled bean offering start and stop of the web service. This bean can implement the control in two types: Setting a flag on the injected service. The service may throw an exception on deactivated state but needs to be extended to this special behavior. The web service may be created by a special sub context to be loaded by the activation or stopped by deactivation. The context may be created with ClassPathXmlApplicationContext using the current context as a parent context.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21836548
accepted answer of: http://stackoverflow.com/q/21836548

http://stackoverflow.com/comment/32895499
type: QuestionComment
has text: Without code its difficult to tell a solution. Please post the validation what you have done.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21747533

http://stackoverflow.com/comment/32775224
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21681152
score: 1
has text: use `position` instead of `listView.getSelectedItem()`

http://stackoverflow.com/comment/33018154
type: Comment
comment on: http://stackoverflow.com/a/21816915
type: AnswerComment
has text: @ChristianKuetbach you are right. I don't exactly know what the intentional idea was, but i thought the question was meant like "why can't I use the writeSensor method here?".
score: 0

http://stackoverflow.com/comment/32784257
type: QuestionComment
comment on: http://stackoverflow.com/q/21686149
has text: I want to have a java program login to a cisco router so I can query the router for statuses of interfaces.
score: 1
type: Comment

http://stackoverflow.com/comment/32902700
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21752901
has text: +1 or don't use threads and just use a loop. You should only use multiple threads when it is simpler/better than using just one thread.
type: AnswerComment

http://stackoverflow.com/a/21720048
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Such kind of issues should provide all related info: OS, Java, Eclipse version, list of plugins installed. Example of file saved. CPU, RAM size, memory setting for Eclipse. Without knowing those details some recommendation would be to analyze and try to find the cause by comparing: try on other PC, with other Java version other Eclipse version the same Eclipse version without any additional plugins. increase Eclipse memory settings Check if it is build related by disabling automatic build. Check if there are "Save Action" configured in Preferences. and so on. maybe some plugin causes that, but usually people just go with new Eclipse instance instead of comparing different plugins combinations. See also How can you speed up Eclipse?
answers question: http://stackoverflow.com/q/21716400

http://stackoverflow.com/comment/33059474
comment on: http://stackoverflow.com/q/21829081
has text: This question may help you. http://stackoverflow.com/questions/3130913/setting-jax-ws-client-timeout
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21707324
accepted answer of: http://stackoverflow.com/q/21705432
type: AcceptedAnswer
downvote count: 0
score: 1
has body: There is a flash attribute that can be added prior to the redirect: 1) add RedirectAttributes redirectAttrs to method signature 2) call redirectAttrs.addFlashAttribute() to add your message prior to redirecting See example in spring docs here, there is also an example in PetClinic app
type: Answer
has comment: http://stackoverflow.com/comment/32824796
upvote count: 1
answers question: http://stackoverflow.com/q/21705432

http://stackoverflow.com/a/21695791
has comment: http://stackoverflow.com/comment/32801561
type: Answer
answers question: http://stackoverflow.com/q/21695670
has body: \b- matches the empty string at the beginning or end of a word. The metacharacter \b is an anchor like the caret and the dollar sign. It matches at a position that is called a "word boundary". This match is zero-length. \B is opposite of \b \B matches the empty string not at the beginning or end of a word.
score: 0

http://stackoverflow.com/comment/32824761
comment on: http://stackoverflow.com/a/21708590
score: 0
has text: So you _don't_ want it aligned in the top-left?
type: Comment
type: AnswerComment

http://stackoverflow.com/a/21818653
has body: My first idea was: char[] orig = // something; char[] copy = orig.clone(); But be aware: clone() only creates a shallow copy of an array. That means for a 2D-Array with chars you have to clone each subarray. For further information about clone() click here. Your code should look something like this char[][] original = new char[3][3]; char[][] copy = new char[orignal.length][0]; for(int i = 0; i &lt; original.length; i++){ copy[i] = original[i].clone(); }
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21818618
answers question: http://stackoverflow.com/q/21818618
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/32988014
has text: It's much easier to read the logcat if you edit your post with the **full** logcat and format in a code block.
comment on: http://stackoverflow.com/q/21800495
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32896161
type: QuestionComment
has text: As Sotirios mentioned, learning debugger for this kind of tasks is very helpful. Simply put breakpoint at the beginning of your method and check step by step what's happening with a result.
comment on: http://stackoverflow.com/q/21748970
score: 0
type: Comment

http://stackoverflow.com/comment/32908279
comment on: http://stackoverflow.com/a/21733554
has text: Adding something to every copied page is explained in my answer: use `PageStamp`. Adding a new page in the middle after any page: please explain what you mean, because the question isn't clear. Create a new question for this. Comments aren't the place to add new questions. If the answer answered the question: please accept it. If you have more questions, please create a new question.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32832717
comment on: http://stackoverflow.com/a/21699528
score: 0
has text: I'm at home now and it is not working, tried with NetBeans and Eclipse, it's really strange, the return is always NULL, how's that possible?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21776612
has comment: http://stackoverflow.com/comment/32948747
upvote count: 3
has comment: http://stackoverflow.com/comment/32945716
has comment: http://stackoverflow.com/comment/32948349
has body: Try a.doCaculations(); a.join(); edit: Since you are using SwingWorker my previous answer is incorrect, but, as in you comment, you've extended Thread, the following should work for you: Thread a = new Calculations(); a.start(); a.join(); Don't forget, that you have to override run method in Calculations class, like: class Calculations extends Thread { @Override public void run() { //your code here } }
has comment: http://stackoverflow.com/comment/32949194
type: Answer
has comment: http://stackoverflow.com/comment/32951225
has comment: http://stackoverflow.com/comment/32946872
score: 2
answers question: http://stackoverflow.com/q/21776495
has comment: http://stackoverflow.com/comment/32950120
downvote count: 1
has comment: http://stackoverflow.com/comment/32949545

http://stackoverflow.com/q/21768792
has body: i need a help. how to show marker in maps when the coordinate in another class? here I have arraylist and dialog alert in same class AlertDialog.Builder mAlert = new AlertDialog.Builder(HotelBintang.this); view = getLayoutInflater().inflate(R.layout.alert_background, null); ImageView Content_img = (ImageView)view.findViewById(R.id.imageView1); TextView Content_txt1 = (TextView)view.findViewById(R.id.textView1); Content_img.setImageResource(item_detail.get(position).getImageNumber()); Content_txt1.setText(item_detail.get(position).getName()); mAlert.setTitle(item_detail.get(position).getName()). setView(view). setPositiveButton("Get Coordinate", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); Intent intent = new Intent(Hotel.this, MapsActivity.class); intent.putExtra("lon", item_detail.get(position).lon); intent.putExtra("lat", item_detail.get(position).lat); HotelBintang.this.startActivity(intent); } }).create().show(); private ArrayList&lt;ItemDetail&gt; GetSearchResult() { ArrayList&lt;ItemDetail&gt; result = new ArrayList&lt;ItemDetail&gt;(); ItemDetail item_detail = new ItemDetail(); item_detail.setName("Taman Sari"); item_detail.setImageNumber(images[0]); item_detail.ALoc(-6.917222222, 106.9758333); result.add(item_detail); item_detail = new ItemDetail(); item_detail.setName("Taman Sari"); item_detail.setImageNumber(images[0]); item_detail.ALoc(-6.917222222, 106.9758333); result.add(item_detail); return result; } and I want when I click "Get Coordinate" Button, show a marker in maps. here is my MapsActivity class : public class MapsAcivity extends FragmentActivity { final int RQS_GooglePlayServices = 1; private GoogleMap myMap; String lon = getIntent().getExtras().getString("lon"); String lat = getIntent().getExtras().getString("lat"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.peta_layout); FragmentManager…
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
tagged with: google-maps
accepted answer: http://stackoverflow.com/a/21769338
score: 0
has answer: http://stackoverflow.com/a/21769338
has title: how to show marker in maps v2 with call coordinate in another class?
answer count: 1
tagged with: android

http://stackoverflow.com/comment/32895302
score: 0
has text: commons-loggin 1.1.3 & spring 3.x.
type: Comment
comment on: http://stackoverflow.com/a/21747038
type: AnswerComment

http://stackoverflow.com/q/21813661
tagged with: java
has answer: http://stackoverflow.com/a/21813693
type: Question
has body: I want to make a line clickable. I made a code using onDraw, in canvas. I tried but, drawline(line) is not a object, so onclicklistener couldn't connect to line. so I made a 2x2 rectangles arraylist, like a line to connect to clicklienter. But I think there must be a better solution. I think path... but path.... how can I connect to clicklistener??? and.... line??? there is no line class.....make a line class? how? line by drawline contains only X1,Y1, X2,Y2.. but clickable line must have x1,y1 to x~ y~.... please help me...
score: 0
answer count: 1
has title: How can I make drawline set onClickListener?
type: UnansweredQuestion
tagged with: android
tagged with: drawable

http://stackoverflow.com/q/21778849
accepted answer: http://stackoverflow.com/a/21906578
downvote count: 0
favorite count: 0
has title: spring-data-elasticsearch using Criteria with nested Objects
linked to: http://stackoverflow.com/q/18831882
tagged with: elasticsearch
tagged with: nested
tagged with: spring-data
has answer: http://stackoverflow.com/a/21906578
possible better answer: http://stackoverflow.com/a/21852622
tagged with: spring
has comment: http://stackoverflow.com/comment/33041794
type: Question
has answer: http://stackoverflow.com/a/21852622
type: AnsweredQuestion
tagged with: java
has body: I'm quite new to elasticsearch and spring-data-elasticsearch and I have some problems querying for nested objects. I use the ElasticSearch repository to save an nested model instance in elasticsearch. As a result there is only one entry in elasticsearch containing all data, as far I understood this means I have a nested document. I need to implement a relatively complex query using Criteria to build up the query iteratively. When I try to access a nested property using the dot notation like startPoint.providingTimeRange.startTime I don't get any search results (but matching data is present in elasticsearch). In Spring Data Elastic Search with Nested Fields and mapping I found the capability of spring-data-elasticsearch to query for nested objects using the nestedQuery. Is there any way to combine the Criteria search with the nestedQuery? Thank you in advance, Christoph Update 1: To provide some example code I created a demo project which contains similar nested objects like in my real project: https://github.com/empulse-gmbh/elasticsearchtest The example is about to find FoodTrucks which are in a certain place in a certain time. In this example I used a Repository to persist my nested entities. I used two (both not working) approaches to query for nested objects: /* * add search criteria by timerange. it is assumed in timerange from * is always before to. */ TimeRange searchTimeRange = foodTruckSearch.getSearchTimeRange(); if (searchTimeRange != null) { String startTimePath = "locationPoint.timeRange.from"; String endTimePath = "locationPoint.timeRange.to"; searchCriteria = searchCriteria.and( new Criteria(startTimePath).between(searchTimeRange .getFrom().getTime(), searchTimeRange.getTo() .getTime())).or( new Criteria(endTimePath).between(searchTimeRange .getFrom().getTime(), searchTimeRange.getTo() .getTime())); } and: TimeRange searchTimeRange = foodTruckSearch.getSearchTimeRange(); if (searchTimeRange != null) { String startTimePath = "locationPoint.timeRange.fr…
score: 4
has comment: http://stackoverflow.com/comment/33007917
upvote count: 4
answer count: 2

http://stackoverflow.com/comment/32785008
has text: Do you have a proxy set in IntelliJ? Do you have a different maven profile running on the command line? Are you using the same version and settings for maven within intellij and on the command line? Are you using the same version of java in intellij and on the command line?
comment on: http://stackoverflow.com/q/21686237
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33044291
comment on: http://stackoverflow.com/q/21832275
score: 0
type: Comment
type: QuestionComment
has text: Have a look at [BufferedOutputStream](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedOutputStream.html)

http://stackoverflow.com/q/21689074
tagged with: primefaces
tagged with: java
has answer: http://stackoverflow.com/a/21715988
tagged with: omnifaces
type: Question
linked to: http://stackoverflow.com/q/18818517
answer count: 2
tagged with: autocomplete
downvote count: 0
tagged with: jsf-2
accepted answer: http://stackoverflow.com/a/21715988
has answer: http://stackoverflow.com/a/21695226
favorite count: 0
linked to: http://stackoverflow.com/q/17631837
has title: POJO support for primefaces autocomplete using omnifaces
possible better answer: http://stackoverflow.com/a/21695226
upvote count: 2
has body: I am trying to use primefaces autocomplete component in my project, in order to avoid writing specific converter to each list object I am trying to use omnifaces as suggested in here and here by 'BalusC', I tried to replicate exactly same way but could not able get this work. please review below code snippet and advice if I am missing anything here? First part of the code [f:selectOneMenu] is working absolutely fine without anyissues XHTML &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:f="http://xmlns.jcp.org/jsf/core"&gt; &lt;ui:composition template="WEB-INF/layout/layout.xhtml"&gt; &lt;ui:define name="content"&gt; &lt;h:form&gt; &lt;h:outputText id="selected_status" value="#{mybean.objLuStatus.strDescColVal}" /&gt; &lt;!-- h:selectOneMenu Working fine --&gt; &lt;h:selectOneMenu id="iterator2" value="#{mybean.objLuStatus}" converter="omnifaces.SelectItemsConverter"&gt; &lt;f:selectItem itemLabel="Choose item" noSelectionOption="true" /&gt; &lt;f:selectItems value="#{mybean.lstStatus}" var="entity" itemLabel="#{entity.strDescColVal}" itemValue="#{entity}" /&gt; &lt;f:ajax render="selected_status" /&gt; &lt;/h:selectOneMenu&gt; &lt;!-- p:autoComplete is NOT Working --&gt; &lt;p:autoComplete id="iterator3" value="#{mybean.objLuStatus}" converter="omnifaces.ListConverter" dropdown="true" var="entity" itemLabel="#{entity.strDescColVal}" placeholder="----- Select One -----" itemValue="#{entity}" completeMethod="#{mybean.completeList}"&gt; &lt;f:ajax render="selected_status" /&gt; &lt;/p:autoComplete&gt; &lt;h:commandButton value="Submit" action="#{mybean.post}" /&gt; &lt;/h:form&gt; &lt;/ui:define&gt; &lt;/ui:composition&gt; &lt;/html&gt; Managed Bean import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import c…
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/32824674
type: Comment
comment on: http://stackoverflow.com/a/21708518
has text: @AshleySwatton I am glad it works for you :) Feel free to accept answer you like the most since all answers posted here will solve your problem.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33001448
type: QuestionComment
has text: @mikemil first of all thank you for your reply. I solved this problem.... I wrote "com.jdbc.mysql.Driver " instead of "com.mysql.jdbc.driver" [ :) ]..now everything is working perfectly.
comment on: http://stackoverflow.com/q/21762748
score: 0
type: Comment

http://stackoverflow.com/q/21809837
answer count: 1
has answer: http://stackoverflow.com/a/21812599
accepted answer: http://stackoverflow.com/a/21812599
has body: This is a program from OpenCV ColorBlobDetectionActivity.java sample, and I tried to modify it so that it would detect yellow objects when the screen is touched, but it always detects black object only even though I specified the color Scalar to be yellow. I have put comments of "NOTICE" in the places where I think would be relevant. package com.example.road_guiding; import java.util.List; import org.opencv.android.BaseLoaderCallback; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android.OpenCVLoader; import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.core.Size; import org.opencv.imgproc.Imgproc; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.MotionEvent; import android.view.View; public class ColorBlobDetectionActivity extends Activity implements View.OnTouchListener, CameraBridgeViewBase.CvCameraViewListener2 { // private static final String TAG = "OCVSample::Activity"; private Scalar CONTOUR_COLOR; private Scalar mBlobColorHsv; private Scalar mBlobColorRgba; //NOTICE private Scalar temp; private ColorBlobDetector mDetector; private boolean mIsColorSelected = false; private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { public void onManagerConnected(int paramAnonymousInt) { switch (paramAnonymousInt) { default: super.onManagerConnected(paramAnonymousInt); // Log.i("OCVSample::Activity", "OpenCV loaded successfully"); ColorBlobDetectionActivity.this.mOpenCvCameraView.enableView(); ColorBlobDetectionActivity.this.mOpenCvCameraView.setOnTouchListener(ColorBlobDetectionActivity.this); return; } } }; private CameraBridgeViewBase mOpenCvCameraView; private Mat mRgba; // private Size SPECTRUM_SIZE; // private Mat mSpectrum; public ColorBlobDetectionActivity() { Log.i("OCVSample::Activity", "Instantiated new " + getClass()); } private Scalar converScalarHsv2Rgba(Sca…
tagged with: android
tagged with: opencv
type: AnsweredQuestion
tagged with: java
has title: OpenCV color detection in yellow
tagged with: image-processing
type: Question
score: 0
tagged with: colors

http://stackoverflow.com/comment/32831258
score: 0
type: AnswerComment
type: Comment
has text: We did consider it but ultimately decided it was not a good approach for this case (most of the framework is all ready separated). For now we have a work around until JetBrains fixes this in 13.1.0.
comment on: http://stackoverflow.com/a/21687746

http://stackoverflow.com/comment/33046457
comment on: http://stackoverflow.com/q/21833537
type: Comment
type: QuestionComment
score: 1
has text: The usage of lambdas as an ActionListener method is very weird. How do you know, that you're implementing method `actionPerformed` of interface `ActionListener`?!

http://stackoverflow.com/q/21702294
type: AnsweredQuestion
has body: I have issues with calling the java class from grails application. Controller class: class MyController{ def index() { somepkg.MyJavaClass.method() } } Java class: package somepkg; public class MyJavaClass{ public void method() { // ... some logic here } } The error: No signature of method: static somepkg.MyJavaClass.method() is applicable for argument types: () values: [] Possible solutions: wait(), any(), find(), wait(long), each(groovy.lang.Closure), find(groovy.lang.Closure)
has comment: http://stackoverflow.com/comment/32812622
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21702562
has title: Error when calling Java code in Grails
tagged with: grails
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32812807
has answer: http://stackoverflow.com/a/21702562
downvote count: 1

http://stackoverflow.com/q/21805331
has answer: http://stackoverflow.com/a/21805463
type: Question
has comment: http://stackoverflow.com/comment/32997468
tagged with: compilation
score: -1
has comment: http://stackoverflow.com/comment/32996544
downvote count: 1
has body: import java.util.Scanner; public class EnemyMessage { public static void main(String[] args) { System.out.println("enter the code:"); Scanner keyboard = new Scanner(System.in); int key; int i; String code = keyboard.next(); for (key = 1; key &lt;= 100; key++) { for (i = 0; i &lt; code.length(); i--) { char c = code.charAt(i); int n = (int) c; System.out.println(n); { (char) c = (int) c - 32 + key + 127; System.out.println(c); } } } } } This block of code gives me two errors that don't make much sense to me. As far as I know, I didn't do anything different then what I have been doing before. Errors: misplaced constructor {" expected
has answer: http://stackoverflow.com/a/21805449
favorite count: 0
has comment: http://stackoverflow.com/comment/32996558
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21805767
has comment: http://stackoverflow.com/comment/32997515
has title: need help on compiler errors
answer count: 4
upvote count: 0
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/21805428
tagged with: java

http://stackoverflow.com/a/21844908
upvote count: 1
has comment: http://stackoverflow.com/comment/33098135
has body: Couple of things... First inject your PersistenceContext like this into your EJB: @PersistenceContext private EntityManager em; Next, mark your function, or the entire EJB with the proper automatic transaction handling: @Stateless @TransactionAttribute(TransactionAttributeType.REQUIRED) public class MyServiceEJBThingy { @PersistenceContext private EntityManager em; In your method, don't do anything but your business logic. Transaction sematics are now handled for you automagically: @Stateless @TransactionAttribute(TransactionAttributeType.REQUIRED) public class MyServiceEJBThingy { @PersistenceContext private EntityManager em; public void update(Object obj) { //GUI independent business logic here em.merge(obj); } } Finally, now inject your EJB in your view controller (assuming you're using the MVVM pattern): @RequestScoped (or something) public class EditUserBean { @Inject private MyServiceEJBThingy myServiceEJBThingy; public void update(Object obj) { // GUI logic here myServiceEJBThingy.update(obj); } } Much simpler yes? :) Java can be very simple and productive. I'm not sure what container you're using, but I'd suggest using Apache TomEE. Check out their huge library of up-to-date examples here. Good luck!!!
has comment: http://stackoverflow.com/comment/33089463
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21837833
score: 1
has comment: http://stackoverflow.com/comment/33101760

http://stackoverflow.com/comment/32820940
type: QuestionComment
comment on: http://stackoverflow.com/q/21698939
has text: why shoudl i do that? does this solve my problem?
score: 0
type: Comment

http://stackoverflow.com/q/21777884
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32947471
has comment: http://stackoverflow.com/comment/32947457
tagged with: audio
has title: Random generation of text and play as an audio JSP Page
has comment: http://stackoverflow.com/comment/32947417
tagged with: java
has body: I have text randomly generated. I wanted that text to be play as an audio in the JSP Page. Can anybody suggest some ideas?.
type: Question
tagged with: jsp
score: 0
has comment: http://stackoverflow.com/comment/32948366
answer count: 0

http://stackoverflow.com/comment/32948160
score: 0
comment on: http://stackoverflow.com/q/21778330
type: Comment
type: QuestionComment
has text: AFAIK Factory implies you get a new object each time. Provider implies pooling is an option (which is often better), though you generally need a Factory when a new object is needed. Lazy is an on-demand factory for one object.

http://stackoverflow.com/q/21807792
has answer: http://stackoverflow.com/a/28779695
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21808240
has comment: http://stackoverflow.com/comment/33001290
has comment: http://stackoverflow.com/comment/33001105
has comment: http://stackoverflow.com/comment/33001411
has comment: http://stackoverflow.com/comment/33001220
possible better answer: http://stackoverflow.com/a/28779695
has comment: http://stackoverflow.com/comment/33001191
linked to: http://stackoverflow.com/q/513832
has title: Java NoSuchElementException using String Tokenizer
has body: I'm reading in a transaction file that looks like this: 1112, D 4444, A, Smith, Jones, 45000, 2, Shipping 6666, U, Jones 8900, A, Hill, Bill, 65000, 0, Accounting When I attempt to read the file line by line using ", " the token, the program bombs out with a NoSuchElementException error at the first record. I've deduced that the condition in which I'm reading the file is causing the issue, particularly at the while loop below. I've tried using an "if" statement and setting the conditions to "while (st2.hasMoreTokens)" and a combination of the two but the error persists and I'm not sure why? Thank you in advance for any assistance. This is the code below: Scanner transactionFile = new Scanner (new File(fileName2)); for (int i = 0; i &lt; T_SIZE; i++) { line2[i] = transactionFile.nextLine(); transaction[i] = new Transaction(); st2 = new StringTokenizer(line2[i], ", "); transaction[i].setEmployeeID(Integer.parseInt(st2.nextToken())); transaction[i].setAction(st2.nextToken()); while ((transaction[i].getAction() != "D")) { transaction[i].setLastName(st2.nextToken()); transaction[i].setFirstName(st2.nextToken()); transaction[i].setSalary(Integer.parseInt(st2.nextToken())); transaction[i].setNumOfDependants(Integer.parseInt(st2.nextToken())); transaction[i].setDepartment(st2.nextToken()); } }
has comment: http://stackoverflow.com/comment/33001358
has comment: http://stackoverflow.com/comment/33001371
tagged with: java
has answer: http://stackoverflow.com/a/21808240
has comment: http://stackoverflow.com/comment/33001672
has comment: http://stackoverflow.com/comment/33001334
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33001349
has comment: http://stackoverflow.com/comment/33001572
has comment: http://stackoverflow.com/comment/33001588
tagged with: nosuchelementexception
has comment: http://stackoverflow.com/comment/33001308
tagged with: stringtokenizer

http://stackoverflow.com/q/21681921
type: UnansweredQuestion
tagged with: transactions
tagged with: java
has title: EJB-CMT JPA flush transaction
type: Question
has answer: http://stackoverflow.com/a/21682142
tagged with: ejb
score: 0
answer count: 1
tagged with: jpa
has body: I am writing an EJB-CMT bean using JPA. In my EJB method, I have some persist actions and I need call 'flush' after one of 'persist' action. Here are my sample code: @Stateless @LocalBean @TransactionManagement(TransactionManagementType.CONTAINER) public class MyEjb { @PersistenceContext(unitName = "MyPU") EntityManager em; public void addSome() { User u = //; em.persist(u); em.flush(); // ----------- CALL FLUSH HERE UserGroup g1; em.persist(g1); // --- Add another UserGroup g2; em.persist(g2); // -- Add another } } My question is: Can I get all codes in 'addSome' method executed in ONE transaction? I know that if I don't use 'flush', all codes executed in one transaction. Thank you very much for your help.

http://stackoverflow.com/comment/33409478
has text: I am using mysql.. i just Emptied the whole database using SQLyog
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21747147

http://stackoverflow.com/comment/33282302
type: QuestionComment
has text: To add it in workspace you have to update your project to maven project else you can add dependencies one by onein build path by selecting from variable and deployment
score: 0
comment on: http://stackoverflow.com/q/21820187
type: Comment

http://stackoverflow.com/a/21821312
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Should be able to pass an argument like you normally would on the command line: String domain1 = "some domain name"; String[] cmd = {"/bin/sh", "startdomain.sh " + domain1}; Process proc = Runtime.getRuntime().exec(cmd); Then change startdomain.sh so that it puts an argument where domain1 current is: #!/bin/sh gksudo -P "/home/priyatam/glassfish-4.0/glassfish/bin/asadmin start-domain $1"
answers question: http://stackoverflow.com/q/21821090
has comment: http://stackoverflow.com/comment/33030104
type: Answer
accepted answer of: http://stackoverflow.com/q/21821090
score: 2

http://stackoverflow.com/comment/32878029
type: Comment
has text: Duh, that's a good point about what if A.x has a field named "field" or A.foo() returns something with a field named "method".
comment on: http://stackoverflow.com/a/21738456
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32868226
score: 0
type: Comment
type: QuestionComment
has text: Thanks @BigT - I've altered `KEY_ID` to be `autoincrement` as suggested and added the semicolon at the end of the `TABLE_CREATE` string (code in question amended). The line it is failing at is: `int a = db.getContactsCount();`
comment on: http://stackoverflow.com/q/21732714

http://stackoverflow.com/comment/33018225
type: AnswerComment
has text: Is there another solution simpler ? I don't find a lot of documentation about what I wanna do :p Is it the solution which was used by the big part of android applications ?
type: Comment
comment on: http://stackoverflow.com/a/21815444
score: 0

http://stackoverflow.com/comment/32891447
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21743194
score: 0
has text: What if I can't upgrade to 3.1? I know the upgrade sounds trivial but it's something out of my control.

http://stackoverflow.com/comment/32932598
comment on: http://stackoverflow.com/q/21769190
score: 4
has text: There's a lot more questions on SO about Java policy files than there are on security.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21963893
answers question: http://stackoverflow.com/q/21774622
downvote count: 0
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/33514381
has comment: http://stackoverflow.com/comment/33483505
has comment: http://stackoverflow.com/comment/33513315
type: AcceptedAnswer
has body: You need to tell Jackson not to include class information for the implementation class. As per the documentation, More granular (and powerful) way to define what type information to add, and where, is to use @JsonTypeInfo annotation (and possibly couple of related ones). For example, we could have annotated Animal as follows: @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class") class Animal { } (which, incidentally is equivalent to the default settings for typing). What does that mean? All instances of annotated type and its subtypes use these settings (unless overridden by another annotation) "Type identifier" to use is fully-qualified Java class name (like "org.codehaus.jackson.sample.Animal") Type identifier is to be included as a (meta-)property, along with regular data properties; using name "@class" (default name to use depend on type if: for classes it would be "@class") Use default type resolver (no @JsonTypeResolver added); as well as default type id resolver (no @JsonTypeIdResolver) Do this by adding an annotation to Duck. @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) public class Duck implements Animal { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } Failing that, add SimpleModule simpleModule = new SimpleModule("SimpleModule", new Version(1,0,0,null)); simpleModule.addSerializer(new JsonSerializer&lt; Duck &gt; { @Override public void serialize(Duck duck, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeStringField("name", duck.getName()); jgen.writeEndObject(); } }); mapper.registerModule(simpleModule);
has comment: http://stackoverflow.com/comment/33680450
accepted answer of: http://stackoverflow.com/q/21774622
type: Answer
has comment: http://stackoverflow.com/comment/33639903
has comment: http://stackoverflow.com/comment/33640526

http://stackoverflow.com/q/21746144
has comment: http://stackoverflow.com/comment/32891460
has comment: http://stackoverflow.com/comment/65175941
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32891281
has answer: http://stackoverflow.com/a/21747038
tagged with: spring
score: 2
has title: Spring : Bean class is not recognised by the spring and throwing ClassNotFoundException
tagged with: java
has comment: http://stackoverflow.com/comment/32891358
has body: I am new to spring framework and trying out a simple example of the same. I have a bean class called 'Triangle' in my com.xyz.model package and one main class called DrawingApp in my com.xyz.DrawingApp package. Here is my spring.xml config file : &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt; &lt;bean id="triangle" class="com.xyz.model.Triangle"&gt; &lt;/bean&gt; &lt;/beans&gt; Triangle.java package com.xyz.model; public class Triangle { public void draw() { System.out.println("Triangle drawn"); } } DrawingApp.java ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); Triangle triangle = (Triangle)context.getBean("triangle"); triangle.draw(); I have included these jars : org.springframework.aop-3.1.2.RELEASE.jar org.springframework.asm-3.1.2.RELEASE.jar org.springframework.aspects-3.1.2.RELEASE.jar org.springframework.beans-3.1.2.RELEASE.jar org.springframework.context.support-3.1.2.RELEASE.jar org.springframework.context-3.1.2.RELEASE.jar org.springframework.core-3.1.2.RELEASE.jar org.springframework.expression-3.1.2.RELEASE.jar org.springframework.instrument.tomcat-3.1.2.RELEASE.jar org.springframework.instrument-3.1.2.RELEASE.jar org.springframework.jdbc-3.1.2.RELEASE.jar org.springframework.jms-3.1.2.RELEASE.jar org.springframework.orm-3.1.2.RELEASE.jar org.springframework.oxm-3.1.2.RELEASE.jar org.springframework.test-3.1.2.RELEASE.jar org.springframework.transaction-3.1.2.RELEASE.jar org.springframework.web.portlet-3.1.2.RELEASE.jar org.springframework.web.servlet-3.1.2.RELEASE.jar org.springframework.web.struts-3.1.2.RELEASE.jar org.springframework.web-3.1.2.RELEASE.jar commons-logging-1.1.3.jar commons-logging-1.1.3-javadoc.jar commons-logging-1.1.3-sources.jar commons-logging-1.1.3-tests.j…
type: Question
has answer: http://stackoverflow.com/a/38908635
has answer: http://stackoverflow.com/a/21746619
has comment: http://stackoverflow.com/comment/32891662
has comment: http://stackoverflow.com/comment/32891311
linked to: http://stackoverflow.com/q/19124445
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33000202
has text: Why don't you use a debugger! Believe me, sometimes using the debugger of your IDE is much better than asking questions on SO.
score: 1
comment on: http://stackoverflow.com/q/21805762
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32916325
has text: @chrylis I also feel like so.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21760431
type: AnswerComment

http://stackoverflow.com/comment/32984492
has text: Thanks, I will read it, it looks very promising.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21782667

http://stackoverflow.com/comment/32891523
comment on: http://stackoverflow.com/a/21746267
has text: @RJ You might need to point `this.balance`, as it's a little less the obvious to see...
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32828004
comment on: http://stackoverflow.com/q/21710558
has text: You don't need to explain that `n` is a terrible name. Change it (and `newthrow` as well because class name convention is `UpperCamelCase`), people will comment anyways :p
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21840069
has body: All hadoop implementations I've seen multithread heavily. Basically, most tasks that move work from map tasks into reducers are paralellized, as are map tasks and reduce tasks themselves. Checking "Hadoop - The Definitive Guide", the author mentions a number of processes that are multithreaded. These include Reducers have a small pool of "copier" threads to fetch map outputs in paralell. Mappers themselves can be multithreaded (MultithreadedMapper) DataNodes have threads to copy data on and off HDFS. Depending on how your cluster is configured, you can have DataNodes and TaskTrackers on the same machine, and this can start to add up to a lot of threads. I'd guess that heavy use of concurrency has significant performance benefits, and that's why the implementors have gone that route.
type: Answer
has comment: http://stackoverflow.com/comment/33061975
score: 5
accepted answer of: http://stackoverflow.com/q/21839318
answers question: http://stackoverflow.com/q/21839318
type: AcceptedAnswer
downvote count: 0
upvote count: 5

http://stackoverflow.com/comment/33051099
type: AnswerComment
has text: what? I don't understand you
type: Comment
comment on: http://stackoverflow.com/a/21812976
score: 0

http://stackoverflow.com/comment/32985386
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21799226
score: 0
has text: A nullpointer exception is the signal that one of your variables is nog initialized. It will signal on which line that is so you can determine which variable it is.

http://stackoverflow.com/a/21766456
answers question: http://stackoverflow.com/q/21766368
upvote count: 1
type: AcceptedAnswer
has body: If only one number is negative, you can use the same approach, but you need to make sure that you use the positive one in the cycle (as num1 in your code). If both numbers are negative, you can change both of them to positive using abs(num) and nothing changes.
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21766368

http://stackoverflow.com/q/21824764
score: 1
tagged with: java
upvote count: 1
tagged with: andengine
type: Question
has body: i'm trying to build a 2d game and now after i created the main menu and all of it supplies i'm having a problem with loading the main menu whenever i start the app just a black screen is appearing and main menu isn't i think i have done the steps for creating them probably but i can't figure out what's the error i hope you can help me this is the logcat 02-15 13:05:10.437: E/dalvikvm(4253): 4253 :: IS_UNIFIED_ARM_PROCESS=FALSE, debugFlags = 3 02-15 13:05:10.657: D/AndEngine(4253): MainGameActivity.onCreate @(Thread: 'main') 02-15 13:05:10.657: D/dalvikvm(4253): Trying to load lib /data/data/com.example.dgame/lib/libandengine.so 0xb3033500 02-15 13:05:10.657: D/dalvikvm(4253): Added shared lib /data/data/com.example.dgame/lib/libandengine.so 0xb3033500 02-15 13:05:10.657: D/dalvikvm(4253): No JNI_OnLoad found in /data/data/com.example.dgame/lib/libandengine.so 0xb3033500, skipping init 02-15 13:05:10.717: D/AndEngine(4253): MainGameActivity.onResume @(Thread: 'main') 02-15 13:05:10.747: D/libEGL(4253): egl.cfg not found, using default config 02-15 13:05:10.747: D/libEGL(4253): loaded /system/lib/egl/libGLES_bst.so 02-15 13:05:10.747: W/PGA(4253): eglGetProcAddress: "eglGetRenderBufferANDROID" not found 02-15 13:05:10.747: W/PGA(4253): eglGetProcAddress: "eglGetSystemTimeFrequencyNV" not found 02-15 13:05:10.747: W/PGA(4253): eglGetProcAddress: "eglGetSystemTimeNV" not found 02-15 13:05:10.777: I/PGA(4253): New SOCKET connection: m.example.dgame (pid 4253, tid 4270) 02-15 13:05:10.817: I/PGA(4253): New SOCKET connection: m.example.dgame (pid 4253, tid 4253) 02-15 13:05:10.997: D/AndEngine(4253): VERSION: OpenGL ES 2.0 02-15 13:05:10.997: D/AndEngine(4253): RENDERER: Bluestacks 02-15 13:05:10.997: D/AndEngine(4253): EGLCONFIG: EGLConfig(Red=5, Green=6, Blue=5, Alpha=0, Depth=0, Stencil=0) 02-15 13:05:10.997: D/AndEngine(4253): EXTENSIONS: GL_OES_EGL_image GL_ARB_texture_non_power_of_two GL_OES_blend_func_separate GL_OES_blend_equation_separate GL_OES_blend_subtract GL_…
downvote count: 0
has comment: http://stackoverflow.com/comment/33033883
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: mainmenu in 2dgame not loading just black screen
has comment: http://stackoverflow.com/comment/33033830
answer count: 0

http://stackoverflow.com/comment/32981081
score: 0
comment on: http://stackoverflow.com/q/21796596
type: Comment
type: QuestionComment
has text: Please, don't use scriplets! Look at MVC Model 2: http://www.javaranch.com/journal/200603/Journal200603.jsp#a5

http://stackoverflow.com/comment/33059596
score: 0
comment on: http://stackoverflow.com/q/21840802
type: Comment
type: QuestionComment
has text: You will notice that that output has a JSON object inside another JSON object. So, you should access the values by first accessing the getuserhasrate and move on from there. Again, just like @Brian Roach said, check out the docs at json.org

http://stackoverflow.com/q/21777001
has title: visiting every node in linked list in java
has comment: http://stackoverflow.com/comment/32945881
has comment: http://stackoverflow.com/comment/32946871
type: UnansweredQuestion
type: Question
has body: String str = "You can use either Iterator or ListIterator for traversing on Java ArrayList"; String[] words = str.split(" "); LinkedList&lt;String&gt; linkedlist=new LinkedList&lt;String&gt;(); for (int i = 0; i &lt;= words.length-1; i++) { linkedlist.add(words[i]); } ListIterator itr = linkedlist.listIterator(); Connection con = null; PreparedStatement pstTemp = null; StringBuilder tokens = new StringBuilder(); try { con = DBConnection.getJndiConnection(); StringBuffer sbQry = new StringBuffer("SELECT englishlex FROM lex_hindi where (domain='Tourism' or domain='Zgeneral') and englishlex="); while (itr.hasNext()) { System.out.println(itr.next()); tokens.append(itr.next()); sbQry.append("'"+tokens+ "',"); System.out.println(tokens.toString()); } sbQry.append(" order by length(englishlex) desc"); tokens.setLength(0); } catch (SQLException ex) { Logger.getLogger(PhraseMarker.class.getName()).log(Level.SEVERE, null, ex); } I split the string on space basis. Now I want to visit every node of linklist and maintain current pointer and my aim is to check the phrase means "you can "whether it is present in database. If yes then make it "you-can", if not then start searching for next token i.e "use" onwards if "use either Iterator" is present then make it "use-either-Iterator" other wise "use either Iterator" remain as it is. I have written a code but now how to proceed i am confuse?
has comment: http://stackoverflow.com/comment/32946121
has answer: http://stackoverflow.com/a/21777657
has comment: http://stackoverflow.com/comment/32945831
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/32945891
answer count: 1
has comment: http://stackoverflow.com/comment/32945954
has comment: http://stackoverflow.com/comment/32945765

http://stackoverflow.com/q/21741997
has title: Iterating through a linkedlist of objects(Exception in thread "main" java.util.ConcurrentModificationException)
has comment: http://stackoverflow.com/comment/32884089
has comment: http://stackoverflow.com/comment/32885878
score: 0
has comment: http://stackoverflow.com/comment/32884356
has comment: http://stackoverflow.com/comment/32895608
has comment: http://stackoverflow.com/comment/32884179
has comment: http://stackoverflow.com/comment/32885347
favorite count: 0
has comment: http://stackoverflow.com/comment/32884560
has comment: http://stackoverflow.com/comment/32884502
answer count: 0
has comment: http://stackoverflow.com/comment/32895603
type: UnansweredQuestion
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/322715
has comment: http://stackoverflow.com/comment/32895668
tagged with: linked-list
has comment: http://stackoverflow.com/comment/32884239
tagged with: java
has comment: http://stackoverflow.com/comment/32884706
linked to: http://stackoverflow.com/q/21646912
has comment: http://stackoverflow.com/comment/32884193
has comment: http://stackoverflow.com/comment/32884120
has comment: http://stackoverflow.com/comment/32885781
type: Question
has body: I am trying to iterate through a linked list of objects, doing a comparison of one object that I want to add to the linkedlist with each objects in the linkedlist so that I can find out where to place this new object. I am doing a comparison with both object's get(0) index which is a string and using compareToIgnoreCase(). I am running into an error right after the print statement "looping through linkedlist": Exception in thread "main" java.util.ConcurrentModificationException at java.util.LinkedList$ListItr.checkForComodification(Unknown Source) at java.util.LinkedList$ListItr.next(Unknown Source) at FileManager.readData(Aclass.java:248) at Aclass.display(Aclass.java:86) at Aclass.&lt;init&gt;(Aclass.java:34) at Aclass.main(Aclass.java:190) here is iteration: while(x.hasNext()){ System.out.println("looping through linklist"); //LinkedList&lt;String&gt; obj=x.next(); PROBLEM HERE if(obj.get(0).compareToIgnoreCase(subData.get(0)) &lt;0){ data.add(c,subData); System.out.println("ADDED"); c=0; } c++; //keeps track of current index of object in linkedlist } alternate code: while(x.hasNext()){ System.out.println("looping through linklist"); LinkedList&lt;String&gt; obj=x.next(); if(obj.get(0).compareToIgnoreCase(subData.get(0)) &lt;0){ System.out.println("ADDED"); break; } c++; } data.add(c-1,subData); c=0; original full code of method: public LinkedList&lt;LinkedList&lt;String&gt;&gt; readData() { LinkedList&lt;LinkedList&lt;String&gt;&gt; data=new LinkedList&lt;&gt;(); LinkedList&lt;String&gt; subData=new LinkedList&lt;&gt;(); Iterator&lt;LinkedList&lt;String&gt;&gt; x = data.listIterator(0); int i=0; int c=0; int flag=0; BufferedReader br = null; String workingDir = System.getProperty("user.dir"); try { String sCurrentLine; br = new BufferedReader(new FileReader(workingDir + "/Data.txt")); while ((sCurrentLine = br.readLine()) != null) { if(i==4){ i=0; if(flag==0){ data.add(subData); subData=new LinkedList&lt;&gt;(); System.out.println("OK NO SORT"); flag=1; } else{ …

http://stackoverflow.com/comment/32866141
type: QuestionComment
comment on: http://stackoverflow.com/q/21732119
has text: What's your question?
score: 0
type: Comment

http://stackoverflow.com/comment/32885355
has text: @Vallentin that's what I thought too :-)
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21742765

http://stackoverflow.com/q/21694401
has answer: http://stackoverflow.com/a/22222779
has answer: http://stackoverflow.com/a/21694471
answer count: 3
downvote count: 0
tagged with: events
tagged with: keytool
favorite count: 0
has answer: http://stackoverflow.com/a/29245892
tagged with: keystore
tagged with: android
has body: Hi i am writing a program which uses event injection.so in order to get system privileges i have to sign the apk with the certificate of the system. I tried as mentioned in this link http://paulononaka.wordpress.com/2011/10/19/apk-with-system-privileges/ https://github.com/getfatday/keytool-importkeypair but when i tried i got the following error C:\Program Files\Java\jdk1.7.0\bin&gt;keytool -importkeypair -k ~/C:\Users\name\.androiddebug.keystore -p android -pk8 platform.pk8 -cert platform.x509. pem -alias platform Illegal option: -importkeypair Key and Certificate Management Tool Commands: -certreq Generates a certificate request -changealias Changes an entry's alias -delete Deletes an entry -exportcert Exports certificate -genkeypair Generates a key pair -genseckey Generates a secret key -gencert Generates certificate from a certificate request -importcert Imports a certificate or a certificate chain -importkeystore Imports one or all entries from another keystore -keypasswd Changes the key password of an entry -list Lists entries in a keystore -printcert Prints the content of a certificate -printcertreq Prints the content of a certificate request -printcrl Prints the content of a CRL file -storepasswd Changes the store password of a keystore Use "keytool -command_name -help" for usage of command_name
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38647163
has title: sign apk with system certificate

http://stackoverflow.com/comment/33054403
score: 0
type: Comment
has text: Oh ok i understand i delete answer and edit my question now just a second. Edit: Ok i deleted my answer and edit my question above. You can chck last situation of my project and its problem.
type: AnswerComment
comment on: http://stackoverflow.com/a/21837153

http://stackoverflow.com/comment/32957116
type: Comment
comment on: http://stackoverflow.com/q/21783370
has text: What @MarkPeters says. If yes and if you are ready to use an external library, Guava has `Iterables.removeIf()`.
score: 0
type: QuestionComment

http://stackoverflow.com/a/21765225
answers question: http://stackoverflow.com/q/21757602
type: Answer
has body: Create a Java program that runs from the command line? You can't access the service registry without using Java (or another JVM language). Alternatively you could of course expose an API as a RESTful web service for example, and access your services over that API from outside the JVM.
score: 0

http://stackoverflow.com/q/21795434
has comment: http://stackoverflow.com/comment/32979037
accepted answer: http://stackoverflow.com/a/21795473
tagged with: swing
type: AnsweredQuestion
tagged with: paint
has answer: http://stackoverflow.com/a/21795473
tagged with: java
has body: I have made a Tetris game using a bit of help from the internet and some books and it seems to work almost as I want it to. The only problem is that when I run it the screen flickers horribly when the blocks drop. I am new to AWT and swing and hence I often tend to use trial and error (I know it is bad) to get what I want. This time I am quite unsure as to what part of the program is causing it. Here is my code. Sorry but my code is a bit long and I seriously dont know where the problem is occuring. (But mostly it will be in the paint() method or in the Timer. At least that is what I feel.) import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.applet.*; import java.io.*; import sun.audio.*; public class MatrixBoard extends Frame implements ActionListener{ int boardHeight = 20; int boardWidth = 10; int score = 0; int curX = 0, curY = 0; int squareWidth; int squareHeight; Timer timer; int sleepTime = 300; Shape curPiece; Shape.Tetromino[][] board; boolean isFallingFinished = false; boolean isStarted = false; boolean isPaused = false; public static void main(String [] args){ playAudio("C:\\doak.wav"); MatrixBoard b = new MatrixBoard(); } public static void playAudio(String filename) { InputStream in = null; AudioStream as = null; try{ in = new FileInputStream(filename); as = new AudioStream(in); } catch(Exception e){ System.out.println("Error!!!"); } AudioPlayer.player.start(as); } MatrixBoard(){ setTitle("TETRIS: NEW GAME"); setFocusable(true); setSize(200, 400); setVisible(true); setBackground(Color.BLACK); timer = new Timer(400, this); timer.setInitialDelay(10); squareWidth = (getWidth())/ boardWidth; squareHeight = (getHeight()) / boardHeight; curPiece = new Shape(); board = new Shape.Tetromino[boardWidth][boardHeight]; addKeyListener(new KeyHandler()); clearBoard(); timer.start(); JOptionPane.showMessageDialog(null, "Press Enter to Start!!!"); start(); System.out.println("MatrixBoard() Success!"); } public void clearBoard(){ for(int i = 0; …
type: Question
has comment: http://stackoverflow.com/comment/32979096
has title: Remove flickering in a self made Tetris game
tagged with: game-engine
tagged with: awt
score: 0
answer count: 1

http://stackoverflow.com/a/21817532
answers question: http://stackoverflow.com/q/21817457
has body: That is really easy. Convert it to an int and increase the exponent and convert it back. Consider this layout of a float: Then, this code should do the trick: public static float increaseExponent(float f) { int bits = Float.floatToIntBits(f); bits += 0x800000; return Float.intBitsToFloat(bits); } Demo here: http://ideone.com/vs8BrG float f = (float) Math.PI; System.out.println(f); System.out.println(f * 2.0f); System.out.println(increaseExponent(f)); Outputs: 3.1415927 6.2831855 6.2831855
score: 4
upvote count: 4
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33006135
has text: See this https://github.com/DushyanthMaguluru/ZBarScanner/blob/master/examples/ZBarScannerDemo/res/layout/main.xml
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21810520

http://stackoverflow.com/a/30781020
score: 15
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21835062
type: Answer
upvote count: 16
has body: I just have something like this in a helper or utils class. I usually use it for debugging and visualizing whats going on. private static ShapeRenderer debugRenderer = new ShapeRenderer(); public static void DrawDebugLine(Vector2 start, Vector2 end, int lineWidth, Color color, Matrix4 projectionMatrix) { Gdx.gl.glLineWidth(lineWidth); debugRenderer.setProjectionMatrix(projectionMatrix); debugRenderer.begin(ShapeRenderer.ShapeType.Line); debugRenderer.setColor(color); debugRenderer.line(start, end); debugRenderer.end(); Gdx.gl.glLineWidth(1); } public static void DrawDebugLine(Vector2 start, Vector2 end, Matrix4 projectionMatrix) { Gdx.gl.glLineWidth(2); debugRenderer.setProjectionMatrix(projectionMatrix); debugRenderer.begin(ShapeRenderer.ShapeType.Line); debugRenderer.setColor(Color.WHITE); debugRenderer.line(start, end); debugRenderer.end(); Gdx.gl.glLineWidth(1); } Now I can easily draw a line from anywhere I like on any projection matrix I want. HelperClass.DrawDebugLine(new Vector2(0,0), new Vector2(100,100), camera.combined); You want to draw outside the other SpriteBatch begin and end. And if you want to make a lot of lines each frame you are better off beginning and ending the ShapeRenderer in a separate static method or make it public and do it yourself depending on your needs. Obviously you can create more methods for more shapes or more overloads.
downvote count: 1
answers question: http://stackoverflow.com/q/21835062

http://stackoverflow.com/q/21763442
has answer: http://stackoverflow.com/a/21763626
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32921893
has body: I'm having a bit of trouble beginning this program that I was given by my professor. Here is the prompt and sample output: Read 20 pairs of numbers (ID number and score respectively) into two separate arrays. Find the average score. Print a table as shown below of the ID, score and difference (score - average) for each student, one student per line. Print the sum, average, and count of score at the head of the table as shown. Round the average and difference to 2 decimal places. Output: End of reading from file. Sum = 4853 Average = 242.65 Count = 20 Id Score Diff 115 257 14.35 123 253 10.35 116 246 3.35 113 243 0.35 112 239 -3.65 104 239 -3.65 110 238 -4.65 218 243 0.35 208 242 -0.65 222 223 -19.65 223 230 -12.65 213 229 -13.65 207 228 -14.65 203 224 -18.65 305 265 22.35 306 262 19.35 311 256 13.35 325 246 3.35 321 245 2.35 323 245 2.35 My main problem right now is figuring out how to sort the ID and Scores into two separate Arrays. I read the files by using Scanner kbReader = new File("C:\\\Users\\\Guest\\\Documents\\\java programs\\\Prog590b\\\Prog590b.in"); But I can't find a way to sort them into the arrays. I'm not asking anyone to write my entire code, but to help me figure out how to sort them into the arrays like the prompt asks. Could someone provide some guidance/feedback on how I can do this? Thanks.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32921717
tagged with: arrays
has answer: http://stackoverflow.com/a/21763743
has title: Java Arrays and external files
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32921955
has answer: http://stackoverflow.com/a/21763594

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/21744714
tags question: http://stackoverflow.com/q/21820644
type: Tag
tags question: http://stackoverflow.com/q/21739349

http://stackoverflow.com/q/21820989
favorite count: 0
has title: Coding Using the classes of Jmeter
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33172342
linked to: http://stackoverflow.com/q/19147235
upvote count: 1
has comment: http://stackoverflow.com/comment/33073605
tagged with: jmeter
score: 1
tagged with: java
has body: I am using APIs of Jmeter to write a code which will run Jmeter.I am getting the following errors while using Jorphan, : About to replace in property of type: class org.apache.jmeter.testelement.property.CollectionProperty: [] DEBUG 2014-02-17 09:37:36.942 [jmeter.e] (): Replacement result: [] DEBUG 2014-02-17 09:37:36.945 [jmeter.e] (): Replacement result: DEBUG 2014-02-17 09:37:36.945 [jmeter.e] (): About to replace in property of type: class org.apache.jmeter.testelement.property.StringProperty: www.google.com
type: Question
tagged with: automated-tests
tagged with: api
downvote count: 0

http://stackoverflow.com/a/21812305
has comment: http://stackoverflow.com/comment/33009030
has comment: http://stackoverflow.com/comment/33009045
downvote count: 0
has body: You cannot add anything else to the () part of the "enhanced for" statement. JLS § 14.14.2: The enhanced for statement has the form: for ( FormalParameter : Expression ) Statement The type of the Expression must be Iterable or an array type. (The "FormalParameter" means a variable declaration.) The break; statement is the only way: for (String s : string_table) { if (condition) break; // ... }
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33009009
answers question: http://stackoverflow.com/q/21812284
score: 1

cloudera
tags question: http://stackoverflow.com/q/21706133
type: Tag
tag name: cloudera

http://stackoverflow.com/comment/32803026
comment on: http://stackoverflow.com/a/21693975
type: AnswerComment
score: 0
type: Comment
has text: Thanks ya its working. But in the above code also you are using replaceAll() method again??? I want something with only regular expression ??

http://stackoverflow.com/comment/33054918
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21837889
has text: @LuiggiMendoza, how about now?
type: Comment

http://stackoverflow.com/q/21821865
has comment: http://stackoverflow.com/comment/33026112
linked to: http://stackoverflow.com/q/12530053
has comment: http://stackoverflow.com/comment/33026003
has answer: http://stackoverflow.com/a/21821980
has comment: http://stackoverflow.com/comment/33026167
favorite count: 0
tagged with: static-members
has comment: http://stackoverflow.com/comment/33026084
type: AnsweredQuestion
has body: class Parent { public static String sName = "Parent"; static { System.out.println("Parents static block called"); sName = "Parent"; } } class Child extends Parent { public static String sName1; static { System.out.println("Childs static block called"); sName = "Child"; sName1 = "Child"; } } public class Inheritance { public static void main(String []args) { System.out.println(Child.sName); System.out.println(Parent.sName); } } In the above code snippet I have a 'Parent' class and a 'Child' class which extends Parent. I understand the fact that static variables are shared between parent and all of its subclasses. When I run the above program the output is Parents static block called Parent Parent I wonder why the Child's static block isn't executed even after executing 'System.out.println(Child.sName);'. I am not sure why only the parent class gets loaded and not the Childs class. Now when I modify the main() function as shown below the Child's class gets loaded. public static void main(String []args) { System.out.println(Child.sName); System.out.println(Parent.sName); System.out.println(Child.sName1); //sName is declared in Child class. System.out.println(Parent.sName); } The output now is shown below and is as expected. Now the Child class has to get loaded as we are making a reference to the static variable sName1 which is declared in Child class. Parents static block called Parent Parent Childs static block called Child Child The static variable 'sName' now has 'Child' as its value. My question here is why doesn't the Child class gets loaded even after making a reference in the first line itself in the main function before modifying it? Please advise.
accepted answer: http://stackoverflow.com/a/21821980
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33026102
downvote count: 1
type: Question
has title: Static variables in Java
has comment: http://stackoverflow.com/comment/33026128
linked to: http://stackoverflow.com/q/9898097
possible better answer: http://stackoverflow.com/a/21821973
tagged with: inheritance
has answer: http://stackoverflow.com/a/21821973
duplicate of: http://stackoverflow.com/q/9898097
score: 0
answer count: 2

http://stackoverflow.com/a/21978012
score: 0
type: Answer
has body: I abandoned the approach of using some hibernate specific event based solution and instead went for using @Configuration which requires aspectJ in Spring. See http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/aop.html 9.8.1 Using AspectJ to dependency inject domain objects with Spring The Spring container instantiates and configures beans defined in your application context. It is also possible to ask a bean factory to configure a pre-existing object given the name of a bean definition containing the configuration to be applied. The spring-aspects.jar contains an annotation-driven aspect that exploits this capability to allow dependency injection of any object. The support is intended to be used for objects created outside of the control of any container. Domain objects often fall into this category because they are often created programmatically using the new operator, or by an ORM tool as a result of a database query. The @Configurable annotation marks a class as eligible for Spring-driven configuration. In the simplest case it can be used just as a marker annotation:
answers question: http://stackoverflow.com/q/21801605
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21801605

http://stackoverflow.com/a/21732033
upvote count: 2
has body: The Minecraft server is not open source. So you won't legaly get the source files. i want to edit the minecraft server code and add/remove things, i need or not. I doubt there are things you don't need and if so... don't use them. But there are OpenSource minecraft servers (like bukkit), that can easily be customized with plugins.
type: Answer
has comment: http://stackoverflow.com/comment/32866014
answers question: http://stackoverflow.com/q/21731765
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32866434
has comment: http://stackoverflow.com/comment/32866506
has comment: http://stackoverflow.com/comment/32865902

http://stackoverflow.com/a/21795642
has body: Java is an interpreter based language u need to give the jar file as input to the interpreter to execute. Pls correct me if i am wrong. PS: Downvoters or editors please mention the reason..Cos of half of them just re-iterate the sentence while editing.
has comment: http://stackoverflow.com/comment/32989945
has comment: http://stackoverflow.com/comment/32990263
type: Answer
has comment: http://stackoverflow.com/comment/32990466
has comment: http://stackoverflow.com/comment/33066186
has comment: http://stackoverflow.com/comment/32989665
answers question: http://stackoverflow.com/q/21795408
has comment: http://stackoverflow.com/comment/32989430
has comment: http://stackoverflow.com/comment/32981182
score: 0
has comment: http://stackoverflow.com/comment/32990771
has comment: http://stackoverflow.com/comment/32989846

http://stackoverflow.com/comment/33063040
type: AnswerComment
comment on: http://stackoverflow.com/a/21842526
type: Comment
has text: 1) I tried adding the `<auxClasspath>` element, and it didn't help; same error as before. 2) The manual says that that element is "An optional nested element which specifies a classpath ... containing classes used by the analyzed library or application, but which you don't want to analyze". I'm not using the BCEL library in my app, so I don't see why it would help FindBugs load one of the libraries *it's* using to *do* the analysis.
score: 0

http://stackoverflow.com/q/21810322
tagged with: smack
tagged with: asmack
type: UnansweredQuestion
score: 2
has title: Can't save VCard using aSmack and Openfire
downvote count: 0
tagged with: java
tagged with: openfire
has body: I have a problem creating VCard on aSmack. I can see that my VCard has not been saved when I try to load it. When I try to load a VCard created by another client, everything works perfectly. When I try to load the VCard from a user created on Openfire, I get the following error : service-unavailable(503) at org.jivesoftware.smackx.packet.VCard.doLoad(VCard.java:568) at org.jivesoftware.smackx.packet.VCard.load(VCard.java:551) When I try to load the VCard from a user I created with my client, I get the following error: remote-server-not-found(404) at org.jivesoftware.smackx.packet.VCard.doLoad(VCard.java:568) at org.jivesoftware.smackx.packet.VCard.load(VCard.java:551) To create a VCard from my client, first I log in then I use the following code : VCard userCard = new VCard(); userCard.setField("customField", "yes"); try { userCard.save(mConnection); Log.i(TAG,"usercard saved "+userCard.toXML()); /* it is displayed! */ } catch (XMPPException e) { Log.e(TAG,"An error occured while sending Vcard"+userCard.toXML(),e); } Before connection mConnection, I added the line ProviderManager.getInstance().addIQProvider("vCard","vcard-temp", new VCardProvider()); According to this post (http://community.igniterealtime.org/thread/34689), it is not possible to modify VCard if we are using LDAP. But I don't get errors when I try to save a VCard, it just doesn't save it ! Does anyone has the same problem ?
type: Question
tagged with: vcf-vcard
upvote count: 2
has answer: http://stackoverflow.com/a/21857944
answer count: 1
favorite count: 0

http://stackoverflow.com/q/21694968
has answer: http://stackoverflow.com/a/21695119
tagged with: arraylist
score: 0
accepted answer: http://stackoverflow.com/a/21695119
answer count: 1
has comment: http://stackoverflow.com/comment/32800135
has body: I am preparing myself to the Java certification and confused with object references in this case. In this piece of code I can't understand why ArrayList's and arrays's elements aren't affected when we assign a new object to them? ArrayList&lt;StringBuilder&gt; myArrList = new ArrayList&lt;StringBuilder&gt;(); StringBuilder sb1 = new StringBuilder("Jan"); StringBuilder sb2 = new StringBuilder("Feb"); myArrList.add(sb1); myArrList.add(sb2); StringBuilder[] array = myArrList.toArray(new StringBuilder[2]); for(StringBuilder val : array) { System.out.println(val); } StringBuilder sb3 = new StringBuilder("NNN"); sb2 = sb3; for(StringBuilder val : array) { System.out.println(val); } for(StringBuilder val : myArrList) { System.out.println(val); } Output: Jan Feb Jan Feb Jan Feb I will be grateful if you could provide simple explanation. Thank you.
has title: Confused with object references
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/40480
type: Question
tagged with: object

http://stackoverflow.com/q/21832338
tagged with: java
type: Question
downvote count: 0
answer count: 1
tagged with: pkcs#12
favorite count: 0
accepted answer: http://stackoverflow.com/a/21952301
has body: I know this is possible with openssl. But I wonder if there are PKCS converting possibilities(pkcs8 to 12) in Java using any library.
has answer: http://stackoverflow.com/a/21952301
has title: How to convert pkcs8 to pkcs12 in Java
upvote count: 1
tagged with: pkcs#8
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/33046984
type: AnswerComment
comment on: http://stackoverflow.com/a/21833144
score: 0
type: Comment
has text: I have everything working smoothly, but I would like to know how I can enter more than 1 grade in Case 2 without going back to the main menu or having the user have to input a number to exit the loop. I want them to be able to enter how ever many numbers they would like, then press enter to average all of those grades.

http://stackoverflow.com/comment/46270244
comment on: http://stackoverflow.com/a/21751058
type: Comment
has text: In Netbeans is the same: addding panels where the "tabs" captions are. BTW, Love the gif :D
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33027437
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21822635
type: Comment
has text: "*On a JVM that optimizes tail recursion the code would be equivalent to an infinite loop*" - That's interesting, can you please explain more about this? What would be the difference?

http://stackoverflow.com/a/21729024
upvote count: 1
has body: public static Hashtable&lt;String, Hashtable&lt;String, String&gt;&gt; tab = new Hashtable&lt;String, Hashtable&lt;String, String&gt;&gt;(); static { tab.put("Key1", new HashTable&lt;String,String&gt;()); ... }
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21728997

http://stackoverflow.com/comment/33055215
has text: @user3044002 You are probably looking for: `String.format("The car is currently in %s",Arrays.toString(transmission)))`
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21838379

http://stackoverflow.com/comment/32783249
score: 3
has text: No matter *what* you do, there's a loop written by someone, somewhere, and it's getting used.
type: QuestionComment
comment on: http://stackoverflow.com/q/21685566
type: Comment

http://stackoverflow.com/comment/32896267
score: 0
type: AnswerComment
has text: +1 The usual workaround is to create inner static classes to avoid the reference to a potentially very large enclosing class.
type: Comment
comment on: http://stackoverflow.com/a/21749100

http://stackoverflow.com/a/37047189
upvote count: 0
answers question: http://stackoverflow.com/q/21805536
type: Answer
downvote count: 1
has body: Keep all your settings file in both %M2_HOME/conf as well as in ~/.m2/ folder. Then you will not get this error message.
score: -1

http://stackoverflow.com/comment/33001358
has text: The first step is to check where it happens. Look at your stack trace and then look into debuggers.
type: QuestionComment
comment on: http://stackoverflow.com/q/21807792
score: 0
type: Comment

http://stackoverflow.com/a/21815625
answers question: http://stackoverflow.com/q/21815551
type: Answer
score: 1
upvote count: 1
has body: It's not infinite. It just goes twice: for(int i = 0; i&lt; grid.length; i++){ There's no need for this i variable here, and hence the entire outer-loop as well, since you use both sub-arrays, grid[0] and grid[1] on the first go-through
downvote count: 0

http://stackoverflow.com/q/21803545
has answer: http://stackoverflow.com/a/21805673
has comment: http://stackoverflow.com/comment/32994290
score: 1
tagged with: java
type: Question
tagged with: round-robin
tagged with: scheduling
answer count: 1
has body: I was asked to do a multithreaded simulator of a specific algorithm. One of the tasks was to compare the regular scheduling results with round robin results. When I was looking for information about the round robin scheduling method I found vary general explanations and some code examples that I couldn’t find any relation between them and scheduling the threads. For example this code (found here on stack overflow): public static void RR3(int numProcess, int[] cpuBurst, int[] arrivalTime){ int quantum = 3,time = 0, temp; int completionTime = 0; LinkedList &lt;Integer&gt;process = new LinkedList(); for (int i = 0; i &lt; numProcess; i++) { process.add(i, cpuBurst[i]); } while (process.isEmpty() != true){ for (int j = 0; j &lt; quantum; j++) { System.out.println(process.getFirst()); if(process.peek() == 0 ){ completionTime = completionTime + time; process.remove(); } else{ temp = process.pop(); process.push(temp - 1); time++; } } process.addLast(process.getFirst()); process.removeFirst(); } double act = (double) completionTime/numProcess; System.out.println("-----------------RR3-----------------"); System.out.println(" Act = " + act + "ms"); } I don't see anything but integers that represent the amount of process, time for each etc., but how do I actually manage their behavior? I dont see any call for a process to run or stop.
has title: Round robin java implementation
upvote count: 1
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/32916300
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21760352
type: Comment
has text: Indeed, the null token was the problem. It seems I missed the part about the ConcurrentHashMap disallowing null keys.

http://stackoverflow.com/q/21814241
score: 4
has body: My problem: I'm just trying to write a function that goes through a directory and gets the time that the most recent file was modified. What I mean by this is there is a directory of say ~2500 .5 megabyte files. I don't care when each file was modified, I just need the most recent modified timestamp. i.e. File 1 - 1392567840 File 2 - 1392567841 File 2403 - 1392567849 File 7 - 1392567850 In this case, File 7 would be the most recently modified timestamp. What I have found however is using the File.lastModified() is very slow, which is also posted in another stackoverflow post, but for use with file copies. So for some prior research: File.lastModified() painfully slow! I did search this forum and read suggestions to use multiple threads to do all of the last modified lookups, however I was wondering if there was a simpler way to do it as I just need the most recently modified value (so I think its a much simpler problem, however I'm not sure if I can avoid the individual lookups :( ). Some code for investigation: public static void main(String[] args) { // TODO Auto-generated method stub long start; long end; long average = 0; int cnt = 10; for(int i = 0; i &lt; cnt; i++) { start = System.nanoTime(); System.out.println(GetLastModifiedTimeOfFiles("./data/")); end = System.nanoTime(); average += (end - start); } System.out.println("The average time it took was: " + (average/(cnt * 1.0))/1000000 + " ms to complete!"); } public static long GetLastModifiedTimeOfFiles(String path) { File folder = new File(path); File[] listOfFiles = folder.listFiles(); StringBuilder sb = new StringBuilder(); for(int i = 0; i &lt; listOfFiles.length; i++) { sb.append(listOfFiles[i].getName() + " "); } System.out.println(sb.toString().length() + " chars"); long time = 0; return time; } Results: Average of 22 ms when using .getName() Average of 631 ms when using .lastModified() So 1) Why would .getName() perform ~30x faster than .lastModified()? 2) Is there some alternative approach as I just…
tagged with: java
tagged with: last-modified
has title: File.lastModified() alternative?
answer count: 0
has comment: http://stackoverflow.com/comment/33013201
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4305448
upvote count: 4
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/33014690
has comment: http://stackoverflow.com/comment/38990351

http://stackoverflow.com/q/21836894
score: 0
has title: java compiler warning: readStrings() in In (deprecated)
answer count: 1
accepted answer: http://stackoverflow.com/a/21837002
has comment: http://stackoverflow.com/comment/33052686
type: AnsweredQuestion
tagged with: deprecated
tagged with: java
has comment: http://stackoverflow.com/comment/33052386
type: Question
has answer: http://stackoverflow.com/a/21837002
tagged with: compiler-warnings
has comment: http://stackoverflow.com/comment/33052508
has body: I'm running javac v1.6.0-65 in a Dr. Java studio on a Mac with OSX 10.9.1 I get the following warning: Quick.java:53: warning: [deprecation] readStrings() in In has been deprecated which isn't so bad, I guess, except I also get the following error: Quick.java:54: sort(java.lang.Comparable[],int,int) in Quick cannot be applied to (java.lang.String[]) The code lines are: public static void main(String[] args) { // Read strings from standard input, sort them, and print. String[] a = In.readStrings(); sort(a); and private static void sort(Comparable[] a, int lo, int hi) { There seems to be some mismatch in defining the array a of input, String[] a, as something that can be compared in the private sort(). I thought strings could be compared. My question is, how do I get rid of the error? And, incidentally, does the warning relate to the error?

http://stackoverflow.com/a/21814188
accepted answer of: http://stackoverflow.com/q/21814109
has comment: http://stackoverflow.com/comment/33012633
upvote count: 4
has body: try this : public void delete(int p){ SQLiteDatabase db = this.getWritableDatabase(); db.execSQL("DELETE FROM "+ TABLE_NAME + " WHERE " + COLUMN_ID + " = "+p+""); db.close(); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33012707
type: Answer
answers question: http://stackoverflow.com/q/21814109
downvote count: 1
has comment: http://stackoverflow.com/comment/33013884
score: 3

http://stackoverflow.com/q/21700896
has comment: http://stackoverflow.com/comment/32810391
tagged with: lucene
has title: Error while indexing files
score: 0
tagged with: apache
answer count: 1
accepted answer: http://stackoverflow.com/a/21701599
has comment: http://stackoverflow.com/comment/32811056
linked to: http://stackoverflow.com/q/21673618
has body: package lia.meetlucene; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.Directory; import org.apache.lucene.util.Version; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.io.FileReader; public class Indexer { public static void main(String[] args) throws Exception { if (args.length != 2) { throw new IllegalArgumentException("Usage: java " + Indexer.class.getName() + " &lt;index dir&gt; &lt;data dir&gt;"); } String indexDir = args[0]; //1 String dataDir = args[1]; //2 long start = System.currentTimeMillis(); Indexer indexer = new Indexer(indexDir); int numIndexed; try { numIndexed = indexer.index(dataDir); } finally { indexer.close(); } long end = System.currentTimeMillis(); System.out.println("Indexing " + numIndexed + " files took " + (end - start) + " milliseconds"); } private IndexWriter writer; public Indexer(String indexDir) throws IOException { Directory dir = FSDirectory.open(new File(indexDir)); writer = new IndexWriter(dir, //3 new StandardAnalyzer( //3 Version.LUCENE_30),//3 true, //3 IndexWriter.MaxFieldLength.UNLIMITED); //3 } public void close() throws IOException { writer.close(); //4 } public int index(String dataDir) throws Exception { try{ File[] files = new File(dataDir).listFiles(); for (File f: files) { ************************************************ if(f.isDirectory()) // I added this if block which is causing error { index(dataDir); } ************************************************ else if (!f.isDirectory() &amp;&amp; !f.isHidden() &amp;&amp; f.exists() &amp;&amp; f.canRead() ) { indexFile(f); } } } catch (IOException e) { e.printStackTrace(); } return writer.numDocs(); //5 } protected Document getDocument(File f) throws Exception { Document doc = new Document(); doc.add(new Field("contents"…
has comment: http://stackoverflow.com/comment/32810906
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: indexing
has answer: http://stackoverflow.com/a/21701599

http://stackoverflow.com/comment/32776452
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21681547
has text: My design is like writing the javascript code in client as string and passing it to client. This works once, when application runs. However, if I try to do it with button click, the content of javascript function does not change. Js function does not call bean method and so it does not get the new content of string.
score: 0

http://stackoverflow.com/a/21764401
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32949737
has body: For this purpose only gwt introduced concept of layout panels. Use RootLayout Panel and other layout panels. Then your applications won't have body scrolls if you maintain the hierarchy. Layout panels also resizes child widgets on browser resize. So you will get an added advantage EDIT If you want a fixed header and scroll on the rest of the part, use RootLayoutPanel and add DockLayoutPanel to it. Set your header panel to dockPanel North side and add scroll panel to the center of the dockPanel FlowPanel headerPanel = new FlowPanel(); headerPanel.setWidth("100%"); ScrollPanel bodyPanel = new ScrollPanel(); DockLayoutPanel myApp = new DockLayoutPanel(Unit.PX); myApp.addNorth(headerPanel, 100); myApp.add(bodyPanel); RootLayoutPanel.get().add();
has comment: http://stackoverflow.com/comment/32926921
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21758400
type: Answer
answers question: http://stackoverflow.com/q/21758400
has comment: http://stackoverflow.com/comment/33038035

http://stackoverflow.com/a/21828856
has comment: http://stackoverflow.com/comment/33072680
score: 1
has comment: http://stackoverflow.com/comment/33055471
has comment: http://stackoverflow.com/comment/33050478
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33169881
accepted answer of: http://stackoverflow.com/q/21803987
has body: If you are just focussing on developping an new algorithm, you might have a look at the Trafficmining framework that does all the parsing etc. for you and you just need to code the nessesary java components for your custom behaviour.
answers question: http://stackoverflow.com/q/21803987
has comment: http://stackoverflow.com/comment/33144689
type: Answer
has comment: http://stackoverflow.com/comment/33057339
has comment: http://stackoverflow.com/comment/33145015
upvote count: 1
has comment: http://stackoverflow.com/comment/33144525

http://stackoverflow.com/comment/33085794
score: 0
comment on: http://stackoverflow.com/q/21833536
type: Comment
has text: Yes my application has an angular front end so I have opted for protractor to test the UI. Whereas I have already written a program in Java that extract some data by calling a REST api and extracting specefic data from a JSON response.
type: QuestionComment

http://stackoverflow.com/q/21689780
has title: Connection timeouts to HTTPS URLs
type: AnsweredQuestion
tagged with: https
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21690131
tagged with: ssl
score: 4
has body: I'm needing to ignore all SSL certificates in Java, but I can't for the life of me get it to work. I've looked through the following pages listed below already, but nothing seems to work on every https link. stackoverflow.com/questions/19517538/ignoring-ssl-certificate-in-apache-httpclient-4-3 stackoverflow.com/questions/13470998/ignoring-ssl-validation-in-java stackoverflow.com/questions/12060250/ignore-ssl-certificate-errors-with-java stackoverflow.com/questions/2694281/ignore-certificate-errors-when-requesting-a-url-in-java stackoverflow.com/questions/6681969/java-ignore-certificate-validation www.nakov.com/blog/2009/07/16/disable-certificate-validation-in-java-ssl-connections/ code.google.com/p/misc-utils/wiki/JavaHttpsUrl www.exampledepot.8waytrips.com/egs/javax.net.ssl/TrustAll.html www.obsidianscheduler.com/blog/ignoring-self-signed-certificates-in-java/ java.dzone.com/articles/how-ignore-cert-and-host-name gist.github.com/henrik242/1510165 I have a good reason for needing to do this so don't worry, but I really need to be able to do it. Basically, I'm needing to go through a list of internal https links and check to make sure that they are all still valid and aren't broken links. Some links works fine since the Java code ignores the certificate and can get an HTTP response header back, but others just timeout even though they work fine in my web browser. All of these links are internal company links. I've tried using HttpsURLConnection as well as HttpGet and HttpClient. Could there be something else that I'm not thinking of, or something unrelated to Java that could be causing the pages to timeout? I just want to make sure the URL of the link exists. Here are the exceptions I am getting. With HttpGet/SSLContextBuilder/PoolingHttpClientConnectionManager: org.apache.http.conn.HttpHostConnectException: Connect to -removed- [-removed-] failed: Connection timed out: connect With HttpsUrlConnection using X509TrustManager: java.net.ConnectException: Connection time…
upvote count: 4
linked to: http://stackoverflow.com/q/19517538
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21690131

http://stackoverflow.com/comment/32828878
comment on: http://stackoverflow.com/q/21710770
has text: Please shorten your question to just include relevant code. No need to dump everything which is not even relevant to the question
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32959075
type: QuestionComment
score: 0
has text: Well, even if it does improve, the question still remains; why is the tree faster than the table, considering both have the same styles, providers etc.
type: Comment
comment on: http://stackoverflow.com/q/21776282

http://stackoverflow.com/a/21795929
answers question: http://stackoverflow.com/q/21795810
score: 0
type: AcceptedAnswer
has body: Try like this: package com.example.goldennuggetnlapp; import android.view.View; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.app.Activity; import android.os.Bundle; 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); } /** Called when the user clicks the Send button */ public void sendMessage(View view) { // Do something in response to button } public void myClickHandler(View v){ startActivity(new Intent(this, InformationActivity.class)); } // more code goes here }
accepted answer of: http://stackoverflow.com/q/21795810
type: Answer

http://stackoverflow.com/a/21821143
has body: I do not believe that an exact equivalent of AffineTransform.createTransformedShape was added to Java 8. You can however apply a transform to a shape by adding a transform to the shape's transform list. So in a way, a transformed shape is just a shape with some custom transforms in it's transform list. The Transform functions in JavaFX were greatly enhance for Java 8 allowing composition of transformations. In addition various vector like algebraic operations were added the Point2D and Point3D classes.
answers question: http://stackoverflow.com/q/21819208
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33058926
accepted answer of: http://stackoverflow.com/q/21819208
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/33055198
type: Comment
comment on: http://stackoverflow.com/a/21833834
has text: There are two classes, `TExtensibleServlet extends HttpServlet`, which seem to be the way to go. There's some more documentation over here http://people.apache.org/~thejas/thrift-0.9/javadoc/org/apache/thrift/server/TExtensibleServlet.html Haven't used it myself.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21713180
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21712543
has body: I recommend to avoid any DAO and to use plain Command design pattern instead. If you use JPA then you do not need to worry about JDBC because it supports native queries of any type and JPA is smart enough to avoid stale object in JPA query after update via native query. JPA query API is already the Command design pattern but you can define wrapper commands to hide EntityManager API for convenience, it can also help to upgrade to newer JPA version later. Commands can help to demarcate transactions and reuse query result processing code. If it does not convince and you decided to use DAO anyways then you can use Spring DAO wrappers, they might be useful for transactions but command design pattern helps to avoid it. You can find links to DAO framework implementations in this answer DAO implementations

http://stackoverflow.com/comment/32918931
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21761788
score: 0
has text: Negation in the sense that product does contain sodium or does not contain sodium. In such a case, given a product description, I need to identify if the description contains sodium or phrases like does not contain sodium or no sodium etc @Jerry

http://stackoverflow.com/comment/33030722
type: AnswerComment
has text: I don't know what program language of that application. I used three app follow: http://www.phonetray.com/, http://www.janrufmonitor.de/downloads.html and http://www.jam-software.com/smartcallmonitor/?language=EN
type: Comment
comment on: http://stackoverflow.com/a/21824213
score: 0

http://stackoverflow.com/comment/33060867
type: QuestionComment
comment on: http://stackoverflow.com/q/21787821
has text: @RomanC, you don't see it, but there is a `<default-interceptor-ref name="defaultStack"/>` for the whole action package.
score: 0
type: Comment

variables
tag name: variables
tags question: http://stackoverflow.com/q/21708765
tags question: http://stackoverflow.com/q/21736222
tags question: http://stackoverflow.com/q/21755138
tags question: http://stackoverflow.com/q/21813279
tags question: http://stackoverflow.com/q/21807016
tags question: http://stackoverflow.com/q/21761881
tags question: http://stackoverflow.com/q/21800018
tags question: http://stackoverflow.com/q/21765702
tags question: http://stackoverflow.com/q/21783857
tags question: http://stackoverflow.com/q/21810240
type: Tag
tags question: http://stackoverflow.com/q/21755124
tags question: http://stackoverflow.com/q/21714953
tags question: http://stackoverflow.com/q/21799602
tags question: http://stackoverflow.com/q/21734517
tags question: http://stackoverflow.com/q/21836049
tags question: http://stackoverflow.com/q/21769060
tags question: http://stackoverflow.com/q/21770284
tags question: http://stackoverflow.com/q/21754768
tags question: http://stackoverflow.com/q/21819118
tags question: http://stackoverflow.com/q/21723766
tags question: http://stackoverflow.com/q/21803033
tags question: http://stackoverflow.com/q/21803807
tags question: http://stackoverflow.com/q/21719805

http://stackoverflow.com/comment/32859575
comment on: http://stackoverflow.com/a/21703449
has text: I was working it yesterday. I'll check it out again in a bit. I'll let you know.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33059243
has text: And what line throws this exception?
type: Comment
comment on: http://stackoverflow.com/q/21840642
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32838855
type: Comment
comment on: http://stackoverflow.com/a/21706508
has text: @JacekLaskowski I don't understand your question, but my answer still says that you cannot do it without using a `for` loop.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32802970
comment on: http://stackoverflow.com/q/21696253
type: Comment
type: QuestionComment
score: 0
has text: @Simon the down votes were are a sign this question is hard to understand. If you think that it's a good question then it helps to edit the question so that other's can see that. Just commenting doesn't (always) do the trick.

jsf-2
tags question: http://stackoverflow.com/q/21761155
type: Tag
tags question: http://stackoverflow.com/q/21774615
tags question: http://stackoverflow.com/q/21703424
tag name: jsf-2
tags question: http://stackoverflow.com/q/21781771
tags question: http://stackoverflow.com/q/21681014
tags question: http://stackoverflow.com/q/21689074
tags question: http://stackoverflow.com/q/21726778
tags question: http://stackoverflow.com/q/21775170
tags question: http://stackoverflow.com/q/21757312
tags question: http://stackoverflow.com/q/21838950
tags question: http://stackoverflow.com/q/21788667

http://stackoverflow.com/q/21819923
has comment: http://stackoverflow.com/comment/33022903
upvote count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: autowired
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/33022767
has body: I am new to Spring. I am working on an existing application which is in SpringFramework. I have a class named Author &amp; a method getBigImage in the Author class. class Author { public String getBigImage() { if(!CollectionUtils.isEmpty(this.av)) { for(Av av : this.av) if(av.getSize() == 136 &amp;&amp; av.getImage() != null ) return av.getImage(); } return null; } } Av class looks like this: class Av { public String getImage() { return image; } public void setImage(String image) { this.image=image; } } I am trying to access getBigImage() of the author class by creating Author object Author auth = new Author(); auth.getBigImage(); But I understand that as I'm creating new auth object auth.getBigImage() would be null because it ain't set. But the whole application uses @autowired &amp; I'm a little confused as the application is too big. In that case can you tell me what exactly should I be doing to get the Author image?
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/33026604
answer count: 1
has title: Creating an object shows null value. How do I correctly autowire?
favorite count: 0
has answer: http://stackoverflow.com/a/21828599
downvote count: 1

http://stackoverflow.com/a/21805854
type: AcceptedAnswer
downvote count: 0
has body: Well, your architecture is simple (that's good), just let me suggest you some concepts that fits with your future intentions. The way how you think the app could be something like: UI -> boundary -> control -> entity from the technology view, is something like: Vaadin (MVC/P) -> EJB's -> CDI Objects -> JPA Entities. The main advantages with this approach are : Your UI could be anything you like (JSF, GWT, Vaadin...), and is not tied to the service layer. The boundary express the contracts that offers your service layer, it is, you could reuse this boundary and give it any kind of exposure that you need, this would be a rest-boundary, webservice-boundary, rmi-boundary, so on, any kind of protocol that you need. With the EJB as your boundary, you can initiate asynchronous methods, JMS consumers, enforces security at service layer and use the timer service. The CDI controls will let you use dependency injection in fancy ways (did you know the configurator pattern? > http://www.adam-bien.com/roller/abien/entry/how_to_configure_java_ee) , and if you have a business problem that requires a kind of pattern (factory, template method, complex inheritance, producers ....) CDI lets you implements all of this in expressive ways. Without mention that EJB + CDI is a deal breaker!. The Controls are orchestrated by the boundary and its behaviour should be well encapsulated. Obviously your boundary could use as many controls as necesary, but no over-engineering, if with just one boundary is enough, well, keep it simple. Finally the JPA entities, try to express has much business concepts as possible, if you have an inheritance between relations, dont be afraid to implement it with JPA. This will save you boilerplate code, remove duplication across the system and easier to work with. (tip: try to use the bean validation spec.) note: this is based in SOA concepts (i.e. @Stateless EJB's), if your app is more RIA oriented, could be useful for you learn how to use the @Stateful EJB's (Gat…
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21804438
answers question: http://stackoverflow.com/q/21804438
score: 2

http://stackoverflow.com/q/21783446
has comment: http://stackoverflow.com/comment/32961688
score: 2
tagged with: android
favorite count: 0
tagged with: shader
has comment: http://stackoverflow.com/comment/33030834
tagged with: opengl-es-2.0
has title: Could a vertex shader be used for a page turn effect?
has answer: http://stackoverflow.com/a/21834412
has comment: http://stackoverflow.com/comment/33029888
type: AnsweredQuestion
upvote count: 5
tagged with: java
downvote count: 3
has body: I've done Open GL ES in the past, but quite a while ago. From what I'm reading now, it seems there is a lot more emphasis on managing your own matrix stacks and pushing your matrices directly into a vertex shader to position your objects. This is all well and good, but I'm just wondering how far you're meant to go with shaders. I don't know if they are only for simple things, or can I use them for a page turn effect. There will definitely be a lot of math that needs to be calculated. It feels like this is a good place to do it, but I don't have the experience to know if there are any gotchas with this. I was going to input a point which maps to a finger position to the shader, then the shader would offset each vertex in a mesh which makes up the page, based on the finger position. I'm going to attempt this in an Android App with OpenGl ES 2.0. So, The Question Does this seem like a reasonable approach and if not, what would be the best way of getting the most out of the graphics chip given the effect I require and moden OpenGL APIs? What I've researched so far I've read through a number of blogs and tutorials, including Tutorials for Modern Open GL, but the shaders are always for lighting or just basic positioning. I'm thinking the calculations for a page turn effect might require more math than are in the shaders I've seen, but I don't know how much math in a shader would be too much! I know I should just give this a go and see, but I've got a bit of time until this project starts and I was just really researching at the moment! Update Just as an update, I recently found out there is an instruction limit for shaders, so one requirement will be that I am able to get all my page turn math within the instruction limit.
type: Question
has comment: http://stackoverflow.com/comment/33029863
accepted answer: http://stackoverflow.com/a/21834412
answer count: 1

http://stackoverflow.com/comment/33712580
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21685497
score: 0
has text: @IraBaxter Just what I'm looking for! And by the way, when I said 'desktop', I meant programming languages designed to target desktop platform. Not web-ones like JavaScript and PHP, while C++ and Delphi target desktop platforms.

http://stackoverflow.com/a/51609037
score: 0
has body: Simply use Java 8 Stream collectors groupby function: import java.util.function.Function; import java.util.stream.Collectors; static String[] COUNTRY_NAMES = { "China", "Australia", "India", "USA", "USSR", "UK", "China", "France", "Poland", "Austria", "India", "USA", "Egypt", "China" }; Map&lt;String, Long&gt; result = Stream.of(COUNTRY_NAMES).collect( Collectors.groupingBy(Function.identity(), Collectors.counting()));
type: Answer
answers question: http://stackoverflow.com/q/21771566

http://stackoverflow.com/comment/33060369
score: 0
has text: @njzk2 my signal strength would be placed there. I am confused, where should I keep it then ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21841159

http://stackoverflow.com/comment/32876486
comment on: http://stackoverflow.com/q/21737726
has text: @user1121883 I think this is more an issue of code cleanliness more than optimization. At least, it should be if it's only a few dozen connections.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21724468
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/32856338
has answer: http://stackoverflow.com/a/21745599
tagged with: java-6
answer count: 1
has title: merge XML using STAX XMLStreamWriter
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has body: I have created an XML using STAX and XMLStreamWriter. It works fine. I need to merge two xml together. The problem that I am facing is the patient Pojo returns me XML containing all the patient information is below <Patient> 3333344 <Name> pillai dhanya <Name> <Patient> I need to add this into existing XML after <proID> like merging. <?xml version="1.0" ?> <proID>123</prodID> Please advice
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/32890243

http://stackoverflow.com/a/21841836
has body: @ClientEndpoint annottation is part of the spec, so I'd suggest to use that, here is a good tutorial , see step 4 and 6 . Step 6 from Openshift tutorial @ClientEndpoint public class WordgameClientEndpoint { private static CountDownLatch latch; private Logger logger = Logger.getLogger(this.getClass().getName()); @OnOpen public void onOpen(Session session) { // same as above } @OnMessage public String onMessage(String message, Session session) { // same as above } @OnClose public void onClose(Session session, CloseReason closeReason) { logger.info(String.format("Session %s close because of %s", session.getId(), closeReason)); latch.countDown(); } public static void main(String[] args) { latch = new CountDownLatch(1); ClientManager client = ClientManager.createClient(); try { client.connectToServer(WordgameClientEndpoint.class, new URI("ws://localhost:8025/websockets/game")); latch.await(); } catch (DeploymentException | URISyntaxException | InterruptedException e) { throw new RuntimeException(e); } } } in this example they are using tyrus, which is the reference implementation for websockets in java, so I think that meets your requirement of a well backed websocket implementation.
score: 10
upvote count: 10
answers question: http://stackoverflow.com/q/21838940
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32793820
type: Comment
comment on: http://stackoverflow.com/a/21691098
has text: Ya, but in your code above you had the location of your `switch` in the correct location. The problem was that you were never asking for another choice from the user. So after the `switch` (because that's where the choices are) you need to ask again so when your program checks to see if it needs to continue, `choice` has been changed and has a possibility to make the condition `false` (look at my in my post). Also, I'm assuming it was a typo, 270 isn't the average of three 90s...it should be 90.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21834095
score: 0
answers question: http://stackoverflow.com/q/21832243
type: Answer
has body: Most likely whats going on here is an issue with the + operator and types that may or may not be Strings. Assuming you want string concatenation (long arithmetic would lead to collisions I think you're trying to avoid), coercing your key arguments to Strings may resolve the problem. Ala: &lt;!-- cache definitions --&gt; &lt;cache:advice id="cacheAdvice" cache-manager="cacheManager"&gt; &lt;cache:caching cache="refs"&gt; &lt;cache:cacheable method="findById" key="#root.targetClass.name + #id.toString()"/&gt; &lt;/cache:caching&gt; &lt;/cache:advice&gt;
has comment: http://stackoverflow.com/comment/33072588

http://stackoverflow.com/q/21757158
has comment: http://stackoverflow.com/comment/32910512
has answer: http://stackoverflow.com/a/21758196
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21758407
has comment: http://stackoverflow.com/comment/32910370
has title: How to overwrite the value of a string in java?
has comment: http://stackoverflow.com/comment/32911792
tagged with: string
has comment: http://stackoverflow.com/comment/32911810
has comment: http://stackoverflow.com/comment/32913766
tagged with: console
score: 0
has comment: http://stackoverflow.com/comment/32910960
has comment: http://stackoverflow.com/comment/32913231
has comment: http://stackoverflow.com/comment/32913167
has comment: http://stackoverflow.com/comment/32911003
has comment: http://stackoverflow.com/comment/32910956
has comment: http://stackoverflow.com/comment/32910637
has body: I have a string idnum. I add a value to that string using the code below. The function show() displays the value of the string in the console. I wish to have a function that can edit the value of string idnum in the console, without having to exit the console. How do I do that? I am thinking of overwriting the value of the string. Is that possible? How do I overwrite the value of a string in the console? public void addstudent(){ student p = null; reader1 = new BufferedReader(new InputStreamReader(System.in)); System.out.print("ID Number: "); String idnum = null; try { idnum = reader1.readLine(); } catch (IOException e){ e.printStackTrace(); } p = new student(idnum); studentList.add(p); show(); } I have this code for the search part public void searchstudent(){ System.out.print("search name : "); try{ searchName = reader1.readLine();} catch (IOException e){e.printStackTrace();} searchCount = 0;//for search for(int i = 0; i&lt;count; i++){ if(studentList.get(i).getLName().toLowerCase().contains(searchName.toLowerCase(‌​))){ searchCount = i; System.out.println(studentList.get(searchCount).getLName()); } } }
has comment: http://stackoverflow.com/comment/32914665
accepted answer: http://stackoverflow.com/a/21758407
has comment: http://stackoverflow.com/comment/32912945
has comment: http://stackoverflow.com/comment/32911867
has comment: http://stackoverflow.com/comment/32912628
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/32912849
has comment: http://stackoverflow.com/comment/32910406
has comment: http://stackoverflow.com/comment/32914017
has comment: http://stackoverflow.com/comment/32910457
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32912687
has comment: http://stackoverflow.com/comment/32910702
has comment: http://stackoverflow.com/comment/32914420
tagged with: java
has comment: http://stackoverflow.com/comment/32914777
has comment: http://stackoverflow.com/comment/32933619
possible better answer: http://stackoverflow.com/a/21758196
has comment: http://stackoverflow.com/comment/32917468

http://stackoverflow.com/comment/32919270
type: Comment
comment on: http://stackoverflow.com/a/21761209
score: 1
has text: A little explanation can go a long way.
type: AnswerComment

http://stackoverflow.com/a/21768451
downvote count: 0
has comment: http://stackoverflow.com/comment/32931685
score: 1
has comment: http://stackoverflow.com/comment/32931723
has comment: http://stackoverflow.com/comment/32931445
upvote count: 1
type: Answer
has body: Here is a much better way to look through an array for consecutive numbers. This will work for both unsorted and sorted arrays. public static int consecutiveEqualElements(int [] elements) { int currentNum = elements[0]; int currentConsecutive = 1; int maxConsecutive = 1; for (int i = 1; i &lt; elements.length; i++) { if (elements[i] == currentNum) { currentConsecutive++; maxConsecutive = Math.max(maxConsecutive, currentConsecutive); } else { currentNum = elements[i]; currentConsecutive = 1; } } return maxConsecutive; }
answers question: http://stackoverflow.com/q/21768291

http://stackoverflow.com/a/21770938
score: 0
has comment: http://stackoverflow.com/comment/32935609
has comment: http://stackoverflow.com/comment/32935578
answers question: http://stackoverflow.com/q/21770875
has body: Because you are using the for loop for(int i = 0; i &lt; array.size(); i++){ out.print(array.get(i).toString()); } it will print the one - by - one for the requirement format you just have to use the below code.. StringWriter out = new StringWriter(); jsonArray.writeJSONString(out); String jsonText = out.toString(); out.print(jsonText);
type: Answer
has comment: http://stackoverflow.com/comment/32935628

http://stackoverflow.com/q/21837016
tagged with: many-to-many
tagged with: java
tagged with: hibernate
tagged with: database
has comment: http://stackoverflow.com/comment/33053028
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21837381
has comment: http://stackoverflow.com/comment/33054293
linked to: http://stackoverflow.com/q/8066109
has comment: http://stackoverflow.com/comment/33052950
score: 0
has body: I need to build a little program that will be able to handle a data of students and courses they have enrolled. The functionality is not that complicated, I want to be able to get the course's average and median, student's average and stuff like that. So I've read a lot about hibernate and databases, but I have no experience with that (For the record, I obviously don't mind open one of the billion toturials online and learn that by myself, I just need the project to get done by the end of the week). So I wonder if there is any efficient way to build such program using java classes only? I mean, how can I handle many-to-many relationship without databases in smart way?
has title: Avoiding hibernate & databases in many-to-many relationship implementation
answer count: 1

http://stackoverflow.com/comment/32777721
has text: Does the postgres server need to be on the same machine as your app?
type: Comment
comment on: http://stackoverflow.com/q/21681436
score: 0
type: QuestionComment

int
tags question: http://stackoverflow.com/q/21817155
tags question: http://stackoverflow.com/q/21833242
tags question: http://stackoverflow.com/q/21820476
tags question: http://stackoverflow.com/q/21790960
tags question: http://stackoverflow.com/q/21816440
type: Tag
tags question: http://stackoverflow.com/q/21682193
tags question: http://stackoverflow.com/q/21742268
tags question: http://stackoverflow.com/q/21792460
tags question: http://stackoverflow.com/q/21717426
tags question: http://stackoverflow.com/q/21693809
tags question: http://stackoverflow.com/q/21770137
tag name: int
tags question: http://stackoverflow.com/q/21743197
tags question: http://stackoverflow.com/q/21809688
tags question: http://stackoverflow.com/q/21800399
tags question: http://stackoverflow.com/q/21769350

http://stackoverflow.com/q/21717842
tagged with: java
has title: Missing Library from Java Project
has body: On the following line: import com.sun.rave.web.ui.appbase.AbstractPageBean; I am receiving the error: "com.sun.rave.web.ui.appbase does not exist" when i hover over it. public class SessionBean1 extends AbstractPageBean { Could the problem be that the program was made with an earlier version of NetBeans and the version I'm using now doesn't support some of the libraries that were used in an earlier version? This was programmed in 7.2 and I'm now using 7.4.
has answer: http://stackoverflow.com/a/27691285
has comment: http://stackoverflow.com/comment/32842623
type: Question
has comment: http://stackoverflow.com/comment/32841365
upvote count: 1
answer count: 1
tagged with: netbeans-7
has comment: http://stackoverflow.com/comment/32843093
favorite count: 0
has comment: http://stackoverflow.com/comment/32843000
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32841890
tagged with: jakarta-ee
score: 1

http://stackoverflow.com/a/26684826
upvote count: 1
has body: I solved this when I did not called my own method in the onCreate method of the Activity like the init() method in sample code in the answer below. So I have to put all my code inside the onCreate. From there you will see what is the culprit like a NullPointerException for example but your code will run smoothly already.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21826670

http://stackoverflow.com/q/21818211
has body: I'm looking for Java libraries of the Reed Solomon algorithm. What I need is to partition a given file in different chunks with redundancy. So, after partitioning in N chunks, I can re-build the file with just K of these chunks (Where k &lt; N). This is supposed to be one of the key features of Reed Solomon. This is what I have tried: I found zxing, I downloaded the core-x.x.jar and run the tests successfully in my computer. But, by reading the code I realised that it was written to only support QR codes. I have tried this library also, but it does not work properly and it has not been updated in the last 4 years. I'm starting this project and I want to do it in Java; however, since the only library highly supported is written in Python I might just do the whole project in Python (I would rather not). This is the zfec library. Any hints on a Java library?
has comment: http://stackoverflow.com/comment/33352832
has answer: http://stackoverflow.com/a/21840833
tagged with: file
upvote count: 1
downvote count: 1
type: Question
tagged with: reed-solomon
has comment: http://stackoverflow.com/comment/33352204
tagged with: java
has comment: http://stackoverflow.com/comment/33352930
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21840833
has title: Reed Solomon Java Library - Partitioning files with redundancy
favorite count: 0
has comment: http://stackoverflow.com/comment/33352546
has comment: http://stackoverflow.com/comment/33020442
has comment: http://stackoverflow.com/comment/33353401
tagged with: redundancy
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22004817
accepted answer: http://stackoverflow.com/a/22004817

http://stackoverflow.com/comment/32989189
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21801256
has text: http://stackoverflow.com/questions/1299837/cannot-refer-to-a-non-final-variable-inside-an-inner-class-defined-in-a-differen
score: 0

http://stackoverflow.com/comment/33037101
has text: Numbers followed by only one or arbitrary number of characters?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21828466

http://stackoverflow.com/a/21726486
answers question: http://stackoverflow.com/q/21695442
type: Answer
downvote count: 0
has body: You are running the shell script from a different directory, and there is something in your code that expects the start-up script to start specifically in /root/jbossDirectory. A simple workaround would be to edit startJbossScript.sh and add cd /root/jbossDirectory as the first line.
score: 1
accepted answer of: http://stackoverflow.com/q/21695442
upvote count: 1
type: AcceptedAnswer

slidingmenu
tag name: slidingmenu
type: Tag
tags question: http://stackoverflow.com/q/21729640

http://stackoverflow.com/q/21746658
tagged with: ondraw
answer count: 1
downvote count: 0
has body: I'm trying to load a picture to paint on top of in an Android app but can't seem to load the to paint on top of. The ErrorLog for activity_main.xml tells me I have a problem in my onDraw() method in my custom views class at the line canvas.drawBitmap(mBitmap,0,0,mBitmapPaint);` activity_main.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android: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;edu.berkeley.cs160.opalkale.prog2.DrawingView android:id="@+id/drawing" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_marginBottom="3dp" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginTop="3dp" android:layout_weight="1" android:src="@drawable/crayon" /&gt; &lt;/LinearLayout&gt; My MainActivity.java file: package edu.berkeley.cs160.opalkale.prog2; import android.os.Bundle; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.crayon); Canvas canvas = new Canvas (mBitmap); //DrawingView drawingView = (DrawingView)findViewById(R.id.drawing); } @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 Custom View class: impor…
favorite count: 0
has title: NullPointerException Android Drawing app in onDraw() method?
has answer: http://stackoverflow.com/a/21746689
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/32892421
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/21746689
type: Question

http://stackoverflow.com/q/21705677
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32825205
has body: I am facing serious issue with sql server, when I am dealing with one billion records. It is crashing production server. My Approach: =========== 1.Used jtds sourceforge datasource. 2.In my code, con.setAutoCommit(false); pstmt = con.prepareStatement( query); pstmt.setFetchSize(10000); Somehow, sql server is ignoring fetch size hint I am specifying here and taking all the memory in server. Am i doing anything wrong here? Do we have any alternative approach to solve this? Please suggest me. Thanks in advance.
tagged with: java
type: Question
has title: sql server when dealing with huge data using jdbc
score: 0
tagged with: sql-server-2008
tagged with: jdbc
has comment: http://stackoverflow.com/comment/32819154

http://stackoverflow.com/comment/32972877
type: Comment
has text: While your point is valid (blocking Netty's IO threads IS bad), I don't think that it's the source of my issue. Authentication only happens for the first PDU after which thousands of PDUs don't block. Your second example shows why I want to use a DEEG. The EventLoop sharing thingy is something that I will look up.
comment on: http://stackoverflow.com/a/21791625
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32927041
type: AnswerComment
has text: @eis A local class IS A nested class that is nested inside of a method.
comment on: http://stackoverflow.com/a/21766251
type: Comment
score: 0

http://stackoverflow.com/comment/32773822
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21679715
has text: *"Is there any other methods for positioning an image in a `JLabel`?"* DYM without a `JTextPane`? Certainly are, and it is easier than positioning an image in a `JTextPane`. Provide more details of how the image should be positioned, and especially what should happen when the GUI is resized.
score: 1

zest
tags question: http://stackoverflow.com/q/21698420
tag name: zest
type: Tag

http://stackoverflow.com/q/21793642
has comment: http://stackoverflow.com/comment/32976015
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/21810803
has title: Grails WEB-INF accessible from Deployed app
has body: In grails application, one can access the WEB-INF contents including all the .gsp content as well as .class file when deployed. I am using grails 2.3.5 and deploying the war in the tomcat 7. You can access the files using http://mydomain.com/static/WEB-INF/web.xml http://mydomain.com/static/WEB-INF/grails-app/views/anyview.gsp http://mydomain.com/static/WEB-INF/grails-app/i18n/messages.properties http://mydomain.com/static/WEB-INF/classes/anyclass.class Can I disable access to these url in grails?
has comment: http://stackoverflow.com/comment/32977500
tagged with: web-inf
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32976068
upvote count: 3
has comment: http://stackoverflow.com/comment/32975976
tagged with: java
accepted answer: http://stackoverflow.com/a/21810803
type: Question
score: 3
has comment: http://stackoverflow.com/comment/32976101
tagged with: grails

http://stackoverflow.com/comment/32864644
comment on: http://stackoverflow.com/q/21731463
type: QuestionComment
has text: why are you saying it doesn't work. please provide stacktrace
type: Comment
score: 2

http://stackoverflow.com/comment/32808483
score: 1
comment on: http://stackoverflow.com/q/21699270
has text: Are you connected to the internet while building? It can be some missing package that needs to be downloaded. Try to `clean&build`.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21755112
has answer: http://stackoverflow.com/a/21755155
answer count: 4
has comment: http://stackoverflow.com/comment/32906578
type: UnansweredQuestion
tagged with: incompatibletypeerror
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32966901
has answer: http://stackoverflow.com/a/21755194
has title: Error: Incompatible types? How else could i do this?
has body: public static int linearSearch(int[] data, int numToFind) { int found=-1; for (int x=0;x&lt;data.length;x++){ **if(data[x] =numToFind)** found = x ; break; } return found; } Where I have my error it says its an incompatible type at if(data[x]=numToFind)
score: 0
has answer: http://stackoverflow.com/a/21755175
has answer: http://stackoverflow.com/a/21755205

http://stackoverflow.com/a/21820774
downvote count: 0
score: 1
has body: If you store and calculate all money values in cents, you can safely use int (or long for very large amounts). The banking industry (EFTPOS especially) uses cents, and if it's good enough for them it should be OK for you too. You only render the number as a decimal number of dollars with currency symbol.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21820598

http://stackoverflow.com/a/21698892
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32807055
answers question: http://stackoverflow.com/q/21698734
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32813228
has body: finally will run in either case, also during normal return without exceptions. And you call .close in the finally statement clause. So your code always returns the closed stream. Probably this is not that you intend. Your description ("jumps to finally statement") still looks very much like a exception has been thrown by urlConn.getInputStream(). Strange you do not observe it.

http://stackoverflow.com/q/21691402
has comment: http://stackoverflow.com/comment/32794422
upvote count: 2
tagged with: collections
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32794339
has answer: http://stackoverflow.com/a/21691465
downvote count: 0
answer count: 1
tagged with: sorting
has title: java Collections.binarySearch() returning -2
favorite count: 0
tagged with: binary-tree
has comment: http://stackoverflow.com/comment/32794343
has body: I have a text file which contains student information. I sort this information using the comparator class which implements the comparator interface.This sorts fine fine when calling Collection.Sort(); I then use the comparator in the binarySearch() method. I have an int index that returns the index of the binary search. after debugging it seems that the binarySearch() isnt sorting the data properly because I get an index of 0 for 501 which is correct, an index of 1 for 503 which is incorrect and an index of -2 for 502. Is the binarySearch not using the comparator apppropriately and thus not sorting the data appropriately as its returning the data in its original form. ================================================= First Name: Mark Last Name: Evans Registration: 501 Subject: Maths Assignment: 1 Homewok Mark: 70 Exam Mark: 80 Assignment: 2 Homewok Mark: 70 Exam Mark: 40 Subject: English Assignment: 1 Homewok Mark: 40 Exam Mark: 50 Assignment: 2 Homewok Mark: 60 Exam Mark: 70 Subject: Science Assignment: 1 Homewok Mark: 50 Exam Mark: 60 Assignment: 2 Homewok Mark: 80 Exam Mark: 45 Assignment: 3 Homewok Mark: 67 Exam Mark: 47 Assignment: 4 Homewok Mark: 38 Exam Mark: 57 ================================================= First Name: Linda Last Name: Evans Registration: 503 Subject: Maths Assignment: 1 Homewok Mark: 50 Exam Mark: 60 Assignment: 2 Homewok Mark: 70 Exam Mark: 50 ================================================= First Name: Joseph Last Name: Evanw Registration: 502 Subject: English Assignment: 1 Homewok Mark: 40 Exam Mark: 50 I have a comparator class that works fine and sorts the data appropriately. public class StudentComparator implements Comparator&lt;Student&gt; { @Override public int compare(Student s1, Student s2) { int registrationNumber1 = s1.getRegistrationNumber(); int registrationNumber12 = s2.getRegistrationNumber(); return registrationNumber1 - registrationNumber12; } } public void searchStudentByName() { int number = 503; int subjectNumber =…
accepted answer: http://stackoverflow.com/a/21691465
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32794378

http://stackoverflow.com/q/21741619
answer count: 4
has comment: http://stackoverflow.com/comment/32883476
favorite count: 0
possible better answer: http://stackoverflow.com/a/21741752
score: -3
has answer: http://stackoverflow.com/a/29269730
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32883417
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/21741667
has answer: http://stackoverflow.com/a/21741770
type: Question
has comment: http://stackoverflow.com/comment/32883482
upvote count: 0
has comment: http://stackoverflow.com/comment/32883516
has comment: http://stackoverflow.com/comment/32883435
tagged with: java-io
has comment: http://stackoverflow.com/comment/32884274
has answer: http://stackoverflow.com/a/21741752
accepted answer: http://stackoverflow.com/a/21741667
has body: public class NestedCountLoop { public static void main(String[] args) { int sum = 0; for (int i = 1; sum &lt; 5050; i++) { sum = sum + i; System.out.println(sum); } } } So I have a little homework assignment for my intro programming class to use a nested loop to accept positive integer input and add all of the integers within the interval from 1 to that input. My mind is playing games with me and I'm having trouble getting going. I know I need a scanner and whatnot, and it has to print every result from 1 to n such as "The sum of 1 to 100 is 5050." Any advice is helpful
has title: Nested for loop sum of integers
has comment: http://stackoverflow.com/comment/32883438

http://stackoverflow.com/a/21831074
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33042205
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21830404
has body: You can use maven resource filtering plugin for dynamically replacing the variable place holders at build time. See Maven Resource Filter Plugin for documentation.
answers question: http://stackoverflow.com/q/21830404

http://stackoverflow.com/q/21747009
tagged with: hadoop
has comment: http://stackoverflow.com/comment/33001404
has comment: http://stackoverflow.com/comment/32893003
tagged with: centos6
score: 0
linked to: http://stackoverflow.com/q/5104817
answer count: 0
type: UnansweredQuestion
tagged with: google-compute-engine
tagged with: hortonworks-data-platform
has title: Updating jdk on Google Compute Engine
has body: I'm trying to have to update my JDK on an instance in Google compute. Basically I am looking to get Hortonworks Hadoop up and running and based on the instructions here. I need: Your system must have the correct JDK installed on all the nodes of the cluster. HDP supports the following JDKs. Oracle JDK 1.6 update 31 64-bit Oracle JDK 7 64-bit OpenJDK 7 64-bit I created an instance and installed Centos 6.5 and when I check the Java version it says: java version "1.5.0" gij (GNU libgcj) version 4.4.7 20120313 (Red Hat 4.4.7-4) How do I update it to 1.6? Or the versions listed above? I see instructions everywhere on how to update to a local system. However, I don't see instructions on updating on a Google compute instance.
tagged with: java
type: Question

http://stackoverflow.com/q/21752539
favorite count: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/32903707
tagged with: ear
tagged with: deployment
has title: Deploy EAR application in Weblogic 12c
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: weblogic12c
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21783565
answer count: 1
downvote count: 0
has body: I have this problem, a application EAR with this error, I am a new administrator with Weblogic 12c, someone help me??? It is a standard installation Weblogic 12c &lt;13-feb-2014 09H53' CET> &lt;[STANDBY] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> &lt;> &lt;> &lt;> &lt;1392281637683> org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath:beanRefContext.xml], factory key [servicelayer-context]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servicelayer-context' defined in class path resource [beanRefContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fwk.abstractSetter$child#0' defined in class path resource [ac-fwk-i18n.xml]: Cannot resolve reference to bean 'fwk.i18n' while setting bean property 'arguments' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fwk.i18n' defined in class path resource [ac-fwk-i18n.xml]: Cannot resolve reference to bean 'fwk.configurationService' while setting bean property 'configuration'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fwk.configurationService' defined in class path resource [ac-fwk-configuration.xml]: Invocation of init method failed; nested exception is es.mercadona.fwk.exceptions.ConfigurationNotFoundException: Error al configurar: SAX Exception caught at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:389) at org.springframework.web.context.ContextLoader.l…

http://stackoverflow.com/comment/32973512
comment on: http://stackoverflow.com/a/21792051
score: 9
type: AnswerComment
type: Comment
has text: As we know all synchronised code are treadsafe, then how Threadsafe defines a method or class instance can be used by multiple threads at the same time without any problems occuring.

http://stackoverflow.com/comment/32980058
type: QuestionComment
has text: Can you explain in what way you want to merge the files?
score: 2
type: Comment
comment on: http://stackoverflow.com/q/21796055

http://stackoverflow.com/a/21813926
downvote count: 0
has comment: http://stackoverflow.com/comment/33012079
accepted answer of: http://stackoverflow.com/q/21813888
has comment: http://stackoverflow.com/comment/33012845
answers question: http://stackoverflow.com/q/21813888
has comment: http://stackoverflow.com/comment/33012788
type: Answer
score: 4
has body: If it always matches exactly that format, then this will suffice: char from = (char)Integer.parseInt(input.substring(0, 4), 16); char to = (char)Integer.parseInt(input.substring(6), 16); For something more flexible: char from; char to; java.util.regex.Matcher m = java.util.regex.Pattern.compile( "^([\\da-fA-F]{1,4})(?:\\s*\\.\\.\\s*([\\da-fA-F]{1,4}))?$").matcher(input); if (!m.find()) throw new IllegalArgumentException(); from = (char)Integer.parseInt(m.group(1), 16); if (m.group(2) != null) { to = (char)Integer.parseInt(m.group(2), 16); } else { to = from; } That allows for 1 to 4 hex digits for each character, the .. may have space around it, and the to part of the range may be omitted and assumed to be equal to from.
has comment: http://stackoverflow.com/comment/36357643
has comment: http://stackoverflow.com/comment/33012136
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/32817464
comment on: http://stackoverflow.com/a/21704721
type: AnswerComment
score: 0
type: Comment
has text: Well for UDP vs TCP you can read : http://www.diffen.com/difference/TCP_vs_UDP It's about speed vs reliability basically.

http://stackoverflow.com/q/21758498
tagged with: kill
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33127956
has comment: http://stackoverflow.com/comment/32960584
has comment: http://stackoverflow.com/comment/32960771
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21758751
score: 1
has title: Cannot close java.exe, JNI calls
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32960357
tagged with: java-native-interface
tagged with: java
has body: I am using a proprietary dll using the jni, anyway i need to free resources manually on shutdown. I tried using shutdownhooks but if i dont call my method for freeing these resources which happens on killing java through netbeans or per taskmanager, java.exe is staying alive. I cant even kill it with the taskmanager (access denied). Is there another safe method for making sure that a free resource method is called after processkill or other unsafe exiting? Edit: Thanks for the first answer but it does not solve my problem. If i kill the program during the sleep call, it wont shutdown properly. But if i wait this 5 seconds, it is properly shutting down. I think the call "AdsCallDllFunction.adsPortOpen()" is registering something for cleanup and if the process is killed, java.exe stays for about 5 - 10 minutes alive until the jvm dies. import de.beckhoff.jni.tcads.AdsCallDllFunction; import de.beckhoff.jni.tcads.AdsVersion; /** * * @author Christian */ public class KillTest { /** * @param args the command line arguments */ public static void main(String[] args) { long port = 0; if (port == 0) { AdsVersion lAdsVersion = null; port = AdsCallDllFunction.adsPortOpen(); } System.out.println("runs through this"); /** * If i call the following function, it can exit. **/ //AdsCallDllFunction.adsPortClose(); try { /** * If i kill the program during this sleep call, it wont exit for a timespan of 5-10 minutes */ Thread.sleep(5000); } catch (InterruptedException ex) { } System.exit(0); } } Edit 2: https://i.sstatic.net/4Vh71.png For own research you can download twincat 3 on http://www.beckhoff.com/. The DLL and jar file is provided in C:\TwinCAT\AdsApi\AdsToJava. I think that the dll tries to communicate with the twincat 3 driver which gets installed on twincat 3 setup. However if u try to kill java during the 5 seconds sleeptime through the taskmanager, the program gets stuck.
has comment: http://stackoverflow.com/comment/32948091

http://stackoverflow.com/a/21733232
score: 1
has comment: http://stackoverflow.com/comment/32868720
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21733012
downvote count: 0
has body: Generally speaking database permissions can begin from database/schema level permissions to specific table and column level select/insert/update permissions. Different databases have different levels. If you want to know whether a user has permission at any level you can do one of these: Query the system tables where the database stores the permission data. Try to run the operation. Operation error indicates that permission is not granted. Typically system table access is limited to admin users only. Therefore No. 1 is not an option. Then you will be left with only No. 2. Try the operation on the database and table of your interest. If the operation fails you know the user has no permission. If the operation succeeds you may have to roll back the changes done if the operation was insert/update.

http://stackoverflow.com/comment/33004392
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21809541
has text: Thanks, however I think that's overly complex for my needs. I think I'll use ObjectStreams but instead send Packet instances instead of full classes. Thanks for taking time to post your answer
score: 0

http://stackoverflow.com/comment/32850040
score: 0
comment on: http://stackoverflow.com/q/21722660
type: Comment
type: QuestionComment
has text: @Sandy it's not a charset issue.

http://stackoverflow.com/comment/32952231
score: 0
type: Comment
type: QuestionComment
has text: What do you mean by uniform? And how exactly is the distance vector computed?
comment on: http://stackoverflow.com/q/21780320

http://stackoverflow.com/q/21702459
tagged with: java
has body: I want to manage my users login in my own database. Now we use liferay embedded database and we want to change and customize it. Is there any document explaining how to do this?
tagged with: liferay
accepted answer: http://stackoverflow.com/a/21702616
downvote count: 0
answer count: 1
favorite count: 0
has title: Lifery portal connect to my own db
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21702616
upvote count: 1
type: Question
score: 1

http://stackoverflow.com/comment/33046939
has text: the REST server should not keep track of sessions. he only gets requests and responds to them. The client–server communication is constrained by no client context being stored on the server between requests.
comment on: http://stackoverflow.com/q/21833672
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32841406
comment on: http://stackoverflow.com/q/21717795
score: 0
type: QuestionComment
type: Comment
has text: Okay, that's a start. Have you run a debugger on this? Are the `int`s zero because you never get into the `for` loop, perhaps because the HTML you're getting from Android doesn't have the same table structure? Start by checking whether your `for` loop is executing to narrow down where the problem is, then dump the document output from Jsoup if it's not being run.

http://stackoverflow.com/comment/32841334
has text: well its reading the file now when i put in CompuDataSales.txt but its returning "java.lang.ArrayIndexOutOfBoundsException:"
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21717751

http://stackoverflow.com/q/21690763
has body: I'm currently learning about coupling and dependencies in Java. I've been reading this tutorial and understand that if class1 contains an instance of class2 and if you call a method like exampleMethod(c2), this counts as dependency between class1 and class2. However, I am unsure about the examples below. Can anyone give me some clarification? Assuming that we are inside class1 (which contains class2 c2): If class1 calls a method defined in class2 (c2.aMethod() for example), does this count as a dependency/coupling between class1 and class2? Does calling c2.someSetterMethod(argument) count as dependency/coupling between class1 and class2? Does calling c2.repaint() within class1 count as a dependency?
type: Question
type: AnsweredQuestion
tagged with: java
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21690887
has title: Coupling and dependencies clarification
possible better answer: http://stackoverflow.com/a/21690859
tagged with: coupling
has answer: http://stackoverflow.com/a/21690859
tagged with: dependencies
linked to: http://stackoverflow.com/q/21689085
has answer: http://stackoverflow.com/a/21690887

http://stackoverflow.com/a/21753038
score: 0
has body: You are using older map V1 which has been deprecated. Use Google map V2 https://developers.google.com/maps/documentation/android/start Follow this tutorial for new Google map v2 http://www.vogella.com/tutorials/AndroidGoogleMaps/article.html
answers question: http://stackoverflow.com/q/21753005
type: Answer

http://stackoverflow.com/q/21793312
downvote count: 0
has title: How to place a JTextField without it generating more fields every time I minimize the window in Java?
type: UnansweredQuestion
score: 1
has body: My code places a JTextField in a specific randomized location, but it also creates a generic JTextField in the top of the Frame, which I don't want it to do. When I minimize it and then re maximize it it creates a second JTextField right next to the first one, and again and again. It also deletes any thing that has been typed in the field. Note that when I place the JTextField in a random location I want it to stay there when I minimize the window. Code: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; import java.util.Random; @SuppressWarnings("serial") public class AC extends JPanel implements ActionListener { JTextField text = new JTextField(10); int x; int y; public AC() { Random r = new Random(); x = r.nextInt(500); y = r.nextInt(500); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); JTextField text = new JTextField(10); text.setBounds(x, y, 150, 20); this.add(text); } static void createandshowGUI() { JFrame frame = new JFrame("AC"); frame.getContentPane().setBackground(Color.white); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); frame.setSize(dim.width, dim.height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new AC()); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createandshowGUI(); } }); } public void actionPerformed(ActionEvent e) { } }
type: Question
has comment: http://stackoverflow.com/comment/32975400
favorite count: 0
tagged with: paint
answer count: 2
upvote count: 1
tagged with: swing
tagged with: jtextfield
has answer: http://stackoverflow.com/a/21793355
tagged with: java
has answer: http://stackoverflow.com/a/21793336

http://stackoverflow.com/a/21782594
has comment: http://stackoverflow.com/comment/32956203
score: 1
has comment: http://stackoverflow.com/comment/32956356
has body: The server.ini file should be in the root of a resources directory. By placing it in the webapp you're making the file available via http, but you need it accessible on the classpath, which means that you should place it in the resources directory.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21782517
has comment: http://stackoverflow.com/comment/32956355
downvote count: 0

http://stackoverflow.com/comment/33009805
comment on: http://stackoverflow.com/q/21812653
score: 0
type: Comment
type: QuestionComment
has text: on the other side, maybe they can be caught by tools such as pmd and findbugs :-) [not sure, actually]

http://stackoverflow.com/q/21714356
has comment: http://stackoverflow.com/comment/32835417
upvote count: 1
accepted answer: http://stackoverflow.com/a/21714656
answer count: 1
has body: I want to use a subtitle API. It requires a md5 hash of first and last 64kb of the video file. I know how to do the md5 part just want to know how will I achieve to get the 128kb of data. An example of API is given in Python but sadly I do not understand it. #this hash function receives the name of the file and returns the hash code def get_hash(name): readsize = 64 * 1024 with open(name, 'rb') as f: size = os.path.getsize(name) data = f.read(readsize) f.seek(-readsize, os.SEEK_END) data += f.read(readsize) return hashlib.md5(data).hexdigest() http://thesubdb.com/api/ Any help would be appreciated.
linked to: http://stackoverflow.com/q/6058003
favorite count: 0
has comment: http://stackoverflow.com/comment/32835387
has comment: http://stackoverflow.com/comment/32835407
has comment: http://stackoverflow.com/comment/32835359
has answer: http://stackoverflow.com/a/21714656
type: AnsweredQuestion
downvote count: 0
has title: How to read first and last 64kb of a video file in Java?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32835671

http://stackoverflow.com/comment/33070508
has text: thank you, that's a viable suggestion, in conjunction with XMLRules it solves the problem. You can put it as an answer so I could mark it as accepted.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21821616
score: 0

http://stackoverflow.com/q/21814328
tagged with: java
type: Question
tagged with: ssl
score: -1
tagged with: amazon-web-services
answer count: 1
downvote count: 1
tagged with: amazon-ec2
tagged with: tomcat
favorite count: 0
has body: I am working with Elastic Beanstalk and am having some trouble with SSL configuration. I have an environment consisting of a Load Balancer and a single EC2 instance at the moment. The Load Balancer has listeners on port 443 and 80. The EC2 instance in the environment is running tomcat on port 80. I have a certificate in place in the load balancer and I am able to access the site on port 443 and 80 and everything is worked fine. The problem is that I would like all requests to be redirected to port 443, even ones that come in on port 80. I have searched high and low for a way to do this without having to change my security configuration. This is a small webapp running on Tomcat 7 with Spring security and MVC. I tried using &lt;sec:intercept-url pattern="/**" requires-channel="https"/&gt; but I have several pages that are not part of the filter chain as such &lt;sec:http pattern="/login.html" security="none" /&gt; This seems like something that could solved at the load balancer but I do not have much experience with setting up SSL. Any help is appreciated.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21815673
has title: Elastic load balancer and https
upvote count: 0

freemarker
tags question: http://stackoverflow.com/q/21752299
type: Tag
tags question: http://stackoverflow.com/q/21826020
tag name: freemarker

http://stackoverflow.com/q/21774894
type: Question
has title: Mysql database backup by using java
score: 0
tagged with: java
answer count: 3
tagged with: mysql
has comment: http://stackoverflow.com/comment/32942411
has comment: http://stackoverflow.com/comment/32942418
has answer: http://stackoverflow.com/a/33634847
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21775103
has answer: http://stackoverflow.com/a/37327882
has comment: http://stackoverflow.com/comment/32942528
has body: I am going to take database backup by using java code.This code is excuting fine but I am getting int processComplete = runtimeProcess.waitFor(); This method calling is returning the integer as 1. So finally I am getting the message as could not create backup as sop. public static void main(String[] args) { String path = "D:/databasebackup/databasbac.sql"; String username = "root"; String password = ""; String dbname = "rac"; String executeCmd = "&lt;Path to MySQL&gt;/bin/mysqldump -u " + username + " -p" + password + " --add-drop-database -B " + dbname + " -r " + path; Process runtimeProcess; try { // System.out.println(executeCmd);//this out put works in mysql shell runtimeProcess = Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", executeCmd }); System.out.println(executeCmd); // runtimeProcess = Runtime.getRuntime().exec(executeCmd); int processComplete = runtimeProcess.waitFor(); System.out.println("processComplete"+processComplete); if (processComplete == 0) { System.out.println("Backup created successfully"); } else { System.out.println("Could not create the backup"); } } catch (Exception ex) { ex.printStackTrace(); } }
linked to: http://stackoverflow.com/q/21772852
has comment: http://stackoverflow.com/comment/32942534
has comment: http://stackoverflow.com/comment/32967723
has comment: http://stackoverflow.com/comment/32942633

http://stackoverflow.com/a/21691060
has comment: http://stackoverflow.com/comment/32794846
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32794094
has comment: http://stackoverflow.com/comment/32793988
has comment: http://stackoverflow.com/comment/32795930
downvote count: 0
has comment: http://stackoverflow.com/comment/32796442
answers question: http://stackoverflow.com/q/21690862
has body: To extend sheltem's answer, you should get the field from an instance of the SalesCommission class (assuming that it is not a class constant). public static void main(String[] args) { // Create an instance of the SalesCommission class (an object) SalesCommission salesCommission = new SalesCommission(); //Scanner input Scanner input = new Scanner( System.in ); int totalSales; int salesPlusSalary; //input commissions System.out.print( "Enter Annual Commissions" ); totalSales = input.nextInt(); salesPlusSalary = (int) (totalSales * .05 + SalesCommission.baseSalary); System.out.printf( "Sales commission plus Salary is %d\n", salesPlusSalary ); } Also since you're just getting the hang of Java, OOP and classes etc., I recommend you work through The Java Tutorials or other similar resources and review your design and how you can make it better. By striving to improve you'll learn OOP and good design/practices.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21690862
type: Answer
has comment: http://stackoverflow.com/comment/32794829

http://stackoverflow.com/a/22786093
answers question: http://stackoverflow.com/q/21730926
score: 1
accepted answer of: http://stackoverflow.com/q/21730926
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: For Windows, this seems to work as an external tool configuration. The only problem is the console doesn't recognize control-d, so you have to kill your java process from the task manager.
upvote count: 1

http://stackoverflow.com/q/21764870
tagged with: java
has answer: http://stackoverflow.com/a/33587462
has answer: http://stackoverflow.com/a/35851989
type: Question
possible better answer: http://stackoverflow.com/a/21764989
has body: this one just is hurting my brain. http://programmingbydoing.com/a/adding-values-in-a-loop.html Write a program that gets several integers from the user. Sum up all the integers they give you. Stop looping when they enter a 0. Display the total at the end. what ive got so far: Scanner keyboard = new Scanner(System.in); System.out.println("i will add"); System.out.print("number: "); int guess = keyboard.nextInt(); System.out.print("number: "); int guess2 = keyboard.nextInt(); while(guess != 0 &amp;&amp; guess2 != 0) { int sum = guess + guess2; System.out.println("the total so far is " + sum); System.out.print("number: "); guess = keyboard.nextInt(); System.out.print("number: "); guess2 = keyboard.nextInt(); System.out.println("the total so far is " + sum); } //System.out.println("the total so far is " + (guess + guess2)); }
has answer: http://stackoverflow.com/a/21764970
accepted answer: http://stackoverflow.com/a/21764970
score: 0
answer count: 4
has comment: http://stackoverflow.com/comment/32924510
has answer: http://stackoverflow.com/a/21764989
has comment: http://stackoverflow.com/comment/32924443
has title: Java - adding value in a while loop
has comment: http://stackoverflow.com/comment/32924428
type: AnsweredQuestion

http://stackoverflow.com/comment/32933400
type: AnswerComment
comment on: http://stackoverflow.com/a/21769652
score: 0
type: Comment
has text: If I don't use recursion (as you rightfully noted, I don't need it, but I wanted to practice doing them), I won't need to increase the fixed stack size?

http://stackoverflow.com/q/21832429
has answer: http://stackoverflow.com/a/21832552
tagged with: android
type: AnsweredQuestion
score: 0
has title: Using JSON for Lat Long on Google Maps
accepted answer: http://stackoverflow.com/a/21832552
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: google-maps
tagged with: google-maps-markers
has body: I am trying to get a JSON object from an API to use the Lat Long for each marker on google maps. I can read the JSON in, as i have been able to put it in a listview, as a string, but cants seem to parse it into a double, it crashes every time. Java: package com.fly.plane; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.fly.plane.R; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.Projection; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import android.R.array; import android.app.ListActivity; import android.app.ProgressDialog; import android.content.Context; import android.graphics.Canvas; import android.graphics.Point; import android.location.Location; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.View; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; public class MyMapActivity extends ListActivity { private ProgressDialog pDialog; // URL to get data JSON private static String url = "http://edmundgentle.com/snippets/flights/api.php"; // JSON Node speeds private static final String TAG_data = "data"; private static final String TAG_BEARING = "bearing"; private static final String TAG_speed = "speed"; private static final String TAG_ARR = "arr"; private static final String TAG_DEP = "dep"; private static final String TAG_DEP_LAT = "lat";…
answer count: 1

http://stackoverflow.com/comment/32899752
comment on: http://stackoverflow.com/a/21749930
score: 0
type: Comment
has text: Did you tried to revert your project to the point before the error happened? It's just to configurm whether it depends on the file upload or not.
type: AnswerComment

http://stackoverflow.com/comment/32895052
type: Comment
has text: add `spring-mvc` lib at least
comment on: http://stackoverflow.com/q/21748154
score: 0
type: QuestionComment

http://stackoverflow.com/a/21729961
type: Answer
has comment: http://stackoverflow.com/comment/32862380
answers question: http://stackoverflow.com/q/21729670
has body: Switch this if statement: if(chars.get(i).equals("1") || chars.get(i).equals("2") || chars.get(i).equals("3") || chars.get(i).equals("4") || chars.get(i).equals("5") || chars.get(i).equals("6")){ grades.add(Character.getNumericValue(chars.get(i).charValue())); } to this: if(chars.get(i).equals('1') || chars.get(i).equals('2') || chars.get(i).equals('3') || chars.get(i).equals('4') || chars.get(i).equals('5') || chars.get(i).equals('6')){ grades.add(Character.getNumericValue(chars.get(i).charValue())); } because you're comparing Character, not String. The ' instead of " makes the whole difference.
score: 0

http://stackoverflow.com/q/21798883
has title: Using SharedPreferences between Activity
tagged with: android
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21799014
has answer: http://stackoverflow.com/a/21798982
has comment: http://stackoverflow.com/comment/32984904
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21799006
has comment: http://stackoverflow.com/comment/32984956
has comment: http://stackoverflow.com/comment/32984831
accepted answer: http://stackoverflow.com/a/21798982
score: 0
has body: I have a configuration page which has a form on it. When the button is pressed, I want to save that value to a SharedPreference. This SharedPreference value then needs to be accessed from elsewhere in my app. I am trying to save the value like the below. I want to save the collectionID so I can use it elsewhere public class ConfigPage extends Activity { public static final String PREFS_NAME = "MyPrefsFile"; Button mButton; EditText mEdit; String collectionID; String key = "GregKey"; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.config); getActionBar().hide(); mButton = (Button)findViewById(R.id.setCollection); mEdit = (EditText)findViewById(R.id.collectionName); mButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { collectionID = mEdit.getText().toString(); Log.d("EditText", collectionID); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString(key, collectionID); editor.commit(); } }); } } Once it has been saved, I then need to access it in another class, however I can't figure out how to do this. The example above crashes the application at the moment so something isn't quite right
possible better answer: http://stackoverflow.com/a/21798943
has answer: http://stackoverflow.com/a/21798943

http://stackoverflow.com/q/21795408
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21795430
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/21795792
has answer: http://stackoverflow.com/a/21795642
has answer: http://stackoverflow.com/a/21844715
type: Question
downvote count: 0
has body: I'm just wondering why is it if I type in command prompt filename.jar it pop a message (could not find the main class) but if I type in java -jar filename.jar the jar file works fine. Can someone explain to me why is this happening?
favorite count: 0
has title: difference between (filename.jar) and (java -jar filename.jar)
answer count: 4

http://stackoverflow.com/comment/32953834
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21780179
has text: @user3134565 read about generics, not just what people tell you! You can't learn the easy way. you try to add an instance of an object, you need an instance of a class

http://stackoverflow.com/comment/33076515
comment on: http://stackoverflow.com/q/21831257
score: 0
has text: I don't have the `CartLine` code, I'm just using it as part of an API...
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21732663
answers question: http://stackoverflow.com/q/21732592
type: Answer
downvote count: 0
has body: You can use an array in both cases to achieve what you want, using a random number to select the text. For case one per example: String[] arr = {"Lucky", "Not lucky", "BadLuck, press the button again"}; Random r = new Random(); JButton button = new JButton(arr[r.nextInt(arr.length)]; This is the same process for case two with an array of JButton.
score: 1
upvote count: 1

http://stackoverflow.com/a/21970754
type: AcceptedAnswer
has body: For anyone who is still struggling with this I worked it out: Download corona SDK and program with that its so much easier: function scrollBackground(self,event) if self.x &lt; [Enter Background width in pixels] then self.x = [Enter Background width in pixels] else self.x = self.x - [Speed - low number like 5 is slow scrolling, high number like 18 is fast scrolling] end end Use the above function to for the scrolling background then add this underneath: function scene:enterScene(event) background.enterFrame = scrollCity Runtime:addEventListener("enterFrame", background)
accepted answer of: http://stackoverflow.com/q/21815824
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21815824

spring-mvc
tags question: http://stackoverflow.com/q/21821791
tags question: http://stackoverflow.com/q/21724053
tags question: http://stackoverflow.com/q/21786110
tags question: http://stackoverflow.com/q/21804848
tags question: http://stackoverflow.com/q/21707723
tags question: http://stackoverflow.com/q/21705432
tags question: http://stackoverflow.com/q/21831766
tags question: http://stackoverflow.com/q/21698569
tags question: http://stackoverflow.com/q/21806126
tags question: http://stackoverflow.com/q/21754326
tags question: http://stackoverflow.com/q/21796190
tags question: http://stackoverflow.com/q/21826445
tags question: http://stackoverflow.com/q/21804268
tags question: http://stackoverflow.com/q/21755663
tags question: http://stackoverflow.com/q/21743660
tags question: http://stackoverflow.com/q/21722365
tags question: http://stackoverflow.com/q/21820779
tags question: http://stackoverflow.com/q/21773954
tags question: http://stackoverflow.com/q/21793584
tags question: http://stackoverflow.com/q/21807009
tags question: http://stackoverflow.com/q/21788654
tags question: http://stackoverflow.com/q/21695963
tags question: http://stackoverflow.com/q/21714513
tags question: http://stackoverflow.com/q/21696915
tags question: http://stackoverflow.com/q/21741433
tags question: http://stackoverflow.com/q/21832537
tags question: http://stackoverflow.com/q/21708307
tags question: http://stackoverflow.com/q/21763321
tags question: http://stackoverflow.com/q/21773492
tags question: http://stackoverflow.com/q/21826179
tags question: http://stackoverflow.com/q/21811030
tags question: http://stackoverflow.com/q/21745361
tags question: http://stackoverflow.com/q/21705028
tags question: http://stackoverflow.com/q/21726119
tags question: http://stackoverflow.com/q/21819923
tags question: http://stackoverflow.com/q/21711462
tags question: http://stackoverflow.com/q/21814672
tags question: http://stackoverflow.com/q/21833107
tags question: http://stackoverflow.com/q/21778083
tags question: http://stackoverflow.com/q/21764696
tags question: http://stackoverflow.com/q/21723183
tags question: http://stackoverflow.com/q/21696592
tags question: http://stackoverflow.com/q/21727286
tags question: http://stackoverflow.com/q/21734785
tags question: http://stackoverflow.com/q/21777193
tags question: http://stackoverflow.com/q/21826639
tags question: http://stackoverflow.com/q/21731959
tag name: spring-mvc
tags question: http://stackoverflow.com/q/21836548
tags question: http://stackoverflow.com/q/21686584
tags question: http://stackoverflow.com/q/21690879
tags question: http://stackoverflow.com/q/21827993
tags question: http://stackoverflow.com/q/21794633
tags question: http://stackoverflow.com/q/21723938
tags question: http://stackoverflow.com/q/21797916
tags question: http://stackoverflow.com/q/21714290
tags question: http://stackoverflow.com/q/21776437
type: Tag
tags question: http://stackoverflow.com/q/21829162
tags question: http://stackoverflow.com/q/21757285
tags question: http://stackoverflow.com/q/21778163
tags question: http://stackoverflow.com/q/21798952
tags question: http://stackoverflow.com/q/21796019
tags question: http://stackoverflow.com/q/21781667
tags question: http://stackoverflow.com/q/21773092
tags question: http://stackoverflow.com/q/21795322
tags question: http://stackoverflow.com/q/21838900
tags question: http://stackoverflow.com/q/21827548
tags question: http://stackoverflow.com/q/21841202
tags question: http://stackoverflow.com/q/21827778
tags question: http://stackoverflow.com/q/21732407
tags question: http://stackoverflow.com/q/21775207
tags question: http://stackoverflow.com/q/21700565
tags question: http://stackoverflow.com/q/21779083
tags question: http://stackoverflow.com/q/21738777
tags question: http://stackoverflow.com/q/21748154
tags question: http://stackoverflow.com/q/21787314
tags question: http://stackoverflow.com/q/21710770
tags question: http://stackoverflow.com/q/21761757
tags question: http://stackoverflow.com/q/21780709

http://stackoverflow.com/q/21800833
answer count: 1
has answer: http://stackoverflow.com/a/21823757
has title: Issue with LibGDX and RoboVM Maven Plugin
tagged with: maven
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21823757
tagged with: libgdx
tagged with: java
type: Question
score: 0
tagged with: robovm
has body: I've been trying to port a libGDX project to iOS, and have encountered a frustrating error. I'm using the RoboVM Maven Plugin, and get the following error when trying to run the iphone simulator. [ERROR] Failed to execute goal org.robovm:robovm-maven-plugin:0.0.9.1:iphone-sim (iphone-sim) on project Main: Execution iphone-sim of goal org.robovm:robovm-maven-plugin:0.0.9.1:iphone-sim failed: No @Marshaler found for parameter 1 of @Callback method -> [Help 1] I have little experience with RoboVM, so I have no idea what the error means, much less why it's occurring. I've looked around, and nobody else seems to be getting the error in the same context, so I'm at a loss as to what to do. My pom.xml looks like this. <?xml version="1.0" encoding="UTF-8"?> 4.0.0 artifactid name main com.badlogicgames.gdx gdx 0.9.9 com.badlogicgames.gdx gdx-backend-robovm 0.9.9 org.robovm robovm-maven-plugin 0.0.9.1 ${mainClass} ios x86 iphone-sim integration-test iphone-sim

http://stackoverflow.com/q/21829108
has title: BeanInstantiationException: Could not instantiate bean class [org.springframework.security.config.SecurityNamespaceHandler]
has comment: http://stackoverflow.com/comment/33162972
score: 0
has comment: http://stackoverflow.com/comment/33039593
answer count: 1
tagged with: spring-security
has body: I am trying to run a example of spring security. This is my web.xml <?xml version="1.0" encoding="UTF-8"?> SpringMVCDemo index.html index.htm index.jsp default.html default.htm default.jsp dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher *.htm org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/dispatcher-servlet.xml, /WEB-INF/spring-security.xml springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* this is dispatcher-servlet.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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.example.controller"></context:component-scan> </beans> this is spring-security.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.3.xsd"> <intercept-url pattern="/hello*" access="ROLE_USER"/> <authentication-manager> <authentication-provider> <user name="root" password="123" authorities="ROLE_USER"/> </authentication-provider> </authentication-manager> </beans:beans> I am getting following exception org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33157610
tagged with: spring
has answer: http://stackoverflow.com/a/21840915
tagged with: java
type: Question

http://stackoverflow.com/q/21809738
has body: Just started learning hibernate, and to understand hibernate 2nd level cache. I created a comment Entity and try to work on it. Here are my codes! @Entity @Table(name = "comment") @FilterDefs(value={@FilterDef(name="projectFilter",parameters=@ParamDef(name="projectID", type="java.lang.Long" )), @FilterDef(name="issueFilter", parameters=@ParamDef( name="issueID", type="java.lang.Long" ) )}) @Filters(value={@Filter(name = "projectFilter", condition = "project_id = :projectID"), @Filter(name = "issueFilter", condition = "issue_id = :issueID")}) @Cache(usage=CacheConcurrencyStrategy.READ_WRITE, region="comment") public class Comment { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name = "id", unique = true, nullable = false, precision = 5, scale = 0 ) private long id; @Column(name = "project_id", nullable = false) private long projectId; @Column(name = "issue_id", nullable = false) private long issueId; @Column(name = "author_id", nullable = false) private long auhorId; @Column(name = "author_name", nullable = false) private String authorName; @Column(name = "comment") private String comment; @Column(name = "created_date") private Date createdDate; I want to fetch user comment based on project or project and issue. In DAO,I have written the following function for comments based on projectid. @Autowired private SessionFactory sessionFactory; ... @Override public List<Comment> getAllProjectComments(long projectId) { Session session = getCurrentSession(); Filter filter = session.enableFilter("projectFilter"); filter.setParameter("projectID", projectId); return session.createQuery("from Comment").setCacheable(true).list(); } and ehcahe.xml is below <?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false"> <diskStore path="java.io.tmpdir/hibernate-cache"/> <defaultCache maxElementsInMemory="500" eternal="false" timeToIdleSeconds="1200" timeTo…
answer count: 1
has comment: http://stackoverflow.com/comment/33004444
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21809769
linked to: http://stackoverflow.com/q/337072
tagged with: java
tagged with: hibernate
has title: hibernate 2nd level cache understanding
type: Question
tagged with: caching
score: 0

http://stackoverflow.com/comment/32945255
has text: There's a BigDecimal class with more memory allocated to store bigger numbers.
comment on: http://stackoverflow.com/q/21776462
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21716423
tagged with: space-efficiency
has title: How to combine exceptions to get rid of repeat code?
upvote count: 1
has comment: http://stackoverflow.com/comment/32838788
has answer: http://stackoverflow.com/a/21716441
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32838739
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21716808
has answer: http://stackoverflow.com/a/21716808
type: Question
answer count: 2
has body: How can I minimize the repeated exception throwing code in the code: public R get(int index) throws IndexException { if (!((0 &lt;= index) &amp;&amp; (index &lt; this.info.length))) { throw new IndexException(); } return this.info[index]; } public void set(int index, R r) throws IndexException { if (!((0 &lt;= index) &amp;&amp; (index &lt; this.info.length))) { throw new IndexException(); } this.info[index] = r; }
downvote count: 0
accepted answer: http://stackoverflow.com/a/21716441
tagged with: exception
favorite count: 0
has comment: http://stackoverflow.com/comment/32838948

http://stackoverflow.com/comment/32970538
type: QuestionComment
comment on: http://stackoverflow.com/q/21789999
has text: @mahesh You can flag the post for moderator attention and ask them if they can delete it. **Don't** just blank the post (which some people do!) which is annoying and the code can still be viewed in old edit revisions.
score: 0
type: Comment

http://stackoverflow.com/q/21690464
answer count: 2
has comment: http://stackoverflow.com/comment/32792681
has comment: http://stackoverflow.com/comment/32793733
has body: UPDATE: See resolution here. Thanks to everyone for their help! I'm encountering an error when attempting to compile a project with Ant, which is claiming "[javac] javac: invalid target release: 7" and causing the build to fail. I am running javac version 1.7.0_40 on a Mac OSX Mavericks machine. Ant version: Apache Ant(TM) version 1.8.3 compiled on February 26 2012 It is only when attempting to compile with Ant that the problem occurs. Compiling individual files in the project with javac at the command line works properly (with the following command): javac -d /Users/username/git/appinventor-sources/appinventor/common/build/classes/CommonUtils -classpath /Users/username/git/appinventor-sources/appinventor/common/build/classes/CommonUtils:/Users/username/git/appinventor-sources/appinventor/lib/guava/guava-14.0.1.jar -target 7 -encoding utf-8 -g:lines,vars,source -source 7 common/src/com/google/appinventor/common/utils/* The build-common.xml file specifies for javac: &lt;attribute name="source" default="7"/&gt; &lt;attribute name="target" default="7"/&gt; The same build file has worked fine for others and can be found at: https://github.com/cdlockard/appinventor-sources/blob/master/appinventor/build-common.xml After reading this, I checked for earlier Java versions on my machine and didn't find any. Per this question, I added executable="/usr/bin/javac" to the build-common.xml file to ensure that it found the correct Java compiler, but the error continued. The command line output is as follows: init: CommonUtils: [javac] Compiling 1 source file to /Users/username/git/appinventor-sources/appinventor/common/build/classes/CommonUtils [javac] javac: invalid target release: 7 [javac] Usage: javac &lt;options&gt; &lt;source files&gt; [javac] use -help for a list of possible options BUILD FAILED /Users/username/git/appinventor-sources/appinventor/build.xml:16: The following error occurred while executing this line: /Users/username/git/appinventor-sources/appinventor/build-co…
downvote count: 0
has comment: http://stackoverflow.com/comment/32886283
favorite count: 0
tagged with: javac
has comment: http://stackoverflow.com/comment/32934995
has answer: http://stackoverflow.com/a/21743233
linked to: http://stackoverflow.com/q/7832298
type: AnsweredQuestion
tagged with: java
has title: Ant build failing, "[javac] javac: invalid target release: 7"
linked to: http://stackoverflow.com/q/5626317
has answer: http://stackoverflow.com/a/25026246
linked to: http://stackoverflow.com/q/15377436
type: Question
has comment: http://stackoverflow.com/comment/32902968
has comment: http://stackoverflow.com/comment/32792499
has comment: http://stackoverflow.com/comment/32793883
accepted answer: http://stackoverflow.com/a/21743233
tagged with: ant
has comment: http://stackoverflow.com/comment/32792547
has comment: http://stackoverflow.com/comment/32792659
possible better answer: http://stackoverflow.com/a/25026246
score: 4
has comment: http://stackoverflow.com/comment/32793589
upvote count: 4

http://stackoverflow.com/comment/32888543
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21743880
has text: @peeskillet problem is every search in invoice load in the same table. As a example in inid = 1 combo box search if I got to 2rows to table, When I search inid=2 in combo box it's search's data also load in that table starting from row 3. I explained it using pictures.
score: 0

http://stackoverflow.com/q/21691305
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32794130
tagged with: java
downvote count: 3
tagged with: loops
accepted answer: http://stackoverflow.com/a/21691423
type: Question
tagged with: do-while
has comment: http://stackoverflow.com/comment/32794082
has comment: http://stackoverflow.com/comment/32794075
favorite count: 0
has title: Loop - Do , while
answer count: 1
score: -2
has comment: http://stackoverflow.com/comment/32794085
has answer: http://stackoverflow.com/a/21691423
has body: I tried doing a loop, but the "{" symbols prevent the all the print lines from repeating I think. I want the loop to redisplay the entire first string after the user finishes entering values for the sequence. import java.util.Scanner; public class FtoC{ static Scanner cin = new Scanner (System.in); public static void main(String[] args) { char userInput = ' '; System.out.print("\nEnter " + "\"F\"" + " or " + "\"f\"" + " for Fahrenheit to Celsius" + "\nEnter " + "\"C\"" + " or " + "\"c\"" + " for Celsius to Fahrenheit" + "\nEnter something else to quit." +"\n"); userInput = cin.next().charAt(0); if ((userInput == 'F') || (userInput =='f')) {print("Enter a temp in Fahrenheit" +"\n I will tell you temp in Celsius" +"\n"); far2cel(); } else if ((userInput == 'C') || (userInput =='c')) { print("Enter a temp in Celsius:" +"\n I will tell you temp in fahrenheit" +"\n"); cel2far(); } else { print("Terminating the program" + "\n"); } } private static void cel2far() { Scanner input = new Scanner(System.in); Double celsius = input.nextDouble(); print(celsius + " celsius is " + ((celsius * 9 / 5.0) + 32) + " Fahrenheit"); } private static void far2cel() { Scanner input = new Scanner(System.in); Double Fahrenheit = input.nextDouble(); print(Fahrenheit + " Fahrenheit is " + ((Fahrenheit - 32) * (5 / 9.0)) + " celsius"); } private static void print(String string) { System.out.print("\n" + string); } }
has comment: http://stackoverflow.com/comment/32794070

http://stackoverflow.com/q/21773141
answer count: 1
has body: Firstly, I was unable to get the index page but I resolved that issue using 404 error for tomcat 6 for spring application After I get index page and when I click on link I am unable to map the request to my Controller. studentspringmvc.xml <Context path="/studentspringmvc" docBase="/home/shoaib/Documents/myprograms/studentspringmvc/src/main/webapp" reloadable="true" debug="9" /> web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> Spring MVC Application contextConfigLocations classpath*:applicationContext.xml mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / org.springframework.web.context.ContextLoaderListener index.jsp StudentDetailsController.java package com.semanticbits.studentspringapp.controller; import org.apache.log4j.Logger; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller @RequestMapping("/studentDetails") public class StudentDetailsController { private static final Logger logger = Logger.getLogger(StudentDetailsController.class); public StudentDetailsController() { System.out.println("In Student Constructor"); } @RequestMapping(method=RequestMethod.GET) public String showForm(ModelMap map){ logger.info("In service method"); System.out.println("In Student Details"); return "studentdetails"; } } mvc-dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http:/…
has answer: http://stackoverflow.com/a/21773167
tagged with: java
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21760201
linked to: http://stackoverflow.com/q/5850336
accepted answer: http://stackoverflow.com/a/21773167
type: Question
has title: Unable to map request to Controller in Spring MVC 3
linked to: http://stackoverflow.com/q/21699240
tagged with: spring-mvc
score: 0

wamp
tag name: wamp
tags question: http://stackoverflow.com/q/21811789
type: Tag

http://stackoverflow.com/comment/33000022
score: 1
has text: just load the required shared library and that's all, what's the problem? `loadLibrary(String libname);` libname should come without `lib` and `.so`
type: Comment
comment on: http://stackoverflow.com/q/21806778
type: QuestionComment

http://stackoverflow.com/comment/32838858
has text: @user3196742 I cannot see what you are talking about, but what "details" are there? They may mean option 3.
comment on: http://stackoverflow.com/a/21716388
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21774917
has comment: http://stackoverflow.com/comment/32951833
tagged with: synchronized
answer count: 2
accepted answer: http://stackoverflow.com/a/21779099
upvote count: 1
has body: Given: A lazy initialized singleton class implemented with double-check locking pattern with all the relevant volatile and synchronized stuff in getInstance. This singleton launches asynchronous operations via an ExecutorService, There are seven type of tasks, each one identified by a unique key, When a task is launched, it is stored in a cached based on ConcurrentHashMap, When a client ask for a task, if the task in the cache is done, a new one is launched and cached; if it is running, the task is retrieved from the cache and passed to the client. Here is a excerpt of the code: private static volatile TaskLauncher instance; private ExecutorService threadPool; private ConcurrentHashMap&lt;String, Future&lt;Object&gt;&gt; tasksCache; private TaskLauncher() { threadPool = Executors.newFixedThreadPool(7); tasksCache = new ConcurrentHashMap&lt;String, Future&lt;Object&gt;&gt;(); } public static TaskLauncher getInstance() { if (instance == null) { synchronized (TaskLauncher.class) { if (instance == null) { instance = TaskLauncher(); } } } return instance; } public Future&lt;Object&gt; getTask(String key) { Future&lt;Object&gt; expectedTask = tasksCache.get(key); if (expectedTask == null || expectedTask.isDone()) { synchronized (tasksCache) { if (expectedTask == null || expectedTask.isDone()) { // Make some stuff to create a new task expectedTask = [...]; threadPool.execute(expectedTask); taskCache.put(key, expectedTask); } } } return expectedTask; } I got one major question, and another minor one: Do I need to perform double-check locking control in my getTask method? I know ConcurrentHashMap is thread-safe for read operations, so my get(key) is thread-safe and may not need double-check locking (but yet quite unsure of this…). But what about the isDone() method of Future? How do you chose the right lock object in a synchronized block? I know it must no be null, so I use first the TaskLauncher.class object in getInstance() and then the tasksCache, already initialized, in …
favorite count: 0
tagged with: double-checked-locking
has comment: http://stackoverflow.com/comment/32942724
has answer: http://stackoverflow.com/a/21779099
tagged with: concurrenthashmap
tagged with: future
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: ConcurrentHashMap of Future and double-check locking
possible better answer: http://stackoverflow.com/a/21775881
type: Question
has answer: http://stackoverflow.com/a/21775881

http://stackoverflow.com/a/21820485
has comment: http://stackoverflow.com/comment/33023849
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21820419
has comment: http://stackoverflow.com/comment/33023936
downvote count: 0
has body: Starting with hour set to 23, then after this code: if (hour&gt;12) { hour-=12; ... what is the value of hour? I'm afraid your code is needlessly complex, even if you fix the bug. Look at the String.format() method for a much better way of formatting numbers for output that does not require you to handle all those "special cases" separately.
has comment: http://stackoverflow.com/comment/33023885
type: Answer

http://stackoverflow.com/a/21835004
has comment: http://stackoverflow.com/comment/33049496
has comment: http://stackoverflow.com/comment/33048978
accepted answer of: http://stackoverflow.com/q/21834951
type: Answer
has comment: http://stackoverflow.com/comment/33050929
has comment: http://stackoverflow.com/comment/33050899
answers question: http://stackoverflow.com/q/21834951
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33049973
upvote count: 3
has comment: http://stackoverflow.com/comment/33049865
has body: Why don't you use a JFileChooser? As always, the API is your best friend: showInputDialog(Component parentComponent, Object message, Object initialSelectionValue) Look for a function that takes an argument for the default value.

http://stackoverflow.com/comment/32992894
type: QuestionComment
comment on: http://stackoverflow.com/q/21803230
has text: Thank you to both of you. Very good insight.
score: 0
type: Comment

http://stackoverflow.com/a/21796975
downvote count: 0
upvote count: 6
answers question: http://stackoverflow.com/q/21796924
has body: Okay, seems my guess was right ;-) So to have it as an official answer here: Optional.&lt;User&gt;absent() Btw, for brevity's sake, you can reduce to: return success ? Optional.of( user ) :Optional.&lt;User&gt;absent ( );
type: Answer
score: 6

http://stackoverflow.com/a/21760114
answers question: http://stackoverflow.com/q/21757312
has comment: http://stackoverflow.com/comment/32922002
has comment: http://stackoverflow.com/comment/32923577
has comment: http://stackoverflow.com/comment/32923040
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32918262
accepted answer of: http://stackoverflow.com/q/21757312
has body: in your first bean declare the second bean like: // change the value as the name of your real managedbean name @ManagedProperty(value="#{ncpFormBean}") private NcpFormBean ncpForm; with the setter of it: public void setNcpForm(NcpFormBean ncpForm) { this.ncpForm = ncpForm; } now in your fillForm Method: public String fillForm(){ boolean failTest = false; String errorCodeForNcpForm = ""; StringBuffer buffer = new StringBuffer(); buffer.append (" "); if (!unitSerialValue.equalsIgnoreCase("P")){ buffer.append (1 + unitSerialValue ); failTest = true; buffer.append(" "); } if(!screenProValue.equalsIgnoreCase("P")){ buffer.append (2 + unitSerialValue ); failTest = true; buffer.append(" "); } if(failTest){ //gets the whole error code errorCodeForNcpForm = buffer.toString(); this.ncpForm.setproblemQcValue(errorCodeForNcpForm); return "ncpFormQc"; } else return "index"; } the passed data is now reachable in your second bean for the second view (since your beans are session scoped). UPDATE: lets say you have 2 beans: Bean1 and Bean2 (both are sessionScoped): if you want to change values @ManagedBean(name="bean1") @SessionScoped public class Bean1 { @ManagedProperty(value="#{bean2}") private Bean2 ncpForm; .... } .. @ManagedBean(name="bean2") @SessionScoped public class Bean2 { .... .... } NOTE: @ManagedProperty(value="#{bean2}") this value/name MUST be exactly identical to the name here @ManagedBean(name="bean2") now the xhtml: bean1.xhtml .... &lt;h:commandButton action="#{bean1.fillForm}"/&gt; ....
type: Answer
has comment: http://stackoverflow.com/comment/32923540
score: 1
upvote count: 1

http://stackoverflow.com/comment/32954592
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21780333
has text: Oh man, i stumbled over my own stupidity. I opened a connection to database and call a method, which opens also a connection and closes it. of course now i can´t execute a statement, because my database is closed. Thanks Naren for your time!!!

http://stackoverflow.com/q/21833107
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21834179
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/21834383
tagged with: java
has body: Here's my controller: @InitBinder protected void initBinder(final WebDataBinder binder) { DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, new Locale("lt")); dateFormat.setLenient(true); CustomDateEditor editor = new CustomDateEditor(dateFormat, true); binder.registerCustomEditor(Date.class, editor); } When I submit my form I get an error saying : Failed to convert property value of type java.lang.String to required type java.util.Date for property dateFrom; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.Date for value 2014-02-20; nested exception is java.lang.IllegalArgumentException How to fix this ?
type: Question
answer count: 2
has title: Spring mvc custom date format based on locale

http://stackoverflow.com/comment/32819608
score: 0
comment on: http://stackoverflow.com/q/21706103
has text: Use String.equals method to compare strings in your if condition.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21778330
tagged with: dagger
has answer: http://stackoverflow.com/a/21785110
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21785110
favorite count: 0
has title: When should I use Factory<T> instead of Provider<T>
upvote count: 8
has comment: http://stackoverflow.com/comment/32948160
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/45173191
tagged with: java
type: Question
score: 8
tagged with: dependency-injection
has body: The Dagger documentation shows using a Provider&lt;Filter&gt; to get Filter instances, which appears to make perfect sense. I am writing a ListAdapter which instantiates Views, which I'd like Dagger to inject. I'm tempted to inject a Provider&lt;ViewType&gt; into my ListAdapter, and call mViewProvider.get() to instantiate views. However, the Dagger documentation says: Injecting Provider&lt;T&gt; has the possibility of creating confusing code, and may be a design smell of mis-scoped or mis-structured objects in your graph. Often you will want to use a Factory&lt;T&gt; or a Lazy&lt;T&gt; or re-organize the lifetimes and structure of your code to be able to just inject a T I can see how I could use a Factory, in a similar manner to that required when using assisted injection. But what advantage would using my own Factory&lt;T&gt; have over using Dagger's Provider&lt;T&gt;, given I'd have to write the former myself?

http://stackoverflow.com/q/21681101
has answer: http://stackoverflow.com/a/21681270
tagged with: gps
score: 2
tagged with: java
linked to: http://stackoverflow.com/q/7829097
type: Question
tagged with: mobile
has answer: http://stackoverflow.com/a/21681319
has title: Use android compass, accelerometer, and gyroscope to get current position
answer count: 2
linked to: http://stackoverflow.com/q/19727298
downvote count: 0
has body: I'm new to android programing. I know how to get a position of a user in outdoor environment using GPS. But i'm faced with a problem to find the location of a person inside a building where you don't have GPS available. I can handle the coding part but i need an idea in how to use compass, accelerometer, and gyroscope data or any other sensor data except GPS to get the current position of the user inside the building after you pass the compass, accelerometer, and gyroscope data to the server. Here consider that the inside of the building is mapped. Sorry if this is a stupid question.
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/21804023
has body: I am working on an android project in which I want to get date of birth from the user. I am using a Datepicker in such a way that the Datepicker pop up as a dialog box when I am clicking on button. Now I want to set the selected date to another java.util.date object to save it to database. I tried using setDate(), setMonth methods but its deprecated and throwing null pointer exception.Is there any other efficient method this problem?Attaching my code. private Date dob; int day,month,year; private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { year = selectedYear; month = selectedMonth; day = selectedDay; System.out.println("Dob selected="+day+"."+month+"."+year); etDOB.setText(day+"/"+month+"/"+year);//setting selected date as Content of edittext //(This part is working fine) dob.setDate(day);//the following lines throwing null pointer exception dob.setMonth(month); dob.setYear(year); } };
tagged with: android
tagged with: datepicker
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21804211
type: Question
tagged with: java
tagged with: database
score: 0
has title: How to set date from user inputs in android?
has answer: http://stackoverflow.com/a/21804211
answer count: 1

http://stackoverflow.com/a/21755113
type: Answer
answers question: http://stackoverflow.com/q/21754980
has body: Box mybox2 = new Box(mybox); is essentially a copy constructor. In your constructor you would be ideally copying properties of myBox into myBox2. Few benefits: an alternative to clone method simply extract the argument's data, and could be forwarded to the regular constructor could be used with immutable objects when you have objects with many properties and would want to copy them Also a good read : Josh Bloch on Design
score: 0
has comment: http://stackoverflow.com/comment/32906539

http://stackoverflow.com/comment/32954363
type: Comment
score: 2
has text: Well, for one, the variables declared in the constructor like that immediately go out of scope to be garbage collected...
comment on: http://stackoverflow.com/q/21781911
type: QuestionComment

http://stackoverflow.com/a/21682636
has comment: http://stackoverflow.com/comment/32778247
accepted answer of: http://stackoverflow.com/q/21682263
score: 0
answers question: http://stackoverflow.com/q/21682263
type: Answer
has body: These are two ways, If you have created instance of Fragment in activity the you can access method by fragment instance. MyFragment frag = new MyFragment(); frag.MyMethodInFragment(); //this method must not be private Or you can also find fragment by tag final String tag = MyFragment.TAG; final FragmentManager fm = getSupportFragmentManager(); final Fragment fragFragment = fm.findFragmentByTag(tag); if (fragFragment != null) { frag = (MyFragment) fragFragment ; frag.MyMethodInFragment(); } Note: you have to set tag for your fragment before finding fragment by tag. I think if you are using ViewPager you can use 1st method easily Update BookPageFragment b = BookPageFragment.newInstance(position); b.CallYourMethod(); return b;
has comment: http://stackoverflow.com/comment/32779437
type: AcceptedAnswer

http://stackoverflow.com/a/21764246
has comment: http://stackoverflow.com/comment/32925945
has comment: http://stackoverflow.com/comment/32926024
has comment: http://stackoverflow.com/comment/32926311
has comment: http://stackoverflow.com/comment/32925353
score: 0
has body: In this line: RowItem rowItem = (RowItem) getItem(position); maybe getItem(position) returned null. Then afterwards you try to call getpid() on it => NPE Put a breakpoint at this line and check the values in the debugger or alternatively output the values to the logcat to confirm that. Then adjust your code to check for null values before calling methods on it. Update: After digging through the for-loop that populates your list I have seen the following part at the end: }else{ //spotsList.add(map); rowItems.add(item); n=1; } so you add "item" to your list, but you never set it for the else-case in your if statement. You do set item only for the case if(search_bp==1) but not for the case it is not. So in the end you end up adding the item values from before entering the for-loop to your list. Try assigning proper item values for this case, maybe like this: }else{ //spotsList.add(map); item = new RowItem(id,image, //etc. rowItems.add(item); } Well alternatively, just don't add the item at all to your list in this case. Depends on what you want ;-) I hope my guess was right and helped solving your problem.
answers question: http://stackoverflow.com/q/21764017
has comment: http://stackoverflow.com/comment/32924772
type: Answer
has comment: http://stackoverflow.com/comment/32924245
has comment: http://stackoverflow.com/comment/32924482

http://stackoverflow.com/q/21717787
has comment: http://stackoverflow.com/comment/32841844
has comment: http://stackoverflow.com/comment/32841445
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/21718267
type: Question
has body: I am developing a quiz game but i have an existing database file where Question and choices are there.. How could i connect it in my program. And how could, I perform a query to display my Question in TextView and choices in Buttons.
tagged with: java
has comment: http://stackoverflow.com/comment/32841211
has title: Connecting Database (SQLITE) file in Eclipse (Android)
accepted answer: http://stackoverflow.com/a/21718267
tagged with: sqlite
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/513084
tagged with: android

http://stackoverflow.com/q/21783649
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21785262
type: Question
tagged with: guice
answer count: 1
has title: Keeping AppModule as a Singleton
has body: In my application (standalone), when I need to get some object instance from Guice, I usually do it like this: injector = Guice.createInjector(new AppModule()); instance = injector.getInstance(MyInterface1.class); I was wondering: Why do I need to pass an instance of the AppModule class, and not the module class reference itself, so Guice could instantiate it? What side-effects should I expect if I keep my AppModule class as a singleton, therefore always using the same instance when calling Guice.createInjector()? As a side note: What about the Injector itself? How bad design would it be if I keep just one instance of it somewhere?
upvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/21825963
score: 6
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/21825843
has comment: http://stackoverflow.com/comment/33037383
answers question: http://stackoverflow.com/q/21825843
has body: You can skip synchronization for the read access to that map if you make sure that all writes happen-before all reads. What it means is described in JLS 7 chapter 17.4.5. In practice, you will have to make sure that the HashMap is populated before any other threads that will access it are started and that its contents are not modified after that. The reason this solution will work is that Thread.start() call enforces a synchronization and therefore guarantees that all changes made prior to that call will be visible to both old and new threads after that call. Should you modify the object after that call this guarantee would be lost and a synchronized access would be necessary.
has comment: http://stackoverflow.com/comment/33038798
has comment: http://stackoverflow.com/comment/33035526
type: AcceptedAnswer
downvote count: 0

message-driven-bean
tags question: http://stackoverflow.com/q/21772663
tag name: message-driven-bean
tags question: http://stackoverflow.com/q/21803299
type: Tag

http://stackoverflow.com/a/21705867
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21705732
downvote count: 0
has body: You could use the Validator framework and use the DoubleValidator from commons-validator. DoubleValidator validator = DoubleValidator.getInstance(); validator.validate("1one");
type: Answer

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/21838523
type: Tag
tags question: http://stackoverflow.com/q/21839280

galaxy
type: Tag
tag name: galaxy
tags question: http://stackoverflow.com/q/21738226

http://stackoverflow.com/q/21697329
has comment: http://stackoverflow.com/comment/32808649
type: Question
answer count: 1
tagged with: jpa
downvote count: 0
has body: I am new to spring and hibernate and trying to use @ElementCollection and @Embeddable, Iv'e seen some close examples but not quite what i need, I have a "top" class that has an @IdClass and in that i want to have an @ElementCollection. Environment(and it's id) classes: class EnvironmentId implements Serializable { String userName; String envName; } @Entity @IdClass(EnvironmentId.class) public class Environment { @Id String userName; @Id String envName; @Column String location; @ElementCollection List&lt;IncludedPRPoint&gt; includedPRPoint; ... getters setters and constructures ... } IncludedPRPoint class: @Embeddable public class IncludedPRPoint implements Serializable { String prPointName; String description; String mainSite; ... Getters setters and constructors ... } when trying to use i get exception "Declaring class is not found in the inheritance state hierarchy: ..." Am I doing something wrong? Edit full stacktrace: [11:34:01:433 GMT+02:00 11/02/14] 0000006e webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[mvc-dispatcher]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'h8EntityManagerFactory' defined in class path resource [build-spring-jpa.xml]: Invocation of init method failed; nested exception is org.hibernate.annotations.common.AssertionFailure: Declaring class is not found in the inheritance state hierarchy: demo.includedPRPoint at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:532) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanF…
score: 6
has answer: http://stackoverflow.com/a/21697415
upvote count: 6
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/71766606
tagged with: spring
has title: Spring and hibernate error "Declaring class is not found in the inheritance state hierarchy"
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/21687643
downvote count: 0
has answer: http://stackoverflow.com/a/72569317
has comment: http://stackoverflow.com/comment/32787250
has comment: http://stackoverflow.com/comment/72043298
tagged with: python
favorite count: 0
has answer: http://stackoverflow.com/a/60277630
has comment: http://stackoverflow.com/comment/32787204
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32788223
upvote count: 1
has body: I am working on a large scale project that involves giving a python script a first name and getting back a result as to what kind of gender it belongs to. My current program is written in Java and using Jython to interact with a Python script called "sex machine." It works great in most cases and I've tested it with smaller groups of users. However, when I attempt to test it with a large group of users the program gets about halfway in and then gives me the following error: "Exception in thread "main" SyntaxError: No viable alternative to input '\\n'", ('&lt;string&gt;', 1, 22, "result = d.get_gender('Christinewazonek'')\n") I am more accustomed to Java and have limited knowledge of Python so at the moment I don't know how to solve this problem. I tried to trim the string that I'm giving the get_gender method but that didn't help any. I am not sure what the numbers 1, 22 even mean. Like I said since I'm using Jython my code would be the following: static PythonInterpreter interp = new PythonInterpreter(); interp.exec("import sys, os.path"); interp.exec("sys.path.append('/Users/myname/Desktop/')"); interp.exec("import sexmachine.detector as gender"); interp.exec("d = gender.Detector()"); interp.exec("result = d.get_gender('"+WordUtils.capitalize(name).trim() +"')"); PyObject gendAnswer = interp.get("result"); And this is pretty much the extent of Jython/Python interaction in my Java code. If someone sees something that's wrong or not right I would certainly appreciate if you could help me. As this is a large project it takes time to run the whole program again only to run into the same issue, so because of this I really need to fix this problem.
has comment: http://stackoverflow.com/comment/32787043
has title: No Viable Alternative to Input '\\n" Python Error
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32787581
has comment: http://stackoverflow.com/comment/32788612
answer count: 2
has comment: http://stackoverflow.com/comment/32787472

http://stackoverflow.com/a/21777732
downvote count: 0
has body: Why are you looking for regex? This can be done using String.contains(String s) String string ="www.pqr.com/page/2/"; if(string.contains("page")){ //true }
answers question: http://stackoverflow.com/q/21777647
type: Answer
upvote count: 4
score: 4

http://stackoverflow.com/comment/32791548
type: Comment
score: 0
has text: why it return empty toast message when return "clicked" but I'm sure i have clicked on button1
type: AnswerComment
comment on: http://stackoverflow.com/a/21689530

http://stackoverflow.com/comment/32819005
type: QuestionComment
has text: You need a regular expression here, because even the commas must be at very specific places, and the dot can only appear once
comment on: http://stackoverflow.com/q/21705732
score: 0
type: Comment

web-applications
tags question: http://stackoverflow.com/q/21802904
tags question: http://stackoverflow.com/q/21705440
tags question: http://stackoverflow.com/q/21834922
tags question: http://stackoverflow.com/q/21814770
tag name: web-applications
tags question: http://stackoverflow.com/q/21697108
tags question: http://stackoverflow.com/q/21825605
tags question: http://stackoverflow.com/q/21798016
tags question: http://stackoverflow.com/q/21817095
tags question: http://stackoverflow.com/q/21719379
tags question: http://stackoverflow.com/q/21739230
tags question: http://stackoverflow.com/q/21752571
tags question: http://stackoverflow.com/q/21749282
type: Tag

http://stackoverflow.com/comment/32845497
type: QuestionComment
comment on: http://stackoverflow.com/q/21720013
score: 0
has text: @SotiriosDelimanolis Here is an example: ImageIcon knightW = new ImageIcon("c:/images/knightW.png"); this is probably not the best way but I meant as a test.
type: Comment

http://stackoverflow.com/q/21780117
accepted answer: http://stackoverflow.com/a/21785735
type: AnsweredQuestion
score: 2
answer count: 1
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
tagged with: spring
has title: Spring Data JPA Query with LIKE condition throws exception on runtime
tagged with: java
has answer: http://stackoverflow.com/a/21785735
tagged with: spring-data
tagged with: jpa
has body: I'm trying to make this simple JPA query working: @Query("SELECT p FROM PersonImpl p WHERE p.customerReference LIKE :query ESCAPE '\\\\'") public Page&lt;Person&gt; findByQuery(@Param("query") String query, Pageable pageable); But upon application startup I get exception: java.lang.IllegalArgumentException: Illegal like pattern :query! at org.springframework.data.jpa.repository.query.StringQuery.getLikeTypeFrom(StringQuery.java:205) at org.springframework.data.jpa.repository.query.StringQuery.parseLikeBindings(StringQuery.java:155) When I change the :query param into a string literal, for eg. 'foobar', then it's fine. Does anyone know what's the issue here?
tagged with: spring-data-jpa

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/21750094
tags question: http://stackoverflow.com/q/21741166
tags question: http://stackoverflow.com/q/21776729

http://stackoverflow.com/comment/32884524
type: Comment
comment on: http://stackoverflow.com/q/21737206
type: QuestionComment
has text: @Taylor, I have excluded them for simplicity. @RC., you are correct that I could test the `doBasicProfiling` method that way, but I would also like to test that the advice is called when I execute an annotated method.
score: 0

jaunt-api
tags question: http://stackoverflow.com/q/21758579
type: Tag
tag name: jaunt-api
tags question: http://stackoverflow.com/q/21832695

http://stackoverflow.com/q/21734014
tagged with: jms
has body: I have a (fairly) complicated Java app that uses Camel (2.11.0) and ActiveMQ (5.8.0) to send messages between a Camel route and various ActiveMQ queues. The Camel-ActiveMQ endpoint that I am using defines a failover like so: failover:(tcp://myBroker01.example.com:61616)?jms.prefetchPolicy.queuePrefetch=1&amp;randomize=false&amp;maxReconnectDelay=250 You'll notice I only have 1 broker defined; for now I only have 1 broker (and so that kind of cancels out the usefulness of the failover transport), but down the road I may have several brokers as part of this failover URI. When I run my app, I see the following error in my app logs: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: &lt;com.me.myapp.model.WidgetVO&gt; ...middle portion of stack trace omitted for brevity; probably irrelevant Caused by: javax.jms.JMSException: Unexpected failure. at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62) at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1409) at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1496) at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:325) at org.apache.activemq.pool.ConnectionPool$2.makeObject(ConnectionPool.java:105) at org.apache.activemq.pool.ConnectionPool$2.makeObject(ConnectionPool.java:90) at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1220) at org.apache.activemq.pool.ConnectionPool.createSession(ConnectionPool.java:142) at org.apache.activemq.pool.PooledConnection.createSession(PooledConnection.java:174) at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:196) at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:457) ... 76 more Caused by: java.io.IOException: Unexpected failure. at org.apache.activemq.transport.failover.FailoverTransport.oneway(FailoverTrans…
has comment: http://stackoverflow.com/comment/32904785
type: UnansweredQuestion
answer count: 0
tagged with: activemq-classic
has comment: http://stackoverflow.com/comment/32893540
tagged with: java
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/32906252
type: Question
has comment: http://stackoverflow.com/comment/32904763
tagged with: failover
has comment: http://stackoverflow.com/comment/32885852
score: 0
has title: ActiveMQ Unexpected failure from FailoverTransport

http://stackoverflow.com/comment/32948422
type: AnswerComment
comment on: http://stackoverflow.com/a/21777981
score: 0
has text: Thanks a lot! That did the trick. Now I just have to stop the playback of the soundpool, whenever a button is pressed.
type: Comment

http://stackoverflow.com/comment/32950593
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21779713
type: Comment
has text: I know how varags work, I just think you should show that args is an array, and I think you still don't. +1 Anyway.

http://stackoverflow.com/a/21875770
answers question: http://stackoverflow.com/q/21825959
upvote count: 3
downvote count: 0
type: Answer
has body: This article is really helpful in my opinion. I have found a solution which should work, but i haven't tryed it yet. My MovingObjects all have a Vector3 position, Vector3 direction, Vector3 size and Vecotr3 upVector. The Player class extends this MovingObject class and adds Mouse and Keycontroll to the movement. In the MovingObject class i have the moethods: rotateYaw(float degrees): rotates the Vector3 direction arround the Y-Axis by the given degrees (libgdx has a rotate function for Vector3)--> Simple rotatePitch(float degrees): rotates the Vector3 direction arround the: direction.cross(Vector3.Y), which is the rotated side Vector of your MovingObject, by the given degrees. Also a Pitch-Rotation has to rotate the upVector, so you rotate the upVector arround the same axis, by the given degrees. As soon as you understand this it is simple. move(delta) moves your MovingObject in x,z direction by doing: if (direction.y == 1) { // You are looking straight up, no x,z direction, move in the opposite // direction of upVector xSpeed = upVector.x / (Math.abs(upVetor.x) + Math.abs(upVector.z)) * (-speed); zSpeed = upVector.z / (Math.abs(upVetor.x) + Math.abs(upVector.z)) * (-speed); position.add(xSpeed * delta, 0, ySpeed * delta); } else if (direction.y == -1) { // You are looking straight down, no x,z direction, move in the direction of // upVector xSpeed = upVector.x / (Math.abs(upVetor.x) + Math.abs(upVector.z)) * speed; zSpeed = upVector.z / (Math.abs(upVetor.x) + Math.abs(upVector.z)) * speed; position.add(xSpeed * delta, 0, ySpeed * delta); } else { // You are not looking straight up or down, so you have x,z direction. Use // that. xSpeed = direction.x / (Math.abs(direction.x) + Math.abs(direction.z)) * speed; zSpeed = direction.z / (Math.abs(direction.x) + Math.abs(direction.z)) * speed; position.add(xSpeed * delta, 0, ySpeed * delta); } I did not test this until now, but i think it should work. Note, that in the Pitch-rotation you should also limit it to straight up…
score: 3

http://stackoverflow.com/comment/32984054
comment on: http://stackoverflow.com/q/21798419
has text: Please elaborate a little more?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21695809
has answer: http://stackoverflow.com/a/24520180
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32832763
upvote count: 2
tagged with: network-programming
answer count: 1
has body: I am developing an application to capture all HTTP urls. I used pcap.LOOP_INFINATE for persistent capturing, but when i search on google, it does not capture any packets. Kindly give me a solution for this. This is my sample code: int snaplen = 64 * 1024; int flags = Pcap.MODE_PROMISCUOUS; int timeout = 10*1000; Pcap pcap = Pcap.openLive(device.getName(), snaplen, flags, timeout, errbuf); PcapPacketHandler&lt;String&gt; jpacketHandler = new PcapPacketHandler&lt;String&gt;() { final Tcp tcp = new Tcp(); final Ip4 ip = new Ip4(); Arp arp=new Arp();Payload payload = new Payload(); Ethernet eth=new Ethernet();Http http = new Http();Udp udp=new Udp(); public void nextPacket(PcapPacket packet, String user) { if (packet.hasHeader(tcp) &amp;&amp; packet.hasHeader(http)) { if(tcp.destination() == 80) { if(http.hasField(Http.Request.Accept) &amp;&amp; http.fieldValue(Http.Request.Accept).contains("text/html")) { String host = http.fieldValue(Http.Request.Host); String url = host + http.fieldValue(Http.Request.RequestUrl); String referer = http.fieldValue(Http.Request.Referer); System.out.println("Request: " +" - " + url); } } } } }; pcap.loop(pcap.LOOP_INFINATE,jpacketHandler, null);
favorite count: 0
has title: Can't capture google search URL using jnetpcap
type: UnansweredQuestion
score: 2
downvote count: 0

http://stackoverflow.com/q/21741168
has title: Method Inheritance
has comment: http://stackoverflow.com/comment/32882668
tagged with: java
type: Question
score: -1
tagged with: inheritance
has answer: http://stackoverflow.com/a/21741200
has comment: http://stackoverflow.com/comment/32882660
answer count: 3
has answer: http://stackoverflow.com/a/21741307
favorite count: 0
has body: Explain to me please why when I compile this code the result is 0 ? How can it be ? class Parentt { int x = 0; public void printX() { System.out.println(x); } } class Child1 extends Parentt { int x = -1; } public class Foo { public static void main(String[] args) { new Child1().printX(); } }
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/21741221
upvote count: 1

http://stackoverflow.com/comment/32875700
type: AnswerComment
comment on: http://stackoverflow.com/a/21737122
score: 0
type: Comment
has text: It doesn't *have* to be a singleton. You can create a new utility class with a static method to perform this action for you. However, it does not need to be singleton... in fact you never need to instantiate it.

http://stackoverflow.com/a/21817028
has comment: http://stackoverflow.com/comment/33027245
accepted answer of: http://stackoverflow.com/q/21816374
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21816374
has comment: http://stackoverflow.com/comment/33029368
type: AcceptedAnswer
downvote count: 0
has body: Everything you check in the build should be included in the plug-in jar at the top level (the bin directory is handled specially). To find an object in a plug-in use: URL url = FileLocator.find(bundle, new Path(path), null); where path is a relative path in the plug-in and bundle is the plug-in Bundle. You can get the Bundle from the BundleContext passed to the plug-in activator or by using Platform.getBundle("plugin id") The URL returned from this will use the bundle scheme, to convert it to a file URL use: URL fileURL = FileLocator.toFileURL(url); The file URL returned may be in a temporary location. Update: When you run your plug-in from with Eclipse (with Run / Eclipse Application) then no jar is built and the folders are not copied anywhere. You still use the FileLocator API to access the folders and the paths are the same.
type: Answer

http://stackoverflow.com/q/21828721
has comment: http://stackoverflow.com/comment/33037541
has body: I saw some code has a child class that contains other siblings. For example, Child1 below contains its siblings Child2, Child3. I wonder if there is any problem with this design? public class Parent { ... } public final class Child1 extends Parent { private Child2 child2; private Child3 child3; ... } public final class Child2 extends Parent { ... } public final class Child3 extends Parent { ... }
has comment: http://stackoverflow.com/comment/33037633
has comment: http://stackoverflow.com/comment/33037703
downvote count: 0
tagged with: inheritance
has answer: http://stackoverflow.com/a/21829033
type: AnsweredQuestion
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33037473
type: Question
has comment: http://stackoverflow.com/comment/33037630
has title: Java one child class containing other siblings
answer count: 2
accepted answer: http://stackoverflow.com/a/21829033
upvote count: 1
has answer: http://stackoverflow.com/a/21828848
tagged with: java
has comment: http://stackoverflow.com/comment/33037462
possible better answer: http://stackoverflow.com/a/21828848

http://stackoverflow.com/q/21749338
answer count: 0
tagged with: cookies
has comment: http://stackoverflow.com/comment/32896923
type: Question
has body: What I have: I use Jetty Websockets and jquery + backbone.js on my client side. Each time user open a new tab, he get new websocket connection and must to log in again. What I want: I want user haven't to log in each time he open new tab. Instead if he's already logged in one tab, new tabs will automatically log in him and redirect him to the home page. Questions: What is better: share the same websocket connection between many tabs or store user credentials and automatically relogin on new tab opening? How can I do that? Provide a little example please?
tagged with: java
tagged with: javascript
has title: Jetty Websockets: share connection among many tabs
score: 0
tagged with: websocket
type: UnansweredQuestion
tagged with: jetty
has comment: http://stackoverflow.com/comment/32901991
linked to: http://stackoverflow.com/q/9554896

http://stackoverflow.com/comment/32834063
has text: That did it :) I knew I had to be missing a <X> somewhere. I'm glad it was that simple.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21713535
type: Comment

http://stackoverflow.com/comment/32786332
comment on: http://stackoverflow.com/q/21687125
score: 0
has text: As I see you cannot connect to the LDAP from your localhost server. Does the LDAP server needs authentication? Yes. Do you have some kind of credential on you server(Tomcat)? I suppose you don't. Look for this.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33044729
type: QuestionComment
comment on: http://stackoverflow.com/q/21832573
score: 0
has text: You're not changing the version yourself are you? That is management the JPA provider should be doing. The proper way to test this is to create two threads, each fetching and updating the same entity in their own unique transaction at the same time; one of them should fail when saving. This is easy to accomplish by putting a sleep of a few seconds in the thread before committing.
type: Comment

http://stackoverflow.com/comment/33024170
score: 1
type: Comment
type: QuestionComment
has text: Seems like `header.jsp` failed to compile. Do you have any other exception messages that would indicate that?
comment on: http://stackoverflow.com/q/21820651

http://stackoverflow.com/comment/32951511
comment on: http://stackoverflow.com/a/21779840
type: Comment
has text: Im sorry but the query Im using is that one in this post and the code to execute the query is in this post either
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32878658
type: Comment
comment on: http://stackoverflow.com/q/21738690
type: QuestionComment
has text: @HotLicks I'm sorry, that's a copy-paste slip-up. Check the edit.
score: 0

http://stackoverflow.com/comment/32969566
type: Comment
type: QuestionComment
has text: try range you mean in try block? I wanted to capture the error and log in different.
score: 0
comment on: http://stackoverflow.com/q/21789999

http://stackoverflow.com/q/21769860
score: 3
has comment: http://stackoverflow.com/comment/32934198
has comment: http://stackoverflow.com/comment/32939122
answer count: 0
downvote count: 0
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa
has title: JPA Hibernate - Mapping Embedded Collections to a Single Table
has comment: http://stackoverflow.com/comment/32933972
has comment: http://stackoverflow.com/comment/32938759
has comment: http://stackoverflow.com/comment/32938633
upvote count: 3
has body: I have a table with lot of fields such as Account OrderNo Term LegNo LegSymbol LegSymbolType LegExchangeType etc etc The primary key of the above table is a composite key comprising of Account, OrderNo &amp; LegNo The data in the DB would look something like this 1234 1 2 1 AAA BBB CCC 1234 1 2 2 DDD EEE FFF The bolded ones are Account,Order,LegNo respectively. While designing the entity for the above table, we want to group all the Leg related information (All bolded columns ) in a separate class and all other info in a entity So, the main Order Entity will contain the Embedded object Leg. (I assume Leg wont be defined as an entity since it is not a separate table as such). @Entity @Table(name="xxx") public class Order implements Serializable { ... All order specific fields &amp; it's getters/setters } @Embeddable public class Leg implements Serializable { private long legNo; private String legSymbol; ... ... } I assume Order Entity would hold the account, orderNo,Term info and the OrderLeg embedded object would the other info like the above. We can have multiple legs for the same order as shown in the above record. Hence we might need to have collection of legs inside the Order entity. Can we achieve this functionality as we have only one table in place ? We cannot change the schema of the table or create a new table as it is out of our control. I tried using the @ElementCollection in the Order Entity on List of Legs but it looks like, when I try to persist a new order, the Leg details are not being taken as part of the query. If I have hibernate.hbm2ddl.auto=create as part of the persistence.xml, it deletes the existing schema and alters the existing order table to hold only the order infos and creates a separate leg table to hold the leg infos which is not desired. @Entity @Table(name="xxx") public class Order implements Serializable { **@ElementCollection private List&lt;Leg&gt; a = new ArrayList&lt;Leg&gt;();** } The values set to Leg class such as LegNo, LegS…
has comment: http://stackoverflow.com/comment/32933876
tagged with: jpa-2.0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32938568

http://stackoverflow.com/q/21816049
type: AnsweredQuestion
tagged with: java
tagged with: fileoutputstream
possible better answer: http://stackoverflow.com/a/21816176
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/21816176
score: 4
has answer: http://stackoverflow.com/a/21816168
answer count: 3
tagged with: fileinputstream
has answer: http://stackoverflow.com/a/29268936
downvote count: 0
has body: I created a custom object of type Task and I want to save it in a binary file in internal storage. Here is the class I created: public class Task { private String title; private int year; private int month; private int day; private int hour; private int minute; public Task(String inputTitle, int inputYear, int inputMonth, int inputDay, int inputHour, int inputMinute) { this.title = inputTitle; this.year = inputYear; this.month = inputMonth; this.day = inputDay; this.hour = inputHour; this.minute = inputMinute; } public String getTitle() { return this.title; } public int getYear() { return this.year; } public int getMonth() { return this.month; } public int getDay() { return this.day; } public int getHour() { return this.hour; } public int getMinute() { return this.minute; } } In an activity, I created a method that will save my object to a file. This is the code I used: public void writeData(Task newTask) { try { FileOutputStream fOut = openFileOutput("data", MODE_WORLD_READABLE); fOut.write(newTask.getTitle().getBytes()); fOut.write(newTask.getYear()); fOut.write(newTask.getMonth()); fOut.write(newTask.getDay()); fOut.write(newTask.getHour()); fOut.write(newTask.getMinute()); fOut.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } Now I would like to create a method that will extract the data from the file. By reading on the internet, a lot of people use FileInputStream but I have trouble with extracting the bytes from it and knowing how long a String can be. Furthermore, I used a simple method found online but I get permission denied. As I said, I am very new to Android development. public void readData(){ FileInputStream fis = null; try { fis = new FileInputStream("data"); System.out.println("Total file size to read (in bytes) : " + fis.available()); int content; while ((content = fis.read()) != -1) { // convert to char and display it System.out.print((char) content); } } catch (IOException e) { e.…
favorite count: 0
has title: Write and read binary files in Android
tagged with: android
accepted answer: http://stackoverflow.com/a/21816168

http://stackoverflow.com/comment/32916731
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21759926
has text: Yes they are! ZeroThing is composed of FirstThing and SecondThing. SecondThing is composed of lab1 and lab2. IS it ok?
score: 0

http://stackoverflow.com/a/21828764
answers question: http://stackoverflow.com/q/21828734
type: Answer
has body: You must also check that the result set indeed have some results in it. Put a condition over your while loop which checks that rs is not null. if(rs!=null) { while(rs.next()) { ... Process } } else { System.out.println("The query returned 0 results"); } In your code: String sql = "select distinct userid from userinfo"; stmt1 = conn.createStatement(); try (ResultSet rs = stmt1.executeQuery(sql)) { if(rs!=null) { while (rs.next()){ String mentionsIDs = (rs.getString("mentions")).trim(); try{ if (!mentionsIDs.isEmpty() ){ System.out.println(mentionsIDs); String[] arr = mentionsIDs.split("\\s+"); if(isNumeric(arr[0])){ System.out.println(arr[0]); sources.add(Long.parseLong(arr[0])); } } } catch(Exception ex){ Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); } } rs.close(); }
score: 0

http://stackoverflow.com/q/21693795
type: Question
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32798314
has title: Issue Creating Own LinkedList
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32798869
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21693876
tagged with: linked-list
has comment: http://stackoverflow.com/comment/32798301
has comment: http://stackoverflow.com/comment/32798097
has body: I have created my own LinkedList, and am running into a type issue with one of my methods. I keep receiving the error: Error: /Users/randymartinuzzi/Documents/EECS 233/FBLinkedList.java:100: incompatible types found : java.lang.Object required: FBLinkedList.Node Any Time my Program runs the line: Node n = iterator().next(); or n = iterator().next(); I am not sure why this is because my method next() returns a Node. I have attached my full code below. Any suggestions on what the issue may be would be greatly appreciated. import java.util.*; public class FBLinkedList implements Iterable, FBList { private Node front; private Person tempPerson; private Node tempNode; public FBLinkedList() { front = null; } /////////////// public int size() { int count = 0; Node nodeptr = getFront(); while (nodeptr != null) { count++; nodeptr = nodeptr.getNext(); } return count; } ////////////// public Person lookup(int i){ if(i&lt;0 || this.size() &gt;0) { throw new ArrayIndexOutOfBoundsException(); } else if(i&lt;this.size()) { Node n = iterator().next(); for(int index = 0; index &lt; i; index++) { n = iterator().next(); } return n.getElement(); } } protected Node getFront() { return front; } protected void setFront(Node front) { this.front = front; } public Iterator iterator() { return new ListIterator(getFront()); } public static class Node { private Person element; private Node next; public Node(Person element, Node next) { this.element = element; this.next = next; } public Person getElement() { return element; } public Node getNext() { return next; } public void setNext(Node next) { this.next = next; } } private static class ListIterator implements Iterator { private Node nodeptr; public ListIterator(Node first) { nodeptr = first; } @Override public boolean hasNext() { return (nodeptr != null); } @Override public Node next() { try { Node element = nodeptr; nodeptr = nodeptr.getNext(); return element; } catch (NullPointerException e) { throw new NoSuchElementException(); } } } }
downvote count: 1

http://stackoverflow.com/comment/33023787
has text: ... or else call `super(config)` from `init(ServletConfig config).`
type: Comment
comment on: http://stackoverflow.com/a/21820171
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33035558
type: Comment
comment on: http://stackoverflow.com/a/21824199
has text: And why you are getting just one item in the map because I while loop you are removing every item using it.remove()
type: AnswerComment
score: 0

http://stackoverflow.com/q/21807061
score: -1
has answer: http://stackoverflow.com/a/21807243
tagged with: class
has answer: http://stackoverflow.com/a/21807079
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/33000090
has comment: http://stackoverflow.com/comment/32999757
type: UnansweredQuestion
downvote count: 2
tagged with: java
upvote count: 1
tagged with: methods
type: Question
tagged with: object
has body: I am going through some past exam papers and some questions are pretty basic. One of the Question is; which of the following best describes the role of a class in the Java language? a) A class defines where a Java program starts executing. b) A class is a graphical user interface component. c) A class is a specification of an object, through grouping variables and methods that define that object. d) A class is an instance of an object containing variables and methods. e) A class is a group of IT students in the Computing Building at the university. I personally believe that it's 'C' but then again 'D' also seems like the role of a class(my apologies if i am wrong). I am new to Java so i'm sorry if this seems like an unprofessional question. Thanks for your help.
has title: Role of a Class in Java
has answer: http://stackoverflow.com/a/21807082

http://stackoverflow.com/a/21741479
has body: Have you tried to use Path object? Also have you tried to use floats in your object to avoid type conversion while drawing it? I'm not experienced with drawing CAD on android, but when i was using such programs on desktop or android i noticed that while you are dragging something, the image stays still. So you need to investigate code that save you drawing to a cache(bitmap) for that moment and not use draw line 5K times for every onDraw call. Also i think you already know that when you zoom in/out some layers shouldn't be visible if they are not representing meaningful information for that layer. Did you look for AutoCAD for android? How do they do it? I think you should search for drawing optimisations...
has comment: http://stackoverflow.com/comment/32915590
has comment: http://stackoverflow.com/comment/32914641
has comment: http://stackoverflow.com/comment/32887947
score: 0
answers question: http://stackoverflow.com/q/21740961
has comment: http://stackoverflow.com/comment/32883172
type: Answer
has comment: http://stackoverflow.com/comment/32883969

http://stackoverflow.com/comment/32931374
score: 0
has text: You have now searched for "Windows" (capitalized) _and_ moved your close() statements out of the while loop?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21768472

http://stackoverflow.com/comment/32963656
has text: Thanks, M.Deinum, for your help. I actually got this to work ;)
score: 0
comment on: http://stackoverflow.com/q/21780709
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21746689
has comment: http://stackoverflow.com/comment/32892661
has comment: http://stackoverflow.com/comment/32892736
has comment: http://stackoverflow.com/comment/32892282
has comment: http://stackoverflow.com/comment/32892876
has comment: http://stackoverflow.com/comment/32892559
type: Answer
has comment: http://stackoverflow.com/comment/32892538
has comment: http://stackoverflow.com/comment/32892429
has comment: http://stackoverflow.com/comment/32892643
has comment: http://stackoverflow.com/comment/32892355
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21746658
has comment: http://stackoverflow.com/comment/32892775
accepted answer of: http://stackoverflow.com/q/21746658
has comment: http://stackoverflow.com/comment/32892699
has comment: http://stackoverflow.com/comment/32892797
has comment: http://stackoverflow.com/comment/32892992
has comment: http://stackoverflow.com/comment/32892973
type: AcceptedAnswer
downvote count: 0
has body: You have one variable mBitmap which is not initialized, That's why it is throwing NPE. @Override protected void onDraw(Canvas canvas) { canvas.drawBitmap(mBitmap,0,0,mBitmapPaint); // NPE here for (Path p : paths) { canvas.drawPath(p, mPaint); } } You need to initialized this variable.
has comment: http://stackoverflow.com/comment/32892837

buffer
tags question: http://stackoverflow.com/q/21828119
tag name: buffer
tags question: http://stackoverflow.com/q/21725410
type: Tag

http://stackoverflow.com/a/21685158
score: 3
downvote count: 0
upvote count: 3
type: AcceptedAnswer
has body: That is due to the fact that you're calling: matcher.reset(); inside your while loop. As per Java doc: public Matcher reset() Resets this matcher. Resetting a matcher discards all of its explicit state information and sets its append position to zero. The matcher's region is set to the default region, which is its entire character sequence. The anchoring and transparency of this matcher's region boundaries are unaffected. Because of reset() in your while loop, matcher gets reset every time and while (matcher.find()) becomes an infinite loop since it always finds from start position.
accepted answer of: http://stackoverflow.com/q/21685098
type: Answer
answers question: http://stackoverflow.com/q/21685098

http://stackoverflow.com/comment/33897286
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21740511
has text: Can you please tell in detail how to use csv data set config to tell that the first column is delay. I created a csv file with delay and url but not able to get jmeter use the delay
type: AnswerComment

http://stackoverflow.com/comment/32831000
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21711752
has text: Thank you Chthonic Project. It would appear that that was exactly what the problem was and I noticed the fact that i had a plus and not a minus when i went back to fix that "=". =D Thank you everyone for help. Sorry I made it so confusing for you.

http://stackoverflow.com/q/21803437
answer count: 3
has title: Accessing methods and variables through super in Java
has answer: http://stackoverflow.com/a/21803464
has comment: http://stackoverflow.com/comment/32993184
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21803743
has body: I am trying to implement the below code, but I am getting an error in class HistoryStudent extends Student, sGrade. How do I go about adding the student grade through super? This is an assignment and we are not supposed to change anything in the abstract class or any part of the below code. abstract class Student { private String studentID = "" ; private int studentGrade = 0 ; public Student (String sID, int sGrade) { studentID = sID ; studentGrade = sGrade ; return ; } public String getStudentID () { return studentID ;} public double getStudentGrade () { return studentGrade ;} boolean updateGrade (int grade) { boolean check = false ; studentGrade += grade; return check ; } } class HistoryStudent extends Student { public HistoryStudent (String sID, int sGrade) { super(sID,sGrade) ; return ; } boolean updateGrade (int grade) { boolean checking = false ; //Problem here **sGrade** += grade; return checking ; } } Any help appreciated.
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21803584
accepted answer: http://stackoverflow.com/a/21803743
possible better answer: http://stackoverflow.com/a/21803584

http://stackoverflow.com/a/21825461
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21814580
upvote count: 2
answers question: http://stackoverflow.com/q/21814580
type: AcceptedAnswer
has body: The reason I got the error was pointing the wrong SSO URL The right address is https://SSO-SERVER:7444/ims/STSService
type: Answer

http://stackoverflow.com/a/21817847
has comment: http://stackoverflow.com/comment/33018975
upvote count: 1
has body: Are you just looking for for (int i = 0; i &lt; 4; i++) { myFinch.setWheelVelocities(255,255,1000); myFinch.setWheelVelocities(255,0,800); }
score: 1
answers question: http://stackoverflow.com/q/21817819
downvote count: 0
type: Answer

http://stackoverflow.com/a/21789715
upvote count: 0
answers question: http://stackoverflow.com/q/21789661
has body: When trying to do what you described, I found the following class very useful to base my code on: http://cs.fit.edu/~ryan/java/programs/2d/Curve-java.html Good Luck!
type: Answer
has comment: http://stackoverflow.com/comment/32968938
has comment: http://stackoverflow.com/comment/32969714
has comment: http://stackoverflow.com/comment/32970316
has comment: http://stackoverflow.com/comment/32970211
has comment: http://stackoverflow.com/comment/32969410
downvote count: 1
has comment: http://stackoverflow.com/comment/32968823
score: -1

http://stackoverflow.com/comment/33029668
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21823552
has text: It didn't work. I'm still getting the error message.
type: AnswerComment

http://stackoverflow.com/comment/32927450
has text: @selomojemalo: the best answer is to study and learn the various layout managers that Swing and AWT have available, including using nested JPanels, each using its own layout manager and components.
score: 0
comment on: http://stackoverflow.com/a/21766152
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/32970860
score: 0
type: Comment
has text: One more thing. What about a case in which the array size is 10 but the DB populates it with only 5 values? I suppose in that case we'll get blank tags for the rest 5. Any way to counter that?
comment on: http://stackoverflow.com/a/21790586
type: AnswerComment

http://stackoverflow.com/a/21697167
has body: The problem is with your input. When you do fileIn.nextDouble() you are expecting a double. What you are getting from the file is actually the String ' 300', so with a space in front. This cannot be converted to a double by Scanner. This should point you already in the right direction.
answers question: http://stackoverflow.com/q/21696698
type: Answer
score: 0

http://stackoverflow.com/a/21798490
score: 0
type: Answer
has body: From what I see you just try to see if they are equal, if this is true, just go with something like this: boolean areEqual = Arrays.equals(Arrays.sort(arr1), Arrays.sort(arr2)); This is the standard way of doing it. Doing so because like ZouZou states and as marked in the documentation: "Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, two arrays are equal if they contain the same elements in the same order"
answers question: http://stackoverflow.com/q/21798434
has comment: http://stackoverflow.com/comment/32984154
has comment: http://stackoverflow.com/comment/32984130

http://stackoverflow.com/comment/32874900
type: Comment
has text: I'm not concerned with the JDBC bit (second paragraph of original question). I'm using a bcrypt hash.
comment on: http://stackoverflow.com/a/21734396
score: 0
type: AnswerComment

http://stackoverflow.com/a/21743466
has body: Create an array. String playersArray[] = new String[players]; Then each iteration, load the name into the array playersArray[nr] = Name; Once your loop finishes, you'll have an array of player names index in order of their entry.
answers question: http://stackoverflow.com/q/21743451
type: Answer
accepted answer of: http://stackoverflow.com/q/21743451
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/21745146
type: UnansweredQuestion
score: 0
tagged with: web-services
has answer: http://stackoverflow.com/a/21745206
has body: I've created a web service using Java (Netbeans IDE). The web service is a web service with MySQL database. and now I want to create a client application using C# Windows Form (Visual Studio IDE). I've added a web reference (wsdl link) on a client project. but I am confused about how to display the records from my database on my C# Windows Form. Need help pleaseee,,, thx before...
tagged with: java
tagged with: mysql
type: Question
tagged with: c#
answer count: 1
has title: How to show mysql database from java web service using c#

http://stackoverflow.com/a/21751020
answers question: http://stackoverflow.com/q/21750934
type: Answer
has body: file = getClass().getClassLoader().getResourceAsStream("extra/dao/database.properties") ; prop.load(file);
score: 0

http://stackoverflow.com/comment/32957148
has text: Basically you're asking the different between being something, and having/using something. A Banana *is* a Fruit (it extends Fruit). A Buyer buys and eats fruits.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/21783301
type: QuestionComment

http://stackoverflow.com/q/21727629
has answer: http://stackoverflow.com/a/21727867
has comment: http://stackoverflow.com/comment/32858436
has answer: http://stackoverflow.com/a/21752418
has comment: http://stackoverflow.com/comment/32857448
tagged with: return
tagged with: resultset
has comment: http://stackoverflow.com/comment/32857511
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32857658
tagged with: java
possible better answer: http://stackoverflow.com/a/21727788
has answer: http://stackoverflow.com/a/21727788
accepted answer: http://stackoverflow.com/a/21752418
type: Question
tagged with: function
has comment: http://stackoverflow.com/comment/32857493
has comment: http://stackoverflow.com/comment/32857602
has body: I am new in Java. I am doing this thing it creates error, please let me know why I am going in this function dispatchUncaughtException. Am I doing right ? If I am not so how can this thing possible ? This is dataCollection Class public class dataCollection { private ResultSet my_rs1 = null; public ResultSet mydata() { try { String get_data_query = "SELECT * FROM my_table "; my_rs1 = cn.stmt.executeQuery(aggregator_data_query); } catch(SQLException SQLex) { System.out.println("SQL Error: " + SQLex.getMessage()); } return my_rs1; } } This is callingClass // where we call ResultSet public class callingClass { dataCollection dc = new dataCollection; private ResultSet my_call_data = dc.mydata(); while(my_call_data.next()) { //Code Here } } EDIT Exception in thread "Thread-2" java.lang.NullPointerException at sms_sender.dataCollection.aggregator_data(dataCollection.java:29) at sms_sender.threadClass.run(threadClass.java:27)
linked to: http://stackoverflow.com/q/3988788
has comment: http://stackoverflow.com/comment/32857844
has title: function return resultset, get in another class - JAVA
has comment: http://stackoverflow.com/comment/32857621
score: 0
answer count: 3

http://stackoverflow.com/comment/33025422
has text: `String#toCharArray()` always returns a new instance.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21821477
score: 1

http://stackoverflow.com/comment/36884523
comment on: http://stackoverflow.com/q/21779136
type: Comment
type: QuestionComment
has text: My guess is that auto-updates are somehow not updating the version information. I saw the same issue you did (version stuck at u51 even though I had u60); after uninstalling the JDK and manually reinstalling it through Oracle's installer, I see the correct version.
score: 0

http://stackoverflow.com/a/38459608
score: 1
upvote count: 1
downvote count: 0
has body: I had the same problem today. When I check the error, I found org.hibernate.search on several lines, even though I'm just using the Hibernate ORM. Then I removed the build path of Hibernate Search and no more error. Check if you have the same path and if you don't need it, just remove it.
answers question: http://stackoverflow.com/q/21821620
type: Answer

http://stackoverflow.com/comment/32793151
has text: The class used should be Number, which is "agnostic" and will cover either Double or Long. Generally the parser will return integer values as Long and fractional values as Double.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21690535

http://stackoverflow.com/comment/32842980
has text: class Player { Statbook stats; String name = ""; public Player(String n) { name = n; stats = new Statbook(); } public Statbook getStats() { return stats; } } Statbook is also of Dictionary class
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21718901
score: 0

http://stackoverflow.com/comment/33001424
comment on: http://stackoverflow.com/q/21807944
score: 0
has text: That is the mistake, please disregard and take as adder, so that it should add further Node additions.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21813134
answer count: 1
has title: Android round up .05 to 0.1
linked to: http://stackoverflow.com/q/2302927
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33010646
has comment: http://stackoverflow.com/comment/33010576
has answer: http://stackoverflow.com/a/21813277
has body: this is i want the result in java 1.05 rounded to 1.1 1.15 rounded to 1.2 but i have tried global.UnitPrice = Math.round(Double.parseDouble(String.format("%.2f", 1.05))); result = 1.00, should be 1.10 ? i have tried this method Round to Next .05 in C Multiply by 20, use ceiling, divide by 20. but can't work? any easier method? or formal way?
has comment: http://stackoverflow.com/comment/33011130
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21813277
type: Question
tagged with: android

http://stackoverflow.com/comment/33052421
has text: put the jar in your libs folder.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21836921

http://stackoverflow.com/a/21751017
answers question: http://stackoverflow.com/q/21750934
has body: If you're loading the properties file into a Properties object, try the something like: Properties properties = new Properties(); properties.load(getClass().getResourceAsStream("../dao/database.properties")); I don't know your full package structure but using this approach and putting the full path to the properties file would also work, ie: /extra/dao/database.properties
score: 0
type: Answer

http://stackoverflow.com/comment/33047427
score: 0
has text: i changed port to 1433 and it gives me this IO Error: Got minus one from a read call on the line with login infos
type: Comment
comment on: http://stackoverflow.com/a/21833908
type: AnswerComment

http://stackoverflow.com/comment/33056380
comment on: http://stackoverflow.com/a/21839064
score: 0
type: Comment
has text: I need to set a chunk Key and Value. so my read function will find it.
type: AnswerComment

http://stackoverflow.com/comment/71766606
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21697329
has text: I believe this can happen when you mix private / public fields, getters, setters, or use a annotation like `@Id` inside the embeddable. a bit weird

http://stackoverflow.com/comment/33092629
type: Comment
comment on: http://stackoverflow.com/a/21848593
has text: About first part. The geometry of children may appear so that it will be a alley to leave parent control by first entering the child. If this happen, then the track will be lost.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32866511
type: Comment
has text: Consider reading http://developer.android.com/training/basics/intents/result.html , more specificly the startActivityForResult method. Should serve your needs
comment on: http://stackoverflow.com/q/21732520
score: 2
type: QuestionComment

http://stackoverflow.com/q/21808033
has body: Overview I am using the WEKA API 3.7.10 (developer version) to use my pre-made .model files. I made 25 models: five outcome variables for five algorithms. J48 decision tree. Alternating decision tree Random forest LogitBoost Random subspace I am having problems with J48, Random subspace and random forest. Necessary files The following is the ARFF representation of my data after creation: @relation WekaData @attribute ageDiagNum numeric @attribute raceGroup {Black,Other,Unknown,White} @attribute stage3 {0,I,IIA,IIB,IIIA,IIIB,IIIC,IIINOS,IV,'UNK Stage'} @attribute m3 {M0,M1,MX} @attribute reasonNoCancerSurg {'Not performed, patient died prior to recommended surgery','Not recommended','Not recommended, contraindicated due to other conditions','Recommended but not performed, patient refused','Recommended but not performed, unknown reason','Recommended, unknown if performed','Surgery performed','Unknown; death certificate or autopsy only case'} @attribute ext2 {00,05,10,11,13,14,15,16,17,18,20,21,23,24,25,26,27,28,30,31,33,34,35,36,37,38,40,50,60,70,80,85,99} @attribute time2 {} @attribute time4 {} @attribute time6 {} @attribute time8 {} @attribute time10 {} @data 65,White,IIA,MX,'Not recommended, contraindicated due to other conditions',14,?,?,?,?,? I need to get the binary attributes time2 to time10 from their respective models. Below are snippets of the code I use to get the predictions from all the model files: private static Map&lt;String, Object&gt; predict(Instances instances, Classifier classifier, int attributeIndex) { Map&lt;String, Object&gt; map = new LinkedHashMap&lt;String, Object&gt;(); int instanceIndex = 0; // do not change, equal to row 1 double[] percentage = { 0 }; double outcomeValue = 0; AbstractOutput abstractOutput = null; if(classifier.getClass() == RandomForest.class || classifier.getClass() == RandomSubSpace.class) { // has problems predicting time2 to time10 instances.setClassIndex(5); } else { // works as intended in LogitBoost and ADTree ins…
has title: WEKA-generated models does not seem to predict class and distribution given the attribute index
tagged with: weka
score: 2
answer count: 1
downvote count: 0
tagged with: decision-tree
favorite count: 0
accepted answer: http://stackoverflow.com/a/21852900
type: AnsweredQuestion
tagged with: prediction
upvote count: 2
tagged with: machine-learning
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21852900

http://stackoverflow.com/a/21826663
has comment: http://stackoverflow.com/comment/33034321
has comment: http://stackoverflow.com/comment/33034710
has comment: http://stackoverflow.com/comment/33034264
score: 0
has body: Create A SMS broadcast receiver for this that gets triggered when an sms is received public 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()); if (intent.getAction() == SMS_RECEIVED) { Bundle bundle = intent.getExtras(); if (bundle != null) { Object[] pdus = (Object[])bundle.get("pdus"); final SmsMessage[] messages = new SmsMessage[pdus.length]; for (int i = 0; i < pdus.length; i++) { messages[i] = SmsMessage.createFromPdu((byte[])pdus[i]); } if (messages.length > -1) { Log.i(TAG, "Message recieved: " + messages[0].getMessageBody()); } } } } } Inside the receiver, you can check for the text you received and perform the particular action. declare it in manifest also, Also declare the permissions,
type: Answer
has comment: http://stackoverflow.com/comment/33034500
answers question: http://stackoverflow.com/q/21826432

http://stackoverflow.com/q/21683656
tagged with: arrays
score: 0
answer count: 2
tagged with: program-entry-point
has answer: http://stackoverflow.com/a/21683884
has answer: http://stackoverflow.com/a/21683691
type: UnansweredQuestion
has title: confusion about inputing an array in the main method
tagged with: java
type: Question
has body: I have this method that checks how many 9's are in an array. public static int arrayCount9(int[] nums){ int count = 0; for (int i = 0; i&lt; nums.length; i++){ if(nums[i]==9) count++; } return count; } I am getting an error on my main method and I don't understand why. public static void main(String [] args){ System.out.println(arrayCount9([1,5,9]));

http://stackoverflow.com/q/21724945
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21724966
upvote count: 30
has answer: http://stackoverflow.com/a/21725023
has answer: http://stackoverflow.com/a/21725021
type: UnansweredQuestion
has title: Store a number that is longer than type long in Java
answer count: 4
score: 30
has comment: http://stackoverflow.com/comment/32854548
duplicate of: http://stackoverflow.com/q/849813
has body: How can I store a number that is longer than the long type (MAX: 9223372036854775807) in Java? For example the number 9223372036854775820. Thanks in advance.
linked to: http://stackoverflow.com/q/849813
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21724958

http://stackoverflow.com/q/21717353
has comment: http://stackoverflow.com/comment/32840530
score: 0
has comment: http://stackoverflow.com/comment/32840504
has comment: http://stackoverflow.com/comment/32841630
answer count: 0
type: UnansweredQuestion
has title: Java program to draw two mountains
tagged with: java
has comment: http://stackoverflow.com/comment/32840462
type: Question
has body: Scanner scanner = new Scanner(System.in); int row = scanner.nextInt(); for(int i = 0; i &lt; row; i++) { int column = 2 * row - 1; for(int j = 0; j &lt; column; j++) { System.out.print("*"); } System.out.print("\n"); Here is my code, I managed to print out number of stars depending on user's input, but Im not sure how to print out increasing number of stars. The idea is should be know the max number of stars to be printed, then print out empty lines -> star -> empty lines. Can someone give me some ideas thanks!

http://stackoverflow.com/q/21739716
answer count: 1
has title: WebSphere MQ Content Enricher in Java
tagged with: jms
tagged with: ibm-mq
has body: How would you implement a Content Enricher in WebSphere MQ using Java? Given an existing input message is provided from a queue, here are some of my ideas, none of which satisfies me: Deep-clone the message object. Here is an explanation of how it could be done, but I can't find either clone() or serialize() methods for the javax.jms.Message class. Take the original message, set the additional properties using setXXXProperty() and send it forward. This throws an exception suggesting that the message is read-only. Create a new message, iterate over properties of the existing message and set them to the new message. getPropertyNames() can help to do this, but it says nothing about types of properties, so this information will be lost.
has comment: http://stackoverflow.com/comment/32888347
has answer: http://stackoverflow.com/a/21744445
accepted answer: http://stackoverflow.com/a/21744445
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: messaging
linked to: http://stackoverflow.com/q/64036
score: 0

http://stackoverflow.com/q/21815227
downvote count: 1
type: Question
upvote count: 0
score: -1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33014515
type: UnansweredQuestion
tagged with: android
has body: I would like to have an Android project which will be a Library Project that holds all my activities and their behaviour, and another Android project which is that actual application that uses the activities from the Library. What I have done was start a new Android project and I check "Mark as Library" check box. On that project I have one activity. I've created another Android Project (regular one) and in the project properties I've added the previous project under the projects tab. To that project I then added in the manifest the activity defenition that I copied and pasted from the precious project. When I try to run it it fails: 02-16 19:56:53.164: E/AndroidRuntime(432): FATAL EXCEPTION: main 02-16 19:56:53.164: E/AndroidRuntime(432): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.test.myapp/com.test.myapp.MyActivity}: java.lang.ClassNotFoundException: com.test.myappcore.MyActivity in loader dalvik.system.PathClassLoader[/data/app/com.test.myapp-2.apk] What am I doing wrong? Thanks
has answer: http://stackoverflow.com/a/21815293
has title: Creating Android library project with activities
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/21775808
has comment: http://stackoverflow.com/comment/47145119
answers question: http://stackoverflow.com/q/21775320
score: 2
downvote count: 0
has body: I think Parcelable is the same as Externalizable introduced in JAVA 1.1. So, it is good known approach how to serialize objects. What is the difference between Serializable and Externalizable in Java? Generally, downsides of Serializable are performance and performance. As is said in the answer from the link. You can use a 3th party implementations which are a bit faster. But it will be never as fast as externalizable. Externalizable or Parcerable leverage from explicit definition how to load and store your objects. The problem is you should maintain a version of object to know what logic to use to serialize or deserialize your objects. There could be a problem with backward compatibility and the programming work is much slower to it this (the right :)) way. But when we come to run-time this approach it's much faster.
type: Answer
upvote count: 2

http://stackoverflow.com/q/21700911
tagged with: playframework
has body: I am trying to generate the PDF in a Job instead of creating it in controller as it is going to take time. I am using the PDF generation code shown below. This is the standard function that Play framework provides. PDF.writePDF(file,"test.html",data, options); Now when I run this I get Null pointer exception. I debugged the issue in the Play framework PDF modules source code. Below is the line where the null pointer is coming because it is trying to access the request object, but as I have called the code from a Job not from Controller the request is null. public static void writePDF(OutputStream out, Object... args) { final Http.Request request = Http.Request.current(); final String format = request.format; Is there any other way of achieving this functionality.
answer count: 1
favorite count: 0
has title: Play Framework 1.2.x Pdf module issue while generationg pdf in Job/Offline
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21703727
accepted answer: http://stackoverflow.com/a/21703727
downvote count: 0

http://stackoverflow.com/comment/32963997
score: 1
has text: It is probably this: `mh.role_id in ({role_id=2},{role_id=4},{role_id=1},{role_id=8},{role_id=38},{role_id=22},{role_id=69})`. Do you mean `mh.role_id IN (2,4,1,8,38,22,69)`
comment on: http://stackoverflow.com/q/21787028
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33058328
comment on: http://stackoverflow.com/q/21840094
type: Comment
type: QuestionComment
has text: Block of text and unformatted code - this question does not look good. More importantly **never change or otherwise interact with Swing components outside of the EDT**. Maybe start with the [Oracle tutorial on the topic](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/).
score: 1

http://stackoverflow.com/comment/32989085
comment on: http://stackoverflow.com/q/21801110
score: 0
has text: You can always use a `Map<String, Command>` where keys are command names and values are implementations of an interface for executing these commands. That is one solution amongst many
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33034939
comment on: http://stackoverflow.com/a/21826750
has text: Opps, I thought 19611015 is MilliSecond, my bad.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21832715
type: AnsweredQuestion
has body: How can "size in bytes" of a array of some datatype be determined? What makes me ask this is a question from this icse board question paper. The question is as follows: And the accepted answers by the board are (space occupied by one of those data types*no of elements in the array) For example , one int array of 10 objects is said to take 4*10=40Bytes But my question is, wouldn't the array have to store it's length and indexes somehow(increasing it's size on memory), or am I misunderstanding the question?
tagged with: java
tagged with: memory
has answer: http://stackoverflow.com/a/21832774
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/33045019
score: 6
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21832774
favorite count: 0
has title: Actual size in bytes occupied by an array of x datatype in java?
upvote count: 6

http://stackoverflow.com/comment/32812512
comment on: http://stackoverflow.com/q/21702198
has text: Might be doable in the browser using [`FileReader`](https://developer.mozilla.org/en-US/docs/Web/API/FileReader); depending whether the file is already accessible on the web or not. Don't you think @AndersR.Bystrup ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21729597
type: Answer
upvote count: 5
has comment: http://stackoverflow.com/comment/33220161
has comment: http://stackoverflow.com/comment/33225384
has comment: http://stackoverflow.com/comment/32863254
has comment: http://stackoverflow.com/comment/33236604
has comment: http://stackoverflow.com/comment/33221229
accepted answer of: http://stackoverflow.com/q/21729315
type: AcceptedAnswer
downvote count: 1
score: 4
answers question: http://stackoverflow.com/q/21729315
has body: A very fast method althrough somewhat challenging to implement would be to store your words in a Trie - http://en.wikipedia.org/wiki/Trie A trie is a tree structure that contains a char in every node and an array of pointers pointing to next nodes. Without blank spaces it would be easy - just follow the trie structure, you can check this in linear time. When you have a blank, you will have a loop to search all possible routes. This can sound complicated and difficult if you are not familiar with tries but if you get stuck I can help you with some code. EDIT: Ok, here is some c# code for your problem using tries, I think you will have no problems converting it in JAVA. If you do, leave a comment and I will help. Trie.cs public class Trie { private char blank = '_'; public Node Root { get; set; } public void Insert(String key) { Root = Insert(Root, key, 0); } public bool Contains(String key) { Node x = Find(Root, key, 0); return x != null &amp;&amp; x.NullNode; } private Node Find(Node x, String key, int d) { // Return value associated with key in the subtrie rooted at x. if (x == null) return null; if (d == key.Length) { if (x.NullNode) return x; else return null; } char c = key[d]; // Use dth key char to identify subtrie. if (c == blank) { foreach (var child in x.Children) { var node = Find(child, key, d + 1); if (node != null) return node; } return null; } else return Find(x.Children[c], key, d + 1); } private Node Insert(Node x, String key, int d) { // Change value associated with key if in subtrie rooted at x. if (x == null) x = new Node(); if (d == key.Length) { x.NullNode = true; return x; } char c = key[d]; // Use dth key char to identify subtrie. x.Children[c] = Insert(x.Children[c], key, d + 1); return x; } public IEnumerable&lt;String&gt; GetAllKeys() { return GetKeysWithPrefix(""); } public IEnumerable&lt;String&gt; GetKeysWithPrefix(String pre) { Queue&lt;String&gt; q = new Queue&lt;String&gt;(); Collect(Find(Root, pre, 0), pre, q); return q; } private vo…

http://stackoverflow.com/a/21769413
answers question: http://stackoverflow.com/q/21769350
score: 0
has comment: http://stackoverflow.com/comment/32932948
has body: sorry, but if you want to write ints to bytes, can't you use ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); int x = 555; dos.writeInt(x); dos.close(); byte[] bytes = baos.toByteArray(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bytes)); int y = dis.readInt(); System.out.println(y); ?
type: Answer

http://stackoverflow.com/comment/32995655
type: Comment
type: QuestionComment
has text: @Janos - I think that method isn't directly in JPanel
comment on: http://stackoverflow.com/q/21804676
score: 0

http://stackoverflow.com/q/21810334
has comment: http://stackoverflow.com/comment/33005558
upvote count: 14
has answer: http://stackoverflow.com/a/21810366
answer count: 2
has comment: http://stackoverflow.com/comment/33005896
downvote count: 1
linked to: http://stackoverflow.com/q/13033037
has title: What is the type on null as a method argument?
tagged with: java
has comment: http://stackoverflow.com/comment/33005592
possible better answer: http://stackoverflow.com/a/21810369
accepted answer: http://stackoverflow.com/a/21810366
has answer: http://stackoverflow.com/a/21810369
type: AnsweredQuestion
favorite count: 0
score: 13
type: Question
has body: So here it is this example public static void main(String[] args) { new Stuff(null); new Stuff("a"); new Stuff(1); } and class Stuff is defined as follow public class Stuff { Stuff(Object o){ System.out.println("object"); } Stuff(String s){ System.out.println("string"); } } The output is string string object How does Java tell the null is a String? If I change Stuff to public class Stuff { Stuff(String s){ System.out.println("string"); } Stuff(Integer o){ System.out.println("Integer"); } } I get compilation error for Stuff(null): The constructore Stuff(String) is ambigous. Again, why does Java "decide" null is a String?

http://stackoverflow.com/q/21748767
score: 1
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21749182
tagged with: insert
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/32896459
has title: JAVA | mybatis | Insert a multimap
has body: I have a use-case wherein i want to insert a multimap ( eg. Multimap ) into database using mybatis. i am not able to access key and value in mybatis using the following : (assumed that it would invoke the entrySet and iterate on it internally before inserting) INSERT INTO table1 (integer1, integer2) VALUES (#{key} , #{value}) Any idea how this can be done ? I am assuming there should be a straightforward way, as this is a basic use case. --EDIT-- Though i can create a wrapper object, set these values and send them to mybatis, i wanted to know if there is any other way to achieve the end result without creating additional objects, as this is the only place where i need them. Thanks for the help. ---EDIT--- Tested after incorporating the suggested solution. Code snippet for details: DAO layer: Map&lt;String, Object&gt; params = new HashMap&lt;&gt;(); params.put("entries", myMultimap.entries()); Mybatis sql: INSERT INTO table1 (integer1, integer2) VALUES &lt;foreach item="item" separator="," collection="entries"&gt; ( #{item.key} , #{item.value} ) &lt;/foreach&gt; --- EDIT --- Guys, with the above solution watch out for max 2000 characters in parameter length. If you face the issue, batching/bulk insert will be the way to proceed further.
tagged with: java
has answer: http://stackoverflow.com/a/21749182
has comment: http://stackoverflow.com/comment/32896262
answer count: 1
has comment: http://stackoverflow.com/comment/32896113
downvote count: 0
tagged with: mybatis

gui-testing
type: Tag
tags question: http://stackoverflow.com/q/21832947
tags question: http://stackoverflow.com/q/21780715
tag name: gui-testing

http://stackoverflow.com/comment/32917261
has text: @Sree: If you mean vertical scrolling, you would need to use a `ScrollView` or something. Tabbed indicators, and `ViewPager` itself, offer horizontal swiping for their contents.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21758565

http://stackoverflow.com/comment/33010675
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21794308
has text: //Adding to above comment code Teacher teacher1 = new Teacher(); teacher1.setSchool(schoolObj); teacher1.setName("Teacher 2"); teachers.add(teacher1); teacher teacher2 = new Teacher(); teacher2.setSchool(schoolObj); teacher2.setName("Teacher 3"); teachers.add(teacher2); school.setTeachers(teachers); em.persist(schoolObj); em.getTransaction().commit(); em.close();

http://stackoverflow.com/q/21717568
has comment: http://stackoverflow.com/comment/32840957
has comment: http://stackoverflow.com/comment/32841036
has comment: http://stackoverflow.com/comment/32841209
tagged with: class
has comment: http://stackoverflow.com/comment/32841098
score: 0
has comment: http://stackoverflow.com/comment/32840968
has comment: http://stackoverflow.com/comment/32841029
has comment: http://stackoverflow.com/comment/32841119
has comment: http://stackoverflow.com/comment/32841078
has title: "java.lang.ArrayIndexOutOfBoundsException" Issue with array logic
has comment: http://stackoverflow.com/comment/32841137
tagged with: file
has body: Issue now is i'm getting java.lang.ArrayIndexOutOfBoundsException: I've been fiddling around for a few hours and don't know if the problem is in SalesManager or SalesAnaylzer. What I am trying to do is format the array values to money and and add lables Store 1.. and QTR 1... Im pretty sure I got the totalSales, highestStoreSales, and averageStoreSales correct Here is my code: import java.io.File; import java.text.DecimalFormat; import java.util.Scanner; import java.io.IOException;; public class SalesManager { public static void main( String []args) throws IOException { System.out.println(" What is the name of the file"); Scanner scan= new Scanner(System.in); String fileName= scan.next(); SalesAnaylzer sA = new SalesAnaylzer(fileName); /*System.out.println(data); System.out.println("Here are the stores' sales for the past four quarters:" + "/n" + data); System.out.println("The total sales were:" + total); System.out.println("The highest quarterly sales were:" + highest); System.out.println("The average quarterly sales were:" + avg);*/ } } and here is this class file: import java.io.File; import java.text.DecimalFormat; import java.util.Scanner; import java.io.IOException; import java.util.*; import javax.swing.*; import java.awt.*; public class SalesAnaylzer { DecimalFormat pricePattern= new DecimalFormat("$#0.00"); int [][]sales= new int [3][4]; public SalesAnaylzer(String fileName)throws IOException { File inputFile= new File(fileName); Scanner scan= new Scanner(inputFile); for (int row=0; row&lt;4; row++){ for (int col=0; col&lt;6; col++){ sales [row][col]= scan.nextInt(); } } } public String toString() { String data = ""; for (int row=0; row&lt;4; row++){ data =data +"\nStore "+(row+1)+": "; for (int col=0; col&lt;6; col++){ data =data + "QTR "+(col+1)+": "+pricePattern.format(sales[row][col])+" "; } } return data; } public double totalSales() { double total=0.0; for (int row=0; row&lt;4; row++){ for (int col=0; col&lt;6; col++){ total= total + sales[row][col]; …
type: AnsweredQuestion
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/32841239
type: Question
has answer: http://stackoverflow.com/a/21717751
accepted answer: http://stackoverflow.com/a/21717751
tagged with: arrays
has comment: http://stackoverflow.com/comment/32841164
answer count: 1

http://stackoverflow.com/comment/32880623
score: 0
has text: It's `BigInteger#divide()`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21739767

http://stackoverflow.com/q/21770936
has answer: http://stackoverflow.com/a/21770968
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32935568
linked to: http://stackoverflow.com/q/4266756
tagged with: java
tagged with: formatting
duplicate of: http://stackoverflow.com/q/4266756
has answer: http://stackoverflow.com/a/21770994
has comment: http://stackoverflow.com/comment/32935788
favorite count: 0
has body: I have a byte array: byte[] a = new byte[3]; which I have added some bytes. For this example, let's say 3, 4, and 210. I would like to print this string of bytes to look like 3 4 210, but instead I get 3 4 -46 I am using String.valueOf(a[i]) to do my conversion. Is there any way to force this conversion to give unsigned values? Thanks in advance, EDIT: Thanks to the various feedback on this question. I had not realized Java Bytes were signed values by default, and so was suspecting the String.valueOf() method as being the issue. It turns out just simply using String.valueOf(a[i]&amp;0xFF) takes care of the signed formatting issue. Again, thank you for your feedback!
has title: Can one force String.valueOf() to return unsigned value in Java?
answer count: 4
has answer: http://stackoverflow.com/a/21770977
upvote count: 2
has answer: http://stackoverflow.com/a/21770975
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/21683284
has body: I need to send this request to a web service through Java: &gt; &lt;soapenv:Envelope &gt; xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" &gt; xmlns:gen="http://www.bossmedia.com/wsdl/genericportaladapter"&gt; &gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &gt; &lt;gen:GetPlayerDetails&gt; &gt; &lt;request&gt; &gt; &lt;systemUID&gt;?&lt;/systemUID&gt; &gt; &lt;sessionID&gt;?&lt;/sessionID&gt; &gt; &lt;/request&gt; &gt; &lt;/gen:GetPlayerDetails&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; What is the best way to do it, and save the response as an XML-file on my computer. What is the best way to do it? Would be glad if you post some links which will help. I know it's popular question, but everything I have found didn't work for me.
score: 0
tagged with: soap
tagged with: request
tagged with: web-services
has title: Java. Soap request to web service
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21683609
accepted answer: http://stackoverflow.com/a/21683609
type: Question
answer count: 1

http://stackoverflow.com/comment/33031200
comment on: http://stackoverflow.com/a/21824613
score: 0
type: AnswerComment
type: Comment
has text: oh, I'm sorry. It was mistaken by me...it will not work. since he initializing the `Resource` object thats why I was suggesting him to use that...but it must be `setImageDrawable()` instead of `setImageResource()`. thanks to both of you.

http://stackoverflow.com/a/21816717
answers question: http://stackoverflow.com/q/21816681
has comment: http://stackoverflow.com/comment/33016946
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21816681
has body: Both are the exact same. When running new Music(Files.getMusic("bar/bold.mp3")); You create an object in memory, and return a reference to it. Whether you temporarily store that reference in foo before passing it to the HashMap or not doesn't really make a difference (and even if it would, this would be optimized away).
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32913044
has text: @C4stor: that is mistake, i forgot to remove that after copying actual code from OP's post, thank you
type: Comment
comment on: http://stackoverflow.com/a/21757530
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33058382
type: Comment
has text: but I don't want to use equal.. I want to sort the word
comment on: http://stackoverflow.com/a/21840142
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32965323
comment on: http://stackoverflow.com/a/21787614
score: 0
type: AnswerComment
has text: Well you just asked about the merging and that is what I looked at primarily... I haven't tried the above code by the way, but the idea should work. I think the way you are finding the length is wrong... what if the list is empty? (You will get a `NullPointerException` in the `while` condition). What if the list has just one item? (You will get `adeck.next == null` in the first iteration, and thus `length` will remain 0 and never updated once. Reason things out and test with corner cases. I think it should be `while(adeck != null)` instead.
type: Comment

http://stackoverflow.com/q/21718356
has body: I have a file sample.avro in hdfs that I want to store into HBase (the file contains multiple entries representing multiple items I want to store in a row based on "uniqueid". If unserialized, the avro contains the following: { uniqueid: 132424, metadata: { item: "Apple", color: "red", properties: ["Crispy", "Juicy"] }, related: { class: "Fruit", movie: "Snow White" } } How do I get just the "metadata" object into an HBase table in Java or Pig? I've noticed this example, but it requires a csv file whereas the files I am working with have multiple lines of avro serialized files. REGISTER /usr/lib/pig/piggybank.jar REGISTER /usr/lib/pig/lib/avro-1.7.1.cloudera.2.jar REGISTER /usr/lib/pig/lib/jackson-core-asl-1.8.8.jar REGISTER /usr/lib/pig/lib/jackson-mapper-asl-1.8.8.jar REGISTER /usr/lib/pig/lib/json-simple-1.1.jar REGISTER /usr/lib/pig/lib/snappy-java-1.0.4.1.jar fs -rm -r -f inputdir outputdir A = LOAD '1.csv' USING PigStorage(',') AS (f1:bytearray, f2:bytearray); B = MAPREDUCE 'target/hbase-bulkload-avro-1.0.0-job.jar' STORE A INTO 'inputdir' USING org.apache.pig.piggybank.storage.avro.AvroStorage('schema', ' { "type" : "record", "name" : "r", "fields" : [ { "name" : "f1", "type" : "bytes" }, { "name" : "f2", "type" : "bytes" } ] } ') LOAD 'outputdir' `com.cloudera.examples.hbase.bulkimport.Driver inputdir outputdir foo`; DUMP B;
favorite count: 0
has title: How to load Avro and store into HBase w/pig or java?
type: UnansweredQuestion
score: 2
tagged with: apache-pig
answer count: 0
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/62787449
type: Question
tagged with: avro
upvote count: 2
tagged with: hadoop

http://stackoverflow.com/comment/33048217
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21834353
has text: It's a homework assignment, I will be implementing a content provider this week

http://stackoverflow.com/comment/33003349
score: 0
comment on: http://stackoverflow.com/q/21809134
type: Comment
type: QuestionComment
has text: "When I add the first value at index 0, I have this value there and M zero values, resulting in an array of size M + 1" - wrong, you have an arrayList of size 1. Capacity and size are not the same thing in array List.

http://stackoverflow.com/q/21691152
tagged with: arrays
has answer: http://stackoverflow.com/a/21693908
has comment: http://stackoverflow.com/comment/32816489
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27526373
has title: NDK: Passing Jfloat array from Java to C++ via GetByteArrayElements?
tagged with: c++
type: UnansweredQuestion
has body: I remembered that there were 4 Bytes per float. And I can use GetByteArrayElements to pass a byte array from Java to C++. But Since 4 Bytes is equal to a float, can I use GetByteArrayElements to pass in a Java byte and manipulate it? Since only GetByteArrayElements and GetPrimitiveArrayCritical would return a actual pointer of data and push speed.
tagged with: java
tagged with: android-ndk
type: Question
answer count: 2

http://stackoverflow.com/a/21841454
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21841301
has comment: http://stackoverflow.com/comment/33060709
has body: I would have just added this as a comment but I do not have the reputation to add comments yet. It looks like the problem is with the input file and not necessarily the code. If you read that API about what could cause the InputMismatchException when using the scanner object this will make sense. The second line of your input file had a space in the name of the renter of the movie/game. The scanner.next() call will read off of the buffer up to that space. This is causing the scanner to pick up the name up until the point at the space then the rest of the name is waiting to be read. Once the scanner.nextInt() is called you are expecting to read an int but there is a string sitting on the buffer causing the InputMismatch exception. G 698 Drakes-Uncharted 3.90 0 16 White, Walter
type: Answer
score: 2

http://stackoverflow.com/q/21686970
has answer: http://stackoverflow.com/a/21687053
accepted answer: http://stackoverflow.com/a/21687053
type: Question
tagged with: instantiation
tagged with: java
has comment: http://stackoverflow.com/comment/32785705
tagged with: class
has comment: http://stackoverflow.com/comment/32785710
has body: Here is my current code In the SalesManager client application i want to prompt the user for the filename. Then nstantiate a SalesAnalyzer object and call all the methods above, outputting the results from each method. How do I call SalesAnaylzer and all of its methods? SalesManager: import java.io.File; import java.text.DecimalFormat; import java.util.Scanner; import java.io.IOException;; public class SalesManager { public static void main( String []args) throws IOException { System.out.println(" What is the name of the file"); Scanner scan= new Scanner(System.in); String fileName= scan.next(); } } and here is the class file: import java.io.File; import java.text.DecimalFormat; import java.util.Scanner; import java.io.IOException; import java.util.*; import javax.swing.*; import java.awt.*; public class SalesAnaylzer { DecimalFormat pricePattern = new DecimalFormat("$#0.00"); int[][] sales = new int[3][4]; public SalesAnaylzer(String fileName) throws IOException { File inputFile = new File(fileName); Scanner scan = new Scanner(inputFile); for (int row = 0; row &lt; 4; row++) { for (int col = 0; col &lt; 6; col++) { sales[row][col] = scan.nextInt(); } } } public String toString() { String data = ""; for (int row = 0; row &lt; 4; row++) { data = data + "\nStore " + (row + 1) + ": "; for (int col = 0; col &lt; 6; col++) { data = data + "QTR " + (col + 1) + ": " + pricePattern.format(sales[row][col]) + " "; } } return data; } public double totalSales() { double total = 0.0; for (int row = 0; row &lt; 4; row++) { for (int col = 0; col &lt; 6; col++) { total = total + sales[row][col]; } } return total; } public double highStoreSales(int store) { double highest = 0.0; for (int row = 0; row &lt; 4; row++) { if (sales[row][store] &gt; highest) highest = sales[row][store]; } return highest; } public double averageStoreSales(int quarter) { double total = 0.0; double avg = 0.0; for (int col = 0; col &lt; 6; col++) { total = total + sales[quarter][col]; } avg = (total / 4); ret…
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21687915
has comment: http://stackoverflow.com/comment/32785761
has title: Calling a class file and its methods
has comment: http://stackoverflow.com/comment/32785785
has comment: http://stackoverflow.com/comment/32785864
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21687915
tagged with: methods

timeoutexception
tags question: http://stackoverflow.com/q/21679357
tag name: timeoutexception
type: Tag

http://stackoverflow.com/q/21743587
tagged with: java
has comment: http://stackoverflow.com/comment/32886912
has answer: http://stackoverflow.com/a/21743929
has answer: http://stackoverflow.com/a/21749266
type: Question
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21743929
has title: Java Reflection - calling a a date function
possible better answer: http://stackoverflow.com/a/21743829
has answer: http://stackoverflow.com/a/21743829
has body: I am getting a string "Date.UTC(2013,10,9,0,0,0)" from a function return. I want to construct a date out of it. something like "2013-10-09 00:00:00" Can I use reflection to give me a timestamp from the string? Or do I have to use a substring and split based on "," and construct the date string?
has comment: http://stackoverflow.com/comment/32886852
type: AnsweredQuestion
tagged with: reflection

http://stackoverflow.com/q/21780715
has body: I've been testing a Java Swing based application with Robot Framework in conjunction with Swing Library for some time. I'm stuck in one of the test cases because the Select Window keyword does not find the desired window on the screen, although it is visible. Here's a code snippet showing the relevant keywords of this test case: ... Select Window Main Window Push Button Add Person List Windows Select Window Person Manager The first three lines are working fine, but the Select Window Person Manager fails with the following rather short message: 14:24:40 FAIL Frame with name or title 'Person Manager' After debugging the application under test I identified the source of the problem: the window not being found is instance of java.awt.Frame. Interestingly, it is listed by List Windows. Is there a known workaround or existing extension of Swing Library to be able to focus on a java.awt.Frame?
type: UnansweredQuestion
score: 0
tagged with: swing
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21785690
tagged with: robotframework
tagged with: gui-testing
answer count: 1
has title: Is it possible to select a java.awt.Frame with Robot Framework in conjunction with SwingLibrary?

http://stackoverflow.com/comment/33041560
comment on: http://stackoverflow.com/q/21817099
score: 0
type: Comment
type: QuestionComment
has text: The difficulty of doing this depends very much on the layout and compression of your TIFF. Is it striped? Tiled? Does it vary? What compression? Does it vary? If you have a tiled/striped TIFF with small enough parts, you could probably read/modify a tile at a time (I guess that's what @Leo refers to). If you have an uncompressed TIFF, you could modify the values in place (with some hacks you could even memory-map the file, to allow using the standard 2D API :-)

http://stackoverflow.com/comment/32807125
comment on: http://stackoverflow.com/a/21698381
score: 0
type: AnswerComment
has text: @Foriger Is there any other way to do this?
type: Comment

http://stackoverflow.com/comment/33019689
score: 0
type: Comment
has text: my trigger is - in each iteration of the algorithm - I get new (i,j) values.. so how so I incorporate that..
comment on: http://stackoverflow.com/a/21818006
type: AnswerComment

http://stackoverflow.com/q/21756263
has answer: http://stackoverflow.com/a/34926516
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33028065
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32913158
has body: We have a very strange problem, especially since the same solution works in other parts of the project. We're working with Maven 3 We have a module with unit tests and some classes (i.e. mocks) in a module A. Module B, depends on A for both sources and test sources. So we've done the following: In module A: org.apache.maven.plugins maven-jar-plugin 2.4 test-jar Then in module B's pom we put: myGroup A ${project.version} jar compile myGroup A ${project.version} test-jar test So, when we build the project everything works, from what I know the build runs the "install" phase, so it makes sense everything works. Now, we're trying to make a relase and during the compile phase of module B, we always get: Failed to execute goal on project B: Could not resolve dependencies for project myGroup:B:war:1.5.0.0: Failure to find myGroup:A:jar:tests:1.5.0.0 in "Link to our artifactory" was cached in the local repository, resolution will not be reattempted until the update interval of "company name" has elapsed or updates are forced From what I can see in the build log it happens during the execution of the "maven-compiler-plugin", so why does it try to get the test jar which is a dependency in the test scope only? This is not the 1st time we've used this method in our project and it has always worked (and we've released several releases thus far).
has comment: http://stackoverflow.com/comment/32936696
linked to: http://stackoverflow.com/q/13991083
has comment: http://stackoverflow.com/comment/32913391
favorite count: 0
has comment: http://stackoverflow.com/comment/32910832
has comment: http://stackoverflow.com/comment/57585769
has title: Maven test dependency in release phase
has comment: http://stackoverflow.com/comment/32911910
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33002842
tagged with: maven
upvote count: 1
has comment: http://stackoverflow.com/comment/33030213
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/21759240

http://stackoverflow.com/q/21806062
has answer: http://stackoverflow.com/a/21806219
has answer: http://stackoverflow.com/a/23226353
has answer: http://stackoverflow.com/a/21806246
type: AnsweredQuestion
has title: Incorrect result of image subtraction
accepted answer: http://stackoverflow.com/a/21806219
tagged with: java
possible better answer: http://stackoverflow.com/a/21806246
tagged with: image
downvote count: 1
type: Question
answer count: 3
has body: I wanted to subtract two images pixel by pixel to check how much they are similar. Images have the same size one is little darker and beside brightness they don't differ. But I get those little dots in the result. Did I subtract those two images rigth? Both are bmp files. import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; public class Main2 { public static void main(String[] args) throws Exception { int[][][] ch = new int[4][4][4]; BufferedImage image1 = ImageIO.read(new File("1.bmp")); BufferedImage image2 = ImageIO.read(new File("2.bmp")); BufferedImage image3 = new BufferedImage(image1.getWidth(), image1.getHeight(), image1.getType()); int color; for(int x = 0; x &lt; image1.getWidth(); x++) for(int y = 0; y &lt; image1.getHeight(); y++) { color = Math.abs(image2.getRGB(x, y) - image1.getRGB(x, y)); image3.setRGB(x, y, color); } ImageIO.write(image3, "bmp", new File("image.bmp")); } } Image 1 Image 2 Result
tagged with: subtraction
score: 7
has comment: http://stackoverflow.com/comment/32998279
favorite count: 0
has comment: http://stackoverflow.com/comment/32998024
has comment: http://stackoverflow.com/comment/32998301
upvote count: 8

http://stackoverflow.com/q/21767486
has comment: http://stackoverflow.com/comment/32930806
answer count: 1
accepted answer: http://stackoverflow.com/a/21768515
has answer: http://stackoverflow.com/a/21768515
tagged with: c++
has comment: http://stackoverflow.com/comment/32930220
tagged with: overlay
has title: Drawing overlay on screen in C++ or Java
type: AnsweredQuestion
has body: Is there any way to draw an invisible overlay on top of the screen (meaning in front of all windows and everything else) in C++ and/or Java? It doesn't need to support 3D graphics or anything fancy, I just need to be able to draw lines/pixels on it. There are some other solutions that I found on the internet, but they all either 1) don't allow mouse clicks to go through them (onto the windows or other stuff under it) or 2) are only for Windows (I need something that works on Windows and Linux, but Mac support would also be nice).
tagged with: java
type: Question
score: 0

http://stackoverflow.com/q/21772966
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32939440
has comment: http://stackoverflow.com/comment/32939678
has answer: http://stackoverflow.com/a/21773156
has comment: http://stackoverflow.com/comment/32939334
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21773075
tagged with: collections
has title: What is the fastest method to find duplicates from a collection
has comment: http://stackoverflow.com/comment/32993423
type: Question
has comment: http://stackoverflow.com/comment/32993425
possible better answer: http://stackoverflow.com/a/21773111
has answer: http://stackoverflow.com/a/21773111
has answer: http://stackoverflow.com/a/21773152
score: 3
accepted answer: http://stackoverflow.com/a/21773075
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/7414667
has body: This is what I have tried and somehow I get the feeling that this is not right or this is not the best performing application, so is there a better way to do the searching and fetching the duplicate values from a Map or as a matter of fact any collection. And a better way to traverse through a collection. public class SearchDuplicates{ public static void main(String[] args) { Map&lt;Integer, String&gt; directory=new HashMap&lt;Integer, String&gt;(); Map&lt;Integer, String&gt; repeatedEntries=new HashMap&lt;Integer, String&gt;(); // adding data directory.put(1,"john"); directory.put(2,"michael"); directory.put(3,"mike"); directory.put(4,"anna"); directory.put(5,"julie"); directory.put(6,"simon"); directory.put(7,"tim"); directory.put(8,"ashley"); directory.put(9,"john"); directory.put(10,"michael"); directory.put(11,"mike"); directory.put(12,"anna"); directory.put(13,"julie"); directory.put(14,"simon"); directory.put(15,"tim"); directory.put(16,"ashley"); for(int i=1;i&lt;=directory.size();i++) { String result=directory.get(i); for(int j=1;j&lt;=directory.size();j++) { if(j!=i &amp;&amp; result==directory.get(j) &amp;&amp;j&lt;i) { repeatedEntries.put(j, result); } } System.out.println(result); } for(Entry&lt;Integer, String&gt; entry : repeatedEntries.entrySet()) { System.out.println("repeated "+entry.getValue()); } } } Any help would be appreciated. Thanks in advance
has comment: http://stackoverflow.com/comment/32993424
answer count: 4

http://stackoverflow.com/a/21709681
score: 0
type: Answer
has body: IMHO this is the simplest way, and you can totally customize the class for achieve your goals. https://github.com/memoryleak/Android-RoundedImageView
answers question: http://stackoverflow.com/q/21709388

http://stackoverflow.com/q/21808817
accepted answer: http://stackoverflow.com/a/21808901
answer count: 1
has body: I would like the method saveTeam() from my class FormTeamsActivity.java to only be visible to its container and the corresponding layout file formteam.xml. FormTeamsActivity.java : public class FormTeamActivity extends Activity { public void onCreate(Bundle savedInstanceState) { //... } public void saveTeam() { //I only want this visible to formTeam.xml /* Capture user defined parameters and store them in DB */ finish(); //Conclude activity } } I cant make it private because I would't be able to call in formTeam.xml: &lt;Button ... android:id="@+id/button_formTeam" ... android:onClick="saveTeam"/&gt;&lt;!-- I would like to call the method here --&gt; The only work around I have found is to write your own actionListener in the class but I would like to be able to get around this to avoid having a ton of listeners in Activity I write.
has title: Restrict visability of a method to everything but corresponding layout
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21808901
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/32841666
comment on: http://stackoverflow.com/a/21717708
has text: I disagree. In cases where you have no control over the situation (whether or not a string is in the proper format), exception handling is perfectly fine. In fact, compare the code above and it seems pretty clear that using exception handling is not only shorter, but is easier to understand.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32846906
comment on: http://stackoverflow.com/q/21721154
score: 0
has text: Please make it clear what you want to do. You are inflating one XML and accessing the members of some other xml. *Do you really think its possible*?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32985037
type: Comment
has text: Thank you, But I need separate the calller File (the file containing <%@ page errorPage ="error.jsp"%>), how to do it?, in other side the called File (<%@ page isErrorPage = "true"%>)... Is It possible (Yes/Not)?
comment on: http://stackoverflow.com/a/21795737
score: 0
type: AnswerComment

http://stackoverflow.com/q/21704583
has comment: http://stackoverflow.com/comment/32816852
downvote count: 0
has body: Qestion First: I need to regex to match 111 or 111. or 111.111 (just aritrarty numbers) for a DocumentFilter. I need the user to be able to input 111. with a decimal and nothing afterwards. Can't seem to get it right. All the Regexes I find all match just all decimal numbers i.e. 12343.5565 32.434 32 Like this regex ^[0-9]*(\\.)?[0-9]+$ Problem is, I need the regex for a DocumentFilter so the input can only be numbers with/without a decimal point. But the catch is it also needs to match 1223. So the user can input the decimal into the text field. So basically I need to regex to match 11111 // all integer 11111. // all integers with one decimal point and nothing after 11111.1111 // all decimal numbers The pattern I have so far is the one above. Here is a test program (For Java users) The patter can be input in the this line Pattern regEx = Pattern.compile("^[0-9]*(\\.)?[0-9]+$"); If the regex fits the bill, then you will be able to input 111 or 111. or 111.111. Run it :) import java.awt.GridBagLayout; import java.util.regex.*; import javax.swing.*; import javax.swing.text.*; public class DocumentFilterRegex { JTextField field = new JTextField(20); public DocumentFilterRegex() { ((AbstractDocument) field.getDocument()).setDocumentFilter(new DocumentFilter() { Pattern regEx = Pattern.compile("^[0-9]*(\\.)?[0-9]+$"); @Override public void insertString(DocumentFilter.FilterBypass fb, int off, String str, AttributeSet attr) throws BadLocationException { Matcher matcher = regEx.matcher(str); if (!matcher.matches()) { return; } super.insertString(fb, off, str, attr); } @Override public void replace(DocumentFilter.FilterBypass fb, int off, int len, String str, AttributeSet attr) throws BadLocationException { Matcher matcher = regEx.matcher(str); if (!matcher.matches()) { return; } super.replace(fb, off, len, str, attr); } }); JFrame frame = new JFrame("Regex Filter"); frame.setLayout(new GridBagLayout()); frame.add(field); frame.setSize(300, 150); frame.setDefaultCloseOperat…
favorite count: 0
tagged with: regex
accepted answer: http://stackoverflow.com/a/21704768
possible better answer: http://stackoverflow.com/a/21704856
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/32816891
has answer: http://stackoverflow.com/a/21704856
type: AnsweredQuestion
tagged with: numbers
tagged with: documentfilter
score: 1
tagged with: java
type: Question
has title: Regex for DocumentFilter to match all decimal number but also number with just a decimal at the end
has answer: http://stackoverflow.com/a/21704768
answer count: 2

android-alertdialog
tags question: http://stackoverflow.com/q/21839357
tag name: android-alertdialog
type: Tag
tags question: http://stackoverflow.com/q/21706521

http://stackoverflow.com/q/21841545
type: AnsweredQuestion
score: 1
tagged with: stack
tagged with: java
tagged with: image
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21841651
accepted answer: http://stackoverflow.com/a/21841651
tagged with: button
possible better answer: http://stackoverflow.com/a/21841648
upvote count: 1
has body: I am finishing up my DiceRollGUI, when I run it and press "Roll" the images stack of top of each other, how do I make so it disappears after I press the button again? I did most of what MadProgrammer told me but I ran into errors which are: --------------------Configuration: &lt;Default&gt;-------------------- G:\DiceRollGUI\src\DiceRollGUI.java:26: error: constructor RollButton in class RollButton cannot be applied to given types; button.addActionListener(new RollButton(diceRoll)); ^ required: JPanel found: JLabel reason: actual argument JLabel cannot be converted to JPanel by method invocation conversion G:\DiceRollGUI\src\DiceRollGUI.java:42: error: cannot find symbol contentPane.add(diceRoll); ^ symbol: variable contentPane location: class RollButton 2 errors Process completed. Code: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.util.Random; public class DiceRollGUI { public static JLabel label; public static JFrame frame; public static JPanel panel; private static JButton button; private static JButton buttonRollDie; private static JLabel diceRoll; public static void main (String[] args) { JFrame frame = new JFrame("Dice Roll GUI"); panel = new JPanel(); JPanel contentPanel = new JPanel(new GridLayout(0,2,5,10)); button = new JButton("Roll");; frame.setVisible(true); frame.setResizable(false); frame.setSize(1000, 1000); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); button.setActionCommand("Roll"); button.addActionListener(new RollButton(diceRoll)); button.setAlignmentX(Component.CENTER_ALIGNMENT); panel.setPreferredSize(new Dimension(750, 500)); frame.setContentPane(panel); frame.pack(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.add(button); } private static class RollButton implements ActionListener { private JPanel diceRoll; public RollButton(JPanel diceRoll){ this.diceRoll = diceRoll; contentPane.add(dice…
has answer: http://stackoverflow.com/a/21841648
has title: Images stacking on top of each other
favorite count: 0
downvote count: 0
tagged with: swing

http://stackoverflow.com/comment/52086723
type: QuestionComment
comment on: http://stackoverflow.com/q/21799178
has text: Related: [How to get javax.comm API?](http://stackoverflow.com/questions/7562565/how-to-get-javax-comm-api)
score: 0
type: Comment

http://stackoverflow.com/comment/33012031
type: QuestionComment
comment on: http://stackoverflow.com/q/21810634
score: 0
type: Comment
has text: From: [first](http://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice/9554657#9554657), [second](http://stackoverflow.com/questions/6476289/replacing-jpanel-with-jpanel-in-a-jframe), [third](http://tips4java.wordpress.com/2008/11/01/card-layout-actions/)

http://stackoverflow.com/comment/32996627
has text: @kajacx No - there are many "zero" values: See [this post](http://stackoverflow.com/questions/10950914/how-to-check-if-bigdecimal-variable-0-in-java/10950967#10950967). Also, the other instances may be `equals()`, but won't be `==`.
score: 0
comment on: http://stackoverflow.com/a/21804956
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32859032
type: Comment
comment on: http://stackoverflow.com/q/21726240
has text: In Q1, Can you please tell me when the memory for object and reference variable "sb" be allotted in a program. Let's say we have one object created in main as "C c = new C();" –
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32777784
type: Comment
comment on: http://stackoverflow.com/a/21682134
score: 0
type: AnswerComment
has text: @user2564491 Why are you using a `java.util.Timer`? You should be using `javax.swing.Timer` for Swing apps, as seen [**here**](http://stackoverflow.com/a/21619240/2587435)

http://stackoverflow.com/comment/33070996
score: 0
type: Comment
type: QuestionComment
has text: I figured out how to upload file, but stuck at uploading speed now. If you are interested, you can find source and new question [here](http://stackoverflow.com/questions/21846530/websocket-file-upload-speed-issue-java-websocket-api-and-javascript).
comment on: http://stackoverflow.com/q/21769470

http://stackoverflow.com/comment/32974506
type: AnswerComment
type: Comment
has text: @Zippy: See if my edit is more to your liking. really allows you to use whatever predicate you want. functional programming FTW
comment on: http://stackoverflow.com/a/21792553
score: 0

http://stackoverflow.com/comment/33025301
has text: decimalFormatSymbols.setMonetaryDecimalSeparator(','); and now it works very well. Toss that into your answer and I'll accept it!
comment on: http://stackoverflow.com/a/21821185
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/21680690
has title: Manage sqlite on real device with eclipse
tagged with: eclipse
tagged with: ddms
score: 0
has answer: http://stackoverflow.com/a/21680951
has body: I'm using galaxy note with rooted software but I'm retying to find some way to test and manage and browse all my sqlite contents values and tables via eclipse I have used com.questoid.sqlitebrowser_1.2.0.jar plugin but it give me disabled button in DDMS note : I'm deploying my app on real device not emulator
tagged with: sql
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question

http://stackoverflow.com/q/21827618
tagged with: android-wifi
downvote count: 0
has body: I have two access point broadcasting same SSID across a wide open area. Usually the mobile device switches to strongest AP by default if the currently AP is not strong enough without haviong disconnecting and reconnecting to WiFi. But over a long period we have observed that the WiFi switching does not happen sometimes. For such cases we were planning to handle that switching at android application level itself. But after doing lots of research over web. We could only find methods which involve disconnecting the Wifi and reconnecting again which is not desirable in our case. As our application accepts payments over web . Disconnecting and reconnecting again based on signal strength would result in payments getting declined. Is is possible to replicate the WiFi switching which mobile device does automatically at android application level.(I know the question is absurd but i am desperately looking for a workaround)
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
has title: WiFi Access point switch android
score: 2
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/q/21754784
answer count: 5
has comment: http://stackoverflow.com/comment/32907350
has comment: http://stackoverflow.com/comment/32906564
has answer: http://stackoverflow.com/a/21756452
has comment: http://stackoverflow.com/comment/32906096
upvote count: 3
has comment: http://stackoverflow.com/comment/32906134
has answer: http://stackoverflow.com/a/21757543
has comment: http://stackoverflow.com/comment/32905943
has comment: http://stackoverflow.com/comment/32906128
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19010399
score: 3
tagged with: short-circuiting
has comment: http://stackoverflow.com/comment/32907779
accepted answer: http://stackoverflow.com/a/21757543
has title: Replacing an if statement with a disjunction
has comment: http://stackoverflow.com/comment/32905947
tagged with: java
has answer: http://stackoverflow.com/a/21755051
has answer: http://stackoverflow.com/a/21756078
has comment: http://stackoverflow.com/comment/32907535
has comment: http://stackoverflow.com/comment/32906152
possible better answer: http://stackoverflow.com/a/21754970
type: Question
has answer: http://stackoverflow.com/a/21754970
tagged with: grammar
has comment: http://stackoverflow.com/comment/32911540
downvote count: 0
has comment: http://stackoverflow.com/comment/32906199
has body: Just for fun, I was trying to replace: if (set1.add(x) == false) { set2.add(x); } with: set1.add(x) || set2.add(x); However, Eclipse complains: Syntax error on token "||", invalid AssignmentOperator The left-hand side of an assignment must be a variable Could anybody shine some light onto these error messages? They don't make much sense to me.
tagged with: boolean-logic
favorite count: 0

http://stackoverflow.com/q/21838734
type: Question
tagged with: jtextarea
has body: I have a problem with setting text in JTextArea, I tried setText(which I'd prefer) and append also. I do not know where the problem is, I got client-server app. I want to put message that server sends in JTextField but I am unable to here is my code: client side code which is reciving the message properly: try { Socket socket = new Socket("localhost", PORT); BufferedReader input = new BufferedReader( new InputStreamReader(System.in)); DataOutputStream output = new DataOutputStream(socket.getOutputStream()); BufferedReader serverInput = new BufferedReader(new InputStreamReader(socket.getInputStream())); output.writeBytes(outputString + "\n"); inputString = serverInput.readLine(); // private String inputString mymodel.setTextArea(inputString); // this is not working System.out.println(inputString); // this is working socket.close(); } catch... setTextArea method: public void setTextArea(String string) { MyPanel mypanel = new MyPanel(); mypanel.textArea.setText(string); // debugger shows that the string contains message from server } I have set textarea to public since setter method weren't working, actually this one isn't working also. I do not know where the problem is, and debugger isn't helping me either. Looking for your answers EDIT: JTextTable code: textArea = new JTextArea(1, 30); textArea.setEditable(false); panel.add(textArea, c);
downvote count: 0
has answer: http://stackoverflow.com/a/21839644
has answer: http://stackoverflow.com/a/21838800
has title: JTextArea setText is not working
favorite count: 0
possible better answer: http://stackoverflow.com/a/21838795
has answer: http://stackoverflow.com/a/21838795
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21845925
accepted answer: http://stackoverflow.com/a/21839644
score: 1
tagged with: java
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/32899118
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21750283
has text: Understood what you are trying to say ..i am not mentioning starred flag in projection.

http://stackoverflow.com/a/21706508
type: Answer
answers question: http://stackoverflow.com/q/21706320
has comment: http://stackoverflow.com/comment/32837568
upvote count: 1
has comment: http://stackoverflow.com/comment/32838855
score: 1
has body: A Set uses a Map behind the scenes and the values in the Set are in fact keys in the Map. So, it is not possible to accomplish what you want/need without a for loop. Using plain Java (no other fancy frameworks), you only can do this: for(Map.Entry&lt;String,String&gt; entry : s) { ms.put(entry.getKey(), entry.getValue()); }
has comment: http://stackoverflow.com/comment/32853513
downvote count: 0

http://stackoverflow.com/comment/32916915
type: QuestionComment
comment on: http://stackoverflow.com/q/21749101
has text: Replace `ieee754 = input.nextLine();` with `ieee754 = "100";` and see if it works. If it does you know the problem is with `input.nextLine()` not doing what you expect.
score: 0
type: Comment

http://stackoverflow.com/q/21694117
answer count: 1
has comment: http://stackoverflow.com/comment/32798784
has comment: http://stackoverflow.com/comment/32798702
has comment: http://stackoverflow.com/comment/32798664
type: AnsweredQuestion
tagged with: user-interface
has comment: http://stackoverflow.com/comment/32798737
has answer: http://stackoverflow.com/a/21694252
type: Question
has comment: http://stackoverflow.com/comment/32798765
has body: how to put an actionListener or ActionEvent on my gui program because i cannot put function of my button please help me this is my code so far. import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.*; import javax.swing.*; public class jiw extends JFrame { private JTextField aw1; private JLabel aww; private JButton aw2; public jiw() { setLayout(new FlowLayout()); aww = new JLabel("Enter Your Password"); add(aww); aw1 = new JTextField(15); add(aw1); aw2 = new JButton("Enter"); add(aw2); setVisible(true); actionPerformed(ActionEvent e) { Object source = e.getSource(); if(source == aw2) { System.exit(0); } } } public static void main(String args []) { jiw v = new jiw(); v.setSize(200,200); v.setResizable(false); v.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
has title: ActionListener,Performed Gui
score: 0
tagged with: java
tagged with: swing
accepted answer: http://stackoverflow.com/a/21694252

http://stackoverflow.com/comment/126954465
type: AnswerComment
comment on: http://stackoverflow.com/a/56906167
type: Comment
has text: Was having this issue with 2022-03 but this solution worked.
score: 1

http://stackoverflow.com/comment/32870077
score: 0
comment on: http://stackoverflow.com/q/21733439
type: Comment
type: QuestionComment
has text: Can you post the bean definition for `smsManagerService` ?

http://stackoverflow.com/q/21788883
type: Question
tagged with: system.exit
answer count: 2
has answer: http://stackoverflow.com/a/21788922
has comment: http://stackoverflow.com/comment/32967122
has body: When the following Java program is compiled, the following error occurs: method exit in class System cannot be applied to given types; I have 2 classes, MainClass and MathQuiz. MainClass: class MainClass { public static void main(String args[]) { MathQuiz mq = new MathQuiz(); //whenever "mq" is written, this refers to class "MathQuiz" mq.initialiseVars(); //initialise variables (from MathQuiz) byte exitChoice = 0; //ask user for choice mq.showOprMenu(); //show operation menu (from MathQuiz) byte oprChoice = Keyboard.readByte(); //ask for user input //if input is out of range (smaller than 0 or greater than 4), ask again while(oprChoice &lt; 0 || oprChoice &gt; 4) { System.out.print("Invalid choice! Enter your choice again (1, 2, 3, 4 or 0): "); oprChoice = Keyboard.readByte(); }//while mq.showDiffMenu(); //show difficulty menu (from MathQuiz) byte diffChoice = Keyboard.readByte(); //ask for user input //if input is out of range (smaller than 0 or greater than 3), ask again while(diffChoice &lt; 0 || diffChoice &gt; 3) { System.out.print("Invalid choice! Enter your choice again (1, 2, 3 or 0): "); diffChoice = Keyboard.readByte(); //ask for user input }//while mq.generateRandNums(); //generate random numbers (from MathQuiz) switch (exitChoice) { case 0: { while (exitChoice != 1 || exitChoice != 2); { System.out.print("Are you sure you want to exit? (1 = Yes, 2 = No) "); exitChoice = Keyboard.readByte(); //ask for user input if (exitChoice == 1) { System.out.println("Exiting program."); **System.exit(); //quit program** }//if exitChoice is 1 else if (exitChoice == 2) { System.out.println("Returning to menu."); mq.showOprMenu(); }//if exitChoice is 2 }//while exitChoice is neither 1 nor 2 }//case 0 ("Exit" chosen) case 1: { System.out.println("You will be tested on addition."); mq.showAddQuestion(); //show addition question (from MathQuiz) mq.checkAns(); //check answer (from MathQuiz) break; }//case 1 ("Addition" chosen) case 2: { System.out.println("You will be tested…
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32967138
type: UnansweredQuestion
tagged with: arguments
has answer: http://stackoverflow.com/a/21788934
has comment: http://stackoverflow.com/comment/32967198
has title: Method exit in class System cannot be applied to given types
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/32994703
type: Comment
has text: See also: http://stackoverflow.com/questions/15711098/trying-to-create-a-file-in-android-open-failed-erofs-read-only-file-system
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21804294

http://stackoverflow.com/comment/32815433
type: Comment
has text: Oh by the way... you're including the zero in the results. You probably should use (Random.nextInt(10) + 1), instead
comment on: http://stackoverflow.com/q/21703867
score: 0
type: QuestionComment

text
tags question: http://stackoverflow.com/q/21836808
type: Tag
tags question: http://stackoverflow.com/q/21715354
tags question: http://stackoverflow.com/q/21684503
tags question: http://stackoverflow.com/q/21684819
tag name: text
tags question: http://stackoverflow.com/q/21782070

http://stackoverflow.com/a/21800057
has body: JLS §8.4.7. Method Body says this: If a method is declared to have a return type, then a compile-time error occurs if the body of the method can complete normally (§14.1). Where the definition of complete normally is not competing abruptly. A return statement is something that completes abruptly. Next, assuming this syntax for a for statement: for ( ForInit_opt ; Expression_opt ; ForUpdate_opt ) Statement The JLS §14.14.1.2. Iteration of for Statement states this : Next, a for iteration step is performed, as follows: If the Expression is present, it is evaluated. If the result is of type Boolean, it is subject to unboxing conversion (§5.1.8). If evaluation of the Expression or the subsequent unboxing conversion (if any) completes abruptly, the for statement completes abruptly for the same reason. So, the fact that the Expression might complete abruptly means that the for loop will complete abruptly as well, for the same reason, which is of course not "returning". So, the return statement might be unreachable. However, we both know that it will be always reached. But that is a shortcoming of the compiler intelligence. If you remove the Expressions (they are optional), or replace them with true, the compiler doesn't complain. Your code is basically this: // This snippet won't work as method body for (int i = 0; i &lt; 10; ++i) { return "Hello"; } In comparison with this: // This snippet compiles fine for (int i = 0; true; ++i) { return "Hello"; } This means that there are two options: i &lt; 10 can complete abruptly the compiler can't determine wether i &lt;= 10 evaluates to true or not, even if you declared int i = 0. I went searching through the JLS and didn't find anything about abrupt completion of a simple i &lt; 10 statement. So, I guess that the reason why this happens is actually the second one: he can't be sure that i &lt; 10 will evaluate to true for at least once. So, in order to make the compiler shut up about the fact that he is not certain about the retu…
answers question: http://stackoverflow.com/q/21799367
score: 3
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32863937
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21725181
type: Comment
has text: well getAllLeafs is written in the code, a field of children is an attribute of Node, therefore you can get it directly, there's no algorithm involved

http://stackoverflow.com/a/21712240
upvote count: 2
has body: Are buttons (or other elements) in some LAFs bigger or smaller than in other LAFs? Yes, it's very possible... So do I need to place all elements depenging on the LAF or are all elements of equal size, independent of the LAF? This is what layout managers are for and why your should avoid using setPreferred/minimum/maximum size on most compnents...
answers question: http://stackoverflow.com/q/21711521
has comment: http://stackoverflow.com/comment/32831269
type: Answer
has comment: http://stackoverflow.com/comment/32831210
score: 2
downvote count: 0

http://stackoverflow.com/comment/32961675
comment on: http://stackoverflow.com/q/21785120
type: Comment
type: QuestionComment
has text: I referred that but the above is a little confusing. I have Image.java where I have a variable url. and I want to put that image & url in Channel.java.
score: 0

http://stackoverflow.com/q/21787079
has answer: http://stackoverflow.com/a/21788753
accepted answer: http://stackoverflow.com/a/21788753
answer count: 1
has body: I am kinda new to adt and developing java apps. But I am trying to make a quiz game. For some reason though, when I click some button, it randomly says Unfortunately your app has stopped. But the problem is, it does't happen at the same place. I happens on the actual quiz part) and even sometimes on the home screen. I do notice that there are some log cat errors but since I am new, I don't know how to fix it. For the first picture, here is the log cat error: 02-14 18:22:27.146: E/AndroidRuntime(7346): FATAL EXCEPTION: main 02-14 18:22:27.146: E/AndroidRuntime(7346): java.lang.ArrayIndexOutOfBoundsException: length=5; index=5 02-14 18:22:27.146: E/AndroidRuntime(7346): at vApp.theperiodictablequiz.QuizActivity.ansGen(QuizActivity.java:131) 02-14 18:22:27.146: E/AndroidRuntime(7346): at vApp.theperiodictablequiz.QuizActivity$4.onClick(QuizActivity.java:204) 02-14 18:22:27.146: E/AndroidRuntime(7346): at android.view.View.performClick(View.java:4206) 02-14 18:22:27.146: E/AndroidRuntime(7346): at android.view.View$PerformClick.run(View.java:17357) 02-14 18:22:27.146: E/AndroidRuntime(7346): at android.os.Handler.handleCallback(Handler.java:725) 02-14 18:22:27.146: E/AndroidRuntime(7346): at android.os.Handler.dispatchMessage(Handler.java:92) 02-14 18:22:27.146: E/AndroidRuntime(7346): at android.os.Looper.loop(Looper.java:137) 02-14 18:22:27.146: E/AndroidRuntime(7346): at android.app.ActivityThread.main(ActivityThread.java:5041) 02-14 18:22:27.146: E/AndroidRuntime(7346): at java.lang.reflect.Method.invokeNative(Native Method) 02-14 18:22:27.146: E/AndroidRuntime(7346): at java.lang.reflect.Method.invoke(Method.java:511) 02-14 18:22:27.146: E/AndroidRuntime(7346): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 02-14 18:22:27.146: E/AndroidRuntime(7346): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 02-14 18:22:27.146: E/AndroidRuntime(7346): at dalvik.system.NativeStart.main(Native Method) For the second picture, h…
has title: App has stopped Error Logcat error
tagged with: android
has comment: http://stackoverflow.com/comment/32963701
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32963697
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32963993
has comment: http://stackoverflow.com/comment/32963716
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/32969916
score: 0

http://stackoverflow.com/q/21686149
has answer: http://stackoverflow.com/a/21686233
has comment: http://stackoverflow.com/comment/32784168
favorite count: 0
type: UnansweredQuestion
tagged with: telnet
tagged with: java
upvote count: 1
has title: Getting information from a cisco / juniper router with java
has comment: http://stackoverflow.com/comment/32786324
downvote count: 1
has body: What method could I use to login to a Cisco or Juniper routers? I know I can use telnet to make a connection to the router itself but I am not aware of an API or anything that allows me to login non-interactively. So how could I do this? Are there any libraries I can use to achieve this? I have seen people use scripts that implement things like expect to know when to send the username and the password. But that is for shell scripting. How can I do this in java? I would prefer to keep strictly in java too. The goal of this is allow a java program login into a router so I can query the router for interface states and execute commands on the router. Any ideas?
type: Question
has answer: http://stackoverflow.com/a/21687498
has answer: http://stackoverflow.com/a/21686855
has comment: http://stackoverflow.com/comment/32784257
tagged with: expect
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32784369
tagged with: information-extraction

http://stackoverflow.com/a/21751039
has comment: http://stackoverflow.com/comment/95223718
type: Answer
has comment: http://stackoverflow.com/comment/107299036
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/21744795
accepted answer of: http://stackoverflow.com/q/21744795
has comment: http://stackoverflow.com/comment/105008278
has comment: http://stackoverflow.com/comment/107299057
type: AcceptedAnswer
downvote count: 0
has body: Create an testng.xml file say name as testsuite.xml. Now follow below 2 steps: Step 1: Create an batch file for scheduler: use below code - modify it and paste in notepad. save the notepad in working directory as"run.bat" set ProjectPath=C:\Selenium\Selenium_tests\DemoProject echo %ProjectPath% set classpath=%ProjectPath%\bin;%ProjectPath%\Lib\* echo %classpath% java org.testng.TestNG %ProjectPath%\testsuite.xml a) First line is for setting project path . b) second line is for verifying that path is set or not. c) third line is for setting classpath - lib folder contain all the jar file added to project build path d) fourth line is for verifying whether classpath is set or not e) fifth line is for executing xml file having details of all test. Step 2: Go to control panel. Administrative tool. Task scheduler and create a task which will trigger run.bat file at the time you want. It will work.

http://stackoverflow.com/comment/32963113
score: 0
type: QuestionComment
has text: I did. I tried with both cglib 3 and cglib 3.1 with no luck.
type: Comment
comment on: http://stackoverflow.com/q/21755291

http://stackoverflow.com/q/21790288
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21790902
score: 1
tagged with: java
type: Question
has body: I am making a Swing based desktop application. I would like to customize the scrollbar in a jtable. I have gotten the below code to customize the scroll bar but i am not sure how to apply it to a jtable. public class MyScrollBarUI extends BasicScrollBarUI { @Override protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { g.setColor(Color.black); g.fillRect(trackBounds.width / 2, trackBounds.y, 3, trackBounds.height); if (this.trackHighlight == BasicScrollBarUI.DECREASE_HIGHLIGHT) { this.paintDecreaseHighlight(g); } else if (this.trackHighlight == BasicScrollBarUI.INCREASE_HIGHLIGHT) { this.paintIncreaseHighlight(g); } } @Override protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { if (thumbBounds.isEmpty() || !this.scrollbar.isEnabled()) { return; } g.translate(thumbBounds.x, thumbBounds.y); g.setColor(this.thumbDarkShadowColor); g.drawOval(2, 0, 14, 14); g.setColor(this.thumbColor); g.fillOval(2, 0, 14, 14); g.setColor(this.thumbHighlightColor); g.setColor(this.thumbLightShadowColor); g.translate(-thumbBounds.x, -thumbBounds.y); } } And i do the following to set the scrollbars look and feel at the start of my program UIManager.put("ScrollBarUI", "mypackage.ui.customization.MyScrollBarUI");
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jtable
accepted answer: http://stackoverflow.com/a/21790902
has title: Custom Jtable scrollbar
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/32969564
type: Comment
type: QuestionComment
has text: In which following task would you like it to be excluded?
comment on: http://stackoverflow.com/q/21790033
score: 0

currency
tag name: currency
type: Tag
tags question: http://stackoverflow.com/q/21821057

http://stackoverflow.com/a/21749843
has comment: http://stackoverflow.com/comment/32914356
downvote count: 0
has comment: http://stackoverflow.com/comment/32898085
has comment: http://stackoverflow.com/comment/32944499
type: Answer
score: 1
upvote count: 1
has body: I'm a noob too with JBoss, but I've been working with CDI, Weld and Seam/Solder. The problem (which I'm facing too) is an incompatibility between CDI 1.1 (Weld-2.x implementation) and Solder lib (org.jboss.solder.config.xml.bootstrap.ProcessAnnotatedTypeImpl). If you don't use directly Solder, I recomend you to exclude it from deployment. Else,... I don't know as Solder has been discontinued and even recomend to use DeltaSpike, but although it has been graduated, IMHO it is not enough mature,....
answers question: http://stackoverflow.com/q/21718997

http://stackoverflow.com/a/21724023
has body: The following might do what you want, if what you want to do is what I think you want to do: long n = 2432902008176640000L; // original number while (n &gt; 9999) { // while "more than 4 digits", "throw out last digit" n = n / 10; } // now, n = 2432 And a demo. Notes: A long can only represent values as large as 9223372036854775807 (which is only about 4 times as large as the number given) before it will overflow. If dealing with larger numbers you'll need to switch to BigInteger or similar. The same technique can be used, updated for syntax differences. As fge pointed out, this won't work as it is written over negative numbers; this can be addressed by either changing the condition (i.e. n &lt; -9999) or first obtaining the absolute value of n (and then reverting the operation at the end). As done in yinqiwen's answer, n &gt; 9999 can be replaced with n &gt;= (long)Math.pow(10, N) (preferably using a temporary variable), where N represents the number of decimal digits.
upvote count: 9
has comment: http://stackoverflow.com/comment/32851328
type: Answer
downvote count: 0
score: 9
has comment: http://stackoverflow.com/comment/32852006
answers question: http://stackoverflow.com/q/21723972

http://stackoverflow.com/q/21696857
has title: create multi user login page using servlet and jsp
has comment: http://stackoverflow.com/comment/32803556
has comment: http://stackoverflow.com/comment/32803492
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/3579079
has comment: http://stackoverflow.com/comment/32803609
has comment: http://stackoverflow.com/comment/32804290
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/21696948
answer count: 2
tagged with: jsp
has comment: http://stackoverflow.com/comment/32804186
score: 0
possible better answer: http://stackoverflow.com/a/21702211
has comment: http://stackoverflow.com/comment/32803401
accepted answer: http://stackoverflow.com/a/21696948
has answer: http://stackoverflow.com/a/21702211
has body: I have a login page i.e index.jsp which is having 3 fields: 1.> Usertype select tag (it include admin, emp, proj. co-ordinator, proj. manager) 2.> Username textbox 3.> Password textbox Login button Now the issue is I had different table for different users (admin, emp, proj. co-ordinator, proj. manager) with their username and password. So is there any step wise procedure to validate multi user login using servlet and jsp. I m successfully able to run for single user (like for only username and password) but unable for multi user.

http://stackoverflow.com/q/21700808
tagged with: android-scrollview
upvote count: 1
type: Question
score: 1
tagged with: java
has body: Hi i am trying to make an app and i have trouble with this: When i press a button i want a small windows to show (not shure if i have to use popup) in wich i want to have a scrollview full with radiobuttons and to be able to select one of them. During the scrolling i want to be able to see the backround that was before the popup. When selected a radio button the window should be closed. The scroll view should be vertical. The code ive came up with uses a new activity ... and that hieds the background which i dont want to happen. One more thing i want to ask is do i have to go through all my radiobuttons using a switch and case or can i combine it with a for loop? Many tahnks in advance!
has comment: http://stackoverflow.com/comment/32809992
tagged with: radio-button
downvote count: 0
answer count: 1
has title: How to create a popup radiobutton scroll view in Android?
favorite count: 0
has comment: http://stackoverflow.com/comment/32809993
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21701741
accepted answer: http://stackoverflow.com/a/21701741

http://stackoverflow.com/comment/33059137
score: 0
type: AnswerComment
has text: it works with different arrays inputs I tried, including the one you just gave. changing to what you suggested did not help when I call `maxheap(arr2,1)` which used to work previously.
comment on: http://stackoverflow.com/a/21839055
type: Comment

http://stackoverflow.com/comment/32869698
type: Comment
score: 1
has text: I made the same mistake but it is there.
type: AnswerComment
comment on: http://stackoverflow.com/a/21734196

http://stackoverflow.com/comment/32895750
has text: @beckinho - From the code you posted, it seems like you have your `clone` method in the class `Node<T>`. is it right?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21748295
type: Comment

http://stackoverflow.com/comment/32897861
type: QuestionComment
has text: Figure out where Eclipse is deploying the application (double click on the server runtime in the 'servers' view), and check what is deployed there. Probably the library is simply not there. And then it is going to be a quest to find out why not and that will depend a lot on what plugins you have or don't have. I would check the deployment assembly of the project, likely it is wonky.
comment on: http://stackoverflow.com/q/21749088
score: 0
type: Comment

http://stackoverflow.com/comment/32863527
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21714543
has text: This is simply not true, you can provide a start index for `indexOf` at which position the search should start (http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#indexOf(java.lang.String,%20int)) so that you don't *have* to chop up the string.
type: AnswerComment

http://stackoverflow.com/q/21712998
accepted answer: http://stackoverflow.com/a/21713069
tagged with: java
possible better answer: http://stackoverflow.com/a/21713062
has answer: http://stackoverflow.com/a/21713062
type: Question
tagged with: actionlistener
has body: I have this and its in an action listener. If i lose it will display 1. It then resets the board and 1 will stay there which is what I want.. Then if i lose again it doesn't change the 1 to a 2. Same problems goes for wins. I hope this is enough information. if (game.getGameStatus() == GameStatus.Lost) { displayBoard(); JOptionPane.showMessageDialog(null, "You Lose \nThe game will reset"); //exposeMines = false; game.reset(); displayBoard(); int losses = 0; losses = losses + 1; String lost = Integer.toString(losses); jtfLosses.setText(String.format(lost)); }
has answer: http://stackoverflow.com/a/21713313
answer count: 3
tagged with: user-interface
has answer: http://stackoverflow.com/a/21713069
score: 0
has title: I am making a game and I need it to add up each time they lose and or win in java guy
type: AnsweredQuestion

http://stackoverflow.com/comment/32951058
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21780103
has text: Check http://stackoverflow.com/questions/290982/java-class-type
score: 0

http://stackoverflow.com/q/21763123
answer count: 2
possible better answer: http://stackoverflow.com/a/21763190
downvote count: 0
has answer: http://stackoverflow.com/a/21763190
tagged with: arraylist
tagged with: groovy
has answer: http://stackoverflow.com/a/21766493
has title: Ensure that Groovy ArrayList objects are of the same class
favorite count: 0
accepted answer: http://stackoverflow.com/a/21766493
has body: I have a Java class: public class Parent { public int parentVal; } that will have several inherited Groovy classes like: class Child1 extends Parent { def value1; } class Child2 extends Parent { def value2; } I would like to have a collection in Groovy that would be restricted to contain only Child1 or Child2 instances, so that if the collection contains Child1 instances it can't contain Child2 instances (or anything else). This my attempt at this: import java.util.ArrayList; public class MyCollection&lt;T extends Parent&gt; { private ArrayList&lt;T&gt; list = new ArrayList&lt;T&gt;(); public void setType(Class&lt;T&gt; cls) { this.cls = cls; } public void add(T item) throws Exception { if(item.getClass() == cls) { list.add(item); } else { throw new Exception("wrong argument type"); } } public T getItem(int index) { return list.get(index); } private Class&lt;T&gt; cls; } and in my Groovy script: def c1 = new Child1() c1.value1 = 1 c1.parentVal = 2; def c2 = new Child2() c2.value2 = 2 c2.parentVal = 3; def myCol = new MyCollection() myCol.setType(Child1.class) myCol.add(c1) myCol.add(c2) // throws an exception The last statement really throws the "wrong argument type" exception, but I'm new to Java and Groovy so I'm probably doing the whole thing wrong. Any advice is greatly appreciated.
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/32965639
comment on: http://stackoverflow.com/q/21787821
has text: Suggestions for debugging:Enable debug logging for struts packages. Make a simple form where you only keep information related to the problem, ie a form with just programId
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32839059
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21716400
type: Comment
has text: @alex I didn't say it was off-topic, just that his error seems to be more of a clueless blunder (given the lack of detail) than a focused and researched inquiry about an issue.

http://stackoverflow.com/comment/33028298
type: AnswerComment
has text: true and you can find it under cached when you issue Free command
type: Comment
comment on: http://stackoverflow.com/a/21823127
score: 0

http://stackoverflow.com/comment/33179545
type: QuestionComment
has text: Thanks everyone for your input. I will try to figure out something from this link.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21823455

http://stackoverflow.com/comment/32885719
has text: You might replace your while loop with the following code snippet so you can see what's happening here: `while (sc.hasNext()) { System.out.println(sc.next()); }`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21742318
type: Comment

http://stackoverflow.com/comment/32924733
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21744022
type: AnswerComment
has text: @QuokMoon, thanks so just to get it clear, I should create a service class that will post data to server and call the service from the broadcast receiver when internet is available? is that possible?

http://stackoverflow.com/q/21824003
upvote count: 1
type: Question
has body: I'm trying to create a program that outputs an alternate tile design from the user's input. I.E. if the use inputs 3 the result would be a 3x3 design that looks like: |R|B|R| |B|R|B| |R|B|R| I'm having problems with getting the right amount of tiles for the output. For the input of 3, row 2 has an extra "|R|" and a 4th row is subsequently created. The output comes out to: |R|B|R| |B|R|B|R| |R|B|R| |B I've attached my code below. I know it has something to do with: if (r%2 == 0){ System.out.println("|"); System.out.print("|B"); Any thoughts? import java.util.*; public class tileFloor { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner (System.in); System.out.println("Enter x:"); int x; x = input.nextInt(); if (x &lt; 10) { int c = 0; int r = 0; while (r &lt; x ){ while (c &lt; x ){ if (c %2 == 0 ) System.out.print("|R"); else if (c%2 != 0) System.out.print("|B"); c++; }//end 'while (c&lt;x)' loop if (r%2 == 0){ System.out.println("|"); System.out.print("|B"); } else if (r%2 != 0) System.out.println("|"); c = 0; r++; }//end 'while (r&lt;x)' loop }//end if statement input.close(); }//end main }//end class
answer count: 2
has comment: http://stackoverflow.com/comment/33030805
has answer: http://stackoverflow.com/a/21824127
has answer: http://stackoverflow.com/a/21824847
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33030706
possible better answer: http://stackoverflow.com/a/21824847
has comment: http://stackoverflow.com/comment/33029824
has title: Creating an alternating tile floor with a nested loop
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21824127
has comment: http://stackoverflow.com/comment/33030023
score: 1
tagged with: java

http://stackoverflow.com/comment/33014382
type: AnswerComment
score: 0
type: Comment
has text: Can you clarify what the `$` and `^` does? I have implemented your code and it works perfectly but what do the `^` and `$` do? As I can see from tangens' answer they are not needed?
comment on: http://stackoverflow.com/a/21815146

http://stackoverflow.com/comment/32851213
has text: i wiil try whith this : String query = new String( "select valeur from table_contenu where valeur = titre"); Cursor c = bdd.rawQuery( query , null);
comment on: http://stackoverflow.com/a/21723829
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32850921
type: AnswerComment
score: 0
has text: @JohnV no worries, I'm glad it helped but it's actually thanks to everyone here that participated including yourself. Also I haven't actually used `BigInteger` before and had to look up the Java doc (hence I didn't realise I could use `BigInteger.ZERO`). My point is that it isn't about memorizing arbitrary facts, it's about understanding and learning how or why something works the way it does. Lastly, don't call yourself stupid, we're all learning so keep at it.
type: Comment
comment on: http://stackoverflow.com/a/21717495

python
tags question: http://stackoverflow.com/q/21807770
tags question: http://stackoverflow.com/q/21835204
tags question: http://stackoverflow.com/q/21691221
tags question: http://stackoverflow.com/q/21768587
tags question: http://stackoverflow.com/q/21717660
tags question: http://stackoverflow.com/q/21796925
tag name: python
tags question: http://stackoverflow.com/q/21719218
tags question: http://stackoverflow.com/q/21763912
tags question: http://stackoverflow.com/q/21735946
type: Tag
tags question: http://stackoverflow.com/q/21713416
tags question: http://stackoverflow.com/q/21715622
tags question: http://stackoverflow.com/q/21694901
tags question: http://stackoverflow.com/q/21798405
tags question: http://stackoverflow.com/q/21729173
tags question: http://stackoverflow.com/q/21685497
tags question: http://stackoverflow.com/q/21700630
tags question: http://stackoverflow.com/q/21687643

http://stackoverflow.com/comment/32827603
type: Comment
type: QuestionComment
has text: Yes, that's the only reason I shuffle twice, lol. :p
score: 0
comment on: http://stackoverflow.com/q/21710339

http://stackoverflow.com/comment/32828550
type: AnswerComment
has text: I tried, my problem is that row highlight on mouse over does not work when I move mouse over hyperlink. And also TRANSPARENT style in hyperlink breaks table borders.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21710070

http://stackoverflow.com/comment/32783974
has text: @ViRALiC: You *could* convert it to a `Calendar` (there's even a `toCalendar` method), but you'd be much better off converting *everything* to use Joda Time if you possibly can.
comment on: http://stackoverflow.com/a/21685777
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21713531
score: 2
has answer: http://stackoverflow.com/a/21746460
upvote count: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21746460
has body: I am having issues while running job with large data (~15G) on hadoop cluster using SimString Native library. However job runs fine on medium/small dataset(~200M). During the job SimString first create a file based database for matching strings and then perform matching on a given String against strings in database. After job is completed it deletes the file-based database. The job runs in a multi-threaded(100 threads) fashion. Around 22 mappers are created for job execution, each running 100 threads. Overall, RAM of machine is 4G Error Logs goes like: 14/02/12 00:15:53 INFO mapred.JobClient: map 0% reduce 0% 14/02/12 00:16:13 INFO mapred.JobClient: map 4% reduce 0% 14/02/12 00:16:24 INFO mapred.JobClient: Task Id : attempt_201402091522_0059_m_000001_0, Status : FAILED java.lang.Throwable: Child Error at org.apache.hadoop.mapred.TaskRunner.run(TaskRunner.java:271) Caused by: java.io.IOException: Task process exit with nonzero status of 134. at org.apache.hadoop.mapred.TaskRunner.run(TaskRunner.java:258) attempt_201402091522_0059_m_000001_0: # attempt_201402091522_0059_m_000001_0: # A fatal error has been detected by the Java Runtime Environment: attempt_201402091522_0059_m_000001_0: # attempt_201402091522_0059_m_000001_0: # SIGSEGV (0xb) at pc=0x00007f6f1cd8827b, pid=21146, tid=140115055609600 attempt_201402091522_0059_m_000001_0: # attempt_201402091522_0059_m_000001_0: # JRE version: 6.0_45-b06 attempt_201402091522_0059_m_000001_0: # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.45-b01 mixed mode linux-amd64 compressed oops) attempt_201402091522_0059_m_000001_0: # Problematic frame: attempt_201402091522_0059_m_000001_0: # C [libSimString.so+0x6c27b][thread 140115045103360 also had an error] attempt_201402091522_0059_m_000001_0: cdbpp::cdbpp_base&lt;cdbpp::murmurhash2&gt;::get(void const*, unsigned long, unsigned long*) const+0x16f attempt_201402091522_0059_m_000001_0: # attempt_201402091522_0059_m_000001_0: # An error report file with more information is saved as:…
type: Question
tagged with: hadoop
answer count: 2
downvote count: 0
has title: Hadoop Job fails with Native SimString C code on Large Data
favorite count: 0
possible better answer: http://stackoverflow.com/a/21714235
has answer: http://stackoverflow.com/a/21714235
tagged with: native-code

http://stackoverflow.com/a/21754399
type: AcceptedAnswer
has body: You already got your answer here: https://stackoverflow.com/a/21749133/1661864 It's a most easy way I can imagine. import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MaximumOccurringChar { static final String TEST_CASE_1 = "Hello! Are you all fine? What are u doing today? Hey Guyz,Listen! I have a plan for today. Help!"; public static void main(String[] args) { MaximumOccurringChar test = new MaximumOccurringChar(); List&lt;Character&gt; result = test.maximumOccurringChars(TEST_CASE_1, true); System.out.println(result); } public List&lt;Character&gt; maximumOccurringChars(String str) { return maximumOccurringChars(str, false); } // set skipSpaces true if you want to skip spaces public List&lt;Character&gt; maximumOccurringChars(String str, Boolean skipSpaces) { Map&lt;Character, Integer&gt; map = new HashMap&lt;&gt;(); List&lt;Character&gt; occurrences = new ArrayList&lt;&gt;(); int maxOccurring = 0; // creates map of all characters for (int i = 0; i &lt; str.length(); i++) { char ch = str.charAt(i); if (skipSpaces &amp;&amp; ch == ' ') // skips spaces if needed continue; if (map.containsKey(ch)) { map.put(ch, map.get(ch) + 1); } else { map.put(ch, 1); } if (map.get(ch) &gt; maxOccurring) { maxOccurring = map.get(ch); // saves max occurring } } // finds all characters with maxOccurring and adds it to occurrences List for (Map.Entry&lt;Character, Integer&gt; entry : map.entrySet()) { if (entry.getValue() == maxOccurring) { occurrences.add(entry.getKey()); } } return occurrences; } }
answers question: http://stackoverflow.com/q/21750365
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21750365
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/comment/120976355
score: 0
type: Comment
has text: This doesn't really help in explaining the concepts of thread-safety and synchronized methods, as requested by the OP.
comment on: http://stackoverflow.com/a/46267598
type: AnswerComment

http://stackoverflow.com/q/21814256
favorite count: 0
tagged with: cucumber-jvm
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21849597
has answer: http://stackoverflow.com/a/21876265
type: Question
has title: Is it possible to generate java test stub files from cucumber gherkin feature file?
tagged with: java
score: 4
upvote count: 4
tagged with: cucumber
answer count: 2
has body: Instead of reading the feature file, writing the name of the methods, add the right annotations and variables I want to "compile" the feature file and generate the java test file automatically. Is it possible? Do you know of a tool that can do that?
tagged with: gherkin
tagged with: bdd
downvote count: 0

http://stackoverflow.com/a/48115469
score: 24
upvote count: 24
answers question: http://stackoverflow.com/q/21829295
has comment: http://stackoverflow.com/comment/94902299
downvote count: 0
has body: By utilizing java.nio.file; (afaik introduced after J2SE 1.7) this simply solved my problem: Path path = Paths.get(fileNameWithFullPath); String directory = path.getParent().toString();
type: Answer

http://stackoverflow.com/comment/32899592
has text: I would add, however, that this should ONLY be the plan if managing permissions is within the application's scope. If its simply a "way to get it done", you need to find another way.
type: Comment
comment on: http://stackoverflow.com/a/21750102
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32985500
score: 0
has text: Hello Pierre, yes, i'm a begginer. As i said this is just simulated to povide here, this is not my actual program
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21798497

http://stackoverflow.com/a/31855921
answers question: http://stackoverflow.com/q/21697284
score: 0
type: Answer
has body: It looks like you have a configuration problem with your database. It's likely that your database couldn't let to the same user 10 simultanious connections. Maybe you could try to reduce maxPoolSize and minPoolSize to 1 so you can see your real problem.(Since the exception that you see is just the last exception given)

http://stackoverflow.com/q/21773448
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32939889
tagged with: hashmap
has answer: http://stackoverflow.com/a/21773478
score: -1
has comment: http://stackoverflow.com/comment/32940164
answer count: 2
tagged with: iterator
has body: I have a hashmap. I want to iterate hashmap to get only values as in hashmap, it contains so many key-value pair. Please guide me,how to get that. I cannot paste the code because of security issue.
upvote count: 0
has title: Iterate hashmap to get particular data
favorite count: 0
type: UnansweredQuestion
tagged with: hashtable
has answer: http://stackoverflow.com/a/21773672
tagged with: java
tagged with: loops

http://stackoverflow.com/comment/32911408
has text: @hgoebl well, in that case, shouldn't it have `not` given `image/jpeg` when tested using `poster/postman`?
comment on: http://stackoverflow.com/q/21756303
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33002915
score: 0
comment on: http://stackoverflow.com/q/21808864
has text: You'are probably missing an import, can't tell you which one as that library jar was not behind some registration... EDIT: add `import Fillo.*` before your line 41
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32830315
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21681257
type: Comment
has text: No. A constraint doesn't cause the database to automatically remove the dependent entities. To the contrary: it prevents the deletion of the referenced row if it's still referenced by a foreign key.

http://stackoverflow.com/q/21797921
score: 0
tagged with: eclipselink
tagged with: netbeans
has title: NetBeans issue when creating a DB entity class
has answer: http://stackoverflow.com/a/21801364
has body: I seem to have run into a problem with NB. I was able to successfully (with a few initial problems which seems to be a bug in NB) create an Entity Class from Database. The objective is to embed the database from a location into the application. The steps and issues are explained below. Resources: ~ Database [TourismDB] with two tables: "Tourists", "Tours" ~ Packages: META-INF, toursapp ~ Files: persistence.xml, Toursists.java, Tours.java, ToursUI.java Steps: 1. Create package ✔ 2. Create new Entity Class from Database ✔ 3. If not created yet, create a connection to physical location of DB on PC ✔ 4. Complete all steps successfully and the files are created by NB, viz. META-INF Package and the custom package for the DB entity classes ✔ 5. One of the class files created for a table creates a field which is a Serializable, but will be changed to Boolean and an error connected to the original Serial change is also changed to Bool. ✔ 6. Create JFrame Form, add jTable and bind it to Tours table. ✔ 7. Change META-INF\Persistence.xml JDBC url to exclude real path to physical location; eg. jdbc:derby:C:\Projects\ToursApp\TourismDB -> jdbc:derby: C:\Projects\ToursApp\ TourismDB ✔ 8. persistence.xml creates new lines which must be deleted. (See Append. 1) ✔ 9. Save everything before running JFrame. ✔ 10. Run JFrame and NB connects to EclipseLink, then throws exception. (expected; refer to bug 1) ✔ 11. Restart NB and run file. Everything compiles correctly. ✔ Appendix: 1. Persistence.xml Before Binding Elements to a JTable Change the JDBC URL to exclude physical location. See step 7. After changes, before running Bugs: 1. After completing steps 1 - 9, I build the app for the first time, and NB throws exception: [EL Info]: 2014-02-15 14:40:08.29--ServerSession(25525711)--EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461 [EL Severe]: 2014-02-15 14:40:12.342--ServerSession(25525711)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v2011…
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21801364
answer count: 1
tagged with: derby
tagged with: entity

http://stackoverflow.com/a/21750250
upvote count: 8
type: Answer
has body: One of the authors of HikariCP here. See the HikariCP wiki for how to properly configure MySQL for prepared statement caching. Prepared statement caching can dramatically speed up SQL. Additionally, it can avoid SQL-injection attacks on your code that would otherwise succeed if you concatenate user-provided input into SQL ordinary statements. Never compose a SQL string that contains user-provided input. Always use prepared statements, and set user-provided input as replacement values.
score: 8
answers question: http://stackoverflow.com/q/21716839
has comment: http://stackoverflow.com/comment/32919416
has comment: http://stackoverflow.com/comment/32929192
downvote count: 0
has comment: http://stackoverflow.com/comment/119641158

http://stackoverflow.com/comment/32825605
type: Comment
type: QuestionComment
has text: @NKN if (json.getString(KEY_SUCCESS) != null) {
comment on: http://stackoverflow.com/q/21709004
score: 0

http://stackoverflow.com/comment/32856129
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21725417
has text: So there are 2 periodic tasks that may take longer than the scheduling interval, and they are blocking the current thread - I can not imagine how it should be possible to execute a third task *immediately* in this case. The only solution that I see now, based on the current description, is to NOT *schedule* the Task3, but simply execute the respective `Runnable` directly in Task2 - but since this is just too obvious, I assume there is a reason why you did not do this...
score: 0

http://stackoverflow.com/comment/32976292
comment on: http://stackoverflow.com/a/21792510
type: Comment
has text: It honestly makes me weep reading all the horrible programming exercises I see posted on SO. It makes you want to find the instructor responsible and take them down about 10 notches.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32922886
type: AnswerComment
comment on: http://stackoverflow.com/a/21744210
type: Comment
has text: Are you trying to save bandwidth? Even if you don't need all the fields, you will be better off just querying the entity instead using a Hibernate projection. aliasToBean transformer does not map child relationships. There's a custom transformer on github for this but it does not work with one-to-many, only one-to-one and many-to-one: https://github.com/samiandoni/AliasToBeanNestedResultTransformer
score: 1

http://stackoverflow.com/comment/32968564
type: Comment
comment on: http://stackoverflow.com/q/21789571
type: QuestionComment
has text: What goes between the angle brackets is not an instance of any variable, but the actual type name, e.g. `ArrayList<Integer>` instead of `ArrayList<anInteger>`.
score: 0

http://stackoverflow.com/comment/32939710
has text: @ReikVal - That's how a sane `HashSet` implementation should work internally (except for `null` values, if the `Set` implementation supports them). However, the only part that's specified in [the docs](http://docs.oracle.com/javase/7/docs/api/java/util/Set.html#add%28E%29) is that values are compared using `equals()`.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21773075

http://stackoverflow.com/q/21693254
has answer: http://stackoverflow.com/a/45066480
has answer: http://stackoverflow.com/a/21693420
has answer: http://stackoverflow.com/a/21693436
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32797705
has comment: http://stackoverflow.com/comment/32797690
tagged with: jtextarea
has answer: http://stackoverflow.com/a/21693400
has body: I'm making a java Text Editior and I can't seems to know how to insert a line of text that is "[code][/code]" Here is what I'm trying to program. The method for the inserting is called "insert". So it has to be something that is insert,(something that inserts strings of text in JTextArea) /////////////////// CODE ////////////////////////////////////////////////////////////////////////////////////////////////// this.insert.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); /////////////// END OF CODE ///////////////////////////////////////////////////////////////////
has comment: http://stackoverflow.com/comment/32797384
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32800016
has comment: http://stackoverflow.com/comment/32797311
has comment: http://stackoverflow.com/comment/32797233
favorite count: 0
has comment: http://stackoverflow.com/comment/32797268
has answer: http://stackoverflow.com/a/57712605
answer count: 5
type: UnansweredQuestion
has title: How do I add text to a JTextArea?
tagged with: swing
has comment: http://stackoverflow.com/comment/32797726

http://stackoverflow.com/q/21737173
linked to: http://stackoverflow.com/q/7095921
tagged with: sql
answer count: 1
has body: I am trying to create the query with join in multiple tables and passing lists as parameters. I am putting the null &amp; empty check within the query string. However i am getting NullPointerException on QueryNode.getDataType. Below are the query and the exception. query = em.createQuery("select avg(kpi.duration), kpi.taskId from KPI kpi, User user, UserRole userRole, Shop shop where " + "(user.clientId = :customer or :customer is null) and (kpi.userId in :users or :users is null or :users = '' ) and " + "(userRole.role in :roles or :roles is null or :roles = '') and (shop.shopName in :shopNames or :shopNames is null or :shopNames = '') " + "and kpi.userId = userRole.userId and kpi.userId = user.id and kpi.userId = shop.userId group by kpi.taskId"); query.setParameter("customer",customer); query.setParameter(“users”,users); query.setParameter(“roles”,roles); query.setParameter("shopNames", shopNames); if (query != null){ List&lt;Object[]&gt; result = query.getResultList(); } users, roles &amp; shopNames are lists and customer is string. I have created queries pereviously with only strings with the null check and it worked. However, with lists, it errored out with the below. Any suggestion how to do it without checking for each parameter in a if else logic. [Request processing failed; nested exception is java.lang.NullPointerException] with root cause java.lang.NullPointerException at org.hibernate.hql.internal.ast.tree.QueryNode.getDataType(QueryNode.java:164) at org.hibernate.hql.internal.ast.tree.AbstractNullnessCheckNode.extractDataType(AbstractNullnessCheckNode.java:118) at org.hibernate.hql.internal.ast.tree.AbstractNullnessCheckNode.initialize(AbstractNullnessCheckNode.java:52) at org.hibernate.hql.internal.ast.HqlSqlWalker.prepareLogicOperator(HqlSqlWalker.java:1224) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:4218) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1935) at org…
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has title: JPA createQuery with passing list as parameter when the list is null or empty
linked to: http://stackoverflow.com/q/6277807
score: 1
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/21737261
type: Question
tagged with: jpa
downvote count: 0

http://stackoverflow.com/q/21778279
downvote count: 6
score: -5
type: UnansweredQuestion
has title: Finding the non leaves in a Binary tree
has comment: http://stackoverflow.com/comment/32947959
upvote count: 1
has answer: http://stackoverflow.com/a/21778396
has comment: http://stackoverflow.com/comment/32947947
has comment: http://stackoverflow.com/comment/32948155
tagged with: java
has body: I am trying to create a binary tree and try to count the non leaves in Java. How can I found the numbers of non leaves? Any suggestions please? here is a part of my code: public int no_leaves() { BTNode&lt;Integer&gt; n = root; int count=0; while(n!=null ) { if((n.right==null)&amp;&amp; (n.left==null)) {continue; } else { count++; } } System.out.println(count); return count; }
has comment: http://stackoverflow.com/comment/32947983
type: Question
answer count: 2
favorite count: 0
tagged with: binary-tree
has comment: http://stackoverflow.com/comment/32947894
has comment: http://stackoverflow.com/comment/32948362
has answer: http://stackoverflow.com/a/21778696

http://stackoverflow.com/q/21694833
type: UnansweredQuestion
downvote count: 2
has body: I am building a java application.I need to monitor how long the user is staying on a particular page.The timer should start on user entering the page.It should pause on user moving away to another page and resumes when user returns to the "page(panel)".It should work like a stopwatch on a particular panel.
upvote count: 1
has comment: http://stackoverflow.com/comment/32799897
tagged with: java
has answer: http://stackoverflow.com/a/21695317
type: Question
has comment: http://stackoverflow.com/comment/32800348
has title: How to display and compute time in java
tagged with: clock
has comment: http://stackoverflow.com/comment/32800313
score: -1
answer count: 2
has comment: http://stackoverflow.com/comment/32801080
has answer: http://stackoverflow.com/a/21695282
favorite count: 0
tagged with: timer

http://stackoverflow.com/comment/32989274
has text: 64 bit Java running on 32 bit OS?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21801106

http://stackoverflow.com/comment/32853548
type: AnswerComment
type: Comment
has text: Ok, just think about it, How would you tell tomcat to start on a remote machine if Tomcat is not running and hence not listening in any port to receive your "start" command? as far as I can tell your local machine is a Windows, right? in this case then you need a ssh client in command line for windows, and then you need to create a *.bat or *.cmd script that uses that ssh client
comment on: http://stackoverflow.com/a/21725129
score: 0

http://stackoverflow.com/a/21785818
has comment: http://stackoverflow.com/comment/32961386
has body: I am pretty sure you can't use the throws keyword at the class level. Which also shows that you don't have any method in your test class. Your code should looks like that: public class FireEyeAlert { public void myTestMethod() throws IOException { ... } } Just by curiosity, what tool are you using to compile your sources?
answers question: http://stackoverflow.com/q/21785627
downvote count: 0
has comment: http://stackoverflow.com/comment/32961312
has comment: http://stackoverflow.com/comment/32961546
type: Answer
has comment: http://stackoverflow.com/comment/32962423
score: 1
upvote count: 1

http://stackoverflow.com/comment/32841111
type: QuestionComment
comment on: http://stackoverflow.com/q/21696742
has text: I don't think this is possible.
score: 0
type: Comment

http://stackoverflow.com/comment/33019150
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21815517
score: 0
has text: Are you sure the file `positions.txt` exists? Are you sure the file `positions.txt` is in the same directory where the sketch `.pde` file is? Also `it didn't work...`...what exactly happened?

http://stackoverflow.com/comment/32772254
has text: The amount of available processors is definitely one. You can get it through Runtime class.
score: 0
comment on: http://stackoverflow.com/q/21679486
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33002992
type: Comment
has text: @trutheality OK, that's what I had in mind too! Thank's for the clear explanation!
type: QuestionComment
comment on: http://stackoverflow.com/q/21808736
score: 0

abstract
tags question: http://stackoverflow.com/q/21783370
tags question: http://stackoverflow.com/q/21742442
type: Tag
tags question: http://stackoverflow.com/q/21816627
tag name: abstract
tags question: http://stackoverflow.com/q/21841301
tags question: http://stackoverflow.com/q/21743145

http://stackoverflow.com/q/21812554
has comment: http://stackoverflow.com/comment/33009538
has comment: http://stackoverflow.com/comment/33026259
has answer: http://stackoverflow.com/a/21812646
favorite count: 0
has body: Is there an unsynchronized version of java.util.Stack? ArrayList almost has everything I want, except there doesn't seem to be a method that removes last element in amortized constant time. I want something that can act like a stack, but still let me have constant random access to the elements. If there really isn't anything, it isn't a big deal for me to just roll out my own or just use java.util.Stack, but it seemed strange to me that I couldn't find Stack's non-synchronized counterpart, that I thought it might be worth asking (also Googling just seemed to point me to other implementations rather than a class in the standard library).
type: UnansweredQuestion
score: 6
tagged with: standard-library
has comment: http://stackoverflow.com/comment/33009496
downvote count: 0
tagged with: stack
tagged with: java
has title: Is there an unsynchronized java.util.Stack?
has answer: http://stackoverflow.com/a/21812648
type: Question
answer count: 2
upvote count: 6

http://stackoverflow.com/comment/32954954
comment on: http://stackoverflow.com/a/21781312
score: 3
type: AnswerComment
type: Comment
has text: There is also an alternative without time by sum up the delta time till it is above 1000 and than execute the method, and resett the timer. (Do this inside of the render or act of an actor)

http://stackoverflow.com/comment/32920365
type: Comment
comment on: http://stackoverflow.com/a/21762438
type: AnswerComment
has text: Ok... so the solution would be to change the LayoutManager of the panel which contains the JLabels to something different, i.e. a BoxLayout. For even more Control your could use a GridBayLayout or an absolute Layout. Don't forget to set the size of the JLabels accordingly.
score: 0

http://stackoverflow.com/q/21757191
score: 16
has comment: http://stackoverflow.com/comment/33154342
has comment: http://stackoverflow.com/comment/33090540
has comment: http://stackoverflow.com/comment/32913799
type: Question
has comment: http://stackoverflow.com/comment/101472670
has comment: http://stackoverflow.com/comment/32910379
has title: JDBC getUpdateCount is returning 0, but 1 row is updated, in SQL Server
tagged with: sql-server
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33480299
tagged with: jooq
tagged with: sql-server-2008
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32913274
has comment: http://stackoverflow.com/comment/32910450
tagged with: jdbc
has body: Anyone ever seen this? I'm using MS SQL Server 2008, and I've tried it with two different JDBC drivers (jtds, and Microsoft's). I run a simple statement to update a row, and it does update it, but getUpdateCount returns 0. If I try it for different tables, it returns 1 as expected. It's something about this one table. PreparedStatement ps = conn.prepareStatement("select count(*) from foo_users where user_id = 1"); ResultSet rs = ps.executeQuery(); rs.next(); println(" count(*) is " + rs.getInt(1)); // Prints 1 ps = conn.prepareStatement("update foo_users set is_admin = 1 where user_id = 1"); ps.execute(); int count = ps.getUpdateCount(); println(" update count is " + count); // Prints 0. What is causing this? Update in response to comment: Yes, executeUpdate works. But I ask this question because I'm using a query library called jOOQ which is returning incorrect results because it's calling execute and getUpdateCount. I left this out of my question originally, because I don't think it is the library's fault.
upvote count: 16
has answer: http://stackoverflow.com/a/77847552
has answer: http://stackoverflow.com/a/38465255
tagged with: java

http://stackoverflow.com/q/21767243
has answer: http://stackoverflow.com/a/21768139
has comment: http://stackoverflow.com/comment/32929013
has comment: http://stackoverflow.com/comment/32929073
has title: Using regex, how can I check if a certain string is at the start of a sentence?
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32929048
type: Question
accepted answer: http://stackoverflow.com/a/21768139
has comment: http://stackoverflow.com/comment/32929061
answer count: 1
has comment: http://stackoverflow.com/comment/32929012
tagged with: regex
has comment: http://stackoverflow.com/comment/32928883
has body: How can I check if a specific string is at the start of a sentence using regex? Here are my examples. The flag I want to search for is "CEO" If the string starts with CEO, then it will be blocked, but it will be accepted if found anywhere else in the word. "CEO Hello": blocked "CEOHello": blocked "HelloCEO": accepted "Hello CEO": accepted CASE does not matter. Edit: Thanks guys, was missing the "^" for the start of the String.
has comment: http://stackoverflow.com/comment/32928994

http://stackoverflow.com/q/21738483
score: 1
has answer: http://stackoverflow.com/a/21781788
type: Question
has title: Processing -- moving image leaving trail
favorite count: 0
answer count: 3
has body: I'm working on trying to make an image move in processing, but the image is leaving a trail. The important part which is tripping me up is that I cannot declare the background in draw(), because I have other functions which place images. Here is the relevant code: void setup() { size(752,500); background = loadImage("prairie.jpg"); background(background); noStroke(); animal = loadImage("squirrel.png"); bird = loadImage("bird.gif"); rock = loadImage("rock.png"); cloud = loadImage("cloud.png"); jeep = loadImage("jeep.png"); flower = loadImage("flower.png"); } float jeepX = 752; float jeepY = 250; float size = 100; void draw() { image(jeep,150,350,125,125); image(jeep,jeepX,jeepY,size,size); jeepX--; jeepY = jeepY + .25; size += .25; image(jeep,jeepX + 1,jeepY - .25, size -.25, size - .25, 0,0,0,0); if(jeepY &gt; height) { jeepX = 752; jeepY = 250; size = 100; } } This is for lab and the TA didn't know how, and I didn't have a chance to ask the professor yet. If no one knows the answer and/or it has something to do with other functions (which place images), i'll post the relevant code.
upvote count: 1
has answer: http://stackoverflow.com/a/21738620
tagged with: processing
tagged with: java
type: UnansweredQuestion
tagged with: image
has answer: http://stackoverflow.com/a/21816974
has comment: http://stackoverflow.com/comment/32972208
downvote count: 0

http://stackoverflow.com/a/21731037
upvote count: 0
has comment: http://stackoverflow.com/comment/52072724
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/52074115
type: Answer
answers question: http://stackoverflow.com/q/21730638
has body: The date in the exception is an xml schema dateTime. Note that simply creating SimpleDateFormat dtf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); Will not work entirely as you might think because the Z indicates "UTC" timezone and the parser is by default initialized as local time. Also note that the schema dateTime has a variable definition, it can (optionally) have millisecond precision (0 or more milliseconds) and the timezone (if something other than Z) is not compatible with the format of SimpleDateFormat. In short: xml date times are tricky with the default libraries. I have written a custom solution for handling them in our environment but you could also look at the joda time library which I believe handles them well. Or you could wait for the next java version which will have a new date API.

http://stackoverflow.com/q/21826167
has comment: http://stackoverflow.com/comment/33033726
has answer: http://stackoverflow.com/a/21826335
has body: Im looking for a simple Set in Java that only provides the following functionality. Set.add(String s); Set.contains(String s); There is not need for me to retrieve any element of the set. All I want to do is to check if a String is contained in it. Is there such a data structure in Java? EDIT: I know that I could use a Set implementation like HashSet, etc... But I want a minimalistic data structure with only the two methods listed above. EDIT2: Im on a memory constrained system that's why.
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/21826273
answer count: 4
has answer: http://stackoverflow.com/a/21828069
has comment: http://stackoverflow.com/comment/33033473
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33033544
tagged with: collections
downvote count: 1
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/33033703
type: Question
has title: Simple Set with only "contains" method
has answer: http://stackoverflow.com/a/21826205
has comment: http://stackoverflow.com/comment/33033937
upvote count: 0
has comment: http://stackoverflow.com/comment/33033390

http://stackoverflow.com/comment/33015122
type: Comment
has text: Your code snippet won't compile because there is no `i` variable, the for loop should have `k < grid[0].length`
comment on: http://stackoverflow.com/a/21815628
type: AnswerComment
score: 0

http://stackoverflow.com/q/21770893
type: Question
has answer: http://stackoverflow.com/a/21770982
tagged with: tomcat
tagged with: assets
score: 0
has body: I'm programmatically (no web.xml) configuring a Tomcat 8 application and I'd like to load static assets (html, images, css, etc.) from the classpath. I've done the equivalent for Jetty using ResourceHandler: ResourceHandler resourceHandler = new ResourceHandler(); String webDir = getClass().getClassLoader().getResource("assets").toExternalForm(); resourceHandler.setResourceBase(webDir); How exactly is this done in Tomcat?
answer count: 1
type: UnansweredQuestion
tagged with: embedded-tomcat-7
tagged with: java
has title: How do you programmatically configure static assets in Tomcat 8?

http://stackoverflow.com/comment/33001553
comment on: http://stackoverflow.com/q/21807941
score: 0
type: Comment
type: QuestionComment
has text: you can use http://developer.android.com/reference/android/widget/SeekBar.OnSeekBarChangeListener.html to notify seekbar is changed

http://stackoverflow.com/comment/77194991
type: Comment
has text: Symantec has a TSA URL that will timestamp your self-signed app, `-tsa http://sha256timestamp.ws.symantec.com/sha256/timestamp` `
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/24178906

logging
tags question: http://stackoverflow.com/q/21703911
tags question: http://stackoverflow.com/q/21831815
tag name: logging
tags question: http://stackoverflow.com/q/21698333
tags question: http://stackoverflow.com/q/21754324
tags question: http://stackoverflow.com/q/21837206
tags question: http://stackoverflow.com/q/21683306
tags question: http://stackoverflow.com/q/21777975
tags question: http://stackoverflow.com/q/21733303
tags question: http://stackoverflow.com/q/21727208
tags question: http://stackoverflow.com/q/21704863
tags question: http://stackoverflow.com/q/21773861
tags question: http://stackoverflow.com/q/21718213
tags question: http://stackoverflow.com/q/21712413
tags question: http://stackoverflow.com/q/21834772
tags question: http://stackoverflow.com/q/21781026
tags question: http://stackoverflow.com/q/21694799
tags question: http://stackoverflow.com/q/21751954
tags question: http://stackoverflow.com/q/21706037
tags question: http://stackoverflow.com/q/21841549
tags question: http://stackoverflow.com/q/21832368
tags question: http://stackoverflow.com/q/21723967
tags question: http://stackoverflow.com/q/21755216
tags question: http://stackoverflow.com/q/21699231
tags question: http://stackoverflow.com/q/21710493
type: Tag
tags question: http://stackoverflow.com/q/21728669

http://stackoverflow.com/comment/33007831
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21806602
has text: wow thanks so much it really worked, I didn't understand what was the problem tho..
type: AnswerComment

http://stackoverflow.com/comment/32779117
type: Comment
type: QuestionComment
has text: stringUtils.padLeft; only i think because it is static
comment on: http://stackoverflow.com/q/21683273
score: 0

http://stackoverflow.com/comment/32947360
score: 0
comment on: http://stackoverflow.com/q/21777474
type: Comment
type: QuestionComment
has text: Ok thanks I will take this into consideration as each screen also does not load a single message but rather an array of ID's with the average being > 10 messages at a time. Perhaps given what you have highlighted and as JP Moresmau suggested this could actually be a waste of time trying to preserve memory at the cost of loads of disk reads. I appreciate the advice, thank you.

http://stackoverflow.com/a/21690920
type: Answer
score: 2
downvote count: 0
has body: boolean found = false; for(int i = 0; i &lt; counter; ++i){ if(records[i].str1.equals(name)){ System.out.println("MATCH FOUND"); found = true; break; } } if(!found) { System.out.println("NO MATCHES FOUND"); }
accepted answer of: http://stackoverflow.com/q/21690877
has comment: http://stackoverflow.com/comment/32793940
answers question: http://stackoverflow.com/q/21690877
has comment: http://stackoverflow.com/comment/32793587
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32793387

playframework-2.0
tags question: http://stackoverflow.com/q/21801742
tags question: http://stackoverflow.com/q/21805439
tags question: http://stackoverflow.com/q/21730323
tags question: http://stackoverflow.com/q/21770347
tags question: http://stackoverflow.com/q/21768024
tags question: http://stackoverflow.com/q/21680478
tags question: http://stackoverflow.com/q/21693970
tags question: http://stackoverflow.com/q/21718018
tags question: http://stackoverflow.com/q/21824330
type: Tag
tags question: http://stackoverflow.com/q/21789849
tags question: http://stackoverflow.com/q/21730926
tags question: http://stackoverflow.com/q/21741198
tag name: playframework-2.0

http://stackoverflow.com/comment/32861875
comment on: http://stackoverflow.com/q/21718213
type: QuestionComment
type: Comment
has text: Oh, ok. I get it now. I think my brain was just tired. You want to write something to go through the source files and do the conversion for you and are trying to simplify what it has to do?
score: 0

web-services
type: Tag
tags question: http://stackoverflow.com/q/21704629
tags question: http://stackoverflow.com/q/21770394
tags question: http://stackoverflow.com/q/21789317
tags question: http://stackoverflow.com/q/21795690
tags question: http://stackoverflow.com/q/21760115
tags question: http://stackoverflow.com/q/21761570
tags question: http://stackoverflow.com/q/21814486
tags question: http://stackoverflow.com/q/21772221
tags question: http://stackoverflow.com/q/21784108
tags question: http://stackoverflow.com/q/21685760
tags question: http://stackoverflow.com/q/21680545
tags question: http://stackoverflow.com/q/21699559
tags question: http://stackoverflow.com/q/21726392
tags question: http://stackoverflow.com/q/21763285
tags question: http://stackoverflow.com/q/21683284
tags question: http://stackoverflow.com/q/21706078
tags question: http://stackoverflow.com/q/21776829
tags question: http://stackoverflow.com/q/21829081
tags question: http://stackoverflow.com/q/21682814
tags question: http://stackoverflow.com/q/21688714
tags question: http://stackoverflow.com/q/21699227
tags question: http://stackoverflow.com/q/21690429
tags question: http://stackoverflow.com/q/21696443
tags question: http://stackoverflow.com/q/21678655
tags question: http://stackoverflow.com/q/21784252
tags question: http://stackoverflow.com/q/21745146
tags question: http://stackoverflow.com/q/21817936
tags question: http://stackoverflow.com/q/21761984
tags question: http://stackoverflow.com/q/21727208
tags question: http://stackoverflow.com/q/21815418
tags question: http://stackoverflow.com/q/21782378
tag name: web-services
tags question: http://stackoverflow.com/q/21778901
tags question: http://stackoverflow.com/q/21743486
tags question: http://stackoverflow.com/q/21719630
tags question: http://stackoverflow.com/q/21835100
tags question: http://stackoverflow.com/q/21778733
tags question: http://stackoverflow.com/q/21749122
tags question: http://stackoverflow.com/q/21836548
tags question: http://stackoverflow.com/q/21696915
tags question: http://stackoverflow.com/q/21827877
tags question: http://stackoverflow.com/q/21678550
tags question: http://stackoverflow.com/q/21798350

http://stackoverflow.com/comment/33031500
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21824922
type: QuestionComment
has text: What are you trying to do: save a new entity or to update it? Show us the HibernateUtil.

http://stackoverflow.com/comment/33061247
has text: I see your point. Stepping away from my over-simplified "Foo Bar Bang" example, it's basically an abstract Person class that holds all the common attributes that more specific kinds of people can extend.
type: AnswerComment
comment on: http://stackoverflow.com/a/21841312
score: 0
type: Comment

http://stackoverflow.com/a/29081464
upvote count: 2
has comment: http://stackoverflow.com/comment/46404682
type: AcceptedAnswer
downvote count: 0
has body: As there is no documentation found regarding this fields parameter I have to speak from my own experiments. In my understanding Google Cloud Endpoints dispatcher does that field masking automatically. Returned object from your API method is processed by Jackson JSON parser which returns only fields given in fields parameter. Your object's fields should appear in field editor also. Below is image how that field editor appears in Drive API. Your own Endpoints APIs should produce likewise field editor and Jackson should parse only fields you have selected. NOTES: Appengine devserver (localhost) shows that field editor too but somehow does not take selected fields in account when parsing to JSON. In some cases field editor allows you to select fields in nested objects, in some cases not. I have not found out the logic behind this behaviour. If using Hibernate (or some other similar framework) with lazy-fetched fields you will probably face "could not initialize proxy" -error. In those cases you have to open Hibernate session manually in Endpoints. One solution I found is to inherit com.google.api.server.spi.SystemServiceServlet class and open session in doPost -method. That method handles all requests sent to Endpoints. You should also annotate your entities with @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) -annotation as Jackson will fail trying to parse those fields.
answers question: http://stackoverflow.com/q/21715070
accepted answer of: http://stackoverflow.com/q/21715070
type: Answer
score: 2

searchview
tags question: http://stackoverflow.com/q/21800802
tag name: searchview
type: Tag
tags question: http://stackoverflow.com/q/21798683

http://stackoverflow.com/q/21831513
tagged with: vector
upvote count: 0
score: -1
answer count: 2
tagged with: operator-keyword
tagged with: compare
favorite count: 0
has title: I need to compare the elements of 2 vectors JAVA
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21831542
has answer: http://stackoverflow.com/a/21831564
tagged with: java
tagged with: methods
downvote count: 1
type: Question
has body: I need to compare the elements of 2 vectors but it keeps throwing an exception. Please help, Im wondering if Im doing wrong comparisons since vectors use methods. for (int i=0; i &lt;= vect.size(); i++) { if (i &gt;0 &amp;&amp; i &lt;= vect.size()) { if( vect.get(i) == vect.get(i--) ) //EXCEPTION HERE { vect2.add(vect.get(i)+ ""); }else{vect2.add(vect.get(i++));} } }

http://stackoverflow.com/comment/119997081
type: Comment
has text: Really, I see 3 attributes in console.log of lastEvaluatedKey - two from GSI (gsi1pk, gsi1sk) and one is 'pk'. In my case gsi1sk=sk - I think it's a reason why I don't see 'sk' in lastEvaluatedKey.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/59548080

http://stackoverflow.com/a/21695731
score: 2
has body: "true" is not a JSONObject. A JSONObject is an unordered collection of name/value pairs. quoting from the same source as @devnull. Java is not interpreting the String result as a Boolean, rather the JSON value represented by the String "true" is correctly interpreted as a JSON boolean. Clearly, it is not a collection of name/value pairs, which is denoted as @Leos Literak suggested using curly braces, colons and semicolons: { key : "value"; otherkey : true } I hope this helps. The term 'object' is used very differently in Java and JSON.
answers question: http://stackoverflow.com/q/21695490
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32969155
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21784629
score: 0
has text: A-ha! `stations.get(fromStation).add(toStation);` - Think that's got it? Thanks for your patience JB Nizet, appreciated!

http://stackoverflow.com/q/21721119
has answer: http://stackoverflow.com/a/34121777
has answer: http://stackoverflow.com/a/32473606
has answer: http://stackoverflow.com/a/28825374
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/21743527
tagged with: gradle
type: Question
upvote count: 209
has answer: http://stackoverflow.com/a/28394231
has answer: http://stackoverflow.com/a/35189253
score: 207
has title: Creating runnable JAR with Gradle
has answer: http://stackoverflow.com/a/21721177
has answer: http://stackoverflow.com/a/59483559
linked to: http://stackoverflow.com/q/22659463
tagged with: executable-jar
tagged with: jar
possible better answer: http://stackoverflow.com/a/21743527
has answer: http://stackoverflow.com/a/70864141
tagged with: build.gradle
favorite count: 0
accepted answer: http://stackoverflow.com/a/21721305
has body: Until now I created runnable JAR files via the Eclipse "Export..." functionallity but now I switched to IntelliJ IDEA and Gradle for build automation. Some articles here suggest the "application" plugin, but this does not entirely lead to the result I expected (just a JAR, no start scripts or anything like this). How can I achieve the same result Eclipse does with the "Export..." dialog?
answer count: 12
linked to: http://stackoverflow.com/q/47961942
has answer: http://stackoverflow.com/a/64628291
has answer: http://stackoverflow.com/a/64786642
linked to: http://stackoverflow.com/q/41794914
linked to: http://stackoverflow.com/q/14669809
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21721305

http://stackoverflow.com/a/21834216
type: Answer
has comment: http://stackoverflow.com/comment/33066981
has comment: http://stackoverflow.com/comment/33074218
has comment: http://stackoverflow.com/comment/33154410
has body: Example: final String html = "&lt;meta name=\"donald\" content=\"duck\" /&gt;\n" + "&lt;meta name=\"micky\" content=\"mouse\" /&gt;\n" + "&lt;meta name=\"daisy\" content=\"duckling\" /&gt;\n" + "&lt;meta name=\"scrooge\" content=\"macduck\" /&gt;"; Document doc = Jsoup.parse(html, ""); Element mouse = doc.select("meta[content=mouse]").first(); mouse.attr("content", "horse"); You just have to select the proper tag and change the attributes value. Explanation: Element mouse = doc.select("meta[content=mouse]").first(); Select all meta-tags, with attribute content with value mouse; since select() returns a list of tags, first() is used to get the first one. mouse.attr("content", "horse"); Change value of attribute content.
answers question: http://stackoverflow.com/q/21833155
score: 0

http://stackoverflow.com/comment/32851450
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21724125
has text: I see at least two here!
score: 0

http://stackoverflow.com/q/21797573
has comment: http://stackoverflow.com/comment/32982970
has title: Why is Scanner slower than BufferedReader when reading from input?
has answer: http://stackoverflow.com/a/44531522
has answer: http://stackoverflow.com/a/21797653
has answer: http://stackoverflow.com/a/21797791
tagged with: java.util.scanner
score: 12
tagged with: java
accepted answer: http://stackoverflow.com/a/21797791
has body: I understand what is Scanner good for, and also when to use Scanner and when BufferedReader. I read a different, yet in some therm similar question Scanner vs. BufferedReader Why is Scanner so slow when I read from the input? I assume it has to do with that there is a small buffer in Scanner, but here I am lost. The original problem is from, Codechef , but I am not interested in that solution. Here is a code example with a given input: Input: 7 3 1 51 966369 7 9 999996 1 And the code import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s = br.readLine().split(" "); int numberOfLines = Integer.parseInt(s[0]); int divideNumber = Integer.parseInt(s[1]); int count = 0; for (int i = 0; i &lt; numberOfLines; i++) { String number = br.readLine(); if (number.length() &lt; 11) { int num = Integer.parseInt(number); if (num % divideNumber == 0) { count++; } } } System.out.println(count); } } If I read the same code with scanner it is slow.
linked to: http://stackoverflow.com/q/2231369
upvote count: 12
possible better answer: http://stackoverflow.com/a/21797777
tagged with: bufferedreader
answer count: 5
has comment: http://stackoverflow.com/comment/32983758
has answer: http://stackoverflow.com/a/21797777
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21797683
type: Question
has comment: http://stackoverflow.com/comment/119211305

http://stackoverflow.com/comment/42184567
type: Comment
has text: @LifeH2O Split them up into blocks of shared functionality then give them that. i.e. you might have `MathsTeacher` and `EnglishTeacher` both inheriting `Teacher`, `ChemicalEngineer`, `MaterialsEngineer` etc inherit `Engineer`. `Teacher` and `Engineer` both implement `Component`. The `Person` then just has a list of `Component`s, and you can give them the right `Component`s for that `Person`. i.e. `person.getComponent(Teacher.class)`, `person.getComponent(MathsTeacher.class)`, etc.
comment on: http://stackoverflow.com/a/21825368
score: 1
type: AnswerComment

http://stackoverflow.com/a/21683516
type: Answer
score: 0
has body: Use a StringTokenizer, which has a " " as a delimiter by default.
answers question: http://stackoverflow.com/q/21683463

http://stackoverflow.com/q/21687022
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32785758
score: 10
linked to: http://stackoverflow.com/q/15704091
has title: Using Autowired in a TestExecutionListener class for BeforeClass junit
has body: I need to do a @BeforeClass method in junit but inject values using Spring so can't switch private variables to static. I am trying to do this Listeners and and creating a Listener class but I am running into an issue with this. I have values that I need to Autowire in this class as well because the method I want to run BeforeClass calls for a variable that is @Autowired injected. However, for some reason, it is not working and this value remains null. Has anyone run into a problem like this before?
has answer: http://stackoverflow.com/a/27513627
upvote count: 10
tagged with: junit
answer count: 1
favorite count: 0
tagged with: listener
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/137013908
downvote count: 0

http://stackoverflow.com/q/21719201
has answer: http://stackoverflow.com/a/21719548
answer count: 2
has comment: http://stackoverflow.com/comment/32849467
tagged with: eclipselink
tagged with: jpa
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am trying to add to my persistance.xml file. Like Below: oracle.toplink.essentials.PersistenceProvider When I added to my persistance.xml it's showing Invalid content was found starting with element 'provider' How can I overcome this I have added 2 jars 1.eclipselink.jar 2.javax.persistence_2.0.4.v201112200901.jar
has comment: http://stackoverflow.com/comment/32849817
has answer: http://stackoverflow.com/a/21720279
has title: While adding <provider> to Persistance.xml it' showing "Invalid content was found starting with element 'provider'."

http://stackoverflow.com/a/21719677
type: Answer
has body: The best way is to go for the resources folder by storing all the languages of French in the res/values-fr folder and reflect it all over the application. By following the resources way you do not need to bother about managing the each and everything in your application flow. The application will be directly changed according to the French language as the user will change its language to french. It will directly access all the resources from the value-fr folder if you have kept. If you will go by database way then in that case you are supposed to check for the locale and you will have to manage all the values of your application according to the local each and everytime which will lead you to complexity of handling resources. So, Why not go for the best way if android is providing you such great functionality.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21719396
answers question: http://stackoverflow.com/q/21719396
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/21821429
type: AnsweredQuestion
tagged with: jpa
accepted answer: http://stackoverflow.com/a/21822688
linked to: http://stackoverflow.com/q/3927091
has body: I have a table called conclusion and it has a relationship with table comments. When i am adding conclusion and comments at the same time, Conclusion is being inserted but child getting conclusion id as null by which i'm getting violation of not null constraint. My transaction roll backs conclusion also not inserted. So please tell me how to insert parent and child at once. my entities are Conclusion Entity @Entity @Table(name="olm_anlys_cncln") public class OlmAnalysisConclusion implements Serializable { private static final long serialVersionUID = 1L; private Long conclusionId; private String concludedBy; private Timestamp concludedTime; private String conclusion; private Timestamp discussionEndTime; private String discussionActive; private Timestamp discussionStartTime; private Integer tntId; private OlmAnalysis olmAnly; private OlmAnalysisCategory olmAnlysCatgMstr; private OlmAnalysisCause olmAnlysCauseMstr; private List&lt;OlmInvsgDiscussionComment&gt; olmInvsgDiscnCmnts; public OlmAnalysisConclusion() { } @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="olm_anlys_cncln_id") public Long getConclusionId() { return this.conclusionId; } public void setConclusionId(Long conclusionId) { this.conclusionId = conclusionId; } @Column(name="cncld_by") public String getConcludedBy() { return this.concludedBy; } public void setConcludedBy(String concludedBy) { this.concludedBy = concludedBy; } @Column(name="cncld_time") public Timestamp getConcludedTime() { return this.concludedTime; } public void setConcludedTime(Timestamp concludedTime) { this.concludedTime = concludedTime; } @Column(name="cncln") public String getConclusion() { return this.conclusion; } public void setConclusion(String conclusion) { this.conclusion = conclusion; } @Column(name="discn_end_time") public Timestamp getDiscussionEndTime() { return this.discussionEndTime; } public void setDiscussionEndTime(Timestamp discussionEndTime) { this.discussionEndTime = discussionEndTime; } @Column(…
tagged with: postgresql
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21822688
has title: How to persist parent and childs in JPA?
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33026132

http://stackoverflow.com/a/21712292
has body: Simply speaking: arrays are a class. BB[] does not extend AA[] even though BB extends AA. In the early days pre-generics. ArrayLists held Objects. so anything could be held in an ArrayList. If you had an Array of Object, you could play the same game. Now with generics you can specify an ArrayList with a specific type like ArrayList&lt;String&gt;. actually the problem is on line 2: AA[] arr2=arr; Let's make the problem a little easier. You have a vehicle class and a bike and a car class that extends vehicle. You can not have Bike b=new Bike() Car c=b; arr2 is an array and arr is an array, but the class is different. Does that help?
downvote count: 0
has comment: http://stackoverflow.com/comment/32831313
answers question: http://stackoverflow.com/q/21711772
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/21803584
downvote count: 0
answers question: http://stackoverflow.com/q/21803437
type: Answer
upvote count: 1
score: 1
has body: //Problem here **sGrade** += grade; //Line mention in code sGrade is local variable declare in the HistoryStudent constructor so you cant access it in the updateGrade method. What you can do is declare the sGrade as global variable and while calling the super constructor in the method set the global variable value and access it in the updateGrade method. class HistoryStudent extends Student { int sGrade; public HistoryStudent (String sID, int sGrade) { super(sID,sGrade) ; this.sGrade = sGrade; } boolean updateGrade (int grade) { boolean checking = false ; sGrade += grade; // Dnt know usage bcoz everytime method will return false return checking ; } }

http://stackoverflow.com/q/21727873
possible better answer: http://stackoverflow.com/a/21728063
answer count: 5
has title: Queue<Integer> q = new LinkedList<Integer>()
has comment: http://stackoverflow.com/comment/32858042
upvote count: 9
accepted answer: http://stackoverflow.com/a/21728088
has answer: http://stackoverflow.com/a/21727968
downvote count: 0
linked to: http://stackoverflow.com/q/1686174
has answer: http://stackoverflow.com/a/21728063
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21728088
linked to: http://stackoverflow.com/q/1913098
has answer: http://stackoverflow.com/a/56253445
tagged with: java
linked to: http://stackoverflow.com/q/383947
tagged with: queue
type: Question
score: 9
has comment: http://stackoverflow.com/comment/32858175
has body: Here is an answer to "How do I instantiate a Queue object in java?", Queue is an interface. You can't instantiate an interface directly except via an anonymous inner class. Typically this isn't what you want to do for a collection. Instead, choose an existing implementation. For example: Queue q = new LinkedList(); or Queue q = new ArrayDeque(); Typically you pick a collection implementation by the performance and concurrency characteristics you're interested in. How does this work? What does it mean for Queue, an interface, to take on the implementation of LinkedList? Does that mean objects can be dequeued in a FIFO (first-in-first-out order), and calling linked list methods on q would work?
has answer: http://stackoverflow.com/a/21727964
tagged with: data-structures
has comment: http://stackoverflow.com/comment/32857963
linked to: http://stackoverflow.com/q/4626812
favorite count: 0

header
type: Tag
tags question: http://stackoverflow.com/q/21809779
tag name: header
tags question: http://stackoverflow.com/q/21831067

http://stackoverflow.com/comment/32806417
comment on: http://stackoverflow.com/q/21697506
score: 0
type: Comment
type: QuestionComment
has text: `get...()` vs. `is...()` - I recall Dozer being picky about that...

http://stackoverflow.com/a/21732872
score: 1
has comment: http://stackoverflow.com/comment/32867989
accepted answer of: http://stackoverflow.com/q/21728274
upvote count: 1
type: AcceptedAnswer
has body: Because it's unclear, I want to make sure that you have spawned a new thread that the ImageIO.read call is running on; This line will likely block the thread until something is sent for it to read. You do not want this executing on the EDT. Assuming you have that, I would suggest that you use SwingUtilities.invokeLater for updating the GUI. This is standard process - what it does is it puts the update in the queue, so the next time the GUI wants to update, it knows what to do. So altogether, your code should look something like this: Thread awesomeThread = new Thread(new Runnable(){ @Override public void run() { while(true){ try{ //Read the image final Image img = ImageIO.read(socket.getInputStream()); System.out.println("Image Read"); //code for troubleshooting //Once an image is read, notify the GUI to update SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { ImageIcon icon = new ImageIcon(img); label.setIcon(icon); System.out.println("Image updated"); //code for troubleshooting }}); } catch (IOException e) {} } }}); awesomeThread.start();
has comment: http://stackoverflow.com/comment/32868852
has comment: http://stackoverflow.com/comment/32868282
has comment: http://stackoverflow.com/comment/32868745
type: Answer
answers question: http://stackoverflow.com/q/21728274
has comment: http://stackoverflow.com/comment/32867888
downvote count: 0
has comment: http://stackoverflow.com/comment/32867709

http://stackoverflow.com/q/21826639
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33034487
tagged with: spring
has comment: http://stackoverflow.com/comment/33035115
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/33034347
score: 1
tagged with: java
has body: I have below spring bean. public class Employee2 { private int id; private String name; private double salary; public Employee2(int id, String name, double salary) { this.id = id; this.name = name; this.salary = salary; } // some logic to call database using above values } Now i have below config in spring configuration file. &lt;bean id="emp2" class="com.basic.Employee2"&gt; &lt;constructor-arg name="id" value="" /&gt; &lt;constructor-arg name="name" value="" /&gt; &lt;constructor-arg name="salary" value="" /&gt; &lt;/bean&gt; Now i cannot hard code the values in above config since they are dynamic. Now i am getting spring bean programmatically using below code. Employee2 emp = (Employee2)applicationContext.getBean("emp2"); Now how can i pass the values to Employee2 constructor? Thanks!
upvote count: 1
type: Question
has title: Passing values to spring bean programmatically?
downvote count: 0
has answer: http://stackoverflow.com/a/21826993
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33034443

http://stackoverflow.com/comment/33045968
comment on: http://stackoverflow.com/q/21833182
score: 0
type: Comment
type: QuestionComment
has text: @Wilmer , yes, yes, I have made that mistake in the post, but I've tested right in my code, and it didn't work..

http://stackoverflow.com/comment/32901471
has text: start applying your learning (of mad's references) by _not_ storing components in your node: instead store the data and let the renderer/editor do their jobs
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21746523

http://stackoverflow.com/a/21806047
has body: When programming in Java, you should be referencing the Javadoc for the class or interface you're using to answer these sorts of questions. You would use: books2.addAll(books); to append all entries in books to books2. From the Javadoc linked above: boolean addAll(Collection&lt;? extends E&gt; c) Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
upvote count: 21
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21805999
answers question: http://stackoverflow.com/q/21805999
type: Answer
downvote count: 0
score: 21

http://stackoverflow.com/comment/32963904
type: QuestionComment
score: 1
has text: what args are you passing?
comment on: http://stackoverflow.com/q/21787198
type: Comment

pom.xml
tags question: http://stackoverflow.com/q/21824853
tags question: http://stackoverflow.com/q/21685353
type: Tag
tag name: pom.xml
tags question: http://stackoverflow.com/q/21747609
tags question: http://stackoverflow.com/q/21801840

http://stackoverflow.com/comment/32793387
score: 0
type: AnswerComment
type: Comment
has text: Also, do you want the search to be case-sensitive or case-insensitive? At the moment it is case sensitive.
comment on: http://stackoverflow.com/a/21690920

http://stackoverflow.com/q/21794117
has title: java.security.cert.CertificateParsingException: signed fields invalid
tagged with: security
answer count: 1
tagged with: x509certificate
favorite count: 0
has body: I'm trying to read a X509 certificate FileInputStream fr = new FileInputStream("suresh.pfx"); CertificateFactory cf = CertificateFactory.getInstance("X509"); X509Certificate c = (X509Certificate) cf.generateCertificate(fr); And run in to the exception java.security.cert.CertificateParsingException: signed fields invalid at sun.security.x509.X509CertImpl.parse(Unknown Source) at sun.security.x509.X509CertImpl.&lt;init&gt;(Unknown Source) at sun.security.provider.X509Factory.engineGenerateCertificate(Unknown Source) at java.security.cert.CertificateFactory.generateCertificate(Unknown Source) at com.nextenders.certificategeenrator.CertificateGenerator.testGenerateSignCertWithKeyStore(CertificateGenerator.java:102) at com.nextenders.certificategeenrator.CertificateGenerator.main(CertificateGenerator.java:65) Found something related to it from Oracle forum with no solution. Any hints ?
upvote count: 11
type: UnansweredQuestion
tagged with: encryption
downvote count: 1
tagged with: java
score: 10
type: Question
has answer: http://stackoverflow.com/a/24081198
tagged with: digital-certificate

http://stackoverflow.com/a/21799487
has comment: http://stackoverflow.com/comment/33204419
upvote count: 3
has comment: http://stackoverflow.com/comment/33157946
has comment: http://stackoverflow.com/comment/33190556
type: Answer
has comment: http://stackoverflow.com/comment/33190280
has comment: http://stackoverflow.com/comment/33183852
answers question: http://stackoverflow.com/q/21799384
downvote count: 0
score: 3
has body: First of all, you questions is structured in a way that i do not fully understand it. However let me make things clear. In order for java program to connect to Database you need a driver ( typically JDBC ). The database HAS to be on some sort of "server" i.e apache, sql server, derby etc. If you want to save some HDD space i suggest looking into Derby Database, which is "integrated" database EDIT: Or you can just host external database on some hosting server ;), there are some free ones out there too !
has comment: http://stackoverflow.com/comment/33219902
has comment: http://stackoverflow.com/comment/33233707

http://stackoverflow.com/a/22745448
answers question: http://stackoverflow.com/q/21697341
has body: I know this is a terrible answer because I don't have time to write any code. Have you tried creating a listener so you can get the proper maximum size once the window is actually created, and then setting the GridBagConstraints weightx and weighty properties accordingly?
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34686018

http://stackoverflow.com/comment/32802747
has text: In addition to @Leos - just make sure the two jars use the same classloader. Especially when deploying it to an Application Server.
comment on: http://stackoverflow.com/q/21695492
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32916137
comment on: http://stackoverflow.com/a/21745664
score: 0
type: Comment
has text: Thank you for the answer. What if I will want the whole to run as a web application? Should I then add an additional web-app module which will have dependencies to all existing modules, i.e. in the case shown in the diagram in my question, to base-api, base and "A" modules?
type: AnswerComment

http://stackoverflow.com/comment/32958949
type: AnswerComment
type: Comment
has text: @Hari that is kind of my point, **deep cloning** is a mess, making your objects `immutable` has many benefits and few to no drawbacks.
comment on: http://stackoverflow.com/a/21784038
score: 0

http://stackoverflow.com/a/21729930
score: 0
answers question: http://stackoverflow.com/q/21727696
type: Answer
has body: Class class1; TelephonyManager manager = (TelephonyManager) mContext.getSystemService(mContext.TELEPHONY_SERVICE); try { class1 = Class.forName(TelephonyManager.class.getName()); Method createBondMethod = class1.getMethod("getVoiceMessageCount"); Integer returnValue = (Integer) createBondMethod.invoke(manager); System.out.println("return value is "+returnValue); }

http://stackoverflow.com/a/21714714
score: 0
type: Answer
has body: Try by putting this in OnClick: Toast.makeText(Wyslij.this, zam.klient.getNazwa()+ " "+zam.klient.getNip()+" "+zam.klient.getAdres().toString(), Toast.LENGTH_LONG) .show();
answers question: http://stackoverflow.com/q/21714119

http://stackoverflow.com/a/21841217
upvote count: 3
has body: Generally a Document Management System would make an excellent choice for this solution. Depending on the level of effort you plan on spending on the project, you may want to explore Alfresco's architecture and take advantage of the underlying Spring MVC Framework that supports the Alfresco Share web application. From this post on the Alfresco Forums, Alfresco is CMIS 1.1 Compliant. You should be able to access CMIS 1.1 from Alfresco through the following URL: http://example.com:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom For more information on Alfresco CMIS: http://www.alfresco.com/cmis
answers question: http://stackoverflow.com/q/21827672
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/q/21787711
has answer: http://stackoverflow.com/a/21788075
downvote count: 0
has comment: http://stackoverflow.com/comment/32965205
possible better answer: http://stackoverflow.com/a/21787775
has answer: http://stackoverflow.com/a/21787775
favorite count: 0
has title: Using interface with enums
accepted answer: http://stackoverflow.com/a/21788075
has comment: http://stackoverflow.com/comment/32965241
tagged with: interface
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21789191
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32965068
upvote count: 1
has body: I am coding a mini-project of sorts about medical information, and in it, I am reading text from several data sources. All these text sources have the same type of information, but under slightly different labels. For example, sourceA has a section titled "adverse effects" while sourceB calls it "side effects". I have an interface called Reader, and several classes (AReader, BReader, etc.) implementing this interface. Also, I have enum for each class for the section titles. For example: enum ASections { SIDE_EFFECTS ("side effects"), DOSAGE ("dosage"); private String sectionTitle; private ASections(String s) { this.sectionTitle = s; } } enum BSections { SIDE_EFFECTS ("adverse effects"), DOSAGE ("dosage and usage"); private String sectionTitle; private BSections(String s) { this.sectionTitle = s; } } At the core of my project lies an Orchestrator class, which uses a Reader (the actual source A, B, etc. are specified by command line options). So far so good. However, I want all the classes implementing Reader to also implement a method getSectionText, where the argument should be ASections or BSections or ... How do I specify such a method at the interface level? This was my first (obviously wrong) attempt: public String getSectionText(Enum _section_enum); The idea is that no matter which data source is specified at command line, I should be able to get the required type of text by fetching the appropriate section title.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32964940
tagged with: enums

http://stackoverflow.com/a/21786299
has comment: http://stackoverflow.com/comment/32963751
upvote count: 1
has comment: http://stackoverflow.com/comment/32967128
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21786205
has body: If you're only wanting the compiler error fixed, you need to properly escape the path like below. public static void main(String[] args) throws IOException { Runtime.getRuntime().exec("cmd /c start \"" + "%ProgramData%\\Microsoft\\Windows\\Start Menu\\Programs\\Accessories\\System Tools\\Task Scheduler.exe\""); } If you need quotes in the string, you escape with a \. If you need to just open the task scheduler on Windows, try the following: Runtime.getRuntime().exec("cmd /c " + "%windir%\\system32\\taskschd.msc /s");
accepted answer of: http://stackoverflow.com/q/21786205
type: Answer

http://stackoverflow.com/comment/32991372
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21802165
type: Comment
has text: Agree! I've no problem implementing a JsonNode producing JsonGenerator. I'd just thought there was a solution already in place.

http://stackoverflow.com/a/21780221
type: Answer
has body: Class is a parametrizable class, hence you can use the syntax Class where T is a type. By writing Class, you're declaring a Class object which can be of any type (? is a wildcard). The Class type is a type that contains metainformation about a class. It's always good practice to refer to a generic type by specifying his specific type, by using Class you're respecting this practice (you're aware of Class to be parametrizable) but you're not restricting your parameter to have a specific type. Reference about Generics and Wildcards: http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html Reference about Class object and reflection the (feature of Java language used to introspect itself): http://java.sun.com/developer/technicalArticles/ALT/Reflection/
upvote count: 7
score: 7
answers question: http://stackoverflow.com/q/21780103
downvote count: 0

http://stackoverflow.com/comment/32910699
type: Comment
comment on: http://stackoverflow.com/a/21756284
type: AnswerComment
has text: I'd create a page which generates a PDF in it's `onActivate(EventContext)`. You can pass the form values to it via request parameters or via activation context. You can get the URL to the page via `Componentresources.createPageLink(...)`.
score: 0

http://stackoverflow.com/q/21762328
has answer: http://stackoverflow.com/a/58670325
favorite count: 0
linked to: http://stackoverflow.com/q/18303522
has comment: http://stackoverflow.com/comment/32919961
has answer: http://stackoverflow.com/a/21762450
accepted answer: http://stackoverflow.com/a/21762450
tagged with: one-to-one
tagged with: hibernate-annotations
linked to: http://stackoverflow.com/q/23925322
has body: I'm trying to get Hibernate @OneToOne annotations working and not having much success here... Let's say I've got a table called status that looks like this: +------------------------------------------------+ | status | +------------------------------------------------+ | id | frn_user_id | frn_content_id | status | +----+-------------+----------------+------------+ | 1 | 111 | 0 | "active" | +----+-------------+----------------+------------+ | 2 | 0 | 222 | "inactive" | +----+-------------+----------------+------------+ And I've got an entity for User that looks like this: @Entity @Table(name = "user") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", nullable = false) private Integer id; @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "userId") private Status status; // getters and setters } And a similar one for Content, and another entity for Status that looks like this: @Entity @Table(name = "status") public class Status { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", nullable = false) private Integer id; @Column(name = "frn_user_id") private Integer userId; @Column(name = "frn_content_id") private Integer contentId; @Column(name = "status") private String status; // getters and setters } When I perform a read on User, I expect that User.getStatus() will return a Status object with id=1. Instead, I get an AnnotationException: "Referenced property not a (One|Many)ToOne: Status.userId in mappedBy User.status" I've poured through docs, tutorials and examples here on SO, but everything I've tried so far has failed. Also worth noting: This should support a one-to-zero-or-one relationship, as some user and content records will not have a reference in the status table. Any help would be greatly appreciated!
possible better answer: http://stackoverflow.com/a/58670325
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32919725
has comment: http://stackoverflow.com/comment/32919982
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32919763
upvote count: 26
type: Question
answer count: 2
score: 26
has title: Java: Hibernate @OneToOne mapping
has comment: http://stackoverflow.com/comment/32919846
tagged with: jpa
downvote count: 0

http://stackoverflow.com/q/21811009
has answer: http://stackoverflow.com/a/21811439
has comment: http://stackoverflow.com/comment/33006819
downvote count: 1
possible better answer: http://stackoverflow.com/a/21811065
linked to: http://stackoverflow.com/q/2605032
answer count: 4
has answer: http://stackoverflow.com/a/21811201
has answer: http://stackoverflow.com/a/21811065
favorite count: 0
accepted answer: http://stackoverflow.com/a/21811139
has body: Say a string contains the expression 1&lt;3... how can I evaluate that expression in an if statement? import java.io.*; public class EvaluateExpression { public static void main(String[]args)throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(isr); String expression; System.out.print("Enter the expression to evaluate: "); expression = in.readLine(); if (expression){ System.out.print("The expression " + expression + " is true."); }else{ System.out.print("The expression " + expression + " is not true."); } } } A boolean is required but a String is found. Is there a way to evaluate the string so it returns a boolean? if (1&lt;3) {...} works but if (expression) {...} where the String variable expression is 1&lt;3 doesn't work. Casting it to boolean doesn't work either. Thanks!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21811139
score: 1
tagged with: java
has title: Evaluate an expression in a String in an if statement
type: Question
upvote count: 2

http://stackoverflow.com/a/21836756
accepted answer of: http://stackoverflow.com/q/21836538
answers question: http://stackoverflow.com/q/21836538
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33052136
has body: You're getting this because totalCost is null, and then you're trying to use the object that it references. What you should do is add this line to your class's constructor. totalCost = BigDecimal.ZERO;

http://stackoverflow.com/q/21713697
answer count: 1
downvote count: 0
tagged with: inheritance
has answer: http://stackoverflow.com/a/21713809
accepted answer: http://stackoverflow.com/a/21713809
has title: inheritance and calling a method(instance vs non-instance)
favorite count: 0
upvote count: 1
tagged with: swing
tagged with: extend
tagged with: object
type: AnsweredQuestion
has body: I have this sample code below where it inherits from JFrame and thus my add() method is inherited from the container(JPanel). I would like to know the following: What is the benefit of using the method directly instead of creating an object and calling an instance of the method? Do we save memory this way? I know creating an object isn't memory free so i thought maybe this is one of the benefits of extending for this particular piece of code. Why do we call an instance for the following methods: fc.setSize(280,125); // width and height fc.setResizable(false); fc.setLocationRelativeTo(null); fc.setVisible(true); We inherit all of these methods so i naively tried to call them without creating objects and using them as instances but i obtained some errors complaining about non-static methods being referenced as a static context. I added them at the end of the constructor and i did not receive any problems. I would also really like to know in this case what is the benefit if any of calling an instance instead of calling the method directly. Its not like we have multiple frames so i don't see the use of creating objects. code: import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class FC2 extends JFrame { JTextField ftext, ctext; JButton f2c, c2f; public FC2(String title) { super(title); JLabel f = new JLabel("Fahrenheit"); JLabel c = new JLabel("Celsius"); ftext = new JTextField(5); ctext = new JTextField(5); f2c = new JButton("&gt;&gt;&gt;"); c2f = new JButton("&lt;&lt;&lt;"); setLayout(new FlowLayout(FlowLayout.LEFT,10,10)); add(f); add(f2c); add(c); add(ftext); add(c2f); add(ctext); ActionListener bl = new ButtonListener(this); // anonymous class for ActionListener parameter f2c.addActionListener(bl); c2f.addActionListener(bl); } /** * @param args */ public static void main(String[] args) { // TODO Aut…
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/21819206
accepted answer: http://stackoverflow.com/a/21819222
has body: So, I have this piece of code here for (int i = 0; i &lt; m; i++) { for (int j = 0; j &lt; n; j++) { System.out.print(newImage[i][j]); } } Which gives me the following output - 17715613511813411198998282899264799679 What I want to actually do is print the array newImage so that it looks like the following - 177 156 135 118 134 111 98 99 82 82 89 92 64 79 96 79 Note : The dimensions of newImage are not known and can be an array of any size. That's why I am using a for loop to print all values of it. Thanks in advance!
has answer: http://stackoverflow.com/a/21819247
score: 0
answer count: 3
tagged with: for-loop
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/21819214
has answer: http://stackoverflow.com/a/21819222
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21819214
tagged with: java
type: Question
has title: How do I get a formatted display for this program? (Beginner)

http://stackoverflow.com/comment/32806583
has text: ya i did now i removed request.getRealPath("") and now i able to find image in eclipse folder how can i write image inside project only
comment on: http://stackoverflow.com/q/21698569
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32933936
comment on: http://stackoverflow.com/a/21769910
score: 0
type: AnswerComment
type: Comment
has text: oh i see what you mean. But actually the 2d array is supposed to be partially filled as the text file only has 10 elements to input. Since i set the array to have 4 rows and 5 columns i thought it would have more than enough space. (thankyou for replying!)

http://stackoverflow.com/a/21708518
has comment: http://stackoverflow.com/comment/32824963
downvote count: 0
has comment: http://stackoverflow.com/comment/32824873
has comment: http://stackoverflow.com/comment/32824080
has comment: http://stackoverflow.com/comment/32824506
has body: You can try with text = text.replaceAll("(\\d{4})cc", "$1CC"); // ↓ ↑ // +→→→→→→→→→→+ Trick is to place number in group (via parenthesis) and later use match from this group in replacement part (via $x where x is group number). You can surround that regex with word boundaries "\\b" if you want to make sure that matched text is not part of some other word. You can also use look-adound mechanisms to ensure that there are no alphanumeric characters before and/or after matched text.
answers question: http://stackoverflow.com/q/21708412
has comment: http://stackoverflow.com/comment/32824641
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/32824446
has comment: http://stackoverflow.com/comment/32824674
type: Answer

http://stackoverflow.com/a/21715476
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/21715354
has comment: http://stackoverflow.com/comment/32841336
type: Answer
score: 1
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21715354
has body: If you mean some kind of a rule of a thumb that distinguishes english word from random text, there is none. For reasonable accuracy you will need to query an external source, whether it's the Web, dictionary, or a service. If you only need to check for an existence of the word, I would suggest Wordnet. It is pretty simple to use and there is a nice Java API for it called JWNL, that makes querying Wordnet dictionary a breeze.

http://stackoverflow.com/comment/32842472
has text: it doesnt matter how similar or dissimilar the compute lines are. using "method 2" abstracts them into callable "things". if you dont want to do that you will need all those if statements. there really aren't any other options. there are many benefits to abstracting these calculations to their own classes. you can apply other standard features, such as counting how many have run. applying standard failure mechanisms etc. you can load them into queues and process them in different ways.
type: AnswerComment
comment on: http://stackoverflow.com/a/21718489
score: 0
type: Comment

http://stackoverflow.com/a/21731570
has comment: http://stackoverflow.com/comment/32891811
downvote count: 0
has comment: http://stackoverflow.com/comment/32869407
answers question: http://stackoverflow.com/q/21731231
type: Answer
has body: Your class-path probably got broken when you switched projects. Eclipse usually does some background work upon closing and re-opening a project. Depending on your version, some things could have happened like Maven dependencies (if you use Maven) not being re-added in the deployment assembly. When all of the sudden Eclipse begins causing me this kind of trouble, I do the following: Refresh all the projects (click + F5 on all the projects) Clean the server for a full reload Sometimes, Project -> Clean also works Usually any broken reference I have gets fixed by this. Still, check your project's deployment assembly to see if anything that should be there is amiss. Finally, the definitive test is to open your file system's server folder and check what has been deployed there. If a class is missing, you will see that the jar is not in its place. Assuming you work with Tomcat, the physical location of your server will be somewhere like: (Eclipse workspace folder).metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
score: 1
upvote count: 1

http://stackoverflow.com/a/21753735
downvote count: 0
has comment: http://stackoverflow.com/comment/32906316
score: 1
has body: I don't think there's a way to generate java classes, but I can think of two approaches you can follow. Domain Entities The principle at use is to wrap the entities around a node (the same approach can be used with relationships as well), see the Neo4j manual. Use Spring Data Neo4j Only applicable if you want to use the Spring framework. You'll also have to create your own entities, but you'll get ORM-like behavior for free. See the SDN quick start.
answers question: http://stackoverflow.com/q/21750507
upvote count: 1
type: Answer

http://stackoverflow.com/a/21815879
type: Answer
has comment: http://stackoverflow.com/comment/33015600
has comment: http://stackoverflow.com/comment/33015646
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21815820
has comment: http://stackoverflow.com/comment/33017518
has body: for(int row = 0; row &lt; rows; row++){ for( int column = 0; column &lt; columns; column++){ System.out.print(array2d[row][column] + " "); } System.out.println(); } This will print out a line of one row and then move onto the next row and print out its contents, etc... Tested with the code that you provided and works. EDIT - Added the code for the way you wanted it: public static void main(String[] args) { Scanner scan =new Scanner(System.in); //creates scanner object System.out.println("How many rows to fill?"); //prompts user how many numbers they want to store in array int rows = scan.nextInt(); //takes input for response System.out.println("How many columns to fill?"); int columns = scan.nextInt(); int[][] array2d=new int[rows][columns]; //array for the elements for(int row=0;row&lt;rows;row++) for (int column=0; column &lt; columns; column++) { System.out.println("Enter Element #" + row + column + ": "); //Stops at each element for next input array2d[row][column]=scan.nextInt(); //Takes in current input } System.out.println(Arrays.deepToString(array2d)); String[][] split = new String[1][rows]; split[0] = (Arrays.deepToString(array2d)).split(Pattern.quote("], [")); //split at the comma for(int row = 0; row &lt; rows; row++){ System.out.println(split[0][row]); } scan.close(); }
upvote count: 1

http://stackoverflow.com/comment/32867774
comment on: http://stackoverflow.com/q/21732923
type: Comment
score: 0
has text: i've tried cleaning my project.i have added the manifest file. please see if there is any correction.
type: QuestionComment

http://stackoverflow.com/q/21782519
favorite count: 0
accepted answer: http://stackoverflow.com/a/21783261
tagged with: maven
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
has body: I have a maven project which contains a notification mechanism to customer's endpoint web service using the given wsdl location. My question is that; do I first need to create the client using the wsdl in another project and then import the client source to my project ? Or can I add a new maven module to my project and add the dependency of this new module to my main project so that I can easily use the methods of the wsdl. If second question's answer is "yes" then how can I do that ? should I create an initial build to be able to the java classes ?
has answer: http://stackoverflow.com/a/21783261
tagged with: wsdl
has title: Java WSLD Client On The Fly
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/a/21680413
downvote count: 0
answers question: http://stackoverflow.com/q/21680379
upvote count: 2
has body: Try catch (Exception e){ Toast.makeText(v.getContext(), "Faltan datos por introducir", Toast.LENGTH_LONG).show(); return; }
type: Answer
score: 2

http://stackoverflow.com/comment/32877203
type: Comment
comment on: http://stackoverflow.com/a/21731225
type: AnswerComment
has text: Jay Elston, Math.abs isn't about a unique identifier, it's about getting the absolute value of a number passed in.
score: 0

http://stackoverflow.com/comment/32939529
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21772999
type: Comment
has text: @user3309169 Can you please add the update in your question with the updated code?

http://stackoverflow.com/q/21804433
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: screen
type: Question
upvote count: 0
has body: What should I implement to ensure my screen is always on whilst my app is running?
has title: How to lock an android screen on whilst app running?
has answer: http://stackoverflow.com/a/22459224
answer count: 1
score: -1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22459224
tagged with: android

http://stackoverflow.com/a/21829504
answers question: http://stackoverflow.com/q/21829295
has comment: http://stackoverflow.com/comment/33039005
downvote count: 1
has comment: http://stackoverflow.com/comment/104311636
has comment: http://stackoverflow.com/comment/33038898
has comment: http://stackoverflow.com/comment/33040954
score: 15
has comment: http://stackoverflow.com/comment/33084229
has body: You are using File.separator in another line. Why not using it also for your lastIndexOf()? nativeDir = nativeDir.substring(0, nativeDir.lastIndexOf(File.separator));
type: Answer
upvote count: 16

http://stackoverflow.com/comment/33031243
comment on: http://stackoverflow.com/a/21824199
score: 0
type: AnswerComment
type: Comment
has text: Could you provide a sample please

http://stackoverflow.com/comment/33051251
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21835457
has text: @rajah9 What do you mean by the OP only entered 15 digits?
type: AnswerComment

http://stackoverflow.com/comment/32920902
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21762963
has text: I'm not using hashCode() as a key, sorry if my question raised this confusion. I just use hashCode() in a System.out to see if my 2 references are pointing to the same object or not.
type: AnswerComment

http://stackoverflow.com/comment/33034697
has text: hm... but why does it not work as I want? only when I got it with the `0x` it works ... without it doesn't
score: 0
comment on: http://stackoverflow.com/q/21826695
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32996558
type: Comment
has text: Also, the errors we can't *see* make no sense to us. You'll have to copy-paste them if you want a decent answer.
comment on: http://stackoverflow.com/q/21805331
score: 0
type: QuestionComment

http://stackoverflow.com/a/21786679
has comment: http://stackoverflow.com/comment/32963220
has comment: http://stackoverflow.com/comment/32964396
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21785140
score: 1
has body: Your code implies each post is related to 1 "code". I'm not sure what the statement "target_uuid could refer to a Post or User" implies about the relationship between user and "code"? Thus, I'll focus just on "post" and "code". You also have an ambiguous statement regarding "uuid". "uuid is not the primary key f". Ok, but is it a "key"? I'll assume it is. Let's translate: Post has 1 "code". The means the the post table contains a foreign key: FOREIGN KEY (uuid) REFERENCES code(target_uuid) The relationship is stored on the "post" table, not the "code" table. Think of books and authors. Each book has one author. The relationship is stored with the book (not the author.) Now the JPA (in the "Post" entity, not the "Code" entity) @JoinColumn(name = "code_id", referencedColumnName = "target_uuid") @OneToOne(optional = false) private Code codeId; To summarize you need to define the relationship on the "Post" and "User" entities. Not on the "Code" entity. Perhaps I did not understand your requirements. Hope that helps:)

amazon-web-services
tags question: http://stackoverflow.com/q/21751865
tags question: http://stackoverflow.com/q/21684516
tags question: http://stackoverflow.com/q/21814328
tags question: http://stackoverflow.com/q/21825029
type: Tag
tags question: http://stackoverflow.com/q/21730183
tag name: amazon-web-services
tags question: http://stackoverflow.com/q/21810915
tags question: http://stackoverflow.com/q/21814486
tags question: http://stackoverflow.com/q/21760739
tags question: http://stackoverflow.com/q/21725453

http://stackoverflow.com/comment/32791977
type: AnswerComment
score: 0
has text: I beg to differ. The levelp field should most definitely **not** be a static field. @user3234092: you should make this change, change it into an *instance* field.
type: Comment
comment on: http://stackoverflow.com/a/21689926

http://stackoverflow.com/q/21793869
tagged with: capture
has comment: http://stackoverflow.com/comment/32976743
answer count: 0
tagged with: java
tagged with: http
type: Question
tagged with: fiddler
has title: Capturing Java Application Traffic with Fiddler
has comment: http://stackoverflow.com/comment/32976706
has comment: http://stackoverflow.com/comment/32976989
has comment: http://stackoverflow.com/comment/32976722
score: 0
has body: I've seen this question asked many times before, along with solutions, however they don't work for me. I have a Java Jar file application that I want to run (a Runescape private server) and see what happens when you do something in the game (you claim a vote, which I assume makes some sort of a HTTP request to servers) and I want to see the response. I tried this: http://docs.telerik.com/fiddler/configure-fiddler/tasks/configurejavaapp However it didn't work. Any help?
has comment: http://stackoverflow.com/comment/33546937
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33060243
has comment: http://stackoverflow.com/comment/32976729

http://stackoverflow.com/a/21697151
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/32818022
answers question: http://stackoverflow.com/q/21692710
downvote count: 0
type: Answer
has body: It looks like you want to display a JDialog with a Progress bar in it. Swing has an own class to do that, ProgressMonitor. Screenshot: If that is what you need, Javadoc is here, sample/tutorial is here.

http://stackoverflow.com/comment/32799058
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21694216
has text: Can page have both `span[class=bld lrg red]` or `span[class=price]` elements? If not then you can try using `span[class=bld lrg red], span[class=price]`. Otherwise you will find both of them.

http://stackoverflow.com/comment/110562571
type: Comment
has text: `IgnoredRequestCustomizer` is deprecated since spring boot 2.
type: AnswerComment
comment on: http://stackoverflow.com/a/45012207
score: 0

http://stackoverflow.com/comment/32992389
has text: Try changing the name of the checkbox to reports.$i.isSelected or just reports.$i . Then you can easily iterated over params.reports in your controller.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21797471

http://stackoverflow.com/q/21729464
score: 0
has body: I have a situation where i want to check if there exists a popup, if yes then accept it otherwise move forward. Kindly help as I am new to selenium.I am using java. Thanks.
has answer: http://stackoverflow.com/a/21729602
favorite count: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21752601
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21729602
tagged with: java
tagged with: selenium
possible better answer: http://stackoverflow.com/a/21752601
type: Question
answer count: 2
has title: How to check if an alert is present and if yes then accept it

http://stackoverflow.com/a/21721177
downvote count: 0
has comment: http://stackoverflow.com/comment/87778651
answers question: http://stackoverflow.com/q/21721119
type: Answer
has body: Have you tried the 'installApp' task? Does it not create a full directory with a set of start scripts? http://www.gradle.org/docs/current/userguide/application_plugin.html
has comment: http://stackoverflow.com/comment/41367169
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/87778623

http://stackoverflow.com/comment/135924875
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26848692
has text: A small note: .antMatchers(HttpMethod.OPTIONS, "/**") should be the first on the list of matchers, othervice a preceeding matcher with a more detailed path pattern can be triggered.

http://stackoverflow.com/q/21726221
accepted answer: http://stackoverflow.com/a/21931180
tagged with: fuseesb
tagged with: java
has body: My Fuse ESB application suddenly stopped, with no clues in fuseesb.log and the following weird log items in wrapper.log: ERROR | wrapper | 2014/02/12 02:36:59 | JVM appears hung: Timed out waiting for signal from JVM. ERROR | wrapper | 2014/02/12 02:36:59 | JVM did not exit on request, terminated STATUS | wrapper | 2014/02/12 02:37:02 | JVM exited in response to signal SIGKILL (9). ERROR | wrapper | 2014/02/12 02:37:02 | Unable to start a JVM STATUS | wrapper | 2014/02/12 02:37:02 | &lt;-- Wrapper Stopped We are using Nagios to monitor the system. System info: FuseESBEnterprise-7.1.0 / linux-gnu (x86_64). For various reasons we need to sick with Fuse ESB (not possible to migrate to JBoss Fuse...)
tagged with: nagios
type: Question
has comment: http://stackoverflow.com/comment/32893489
has title: Fuse ESB mysteriously hangs - "JVM appears hung: Timed out waiting for signal from JVM."
score: 0
has answer: http://stackoverflow.com/a/21931180
answer count: 1
tagged with: freeze
tagged with: jvm
type: AnsweredQuestion

http://stackoverflow.com/q/21733464
type: Question
has answer: http://stackoverflow.com/a/21744565
downvote count: 0
answer count: 1
tagged with: google-glass
accepted answer: http://stackoverflow.com/a/21744565
has body: I'm a bit stuck here, I just started with the basics of Glass development, is it possible to add a CardScrollView/Card to an Livecard? It looks like it's only possible to add RemoteViews to a LiveCard but I would like to show a CardScrollView instead of coding everything in xml. CardScrollView csvCardsView; //has adapter, items,... RemoteViews aRV = new RemoteViews(this.getPackageName(), R.layout.card_text); if (mLiveCard == null) { mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_ID); mLiveCard.setViews(aRV); //... Action code mLiveCard.publish(LiveCard.PublishMode.REVEAL); } Now I can't find out how to add my csvCardsView to my mLiveCard since LiveCard.setViews() only accepts RemoteViews and RemoteViews.addViews() also only accepts RemoteViews.
favorite count: 0
upvote count: 2
score: 2
has title: Cardscrollview/Cards in Livecard
type: AnsweredQuestion
tagged with: java
tagged with: google-gdk

http://stackoverflow.com/a/21770459
has comment: http://stackoverflow.com/comment/32934730
score: 1
upvote count: 1
has body: private static double byteArrayToDouble(byte[] bytes) { double d = 0.0; ByteBuffer.wrap(bytes).putDouble(d); return d; } That's a strange way to convert a byte array to a double. It doesn't do anything to the double. It can't. No reference parameters in Java. It should be get. Essentially the whole method can be replaced with: ByteBuffer.wrap(request.getData(), 0, request.getLength()).getDouble(). E&amp;OE
accepted answer of: http://stackoverflow.com/q/21770106
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21770106
has comment: http://stackoverflow.com/comment/32934833
has comment: http://stackoverflow.com/comment/32934701
type: Answer

http://stackoverflow.com/a/21781116
score: 2
downvote count: 0
upvote count: 2
has body: there is a solution for testing spring mvc controllers and is much more convenient than manually mocking everything. MockMvc class is designed for this. Please take a look at: http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-mvc-controllers-normal-controllers/
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21780157
answers question: http://stackoverflow.com/q/21780157
type: Answer

http://stackoverflow.com/q/21807400
tagged with: java
has title: JOptionPane Drop Down Menu Java
type: Question
tagged with: arrays
tagged with: arraylist
score: 0
has body: I'm trying to make a drop down menu using JOptionPane. The options I want it to have are the elements of an array list. So what i have done is create an array with elements of the array list. I want the user to be able to see the elements as options.The code I have so far is provided. I have provided my classes for Person, Address, Student and Driver. Any help would be greatly appreciated. package lab; import java.util.Scanner; public class Person { Scanner in = new Scanner(System.in); public String name; public String phone; public String email; public Address address; public Person(String name, String phone, String email, Address address){ this.name = name; this.phone = phone; this.email = email; this.address = address; } public Person(){} public String getName(){ return name; } public String getPhone(){ return phone; } public String getEmail(){ return email; } public Address getAddress(){ return address; } public String toString(){ return name + "\n" + address + "\n" + phone + "\n" + email; } } Here is the Student class package lab; import java.util.ArrayList; public class Student extends Person{ private String studentID; private String status; private ArrayList&lt;Course&gt; courses = new ArrayList&lt;Course&gt;(); private Person person; private Student student; public Student(String id, String status, ArrayList&lt;Course&gt; courses, String name, String phone, String email, Address address){ this.studentID = id; this.status = status; this.courses = courses; this.name = name; this.phone = phone; this.email = email; this.address = address; } public String getStudentID(){ return studentID; } public String getStatus(){ return status; } public ArrayList getCourses(){ return courses; } public String toString(){ return "Current Student: " + name + "\n" + studentID + "\n" + status + "\n" + address + "\n" + phone + "\n" + email; } } Here is the Address class: package lab; public class Address { private String number; private String street; private String city; private S…
accepted answer: http://stackoverflow.com/a/21807759
answer count: 1
has answer: http://stackoverflow.com/a/21807759
tagged with: joptionpane
type: AnsweredQuestion

http://stackoverflow.com/comment/32863598
type: Comment
has text: I assumed that by "`this` will always be an A, even inside methods of B." you meant that `this`, inside a method defined in `B`, would have type `A`, and that's not correct. (It can be tricky to word these things, though, so it's an easy area to know the correct answer, but to write something misleading. :))
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21729345

http://stackoverflow.com/a/21842429
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33069706
has body: I tested your code and had the same problem as you on OSX. Your issue seems to be related to blank spaces, I was able to get around the issue by using a ProcessBuilder since it works much better with spaces. //Create and start process builder ProcessBuilder builder = new ProcessBuilder("java", "-jar", path_to_jar_file, param1, param2, param3); Process process = builder.start(); //Create reader to get error messages (Just in case you have another issue) BufferedReader errinput = new BufferedReader(new InputStreamReader( process.getErrorStream())); //Print errors to the terminal/console String s = null; while ((s = errinput.readLine()) != null) { System.out.println(s); } The above code works on Windows and OSX, Linux should behave the same way as OSX. Remember to take out the error reporting code when you are done, because it will lock the main thread.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21812990
answers question: http://stackoverflow.com/q/21812990

http://stackoverflow.com/a/21794065
type: Answer
has comment: http://stackoverflow.com/comment/33184812
answers question: http://stackoverflow.com/q/21782785
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33052570
upvote count: 2
has comment: http://stackoverflow.com/comment/33037330
has body: The answer by dcsohl and the answer by Mike Samuel are correct. The other comments about the time database of Java being updated are incorrect. Yes, the database is updated, but not for leap seconds. Leap seconds are entirely ignored by Java, by Joda-Time, and by other Unix-oriented timekeeping systems. Your question assumes a problem where none exists. Clocks Drift The physical clock on nearly all computers are not very precise. Drifting a second or more per month is common. That's why virtually all Operating Systems default to connecting to time servers either locally or over the internet. So, in practical terms, your computer is regularly tweaking its own current time. Because of this you may already find anomalies in the time sequences recorded in your logs if you looked carefully. Inserting a leap second has the same effect as your clock’s imprecision. Your computer is off by a second, and will soon be corrected by a check-in with a time server. Ignoring Leap Second In terms of your data, both the bundled java.util.Date class and the popular replacement, Joda-Time, ignore the leap second. So think of a leap second as just stretching out that 59th second on the last hour of the day of a leap-second event. In terms of our calendar and call clocks, nothing happened. For all business-related apps and most practical purposes of most software, ignoring leap seconds has no detrimental effects. Yes, technically speaking, the milliseconds-since-epoch used by java.util.Date and Joda-Time are incorrect. Right now is reported 1392442622998 since the beginning of the year 1970, while actually with 25 leap-seconds having been inserted since 1972, that number "should" be 1,392,442,647,998 (25,000 more). Yes, calculating the elapsed time between two timepoints over years will be short by a few seconds. But for most purposes, who cares? We have adjusted our calendars to act as if there was no extra second. If you have a precision-oriented mind as I do, it takes a while to wrap …

http://stackoverflow.com/q/21834951
has answer: http://stackoverflow.com/a/21835004
favorite count: 0
tagged with: netbeans
tagged with: swing
accepted answer: http://stackoverflow.com/a/21835004
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: dialog
tagged with: java
score: -1
has title: string already written in input dialog box in java swing
upvote count: 0
answer count: 1
has body: i want a string already written in the input dialog box text field when this dialog box appear. String filename = jLabel6.getText(); String fname=JOptionPane.showInputDialog("Enter File Name"); String dir=fc.getCurrentDirectory().toString(); dir = dir+"\\"+fname+"_crypt.txt"; here i want the string in variable filename appear in text box of dialog box , so one can accept this file name or edit if want. i am writing code in netbeans. is there any option to do this? or i should leave this thought??

union
type: Tag
tags question: http://stackoverflow.com/q/21691018
tag name: union
tags question: http://stackoverflow.com/q/21765780

http://stackoverflow.com/q/21717917
answer count: 2
has comment: http://stackoverflow.com/comment/32841667
has comment: http://stackoverflow.com/comment/32841653
has comment: http://stackoverflow.com/comment/32841577
score: 0
has comment: http://stackoverflow.com/comment/32841533
has comment: http://stackoverflow.com/comment/32841847
has comment: http://stackoverflow.com/comment/32841832
has title: Java blackjack swing gui ImageIcon
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21718497
tagged with: swing
has answer: http://stackoverflow.com/a/21718776
has body: I've just started Java a week ago and have finished my first blackjack program. I want to enhance it by using Java swing (ImageIcon) so that each time I draw a card, let's say an ace it actually displays the ace as an image on the screen or my current hand. I have written this program which displays the cards I want: import java.awt.FlowLayout; import javax.swing.*; public class TenCards extends JFrame { public TenCards() { ImageIcon[] images = new ImageIcon[10]; // Saved the card images as 1,2,3...10.gif in my package // looped them into the images list for (int i = 1; i &lt; images.length; i++) { images[i] = new ImageIcon((getClass().getResource(i + ".gif"))); // testing by displaying 7,8 and 9 cards } setLayout(new FlowLayout(1, 1, 1)); add(new JLabel(images[7])); add(new JLabel(images[8])); add(new JLabel(images[9])); } public static void main(String[] args) { // TODO Auto-generated method stub JFrame frame = new TenCards(); frame.setTitle("Testing!"); frame.pack(); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } Now my question is, given I have my blackjack class or program in another file, how do I combine both classes so that I can use all this image stuff in my blackjack program? I tried copy pasting my TenCards program into the Blackjack one to no avail :( If anyone could lend me a hand or point me towards the next step I would really appreciate it. EDIT I have now included my blackjack program and deleted the other because stackoverflow wouldn't accept both combined because there was too much code. import java.util.ArrayList; import java.util.Scanner; import javax.swing.JLabel; public class myblackjack { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); ArrayList&lt;Integer&gt; player = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; dealer = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; cards = new ArrayLi…
tagged with: java
has comment: http://stackoverflow.com/comment/32841573
type: Question

http://stackoverflow.com/a/21814084
has comment: http://stackoverflow.com/comment/33012363
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21813933
has comment: http://stackoverflow.com/comment/33012508
has body: Java only supports pass-by-value. So when you pass an object "v" to the method foo2 a copy of the reference "v" is created. So when you set v = val1 in foo2 the copy of the reference is being changed in foo2 not the original reference "v" in foo1.

http://stackoverflow.com/q/21761538
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/21199427
has answer: http://stackoverflow.com/a/21761624
type: Question
tagged with: decompiling
possible better answer: http://stackoverflow.com/a/21761576
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21761576
accepted answer: http://stackoverflow.com/a/21761624
has body: Is it possible to prevent or otherwise hinder the decompilation of your own applications? Programmatically or otherwise?
tagged with: android
tagged with: apk
has title: Hindering decompilation of android applications?

http://stackoverflow.com/comment/32830937
type: QuestionComment
has text: You mean you're reading all this from the console? Sounds like you need a GUI to me. Classic case for a modal dialog. The question has nothing whatsoever to do with RMI.
comment on: http://stackoverflow.com/q/21706215
score: 0
type: Comment

http://stackoverflow.com/comment/120371093
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21713629
has text: the `inputWebDriver.switchTo().frame("input-data_ifr");` really helped me to find the mce body, without it I couldn't interact with the element

http://stackoverflow.com/q/21780204
has comment: http://stackoverflow.com/comment/32975070
has title: Can't able establish connection in activemq server?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32961944
tagged with: activemq-classic
has body: I'm newbie to activemq server.I have downloaded activemq 5.8 version.I have used following code for creating and sending messages to activemq server. private static String url = ActiveMQConnection.DEFAULT_BROKER_URL; private static Connection connection = null; public static boolean testessages(String message){ Session session = null; try { ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = session.createQueue("orderjson"); producer = session.createProducer(destination); TextMessage message = session.createTextMessage(); message.setText(msg); producer.send(message); return true; } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { if(session != null){ producer.close(); session.close(); connection.close(); } } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return false; } If i run the above code cant create the connection.After debugging the code issue is, the code wasnot executed when its comes to connnection.start(). The Error message there's no thread suspension support How to resovle this error? please someone help me?
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/32805011
type: QuestionComment
has text: I suggest you can download the SDK bundle from android website to install eclipse again.
comment on: http://stackoverflow.com/q/21697001
score: 0
type: Comment

http://stackoverflow.com/comment/32867849
type: QuestionComment
score: 0
has text: a/ you do not need to clean variables your self, unless your scopes are messed up. b/ dead code is dead, it is never executed, that's why it is dead.
comment on: http://stackoverflow.com/q/21733040
type: Comment

http://stackoverflow.com/comment/92032973
type: Comment
has text: I'm pretty sure this would *not* work because JS changes to the style do not change the value of @style. OP needs just a plain old wait loop on `element.getCssValue("display")`.
type: AnswerComment
comment on: http://stackoverflow.com/a/21715324
score: 0

http://stackoverflow.com/q/21744930
type: Question
tagged with: mandrill
has body: For my android app, I want to send a verification email to the user when they sign up. I'm want to do this through Mandrill with Parse backend. I copy and pasted the Mandrill Cloud Module from the Parse docs: var mandrill = require("mandrill"); mandrill.initialize("mandrillAPIKey"); Parse.Cloud.define("myMandrillFunction", function(request, response) { mandrill.sendEmail({ message: { text: "Hello World!", subject: "Using Cloud Code and Mandrill is great!", from_email: "parse@cloudcode.com", from_name: "Cloud Code", to: [ { email: "you@parse.com", name: "Your Name" } ] }, async: true }, { success: function(httpResponse) { response.success("Email sent!"); }, error: function(httpResponse) { response.error("Uh oh, something went wrong"); } }); } I replaced the mandrillAPIKEY and email fields with my own. But eclipse says that the "mandrill" string in require("mandrill"); is an invalid character constant. I think this might have to do with not importing Mandrill properly. How do I fix this?
has comment: http://stackoverflow.com/comment/33142513
accepted answer: http://stackoverflow.com/a/21745714
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32889399
tagged with: parsing
tagged with: android
type: AnsweredQuestion
has title: Can't initialize Mandrill for Parse on Android
has answer: http://stackoverflow.com/a/21745714
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/21758258
tagged with: htmlunit
answer count: 1
accepted answer: http://stackoverflow.com/a/21758298
favorite count: 0
has body: Copied from here: I need to save files from websites using HtmlUnit. I am currently navigating to pages that have several anchors that use javascript: onClick()="DownloadAttachment('attachmentId')" So far though I've been unable to find resources or examples that show how to save files using HtmlUnit. I've been trying mainly to get AttachmentHandler to work for this as it seems the most likely to work, but have been unsuccessful. How do I use AttachmentHandler to get at the data stream which the browser would see if I clicked on the link?
has title: HtmlUnit and JavaScript in links
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6497098
upvote count: 2
score: 1
tagged with: http
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21758298
tagged with: java
tagged with: javascript

http://stackoverflow.com/q/21817427
has body: I'm just trying to get the basics down when it comes to simple drawing programs. I have a program that draws a rectangle and then lets me move it in any direction. I use a thread for smooth actions. However, what kind of bothers me is that if I press down three keys and release two of them, the program won't detect the third, thus leaving the rectangle stationary. Am I asking for too much here, or might it be hardware related? I have a pretty cheap keyboard. Here's the full program if you want to go for a ride. import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class Boxxy extends JFrame implements Runnable{ int xPos, yPos, xDir, yDir; MyPanel panel; ImageIcon ii; Image i; public Boxxy() { setSize(400,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); panel = new MyPanel(); add(panel); setVisible(true); } class MyPanel extends JPanel { private static final long serialVersionUID = 1L; private int squareX = 0; private int squareY = 0; private int squareW = 20; private int squareH = 20; private MyPanel() { setFocusable(true); addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case (KeyEvent.VK_UP): setyDir(-1); break; case (KeyEvent.VK_DOWN): setyDir(1); break; case (KeyEvent.VK_LEFT): setxDir(-1); break; case (KeyEvent.VK_RIGHT): setxDir(1); break; } } public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case (KeyEvent.VK_UP): setyDir(0); break; case (KeyEvent.VK_DOWN): setyDir(0); break; case (KeyEvent.VK_LEFT): setxDir(0); break; case (KeyEvent.VK_RIGHT): setxDir(0); break; } } }); } private void repaintSquare(int x, int y) { int OFFSET = 1; if ((squareX!=x) || (squareY!=y)) { repaint(squareX,squareY,squareW+OFFSET,squareH+OFFSET); squareX=x; squareY=y; repaint(squareX,…
answer count: 1
has title: Simple program with KeyAdapter can't register single keys after pressing down several. Code solution?
downvote count: 0
linked to: http://stackoverflow.com/q/8961938
has answer: http://stackoverflow.com/a/21817447
favorite count: 0
type: AnsweredQuestion
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21817447
score: 1
tagged with: java
tagged with: keylistener

http://stackoverflow.com/q/21770284
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21770475
has title: Initialize variable and change it later in if condition
tagged with: java
possible better answer: http://stackoverflow.com/a/21770473
has answer: http://stackoverflow.com/a/21770473
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21770475
tagged with: variables
tagged with: initialization
has body: I'm trying to get let1 initialized while still having it be manipulated by the if condition I set up for av1. import java.util.Scanner; public class School { public static void main(String args[]) { Scanner get=new Scanner(System.in); //Variables String Stud1, Stud2, Stud3, Stud4; int num1S1, num2S1, num3S1, num4S1; int num1S2, num2S2, num3S2, num4S2; int num1S3, num2S3, num3S3, num4S3; int num1S4, num2S4, num3S4, num4S4; double av1, av2, av3, av4; char let1,let2,let3,let4; //Input Student One System.out.println("Please enter name of first student:"); Stud1=get.next(); System.out.print("Integer grades from 1st to fourth grade:\n"); num1S1=get.nextInt(); num2S1=get.nextInt(); num3S1=get.nextInt(); num4S1=get.nextInt(); //Computing Average av1= (num1S1+num2S1+num3S1+num4S1)/4.0; av2= (num1S2+num2S2+num3S2+num4S2)/4.0; av3= (num1S3+num2S3+num3S3+num4S3)/4.0; av4= (num1S4+num2S4+num3S4+num4S4)/4.0; //If Statements for letter grade if(av1&lt;=50) let1='F'; if(av1&gt;=60 &amp;&amp; av1&lt;=69) let1='D'; if(av1&gt;=70 &amp;&amp; av1&lt;=79) let1='C'; if(av1&gt;=80 &amp;&amp; av1&lt;=89) let1='B'; if(av1&gt;=90) let1='A'; //Output System.out.printf("Studnet Name Grades Average Letter Grade\n"); System.out.printf("%s %1d %1d %1d %1d %1.2f %c \n",Stud1,num1S1,num2S1,num3S1,num4S1,av1,let1); } }

http://stackoverflow.com/comment/32771520
has text: I would double check that you're "disposing" of the graphics correctly.
comment on: http://stackoverflow.com/q/21679057
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21722433
has comment: http://stackoverflow.com/comment/32849054
has comment: http://stackoverflow.com/comment/33027030
answers question: http://stackoverflow.com/q/21722340
has comment: http://stackoverflow.com/comment/32849930
has comment: http://stackoverflow.com/comment/32895789
has comment: http://stackoverflow.com/comment/32849564
score: 0
has comment: http://stackoverflow.com/comment/32849438
has comment: http://stackoverflow.com/comment/32849394
has comment: http://stackoverflow.com/comment/32851746
has comment: http://stackoverflow.com/comment/32850581
has comment: http://stackoverflow.com/comment/32890733
type: Answer
has comment: http://stackoverflow.com/comment/33028752
has body: You have two major problems here: Problem #1 - An unhandled NoSuchElementException. The only statement in your code that can lead to that, is Driver1.findElement(...). You are executing this statement inside the try clause, but also outside the try clause. So obviously, the loop (and probably the entire method) is terminated due to that exception. Therefore, you need to move the second Driver1.findElement(...) into the try clause. In fact, in the try clause, you might as well search for the h1 element only once: try { WebElement h1 = Driver1.findElement(By.cssSelector("h1")); if (h1.isDisplayed()) System.out.println("page heading: " + h1.getText()); } catch(NoSuchElementException ne) { System.out.println("error page: " + page); } Problem #2 - An unhandled StaleElementException. This exception usually occurs when you fetch some WebElement object, and at a later point in execution - after navigating to a different page using get(...), or after switching to a different frame using switchTo().frame(...) - you attempt to use it. This is what probably happens when you attempt to use dropdown after calling Driver1.get(page). Here is an optional workaround for this problem: for (int i=0; true; i++) { List&lt;WebElement&gt; dropdown = Driver.findElementsByXPath(...); int dropdown_count = dropdown.size(); if (dropdown_count &gt;= i) break; String page = dropdown.get(i).getAttribute("href"); Driver1.get(page); ... Driver1.navigate().back(); } And here is an alternative solution to both problems, that would make your program a lot more efficient. First, iterate all the links and build a list of URLs. Then, navigate to each URL and do whatever you wanna do on each page: List&lt;WebElement&gt; links = Driver.findElementsByXPath(...); List&lt;String&gt; pages = new ArrayList&lt;String&gt;(); for (WebElement dropdown : links) { String page = dropdown.getAttribute("href"); pages.add(page); } for (String page : pages) { Driver1.get(page); try { WebElement h1 = Driver1.findElement(By.…

http://stackoverflow.com/comment/32889366
type: AnswerComment
type: Comment
has text: actually `Runtime.exec` should do the job just as well, can you post the error you're getting?
comment on: http://stackoverflow.com/a/21744987
score: 0

http://stackoverflow.com/a/21808998
has comment: http://stackoverflow.com/comment/33032903
has comment: http://stackoverflow.com/comment/33031429
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33028849
type: Answer
has comment: http://stackoverflow.com/comment/33168071
has comment: http://stackoverflow.com/comment/33029294
score: 1
upvote count: 1
has body: After some investigation on this, I found a way that you are able to support your use case without modifying or copying code a lot. You need to exchange the BundleLocalization to load the ResourceBundle your way. In your case by using your custom ResourceBundle.Control. By doing this you override that the platform is looking for the ResourceBundle specified by the MANIFEST. At the moment you will also have to implement a custom TranslationService that uses your BundleLocalization. The existing BundleTranslationProvider does not take the BundleLocalization out of the context. And you will need to copy a lot of code there, because getBundle() is private. I will discuss possible modifications with the developers. You can find an example here: https://github.com/fipro78/e4classbasedtranslation Hope that helps you to solve your specific requirement.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21776496
answers question: http://stackoverflow.com/q/21776496

http://stackoverflow.com/comment/32957073
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21783191
has text: @AaronDigulla What about if I wanted to compare `Register.LOADED` to `Login.LOADED`, will I get different values?

jboss-4.2.x
tags question: http://stackoverflow.com/q/21756059
tag name: jboss-4.2.x
type: Tag

http://stackoverflow.com/a/21773697
accepted answer of: http://stackoverflow.com/q/21769224
type: Answer
answers question: http://stackoverflow.com/q/21769224
score: 2
downvote count: 0
has body: As @randyumi has stated in the comments that my solution worked for him, I am adding this as a legitimate answer. The reason for the delay in fallback is due to the fact that mysql tries to connect to the primary database instance and waits for it to respond for a certain amount of time i.e. connection timeout. Once that connection timeout expires then mysql switches to the fallback. So reducing the default connection timeout can reduce the latency.
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/21799306
has body: While this is not the norm for 'good' stackOverflow questions, I don't have any problem with it myself. Some people cannot deal with anything except code. I would suggest that, if you're going to post code, that you take the trouble to post code that will compile, run, and demonstrate your situation. It really helps those of us out here understand what you're seeing and what you're trying to do. You talk about "rows"; be aware that rows and columns are terms used with things like GridLayout and GridBagLayout, but I don't think they're appropriate for what you describe. In your description, you don't say what you want scrolled. It would appear you want the entirety of the UI scrolled, I'll assume that for now. I would try a JPanel with BoxLayout, oriented vertically, for the overall main UI. You will put some things into that: The first JPanel. Another JPanel, set with FlowLayout, holding the first bunch of buttons. Another JPanel with the next JLabel And a fourth JPanel, set with FlowLayout, holding the second bunch of buttons. Now, I would put the top-level panel into a JScrollPane, and then put that into the CENTER section of a Frame (with its default BorderLayout), and see what happens. To tell the truth, I'm not sure, but these are the things I would start with. I cannot tell, without running code, why you get odd behavior sometimes.
answers question: http://stackoverflow.com/q/21798497
score: 0
has comment: http://stackoverflow.com/comment/32989207
type: Answer
has comment: http://stackoverflow.com/comment/33022581

http://stackoverflow.com/a/21713028
has comment: http://stackoverflow.com/comment/32880679
type: Answer
answers question: http://stackoverflow.com/q/21706133
score: 1
upvote count: 1
has body: Looks like you're still building against a Hadoop2 version (the MR2 variant of cdh4.3 is my guess) which is not compatible with Accumulo 1.4.3. If you want to use cdh with Accumulo 1.4.3, you'll have to make sure you use their MR1 support otherwise you'll run into incompatibilities.
downvote count: 0

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/21836124
tags question: http://stackoverflow.com/q/21684373
tags question: http://stackoverflow.com/q/21834951
type: Tag
tags question: http://stackoverflow.com/q/21746067

http://stackoverflow.com/comment/51697137
comment on: http://stackoverflow.com/q/21730203
score: 0
has text: can you help on this http://stackoverflow.com/questions/31837788/how-can-i-calculate-total-number-of-term-frequency-in-all-collection-s-document
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32813019
type: QuestionComment
comment on: http://stackoverflow.com/q/21701736
has text: So what does the file look like? Have you examined it?
score: 0
type: Comment

http://stackoverflow.com/comment/33032950
type: QuestionComment
comment on: http://stackoverflow.com/q/21821644
has text: Whats the question is the good question here :D :P
score: 0
type: Comment

actionlistener
tags question: http://stackoverflow.com/q/21807086
tags question: http://stackoverflow.com/q/21736007
tags question: http://stackoverflow.com/q/21804977
tags question: http://stackoverflow.com/q/21754768
tags question: http://stackoverflow.com/q/21783798
tags question: http://stackoverflow.com/q/21742172
tags question: http://stackoverflow.com/q/21765429
tags question: http://stackoverflow.com/q/21837249
tags question: http://stackoverflow.com/q/21820118
tags question: http://stackoverflow.com/q/21791057
tags question: http://stackoverflow.com/q/21768965
tags question: http://stackoverflow.com/q/21712998
type: Tag
tag name: actionlistener
tags question: http://stackoverflow.com/q/21688475
tags question: http://stackoverflow.com/q/21766811
tags question: http://stackoverflow.com/q/21739570
tags question: http://stackoverflow.com/q/21837899

http://stackoverflow.com/comment/32843502
score: 0
type: Comment
type: QuestionComment
has text: What is your default `Locale`?
comment on: http://stackoverflow.com/q/21719208

http://stackoverflow.com/comment/32918680
comment on: http://stackoverflow.com/a/21761576
type: Comment
has text: @Kayaman: Sure. The key word there is "hinders", though. The OP should be aware that he's not going to be able to _prevent_ anyone from reverse-engineering his app; all he can do is make it slightly more difficult.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32890940
type: AnswerComment
comment on: http://stackoverflow.com/a/21745907
type: Comment
has text: if this case is so called biased randomness, how about having that biased randomness to maintain at 48-52% ratio rate
score: 0

http://stackoverflow.com/comment/32930550
comment on: http://stackoverflow.com/q/21767963
score: 0
type: Comment
type: QuestionComment
has text: Not exactly sure but using destructor might help in some case? As I know it will delay collecting objects because it expects destructor to do the job.

http://stackoverflow.com/q/21800147
tagged with: repaint
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: swing
has answer: http://stackoverflow.com/a/21800178
accepted answer: http://stackoverflow.com/a/21800178
type: Question
tagged with: java
has body: I have built a tetris game. Now in that I have used a JPanel for displaying content and the blocks (using the paintComponents() method). The problem is whenever I try to call the tetris program from another JFrame it does not paint at all. The code for my tetris main menu is: import javax.swing.*; import sun.audio.AudioPlayer; import sun.audio.AudioStream; import java.awt.*; import java.awt.event.*; import java.io.FileInputStream; import java.io.InputStream; @SuppressWarnings("serial") public class Tetris_MainMenu extends JFrame implements ActionListener { @SuppressWarnings("unused") public static void main(String[] args) { Tetris_MainMenu tmm = new Tetris_MainMenu(); playAudio("doak.wav"); } JPanel logo = new JPanel(); JPanel buttonPanel = new JPanel(new GridLayout(4, 1)); JButton start = new JButton("START NEW GAME"); JButton help = new JButton("INSTRUCTIONS"); JButton about = new JButton("ABOUT THIS GAME"); JButton exit = new JButton("EXIT"); Tetris_MainMenu(){ setTitle("JAG's TETRIS"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocation(300, 100); setSize(200, 400); setEnabled(true); setFocusable(true); setVisible(true); //adding a logo to the logo panel //adding buttons to the buttonPanel buttonPanel.add(start); buttonPanel.add(help); buttonPanel.add(about); buttonPanel.add(exit); //add panels to window setLayout(new GridLayout(2, 1)); add(logo); add(buttonPanel); //make buttons listen to actions start.addActionListener(this); help.addActionListener(this); about.addActionListener(this); exit.addActionListener(this); } @SuppressWarnings("restriction") public static void playAudio(String filename) { InputStream in = null; AudioStream as = null; try{ in = new FileInputStream(filename); as = new AudioStream(in); } catch(Exception e){ System.out.println("Error!!!"); } AudioPlayer.player.start(as); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == start){ this.dispose(); MatrixBoard b = new MatrixBoard(); b.setRequestFocusEnabled(tr…
upvote count: 1
answer count: 1
tagged with: user-interface
tagged with: awt
has title: Repaint is not functioning properly as required
favorite count: 0

http://stackoverflow.com/a/21791375
type: Answer
answers question: http://stackoverflow.com/q/21790651
accepted answer of: http://stackoverflow.com/q/21790651
has comment: http://stackoverflow.com/comment/34072122
type: AcceptedAnswer
downvote count: 0
score: 8
has body: Thank you NickT. I just updated Google Play Services and the Plus class came with the library.
upvote count: 8

http://stackoverflow.com/a/21732587
type: Answer
upvote count: 1
has body: Answer 1: It is doing a string comparison between whatever is returned from the getHandleDate method. I have no idea why it is doing: return (cc &lt; 0 ? -1 : cc &gt; 0 ? 1 : 0); since cc should by all rights be -1, 0 or 1. The code could just as easily do: return ((String)o11.getHandledDate()).compareTo(o22.getHandledDate()); Answer 2: You could use generics to simplify as follows: static void sortByDate(List&lt;RQEntry&gt; list) throws Exception { Collections.sort(list, new Comparator&lt;RQEntry&gt; { public int compare(RQEntry o1, RQEntry o2) { return ((String)o1.getHandledDate()).compareTo(o2.getHandledDate()); } }); }
score: 1
answers question: http://stackoverflow.com/q/21732357
has comment: http://stackoverflow.com/comment/32867154
downvote count: 0

http://stackoverflow.com/q/21738318
has answer: http://stackoverflow.com/a/21738883
has comment: http://stackoverflow.com/comment/32877302
has comment: http://stackoverflow.com/comment/32877380
has comment: http://stackoverflow.com/comment/32877350
tagged with: regex
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21738431
type: Question
tagged with: split
has body: I have a string being passed into a function. The string looks like this: "[teststring]" There are cases where there may be multiple string in there separated by a delimiter. "[teststring, nogood; dontUse]" How can I use the java split method to extract the first string, excluding the brackets and the delimiters can be either a comma and/or semi-colon? This does not work: string args = "[teststring, nogood; dontUse]"; string temp = args.split("[,;]")[0]; The final result should be just: teststring.
has comment: http://stackoverflow.com/comment/32877501
has title: Java split method using Regex
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21738431
possible better answer: http://stackoverflow.com/a/21738464
has answer: http://stackoverflow.com/a/21738464
tagged with: string

http://stackoverflow.com/a/21736389
score: 0
answers question: http://stackoverflow.com/q/21728896
type: Answer
has body: Try this: (for was mq 7.0) add Server connection channel: (in Linux) DEFINE CHANNEL(CHNAME) CHLTYPE(SVRCONN) MCAUSER('mqm') ; (in windows) DEFINE CHANNEL(CHNAME) CHLTYPE(SVRCONN) MCAUSER('MUSR_MQADMIN') ;

http://stackoverflow.com/comment/32894715
type: Comment
type: QuestionComment
score: 0
has text: Where is the code that contacts the remote server?
comment on: http://stackoverflow.com/q/21748154

http://stackoverflow.com/q/21751240
tagged with: email
has body: Following is the code of Main.java file. package com.app.mail1; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; public class Main extends Activity { EditText to, from, message, subject; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); send.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { GMailSender sender = new GMailSender("rockstarjamunjuice@gmail.com", "jamunjuice"); sender.sendMail("This is Subject", "This is Body", "user@gmail.com", "user@yahoo.com"); } catch (Exception e) { Log.e("SendMail", e.getMessage(), e); } } }); } } Here is the code for GMailSender.java file package com.app.mail1; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.mail.Message; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.Security; import java.util.Properties; public class GMailSender extends javax.mail.Authenticator { private String mailhost = "smtp.gmail.com"; private String user; private String password; private Session session; static { Security.addProvider(new com.provider.JSSEProvider()); } public GMailSender(String user, String password) { this.user = user; this.password = password; Properties props = new Properties(); props.setProperty("mail.transport.protocol", "smtp"); props.setProperty("mail.host", mailhost); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFacto…
tagged with: gmail
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5702949
has title: How can I create run time entry for email and password in following code?
tagged with: java
has answer: http://stackoverflow.com/a/21752324
has comment: http://stackoverflow.com/comment/32899979
type: Question
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/2091465
tagged with: android

http://stackoverflow.com/a/21818419
accepted answer of: http://stackoverflow.com/q/21817236
has comment: http://stackoverflow.com/comment/33026552
score: 1
answers question: http://stackoverflow.com/q/21817236
has comment: http://stackoverflow.com/comment/33021241
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33026772
has body: I think a converting the query into a regular expression would suffice for all the given conditions. According to the question, By points 1 &amp; 2, the query should match the text only if the query-string is in the beginning of the text or succeeds a space. So basically the regular expression for this would be something like - (^|\s)(query-string) Point 3 needs the query to be case-insensitive, which can be handled when the query-regex is compiled. For points 4 &amp; 5- the query should match the text even if the query does not have a space, but if a space exists in the query, it should be properly matched in the text. So, we need to transform our regex in such a way, that after every character(or space), the regex can handle spaces which may or may not be present.In that way, we assume that the character(or space) must be matched while the space after it is conditional. This should work - public static boolean find_match(String query, String text){ String regex = "(?:^|\\s)(" + query.replaceAll(".(?!$)", "$0(?:\\\\s*)") + ")"; //System.out.println("Regex -&gt; " + regex); Pattern re = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); return re.matcher(text).find(); } Testing this function - public static void main(String []args){ String query1 = "cat"; String[] text1 = { "Cat", "caT toy", "This is a CaT", "caTty", "loCation" }; for(String s : text1){ System.out.println("Query -&gt; " + query1 + "\nText -&gt; " + s + "\n" + find_match(query1, s) + "\n"); } String query2 = "luke j"; String query3 = "lukej"; String[] text2 = { "Luke Johnson", "lukejohnson", "Luke Johson", "This is Luke Johnson", "L ukeJohnson", "L uke Johnson" }; for(String s : text2){ System.out.println("Query -&gt; " + query2 + "\nText -&gt; " + s + "\n" + find_match(query2, s)); System.out.println("Query -&gt; " + query3 + "\nText -&gt; " + s + "\n" + find_match(query3, s) + "\n"); } } The Output -> Query -&gt; cat Text -&gt; Cat true Query -&gt; cat Text -&gt; caT toy true Query -&gt; cat Text -&…
upvote count: 1

http://stackoverflow.com/a/21839086
answers question: http://stackoverflow.com/q/21838971
type: Answer
has body: You're initializing your array correctly, but not assigning new Cards to it in your constructor: public Deck() { nextCard = 0; deck = new Card[52]; int iCount; for(iCount=0; iCount&lt;52; iCount++) { Card c = new Card(iCount); } } You instantiate each card ... then throw it away. This means every element in your deck array is null as that is the default value.
score: 0

http://stackoverflow.com/comment/32835569
type: Comment
score: 0
type: QuestionComment
has text: The question doesn't actually include a question. Please make the necessary edits to add a question.
comment on: http://stackoverflow.com/q/21712919

http://stackoverflow.com/comment/33036220
type: Comment
type: QuestionComment
has text: The answer is in your question, isn't it? You use methods such as `renderInfo.getBaseline().getEndPoint()` and `renderInfo.getBaseline().getStartPoint()`. In iText's `LocationTextExtractionStrategy` all `TextRenderInfo` instances are ordered based on their coordinates and all end points are compared with the start point of the next snippet. What more is there to say? mkl and I have given you all the info you need to start coding.
comment on: http://stackoverflow.com/q/21821289
score: 0

http://stackoverflow.com/comment/32909996
score: 0
type: AnswerComment
type: Comment
has text: The description the OP has given suggests that either `param1` is a primary key or that it just needs a basic unique constraint, and JPA can declare unique constraints inline and generate the appropriate database constraint definitions.
comment on: http://stackoverflow.com/a/21756727

http://stackoverflow.com/q/21735131
has comment: http://stackoverflow.com/comment/32872077
has title: Java regex - why did the Matcher find extra characters?
tagged with: regex
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21735168
accepted answer: http://stackoverflow.com/a/21735168
tagged with: java
has comment: http://stackoverflow.com/comment/32871607
type: Question
has body: I was experimenting trying to extract the 't' and 'f' flags from here. So I was surprised to see extra characters in the output. Apparently the matcher backtracked - I dont understand why. What should be the correct regex? System.out.println("searching..."); // "Sun:\\s Mon:\\s Tue:\\s Wed:\\s Thu:\\s Fri:\\s Sat:\\s " Pattern p = Pattern.compile("[t|f]"); Matcher m = p.matcher("Sun:t Mon:f Tue:t Wed:t Thu:f Fri:t Sat:f "); while (m.find()) { System.out.println(m.group()); } Output: searching... t f t t f t t f
score: 0
answer count: 1

http://stackoverflow.com/comment/32941336
score: 0
type: QuestionComment
has text: http://stackoverflow.com/questions/8085040/how-to-add-an-icon-image-as-hint-to-editbox-in-android
type: Comment
comment on: http://stackoverflow.com/q/21774256

http://stackoverflow.com/q/21758400
score: 1
linked to: http://stackoverflow.com/q/5802467
favorite count: 0
has answer: http://stackoverflow.com/a/21759413
accepted answer: http://stackoverflow.com/a/21764401
type: Question
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/8701754
has title: Is there a better way to lock the main scroll bar without hiding it in GWT?
tagged with: css
has comment: http://stackoverflow.com/comment/32919330
possible better answer: http://stackoverflow.com/a/21759413
answer count: 2
upvote count: 1
tagged with: gwt
has body: I set my body element to body { overflow-y: scroll; } This creates a scroll bar on my body element. When I create a scrollbar and scroll to the bottom the main area of my page is also scrolled. I found some posts on this topic: Prevent scrolling of parent element? prevent Scroll "bubbling" from element to window but these are not applicable for GWT. I tried the following: @UiHandler("panel") void onPanelMouseOver(MouseOverEvent event) { Window.enableScrolling(false); } @UiHandler("panel") void onPanelMouseOut(MouseOutEvent event) { Window.enableScrolling(true); } This is a bad solution because the main scroll bar disappear and the page is moving from left to right and back. I want to lock the scroll bar not hide it. Hiding will move the screen. Is there a better way to lock the main scroll bar in GWT?
tagged with: java
linked to: http://stackoverflow.com/q/1459676
tagged with: javascript
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21764401
downvote count: 0

http://stackoverflow.com/q/21762754
favorite count: 0
has answer: http://stackoverflow.com/a/21762963
has comment: http://stackoverflow.com/comment/32920970
possible better answer: http://stackoverflow.com/a/21762963
has title: Unique java objects - different behaviour in run and debug
linked to: http://stackoverflow.com/q/2008912
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/32920486
tagged with: java
accepted answer: http://stackoverflow.com/a/21801184
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32920559
has answer: http://stackoverflow.com/a/21762823
has comment: http://stackoverflow.com/comment/32920595
has body: I'm working on a program that relies on objects being unique. I work with the same object in 2 places, and when an update is done in one place, this should be reflected in the other. If I debug the program (in eclipse), everything works. My 2 object references both point at the same object (ojbect1==object2 returns true). If I run exactly the same program (in eclipse), there are different objects in both references (same comparison shows false). This object is instantiated multiple times, but one of those instances is saved in a TreeMap and picked up later. However, when I pick it up, sometimes (as described above) it's a different object, which does not hold any changes made to the original object in the meantime. Does anybody have an idea why this is? I cannot replicate the problem in a smaller scope so unfortunately I can't post code here.
has comment: http://stackoverflow.com/comment/32920511
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32920762
has answer: http://stackoverflow.com/a/21801184

http://stackoverflow.com/comment/32994712
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21804288
type: AnswerComment
has text: I have got the sql table having columns like x1 y1 x2 y2 but i really don't know what they stand for and how can I use them in Hjikstra's or A* algorithm to find the shortest route between two points.

http://stackoverflow.com/a/21706114
answers question: http://stackoverflow.com/q/21705594
has body: Look the problem is very basic.. In a switch statement it allows only the following datatypes and wrapper classes Byte,short,char,int,Byte,Short,Character,Integer,enum,String.. If you are passing anything other than that will give you an error. In your case the condition which you are evaluating will give you result which is a Boolean value.
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/32972586
comment on: http://stackoverflow.com/q/21769785
type: Comment
type: QuestionComment
has text: Yes. That solved the issue..i changed the context-root in jboss-web.xml and it start working. Thanks
score: 0

http://stackoverflow.com/q/21745261
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32889925
score: 1
tagged with: java
upvote count: 1
tagged with: locationmanager
type: Question
has title: Address returning null using LocationManager and GeoCoder
has comment: http://stackoverflow.com/comment/32889883
has body: I'm simply trying to grab the users location (most accurate way, I assume GPS) - and convert the latittude/longitutde into an address to display in a EditText. I keep getting "null - UnitedStates - US - 06705" basedd off my coordinates. Any idea? Here is my code: locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); providers = locationManager.getBestProvider(criteria, false); locationManager.requestLocationUpdates(providers, 5000,0, this); onLocationChanged method @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); Log.i(mTAG, String.valueOf(latitude)); try { geoCoder = new Geocoder(this); addresses = geoCoder.getFromLocation(latitude, longitude, 1); StringBuilder str = new StringBuilder(); if (geoCoder.isPresent()) { Address returnAddress = addresses.get(0); String localityString = returnAddress.getLocality(); String city = returnAddress.getCountryName(); String region_code = returnAddress.getCountryCode(); String zipcode = returnAddress.getPostalCode(); str.append(localityString + " - "); str.append(city + " - " + region_code + " - "); str.append(zipcode); addressTxtField.setText(str); Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32890005
favorite count: 0
has answer: http://stackoverflow.com/a/21745400

http://stackoverflow.com/comment/32966354
comment on: http://stackoverflow.com/a/21784275
has text: Hi Remigio. I tried your idea, and I get `Type mismatch: cannot convert from Set<DriverNode> to Set<Driver>`. It doesn't seem possible to cast a Collection. Are you sure this is what you used?
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/21709875
has title: Parsing List<Map<String,String>> String form to POJO again
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21710012
accepted answer: http://stackoverflow.com/a/21710012
has comment: http://stackoverflow.com/comment/32827007
has answer: http://stackoverflow.com/a/21710082
tagged with: dictionary
type: AnsweredQuestion
tagged with: list
downvote count: 0
score: 1
tagged with: java
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/32826751
has body: I am getting a String which comes from calling toString() from a List&lt;Map&lt;String, String&gt;&gt; object. Some sample code is: List&lt;Map&lt;String,String&gt;&gt; list = new ArrayList&lt;Map&lt;String,String&gt;&gt;(); Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("key1", "value1"); map.put("key2", "value2"); list.add(map); String myStr = list.toString(); System.out.println(myStr); This code outputs: [{key2=value2, key1=value1}] I am looking for a simple way to parse this string and convert it to a List&lt;Map&lt;String, String&gt;&gt; again. I am just wondering if there is any constructor / utility class out there to do this easily. I have already look at Java Collections library and Guava from Google but I have not found any function already built to do this. Does this exist? If not I will just create my own parser but I would to reuse some code if it exists out there. I like the concept of DRY.
possible better answer: http://stackoverflow.com/a/21710082
has comment: http://stackoverflow.com/comment/32826643

http://stackoverflow.com/a/21706323
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21705030
accepted answer of: http://stackoverflow.com/q/21705030
type: Answer
has body: Let me briefly explain what entitlement mediator does, It extracts some values from the request message and creates the XACML request and sends it to WSO2IS for decision. To create the XACML request, entitlement mediator looks for following User --> By default user name is retrieved from the message context property value called "username". This value is populated to message context when user is authenticated to proxy service using UT/Basic auth .... Resource --> By default resource is the endpoint service name. this is retrieved from "To" header in the SOAP message. Action --> By default action is "read" If this is REST request, it would take, GET/POST as actions. Same use case for REST services has been described here But you can change the default behavior by implementing new call back class. Above values are retrieved from the default implementation of call back class. If you want to retrieve some user name values from user json request, you can even do it by extending new implementation. Basically you want to write some java code and create a jar file and put it in to repository/components/lib directory... Please find the default implementation from here which is "UTEntitlementCallbackHandler.java". Also there are some other implementation as well, Please look in to the code, it is simple, you can understand them.
score: 0

http://stackoverflow.com/comment/32825478
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21708655
type: Comment
has text: Actually I solved my compile error, I was just calling with the wrong parameters! Rohit's answer is correct! Thanks again all!

http://stackoverflow.com/q/21699187
has answer: http://stackoverflow.com/a/21736553
type: Question
upvote count: 4
has body: I am beginner in web sphere mq programming. Any one has sample tutorial for connecting mq queue to java simple application. Basically i want to read a Mq queue through my java code. Please help me. Thanks in advance
tagged with: websphere-7
answer count: 2
tagged with: websphere
linked to: http://stackoverflow.com/q/21672833
favorite count: 0
tagged with: ibm-mq
accepted answer: http://stackoverflow.com/a/21706963
downvote count: 3
has title: For Websphere MQ tutorial
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21706963
possible better answer: http://stackoverflow.com/a/21736553
score: 1
tagged with: java

http://stackoverflow.com/a/21823169
score: 3
upvote count: 3
has body: Consider the following approach, which may be easier to understand. Picture the 1d axis of integers, and place on it the k hints. Every hint can be regarded as '(' or ')' or '=' (greater than, less than or equal, respectively). Example: -----(---)-------(--=-----)-----------) Now, the true value is somewhere on one of the 40 values of this axis, but actually only 8 segments are interesting to check, since anywhere inside a segment the number of true/false hints remains the same. That means you can scan the hints according to their ordering on the axis, and maintain a counter of the true hints at that point. In the example above it goes like this: segment counter ----------------------- -----( 3 --- 4 )-------( 3 -- 4 = 5 &lt;---maximum ----- 4 )----------- 3 ) 2 This algorithm only requires to sort the k hints and then scan them. It's near linear in k (O(k*log k), with no dependance on n), therefore it should have a reasonable running time. Notes: 1) In practice the hints may have non-distinct positions, so you'll have to handle all hints of the same type on the same position together. 2) If you need to return the minimum set of lies, then you should maintain a set rather than a counter. That shouldn't have an effect on the time complexity if you use a hash set.
answers question: http://stackoverflow.com/q/21822388
accepted answer of: http://stackoverflow.com/q/21822388
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33028544
has comment: http://stackoverflow.com/comment/33028991
has comment: http://stackoverflow.com/comment/33028734
type: Answer

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

http://stackoverflow.com/a/21830767
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33074338
type: Answer
accepted answer of: http://stackoverflow.com/q/21826253
has body: How can I create a map On the screen or in the memory? Jogl, lwjgl, .. there are too many things that you can start an opengl drawing on screen.(maybe AndEngine is better I dont know), you need to use version-compliant functions of opengl. If you need to generate wall information in memory, you can use a simple function superpositioned with a height-map. You need to compute surface normals to be able to put things on top of others.(Im not sure if android device is capable of realtime performance for high resolution) For example, starting with a sine wave, Adding a square wave on top of that, Superpositioned case: Adding random-height-map, you get one side of wall with randomness and you can generate it using only one or two lines of code(then you can save coordinates if you need to save CPU cycles more than memory space): How can i detect a collision Do you need event-based or a direct detection? Priori detection: you shoot imaginary rays from ball with direction of ball's velocity vector. Test both walls' and red obstacles' coordinates for the ray intersection. If it intersects, it will know which object the ball will collide after n time-steps. (if everything goes unchanged) You can try multiple ray test that works background such as first test shoots rays from current position, next test shoots from next position of ball, next is next, ... Good: you will know before it collides, so you can stop it "just in time". You can compute where the ball will be jumped after collision too! Even for consecutive collisions. Bad: needs more cpu cycles, recursion can kill performance. More than one moving objects will increase complexity exponentially. Using "Counting Sort" algorithm on a separate object coordinate buffer before shooting rays, can make the tracing faster. Posteriori detection is simple since you check for only if ball's coordinate fits in an tolerance interval of any other object's coordinate. Good: this is the simplest. Bad: it already collided. May bug or exp…
answers question: http://stackoverflow.com/q/21826253
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33073979

http://stackoverflow.com/comment/33049684
has text: double rand2 = (int) ((Math.random() * 32 + 23)* 100.0)/100.0 ; maybe (int) destroys the randomization maybe being 32 not 32.0
score: 0
comment on: http://stackoverflow.com/q/21835380
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32990877
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21802035
has text: Your solution looks feasible. I would try and update. Thanks for responding on this.
type: AnswerComment

http://stackoverflow.com/comment/32896780
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21728110
has text: Thank you for the answer. Though, it's exactly what I wanted to avoid: "The map has a proper structure, i.e. could be mapped by Jackson to Artwork object, but I'd like to avoid mapping it manually." I was thinking if there's any chance to do it more or less like this: `List<Artwork> returnedArtworks = response.getBody().asListOf(Artwork.class)`

http://stackoverflow.com/comment/32800292
comment on: http://stackoverflow.com/a/21694852
score: 0
type: Comment
has text: Hi. So I ran it again and currently, the code is simply sorting by alphabetical order and not the depth of the directory. The depth of the directory should be the first criterion being used to sort the array. Is there something wrong with my comparator method?
type: AnswerComment

http://stackoverflow.com/a/21786549
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/32962762
has comment: http://stackoverflow.com/comment/32965700
has body: Use a java.sql.Timestamp instead.
upvote count: 4
answers question: http://stackoverflow.com/q/21786478

http://stackoverflow.com/a/21741933
answers question: http://stackoverflow.com/q/21731152
accepted answer of: http://stackoverflow.com/q/21731152
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32948286
has comment: http://stackoverflow.com/comment/32949042
type: Answer
has comment: http://stackoverflow.com/comment/32900961
has comment: http://stackoverflow.com/comment/32950168
has comment: http://stackoverflow.com/comment/32950659
has body: What ZK does is that it loads your loginModal page in one desktop and your iframeLogin page in another desktop. The notion of a desktop is further clarified here. Thus, loginModal is not the parent browser window of iframeLogin. This is why getParent returns null when you invoke it on your iframe. As stated in ZK Component Reference, one may not access components attached to other desktops. In other words, the information exchange between loginModal and iframeLogin is disabled. It seems that you have one of two options: Do without an iframe and use include instead. Use an iframe but define an Event Queue under the group scope. Make this event queue visible to both loginModal and iframeLogin, and use it to exchange information between the two desktops you have. EDIT 1 Please ensure that: the client-side namespace is incorporated by inserting xmlns:w="http://www.zkoss.org/2005/zk/client" into your window tag. your JS code is evaluated after creating all the widgets by inserting defer="true" into your script tag. In your second JS snippet, this references the script widget itself. Your window and script co-exist in the same ID space. In other words, your window and script are fellows. Therefore, to reference your window from your script, please use any of the following: this.$f('loginModal').setHeight("500px"); this.$f().loginModal.setHeight("500px"); zk.Widget.$(jq('$loginModal')[0]).setHeight("500px"); Instead of: loginModal.height = 500; EDIT 2 To further exemplify, the following JS script would double the initial height of loginModal: &lt;window id="loginModal" title="Login" border="normal" width="500px" height="350px" xmlns:w="http://www.zkoss.org/2005/zk/client"&gt; &lt;script defer="true"&gt; this.$f('loginModal').setHeight("700px"); &lt;/script&gt; &lt;/window&gt;

http://stackoverflow.com/q/21749282
has comment: http://stackoverflow.com/comment/32910074
has title: Getting PageParameters from another Page
has comment: http://stackoverflow.com/comment/32907262
has body: I want to get a parameter from another page to mount an ImageResourceReference. How could I make that? public MyApp extends WebApp { public init() { ..... ..... mountPage("/edit/book/ref/${ref_number}", EditBookPage.class); mountResource("/book/ref_nr/${ref_number}/${name}", new ImageResourceReference()); } } the ${name} is defined in the ImageResourceReference.java, so there is no problem with it. But I would like to get the ${ref_number}, but don t know how to make that.. ${ref_number} is a parameter of EditBookPage
score: 0
has comment: http://stackoverflow.com/comment/32897062
tagged with: wicket
has comment: http://stackoverflow.com/comment/32900813
has comment: http://stackoverflow.com/comment/32946505
has comment: http://stackoverflow.com/comment/32897272
has comment: http://stackoverflow.com/comment/32898357
answer count: 0
type: UnansweredQuestion
tagged with: web-applications
has comment: http://stackoverflow.com/comment/32906247
tagged with: parameter-passing
has comment: http://stackoverflow.com/comment/32899162
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32911233
has comment: http://stackoverflow.com/comment/32898331
has comment: http://stackoverflow.com/comment/32912289

http://stackoverflow.com/comment/32975578
type: QuestionComment
has text: Please edit your original question, and put that information in there for all to see, as many skip comments.
score: 1
comment on: http://stackoverflow.com/q/21793408
type: Comment

arraylist
tags question: http://stackoverflow.com/q/21745929
tags question: http://stackoverflow.com/q/21830970
tags question: http://stackoverflow.com/q/21802544
tags question: http://stackoverflow.com/q/21714533
tags question: http://stackoverflow.com/q/21815156
tags question: http://stackoverflow.com/q/21817885
tags question: http://stackoverflow.com/q/21829272
tags question: http://stackoverflow.com/q/21688332
tags question: http://stackoverflow.com/q/21691973
tags question: http://stackoverflow.com/q/21805950
tags question: http://stackoverflow.com/q/21771074
tags question: http://stackoverflow.com/q/21752760
tags question: http://stackoverflow.com/q/21692873
tags question: http://stackoverflow.com/q/21732453
tags question: http://stackoverflow.com/q/21713919
tags question: http://stackoverflow.com/q/21708937
tags question: http://stackoverflow.com/q/21771831
tags question: http://stackoverflow.com/q/21710555
tags question: http://stackoverflow.com/q/21782853
tags question: http://stackoverflow.com/q/21693176
tags question: http://stackoverflow.com/q/21732952
tags question: http://stackoverflow.com/q/21748315
tags question: http://stackoverflow.com/q/21751064
tags question: http://stackoverflow.com/q/21696784
tags question: http://stackoverflow.com/q/21808736
tags question: http://stackoverflow.com/q/21802550
tags question: http://stackoverflow.com/q/21681155
tags question: http://stackoverflow.com/q/21759969
tags question: http://stackoverflow.com/q/21810076
tags question: http://stackoverflow.com/q/21735895
tags question: http://stackoverflow.com/q/21679732
tags question: http://stackoverflow.com/q/21825336
tags question: http://stackoverflow.com/q/21798680
tags question: http://stackoverflow.com/q/21703338
tags question: http://stackoverflow.com/q/21779960
tags question: http://stackoverflow.com/q/21815035
tags question: http://stackoverflow.com/q/21714886
tags question: http://stackoverflow.com/q/21716349
tags question: http://stackoverflow.com/q/21733925
tags question: http://stackoverflow.com/q/21711772
tags question: http://stackoverflow.com/q/21755173
tags question: http://stackoverflow.com/q/21722776
tags question: http://stackoverflow.com/q/21761708
tags question: http://stackoverflow.com/q/21687054
tags question: http://stackoverflow.com/q/21783370
tags question: http://stackoverflow.com/q/21821617
tags question: http://stackoverflow.com/q/21716117
tags question: http://stackoverflow.com/q/21695516
tags question: http://stackoverflow.com/q/21784527
tags question: http://stackoverflow.com/q/21788415
tags question: http://stackoverflow.com/q/21782975
tags question: http://stackoverflow.com/q/21774340
tags question: http://stackoverflow.com/q/21809134
tags question: http://stackoverflow.com/q/21807141
tags question: http://stackoverflow.com/q/21763912
tags question: http://stackoverflow.com/q/21741855
tags question: http://stackoverflow.com/q/21720613
tags question: http://stackoverflow.com/q/21770296
tags question: http://stackoverflow.com/q/21768687
tags question: http://stackoverflow.com/q/21778385
tags question: http://stackoverflow.com/q/21732520
tags question: http://stackoverflow.com/q/21694968
tags question: http://stackoverflow.com/q/21760115
tags question: http://stackoverflow.com/q/21768246
tags question: http://stackoverflow.com/q/21720173
tags question: http://stackoverflow.com/q/21711752
tags question: http://stackoverflow.com/q/21755335
tags question: http://stackoverflow.com/q/21763123
tags question: http://stackoverflow.com/q/21695701
tags question: http://stackoverflow.com/q/21728464
tags question: http://stackoverflow.com/q/21723042
tags question: http://stackoverflow.com/q/21797851
tags question: http://stackoverflow.com/q/21813124
tags question: http://stackoverflow.com/q/21827863
tags question: http://stackoverflow.com/q/21833137
tags question: http://stackoverflow.com/q/21815153
type: Tag
tags question: http://stackoverflow.com/q/21807400
tags question: http://stackoverflow.com/q/21810009
tags question: http://stackoverflow.com/q/21815969

http://stackoverflow.com/q/21824131
has title: Java - How to detect PCI modem on window 7 (64bit)
has body: I want to build the java application like callerID application. When having an incoming call then this application will show phone number in the textbox. I search on the internet, somebody said that using Java Communications API like this site. Check it like at http://edn.embarcadero.com/article/31915 I have done the same step in that site but I get NoSuchPortException when get port "COM3". CommPortIdentifier portId1 = CommPortIdentifier.getPortIdentifier("COM3"); My PCI modem was running fine when I'm testing by other callerID applicaiton. Everyone know how to detect PCI modem.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21824213
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/32910702
has text: Not it is less confusing but I still don't understand what you want. Please, try to explain how you want to get and not your aproach to the solution.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21757158

http://stackoverflow.com/comment/33038987
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21824847
type: AnswerComment
has text: Okay, OP didn't really mention what he was expecting as a result... But now I'm guessing it's something like a chess field... I corrected my answer!

http://stackoverflow.com/a/21829160
has body: Child class loader can find the classes loaded in parent class loader but parent class loader could not find the classes loaded by child class loader. here the spring classes required the quartz classes for bean creation but failed, Because the quartz classes loaded by child class loader.
has comment: http://stackoverflow.com/comment/33042602
upvote count: 5
answers question: http://stackoverflow.com/q/21828846
type: Answer
has comment: http://stackoverflow.com/comment/33040554
has comment: http://stackoverflow.com/comment/33038317
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/33039251

http://stackoverflow.com/a/21845274
answers question: http://stackoverflow.com/q/21829193
type: Answer
has body: write this methode in your adapter and use it to remove perticular Item from adapter. public void remove(int position){ mProductList.remove(position); notifyDatasetChanged(); }
score: 0

http://stackoverflow.com/comment/32844136
has text: note that the resources will only be updated if language setting (system level) changes. If you want only this app to use a different language, you'll have to use another method.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21719396
score: 0

http://stackoverflow.com/comment/33032053
type: Comment
type: QuestionComment
has text: A generic map doesn't guarantee order of keys, so I don't see how you could do this.
score: 1
comment on: http://stackoverflow.com/q/21824669

http://stackoverflow.com/comment/32870679
comment on: http://stackoverflow.com/q/21734329
score: 0
type: QuestionComment
type: Comment
has text: It's worth noting that even in C++ the inner class approach would be preferred on this case. We usually avoid `friend`ship in C++ as much as possible as it's usually not necessary and bad for encapsulation ( Even worst than inheritance ).

http://stackoverflow.com/comment/33060750
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21818307
score: 0
has text: @Altavista Yes, as ntv100 said you have to extend AsyncTask and invokes methods of it. I updated my answer to make more clear for you. I hope now you got the way.

http://stackoverflow.com/q/21705171
tagged with: vertices
has comment: http://stackoverflow.com/comment/32818951
tagged with: java
has comment: http://stackoverflow.com/comment/32819105
type: UnansweredQuestion
tagged with: graph-theory
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/32818820
has comment: http://stackoverflow.com/comment/32818706
upvote count: 1
tagged with: methods
has body: I'm trying to merge the vertices in an undirected graph after removing an edge from it, using Java. I'm representing said graph using arrays of bags containing integers, with variables for number of vertices and edges. For example a hexagon graph would be represented as: 6 vertices, 6 edges 0: 5 1 1: 2 0 2: 3 1 3: 4 2 4: 5 3 5: 0 4 The numbers before the colons are the vertices and the numbers after are the vertices they're connected to. If I remove the edge connecting vertices 1 and 2 I obtain this: 6 vertices, 5 edges 0: 5 1 1: 0 2: 3 3: 4 2 4: 5 3 5: 0 4 I then want to merge those two vertices (1 and 2) to obtain: 5 vertices, 5 edges 0: 1 4 1: 0 2 2: 1 3 3: 2 4 4: 3 0 Here is my latest attempt at coding a solution (it's very incomplete, but at least it's something): public Graph MergeVerticies(int start, int end) { Graph tempGraph = new Graph(V - 1); //V = number of vertices for(int i = 0; i &lt; V; i++) { for(int j = 0; j &lt; V; j++) { if(isEdge(i,j)) { if(i == start &amp;&amp; j == end) { //not sure } else if(i == end &amp;&amp; j == end) { //not sure } else if(i &gt;= end &amp;&amp; j &gt;= end) { tempGraph.addEdge(i-1,j-1); } else if(i &lt;= end &amp;&amp; j &gt;= end) { tempGraph.addEdge(i,j-1); } //Seems like this would take a lot of conditions //There is probably a simpler set of conditions } } } return tempGraph; } Start and end are the vertices being merged. tempGraph is the new graph being created with the merged vertices.
tagged with: graph
has title: Merging Vertices in Undirected Graph

http://stackoverflow.com/q/21735946
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/21736098
has answer: http://stackoverflow.com/a/21736101
has comment: http://stackoverflow.com/comment/32872771
type: Question
answer count: 2
has title: how does Python do the type checking compared to Java?
score: -2
has comment: http://stackoverflow.com/comment/32872773
has comment: http://stackoverflow.com/comment/32872779
possible better answer: http://stackoverflow.com/a/21736098
favorite count: 0
has comment: http://stackoverflow.com/comment/32872746
has body: Here's an example: In Python, you can type: x = 1 or x = 'hello' without declaring the type for x, However, in Java, you cannot do this, you must declare the type of x firstly. So my question is why Python allow this behavior, how does Python do the type checking compared to Java? (In my thought, In python, x just is a label, and it can point to anything. Can anyone give me some hints about the mechanism when x doing the assignment operation)
upvote count: 1
tagged with: python
accepted answer: http://stackoverflow.com/a/21736101
type: AnsweredQuestion

http://stackoverflow.com/comment/32891311
score: 1
comment on: http://stackoverflow.com/q/21746144
has text: How are you compiling and running your program? Your `Triangle` class is not on the class path.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24285252
has comment: http://stackoverflow.com/comment/105468943
has comment: http://stackoverflow.com/comment/127311064
has comment: http://stackoverflow.com/comment/76149901
has body: The easiest way is to setup simple web-filter in your web.xml which will be executed before handshake. Smth like: public class MyHandshakeFilter implements Filter { @Override public void init(FilterConfig config) throws ServletException { // do nothing } /** * Passes request to chain when request port is equal to specified in the allowedPort property * and returns HttpServletResponse.SC_NOT_FOUND in other case. */ @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (<your validation here based on http request>) { // request conditions are met. continue handshake... chain.doFilter(request, response); } else { // request conditions are NOT met. reject handshake... ((HttpServletResponse) response).setStatus(HttpServletResponse.SC_FORBIDDEN); } } } and in web.xml: yourHandshakeFilter com....MyHandshakeFilter yourHandshakeFilter /yourEndpointUrl and your ServerEndpoint should be smth like: @ServerEndpoint("/yourEndpointUrl") public class MyServerEndpoint { ... }
type: Answer
score: 2
upvote count: 3
answers question: http://stackoverflow.com/q/21763829
downvote count: 1

http://stackoverflow.com/a/21813456
answers question: http://stackoverflow.com/q/21812867
has body: Can't answer all your questions, as I am not familiar with Google's cloud offerings, but as far as EC2, you pay by the full hour for every hour (or part of an hour) that you leave the instance running - whether or not it is doing anything - think of ec2 as a server sitting on the desk next to you; every time you power it on, you are getting billed by the hour until you power it off. Depending on how you power it off, you may also pay storage fees for the non-running server (i.e if you do the equivalent of 'turning it off', you will pay storage fees, if you do the equivalent of throwing it away when you power it off, you wouldn't need to pay those storage fees - not a perfect analogy, but close enough. Also keep in mind the cost of 'storing' a non-running server is only pennies, so should be a non-issue in most cases - most of your ec2 costs will be related to the running cost per hour charges, which can range from less than a penny per hour to several dollars per hour for a very powerful machine. Whenever possible, you should purchase reserved instances which save you a tremendous amount per hour, if you are able to commit yourself to a 1-3 year term.
score: 3
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/q/21756161
has title: Why my alarmManager starts immediately if I setup for a previous day?
tagged with: alarmmanager
has body: I have an AlarmManager application in Android, it's working correctly except for one thing, if today is Thursday and I set it for Wednesday, after I finish the configuration, it starts immediately, it only happens if I try to set it for a previous day than today, this is my code: public void setupAlarm(View v){ Calendar cal = Calendar.getInstance(); AlarmManager alarmMgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE); //Setting up for Monday, as an example cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); cal.set(Calendar.HOUR_OF_DAY, tPicker.getCurrentHour()); //tPicker is a TimePicker cal.set(Calendar.MINUTE, tPicker.getCurrentMinute()); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); alarmMgr.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pIntent(this, Calendar.MONDAY)); } public static pIntent testThis(Context context, int dayId){ Intent intent = new Intent(); intent.setAction("myIntent.intent.action.CLOCK"); return PendingIntent.getBroadcast(context, dayId, intent, PendingIntent.FLAG_UPDATE_CURRENT); } As I said it works great for today and the days after, but why does it starts immediately if I setup a previous day? I will appreciate your help, thank you! EDIT: Ok, this is what I have based on suggestions, and seems like working fine: I have a checkbox for each of the days in the week, for example Monday: Calendar cal = Calendar.getInstance(); Calendar calMon = Calendar.getInstance(); calMon.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); calMon.set(Calendar.HOUR_OF_DAY, tPicker.getCurrentHour()); calMon.set(Calendar.MINUTE, tPicker.getCurrentMinute()); calMon.set(Calendar.SECOND, 0); calMon.set(Calendar.MILLISECOND, 0); if((cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || (cal.get(Calendar.DAY_OF_WEEK) &gt; Calendar.MONDAY) || ((cal.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) &amp;&amp; (calMon.getTimeInMillis() &lt; System.currentTimeMillis()))){ calMon.add(Calendar.WEEK_OF_MONTH, 1); } Basically, if day is Sunday, add a week to …
answer count: 2
linked to: http://stackoverflow.com/q/8340096
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
has answer: http://stackoverflow.com/a/21756212
score: 1
has answer: http://stackoverflow.com/a/35075014
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/a/21752861
upvote count: 1
answers question: http://stackoverflow.com/q/21751624
has comment: http://stackoverflow.com/comment/32903188
downvote count: 0
type: Answer
has body: Since you are creating xml file for each User object, the objects will be keep on replacing when the program is taking an new User from DB So create a POJO class Users with List of User as an attribute, public class Users { //Users grouping private List&lt;User&gt; user; public void setUser(List&lt;ProductInfo&gt; userInfo) { this.user = userInfo; } @XmlElement(name="user") public List&lt;User&gt; getUser() { return user; } } Then in the code section create instance of JAXBContext for the class Users, like mentioned below JAXBContext contextObj = JAXBContext.newInstance(Users.class); Now modify the while loop to set all user's information into Users object, and marshar the Users object than marshaling the User object. Users users = new Users(); while (iterator.hasNext()) { User student = (User) iterator.next(); users.setUser(student); } MarshallerObj.marshal(users, new FileOutputStream("User.xml"));
score: 1

http://stackoverflow.com/a/21826112
type: Answer
has comment: http://stackoverflow.com/comment/33033485
downvote count: 0
score: 19
upvote count: 19
answers question: http://stackoverflow.com/q/21826020
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21826020
has body: You missed that last couple of lines in the documentation :). How to test if x is greater than 1? &lt;#if x &gt; 1&gt; will be wrong, as FreeMarker will interpret the first &gt; as the end of the tag. Thus, either write &lt;#if (x &gt; 1)&gt; or &lt;#if x &amp;gt; 1&gt;.

http://stackoverflow.com/comment/49539494
type: Comment
has text: @Pablo no, a Pegasus HAS horseFeatures and HAS birdFeatures. +1 for the answer because it keeps the code simple, unlike the clunkier, class-spawning, proper Java solutions.
comment on: http://stackoverflow.com/a/21824834
score: 2
type: AnswerComment

http://stackoverflow.com/q/21803807
tagged with: reference
has body: First Java project - solving a Sudoku puzzle. Used SDK to create GUI first (bad idea?). GUI has 9x9 grid of square JButtons. Added handlers (81!) such that 'click' cycles values '_','1',...'9'. Named buttons in grid to reflect position (also painful). To solve puzzle implemented 9x9 array of Tile objects. Tiles to mirror state of respective JButtons (text value, etc). Want to use array of Tiles to solve puzzle. To use get/setText methods to r/w from array to/from JButtons. Hit wall!! Can't find way to reference JButtons. Hoped to create String representing JButton variable name (easy enough) then magically convert (type casting?) to reference JButton object. Not possible? A String is a String is a...? I have an object in memory (JButton) I can't reference dynamically? Approaches seen (tic-tac-toe, etc.) create an array of JButtons to access by index. Don't want to do this as it takes away from simplicity of using swing. The SDK generated source code is ~2000 lines already! Use hash to map objects to objects? Ideally each Tile object will map to respective JButton when created. Hopefully enough detail here to explain what I am 'trying' to do. Is this case where pointers would be nice? Is this a downfall of using SDK for GUI? Shortcoming in Java? Can anyone recommend approach to this (tricks or tips)?? Thanks!!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32993827
tagged with: dynamic
has title: Dynamic reference to JComponents?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22265715
tagged with: user-interface
tagged with: variables
has comment: http://stackoverflow.com/comment/32997809
score: 0
has comment: http://stackoverflow.com/comment/32998435
answer count: 1

http://stackoverflow.com/comment/32789562
has text: **Just** the first item? Could you paste how are you creating your custom `ArrayAdapter` instance?
comment on: http://stackoverflow.com/q/21688978
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32877488
type: QuestionComment
has text: For one thing, because `field` and `method` aren't, and should not be, keywords.
type: Comment
score: 2
comment on: http://stackoverflow.com/q/21738363

http://stackoverflow.com/a/21747769
has comment: http://stackoverflow.com/comment/32927458
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/32915862
has body: Java config support for oauth2 is work in progress, but you might have more success with my fork. If I were you I'd stick to XML for the oauth2 bits for now. Here's a bootified sparklr2 with minimal XML. I haven't checked that it works recently but it shouldn't be in bad shape if you update the boot dependencies to 1.0.0.RC2. Update: the @Configuration stuff has moved to the main OAuth2 repo, so the fork and its parent are basically redundant now (and will probably be removed soon). Update: the bootified sample is now also using @Configuration.
has comment: http://stackoverflow.com/comment/32920870
has comment: http://stackoverflow.com/comment/51557183
has comment: http://stackoverflow.com/comment/32919731
answers question: http://stackoverflow.com/q/21747431
has comment: http://stackoverflow.com/comment/32918025
has comment: http://stackoverflow.com/comment/33020790
has comment: http://stackoverflow.com/comment/38648964
has comment: http://stackoverflow.com/comment/32961521
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/51533923
has comment: http://stackoverflow.com/comment/32921822
has comment: http://stackoverflow.com/comment/32894366
has comment: http://stackoverflow.com/comment/32964393

http://stackoverflow.com/comment/32961123
type: QuestionComment
comment on: http://stackoverflow.com/q/21785544
score: 0
has text: good , but i dont see any field for performance insert , and doubt that can be meseaured by the same running code.. we got tools for monitoring JVM (which i have not used)
type: Comment

http://stackoverflow.com/a/21713934
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32845106
accepted answer of: http://stackoverflow.com/q/21713893
answers question: http://stackoverflow.com/q/21713893
type: Answer
has body: You're not far off (if you really want to follow these criteria): ^[=+\s]*(?:[0-9][=+\s]*){8,}$ Explanation: ^ # Start of string [=+\s]* # Optionally match =, + or whitespace (?: # Start of group: [0-9] # Match a digit [=+\s]* # Optionally match =, + or whitespace ){8,} # Repeat at least 8 times $ # End of string Don't forget to double the backslashes in a Java string: Pattern regex = Pattern.compile("^[=+\\s]*(?:[0-9][=+\\s]*){8,}$"); But of course these rules also permit matches like ++++0+0===0=+0+000+0+0+0+0+++...

http://stackoverflow.com/a/21730478
has body: A straight String.equals(xx) is fast enough, but that obviously doesn't take blanks into account. So I recommend to implement this simple solution, which is very close to String.equals(), and takes blanks into account: public boolean isValidWord(String word) { if (wordHashSet.contains(word)) { return true; } for (String fromHashSet: wordHashSet){ if (compareIgnoreBlanks(fromHashSet, word)) { return true; } } return false; } /** * Inspired by String.compareTo(String). Compares two String's, ignoring blanks in the String given as * second argument. * * @param s1 * String from the HashSet * @param s2 * String with potential blanks * @return true if s1 and s2 match, false otherwise */ public static boolean compareIgnoreBlanks(String s1, String s2) { int len = s1.length(); if (len != s2.length()) { return false; } int k = 0; while (k &lt; len) { char c1 = s1.charAt(k); char c2 = s2.charAt(k); if (c2 != ' ' &amp;&amp; c1 != c2) { return false; } k++; } return true; }
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32863112
has comment: http://stackoverflow.com/comment/32863431
answers question: http://stackoverflow.com/q/21729315
downvote count: 0

http://stackoverflow.com/comment/32833700
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21713466
has text: Have you looked at: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html .... you know... the document that explains all of this?

http://stackoverflow.com/q/21781622
has comment: http://stackoverflow.com/comment/32954252
has title: Java String.format is not working starting app as jar
has comment: http://stackoverflow.com/comment/32953843
has comment: http://stackoverflow.com/comment/32953925
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21782187
tagged with: formatting
type: Question
answer count: 1
tagged with: executable-jar
tagged with: string
score: 0
has body: I've got a problem with formatting a string using javas String.format. I'm adding the string containing a description and a price to a swing JList component. I want that the prices are always under each other. So I use: String ret = String.format( "%s %-" + Integer.toString(articleNameLength) + "s %3s %9.2f EUR", (new SimpleDateFormat("dd.MM.yyyy")).format(date), article, " ", price ); You can also see the code at line 205 at: https://github.com/hanneseilers/MyBudget/blob/master/MyBudget/src/de/hanneseilers/core/Article.java That's working fine if I start the application using eclipse or a simple batch file that runs java -jar MyBudget.ja But if i use a doubleclick in file explorer to start the jar, the layout breaks up and the prices aren't under each other. Any idea why this happens?

http://stackoverflow.com/q/21807691
answer count: 1
linked to: http://stackoverflow.com/q/19786142
has answer: http://stackoverflow.com/a/23619404
type: UnansweredQuestion
has title: How to protect my jsp page from direct access
tagged with: java
has comment: http://stackoverflow.com/comment/33000915
tagged with: servlets
type: Question
has body: I am doing a web application using servlets and jsps. I had a index.html Now i need to avoid direct access of my login page from browser Login App using Servlet and JSP Register Login Now I want to prevent direct access of Login.jsp from the browser http://localhost:9090/LoginAppWithServletsJSPJDBC/Login.jsp By googling I came to know that I need to use <security-constraint> for this. Please help me .How can I achieve this.
has comment: http://stackoverflow.com/comment/33000902
tagged with: jsp
has comment: http://stackoverflow.com/comment/33000885
has comment: http://stackoverflow.com/comment/33000960
score: 0

http://stackoverflow.com/comment/32926661
has text: @jaket Do you mean use stream.close()? I tried, and it didn't change anything. When I try stream.reset() it tells me mark/reset is not supported, which I've heard you can fix by making stream into a BufferedInputStream, but is there an easier way? I can't get a format from a BufferedInputStream.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21745956

http://stackoverflow.com/comment/32837168
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21713660
has text: Thank you for that resource! After reading and messing with the build.gradle file, there are still some bugs. I've updated the question as well. If there are any other resources that I should read then please let me know.

http://stackoverflow.com/comment/32793662
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21691052
type: Comment
has text: @a24 Did you try that?

http://stackoverflow.com/comment/32941891
has text: Show a call stack when the exception is thrown.
comment on: http://stackoverflow.com/q/21771624
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32961606
comment on: http://stackoverflow.com/q/21785054
type: Comment
type: QuestionComment
has text: `name.contains("duration")` has no effect. No log. :(
score: 0

http://stackoverflow.com/a/21739772
has comment: http://stackoverflow.com/comment/42179593
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Recompile all of your Java source against the newer Alfresco classes and with JDK 1.7. The exact ones escape me, but some critical method signatures in places like the NodeService (I think) have changed.
type: Answer
accepted answer of: http://stackoverflow.com/q/21733439
answers question: http://stackoverflow.com/q/21733439
has comment: http://stackoverflow.com/comment/32896590
has comment: http://stackoverflow.com/comment/40482457

http://stackoverflow.com/comment/32982703
type: QuestionComment
has text: *"overload" the signature of the override "onRequestFailure"* - What do you mean by that?
comment on: http://stackoverflow.com/q/21797661
score: 0
type: Comment

http://stackoverflow.com/comment/32817383
has text: Well, you might have more than one pixel with the same color, right? This implementation starts in the upper left corner and scans line by line for the first pixel with the given color.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21692861

http://stackoverflow.com/comment/32935740
comment on: http://stackoverflow.com/a/21770968
type: AnswerComment
has text: A dependency for something this simple?
type: Comment
score: 1

http://stackoverflow.com/comment/35247381
comment on: http://stackoverflow.com/a/21794061
has text: Path location is different in windows and ... everyone else. If you want to use "C:\Users\Owner\Desktop\Data.csv" as your location, then escape the back slash with "C:\\Users\\Owner\\Desktop\\Data.csv"
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32933196
comment on: http://stackoverflow.com/a/21764528
type: AnswerComment
score: 0
type: Comment
has text: Hi @JohnKugelman, I actually spent some time to test with different files. Also the OP wanted to know why there was an infinite loop and I think I have answered the question. I have also presented a strategy for the OP to check code by running it like this.

http://stackoverflow.com/comment/37246009
type: QuestionComment
has text: I tried using the job priority like in MR1 and it did nothing :(
score: 0
comment on: http://stackoverflow.com/q/21679504
type: Comment

http://stackoverflow.com/comment/32973196
type: AnswerComment
score: 0
has text: Certainly the Iterator itself does not reiterate. Internally, there *may* be an iteration over the data structure, but that's never revealed publicly.
type: Comment
comment on: http://stackoverflow.com/a/21791508

http://stackoverflow.com/comment/32816481
type: Comment
comment on: http://stackoverflow.com/a/21703889
score: 0
type: AnswerComment
has text: @alex1111 `Pattern#quote` must be used, not `Pattern#split`. Only one `replaceAll` should be enough: `template.replaceAll(Pattern.quote("${" + name + "}"), value.toString());`

http://stackoverflow.com/q/21824260
has title: Apache Ivy dependencies force="true" does not work
score: 0
has answer: http://stackoverflow.com/a/21842146
accepted answer: http://stackoverflow.com/a/21842146
answer count: 1
has body: My project has commons-codec as a dependency and uses Ivy. Some other dependencies need commons-codec-1.6 and 1.2. Now my problem is that Ivy evicts my version(1.4) and instead uses 1.6. &lt;dependency org="commons-codec" name="commons-codec" force="true" rev="1.4" /&gt; Why doesn't force work? Has anyone encountered this yet? FYI i have used this before and it worked...
type: AnsweredQuestion
type: Question
linked to: http://stackoverflow.com/q/11871838
tagged with: ant
tagged with: java
tagged with: ivy

http://stackoverflow.com/q/21764131
upvote count: 1
tagged with: java
tagged with: jaxb
has body: I am trying to parse a class with multiple bidirectional connections to other classes. To prevent the infinite loop problem and cause of other reasons I want to parse some properties in a custom way. i.e I have the class MovieImpl (implements the movie interface) which contains a list of actors (PersonImpl) and one field for the director (PersonImpl) (and of course other fields): @XmlRootElement @XmlSeeAlso({ PersonImpl.class }) @Entity public class MovieImpl implements Movie { @Id @Column(name = "movieId", unique = true) @GeneratedValue(strategy = GenerationType.IDENTITY) int _id; ... @ManyToOne(fetch = FetchType.LAZY, targetEntity = PersonImpl.class) @JoinColumn(name = "directorId") Person _director; ... @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, targetEntity = PersonImpl.class) @JoinTable(name = "movie_has_actors", joinColumns = { @JoinColumn(name = "movieId", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "personId", nullable = false) }) Collection<Person> _actors; ... } my PersonImpl class has a list of movies: @XmlRootElement @XmlSeeAlso({ MovieImpl.class }) @Entity public class PersonImpl implements Person { ... private int _id; private String _name; @ManyToMany(mappedBy = "_actors", targetEntity = MovieImpl.class) private Collection _movies; ... } So is there a way with jaxb to display only the name and id of an actor when it is rendered from a movie object. And on the other hand: display only some other fields from a movie, when it is rendered from a person object? i.e.: 82303482 ... 340980 xyz 479834 xyz 3434234 abc ... 34843 abc ... 3489 asdf ... 4534534 qwer ... Thanks for help in advance. Update: when I add the @XmlInverseReference annotation to the fields it gives me only something like: ... <_actors> com.company.package...PersonImpl@2450c3 </_actors> <_actors> com.company.package...PersonImpl@4e98166 </_actors> com.company.package...PersonImpl@2450c3 com.company.package...PersonImpl@4e98166 ... why are there 2 field…
has comment: http://stackoverflow.com/comment/32928710
has answer: http://stackoverflow.com/a/21765861
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/21764399
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32926945
score: 1
has title: JAXB - How to parse an element in two ways
possible better answer: http://stackoverflow.com/a/21764399
tagged with: moxy
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
accepted answer: http://stackoverflow.com/a/21765861
type: Question
answer count: 2

http://stackoverflow.com/comment/33016868
type: QuestionComment
has text: No , because i just switched to Eclipse and i'm fairly new to using a debugger . I'm trying to do my own debugging by printing certain messages in certain key stages of my code .
score: 0
comment on: http://stackoverflow.com/q/21816328
type: Comment

http://stackoverflow.com/comment/32853845
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21725445
has text: I have checked out your conditions. After adding these two attributes the **EditText** field will not take any "." or "-" and it will take only 3 digits, not more than that.
type: AnswerComment

http://stackoverflow.com/comment/32902340
type: Comment
has text: Did you set an action command for this button (using `setActionCommand("Predict")`)?. Otherwise did you try `if(e.getSource() == yourButton)`?
type: QuestionComment
comment on: http://stackoverflow.com/q/21752628
score: 0

http://stackoverflow.com/a/21770004
has comment: http://stackoverflow.com/comment/32933973
score: 0
type: Answer
has body: You need to loop over the cursor if the cursor is returning more than one row, and build your output in the loop. Keep calling c.moveToNext() until it returns false.
answers question: http://stackoverflow.com/q/21769926

http://stackoverflow.com/comment/33001937
type: AnswerComment
has text: Try with xpath //li[@title='Alerts']/a/span
score: 0
comment on: http://stackoverflow.com/a/21801911
type: Comment

http://stackoverflow.com/q/21773997
type: AnsweredQuestion
tagged with: jsf
has title: Programmatic Login to custom JAAS LoginModule in JSF2 web application (JBoss)
score: 1
tagged with: java
tagged with: jboss
upvote count: 1
answer count: 1
favorite count: 0
tagged with: security
has answer: http://stackoverflow.com/a/21891069
accepted answer: http://stackoverflow.com/a/21891069
tagged with: jaas
has body: I have a CustomLogin Module on my server-side JBoss EAP 6.2.0 SecurityDomain. This Custom LoginModule requires three CallbackHandlers: NameCallback (Java Standard), PasswordCallback (Java Standard) and an additional OtpCallback (implemented by myself, for a one time password). I now want to login to this module via a JSF 2.1 web application. I know that this is usually possible with FORM login, BASIC login, or login via HttpServletRequest#login. But all of them don't let me specify username, password and otp-value. They only allow for username and password. Therefore I'm seeking for a way to authenticate like with the HttpServletRequestMethod while being able to supply the three credentials. Thank you very much in appreciation of your help! N.B.: I've already tried to use LoginContext lc = new LoginContext("MyOtpSecurityDomain", new CallbackHandler() { @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for( Callback callback : callbacks ) { if( callback instanceof NameCallback ){ NameCallback nc = (NameCallback) callback; nc.setName(username); } else if ( callback instanceof PasswordCallback ) { PasswordCallback pc = (PasswordCallback) callback; pc.setPassword(password.toCharArray()); } else if ( callback instanceof OtpCallback ) { OtpCallback oc = (OtpCallback) callback; oc.setOtp(otp); } } } }); lc.login(); This even calls my server-side custom Login Module, but somehow the login is not propagated to the webapp and the EJBs.
downvote count: 0
type: Question

http://stackoverflow.com/comment/32891358
type: QuestionComment
has text: Have you placed your `spring.xml` inside src folder, not in any other?
comment on: http://stackoverflow.com/q/21746144
score: 0
type: Comment

http://stackoverflow.com/q/21794703
has answer: http://stackoverflow.com/a/38085232
tagged with: opencv
tagged with: java-native-interface
tagged with: java
tagged with: spring-tool-suite
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/21902951
downvote count: 0
has body: First of all, I have a basic example of OpenCV running in a main method. However, if I use OpenCV in a Spring Web Controller, an error is thrown. I am getting an UnsatisfiedLinkError when running the following code inside a Tomcat Server, within STS (Spring Tool Suite), and have boiled the problem down to the following code: System.loadLibrary(Core.NATIVE_LIBRARY_NAME); CascadeClassifier cascadeClassifier = new CascadeClassifier(); The run configurations of both the server and the "main" application contain the VM Arguments pointing to the OpenCV DLLs: -Djava.library.path="C:\opencv\build\java\x64;C:\opencv\build\x64\vc10\bin" For reference, I have also included the pertinent bits of the stacktrace below: org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.UnsatisfiedLinkError: org.opencv.objdetect.CascadeClassifier.CascadeClassifier_0()J ... Caused by: java.lang.UnsatisfiedLinkError: org.opencv.objdetect.CascadeClassifier.CascadeClassifier_0()J at org.opencv.objdetect.CascadeClassifier.CascadeClassifier_0(Native Method) at org.opencv.objdetect.CascadeClassifier.&lt;init&gt;(CascadeClassifier.java:38) at com.immersion.test.controllers.SimpleController.createClassifier(SimpleController.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) Note: I have read in several StackOverflow threads that the main cause of the UnsatisfiedLinkError is the missing System.loadLibrary(Core.NATIVE_LIBRARY_NAME) call. This is clearly not the case here, since it is being called just above where the exception is thrown.
tagged with: tomcat
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/13164115
upvote count: 2
answer count: 2
has title: UnsatisfiedLinkError with OpenCV in Tomcat
possible better answer: http://stackoverflow.com/a/38085232
has answer: http://stackoverflow.com/a/21902951
linked to: http://stackoverflow.com/q/16449781

http://stackoverflow.com/comment/32788673
has text: Where do you define `VerticalSeekBar.OnSeekBarChangeListener`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21687423
score: 1

http://stackoverflow.com/comment/32920587
comment on: http://stackoverflow.com/q/21745619
score: 0
type: Comment
type: QuestionComment
has text: (It's also true that the Hotspot JITC kinda sucks at optimization. Dunno about GCC.)

http://stackoverflow.com/comment/32964839
has text: @user3182532 I have been developing professionally in Java since 1998...I ALWAYS assume it's my code first. Saves a lot of time that way.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21787198
score: 0

http://stackoverflow.com/a/21795720
has comment: http://stackoverflow.com/comment/32979883
answers question: http://stackoverflow.com/q/21795690
accepted answer of: http://stackoverflow.com/q/21795690
upvote count: 1
has body: You should redirect the correct port on your router, too. Log in to your router Find Network > NAT > Port Forwarding Add a rule for your web Service that redirect the port 8080 to your local (LAN) ip
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32979699
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32979631

http://stackoverflow.com/comment/32984154
type: AnswerComment
has text: Arrays.sort() returns void. This wouldn't compile.
type: Comment
comment on: http://stackoverflow.com/a/21798490
score: 0

http://stackoverflow.com/comment/32829443
type: Comment
type: QuestionComment
has text: Yes that would be correct. The Vector contains data from DB1, I want to place it in DB2.
comment on: http://stackoverflow.com/q/21711309
score: 0

http://stackoverflow.com/a/21727519
answers question: http://stackoverflow.com/q/21727187
type: Answer
has body: You are getting a NullPointerException at line 15 of MainActivity.java at com.example.giftester.MainActivity.&lt;init&gt;(MainActivity.java:15) Please check for this error.
has comment: http://stackoverflow.com/comment/32857120
score: 0

http://stackoverflow.com/comment/32930044
type: Comment
has text: If you're wanting to forward the results to the JSP page DBResult.jsp for display, you might want to append them to the end like so: RequestDispatcher view = request.getRequestDispatcher("DBResult.jsp?id=" + id + "&name=" + name);
score: 0
comment on: http://stackoverflow.com/q/21767762
type: QuestionComment

http://stackoverflow.com/comment/32986281
score: 0
type: AnswerComment
type: Comment
has text: pierre... this is the problem. Please try below code JPanel panel2 = new JPanel(new FlowLayout()); JPanel panel3 = new JPanel(new FlowLayout()); panel2.add(new JLabel("row 1")); for(int i=0;i<200;i++){ panel3.add(new JButton("b"+i)); } panel1.add(panel2); panel1.add(panel3);
comment on: http://stackoverflow.com/a/21799468

http://stackoverflow.com/comment/32983140
comment on: http://stackoverflow.com/q/21795688
score: 1
type: Comment
type: QuestionComment
has text: Please edit the code into your question - that's where it belongs, not in a comment. And say what goes wrong - just saying "it doesn't work well" isn't enough information.

http://stackoverflow.com/comment/32803401
has text: This is an issue with your db design. Make it perfect.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21696857

http://stackoverflow.com/comment/32992602
comment on: http://stackoverflow.com/q/21802828
type: Comment
has text: @CamiloBermúdez did the server.xml provided any clue?
type: QuestionComment
score: 0

http://stackoverflow.com/a/21723073
score: 1
has body: Matrices element = list.get(1); will do the job. ArrayList is a zero index collection. So list.get(1) will give the 2nd element. You should check relevant apis, here ArrayList
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21723042

http://stackoverflow.com/q/21806586
favorite count: 0
has comment: http://stackoverflow.com/comment/32999111
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32998901
has title: reusing Color type (reset color) in java
answer count: 4
has answer: http://stackoverflow.com/a/21806732
has answer: http://stackoverflow.com/a/22032058
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21807019
has comment: http://stackoverflow.com/comment/32998943
has comment: http://stackoverflow.com/comment/32998905
type: Question
has answer: http://stackoverflow.com/a/21807060
has body: Is there any possible way to reuse the same Color type object without creating a new one? Because I think creating a new Color object is slowing the program down if the color is changed frequently. something like this: //passing Graphics g into the function int color_setting=1; while(1) { Color cl=new Color(color_setting,0,0); g.setPaint(cl); //the rest of drawing color_setting=(color_setting+1)%256; } //is there a way to reset the color of old cl without always creating a new Color object? Ok I'm posting the whole code here. Sry it's a little bit messy: import java.lang.*; import java.awt.*; import java.awt.event.*; import javax.swing.Timer; import javax.swing.*; import java.awt.geom.*; import static java.lang.System.*; import java.util.*; class compo extends JComponent { static int color,dir; { color=0; dir=1; } Toolkit kit=Toolkit.getDefaultToolkit(); Dimension sz=kit.getScreenSize(); public Dimension getPreferredSize(){return new Dimension(sz.width/2,sz.height/2);} public void paintComponent(Graphics g) { Graphics2D g2=(Graphics2D)g; float x=255; int count=255; while(count!=0) { color=color+dir; if(color%128==0) dir=-dir; Color temp_color=new Color(color+64,0,0); Line2D line=new Line2D.Double(0.0,x,sz.width,x); g2.setPaint(temp_color); x--; count--; g2.draw(line); } } } public class hello { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { SimpleFrame frame=new SimpleFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); class temp implements ActionListener { Timer timer; Toolkit kit=Toolkit.getDefaultToolkit(); Dimension sz=kit.getScreenSize(); SimpleFrame frame; public temp(SimpleFrame _frame) { frame=_frame; } public void actionPerformed(ActionEvent event) { timer.stop(); frame.setTitle("this is the frame!"); frame.add(new compo()); frame.pack(); timer.start(); } public void storing(Timer timer) { this.timer=timer; } } ActionListener test=new temp(frame); Timer t=new Timer(0,te…
score: 3
downvote count: 0

http://stackoverflow.com/q/21706284
has comment: http://stackoverflow.com/comment/32820093
type: Question
answer count: 3
has title: Read Arduino A0, A1 and A2 in Java, independently
possible better answer: http://stackoverflow.com/a/79432840
has answer: http://stackoverflow.com/a/21706588
tagged with: serial-port
has answer: http://stackoverflow.com/a/79432840
has body: I need to get the values from three load cells that are connected to A0, A1 and A2 pins, separately. At the moment, my code in Java that prints the data from Arduino is this: public synchronized void serialEvent(SerialPortEvent oEvent) { if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) { try { load = input.readLine(); System.out.println(load); System.out.println("====DATA FINISHED===="); } catch (Exception e) { System.err.println(e.toString()); } } } And I get this from the Console: 0 ====DATA FINISHED==== 3 ====DATA FINISHED==== 5 ====DATA FINISHED==== I wanted to reach the values of A0, A1, A2 separated from each other, but they are coming all together. My arduino code is: int firstSensor = 0; // first analog sensor int secondSensor = 0; // second analog sensor int thirdSensor = 0; // third analog sensor int inByte = 0; // incoming serial byte void setup() { Serial.begin(9600); } void loop() { // read first analog input firstSensor = analogRead(A0); // delay 10ms to let the ADC recover: delay(10); // read second analog input secondSensor = analogRead(A1); delay(10), // read third analog input thirdSensor = analogRead(A2); // send sensor values: Serial.println(firstSensor); Serial.println(secondSensor); Serial.println(thirdSensor); } I'm new to JAVA, Arduino and here (stackoverflow), I'm sorry for any 'bad' mistake in this post. Thanks in advance.
score: 0
tagged with: arduino
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21706588
has answer: http://stackoverflow.com/a/79432979
tagged with: java

http://stackoverflow.com/q/21762452
has comment: http://stackoverflow.com/comment/32919863
favorite count: 0
has comment: http://stackoverflow.com/comment/32919986
has answer: http://stackoverflow.com/a/21762468
has body: In all the tutorials I have read they always say that \s matches a whitespace. So why this instruction System.out.println("line1 \n line2".replaceAll("\\s\\s*", " ")); have this output : line1 line2 Thanks for your response.
has comment: http://stackoverflow.com/comment/32920166
tagged with: regex
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21762468
possible better answer: http://stackoverflow.com/a/21762499
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21762499
upvote count: 1
has answer: http://stackoverflow.com/a/21762544
type: Question
has answer: http://stackoverflow.com/a/21762536
has title: what \\s matches in Java
downvote count: 0

junit
type: Tag
tags question: http://stackoverflow.com/q/21773767
tags question: http://stackoverflow.com/q/21744005
tags question: http://stackoverflow.com/q/21770042
tags question: http://stackoverflow.com/q/21805969
tags question: http://stackoverflow.com/q/21737206
tags question: http://stackoverflow.com/q/21696212
tags question: http://stackoverflow.com/q/21773344
tags question: http://stackoverflow.com/q/21790856
tags question: http://stackoverflow.com/q/21821521
tags question: http://stackoverflow.com/q/21823438
tags question: http://stackoverflow.com/q/21804848
tags question: http://stackoverflow.com/q/21790894
tags question: http://stackoverflow.com/q/21760626
tags question: http://stackoverflow.com/q/21703242
tags question: http://stackoverflow.com/q/21803844
tag name: junit
tags question: http://stackoverflow.com/q/21781329
tags question: http://stackoverflow.com/q/21738543
tags question: http://stackoverflow.com/q/21712360
tags question: http://stackoverflow.com/q/21735487
tags question: http://stackoverflow.com/q/21784642
tags question: http://stackoverflow.com/q/21732187
tags question: http://stackoverflow.com/q/21686237
tags question: http://stackoverflow.com/q/21777087
tags question: http://stackoverflow.com/q/21728961
tags question: http://stackoverflow.com/q/21713660
tags question: http://stackoverflow.com/q/21727574
tags question: http://stackoverflow.com/q/21821791
tags question: http://stackoverflow.com/q/21743974
tags question: http://stackoverflow.com/q/21827531
tags question: http://stackoverflow.com/q/21814990
tags question: http://stackoverflow.com/q/21733678
tags question: http://stackoverflow.com/q/21803591
tags question: http://stackoverflow.com/q/21682430
tags question: http://stackoverflow.com/q/21687022
tags question: http://stackoverflow.com/q/21839971
tags question: http://stackoverflow.com/q/21720661
tags question: http://stackoverflow.com/q/21788091
tags question: http://stackoverflow.com/q/21728702
tags question: http://stackoverflow.com/q/21678542

http://stackoverflow.com/comment/109285320
comment on: http://stackoverflow.com/a/52681317
score: 0
type: AnswerComment
has text: @SteveWhite Yes it's the Gradle menu/toolbar, can be found on the right side in the Android IDE. Or on the keyboard dubble tap CTRL then type "gradle CreateFullJarRelease". =)
type: Comment

http://stackoverflow.com/comment/32798415
type: QuestionComment
has text: @BenjaminLindley It's kinda obvious the doesn't understand either ;) This is a dup question on both sides, I picked the C++ side.
comment on: http://stackoverflow.com/q/21693987
score: 0
type: Comment

http://stackoverflow.com/a/64628291
has body: Configure Main Class to your Manifest If you are using gradle project, just add the following into your build.gradle jar { manifest { attributes( 'Main-Class': 'pokerhandscorer.PokerHandScorer' ) } } Where 'pokerhandscorer' is the name of the package name, and PokerHandScorer is the main class name This creates a jar file into your \build\libs{jarFilename}.jar Run jar file using java -jar /{path}/{jarFileName.jar} java -jar /{path}/{jarFileName.jar}
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21721119

http://stackoverflow.com/q/21779577
accepted answer: http://stackoverflow.com/a/21779840
has comment: http://stackoverflow.com/comment/32950269
has comment: http://stackoverflow.com/comment/32950288
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32950375
tagged with: java
has answer: http://stackoverflow.com/a/21779844
type: Question
has answer: http://stackoverflow.com/a/21779840
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32950076
has title: Return List of entity instead of List of object
tagged with: jpa
possible better answer: http://stackoverflow.com/a/21779844
has body: Eclipse / Java I have a method to perform database query. myBean : List&lt;Composicao&gt; itemProdutoLista = compPrecoServico.buscar(Composicao.nomeQuery); The nomeQuery is : @NamedQuery(name = "nomeQuery", query= " SELECT composicao.valortotal,composicao.id FROM Composicao composicao query - javax.persistence.query public List&lt;T&gt; buscar(String nomeQuery) { Query query = entityManager.createNamedQuery(nomeQuery); return query.getResultList(); } My return List buscar get me that : An Object elementData How can I get an Entity Composicao elementdata in my return buscar method ? instead of object elementData

http://stackoverflow.com/a/21749658
has body: instantiate() allows you to specify a fragment by name, without compile-time static resolution of the class. It's useful when the fragment name comes from some runtime source, such as a binary XML: &lt;fragment class="com.example.FragmentClass" ... This is how the framework instantiates fragments specified in layout XML. In code, it's preferable to use newInstance() or the empty constructor to get compile-time static type checking. The code instantiate() does under the hood is not too different from what happens when instantiated with newInstance() / empty constructor so there's unlikely to be a significant difference in performance.
upvote count: 9
answers question: http://stackoverflow.com/q/21738570
type: Answer
accepted answer of: http://stackoverflow.com/q/21738570
downvote count: 0
score: 9
type: AcceptedAnswer

http://stackoverflow.com/a/21757107
type: Answer
has comment: http://stackoverflow.com/comment/32961581
score: 0
answers question: http://stackoverflow.com/q/21756445
has body: You need to add selector code in drawable folder file_name "selector.xml" &lt;xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;!-- When selected, color is white --&gt; &lt;item android:color="@android:color/white" android:state_selected="true" /&gt; &lt;!-- When not selected, color is green --&gt; &lt;item android:color="@android:color/green" /&gt; &lt;/selector&gt; Set this selector in your main file like this TabSpec tabSpecWindow = tabHost.setIndicator("", ressources.getDrawable(R.drawable.selector)) .setContent(new Intent( , )); Changing the color of rating bar has similar process to selection color change Tabhost Get the star images of color which you want. create color.xml in drawable folder &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@android:id/background" android:drawable="@drawable/color_empty" /&gt; &lt;item android:id="@android:id/secondaryProgress" android:drawable="@drawable/color_half" /&gt; &lt;item android:id="@android:id/progress" android:drawable="@drawable/color_full" /&gt; &lt;/layer-list&gt; Now in your rating bar add below code &lt;RatingBar android:progressDrawable="@drawable/color"/&gt;
has comment: http://stackoverflow.com/comment/32950101

http://stackoverflow.com/comment/32783209
score: 0
has text: So I should assume that my attempt at fixing the leak that was causing OOMEs worked and I have no reason to believe there might be a leak if it doesn't crash again?
type: Comment
comment on: http://stackoverflow.com/a/21684826
type: AnswerComment

http://stackoverflow.com/q/21697949
has comment: http://stackoverflow.com/comment/32805849
has answer: http://stackoverflow.com/a/25229399
has answer: http://stackoverflow.com/a/22078957
has comment: http://stackoverflow.com/comment/32806827
has title: How to resolve nested column in tableview after update version of java-124 in javaFx?
favorite count: 0
linked to: http://stackoverflow.com/q/22202782
tagged with: javafx-8
tagged with: javafx-2
accepted answer: http://stackoverflow.com/a/22078957
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has body: Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at com.sun.javafx.scene.control.skin.NestedTableColum nHeader.dispose(NestedTableColumnHeader.java:323) at com.sun.javafx.scene.control.skin.NestedTableColum nHeader.updateTableColumnHeaders(NestedTableColumn Header.java:265) at com.sun.javafx.scene.control.skin.NestedTableColum nHeader.checkState(NestedTableColumnHeader.java:51 9) at com.sun.javafx.scene.control.skin.NestedTableColum nHeader.computePrefHeight(NestedTableColumnHeader. java:401) at javafx.scene.Parent.prefHeight(Parent.java:918) at javafx.scene.layout.Region.prefHeight(Region.java: 1438) at com.sun.javafx.scene.control.skin.TableHeaderRow.c omputePrefHeight(TableHeaderRow.java:344) at com.sun.javafx.scene.control.skin.TableHeaderRow.c omputeMinHeight(TableHeaderRow.java:339) at javafx.scene.Parent.minHeight(Parent.java:946) at javafx.scene.layout.Region.minHeight(Region.java:1 404) at javafx.scene.control.SkinBase.computeMinHeight(Ski nBase.java:254) at javafx.scene.control.Control.computeMinHeight(Cont rol.java:485) at javafx.scene.Parent.minHeight(Parent.java:946) at javafx.scene.layout.Region.minHeight(Region.java:1 404) at javafx.scene.layout.Region.computeChildMinAreaHeig ht(Region.java:1700) at javafx.scene.layout.Region.getMaxAreaHeight(Region .java:1981) at javafx.scene.layout.Region.computeMaxMinAreaHeight (Region.java:1850) at javafx.scene.layout.HBox.computeMinHeight(HBox.jav a:419) at javafx.scene.Parent.minHeight(Parent.java:946) at javafx.scene.layout.Region.minHeight(Region.java:1 404) at javafx.scene.layout.AnchorPane.computeHeight(Ancho rPane.java:297) at javafx.scene.layout.AnchorPane.computeMinHeight(An chorPane.java:246) at javafx.scene.Parent.minHeight(Parent.java:946) at javafx.scene.layout.Region.minHeight(Region.java:1 404) at javafx.scene.layout.Region.computeChildMinAreaHeig ht(Region.java:1700) at javafx.scene.layout.Region.getMaxAreaHeight(Region .java:1981) at javafx.scene.layout.Region.compute…
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25229399
downvote count: 0

http://stackoverflow.com/a/21763839
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21763805
score: 1
has body: make your class implements Serializable interface and don't forgot to add serialversionuid
has comment: http://stackoverflow.com/comment/32923073
upvote count: 1

http://stackoverflow.com/q/21761793
has comment: http://stackoverflow.com/comment/32918998
has body: First of all, I have this interface: public interface GeometricFigureInterface extends Comparable { double getArea(); TreeSet&lt;?&gt; getByText(String text); @Override public int compareTo(Object o); } And then a Rectangle public class Dreptunghi implements GeometricFigureInterface { private double x1; private double y1; private double x2; private double y2; public Dreptunghi() { super(); } public Dreptunghi(double x1, double y1, double x2, double y2) { super(); this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } @Override public double getArea() { return Math.sqrt(Math.pow(x1 - y2, 2) + Math.pow(x2 - y2, 2)); } And i have a method that reads from a text the coordonates @Override public TreeSet&lt;Dreptunghi&gt; getByText(String text) { String file ="D:/FiguriGeometrice.txt"; BufferedReader br = null; TreeSet&lt;Dreptunghi&gt; setDreptunghiuri = new TreeSet&lt;Dreptunghi&gt;(); Dreptunghi d = new Dreptunghi(); try { String line = ""; FileReader fr = new FileReader(file); br = new BufferedReader(fr); while ((line = br.readLine()) != null) { String[] s = line.split(" "); if (s[0].equals("D")) { d.setX1(Double.parseDouble(s[1])); d.setY1(Double.parseDouble(s[2])); d.setX2(Double.parseDouble(s[3])); d.setY2(Double.parseDouble(s[4])); //HERE is my problem when I add this the compareToMethod is called but the objects are the same and i end up with only one object regardless of the values setDreptunghiuri.add(d); } } } catch (Exception e) { .... } return setDreptunghiuri; } @Override public int compareTo(Object o) { Dreptunghi d = (Dreptunghi)o; if(this.getX1() == d.getX1()) return 0; return 1; }
has comment: http://stackoverflow.com/comment/32919221
score: 0
has comment: http://stackoverflow.com/comment/32918841
has comment: http://stackoverflow.com/comment/32939909
has comment: http://stackoverflow.com/comment/32940181
tagged with: treeset
has comment: http://stackoverflow.com/comment/32918713
type: Question
has comment: http://stackoverflow.com/comment/32920009
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32918860
tagged with: java
has title: TreeSet -> Override compareTo in Java
tagged with: comparable
answer count: 1
has answer: http://stackoverflow.com/a/21761838
accepted answer: http://stackoverflow.com/a/21761838

http://stackoverflow.com/a/36864447
has body: IMHO the problem is quite easy if the dimension n of your vector is odd. Then d = (n -1)/2 is prime with n and you just have to build a star polygon (d, n)(see stars polygons or stellation on wikipedia). Same thing is to add the distance d (modulo n). If the dimension is even and if d = n/2 - 1 is prime with n, same method. More complications if not. But I confess that it is the solution of the circular problem (where the distance among the last element and the first one is also taken in account). Example : for 1 à 9, distance 4, we obtain : 1,5,9,4*,8,3*,7,2*,5 (* 4 = 13 (modulo 9), id for the others *). The distance is constant and max (in the circular point of view), Brg
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21780320

http://stackoverflow.com/comment/33090540
type: Comment
has text: Do any triggers fire when you run this update? E.g. triggers that might [raise an error](https://groups.google.com/forum/#!topic/jooq-user/Rzj96HIliBo)?
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21757191

http://stackoverflow.com/a/21698729
downvote count: 0
type: Answer
has body: You can remove the if else and directly return the following way. return createdDate.after(fromDateCal) &amp;&amp; createdDate.before(toDateCal); You if and else are redundant
answers question: http://stackoverflow.com/q/21698692
upvote count: 1
score: 1

http://stackoverflow.com/q/21796549
has answer: http://stackoverflow.com/a/21796569
has comment: http://stackoverflow.com/comment/32981558
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21797096
tagged with: java
has title: Getting the ping results using java
type: Question
answer count: 2
tagged with: jsp
has body: I'm trying to get the last line of the ping result. I'm not a java developer. I'm learning so please bear my mistakes. This is the program I have written. private static String pingTest(String ip) { // TODO Auto-generated method stub String pingResult = ""; // System.out.println("Came in pingTest"); String pingCmd = "ping -c 3 " + ip; try { Runtime r = Runtime.getRuntime(); Process p = r.exec(pingCmd); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { System.out.println(inputLine); pingResult += inputLine; } in.close(); } catch (IOException e) { System.out.println(e); } return pingResult; I'm getting the result as follows: PING google.com (74.125.236.165) 56(84) bytes of data.64 bytes from maa03s16-in-f5.1e100.net (74.125.236.165): icmp_req=1 ttl=52 time=20.5 ms64 bytes from maa03s16-in-f5.1e100.net (74.125.236.165): icmp_req=2 ttl=52 time=11.4 ms64 bytes from maa03s16-in-f5.1e100.net (74.125.236.165): icmp_req=3 ttl=52 time=19.6 ms--- google.com ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2002msrtt min/avg/max/mdev = 11.494/17.252/20.579/4.089 m Its ot properly formatted. how to add line breaks? Well. what I really want is something like this. Only the last line. rtt min/avg/max/mdev = 20.774/20.962/21.085/0.135 ms and I want to show the values of min,avg,max values in my jsp page. Please guide me.
score: 0

http://stackoverflow.com/comment/32888465
comment on: http://stackoverflow.com/q/21744429
score: 0
type: Comment
type: QuestionComment
has text: is there a requirement that you cannot use oracle jdk instead of GNU java?

http://stackoverflow.com/comment/32983135
comment on: http://stackoverflow.com/a/21797718
score: 0
type: AnswerComment
has text: Ya whats wrong with that? Im sorry I dont get it. as per the link u shared, thr shudnt be space either before or after <?xml and utf-8"?>
type: Comment

http://stackoverflow.com/comment/32829470
type: Comment
type: QuestionComment
has text: Okay -if there is no ability to implement a listener for the system UI -that was the answere i was afraid of. But thank you for the clearification!!
comment on: http://stackoverflow.com/q/21711286
score: 0

http://stackoverflow.com/comment/32990989
score: 0
has text: only with a crystal ball to know
comment on: http://stackoverflow.com/q/21802174
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32820410
type: AnswerComment
comment on: http://stackoverflow.com/a/21698613
has text: Unfortunately, my short term problems aren't over yet either. New question here: http://stackoverflow.com/questions/21706565/jax-ws-unmarshals-empty-objects-when-in-an-osgi-environment
type: Comment
score: 0

http://stackoverflow.com/q/21710468
score: 0
tagged with: watchmaker
answer count: 1
has title: getting started with watchmaker api
type: UnansweredQuestion
tagged with: evolutionary-algorithm
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21752668
has body: I am new to Watchmaker framework and interested to build a most basic genetic algorithm solver for tsp to understand how it works and further explore. I have a distance matrix of cities already where each element would be the distance between the city of rowth index and city of column index (diagonal elements will be zero as it will be distance between same cities). I would like to generate few hundreds of initial population, calculate fitness function, take two of best that yields min of fitness function, produce children and so on.. (the basic routine) My question is, is my distance matrix enough to be fed as initial population? is it in correct format? which objects should I use for generating initial population? Technology: Netbeans 7.4 on Ubuntu 12.10 running OpenJDK 1.7 . Planning to add the jar file in the library of my project . Input file (distance matrix) in csv form . Right now, I am merely curious to see the output of generating initial population. I've not used Java API extensively so correct me if I have asked anything wrong.

http://stackoverflow.com/comment/32787312
has text: Trigonometric functions. And some graphics code, of course.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21687782

http://stackoverflow.com/comment/32822620
has text: That should be `enum A implements MyInterface`
type: Comment
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/21707681

http://stackoverflow.com/comment/32780268
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21683904
has text: You mean that you are using a kind of FileChooser and when the user select the file you want to open it? `Desktop.getDesktop().open(myFile);` this may help

http://stackoverflow.com/a/21789695
has comment: http://stackoverflow.com/comment/32969341
score: 12
upvote count: 12
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21789190
has body: By doing this: scroll.getViewport().add(paneel2,null); You're trying to add a component to the scroll pane's JViewPort shown in the picture below: This makes no sense. As stated in How to Use Scroll Panes trial: A JScrollPane provides a scrollable view of a component. This single component is the view port's view. So if you want to have more than a single component in your scroll pane you must to wrap all those components in a lightweight component such as JPanel and set this one as the scroll pane's view port view: JPanel content = new JPanel(); content.add(label); content.add(paneel2); scroll.setViewportView(content);
answers question: http://stackoverflow.com/q/21789190
type: AcceptedAnswer

http://stackoverflow.com/comment/96559486
has text: @RoyLee, `start + (end - start) / 2` avoids overflows.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26693627

http://stackoverflow.com/comment/32846761
type: QuestionComment
has text: Sorry for incomplete question. But the result of the division is not in decimal.
comment on: http://stackoverflow.com/q/21721242
score: 0
type: Comment

http://stackoverflow.com/comment/33030602
type: Comment
type: QuestionComment
has text: Nope, there are no warnings or errors or anything out of the ordinary in the log, even at TRACE logging level.
comment on: http://stackoverflow.com/q/21706565
score: 0

http://stackoverflow.com/q/21729093
has comment: http://stackoverflow.com/comment/32860356
has title: Start Activity of 2nd app from 1st app in android
tagged with: java
has answer: http://stackoverflow.com/a/21729368
tagged with: android-intent
type: Question
possible better answer: http://stackoverflow.com/a/21729368
has comment: http://stackoverflow.com/comment/32860047
tagged with: runtime-error
score: 0
answer count: 2
has body: I am new to android development. I am trying to start an activity of 2nd app from 1st app on button click. But my app gets stopped. i might be doing something wrong with the intent. This is the LOGCAT: 02-12 18:06:50.948: D/gralloc_goldfish(1247): Emulator without GPU emulation detected. 02-12 18:07:02.338: D/AndroidRuntime(1247): Shutting down VM 02-12 18:07:02.338: W/dalvikvm(1247): threadid=1: thread exiting with uncaught exception (group=0xb3ad1b90) 02-12 18:07:02.528: E/AndroidRuntime(1247): FATAL EXCEPTION: main 02-12 18:07:02.528: E/AndroidRuntime(1247): Process: smd.homework1.question2, PID: 1247 02-12 18:07:02.528: E/AndroidRuntime(1247): java.lang.IllegalStateException: Could not execute method of the activity 02-12 18:07:02.528: E/AndroidRuntime(1247): at android.view.View$1.onClick(View.java:3814) 02-12 18:07:02.528: E/AndroidRuntime(1247): at android.view.View.performClick(View.java:4424) 02-12 18:07:02.528: E/AndroidRuntime(1247): at android.view.View$PerformClick.run(View.java:18383) 02-12 18:07:02.528: E/AndroidRuntime(1247): at android.os.Handler.handleCallback(Handler.java:733) 02-12 18:07:02.528: E/AndroidRuntime(1247): at android.os.Handler.dispatchMessage(Handler.java:95) 02-12 18:07:02.528: E/AndroidRuntime(1247): at android.os.Looper.loop(Looper.java:137) 02-12 18:07:02.528: E/AndroidRuntime(1247): at android.app.ActivityThread.main(ActivityThread.java:4998) 02-12 18:07:02.528: E/AndroidRuntime(1247): at java.lang.reflect.Method.invokeNative(Native Method) 02-12 18:07:02.528: E/AndroidRuntime(1247): at java.lang.reflect.Method.invoke(Method.java:515) 02-12 18:07:02.528: E/AndroidRuntime(1247): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777) 02-12 18:07:02.528: E/AndroidRuntime(1247): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) 02-12 18:07:02.528: E/AndroidRuntime(1247): at dalvik.system.NativeStart.main(Native Method) 02-12 18:07:02.528: E/AndroidRuntime(1247): Caused by: java.lang.reflect…
tagged with: android
has comment: http://stackoverflow.com/comment/32860327
has comment: http://stackoverflow.com/comment/32860045
has answer: http://stackoverflow.com/a/21729200
accepted answer: http://stackoverflow.com/a/21729200
type: AnsweredQuestion

http://stackoverflow.com/comment/59666828
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21709219
has text: See http://stackoverflow.com/questions/10380835/is-it-ok-to-use-gson-instance-as-a-static-field-in-a-model-bean-reuse

fractions
type: Tag
tags question: http://stackoverflow.com/q/21793169
tag name: fractions

http://stackoverflow.com/q/21820476
has answer: http://stackoverflow.com/a/21821064
tagged with: overloading
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33023902
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/21820626
accepted answer: http://stackoverflow.com/a/21820626
has comment: http://stackoverflow.com/comment/33023917
answer count: 2
has title: How to implement overload methods to identify variables correctly
has comment: http://stackoverflow.com/comment/33023853
possible better answer: http://stackoverflow.com/a/21821064
tagged with: int
score: 0
has comment: http://stackoverflow.com/comment/33023897
has body: I've been working on my project for about 15 hours straight and I ran out of ideas and am in desperate need of some help. I have looked at tutorials and books, but i cannot figure it out. My main problem is that i cannot understand/calculate how i can use an overload method to choose between an int or a double. To explain I'm trying to get my program to use user input to convert the value to either int to a double (or vice-versa) and store the result to show the correct answers. Instead of just leaving it as double I'm trying to get the variation for each possibility. The reason I'm trying to do so is as follows (i know the code doesn't need it but the assignment requires i do so in this way but I keep hitting dead ends) : Here’s where the overloading comes in: some applications will define the amount as an int, and others will define it as a double. Therefore, you need to write two overloaded versions of this method: Get user input only once. If you convert the input value for the amount loaned to an int and store it in an int variable, you can then convert the value of this int to a double and store the result of this conversion in a double variable. The use of cast operators to either convert int values to double or double values to int.
has comment: http://stackoverflow.com/comment/33023884
linked to: http://stackoverflow.com/q/10280520
tagged with: double
linked to: http://stackoverflow.com/q/9898512

http://stackoverflow.com/q/21833844
type: Question
has comment: http://stackoverflow.com/comment/33046878
answer count: 1
has title: google map android API V2 failure
has comment: http://stackoverflow.com/comment/33047279
upvote count: 1
tagged with: permissions
favorite count: 0
has answer: http://stackoverflow.com/a/21833880
type: UnansweredQuestion
tagged with: android
tagged with: maps
has body: Trying to add a Map into an Android application, I already created the API key and enabled Google Map Android V2; I added the permission, the google play services version and the API key in the manifest file. I also added the Google Plays Services lib in the project. But when I launch the application it stops, I don't know why, I think it's something that has to do with the permissions, but just to make sure, I copy/Past the permissions as suggested by the Google Developpers website showing us how to add the map. But like I said, I'm not sure if this si the real deal. Here's my codes: Manifest file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="usthb.appusthb" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" /&gt; &lt;!-- ============ PERMISSIONS: ============ --&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/&gt; &lt;!-- The following two permissions are not required to use Google Maps Android API v2, but are recommended. --&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt; &lt;!-- ============ END PERMISSIONS =============== --&gt; &lt;!-- this will notify the user that the device needs OpenGL ES version 2 to display the map (as recomanded from the google developpers website)--&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="@android:style/Theme.Black.NoTitleBar…
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/21716150
has body: public class DProb{ needs to be public class dProb{ The most likely reason for this is your .java file is called dProb.java. The class name and file name must match!
type: Answer
has comment: http://stackoverflow.com/comment/32838330
answers question: http://stackoverflow.com/q/21716081
score: 0
has comment: http://stackoverflow.com/comment/32838286

http://stackoverflow.com/a/21803546
has body: You can get a RenderedImage directly, without saving to a file: private RenderedImage getImage(HtmlImage image) throws IOException { ImageReader reader = image.getImageReader(); int minIndex = reader.getMinIndex(); return reader.read(minIndex); } Here is a working example: package org.human.joecoder.htmlunit; import java.awt.image.RenderedImage; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.List; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlImage; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class HtmlUnitImageScraper { public static void main(String[] args) throws Exception { WebClient webClient = new WebClient(); HtmlPage currentPage = (HtmlPage) webClient.getPage(new URL( "http://www.google.com")); final List&lt;?&gt; images = currentPage.getByXPath("//img"); for (int i = 0; i &lt; images.size(); i++) { Object imageObject = images.get(i); HtmlImage image = (HtmlImage) imageObject; RenderedImage buf = getImage(image); ImageIO.write(buf, "png", new File("image_"+i+".png")); } webClient.closeAllWindows(); } private static RenderedImage getImage(HtmlImage image) throws IOException { ImageReader reader = image.getImageReader(); int minIndex = reader.getMinIndex(); return reader.read(minIndex); } }
score: 1
answers question: http://stackoverflow.com/q/21802990
type: Answer
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/21833258
downvote count: 0
type: Answer
upvote count: 1
has body: Turn On sql logging by show-sql=true and see if the update query has the required where clause where version = ? If such where clause is missing then you need to add annotation @org.hibernate.annotations.Entity(dynamicUpdate = true)
has comment: http://stackoverflow.com/comment/33053074
answers question: http://stackoverflow.com/q/21832573
score: 1
has comment: http://stackoverflow.com/comment/33054057
has comment: http://stackoverflow.com/comment/33051181

http://stackoverflow.com/comment/32963136
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21786548
score: 0
has text: @yshavit i have most difficulty in getting points 5 and 6. As all the Java 8 blogs says just that "use this new `parallelStream()` and you will get parallel processing??", my question in one sentence would have been is that really correct all the time? thanks

http://stackoverflow.com/comment/32952710
comment on: http://stackoverflow.com/a/21780468
score: 0
type: AnswerComment
has text: Exactly :) I added an example. You could have also multiple classes in that package, just make sure that no other classes in that module (I hope you control it and no one will have the bad idea to manipulate it from other classes of that package).
type: Comment

getmethod
tag name: getmethod
tags question: http://stackoverflow.com/q/21838379
type: Tag

jmx
tags question: http://stackoverflow.com/q/21765678
tags question: http://stackoverflow.com/q/21786111
tag name: jmx
tags question: http://stackoverflow.com/q/21738145
type: Tag

http://stackoverflow.com/a/21694612
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32800018
answers question: http://stackoverflow.com/q/21694216
has comment: http://stackoverflow.com/comment/32799903
type: Answer
has body: You can also use regex to select the required elements in from your web page using jsoup too, there you can use and 'OR' condition to specify what you are looking for; Example: Elements e = d.select("span[class~=(?i)(bld lrg red|price)]"); The above regex would select your span elements with classselector directly matching bld lrg red OR price (case insensitive). Refer to here for details: http://jsoup.org/apidocs/org/jsoup/select/Selector.html Now you may want to iterate over the elements and select which are not blank, null, both and so on. EDIT: As per the comments, price class is not held by a span element. To get over it, you can use: Elements e = d.select("span[class=bld lrg red],del[class=price]");
score: 3
has comment: http://stackoverflow.com/comment/32801146
upvote count: 3
has comment: http://stackoverflow.com/comment/32799817
has comment: http://stackoverflow.com/comment/32800531
has comment: http://stackoverflow.com/comment/32801515
accepted answer of: http://stackoverflow.com/q/21694216

http://stackoverflow.com/comment/32772421
score: 1
type: QuestionComment
has text: I'm not sure you can qualify a column as you've done with "? as gm.message_id". When I take your query into [sqlfiddle](http://sqlfiddle.com/#!4/4992b) and change this to a hardcoded value, then the "FROM keyword" error goes away, so I suspect this is your problem.
comment on: http://stackoverflow.com/q/21679085
type: Comment

http://stackoverflow.com/a/21818115
score: 1
upvote count: 1
has body: I have to disagree with the principle implied by most of the answers that the order does not affect performance. Of course in a very small case like this, with only 50 people and 200 gifts, the difference is negligible. But consider a more extreme case with 2 people and 1,000,000 gifts. In Option A, the people variable changes value twice and the gifts variable changes value 2 million times. Total number of variable assignments 1,000,002. In Option B, the gifts variable changes value 1 million times and the people variable changes value 2 million times. Total number of variable assignments 3,000,000. It may be true that the same computational work is done inside the nested loops in both options, but the computational house-keeping to manage the nested loops differs. Even putting aside the optimisation that might be achieved by breaking out of the loop early depending on gift acceptance, performance will be improved by having the variable with fewer values as the outer loop.
answers question: http://stackoverflow.com/q/21811192
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32960111
comment on: http://stackoverflow.com/q/21779537
has text: that could be true, but I dont have a clue how to fix this. I havn`t touched the pom since the autogenerate.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/21738205
type: Question
has comment: http://stackoverflow.com/comment/32877095
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/21738609
answer count: 1
has title: Java Reflection/BeanUtils issue
tagged with: javabeans
has comment: http://stackoverflow.com/comment/32877155
accepted answer: http://stackoverflow.com/a/21738609
type: AnsweredQuestion
has body: I'm trying to populate a bean with some table driven attribute:value pairs. I retrieve them from a MySQL table, and populate a hashmap just fine. I iterate through the hashmap, and if I use PropertyUtils.setProperty() I get a "Class does not have setter for *" error. If I use BeanUtils.setProperty() the bean never gets populated. Here's the sample: public class DBDrivenPayloadHandler extends GDE{ DbDrivenPayloadHandlerBean bean; @SuppressWarnings("rawtypes") public void populateBean() throws Exception { ITransaction trans = new MySQLTransaction(); IAdapterDataMapDAO adapterDataMap = new MySQLAdapterDataMapDAO(); adapterDataMap.setTransaction(trans); HashMap&lt;String, String&gt; values = adapterDataMap.getHashMap(super.getCurrentAccountId()); //hashmap gets populated correctly with correct variable names and values != "-1"; DbDrivenPayloadHandlerBean bean = new DbDrivenPayloadHandlerBean(); //We have a bean with all the intialized variable values Iterator it = values.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry)it.next(); try { PropertyUtils.setProperty(bean, (String) entry.getKey(), entry.getValue()); //PropertyUtils will give a setter not found error. BeanUtils never sets the values. } catch (Exception e) { e.printStackTrace(); } } } public void getInfo(String fileName) { try { populateBean(); } catch (Exception e) { e.printStackTrace(); } APPTS_FULLNAME_POS = bean.getAPPTS_FULLNAME_POS(); APPTS_DATETIME_POS = bean.getAPPTS_DATETIME_POS(); //Both still -1; super.getInfo(filename); } And here's the Bean (or at least some of it): public class DbDrivenPayloadHandlerBean { int APPTS_FULLNAME_POS = -1; int APPTS_DATETIME_POS = -1; public DbDrivenPayloadHandlerBean() { super(); } public int getAPPTS_FULLNAME_POS() { return APPTS_FULLNAME_POS; } public void setAPPTS_FULLNAME_POS(String APPTS_FULLNAME_POS) { this.APPTS_FULLNAME_POS = Integer.parseInt(APPTS_FULLNAME_POS); } public int getAPPTS_DATETIME_POS() { return APPTS_DATETIME_POS; } publ…
tagged with: reflection
has comment: http://stackoverflow.com/comment/32877292
has comment: http://stackoverflow.com/comment/32877154

http://stackoverflow.com/comment/33021306
has text: what's the code for the servlet?
comment on: http://stackoverflow.com/q/21812352
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33021631
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21818100
has text: Hey I tried your method and tried to have it just print the array for me and all I got as output was [LPerson;@a51064e To print out the array all I have to do is System.out.println(people); right? Thanks!!

http://stackoverflow.com/comment/32922746
score: 0
comment on: http://stackoverflow.com/q/21763720
type: Comment
type: QuestionComment
has text: What's `status.getCreatedAt()` exactly? You need to explain problem a little bit better. Give us more information.

http://stackoverflow.com/q/21751956
type: Question
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/21752071
has answer: http://stackoverflow.com/a/21752071
score: 0
has comment: http://stackoverflow.com/comment/32901495
has answer: http://stackoverflow.com/a/21752201
has comment: http://stackoverflow.com/comment/32901310
linked to: http://stackoverflow.com/q/21480634
favorite count: 0
has answer: http://stackoverflow.com/a/21752318
has answer: http://stackoverflow.com/a/21752506
has comment: http://stackoverflow.com/comment/32901416
answer count: 5
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21752409
tagged with: java
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/21752318
has body: I am working with webservice in an android app. I could not parse the following response in app. it always gives the org.json.JSONException: Value [{"METER_READING":"15","UTILITY_PLAN":"1","uname":"vinayak@triffort.com","kwh_usage":"3","meter_reading_date":"02-13-2014","ESID":"abc","METER_ID":"abc100"}] at data of type java.lang.String cannot be converted to JSONArray. Below is my code: StringEntity entity = new StringEntity(jsonObject.toString(), HTTP.UTF_8); httpPost.setEntity(entity); HttpResponse response = httpClient.execute(httpPost); BufferedReader reader =new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8")); String jsonResultStr = reader.readLine(); JSONObject jObject = new JSONObject(jsonResultStr); JSONArray jArray = jObject.optJSONArray("data"); I get following response from webservice {"data":"[{\"METER_READING\":\"25\",\"UTILITY_PLAN\":\"1\",\"uname\":\"vinayak@triffort.com\",\"kwh_usage\":\"9\",\"meter_reading_date\":\"02-13-2014\",\"ESID\":\"abc\",\"METER_ID\":\"abc100\"}]"}
has title: How to parse following json response in android app

http://stackoverflow.com/comment/32975708
type: Comment
has text: BatchUpdateException is caught should we catch the SQLException also. Is this required?.
type: AnswerComment
comment on: http://stackoverflow.com/a/21793437
score: 0

http://stackoverflow.com/comment/32872333
comment on: http://stackoverflow.com/q/21735721
has text: Check the code again, it has a defect.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21719164
downvote count: 0
answer count: 1
tagged with: jpa-2.0
favorite count: 0
has title: JPA Embeddable can have ElementCollection<Embeddable> property
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21719449
tagged with: orm
has body: can JPA ElementCollection Embeddable have ElementCollection List Embeddable property? @Entity class Person { @ElementCollection private List&lt;Address&gt; addressList; } @Embeddable public class Address { private String city; private String state; private String countary; @ElementCollection private List&lt;Phone&gt; phones; ... } @Embeddable public class Phone { private String type; private String areaCode; private String number; ... }
type: Question
tagged with: jpa
has answer: http://stackoverflow.com/a/21719449
upvote count: 1

http://stackoverflow.com/a/21735545
has comment: http://stackoverflow.com/comment/32872935
answers question: http://stackoverflow.com/q/21735427
accepted answer of: http://stackoverflow.com/q/21735427
has comment: http://stackoverflow.com/comment/32873437
has comment: http://stackoverflow.com/comment/32873410
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32873380
has comment: http://stackoverflow.com/comment/32872216
has comment: http://stackoverflow.com/comment/32872621
has comment: http://stackoverflow.com/comment/32873074
has comment: http://stackoverflow.com/comment/32873005
has comment: http://stackoverflow.com/comment/32873664
type: Answer
has comment: http://stackoverflow.com/comment/32875845
has body: input.read(buffer) will block until data is received. If the stream is closed, it will return -1 as you are testing for. But, since the stream is still open and is waiting for data to arrive, it'll block. Since you did update your question, I will update my answer. Closing a stream is not the same as terminating a TCP session. Closing a stream will put the connection into FIN_WAIT_1 or FIN_WAIT_2 and it needs to finish and reset to be fully closed. You need to tell your server that you're shutting down your client and then shut down, or tell the client you're shutting down the server, and then close. Basically, both sides need to close when they wish to terminate the connection. Closing also may, depending on your environment, not even do anything but release references. In most implementations of low level socket APIs, you have socket_shutdown(2) which actually sends the FIN TCP packet for a mutual shutdown initiation. Basically both parties need to close, or the connection will be stuck in a waiting state. This is a defined behavior in various RFCs. An explanation can be found here. From the post I linked, you can review the diagram here.

http://stackoverflow.com/comment/32960941
has text: Ok Since Posix/Unix ignore the leap seconds in the representaion of num Millis from EPOCH (1970). The value asumes a year with exact 86400s. So everything is fine unless doing astronomical calculations.
comment on: http://stackoverflow.com/a/21783466
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/32877292
type: QuestionComment
has text: Not possible. The attribute values table will need to accomodate strings. Therefore, all booleans and ints will need to be parsed out.
score: 0
comment on: http://stackoverflow.com/q/21738205
type: Comment

http://stackoverflow.com/q/21829477
has comment: http://stackoverflow.com/comment/33038940
answer count: 2
has title: Java scentific date hanlding
has comment: http://stackoverflow.com/comment/33049061
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21829577
has comment: http://stackoverflow.com/comment/33038879
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33039047
upvote count: 3
type: Question
accepted answer: http://stackoverflow.com/a/21829577
score: 3
possible better answer: http://stackoverflow.com/a/21859704
has body: My question is how should a Date be handled when we want to store dates since the birth of earth until end of earth (expected to be at 100000000000000000000-12-31 23:59:00.0000 +1 ). I am sure some scientists have libraries for Dates like these. Since Joda-Time is also using a long for internal storage it is out of scope. Developing a calender from scratch could be difficult since we have to handle all the special cases like switching from julian to gregorian calendar and leap years/seconds ...
has answer: http://stackoverflow.com/a/21859704
has comment: http://stackoverflow.com/comment/33049232
tagged with: java
tagged with: date

http://stackoverflow.com/q/21717082
type: Question
has title: Lottery - guess correct number
tagged with: if-statement
has comment: http://stackoverflow.com/comment/32839988
has comment: http://stackoverflow.com/comment/32840250
has comment: http://stackoverflow.com/comment/32840128
has comment: http://stackoverflow.com/comment/32840219
score: 0
tagged with: random
answer count: 1
has comment: http://stackoverflow.com/comment/32840333
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32840140
has answer: http://stackoverflow.com/a/21717101
has comment: http://stackoverflow.com/comment/32840083
has comment: http://stackoverflow.com/comment/32840107
tagged with: java
has body: Scanner input = new Scanner(System.in); Random random = new Random(); System.out.print("Enter a number u wish(1-1000): "); int unos = input.nextInt(); int rand = random.nextInt(1000) + 1; System.out.println(rand); if (unos = random) { System.out.printf("Congratz u won"); } while (unos &lt; rand) { System.out.println("Your number is lower \t Try again: "); unos = input.nextInt(); } while (unos &gt; rand) { System.out.println("Your number is higher\t Try again: "); unos = input.nextInt(); } So, if I hit numbers that aren't equal to the randomly generated number it works, but once I hit, it doesn't output "Congratz u won". It just terminates. Why? import java.util.Scanner; import java.util.Random; public class Lutrija { public static void main(String []args){ Scanner input = new Scanner(System.in); Random random = new Random(); System.out.print("Uneti broj koji mislite da ce ispasti(1-1000): "); int unos=input.nextInt(); int rand =random.nextInt(1000)+1; System.out.println(rand); while (unos!=rand){ if(unos==rand){ System.out.println("Congratz"); } else if (unos&gt;rand){ System.out.println("broj je veci od izvucenog"); unos=input.nextInt(); } else if (unos&lt;rand){ System.out.println("broj je manji od izvucenog"); unos=input.nextInt(); } } } } This doesn't work, why?

http://stackoverflow.com/comment/32931516
type: QuestionComment
has text: The same happens with `HashSet` which uses a `HashMap` under the hood.
score: 0
comment on: http://stackoverflow.com/q/21750004
type: Comment

http://stackoverflow.com/a/21703298
has comment: http://stackoverflow.com/comment/32816176
downvote count: 0
has body: A static abstract method makes no sense, since the notion that an abstract method should be implemented by an extending class (which is part of OO), and static denotes a non instance method (not OO). But I had a similar problem in a J2EE project recently, in which the library needed some specific configuration depending on the project that used it. What we decided to do is to have a configuration file with a specific name in the project, that the library should read as soon as loaded. If the file and/or the required configurations were not found, an exception is thrown (you can create your own). I think this way you can decouple implementation of the library from the projects using it.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21703003
type: Answer

http://stackoverflow.com/a/21819525
has comment: http://stackoverflow.com/comment/33022007
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33022050
has comment: http://stackoverflow.com/comment/33022000
type: Answer
has body: Create a new, custom class loader... URLClassLoader cl = new URLClassLoader( new URL[]{new File("Path/to/Project/mal.jar").toURI().toURL()} ); Load the class from the class loader... Class clazz = cl.loadClass("Mal.MalClass"); Create a new instance of the class... Object obj = clazz.newInstance(); Now. You have a problem. Unless the Class you've just loaded implements a interface which is common to both projects, you won't be able to resolve the instance of the Class to an actual type, as the type would be unknown at compile time. Instead, you would be forced to use reflection, which is never pretty...
accepted answer of: http://stackoverflow.com/q/21819278
has comment: http://stackoverflow.com/comment/33021974
answers question: http://stackoverflow.com/q/21819278
has comment: http://stackoverflow.com/comment/33022036

http://stackoverflow.com/comment/32816768
has text: yes you are right, i don't know why i don't think about modal. thank you.
comment on: http://stackoverflow.com/a/21703162
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32876296
has text: Do you mean `new Thread(new EvenCheckerRunnable(even)).start()` or `new EvenCheckerThread(even).start()`? `EvenCheckerThread` does extend `Thread` so it shouldn't need to be passed into *another* thread. But the call to `start()` instead of `run()` is critical.
comment on: http://stackoverflow.com/a/21737609
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26907642
type: Answer
score: 6
downvote count: 0
answers question: http://stackoverflow.com/q/21751954
has comment: http://stackoverflow.com/comment/56975051
upvote count: 6
has body: Just create wrapper methods for your current logger as: public static void info(Logger logger, Supplier&lt;String&gt; message) { if (logger.isLoggable(Level.INFO)) logger.info(message.get()); } and use it: info(log, () -&gt; "x: " + x + ", y: " + y); Reference: JAVA SE 8 for the Really Impatient eBook, pages 48-49.
has comment: http://stackoverflow.com/comment/55369897

http://stackoverflow.com/q/21770919
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/21770958
accepted answer: http://stackoverflow.com/a/21770958
has title: Sorting data file by number of vowels
has answer: http://stackoverflow.com/a/21771189
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/32935582
answer count: 3
possible better answer: http://stackoverflow.com/a/21771189
has answer: http://stackoverflow.com/a/21770965
downvote count: 1
has body: Sort all words by comparing the number of vowels that each word contains. The word with the fewest number of vowels would come first. If you have more than one word with the same number of vowels, that group would be sorted alphabetically. I believe that I have most of the project completed, I just don't know why it's not working. public class Word implements Comparable&lt;Word&gt; { private String word; public Word(String s) { word = s; } private int numVowels() { String vowels = "AEIOUaeiou"; int vowelCount = 0; for (int i = 0; i &lt; vowels.length(); i++) { if ((vowels.charAt(i) == 'a') || (vowels.charAt(i) == 'e') || (vowels.charAt(i) == 'i') || (vowels.charAt(i) == 'o') || (vowels.charAt(i) == 'u')) { return vowelCount; } } return vowelCount; } public int compareTo(Word rhs) { for (int i = 0; i &lt; word.length(); i++) { if ((word.charAt(i) == 'a') || (word.charAt(i) == 'A')) { System.out.println(word); } else if ((word.charAt(i + 1) == 'e') || (word.charAt(i + 1) == 'E')) { System.out.println(word); } } return -1; } public String toString() { return word; } } I think my error is in the compareTo method. I'm not sure. Would anyone be able to help me?
favorite count: 0

http://stackoverflow.com/q/21796019
tagged with: jakarta-ee
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32980402
downvote count: 3
tagged with: struts
type: Question
has answer: http://stackoverflow.com/a/21808599
answer count: 1
has title: what is the difference between moqui framework vs other frameworks
has comment: http://stackoverflow.com/comment/32980826
has comment: http://stackoverflow.com/comment/32980493
favorite count: 0
score: -1
upvote count: 2
has comment: http://stackoverflow.com/comment/32980713
has body: Hi Can you share what is the difference between Moqui framework vs other frameworks.Am the New of Moqui Framework.
accepted answer: http://stackoverflow.com/a/21808599
tagged with: moqui

http://stackoverflow.com/q/21717698
has body: If I have N bytes of data, how can I calculate the distinct combinations that are possible? My first thought was that since every byte is really just 8 bits, I should calculate the unique sets of bits possible. So I have put this together in Java: private void bytePossibilities(int numberOfBytes) { final int BITS_IN_A_BYTE = 8; final int numberOfBits = numberOfBytes * BITS_IN_A_BYTE; long totalPossibilities = 0; for (int i = 0; i &lt; (1 &lt;&lt; numberOfBits); i++) { int[] next = new int[numberOfBits]; for (int j = 1, a = 1; j &lt; (1 &lt;&lt; numberOfBits); j &lt;&lt;= 1, a++) { next[numberOfBits - a] = (i &amp; j) == 0 ? 0 : 1; } System.out.println(Arrays.toString(next)); totalPossibilities++; } System.out.println(totalPossibilities + " combinations found for "+ numberOfBytes +" bytes"); } Which seems to work... bytePossibilities(1) [0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 1] ...252 other combinations... [1, 1, 1, 1, 1, 1, 1, 0] [1, 1, 1, 1, 1, 1, 1, 1] 256 combinations found for 1 bytes bytePossibilities(2) [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, 1] ...65532 other combinations... [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0] [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] 65536 combinations found for 2 bytes So it seems that the distinct possibilities given N bytes of data is 2^(bytes*8). I just want to make sure I'm doing this correctly. It seems extreme that the odds that any 2 random bytes of data (next to each other) would be exactly the same is 1 in 65,536 and for any 3 bytes, 1 in 16,777,216. If anyone could shed more mathematical light on this, I'd appreciate it.
tagged with: byte
has answer: http://stackoverflow.com/a/21717772
has title: Calculate distinct bit-array possibilities given n bytes of data
tagged with: combinations
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21717772
possible better answer: http://stackoverflow.com/a/21717784
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/21717784
type: Question
score: 0
answer count: 2
tagged with: permutation

http://stackoverflow.com/a/21686023
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21685890
has body: Your program will not get to the else statement if any of the previous if's were true. So, you could use that to your advantage and leave out the following: yearlySalary &gt; 60000.00 &amp;&amp; if(yearlySalary &lt;= 60000.00) { salaryRank = 1; } else if(yearlySalary &lt;= 80000.00) { salaryRank = 2; } Also, doubles aren't particularly precise. They're floating point numbers, which means that you can't accurately hold the value of for instance 0.1. Look it up. BigDecimal is a better type to use with currency.
type: Answer
score: 2

http://stackoverflow.com/a/21711962
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32831252
has body: Choose 9 distinct (without replacement) values between 0 and 100. Sort them (if you use the solution in the thread I linked, they'll already be sorted), and use them as your interval boundaries. EDIT: If the ranges are allowed to be empty, don't even worry about uniqueness; just pick 9 random values, sort them, and you have your interval boundaries.
has comment: http://stackoverflow.com/comment/32831539
has comment: http://stackoverflow.com/comment/32832068
downvote count: 0
answers question: http://stackoverflow.com/q/21711864

http://stackoverflow.com/a/21817850
has body: The syntax you use is slightly wrong. public Sub(Str) should be public Sub(SomeTypeHere Str)
answers question: http://stackoverflow.com/q/21817822
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/117630777
has text: If you want to reverse the char array by words and not use extra memory, refer this approach. https://www.tutorialspoint.com/program-to-reverse-a-sentence-words-stored-as-character-array-in-cplusplus
comment on: http://stackoverflow.com/q/21811667
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21821844
has comment: http://stackoverflow.com/comment/33027227
has comment: http://stackoverflow.com/comment/33027507
has comment: http://stackoverflow.com/comment/33028168
type: Answer
has body: String concentrate = getIntent().getStringExtra("Intent"); Should be like this: double concentrate = getIntent().getExtras().getDouble("Intent"); Wrap the passed bundle directly into double.
downvote count: 0
has comment: http://stackoverflow.com/comment/33028426
score: 1
answers question: http://stackoverflow.com/q/21821763
upvote count: 1

http://stackoverflow.com/a/21810366
type: Answer
has body: The compiler first lists all applicable methods. In your case, both are applicable. It then tries to find a method which is more specific than the other(s). In your first example, String is a subclass of Object and is therefore more specific. In your second example, both methods are applicable (String and Integer) but neither is more specific than the other (String is not a subclass of Integer which is not a subclass of String). So there is an ambiguity, hence the compiler error. The full algorithm to determine which method should be chosen is defined in the JLS.
answers question: http://stackoverflow.com/q/21810334
upvote count: 19
accepted answer of: http://stackoverflow.com/q/21810334
score: 19
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21753005
possible better answer: http://stackoverflow.com/a/21753038
has answer: http://stackoverflow.com/a/21753038
type: Question
answer count: 2
tagged with: google-maps
has comment: http://stackoverflow.com/comment/32935502
has title: Could not see the map in a picture in Android using Map
accepted answer: http://stackoverflow.com/a/21754731
has comment: http://stackoverflow.com/comment/32902977
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/32902890
has comment: http://stackoverflow.com/comment/32903297
has comment: http://stackoverflow.com/comment/32904052
has answer: http://stackoverflow.com/a/21754731
has comment: http://stackoverflow.com/comment/32905567
has body: I am creating a location using a map Activity in android. Everything is fine on the map, but could not populate the location picture in the map. MY FULL CODE IS HERE http://pastebin.com/eTa1eSZe Edit: After adding V2 , I saw my deice like this: Output on My phone. I saw one like this: But it did not work in my app. Layout File: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey="AIzaSyCmEzF1MfGAdfddfddfdf4qyf_MkbyKnoSSNvbO1RFmM" /&gt; and AndroidManifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.maptest.googlemaps" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-permission android:name="com.example.googlemaps.permission.MAPS_RECEIVE" android:protectionLevel="signature" /&gt; &lt;uses-sdk android:minSdkVersion="12" android:targetSdkVersion="16" /&gt; &lt;!-- Maps API needs OpenGL ES 2.0. --&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true" /&gt; &lt;!-- End of copy. --&gt; &lt;!-- For Google Map --&gt; &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCmEzF1MfGAdfddfddfdf4qyf_MkbyKnoSSNvbO1RFmM" /&gt; &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; &lt;!-- Give Permission to AutoLife App --&gt; &lt;!-- for get the Device IMEI Number --&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="com.google.android.providers.g…
type: AnsweredQuestion
tagged with: java

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/21762909
tags question: http://stackoverflow.com/q/21836366
tags question: http://stackoverflow.com/q/21804478
tags question: http://stackoverflow.com/q/21815639
type: Tag
tags question: http://stackoverflow.com/q/21757091
tags question: http://stackoverflow.com/q/21807286

http://stackoverflow.com/comment/32832704
comment on: http://stackoverflow.com/q/21712919
score: 0
type: Comment
type: QuestionComment
has text: @user3299002 For the sake of argument, there are simple and practical solutions to this in certain instances, which is why I asked a very specific question about how large the set of numbers is, their range, and their type.

http://stackoverflow.com/q/21809188
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: animation
score: 2
has answer: http://stackoverflow.com/a/21809257
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21809303
type: Question
tagged with: graphics
tagged with: layout
has body: Good day, I would like to ask for some advice on coding up one pretty strange graphical element. The point is - there should be a button in the middle (green), but it should be surrounded with an animated element (blue strip around green button on a sketch). So when user clicks the button, the blue element starts rotating, when he taps again, it stops. any ideas on that? thanks!
has title: android complex graphic element
answer count: 2

http://stackoverflow.com/comment/32930473
type: AnswerComment
comment on: http://stackoverflow.com/a/21767483
type: Comment
has text: Thanks Jon. I might supply parameter only at initialization time, and after that I don't want to specify any parameter and just want to use `isLeader()` and `getClient()` method in all the classes.
score: 0

http://stackoverflow.com/comment/32849740
has text: Is `%645D5$64%64f&%DF` what you actually get when sending السلام?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21722979

http://stackoverflow.com/q/21753229
has comment: http://stackoverflow.com/comment/32903774
type: UnansweredQuestion
tagged with: classcastexception
has comment: http://stackoverflow.com/comment/32903537
has comment: http://stackoverflow.com/comment/32904066
upvote count: 1
has comment: http://stackoverflow.com/comment/32904046
linked to: http://stackoverflow.com/q/4043579
has title: ClassCastException and incompatible
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32903421
has answer: http://stackoverflow.com/a/21753507
type: Question
has comment: http://stackoverflow.com/comment/32903295
has answer: http://stackoverflow.com/a/21753535
has body: In a method I remember there was an error thrown at a line having the following code. java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Integer at Integer count = (Integer) result[1]; and I replaced the code to Integer count = ((BigDecimal) result[1]).intValue(); the error has gone. But some how I got the following error for the same code snippets in the new project. java.lang.ClassCastException: java.math.BigDecimal incompatible with java.lang.Integer Just wanted to know, both of these are the same or not.
downvote count: 0
has comment: http://stackoverflow.com/comment/32903874
answer count: 3
has comment: http://stackoverflow.com/comment/32903320
has answer: http://stackoverflow.com/a/21753772
favorite count: 0

http://stackoverflow.com/a/21774782
has comment: http://stackoverflow.com/comment/32968476
upvote count: 1
type: AcceptedAnswer
has body: If you use GridLayout with GridData on each item you can use: (GridData)data = (GridData)control.getLayoutData(); data.exclude = true; control.setVisible(false); to hide a control, when all controls are hidden use layout() on the parent composite. To show again reverse the exclude and setVisible calls.
type: Answer
answers question: http://stackoverflow.com/q/21769134
downvote count: 0
has comment: http://stackoverflow.com/comment/33022366
score: 1
accepted answer of: http://stackoverflow.com/q/21769134
has comment: http://stackoverflow.com/comment/32969326

http://stackoverflow.com/comment/32897236
has text: Try [Viola Jones Object Detection](http://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework)
comment on: http://stackoverflow.com/q/21748235
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21838707
has comment: http://stackoverflow.com/comment/33055709
score: 1
answers question: http://stackoverflow.com/q/21838565
has body: You never Call set visible any where, in fact, it's impossible to determine if your UI actually has a window to be displayed. If LoginUI extends from something like JFrame, the on you should call ... theLoginUI.pack(); theLoginUI.setVisible(true);
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33055786
downvote count: 0

http://stackoverflow.com/q/21805956
accepted answer: http://stackoverflow.com/a/21805978
tagged with: user-input
type: AnsweredQuestion
tagged with: java
has body: I'm trying to create a new object using a user input. I tried assigning the user input to variables but don't know how to add the variables to the new object in the when I declare the new object. This is just the part of my code that i need help with. part i need help with is line 8. i know i can just put something random and when i use my set methods it will overwrite but that's not what I want. thank you in advance Scanner input = new Scanner(System.in); System.out.println("Enter the name of the Soda: "); String soda = input.nextLine(); System.out.println("Inventory count?: "); int product = input.nextInt(); System.out.println("Cost of Soda?: "); double cost = input.nextDouble(); SodaMachine one = new SodaMachine(String soda, int product, double cost); one.setCostOfBottle(cost); one.setInventory(product); one.setNameOfSoda(soda);
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/21805978
has title: user input to create object
answer count: 1
score: 1
favorite count: 0

rampart
tags question: http://stackoverflow.com/q/21678550
type: Tag
tag name: rampart

http://stackoverflow.com/comment/32817534
has text: No problem. You select whichever you like most :) Good luck.
type: Comment
comment on: http://stackoverflow.com/a/21688520
score: 0
type: AnswerComment

http://stackoverflow.com/q/21771298
tagged with: logic
has comment: http://stackoverflow.com/comment/32936442
has comment: http://stackoverflow.com/comment/32936785
has comment: http://stackoverflow.com/comment/32936511
downvote count: 0
has comment: http://stackoverflow.com/comment/32936827
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/32936921
has comment: http://stackoverflow.com/comment/32936495
tagged with: performance
answer count: 0
has title: Performance bottleneck from simple logic?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32936487
has comment: http://stackoverflow.com/comment/32943253
type: Question
has body: I'm writing a simulation in Java and I have had a marked decrease in performance today. I used to be able to progress through my timesteps without waiting, but now there are several seconds of lag between timesteps. Through some experimentation I have found a particular line that, when commented out, cause the program to execute smoothly again. It is indicated in my code snippet below: public HashMap&lt;String, Gene&gt; childGenes(String parent, Axes axis, boolean daughter1){ HashMap&lt;String, Gene&gt; parentGenes = this.cells.get(parent).getGenes(); HashMap&lt;String, Gene&gt; childGenes = new HashMap&lt;String, Gene&gt;(); switch(axis){ case X: for(String s: parentGenes.keySet()){ Gene g = parentGenes.get(s); Compartment comp = g.getLocation().getAP(); /*commenting out this line increases performance*/ if((comp != Compartment.POSTERIOR &amp;&amp; daughter1) || (comp != Compartment.ANTERIOR &amp;&amp; !daughter1)){ childGenes.put(g.getName(), new Gene(g.getName(), g.getState(), g.getLocation()).populateCons()); } } break; //essentially identical cases for Y and Z here } return childGenes; } The hashmap has about 30 members, so this for loop will execute 30 times, and this method is called twice in quick succession for about a total of 60 runs. This still seems like small beans in computer terms, and it's not as though the if statement contains anything particularly calculation heavy - right? - but commenting out that single line increases performance like crazy. What could be going on? Thanks in advance.

http://stackoverflow.com/comment/32795193
comment on: http://stackoverflow.com/a/21692003
type: Comment
has text: I don't know what OP is asking. But you still need to start the loop at 1, not at 0.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33019664
type: QuestionComment
type: Comment
has text: After added `implements Serializable` nothing changed.
comment on: http://stackoverflow.com/q/21817809
score: 0

http://stackoverflow.com/comment/33029641
type: Comment
comment on: http://stackoverflow.com/q/21784801
type: QuestionComment
has text: I need to compare the AST nodes. Is there any other way to compare AST nodes?
score: 0

http://stackoverflow.com/q/21765260
has answer: http://stackoverflow.com/a/21770182
has body: In my activity I add to it some stuff by checking checkbox and if list.size()&gt;0 (this condition is in my adapter) shows up button which is redirecting me to second activity. In second activity I display listview filled with items from static list , when I click on it i delete object from list, also Ive made button in second activity which make this list.clear(); finish(); When I return to first activity i've still visible button even if static list was cleared. How to solve it ? I need the simplest ideas becouse i'm a beginner in android. All answers, suggestions, clues are wellcome. If you don't know how to do it, pop up thread. Thank you for your time. public class TowarAdapter extends ArrayAdapter&lt;Towar&gt; { private List&lt;Towar&gt; items; private Activity context; private int i = 0; ImageButton b_zatwierdz; int counter = 0; boolean user_checked = false; public int getI() { return i; } public void setI(int i) { this.i = i; } public TowarAdapter(Activity context, int resource, List&lt;Towar&gt; items, ImageButton b_zatwierdz) { super(context, resource); this.b_zatwierdz = b_zatwierdz; this.items = items; this.context = context; } public int getCount() { // TODO Auto-generated method stub return items.size(); } @Override public Towar getItem(int position) { // TODO Auto-generated method stub return items.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } static class ViewHolder { TextView tvNazwaT; TextView tvCenaT; ImageView ivTowar; CheckBox chb_czy_zamowic; } public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder view; // LayoutInflater inflator = activity.getLayoutInflater(); LayoutInflater inflator = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (convertView == null) { view = new ViewHolder(); convertView = inflator.inflate(R.layout.element, null); view.tvNazwaT = (TextView) convertView.findViewById(R.id.tvNazwaT); view…
favorite count: 0
has answer: http://stackoverflow.com/a/21771391
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21765434
downvote count: 0
score: 1
tagged with: java
type: Question
has title: how to set button invisible depending on another activity
answer count: 3
upvote count: 1

http://stackoverflow.com/q/21746164
type: AnsweredQuestion
tagged with: java
tagged with: easymock
has title: Difference between EasyMock.createStrictMock(class<T> x) and EasyMock.createNiceMock(class<T> x)
has answer: http://stackoverflow.com/a/21747328
type: Question
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/36774346
has answer: http://stackoverflow.com/a/36774346
accepted answer: http://stackoverflow.com/a/21747328
has body: In the API doc it is mentioned that in the strictmock order checking is enabled by default while in case of nice mock it is not . I did not get what exactly they meant by "order checking".
score: 6
upvote count: 7
downvote count: 1

http://stackoverflow.com/a/21764717
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21764620
upvote count: 1
has body: You can make any of your index null, but array size will remain same, that is how array's work right ? A workaround would be to first convert your array into an ArrayList, remove item and then again make it an array - List&lt;String&gt; list = new ArrayList&lt;String&gt;(Arrays.asList(array)); list.remove(button1); array= list.toArray(array);

http://stackoverflow.com/comment/32849054
type: AnswerComment
comment on: http://stackoverflow.com/a/21722433
score: 0
type: Comment
has text: Tried it Not Working. I want the loop to check all the URL's and keep giving me exceptions in the console as and when it encounters a mismatch. I dont want the loop to stop.

http://stackoverflow.com/a/21834855
has comment: http://stackoverflow.com/comment/33054204
score: 1
has comment: http://stackoverflow.com/comment/33048754
accepted answer of: http://stackoverflow.com/q/21834643
has comment: http://stackoverflow.com/comment/33049461
has comment: http://stackoverflow.com/comment/33051137
has comment: http://stackoverflow.com/comment/33049892
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33090754
type: Answer
has comment: http://stackoverflow.com/comment/33049369
has comment: http://stackoverflow.com/comment/33049332
upvote count: 1
answers question: http://stackoverflow.com/q/21834643
has body: You should be able to make this work using something like the following (this is from this stack overflow answer). String a = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;%s"; url = new URL(a); URLConnection conn = url.openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); Once you have the BufferedReader from the URLConnection, you can get a String object from it: StringBuilder builder = new StringBuilder(); String aux = ""; while ((aux = reader.readLine()) != null) { builder.append(aux); } String text = builder.toString(); Once you have the String object, you can pass that into your JSONObject constructor. (from this stack overflow answer). Using org.json library: JSONObject jsonObj = new JSONObject(text); Now that you have your JSONObject, you can use the available methods to extract the data that you need. Ex: JSONObject cursorObj = jsonObj.getJSONObject("cursor"); int resultCount = cursorObj.getInt("resultCount");

linechart
tag name: linechart
tags question: http://stackoverflow.com/q/21840448
type: Tag

http://stackoverflow.com/comment/32839797
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21702776
has text: @Jongware .. Can you suggest me where I have to adjust my Code ....
score: 0

http://stackoverflow.com/comment/32914601
type: Comment
type: QuestionComment
has text: Hmm, unless I'm misunderstanding, that's the right one. :/ Something else to investigate is enabling JRockit VM - I've read about that being better performing and integrated into Java 7 in some way, but I'm not sure of specifics.
score: 0
comment on: http://stackoverflow.com/q/21758449

http://stackoverflow.com/comment/32840935
has text: Turns out it's to signify the beginning of the line. I still don't understand why I need it though.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21717309

http://stackoverflow.com/q/21821958
score: 2
tagged with: ejb-3.0
upvote count: 2
tagged with: java
type: Question
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/33026120
answer count: 1
tagged with: entitymanager
has answer: http://stackoverflow.com/a/21858683
has body: I am using JPA framework to do some database operations. First of all I make an EntityManager object and then I save the entity object for a specific table by using the code snippet "entityManager.persist(specificEntity)" And this persist operation is done from method with annotaion "@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)" I try to persist large number of data using a for loop in that method and all the data is persisted in one transaction. Normally all this works fine, but when i try to persist lot of rows, i face issue and error "Out of operation records in transaction coordinator (increase MaxNoOfConcurrentOperations)" My DB supports approx 32,000 concurrent operations. So is there any way in JPA framework to specify the max number of concurrent operations.
favorite count: 0
has comment: http://stackoverflow.com/comment/33031178
type: UnansweredQuestion
has title: JPA EntityManager limit number of concurrent operations on DB

http://stackoverflow.com/q/21813914
type: AnsweredQuestion
has body: I have a String timeStamp in this format "Wed, 29 Jan 2014 20:14:15 GMT". I want to be able to compare this date with another date that is in this format 01/25/1999. I have tried simpledateformatter but with no success. String a = connection.getHeaderField("Last-Modified"); //Returns Wed, 29 Jan 2014 20:14:15 GMT Date lastModDate = new Date(file.lastModified()); //returns 01/25/1999 This is the simpleDateFormatter I tried implementing SimpleDateFormat formatter; Date dateIn = null; formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US); try{ dateIn = (Date)formatter.parse(a); }catch(ParseException e){ e.printStackTrace(); } Log.d(TAG, "The server date is formated to : " + dateIn); The dateIn is always null. I want the to be able to do something like this SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy"); Date strDate = sdf.parse(valid_until); if (new Date().after(strDate)) { }
score: 1
tagged with: java
has title: Getting the month and day from a TimeStamp
upvote count: 1
accepted answer: http://stackoverflow.com/a/21814338
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/21814063
has answer: http://stackoverflow.com/a/21814338
has comment: http://stackoverflow.com/comment/33016589
has answer: http://stackoverflow.com/a/21814067
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/21814063
has answer: http://stackoverflow.com/a/21814069
answer count: 4

http://stackoverflow.com/comment/33092576
comment on: http://stackoverflow.com/a/21843043
type: AnswerComment
has text: While this worked, what's the best way to work with Dates in Java/Android? Preferred objects?
score: 0
type: Comment

http://stackoverflow.com/a/21705359
answers question: http://stackoverflow.com/q/21705151
type: Answer
upvote count: 6
has body: To answer your edited question, there's no way to do that without an explicit cast. So the simplest (yet brutal) solution would be: public &lt;T extends Result&gt; T execute(Command&lt;T&gt; command) { return (T) new LoginResult(); } But this way you take the full responsibility for instantiating the right result for the right command, as the compiler won't help you any more. The only thing that could help you instantiate things dynamically would be a reference to the actual Class&lt;T&gt;. So if you add a method like Class&lt;T&gt; getResultType() to your command, you would be able to write: return command.getResultType().newInstance(); // instead of new SpecificResult() This of course implies that you have a default constructor in each Result implementation and so on... A more OO friendly approach (no reflection) would be to let the command instantiate its own result (with a factory method T instantiateResult()): return command.instantiateResult();
score: 6
has comment: http://stackoverflow.com/comment/32819198
has comment: http://stackoverflow.com/comment/32818307
has comment: http://stackoverflow.com/comment/32819046
has comment: http://stackoverflow.com/comment/32818144
has comment: http://stackoverflow.com/comment/32818248
has comment: http://stackoverflow.com/comment/32818344
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32818271
accepted answer of: http://stackoverflow.com/q/21705151
has comment: http://stackoverflow.com/comment/32818362

http://stackoverflow.com/comment/33055406
type: QuestionComment
has text: The your current solution only works with number with two digits. You need to make it more dynamic.
comment on: http://stackoverflow.com/q/21837889
score: 0
type: Comment

http://stackoverflow.com/comment/102144754
has text: In what way is that regex at all readable? Do you have all those unicode code points memorized?
comment on: http://stackoverflow.com/a/21731443
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/33045970
type: QuestionComment
score: 0
has text: In Java, array indices start from 0 to (n-1) where `n` is the length of the array.
comment on: http://stackoverflow.com/q/21833352
type: Comment

http://stackoverflow.com/comment/33053699
comment on: http://stackoverflow.com/q/21837640
type: QuestionComment
score: 0
has text: You should probably show the code on or about line 40 of app.java, since that's where your NullPointerException occurs.
type: Comment

http://stackoverflow.com/comment/32956839
type: QuestionComment
has text: Your method signature already constrains what argument type the method uses, why don't you just use `any()`? Code not calling your method with a `Map<String, Set<String>>` will not even compile...
score: 0
comment on: http://stackoverflow.com/q/21783219
type: Comment

http://stackoverflow.com/q/21758254
possible better answer: http://stackoverflow.com/a/21760033
has answer: http://stackoverflow.com/a/21758931
linked to: http://stackoverflow.com/q/13428796
favorite count: 0
has title: How do you add and image into JFrame from a source folder?
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21758931
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21760033
has body: I have tried numerous ways of added a jpg image into the Jframe without success, the code will compile but the image wont appear. Th image is stored in a source file in the project! Thanks for the help. public class GordonsWindow extends JFrame { public GordonsWindow() { JMenuBar menuBar = new JMenuBar(); JMenu menuFile = new JMenu(); JMenu menuStores = new JMenu(); JMenuItem menuFileExit = new JMenuItem(); JMenuItem menuStoresArmagh = new JMenuItem(); JPanel paneStores = new JPanel(new FlowLayout()); paneStores = new JPanel(); paneStores.setPreferredSize(new Dimension(500,300)); paneStores.setBackground(Color.blue); JButton ArmaghButton = new JButton(); ImageIcon icon = new ImageIcon("Gordons.jpg"); JLabel label = new JLabel(); label.setIcon(icon); ArmaghButton.setText("Armagh"); paneStores.add(ArmaghButton); paneStores.add(label); add(paneStores); menuFile.setText("File"); menuFileExit.setText("Exit"); menuStores.setText("Stores"); menuStoresArmagh.setText("Armagh"); ArmaghButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Armagh.windowActivated(); } }); menuFileExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { GordonsWindow.this.windowClosed(); } }); menuFile.add(menuFileExit); menuBar.add(menuFile); menuBar.add(menuStores); menuStores.add(menuStoresArmagh); setTitle("Gordons Chemists Application"); setJMenuBar(menuBar); setSize(new Dimension(800, 800)); //Add Window Listener this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { GordonsWindow.this.windowClosed(); } }); } protected void windowClosed() { System.exit(0); } }
has comment: http://stackoverflow.com/comment/32913273
has comment: http://stackoverflow.com/comment/32912282

http://stackoverflow.com/a/21689766
score: 0
has body: Disclaimer: As this is apparently a homework, I will not post any code per se. The first thing you need to do is define the 3 notions you use in this exercise: A set is a group of elements such as each element is present only once An intersection is a set of element present in group A or in group B An union is a set of element present both in group A and in group B Then you need to define what basic functions you will need. tell if an element E is present in a set A. add an element to a set. Now, looking at what you have so far, the issue is that you are creating 2 groups A and B that are not sets. There is nothing preventing to have a group like so [1, 1, 1] Therefore, you first work should be to make sure each group remains a set, by checking the content of the set before adding a value. That uses the first function defined earlier. Once A and B are both sets, you need to find an algorithm for each of the functions that are asked of you. The union algorithm is quite simple: Loop on the elements of each of the groups that you want to add to the union, if the element is not in the set already, add it. The intersection is not very much complicated: Loop on the elements of each of the groups that you want to add to the union, if the element is not in the set already, and is present in all the groups that you are intersecting, add it. All this should fit in around 20 lines, 30 tops.
answers question: http://stackoverflow.com/q/21689550
type: Answer
has comment: http://stackoverflow.com/comment/32791242

http://stackoverflow.com/q/21823419
tagged with: casting
tagged with: class
has answer: http://stackoverflow.com/a/21834472
score: 0
has comment: http://stackoverflow.com/comment/33046523
answer count: 1
has comment: http://stackoverflow.com/comment/33028685
type: UnansweredQuestion
tagged with: android
has body: I fill a list with checkBoxPreference objects programmatically. For new android SDK, there's a method setIcon() that was not implemented before. So I extended the checkBoxPreference class and implemented the setIcon() similar to this gist. My new class is called IconCheckBoxPreference, which has issues with Kitkat [new SDK]. I want to have something like Object cbp; if(android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.HONEYCOMB){ cbp = new checkBoxPreference(this); casted_cbp = CastAccordingToClass(cbp, checkBoxPreference.class); //TODO! }else{ cbp = new IconCheckBoxPreference(this, null); casted_cbp = CastAccordingToClass(cbp, IconCheckBoxPreference.class); //TODO! } casted_cbp.setTitle("My Title"); casted_cbp.setIcon(getResources().getDrawable(R.drawable.bla)); And continue my code using the variable "casted_cbp" without further SDK conditions. What could by the type of "casted_cbp"? Is there a way for doing so? What's the best practice in such situations?
has title: Type-Casting a java object according to Android SDK Level
tagged with: java
has comment: http://stackoverflow.com/comment/33047831
type: Question

jvm
tags question: http://stackoverflow.com/q/21771007
type: Tag
tags question: http://stackoverflow.com/q/21734086
tags question: http://stackoverflow.com/q/21724726
tags question: http://stackoverflow.com/q/21747680
tags question: http://stackoverflow.com/q/21837822
tags question: http://stackoverflow.com/q/21745044
tags question: http://stackoverflow.com/q/21814298
tags question: http://stackoverflow.com/q/21679998
tags question: http://stackoverflow.com/q/21732611
tags question: http://stackoverflow.com/q/21787289
tags question: http://stackoverflow.com/q/21700603
tag name: jvm
tags question: http://stackoverflow.com/q/21807770
tags question: http://stackoverflow.com/q/21728729
tags question: http://stackoverflow.com/q/21819964
tags question: http://stackoverflow.com/q/21697811
tags question: http://stackoverflow.com/q/21759404
tags question: http://stackoverflow.com/q/21700310
tags question: http://stackoverflow.com/q/21703420
tags question: http://stackoverflow.com/q/21726221
tags question: http://stackoverflow.com/q/21779244
tags question: http://stackoverflow.com/q/21816985
tags question: http://stackoverflow.com/q/21746719
tags question: http://stackoverflow.com/q/21748389
tags question: http://stackoverflow.com/q/21777606
tags question: http://stackoverflow.com/q/21724836
tags question: http://stackoverflow.com/q/21706576

http://stackoverflow.com/q/21761875
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25120739
has comment: http://stackoverflow.com/comment/32920854
tagged with: if-statement
has answer: http://stackoverflow.com/a/54590675
score: 21
duplicate of: http://stackoverflow.com/q/5574058
tagged with: java
has comment: http://stackoverflow.com/comment/90675868
has comment: http://stackoverflow.com/comment/32924776
has answer: http://stackoverflow.com/a/21761930
has answer: http://stackoverflow.com/a/73730209
has body: I have a problem with this code: if (90 &gt;&gt;= angle =&lt;&lt; 180) The error explanation is: The left-hand side of an assignment must be a variable. I understand what this means but how do I turn the above code into correct code?
has answer: http://stackoverflow.com/a/70463309
upvote count: 24
has answer: http://stackoverflow.com/a/21763274
accepted answer: http://stackoverflow.com/a/21763274
favorite count: 0
linked to: http://stackoverflow.com/q/5574058
has comment: http://stackoverflow.com/comment/32920405
downvote count: 3
has answer: http://stackoverflow.com/a/57500486
answer count: 10
has title: Check if a variable is between two numbers with Java
has answer: http://stackoverflow.com/a/21762926
has comment: http://stackoverflow.com/comment/32920055
has answer: http://stackoverflow.com/a/25120739
has answer: http://stackoverflow.com/a/21761950
has comment: http://stackoverflow.com/comment/32919577
has answer: http://stackoverflow.com/a/76405238

http://stackoverflow.com/a/21790764
has comment: http://stackoverflow.com/comment/32971119
type: Answer
has comment: http://stackoverflow.com/comment/32970900
has comment: http://stackoverflow.com/comment/32971153
has body: Have you set the meta-data in the manifest? The all steps indicated in the getting started guide should be everything you need.
answers question: http://stackoverflow.com/q/21790651
score: 0

http://stackoverflow.com/comment/33043037
comment on: http://stackoverflow.com/a/21830859
has text: /WEB-INF is context folder in your web application
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33016291
score: 0
comment on: http://stackoverflow.com/q/21816246
type: Comment
type: QuestionComment
has text: I could calculate the area with sides a=b=c=10000 without any problems.

jodatime
tags question: http://stackoverflow.com/q/21839143
tags question: http://stackoverflow.com/q/21804054
type: Tag
tag name: jodatime
tags question: http://stackoverflow.com/q/21784811
tags question: http://stackoverflow.com/q/21774949
tags question: http://stackoverflow.com/q/21712183
tags question: http://stackoverflow.com/q/21820078

http://stackoverflow.com/comment/33024278
comment on: http://stackoverflow.com/q/21790656
score: 0
type: Comment
has text: Don't be embarassed. What HTTP request (method and URL) do you perform that causes the exception that you've posted?
type: QuestionComment

http://stackoverflow.com/comment/105360369
has text: Go through this link you can get idea of transparent window utilities http://docs.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html Supported in JDK 7.
comment on: http://stackoverflow.com/q/21771215
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32926236
comment on: http://stackoverflow.com/q/21765819
has text: So that is not the file? I thought if you define a path, it will read the file
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21754560
tagged with: digraphs
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/8066109
favorite count: 0
has comment: http://stackoverflow.com/comment/32905633
type: Question
upvote count: 2
tagged with: interface
tagged with: guava
has comment: http://stackoverflow.com/comment/33107875
has comment: http://stackoverflow.com/comment/32907395
has title: Interface for BinaryRelation
tagged with: java
has body: I’d like to define elegant interfaces for a binary relation and for a transitive relation. I consider a binary relation as a set of pairs, a subset of some set X × Y. In fact I intend to work mainly with transitive relations, but I occasionally need general binary relations. This is mainly for my own usage but I may end-up publishing this as a FLOSS library for other users. I would like my definitions to make sense on a general level as I do not have yet precise requirements about usage of these classes: I need them for experimental work related to scientific research, I have some ideas right now but it is unclear yet what kind of experiments I will need as more ideas come while doing the research. General idea The core of what I (think I) need is as follows. /** * @param <F> * the type used for the “from” elements. * @param <T> * the type used for the “to” elements. * */ public interface BinaryRelationTentative<F, T> { /** * @return a view of the domain of this relation: all the elements x such that for some y, (x, y) is in the * relation. */ public Set<F> getFromSet(); /** * @return a view of the range of this relation: all the elements y such that for some x, (x, y) is in the relation. */ public Set<T> getToSet(); /** * @return the number of pairs that this relation contains. */ public int size(); /** * @return true iff the relation has empty from and to sets. */ public boolean isEmpty(); /** * A binary relation equals an other one iff they have equal from and to sets and for each (x, y) contained in one, * (x, y) is contained in the other one. */ @Override public boolean equals(Object obj); /** * @return whether the given from element is in relation with the to element. */ public boolean contains(F from, T to); /** * Optional operation. */ public boolean add(F from, T to); } (This is only the core features, so that you see what I mean — nicer features for traversal and so on would be welcome, see below.) Then I would define a TransitiveRelation<E> that extends B…
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21867547

http://stackoverflow.com/a/21824727
type: Answer
score: 0
has body: override equals() method of Object class while comparing two string . ex : str1.equals(str2);
answers question: http://stackoverflow.com/q/21823479
has comment: http://stackoverflow.com/comment/33031407

http://stackoverflow.com/comment/33043594
type: Comment
comment on: http://stackoverflow.com/q/21831672
score: 0
has text: Server use last java, and IDEA too, but how to check it?
type: QuestionComment

http://stackoverflow.com/comment/32889706
type: Comment
type: QuestionComment
score: 0
has text: No, I went with what was installed on the system rather than downloading a separate JDK. Do you think it would be solved with a different version?
comment on: http://stackoverflow.com/q/21744429

http://stackoverflow.com/q/21706947
has comment: http://stackoverflow.com/comment/32823455
favorite count: 0
accepted answer: http://stackoverflow.com/a/21713021
has title: Rectangular constraints in Delaunay Triangulation without edges within
tagged with: c++
type: AnsweredQuestion
upvote count: 1
type: Question
has body: I'm using a triangulation library to compute the Constrained Delaunay Triangulation of a set of rectangles within some large boundary. The algorithm returns all the edges, but also adds edges inside of the rectangles that define the constraints. I want to be able to create a graph without the edges within any of the rectangles that are the constraints (with the exception of the large boundary of course) but removing these edges in the triangulation that is given to me takes longer than O(nlog(n)) time at least and that's not good for what I need. What I'm asking is, is there any quick way to get a CDT to keep edges from appearing within some polygon? I want the rectangles to be empty of edges but I'm not sure how to quickly do that. In case this helps, the library I'm using is TriPath by Marcello Kallmann, and it is written in c++ (http://graphics.ucmerced.edu/software/tripath/). My application is in Java and I'm using JNI. EDIT: As requested, here's some images to help you visualize what I'm trying to describe. This CDT is built with the black lines being constraints. As you can see, each constrained edge is part of a rectangle. The blue lines are unconstrained Delaunay edges. I am trying to remove any blue unconstrained Delaunay edges from within the black constrained rectangles.
tagged with: algorithm
has answer: http://stackoverflow.com/a/21713021
score: 1
tagged with: java
tagged with: triangulation
downvote count: 0
answer count: 1

http://stackoverflow.com/a/21719777
accepted answer of: http://stackoverflow.com/q/21714594
answers question: http://stackoverflow.com/q/21714594
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32882003
downvote count: 0
has comment: http://stackoverflow.com/comment/32848337
has comment: http://stackoverflow.com/comment/32880768
has comment: http://stackoverflow.com/comment/32847901
type: Answer
has comment: http://stackoverflow.com/comment/32845217
score: 17
upvote count: 17
has body: If we're talking about differences that aren't syntax-related, Tomasz Nurkiewicz pretty much highlights the biggest one in the opening paragraphs of his blog post: Optional was introduced in Java 8 so obviously it is not used throughout the standard Java library - and never will be for the backward compatibility reasons. (emph. mine - although I wouldn't be so adamant on "never", given the new default methods) So the biggest difference, and the greatest advantage of Scala's Option, seems to be simply that it's much more tightly integrated into the language's API. First of all, you're very likely to obtain exposure to it, and hence its usage pattern, early on when you start using Scala - most notably, through Scala's Map#get. And inversely - if you look at Scala's Option API, you will see that it is "spliced" into Scala's collection hierarchy, meaning that you can transparently use it as a collection whenever you need so - e.g. without, say, the end developer of your library ever dealing with its particularities.
has comment: http://stackoverflow.com/comment/32848202

http://stackoverflow.com/a/78650319
score: 0
type: Answer
has body: The error you’re seeing is due to a mismatch between the version of JUnit that Cucumber expects and the version that is actually on your classpath. It could also be some dependency using old functionality that creates the mismatch. More on that below. The method org.junit.runner.Description.createSuiteDescription(String, Serializable, Annotation[]) was added in JUnit 4.12, but you’re using JUnit 4.8.2. Try updating the version of JUnit in your pom.xml file to 4.12 or higher. junit junit 4.12 test change, re-import Maven dependencies in Eclipse (Right click on the project -> Maven -> Update Project), and then try running your tests again. That should help resolve the particular general NoSuchMethodError What I had to ressolve was a clash of dependencies. I am using a customized test automation framework afor.co.nz. I run the framework in bitbucket pipeline. I had 15 dependencies in my pom.xml. I had to uncomment one by one until i found the library causing the issue. a 2012 dependency json-simple 1.1.1 error I got with json-simple 1.1.1 [INFO] Surefire report directory: /opt/atlassian/pipelines/agent/build/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running RunTest Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.547 sec <<< FAILURE! RunTest Time elapsed: 0.546 sec <<< ERROR! java.lang.NoSuchMethodError: 'org.junit.runner.Description org.junit.runner.Description.createSuiteDescription(java.lang.String, java.io.Serializable, java.lang.annotation.Annotation[])' at io.cucumber.junit.FeatureRunner.getDescription(FeatureRunner.java:118) at io.cucumber.junit.Cucumber.describeChild(Cucumber.java:191) at io.cucumber.junit.Cucumber.describeChild(Cucumber.java:89) at org.junit.runners.ParentRunner.getDescription(ParentRunner.java:290) at org.junit.runners.ParentRunner.run(ParentRunner.java:296) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4P…
answers question: http://stackoverflow.com/q/21738543

http://stackoverflow.com/comment/32997472
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21805766
has text: You can create a *variable* of an abstract class, but not an object! And if you try to invoke any method from a null reference, you'll get a `NullPointerException` anyway.
score: 0

http://stackoverflow.com/q/21769793
has comment: http://stackoverflow.com/comment/32933703
has title: Whats better for performance? A list, or getting info from a database?
type: Question
has answer: http://stackoverflow.com/a/21773109
tagged with: performance
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/32933626
has comment: http://stackoverflow.com/comment/32933812
has comment: http://stackoverflow.com/comment/32933784
has comment: http://stackoverflow.com/comment/32933742
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/32933902
has body: So, I have a server with limited resources. (3Gb of RAM) What I need to know is, is it better to use this List&lt;Object&gt; list = new ArrayList&lt;Object&gt;(); void init(){ list = loadListFromDatabase } And add or remove to the list when needed, or, when I need the object, load it from the database every time its accessed?
has comment: http://stackoverflow.com/comment/32934037
type: UnansweredQuestion

http://stackoverflow.com/comment/33845343
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21754951
score: 0
has text: We ended up increasing resources on the server and restart Tomcat daily. But I do wanna find a nicer solution.

http://stackoverflow.com/comment/32933324
score: 0
comment on: http://stackoverflow.com/q/21769600
type: QuestionComment
type: Comment
has text: private String[][] tictac = new String[3][3]; is this the right one?

http://stackoverflow.com/a/21710406
answers question: http://stackoverflow.com/q/21710189
score: 1
upvote count: 1
has body: I’d say have SQL do the work. It’s fairly trivial and won’t soak up CPU time, and SQL will have to load the pertinent info in memory anyway so it’s already there for processing. Doing it on the app side, to a certain extent it seems like you have to “re-stage” the data for analysis, and (imho) the java code seems more difficult to read through and understand. Note that there’s a minor flaw in your SQL code, you can’t use WHEN NULL that way in a case statement. You’d want something like ...case when min(Id) is null then 2 when min(Id) = -1 then 1 else 3 end
has comment: http://stackoverflow.com/comment/32832901
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32827722

http://stackoverflow.com/q/21821701
has answer: http://stackoverflow.com/a/21821753
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33025695
tagged with: java
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/33025706
tagged with: layout
has comment: http://stackoverflow.com/comment/33025735
has title: How to set JTextField border size in java
has body: I want to set the Border height,width of JTextField and want to put it on the center of the JFrame in java. I tried those ideas but those ideas does not work. setSize(),SetPrefferedSize(),SetMaximumSize(); Need Help. Thanks in advance. import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JTextField; public class P{ public static void main(String [] args){ JFrame frame = new JFrame(); JTextField field = new JTextField(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(BorderLayout.NORTH,field); frame.setSize(350,300); frame.setVisible(true); } }
tagged with: border
score: 0
answer count: 1

http://stackoverflow.com/a/21741042
has body: I'm not sure what some of your other code looks like but I think you probably want your System.out line to look something like: System.out.format("%s %11d\t%9.2f\t%11.2f\n", s_name[i], s_quantity[i], s_price[i], result) I also added .2 to both of your float format specifiers (%f) since you are dealing with money and probably only want to round to 2 decimal places... Also seems like your s_name array should be declared as an array of strings, not ints. But alas, as the other poster has suggested, you have not shown us this part of the code.
answers question: http://stackoverflow.com/q/21740845
has comment: http://stackoverflow.com/comment/32883042
score: 0
type: Answer

http://stackoverflow.com/comment/32802890
score: 0
comment on: http://stackoverflow.com/a/21695654
type: AnswerComment
has text: this means that something esle is using the port can you make sure that the ports which you are using are not used by other services or change the ports for faster results
type: Comment

http://stackoverflow.com/comment/32985596
type: AnswerComment
comment on: http://stackoverflow.com/a/21779987
type: Comment
has text: @Lacrymae You don't have to call doInBackGround.. you have to use `execute()` to get the swingWorker work and remember an instance of swingWorker only can execute one time!
score: 0

http://stackoverflow.com/comment/32985878
has text: what do you see in the logcat for `Log.d(TAG, String.valueOf(position));`?
comment on: http://stackoverflow.com/q/21799464
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21796141
has comment: http://stackoverflow.com/comment/32980326
tagged with: simpledateformat
tagged with: java
has comment: http://stackoverflow.com/comment/32980344
type: Question
has comment: http://stackoverflow.com/comment/32980496
answer count: 2
has body: I'm going nuts trying to parse the 2 following dates: Thu, 13 Feb 2014 13:03:50 GMT 13 Feb 2014 13:03:50 GMT I did try the following SimpleDate patterns with no success: "EEE, dd MMM yyyy HH:mm:ss zzz" "EEE, dd MMM yyyy HH:mm:ss 'GMT'" "dd MMM yyyy HH:mm:ss zzz" "dd MMM yyyy HH:mm:ss 'GMT'" Here's my code SimpleDateFormat dateFormat = new SimpleDateFormat(dateFormatPattern, Locale.US); Date date = dateFormat.parse(dateString); But I'm always getting ParseException... Any idea why ?
has answer: http://stackoverflow.com/a/21796216
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/32981294
has comment: http://stackoverflow.com/comment/32980228
has title: Failing to parse a String date
has comment: http://stackoverflow.com/comment/32980564
accepted answer: http://stackoverflow.com/a/21796216
possible better answer: http://stackoverflow.com/a/21796199
has answer: http://stackoverflow.com/a/21796199
type: AnsweredQuestion

http://stackoverflow.com/a/21709167
has comment: http://stackoverflow.com/comment/32826531
has comment: http://stackoverflow.com/comment/32826602
has body: When you overwrite the entry at location count with the line: sort[count] = min; you will lose the previous contents of the array at that index. You need to keep track of the location of the minimum and perform a swap instead.
score: 0
answers question: http://stackoverflow.com/q/21708832
type: Answer

http://stackoverflow.com/comment/32958655
type: Comment
type: QuestionComment
has text: I guess you use overriding methods in derivated classes for polymorphism, and if you do not intend your class to be overriden you declare it final. Why would you want your method not to work with polymorphism? I still see not quite a reason for it.
comment on: http://stackoverflow.com/q/21784200
score: 0

http://stackoverflow.com/q/21817888
score: 25
tagged with: cordova
has answer: http://stackoverflow.com/a/21984137
downvote count: 0
linked to: http://stackoverflow.com/q/2850573
linked to: http://stackoverflow.com/q/21728673
has comment: http://stackoverflow.com/comment/33019030
has body: Look at these pieces of code: Custom views and window attributes on Android Problem When I click 'Home button', exception is thrown: Activity has leaked window... from this line: localWindowManager.addView(colourView, layoutParams); Question(s) Do you know what can cause it? Problem doesn't occur, when I close application with back button. Exception/Error Logs W/InputManagerService( 96): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@40908148 (uid=10056 pid=1368) D/CordovaActivity( 1368): CordovaActivity.onDestroy() D/CordovaWebView( 1368): &gt;&gt;&gt; loadUrlNow() E/WindowManager( 1368): Activity com.phonegap.helloworld.HelloWorld has leaked window pl.edu.uj.tcs.student.xxx.Display$Layer@40589368 that was originally added here E/WindowManager( 1368): android.view.WindowLeaked: Activity com.phonegap.helloworld.HelloWorld has leaked window pl.edu.uj.tcs.student.xxx.Display$Layer@40589368 that was originally added here E/WindowManager( 1368): at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:258) E/WindowManager( 1368): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148) E/WindowManager( 1368): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) E/WindowManager( 1368): at android.view.Window$LocalWindowManager.addView(Window.java:424) E/WindowManager( 1368): at pl.edu.uj.tcs.student.xxx.Display.setColorsViews(Display.java:181) E/WindowManager( 1368): at pl.edu.uj.tcs.student.xxx.Display$3.run(Display.java:139) E/WindowManager( 1368): at android.os.Handler.handleCallback(Handler.java:587) E/WindowManager( 1368): at android.os.Handler.dispatchMessage(Handler.java:92) E/WindowManager( 1368): at android.os.Looper.loop(Looper.java:130) E/WindowManager( 1368): at android.app.ActivityThread.main(ActivityThread.java:3683) E/WindowManager( 1368): at java.lang.reflect.Method.invokeNative(NativeMethod) E/WindowManager( 1368): at java.lang.reflect.Method.invoke(Method.java:507) E/WindowManager( 13…
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21986772
accepted answer: http://stackoverflow.com/a/21986772
upvote count: 25
type: Question
has answer: http://stackoverflow.com/a/31965887
possible better answer: http://stackoverflow.com/a/21984137
favorite count: 0
has title: Activity has leaked window - Android
answer count: 5
has answer: http://stackoverflow.com/a/22032691
tagged with: android
has answer: http://stackoverflow.com/a/22067280
tagged with: android-activity

http://stackoverflow.com/comment/32919230
has text: thank you for your time, i did it with the code from David, but i will be back soon enough to ask other stupid questions.
comment on: http://stackoverflow.com/a/21761381
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32940172
type: Comment
type: QuestionComment
score: 2
has text: If you have one submit button per form (nested within it), it should behave as you expect.
comment on: http://stackoverflow.com/q/21773492

http://stackoverflow.com/comment/32862267
score: 0
type: Comment
has text: i tried the above code.but stil the same.Have you edited your code already?I tried this::: double d = 4.85999999999; long l = (int)Math.round(d * 100); // truncates d = l / 100.0;
type: AnswerComment
comment on: http://stackoverflow.com/a/21727480

http://stackoverflow.com/a/21763441
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21763321
answers question: http://stackoverflow.com/q/21763321
has comment: http://stackoverflow.com/comment/32921951
has body: Your form should thus have login as its action, and the method implementing this action should redirect to welcome if the login is successful. @RequestMapping(value = "/login", method = ResquestMethod.POST) public String handleLogin([...]) { ... if (successful) { return "redirect:/welcome" } }
score: 5

http://stackoverflow.com/a/21817678
upvote count: 1
has comment: http://stackoverflow.com/comment/33019105
answers question: http://stackoverflow.com/q/21817342
type: Answer
downvote count: 0
score: 1
has body: I'm trying to create a file in the external storage (SD Card) of my phone What the Android SDK refers to as "external storage" is not an SD card, on most devices manufactured since early 2011. No clue why the getExternalSorage is not working. It is working just fine and as documented. It is simply not meeting your expectations. Up until Android 4.4, there was no documented and supported means of accessing any sort of removable storage. On Android 4.4, you now have getExternalFilesDirs() and getExternalCacheDirs() (note the plural), which may give you access to specific directories on removable storage if such storage exists.

http://stackoverflow.com/a/21692074
has body: Have a look into Camel MQTT component documentation. There is note that this component can be only used for consuming messages if I understand it correctly. Note: The component currently only supports polling (consuming) feeds. It's quite weird. I'll investigate further.
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32826556
answers question: http://stackoverflow.com/q/21691360
upvote count: 1

http://stackoverflow.com/comment/32855917
score: 0
type: AnswerComment
type: Comment
has text: In Q1, Can you please tell me when the memory for object and reference variable "sb" be allotted in a program. Let's say we have one object created in main as "C c = new C();"
comment on: http://stackoverflow.com/a/21726507

http://stackoverflow.com/q/21763285
type: Question
answer count: 1
has body: I am trying to set up an Fitnesse fixture for testing SOAP services. I am trying to use the SoapUI API to build requests from the WSDL, and probably send and disseminate the responses. I am trying to integrate with the SoapUI API as described here: Integrating with SoapUI. I can read in my .wsdl file fine and create a template for the SOAP request based on the operation I am wanted to call. However, for the life of me, I cannot figure out how to manipulate the operation's parameter fields in the request. Example Request for the getName operation: &lt;soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Foo"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;urn:getName soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;in xsi:type="urn:GetNamedRequest"&gt; &lt;name xsi:type="xsd:string"&gt;?&lt;/name&gt; &lt;/in&gt; &lt;/urn:updateRecord&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; From this example, I want to be able to change the &lt;name/&gt; item. Ideally, I want to be able to use the SoapUI API to change it, if it offers that feature. But the documentation is poorly commented and infuriating. I am not beyond taking the request it generates and manipulating it to my ends, but would rather not go to that measure as the API surely has some way to manipulate the inner html of &lt;name/&gt;. Can anyone help or point me in the right direction?
has title: Manipulating SOAP request paramenters when Integrating with SOAPUI in Java
score: 0
has answer: http://stackoverflow.com/a/21836440
tagged with: wsdl
tagged with: soap
tagged with: soapui
type: UnansweredQuestion
tagged with: web-services
tagged with: java

http://stackoverflow.com/comment/33028012
comment on: http://stackoverflow.com/a/21777518
type: AnswerComment
type: Comment
score: 0
has text: When u fill the arraylist for the adapter.U have to check for the condition

http://stackoverflow.com/a/21803410
has body: When you try implement Parcelable then you must have to create an obeject named CREATOR inside your class which implementing the Parcelable interface as example for your City class... public static final Parcelable.Creator&lt;City&gt; CREATOR = new Creator&lt;City&gt;() { @Override public City[] newArray(int size) { return new City[size]; } @Override public City createFromParcel(Parcel in) { return new City(in); } };
type: Answer
answers question: http://stackoverflow.com/q/21803325
score: 0

http://stackoverflow.com/a/21750779
downvote count: 0
type: Answer
has body: Depends on class visibility. For your class dafault constructor is going to be public. In a class type, if the class is declared public, then the default constructor is implicitly given the access modifier public (§6.6); if the class is declared protected, then the default constructor is implicitly given the access modifier protected (§6.6); if the class is declared private, then the default constructor is implicitly given the access modifier private (§6.6); otherwise, the default constructor has the default access implied by no access modifier. From here.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21750609

http://stackoverflow.com/q/21786844
type: Question
has comment: http://stackoverflow.com/comment/32963843
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21787760
has body: The code I have inherited uses HttpURLConnection to make a connection to a Perl script hosted by Apache to get some data. I want to make the request time out after, say 2 seconds, and print a message to the logs. I have put a sleep 10 command in the Perl which makes the Perl script delay for 10 seconds. However despite having set the timeout on HttpURLConnection to 1 millisecond, it still gets the request from Perl, ignoring my timeout setting. What am I doing wrong? Here is my code, simplified to what I hope is the essential points: HttpURLConnection connection = (HttpURLConnection) new URL(URLDecoder.decode(url)).openConnection(); connection.setConnectTimeout(1) ; output = connection.getOutputStream(); BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(output, "UTF-8")); bufferedWriter.write(sb.toString());/* the request */ bufferedWriter.close(); output.close(); try { InputStream res = connection.getInputStream(); writer = new StringWriter(); IOUtils.copy(res, writer, "ISO-8859-1"); } catch(java.net.SocketTimeoutException e) { logger.debug("CONNECTION TIMED OUT"); } return writer.toString(); // the returned data returned to calling function I have two questions: I am simply expecting this not to work. I have set the timeout on the connection to 1 millisecond. Perl is (definitely) sleeping for 10 seconds. And, then, secondly, I was expecting to catch a timeout error.
tagged with: httpurlconnection
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/6829801
has title: How to make HttpURLConnection timeout?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21787760

http://stackoverflow.com/comment/32898235
comment on: http://stackoverflow.com/q/21749862
type: QuestionComment
has text: If you login as the user executing the program, can you open the file? Also, is `tiff2pdf` correctly installed where you think it is?
score: 0
type: Comment

http://stackoverflow.com/comment/33010839
comment on: http://stackoverflow.com/a/21798168
type: Comment
has text: Thanks Mark.Nice solution with groovy
score: 0
type: AnswerComment

http://stackoverflow.com/a/21815550
answers question: http://stackoverflow.com/q/21813886
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21813886
type: Answer
score: 0
has body: The code is a poor algorithm for reversing a linked list. You presumably have either converted the rest of the class, or have your own linked list class and are just trying to copy the reversal algorithm. You should really include these details and what you've tried when you ask questions on SO, without them people answering can often only guess and you've failed to show any effort - the latter is important. While this code strongly suggests a linked list there is no clue in this fragment whether this is a single or double-linked list. The code fragment you supply indicates that you have a MyList class with manages a linked list made up of ListNode objects. The basic operations on a linked list are typically: Access/change the value stored in the current node - in your code this is the property head and it is an object reference of type ListNode; which itself appears to hold a string. Access/change the reference to the remainder ("tail") of the list - in your code the getNext &amp; setNext methods. The method you show RecReverse is a way to recursively produce a new list which is the reverse of the current list. The algorithm does this by reversing the tail of the list and then appending the head onto the end - using the method end. If the list is double-linked and/or keeps a reference to the end of the list then the algorithm is ok - the method end does not need to traverse the list in this case. Just write it in Objective-C and add it to your list class. If the list is single-linked and does not keep a reference to the end of the list then the algorithm is poor and the method end does need to traverse the list. This makes it an O(n^2) algorithm - every step traverses the list. A better algorithm in this case is to use an accumulating parameter. In pseudo-code this is: Reverse(l) if length(l) &lt;= 1 then return l // empty list or list with one element reversed is itself else return ReverseHelper(l, new empty list) ReverseHelp(remainder, result) if remainder is emp…

http://stackoverflow.com/a/21684782
score: 2
has comment: http://stackoverflow.com/comment/32794752
has body: For boolean fields I don't think we are suppose to give values(i.e. true/false). Just pass the argument as a flag java XXX.java -enableAuth If the field was non-boolean than it would have expected a value.
type: AcceptedAnswer
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21681258
type: Answer
answers question: http://stackoverflow.com/q/21681258

http://stackoverflow.com/comment/32868453
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21733548
has text: Well, it is a ui thread. `UpdateData()` sets the data from the adapter and call `notifyDataSetChanged()`
score: 0

http://stackoverflow.com/q/21770106
answer count: 1
has title: Sending and receiving DatagramPacket containing a double
score: 1
accepted answer: http://stackoverflow.com/a/21770459
favorite count: 0
tagged with: sockets
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21770459
tagged with: datagram
downvote count: 0
tagged with: udp
tagged with: byte
has body: What I want to do is 1) On the client side, convert a double (currently it's 1.75) to bytes[] and send it to the server using DatagramPacket; 2) On the server side, receive the request, get the bytes[] data, convert it to double and print it out. UDPClient.java: import java.net.*; import java.io.*; import java.nio.ByteBuffer; public class UDPClient { private static byte[] doubleToByteArray(double x) { byte[] bytes = new byte[8]; ByteBuffer.wrap(bytes).putDouble(x); return bytes; } public static void main(String args[]) { DatagramSocket aSocket = null; try { aSocket = new DatagramSocket(); byte[] m = doubleToByteArray(1.75); InetAddress aHost = InetAddress.getByName("localhost"); int serverPort = 6789; DatagramPacket request = new DatagramPacket(m, m.length, aHost, serverPort); aSocket.send(request); } catch (SocketException e) { System.out.println("Socket: " + e.getMessage()); } catch (IOException e) { System.out.println("IO: " + e.getMessage()); } finally { if (aSocket != null) { aSocket.close(); } } } } UDPServer.java: import java.net.*; import java.io.*; import java.nio.ByteBuffer; public class UDPServer { private static double byteArrayToDouble(byte[] bytes) { double d = 0.0; ByteBuffer.wrap(bytes).putDouble(d); return d; } public static void main(String args[]) { DatagramSocket aSocket = null; try { aSocket = new DatagramSocket(6789); // create socket at agreed port byte[] buffer = new byte[1000]; while (true) { DatagramPacket request = new DatagramPacket(buffer, buffer.length); aSocket.receive(request); System.out.println(new String(request.getData(), 0, request.getLength())); // output: some messy characters System.out.println(byteArrayToDouble(request.getData())); // output: "0.0" (of course, unfortunately) } } catch (SocketException e) { System.out.println("Socket: " + e.getMessage()); } catch (IOException e) { System.out.println("IO: " + e.getMessage()); } finally { if (aSocket != null) { aSocket.close(); } } } } How should I modify my send/receive mechani…

http://stackoverflow.com/a/21784713
downvote count: 0
has comment: http://stackoverflow.com/comment/32959503
has comment: http://stackoverflow.com/comment/32959467
upvote count: 2
has comment: http://stackoverflow.com/comment/32959481
type: Answer
has comment: http://stackoverflow.com/comment/32959440
answers question: http://stackoverflow.com/q/21784638
has comment: http://stackoverflow.com/comment/32959382
has body: Your length function removes (pops) all elements from the stack. Note that assigning an object reference to another variable like Stack&lt;Integer&gt; a = c does not copy the object - only a reference to the object.
score: 2

http://stackoverflow.com/q/21760115
answer count: 1
has body: I am new to Android. I am trying to populate a list view from an array list from a web service. I have not had any luck finding the any tutorial online that uses arrays to listview. I am getting a Syntax error on token "final", invalid Type Here is my java code: public class LocationFragment extends Fragment { ListView tv; public LocationFragment() { } private String TAG = "Vik"; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_location, container, false); tv = (ListView) rootView.findViewById(R.id.listView1); AsyncCallWS task = new AsyncCallWS(); task.execute(); return rootView; } private class AsyncCallWS extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected Void doInBackground(Void... params) { Log.i(TAG, "doInBackground"); location(); return null; } @Override protected void onPostExecute(Void result) { Log.i(TAG, "onPostExecute"); } @Override protected void onPreExecute() { Log.i(TAG, "onPreExecute"); } @Override protected void onProgressUpdate(Void... values) { Log.i(TAG, "onProgressUpdate"); } } public void location() { String SOAP_ACTION = "http://example.com/getlocations"; String METHOD_NAME = "getlocations"; String NAMESPACE = "http://example.com/"; String URL = "http://localhost/example/Service.asmx"; try { SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME); Request.addProperty("get locations", "null"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(Request); HttpTransportSE transport= new HttpTransportSE(URL); transport.call(SOAP_ACTION, envelope); Object result=(Object)envelope.getResponse(); final results = (String[]) result; getActivity().runOnUiThread(new Runnable() { @Override public void run() { // This code will always run on the UI thread, therefore is safe to modify UI elements. ArrayAdapter&lt;MyObject&gt; adapter = new Arra…
tagged with: android
tagged with: web-services
has answer: http://stackoverflow.com/a/21760277
accepted answer: http://stackoverflow.com/a/21760277
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: listview
tagged with: arraylist
score: 0
has title: How to set a list view array from a web service

http://stackoverflow.com/q/21682193
score: 0
answer count: 3
tagged with: converters
tagged with: string
accepted answer: http://stackoverflow.com/a/21682249
has body: I need to be able to convert an int into a string which represents a series of bytes, and back. To do this, I came up with this code: Int -> Byte[] -> String new String(ByteBuffer.allocate(5).putInt(num).array()) String -> Byte[] -> Int ByteBuffer.allocate(4).put(team.getBytes()).getInt(0) One of my test cases is the number 4231. When viewed as a string, none of the characters are visible but that's not completely unusual, and when I invoke it's .length() method, it returns 4. But when I used .getBytes(), I get [0, 0, 16, -17, -65, -67], which causes a StackOverflowException. Can someone explain this result to me?
possible better answer: http://stackoverflow.com/a/21682326
has answer: http://stackoverflow.com/a/21682326
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32777190
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21682249
has answer: http://stackoverflow.com/a/21682606
tagged with: arrays
has title: Java: Why does this string of 4 characters create a byte[] with 6 data?
has comment: http://stackoverflow.com/comment/32777309
tagged with: int

http://stackoverflow.com/comment/33060344
has text: Need to see the stacktrace.
type: Comment
comment on: http://stackoverflow.com/a/21841192
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32853089
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21720775
type: AnswerComment
has text: I replaced the section of code you wrote in the given section in my `androidmanifest.xml` file and it has not resolved the problem yet unfortunately

http://stackoverflow.com/a/21699856
score: 2
answers question: http://stackoverflow.com/q/21699574
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: For example: public class Example { public static void main(String...args) { new C(); } public static class A { public A() { System.out.println("A"); } } public static class B extends A { public B() { System.out.println("B"); } } public static class C extends B { public C() { System.out.println("C"); } } } Also note that this might not print what you would expect. It would actually print: A B C Why? Constructors are always chained to the super class.
type: Answer
accepted answer of: http://stackoverflow.com/q/21699574

http://stackoverflow.com/a/21783363
score: 0
has body: Extending a class means that your class is "inheriting" the methods of the standard class; in other words, you are taking an existing class and building your class on top of it. That is how Java manages all objects (i.e. every class that you create actually extends the default Object class). When you import a class, on the other hand, you have access to all its functionality, but you cannot build on top of it as you could with inheritance.
type: Answer
answers question: http://stackoverflow.com/q/21783301

http://stackoverflow.com/a/22260115
answers question: http://stackoverflow.com/q/21771043
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: You don't show the code for the finalizer guardian, but I would suggest that one should avoid having a finalizable object hold a reference back to the original. Instead, those aspects of the original which would need cleanup should be encapsulated within the finalizable object (possibly using an AtomicReference or AtomicInteger). For example, an object which encapsulates an OS file handle could keep the handle itself encapsulated within a private finalizable object that holds the handle in an AtomicInteger. If the outer object gets abandoned, the handle can be cleaned up without anything having to access the outer object. If the outer object is asked to close the file, it can relay the request to the inner object, which can then read and clear the AtomicInteger where the handle is stored (thus ensuring the file can get closed only once).

handler
tags question: http://stackoverflow.com/q/21810015
tags question: http://stackoverflow.com/q/21723545
tag name: handler
type: Tag
tags question: http://stackoverflow.com/q/21700958
tags question: http://stackoverflow.com/q/21810783

http://stackoverflow.com/q/21696443
tagged with: web-services
type: Question
type: AnsweredQuestion
score: 3
tagged with: mule
tagged with: mule-studio
has title: How to expose a jax-ws which is located in a mule devkit connector?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21705712
favorite count: 0
has body: I need to expose a jax-ws which is located in a mule devkit connector. Is there a way to do this operation or should I separate the jax-ws and mule-connecor?
upvote count: 3
accepted answer: http://stackoverflow.com/a/21705712
tagged with: java
tagged with: jax-ws

http://stackoverflow.com/q/21728406
score: 0
has answer: http://stackoverflow.com/a/21728471
has answer: http://stackoverflow.com/a/21728488
has comment: http://stackoverflow.com/comment/32858874
has comment: http://stackoverflow.com/comment/32859002
has answer: http://stackoverflow.com/a/21731669
type: UnansweredQuestion
tagged with: multithreading
answer count: 4
tagged with: performance
has answer: http://stackoverflow.com/a/22148334
has body: I need to build a job processing module wherein the incoming rate of jobs is in the order of millions. I have a multiprocessor machine to run these jobs on. In my current solution for Java, I use Java's ThreadPoolExecutor framework to create a job queue, a LinkedListBlockingQueue, and the number of threads equals the available processor on the system. This design is not able to sustain the incoming rate as the job queue keeps growing and within seconds it reports the overflow even though the CPU utilization is not maxed out. The CPU utilization remains somewhere in the range of 30-40 percent. It means that most of the time is going away in thread contention where other CPU remains idle. Is there any better way of processing the jobs so that CPUs are utilized better so that job queue does not overflow?
tagged with: java
tagged with: concurrency
type: Question
has title: Java: How to build a scalable Job processing mechanism
has comment: http://stackoverflow.com/comment/32869089

http://stackoverflow.com/a/21770432
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21770373
has body: The idea is you get text of &lt;td class="resutinfo"&gt; first, which should be Displaying 1 - 10 of 41 records Results per page: 10 20 30 Then you get the text of the &lt;select&gt;, which should be 10 20 30 Then replace it with empty string to remove. String tdText = driver.findElement(By.xpath(".//td[@class='resutinfo']")).getText(); String selectText = driver.findElement(By.xpath(".//td[@class='resutinfo']/select")).getText(); tdText.replace(selectText, "").trim();
type: Answer

http://stackoverflow.com/q/21798819
has comment: http://stackoverflow.com/comment/32984918
tagged with: java
accepted answer: http://stackoverflow.com/a/21799126
type: AnsweredQuestion
tagged with: user-interface
type: Question
has comment: http://stackoverflow.com/comment/32984843
has body: I am confused about my program. How can I get my integer array in my concatenation if I click on some list? Here is the code I'm trying. import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; public class JListDemo extends JFrame { JList list; String[] listColorNames = {"tres", "dos", "piso", "kwatro", "sais"}; int[] listColorValues = {3, 2, 1, 4, 6}; Container con; public JListDemo() { super("List Source Demo"); con = getContentPane(); con.setLayout(new FlowLayout()); list = new JList(listColorNames); list.setSelectedIndex(0); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); con.add(new JScrollPane(list)); list.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { con. (listColorValues[list.getSelectedIndex()]); } } ); setSize(200, 200); setVisible(true); //setSizable(false); } public static void main(String[] args) { JListDemo test = new JListDemo(); test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
has title: Int array can't call out
possible better answer: http://stackoverflow.com/a/21799514
has comment: http://stackoverflow.com/comment/32984828
has answer: http://stackoverflow.com/a/21799514
has answer: http://stackoverflow.com/a/21799126
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32984871
has comment: http://stackoverflow.com/comment/32984902

http://stackoverflow.com/comment/32845022
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Remove and rearrange in arraylist](http://stackoverflow.com/questions/18714352/remove-and-rearrange-in-arraylist)
comment on: http://stackoverflow.com/q/21720157

http://stackoverflow.com/a/21724978
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21724688
score: 0
type: Answer
has body: Change your Select Type in jsp as follows User Type: Employee Project Co-ordinator Project Manager Admin
has comment: http://stackoverflow.com/comment/32853519
accepted answer of: http://stackoverflow.com/q/21724688

http://stackoverflow.com/comment/32997211
type: Comment
comment on: http://stackoverflow.com/q/21805670
type: QuestionComment
has text: You could just try it you know.
score: 1

http://stackoverflow.com/a/21729217
upvote count: 1
answers question: http://stackoverflow.com/q/21728958
accepted answer of: http://stackoverflow.com/q/21728958
has body: Have a look at Contracts for Java, which helps enforing pre- and postconditions as well as invariants through annotations. But there's no compile-time-checking, only runtime as far as I know.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/32975497
has text: Yes. Use a `while` loop instead.
score: 3
comment on: http://stackoverflow.com/q/21793374
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33125732
score: 0
has text: I've tried with aSmack. It works fine with the currently logged in user. And when you try to change another vCard... it still updates the vCard of the currently logged in user. Which is according to the docs, the right behavior. It's king of confusing but it makes sense that you can't modify the vCard of somebody else than you.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21857944

http://stackoverflow.com/comment/32924097
has text: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21764624

http://stackoverflow.com/comment/32931588
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21768687
type: Comment
has text: see if this helps you: http://stackoverflow.com/questions/21732520/what-happens-to-an-arraylist-in-an-activity-that-is-recalled/21733769#21733769

http://stackoverflow.com/a/21782494
has comment: http://stackoverflow.com/comment/34181866
has comment: http://stackoverflow.com/comment/32956462
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21782357
has comment: http://stackoverflow.com/comment/32957952
has comment: http://stackoverflow.com/comment/32956023
type: Answer
downvote count: 0
has body: if i set the min sdk version to 17 then no one using an android OS that below level 17 will be able to install and use my app right? Correct. This is explained in the official documentation here. how do I get around this? There are libraries around that provide a backward compatibility for that visual component, you could have a look at android-textclock-backport for example (although I didn't test it).
has comment: http://stackoverflow.com/comment/32957614

http://stackoverflow.com/q/21812284
score: 0
tagged with: break
has answer: http://stackoverflow.com/a/21812317
accepted answer: http://stackoverflow.com/a/21812317
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21812305
tagged with: conditional-statements
has title: Java - object for loop with condition?
tagged with: java
possible better answer: http://stackoverflow.com/a/21812305
has comment: http://stackoverflow.com/comment/33008992
type: Question
tagged with: iterator
answer count: 2
has body: This may sound silly but I couldn't find an answer by googling it. When using a for loop in it's simplest form I can add conditions to break the loop in the for statement. example: for(int i=0; i&lt;100 &amp;&amp; condition2 &amp;&amp; condition3; i++){ //do stuff } When using an object for loop like this: for(String s:string_table){ //do stuff } how can i add a condition to break the loop? I'm talking about adding conditions in the for statement. I know I can add the condition inside //do stuff part and break from there.

http://stackoverflow.com/comment/32841987
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21718042
has text: Yep! :) That's why I included Method 2.
score: 0

http://stackoverflow.com/comment/54665653
type: Comment
comment on: http://stackoverflow.com/a/23185075
type: AnswerComment
has text: Your `<input type="hidden"...` block helped with me with another problem - thanks.
score: 0

memory-leaks
tags question: http://stackoverflow.com/q/21759404
tags question: http://stackoverflow.com/q/21717814
type: Tag
tags question: http://stackoverflow.com/q/21679057
tag name: memory-leaks
tags question: http://stackoverflow.com/q/21683709

android-intent
tags question: http://stackoverflow.com/q/21770692
tags question: http://stackoverflow.com/q/21760810
tags question: http://stackoverflow.com/q/21789492
tags question: http://stackoverflow.com/q/21702190
tags question: http://stackoverflow.com/q/21806656
tags question: http://stackoverflow.com/q/21756161
tags question: http://stackoverflow.com/q/21821763
tags question: http://stackoverflow.com/q/21716751
tags question: http://stackoverflow.com/q/21800686
tags question: http://stackoverflow.com/q/21751139
tags question: http://stackoverflow.com/q/21788571
tags question: http://stackoverflow.com/q/21762778
tags question: http://stackoverflow.com/q/21744096
tags question: http://stackoverflow.com/q/21802537
type: Tag
tag name: android-intent
tags question: http://stackoverflow.com/q/21736298
tags question: http://stackoverflow.com/q/21704838
tags question: http://stackoverflow.com/q/21708702
tags question: http://stackoverflow.com/q/21729093

http://stackoverflow.com/a/21823843
upvote count: 1
has body: As with byte, int, float etc. these are all called primitive types. A String is sort of like a primitive type in the sense that you do not need to say String abc = new String("xyz");. It's actual name is a String Literal. Since Strings are used so much in Java programming, it's just a convenience method to use String abc = "xyz". The two are exactly the same when compiled, however one is arguably easier to read, but even then, there is still hardly any difference.
type: Answer
answers question: http://stackoverflow.com/q/21823740
downvote count: 0
score: 1

http://stackoverflow.com/q/21738467
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/21738532
tagged with: recursion
has body: How would I write the toString method? And how could I change the way users can fill numbers? Here's the code: public class NArray { private int[] intArray; private NArray[] array; public NArray(int n, int size, int fillNum) { if(n==1) { intArray = new int[size]; for(int i=0;i&lt;size;i++) { intArray[i]=fillNum; } } else { array=new NArray[size]; for(int i=0;i&lt;size;i++) { array[i] = new NArray(n-1,size, fillNum); } } } }
has title: I've just written this class for an n-dimensional array object. Is there any way I can improve it?
tagged with: java
has comment: http://stackoverflow.com/comment/32877633
type: Question
has answer: http://stackoverflow.com/a/21738644
answer count: 2
upvote count: 0
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/32877710

http://stackoverflow.com/q/21690313
type: AnsweredQuestion
tagged with: geometry
has answer: http://stackoverflow.com/a/21692376
downvote count: 2
has comment: http://stackoverflow.com/comment/32792912
has comment: http://stackoverflow.com/comment/32792322
has comment: http://stackoverflow.com/comment/32792212
type: Question
score: -2
tagged with: java
has title: The triangle made of asterisks
possible better answer: http://stackoverflow.com/a/21690455
has answer: http://stackoverflow.com/a/21690644
answer count: 3
has answer: http://stackoverflow.com/a/21690455
upvote count: 0
accepted answer: http://stackoverflow.com/a/21690644
favorite count: 0
has comment: http://stackoverflow.com/comment/32792380
has body: I saw a few post on this already but I don't seem to understand what the problem is. I am very new at this and I just can't figure this out. I have to make a triangle made of asterisk for a homework. The number of rows wille be determined by which integer the user inputs and show give something like this * ** *** **** I'm not really sure how to do this. But this is what I have so far (pretty sure I made dumb errors) import java.util.Scanner; public class triangle { public static void main(String args[]) { /*declarations*/ Scanner input= new Scanner(System.in); int how_many;/*number of rows*/ int i; int j; /*prompt for input*/ System.out.printIn("Choissiez un nombre entier postif"); how_many=input.nextInt(); } for(i=1;i&lt;=1;i++){ for(j=1;j&lt;=i;j++){ System.out.print("*"); } System.out.printIn(); } }
has comment: http://stackoverflow.com/comment/32792370
tagged with: input
has comment: http://stackoverflow.com/comment/32792332
has comment: http://stackoverflow.com/comment/32792286

http://stackoverflow.com/q/21732499
has answer: http://stackoverflow.com/a/21733004
answer count: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
upvote count: 0
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/32977598
type: Question
has title: What is function of closeContextMenu(), closeOptionsMenu(),etc.?
score: -2
accepted answer: http://stackoverflow.com/a/21733004
has body: Hi I'm just another android newbie, I am not understanding why there is a need for closeContextMenu() and closeOptionsMenu() before anything else is executed ...thanks in advance... Button buttonSend = (Button) findViewById(R.id.send); buttonSend.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { closeContextMenu(); closeOptionsMenu(); progressBar=new MobiProgressBar(EncodeActivity.this); progressBar.setMax(100); progressBar.setMessage(context.getString(R.string.encoding)); progressBar.show(); Thread tt = new Thread(new Runnable() { public void run() { Uri uri= encode(); MmsIntent mms=new MmsIntent(uri,EncodeActivity.this); progressBar.dismiss(); mms.send(); //handler.post(mShowAlert); } }); tt.start();

http://stackoverflow.com/comment/33030924
comment on: http://stackoverflow.com/q/21824674
score: 1
has text: Uhm, why don't you use the `URI` class to identify URLs? This would imho be faster than using a regex...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21829023
tagged with: java
tagged with: hibernate
tagged with: mysql
accepted answer: http://stackoverflow.com/a/21829078
possible better answer: http://stackoverflow.com/a/26902953
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26902953
has title: How can I get last inserted id using Hibernate
upvote count: 12
tagged with: struts2
score: 11
has body: I want to fetch the last inserted value's id in Hibernate. After search: Long lastId = ((Long) session.createSQLQuery("SELECT LAST_INSERT_ID()").uniqueResult()).longValue(); But the following code gives me this error: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long Please share your thoughts! Solution Long lastId = ((BigInteger) session.createSQLQuery("SELECT LAST_INSERT_ID()").uniqueResult()).longValue(); Don't forget to import: import java.math.BigInteger;
has comment: http://stackoverflow.com/comment/33038882
has answer: http://stackoverflow.com/a/30071569
favorite count: 0
has answer: http://stackoverflow.com/a/21829078
linked to: http://stackoverflow.com/q/25561681
has comment: http://stackoverflow.com/comment/33039125
has comment: http://stackoverflow.com/comment/33038647
has answer: http://stackoverflow.com/a/21829113
answer count: 4
has comment: http://stackoverflow.com/comment/96151746
has comment: http://stackoverflow.com/comment/58565020
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33038729

http://stackoverflow.com/a/21824943
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21819199
answers question: http://stackoverflow.com/q/21819199
score: 0
has body: You shall not put empty line between annotation and class definition, this one should work: import com.xx.{Bar,Baz} @Bar(value = "XX", description = "xx") class Foo extends Baz { }

http://stackoverflow.com/comment/33026128
has text: Yes Zeeshan I did go thru that post but it doesnt say why the Parent Class gets loaded first even after making a reference to the Child class.
comment on: http://stackoverflow.com/q/21821865
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38198430
score: 0
type: Comment
has text: encrypt and decrypt twice to show the way of use of both sealed object and Cipher streams, however this works the same. you can try and see yourself before downvote. Only basilar adjustments (like proper try-catch blocks) are needed to compile this code.
comment on: http://stackoverflow.com/a/21805065
type: AnswerComment

http://stackoverflow.com/q/21694655
favorite count: 0
has answer: http://stackoverflow.com/a/21778990
has body: i have some problem using Morris Chart. I want to show the details of transaction using Morris Chart using JSON from external source. Here's my code: $(document).ready(function() { //getting JSON data from external sources var json_data = (function() { var json; $.ajax({ type:'GET', url: 'http://localhost:8080/masterpiece/chartGetTransaction', async: false, global: false, success: function(data) { json = data; }, error:function(){ alert("Error loading chart"); } }); return json; })(); //testing purposes to see whether json is shown up or not. alert(json_data); new Morris.Bar({ // ID of the element in which to draw the chart. element: 'pesanan-chart-area', data: json_data, xkey: 'tahun', ykeys: ['jml'], labels: ['Jumlah'], smooth: false }); }); But it always broken. The JSON itself: [{"tahun":"2013-10-12","jml":3},{"tahun":"2013-11-16","jml":2},{"tahun":"2013-12-23","jml":4},] when i place the JSON manually to 'data:' attribute, the chart is shown up. But when it referenced from external source (json_data var) it is broken any ideas? thanks. UPDATE update! the JSON is generated from JAVA function using third party library called json-simple (https://code.google.com/p/json-simple/downloads/list) protected List&lt;JSONObject&gt; statisticPesanan(){ List&lt;JSONObject&gt; det = new ArrayList&lt;JSONObject&gt;(); try { //create JSONObject to executed String sql = "SELECT * FROM vstatisticpesanan"; cs = datman.logOn().prepareCall(sql); ResultSet result = cs.executeQuery(); while (result.next()) { JSONObject details = new JSONObject(); details.put("tahun", result.getString(1)); details.put("jml", result.getInt(2)); det.add(details); } } catch (SQLException se) { Logger.getLogger(Analytics.class.getName()).log(Level.SEVERE, null, se); java.lang.System.out.println("Error on Analytics Generate JSON Pesanan Statistics : " + se.toString()); } finally { datman.logOff(); } return det; } then called via servlet: protected void processRequest(HttpServletRequest request, HttpServlet…
score: 1
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/21797450
accepted answer: http://stackoverflow.com/a/21778990
tagged with: servlets
has title: Morris Chart Broken From External JSON
answer count: 1
downvote count: 0
tagged with: morris.js
tagged with: jquery

http://stackoverflow.com/comment/32806511
comment on: http://stackoverflow.com/a/21698088
type: AnswerComment
score: 0
type: Comment
has text: serious?! a LIST OF INT?? From the Docs: http://docs.oracle.com/javase/6/docs/api/java/util/List.html#size()

http://stackoverflow.com/comment/32987775
comment on: http://stackoverflow.com/a/21800455
type: AnswerComment
has text: No, you can call it before if you want. An array is a type of Java object, so updating the object will reflect in all references to that `Object`.
score: 0
type: Comment

http://stackoverflow.com/comment/32770224
comment on: http://stackoverflow.com/q/21678327
score: 0
has text: Unable to pause activity???? why ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32947160
has text: sorry i am not understand what you are trying to do. 1) there is only one item in listview?????
type: Comment
comment on: http://stackoverflow.com/a/21777518
score: 0
type: AnswerComment

http://stackoverflow.com/q/21834003
answer count: 1
score: 1
favorite count: 0
has body: EventObject target = new EventObject("e2"); Set&lt;EventObject&gt; Following = o.getFollowingEvents(e1); System.out.println("Elements : "+Following.toString()); System.out.println(e2.toString()); System.out.println(Following.toString()+" contains "+e2+" ? = "+Following.contains(target)); Print : Elements : [e2, e5, end, T] e2 [e2, e5, end, T] contains e2 ? = false Equals and CompareTo : @Override public int compareTo(EventObject o) { return this.getName().compareTo(o.getName()); } @Override public boolean equals(Object obj) { return (obj instanceof EventObject) &amp;&amp; (this.compareTo((EventObject) obj) == 0); } How is this possible, if the event is present on the Set ?
has answer: http://stackoverflow.com/a/21834018
type: UnansweredQuestion
tagged with: equals
upvote count: 2
has title: Java Set, contains, false result
tagged with: java
tagged with: set
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33051020
tagged with: compareto
has comment: http://stackoverflow.com/comment/33047084
tagged with: contains

http://stackoverflow.com/comment/33009518
score: 0
comment on: http://stackoverflow.com/q/21795688
has text: 17 17 17 17 17 17 17 9 -1 These are the outputs in console. Actually I just inputted "cleartext" in the original .txt text. I'm still confusing now I don't think this is something wrong with my close of cos and fos. Because I can output the encrypted file firstly. Later I just change the path of two String
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33041825
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21830970
has text: Definitely it would be slow with increase in the size of arraylist. Usage of `contains()` will be in single line and would be more readable and easier than your for loop
score: 0

http://stackoverflow.com/comment/32866602
has text: @a_horse_with_no_name: I successfully tested your solution with `zeroDateTimeBehavior=round`, so thanks again! Why don't you write that as a short 'Answer' so I can 'accept' it for others to see? :)
score: 0
comment on: http://stackoverflow.com/q/21729755
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21795787
has comment: http://stackoverflow.com/comment/32979866
has comment: http://stackoverflow.com/comment/32979592
type: Answer
has comment: http://stackoverflow.com/comment/32979647
has comment: http://stackoverflow.com/comment/32980073
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21795703
has comment: http://stackoverflow.com/comment/32979636
answers question: http://stackoverflow.com/q/21795703
has body: UPDATE - it seems there is a way :-) https://github.com/benjholla/ColorMixer (does not seem to be working 100%, see the disclaimer) see Adding Colours (Colors) Together like Paint (Blue + Yellow = Green, etc) import java.awt.Color; import java.awt.Font; import java.io.IOException; import javax.swing.JFrame; import javax.swing.JLabel; import colormixer.KMColorUtils; public class Byta { public static void main(String[] args) throws IOException { Font font = new Font("Arial", Font.BOLD, 12); JFrame frame = new JFrame("HelloWorldSwing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Hello World"); label.setFont(font); Color customColor = KMColorUtils.mix(Color.CYAN, Color.YELLOW); label.setForeground(customColor); frame.getContentPane().add(label); frame.pack(); frame.setVisible(true); } } gives
has comment: http://stackoverflow.com/comment/32980288
has comment: http://stackoverflow.com/comment/32980482
score: 1
has comment: http://stackoverflow.com/comment/32980308
upvote count: 1
has comment: http://stackoverflow.com/comment/32979826
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32979931
has comment: http://stackoverflow.com/comment/32980191
has comment: http://stackoverflow.com/comment/32980046

http://stackoverflow.com/comment/32846859
comment on: http://stackoverflow.com/a/21721262
type: AnswerComment
score: 0
type: Comment
has text: @user2864740 read again: `((double)someValue)`...

http://stackoverflow.com/comment/32843001
comment on: http://stackoverflow.com/q/21718901
type: Comment
type: QuestionComment
has text: Each player has 130 dictionary objects as attributes
score: 0

http://stackoverflow.com/q/21750601
tagged with: java
has answer: http://stackoverflow.com/a/21765402
has body: I want to use my java project on Raspberry Pi. This code depends on sqlite4java which uses native implementations for many platforms including arm processors link. The problem is that java can't load required sqlite wrapper for arm processor. I was doing the follows: Copied all version (tried one by one) of precompiled libraries (libsqlite4java-linux-armv5te.so, libsqlite4java-linux-armv7a.so, libsqlite4java-linux-arm.so) which I renamed to libsqlite4java-linux-arm.so. Command java -Djava.library.path=. -jar sqlite4java.jar -d gives output: 140213:092447.509 FINE [sqlite] Internal: loading library 140213:092447.536 FINE [sqlite] Internal: java.library.path=. 140213:092447.538 FINE [sqlite] Internal: sqlite4java.library.path=null 140213:092447.541 FINE [sqlite] Internal: cwd=/home/pi/sqlite4java-282/. 140213:092447.544 FINE [sqlite] Internal: default path=/home/pi/sqlite4java-282 140213:092447.554 FINE [sqlite] Internal: forced path=null 140213:092447.558 FINE [sqlite] Internal: os.name=linux; os=linux 140213:092447.562 FINE [sqlite] Internal: os.arch=arm 140213:092447.575 FINE [sqlite] Internal: trying to load sqlite4java-linux-arm from /home/pi/sqlite4java-282/libsqlite4java-linux-arm.so 140213:092447.596 FINE [sqlite] Internal: cannot load sqlite4java-linux-arm from /home/pi/sqlite4java-282/libsqlite4java-linux-arm.so: java.lang.UnsatisfiedLinkError: /home/pi/sqlite4java-282/libsqlite4java-linux-arm.so: /home/pi/sqlite4java-282/libsqlite4java-linux-arm.so: cannot open shared object file: No such file or directory 140213:092447.605 FINE [sqlite] Internal: trying to load sqlite4java-linux-arm 140213:092447.617 FINE [sqlite] Internal: cannot load sqlite4java-linux-arm: java.lang.UnsatisfiedLinkError: /home/pi/sqlite4java-282/libsqlite4java-linux-arm.so: /home/pi/sqlite4java-282/libsqlite4java-linux-arm.so: cannot open shared object file: No such file or directory 140213:092447.622 FINE [sqlite] Internal: trying to load sqlite4java-linux 140213:092447.627 FINE [sqlite…
score: 4
answer count: 2
tagged with: raspberry-pi
tagged with: sqlite
possible better answer: http://stackoverflow.com/a/69555607
favorite count: 0
has answer: http://stackoverflow.com/a/69555607
upvote count: 4
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/21765402
type: Question
tagged with: raspbian
has title: Sqlite4java on Raspberry Pi

http://stackoverflow.com/comment/33037868
score: 0
has text: First refresh ur project in Eclipse then you can see it.. in the console there will be nothing .if you run this program
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21828403

http://stackoverflow.com/q/21801594
tagged with: android
upvote count: 3
type: UnansweredQuestion
has body: I have TableLayout and I would like to have buttons as cells. All buttons should have the same width. And all buttons should have the same height. (Weight and height will be different as I want to fill the screen). I was sure that I'm doing everything right but unfortunately only the width is the same. The problem is with height - first two rows have the same height, the third is smaller (or more precisely as long as buttons doesn't contain any text, the height is the same, but when I put text, the height is not equal). I couldn't believe that it doesn't work so I made even screenshoot and I checked the distance in graphical program. My table: <TableLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:stretchColumns="*" android:shrinkColumns="*" android:weightSum="3" android:padding="@dimen/dialog_margin" > // buttons analogously as in previous row.... // buttons analogously as in previous row.... I tried also to set the TableRow height as match_parent. It doesn't help. And btw how shrinkColums work, in particular together with stretchColumns? (I had version with and without shrinkColumns and it seems there is no difference.
has answer: http://stackoverflow.com/a/21801752
has title: Android TableLayout - equal width and equal height of cells - doesn't work, why
score: 3
tagged with: android-layout
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21801820
answer count: 2
tagged with: android-view
downvote count: 0
favorite count: 0
tagged with: android-tablelayout

http://stackoverflow.com/comment/32857285
score: 0
type: AnswerComment
type: Comment
has text: I understood your above program but please tell me What exactly does Monitor with a barrier (condition) means? Can you make reference with your example.
comment on: http://stackoverflow.com/a/21724276

http://stackoverflow.com/comment/33010096
type: Comment
type: QuestionComment
has text: anyway this tutorial isn't good .. it using deprecated `startManagingCursor` it also closing Database but Cursor is still opened it will lead to errors with "large cursors"
score: 0
comment on: http://stackoverflow.com/q/21812762

http://stackoverflow.com/q/21719269
favorite count: 0
possible better answer: http://stackoverflow.com/a/21719676
has title: Decoding APK Files in android
upvote count: 3
tagged with: android
tagged with: dex2jar
accepted answer: http://stackoverflow.com/a/21719298
has answer: http://stackoverflow.com/a/21719298
has answer: http://stackoverflow.com/a/21719676
type: AnsweredQuestion
score: -5
has body: I tried to decode a published application from Google Play with its apk file by using dex2jar and apktool. I successfully manage to get its source code however, I am wondering why the hell I got this sets of codes(attached image)? I could not clearly get the package/s and the activity names of this app. I need it badly. Is it because of encapsulation? How can I get the real code?
tagged with: java
type: Question
downvote count: 8
answer count: 2
tagged with: encapsulation

http://stackoverflow.com/q/21788741
tagged with: java
answer count: 3
tagged with: jpa
accepted answer: http://stackoverflow.com/a/21789445
has title: JPA select rows with where clause
possible better answer: http://stackoverflow.com/a/21788893
linked to: http://stackoverflow.com/q/12244799
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21788893
has answer: http://stackoverflow.com/a/21789119
has comment: http://stackoverflow.com/comment/32967556
has body: I know that entityManager.find() method can be used to fetch a row with the primary key. But I have a requirement to define a common find method which accepts a map having the where clause conditions. In the map, key will be the column name and value will be the column name value of the where clause. This method should return the list of selected rows. Can some one help me out?
score: 0
type: Question
has answer: http://stackoverflow.com/a/21789445

http://stackoverflow.com/comment/32895019
has text: Please provide a minimum (non)working example.
comment on: http://stackoverflow.com/q/21748042
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32788421
has text: Do you have any links to documentation relating to this?
type: Comment
comment on: http://stackoverflow.com/a/21687746
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41191356
has text: @aardvarkk did you find out the solution? same issue here, I've working 4 hours straight to solve this....
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21741992

http://stackoverflow.com/comment/32900779
comment on: http://stackoverflow.com/a/21750062
score: 0
type: AnswerComment
type: Comment
has text: @akshay if the file was created by the program (or user) you can change the permission. I have tried this before when uploading a file to a server.I had to execute these statement to read the file. Otherwise it returned 'Permission denied' error.

http://stackoverflow.com/comment/33109536
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21829443
score: 0
has text: @YvesDaoust: By simply invoking `bufferedReader.readLine` `n` times in row? The first invocation fills the buffer and others work using it until more data need to be fetch.

mutators
tags question: http://stackoverflow.com/q/21816582
type: Tag
tag name: mutators

http://stackoverflow.com/comment/32912628
type: Comment
comment on: http://stackoverflow.com/q/21757158
score: 1
has text: @murrmurr - We don't understand what you are saying. Saying it 4 times doesn't help. Perhaps you need to find someone who speaks your language to help you.
type: QuestionComment

http://stackoverflow.com/comment/32896451
has text: In my example, integer1 is already a foreign key to another table and i dont see any advantage in using a surrogate key here.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21749182

http://stackoverflow.com/q/21758276
tagged with: jtable
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21771715
has body: I am trying to retrieve the data from the database and show it at the JTable. I'm using NetBeans and in debugging I have noticed that data from database is actually retrieved and data is populated in the Array "Appointment" but somehow it goes through these lines of code (which should insert everything into the table) and stops as if everything is done without any errors, although in GUI there is nothing showing up. Your help would be really appreciated. private void search(){ try{ Model_Customer[] appointment = Controller_ManageCustomer.FindCustomers(Searchtxt.getText()); resultModel.setRowCount(0); for(int i = 0; i &lt; appointment.length; i++) resultModel.insertRow(i,new Object[]{appointment[i].GetID(),appointment[i].GetFName(), appointment[i].GetLName(), appointment[i].GetRegistration(), appointment[i].GetMake(), appointment[i].GetModel(), appointment[i].GetEngine(), appointment[i].GetYear(), appointment[i].GetMileage(), appointment[i].GetType(), appointment[i].GetDate(), appointment[i].GetTime()}); }catch(Exception ex){ JOptionPane.showMessageDialog(this,ex.getMessage(),"Error",JOptionPane.ERROR_MESSAGE); } } DefaultTableModel resultModel = new DefaultTableModel(); in NetBeans Design the table code is: tableresult = new javax.swing.JTable(resultModel); tableresult.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null} }, new String [] { "ID", "FName", "LName", "Registration", "Make", "Model", "Engine", "Type", "Date", "Time" } )); jScrollPane1.setViewportView(tableresult);
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32913488
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/21768657
type: Question
tagged with: arrays
has title: InsertRow in JTable via array (array is populated by data) no errors
has comment: http://stackoverflow.com/comment/32913959

http://stackoverflow.com/comment/32980424
type: Comment
comment on: http://stackoverflow.com/a/21734339
score: 0
type: AnswerComment
has text: 02-15 05:25:34.684: E/AndroidRuntime(1899): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.makor.pokus/com.makor.pokus.Pokus}: java.lang.NullPointerException

keylistener
tags question: http://stackoverflow.com/q/21791999
type: Tag
tags question: http://stackoverflow.com/q/21831965
tags question: http://stackoverflow.com/q/21685029
tags question: http://stackoverflow.com/q/21714436
tags question: http://stackoverflow.com/q/21738787
tags question: http://stackoverflow.com/q/21817427
tag name: keylistener

http://stackoverflow.com/q/21681910
tagged with: java
has answer: http://stackoverflow.com/a/21682196
accepted answer: http://stackoverflow.com/a/21682196
type: Question
has title: having error when trying to catch values from database and display it in a text view. android
possible better answer: http://stackoverflow.com/a/21682048
score: 0
has answer: http://stackoverflow.com/a/21683768
answer count: 3
tagged with: android
tagged with: sqlite
has body: i am having a sqllite database. i am trying to catch values from the database and display it in a text view. i get the following error. having error in this line TextView result = (TextView) findViewById(R.id.textviewres); Full error stack.. 02-10 21:24:53.986: E/AndroidRuntime(27992): FATAL EXCEPTION: main 02-10 21:24:53.986: E/AndroidRuntime(27992): java.lang.RuntimeException: Unable to start activity ComponentInfo{lk.adspace.jaffnatemples/lk.adspace.jaffnatemples.Db_results}: java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView 02-10 21:24:53.986: E/AndroidRuntime(27992): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343) 02-10 21:24:53.986: E/AndroidRuntime(27992): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395) 02-10 21:24:53.986: E/AndroidRuntime(27992): at android.app.ActivityThread.access$600(ActivityThread.java:162) 02-10 21:24:53.986: E/AndroidRuntime(27992): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 02-10 21:24:53.986: E/AndroidRuntime(27992): at android.os.Handler.dispatchMessage(Handler.java:107) 02-10 21:24:53.986: E/AndroidRuntime(27992): at android.os.Looper.loop(Looper.java:194) 02-10 21:24:53.986: E/AndroidRuntime(27992): at android.app.ActivityThread.main(ActivityThread.java:5371) 02-10 21:24:53.986: E/AndroidRuntime(27992): at java.lang.reflect.Method.invokeNative(Native Method) 02-10 21:24:53.986: E/AndroidRuntime(27992): at java.lang.reflect.Method.invoke(Method.java:525) 02-10 21:24:53.986: E/AndroidRuntime(27992): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 02-10 21:24:53.986: E/AndroidRuntime(27992): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 02-10 21:24:53.986: E/AndroidRuntime(27992): at dalvik.system.NativeStart.main(Native Method) 02-10 21:24:53.986: E/AndroidRuntime(27992): Caused by: java.lang.ClassCastException: android.widget.RelativeLayout c…
has answer: http://stackoverflow.com/a/21682048
type: AnsweredQuestion

http://stackoverflow.com/comment/33010461
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21813002
has text: it tells me no permmison internet !?
score: 0

http://stackoverflow.com/a/21734115
answers question: http://stackoverflow.com/q/21733963
type: Answer
downvote count: 0
has body: Replace this: homework = dylan.nextInt(); with this: homework += dylan.nextInt(); Your code to break out of the loop is also faulty. You are never updating the choice variable, so you won't ever exit the loop. You also want to be careful that you don't add -1 to homework when the user wants to leave the loop.
score: 1
upvote count: 1

http://stackoverflow.com/a/22022977
score: 0
has body: I'm also trying to make the server code of spika to run, so i hope i could help you a bit and matbe you could also help me. Well about your issue here at the next link - http://www.spikaapp.com/en/build/android You can see you need to change two line at your code - public static final String BASE_URL = "http://localhost:8080/wwwroot/api/"; public static final String INFORMATION_URL= "http://localhost:8080/wwwroot/page/information"; So i wouuld say you need to add the next bits- public static final String BASE_URL = "http://10.0.2.2:5983/wwwroot/api/"; public static final String INFORMATION_URL= "http://10.0.2.2:5983/wwwroot/page/information"; Hope this will help you
answers question: http://stackoverflow.com/q/21792447
type: Answer

http://stackoverflow.com/comment/33026772
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21818419
has text: [This](http://www.regular-expressions.info/tutorial.html) tutorial is pretty comprehensive, if you want to begin regex properly from scratch

http://stackoverflow.com/comment/33028938
has text: Read about working of method split, u will get your answer......
type: Comment
comment on: http://stackoverflow.com/q/21823595
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32829432
score: 0
has text: I think the reason is not in JDK 1.5. Can you print `objArr.class.getName()` to see really what class hi has?
comment on: http://stackoverflow.com/q/21711196
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32916650
type: QuestionComment
type: Comment
has text: In general, as a software developer you should consider the rule-of-thumb that when a well-established API isn't acting as you expect, it's probably not a problem with the API.
score: 0
comment on: http://stackoverflow.com/q/21760531

http://stackoverflow.com/comment/33024012
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21820575
has text: Why do you need `a` to be a `ListA` instead of a `List`?

http://stackoverflow.com/comment/33057565
type: Comment
type: QuestionComment
has text: Did my answer solve your problem?
comment on: http://stackoverflow.com/q/21835975
score: 0

http://stackoverflow.com/comment/32953892
comment on: http://stackoverflow.com/a/21780118
score: 0
type: AnswerComment
has text: It is an odd and inconvenient situation indeed. But sometimes unfortunately, one has to work with legacy code that cannot be altered easily, may not be accessible to you or be too costly to refactor... Really this is a question for a JAXB expert that knows of a trick or two...
type: Comment

http://stackoverflow.com/q/21792835
has answer: http://stackoverflow.com/a/21792902
type: UnansweredQuestion
has title: Running Applet Out of JButton
tagged with: swing
type: Question
has body: I have a Applet game, and it consists of a Applet class for the game, and a regular drawpanel class for the graphics. I wanted to use a third class to have a main menu, that had several JButtons to direct to other class I want to make, but more importantly to open the Applet game class. Does the Menu Class have to be an Applet? I wouldn't think it would, but if not, how could I use a line of code similar to Pacman g = new Pacman(); To open a Applet class? Thank You! (I don't have many years of programming under my belt, as I am just a tenth grade student in AP Computer Science)
linked to: http://stackoverflow.com/q/21459718
tagged with: java
score: 0
answer count: 1
tagged with: applet

size
type: Tag
tags question: http://stackoverflow.com/q/21754274
tags question: http://stackoverflow.com/q/21707310
tag name: size
tags question: http://stackoverflow.com/q/21804929

http://stackoverflow.com/q/21734900
has comment: http://stackoverflow.com/comment/32879195
score: 0
has comment: http://stackoverflow.com/comment/32872463
answer count: 1
has comment: http://stackoverflow.com/comment/32873576
type: UnansweredQuestion
has body: When attempting to implement a keystore into a Java SOAP client for accessing a WS, I get the exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target We identified that the cause of this was the CA (DigiSign) wasn't in the Java trusted CA. Initially I used two certificates that were given to me by one of our senior engineers and combined them via keytool: keytool.exe -v -alias digicert_3 -import -file DigiCertHighAssuranceCA-3.pem -keystore mykeystore.jks keytool.exe -v -alias digicert_root -import -file DigiCertHighAssuranceEVRootCA.pem -keystore mykeystore.jks I then copied the keystore.jks file into the Eclipse project under src/main/resources. However, now I am getting other exceptions. I have tried multiple ways of loading the certificates into a keystore and I am getting various exceptions. Here are the different ways I've tried to implement the keystores (one at a time): //Load keystore from project resource KeyStore keyStore = KeyStore.getInstance("JKS"); //Keystore created using two individual PEM certs //Exception: java.io.IOException: Keystore was tampered with, or password was incorrect keyStore.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("mykeystore_PEM.jks"), "password".toCharArray()); //Keystore created with two certs combined into a single file //Exception: java.io.IOException: Keystore was tampered with, or password was incorrect keyStore.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("mykeystore_Com.jks"), "password".toCharArray()); //Keystore created using two individual DER cert calls //Exception: java.io.IOException: DerInputStream.getLength(): lengthTag=127, too big. keyStore.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("mykeystore_DER.jks"), "password".toCharArray()); //Keystore created…
has title: Java Certificate / Keystore Exceptions
tagged with: java
tagged with: certificate
tagged with: eclipse
has comment: http://stackoverflow.com/comment/101852212
has answer: http://stackoverflow.com/a/21735026
has comment: http://stackoverflow.com/comment/32873484
type: Question
tagged with: ssl

http://stackoverflow.com/comment/32914005
has text: do you have an understanding of the `final` keyword? That means you will not be able to reassign the object after initialization. That's what happens when you add final to those types.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21759275
type: Comment

http://stackoverflow.com/q/21709375
type: Question
has title: Gridlayout Not Sizing to Constraints
has comment: http://stackoverflow.com/comment/32825668
answer count: 1
tagged with: user-interface
has body: this.setSize(700,500); this.setLayout(new BorderLayout()); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setIconImage(frameIcon.getImage()); this.setTitle("Rifle Reload Logger v1.0"); this.setMinimumSize(new Dimension(700,500)); /* * The center panel of the JFrame will be used to display the current information * as needed whether it be for showing the file chooser, or the reload data.*/ center.setVisible(true); center.setLayout(new GridLayout(6,4)); this.add(center, BorderLayout.CENTER); setGUILabels();//sets the labels for the entire Gui. Essentially my problem here is my GridLayout does not create the 6x4 size that I am asking it to. it goes to a 6x3 size, here is an image. Improper gridlayout.
has comment: http://stackoverflow.com/comment/32825869
tagged with: jframe
score: 0
has answer: http://stackoverflow.com/a/21709494
tagged with: swing
has comment: http://stackoverflow.com/comment/32825590
tagged with: jbutton
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21709494
tagged with: java

http://stackoverflow.com/comment/32858041
type: Comment
comment on: http://stackoverflow.com/q/21727975
has text: your computer does not know that 192.168.1.1 is localhost. May be you wanted to say "127.0.0.1"?
score: 0
type: QuestionComment

http://stackoverflow.com/a/21783305
upvote count: 1
type: AcceptedAnswer
has body: MySQL has a slow query log. Enable that if it isn't already. http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
type: Answer
has comment: http://stackoverflow.com/comment/32962539
accepted answer of: http://stackoverflow.com/q/21783262
downvote count: 0
answers question: http://stackoverflow.com/q/21783262
score: 1

http://stackoverflow.com/comment/33089734
type: Comment
comment on: http://stackoverflow.com/a/21820826
type: AnswerComment
has text: @PASTRY You'll have to give more details. Where is the `NullPointerException` occurring? Consider asking a new question, providing all the relevant details after analysing the problem.
score: 0

http://stackoverflow.com/q/21790651
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/23927351
accepted answer: http://stackoverflow.com/a/21791375
answer count: 4
type: AnsweredQuestion
has body: I can't seem to resolve the Plus class from the Google Play services library. I've already imported the Google Play library into the project as an Android Library project through Eclipse. I'm also following the basic example from the getting started page. My onCreate is currently this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mGoogleApiClient = new GoogleApiClient.Builder(getActivity()) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API, null) .addScope(Plus.SCOPE_PLUS_LOGIN) .build(); } Eclipse flags the Plus class names because it can't resolve them so the code doesn't build.
downvote count: 0
tagged with: google-plus
score: 7
has title: Can't resolve com.google.android.gms.plus.Plus class
favorite count: 0
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/32970932
has answer: http://stackoverflow.com/a/21790764
has answer: http://stackoverflow.com/a/21791375
upvote count: 7
has answer: http://stackoverflow.com/a/33012436
has answer: http://stackoverflow.com/a/23927351
tagged with: java

http://stackoverflow.com/comment/33008768
score: 0
type: Comment
type: QuestionComment
has text: Where does java use this algorithm? Collections.sort uses modified mergesort as per javadoc
comment on: http://stackoverflow.com/q/21812128

http://stackoverflow.com/q/21734809
has title: changing editText to textView error
has answer: http://stackoverflow.com/a/21773012
score: 1
tagged with: java
tagged with: eclipse
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/21734938
downvote count: 0
has body: Beginner at android, I did some research and did not come up with an answer - so I am posting on SO. Please keep in mind I have done the usual things such as going to javadoc or other first step problem solutions that most programmers do before asking another programmer for help. Basically, I am trying to learn how to send data between activities, and I understand how to send a message that someone types in (editText), but if I just want to send over data from a textView, this is where I am having issues. My question: what am i doing wrong on this line (I assume my syntax is wrong here, I don't feel the need to post rest of code, but will if it will help). All I did was switch up "editText1" and "textView1" and although there's no errors in the code, whenever I run the app (the activity switch happens at a button press) and press the button it gives me an android error and closes the app. //doesnt work String text = ((EditText)findViewById(R.id.textView1)).getText().toString(); //works String text = ((EditText)findViewById(R.id.editText1)).getText().toString();
tagged with: textview
favorite count: 0
possible better answer: http://stackoverflow.com/a/21734938
has answer: http://stackoverflow.com/a/21734832
tagged with: android
upvote count: 1
accepted answer: http://stackoverflow.com/a/21734832
type: AnsweredQuestion

http://stackoverflow.com/comment/47427275
has text: <iq type="error" id="U45Co-6" from="shailesh@apps-shailesh/Smack" to="admin@apps-shailesh/Smack" <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/> </iq>
type: AnswerComment
comment on: http://stackoverflow.com/a/21730313
score: 0
type: Comment

http://stackoverflow.com/q/21789616
has title: how to find recently modified document in lotus notes 5
possible better answer: http://stackoverflow.com/a/21789906
upvote count: 2
accepted answer: http://stackoverflow.com/a/21789979
has answer: http://stackoverflow.com/a/21789906
has comment: http://stackoverflow.com/comment/32968905
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32970618
type: Question
has body: What I am trying to do is read through lotus notes 5 and export all the document in there to by local modeshape repository but once i finish reading through all the million records/ documents, the process starts reading from 1st record in lotus notes but i don't want that. i need to read only the recently modified documents in lotus notes. my function looks something like this : public void run() { logger.log(Level.INFO, "entering run"); try { String pathToFolder = ""; s = NotesFactory.createSession(host, "username", "password"); Database db = s.getDatabase("", nsffilename); if (!db.isOpen()) { db.open(); } DocumentCollection docCol = db.getAllDocuments(); Document doc = docCol.getFirstDocument(); while (doc != null) { doc = docCol.getNextDocument(); } } } I found some code off internet which is posted here: http://www-12.lotus.com/ldd/doc/domino_notes/7.0/help7_designer.nsf/f4b82fbb75e942a6852566ac0037f284/c698b5888603d5cd8525704a00417105?OpenDocument but this only works for lotus notes 8 and above. but I am stuck with lotus notes 5. Please let me know if there is some way that I can get recently modified documents in lotus notes 5.
answer count: 2
score: 2
downvote count: 0
tagged with: lotus-notes
has answer: http://stackoverflow.com/a/21789979
favorite count: 0

http://stackoverflow.com/comment/32885882
comment on: http://stackoverflow.com/q/21742894
score: 0
has text: This is what debuggers are for.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/46008579
comment on: http://stackoverflow.com/q/21822951
score: 0
type: QuestionComment
type: Comment
has text: Hi, no I didn't solve this problem. I now just write a log file with all the errors.

http://stackoverflow.com/q/21757376
has answer: http://stackoverflow.com/a/21757530
has body: I am trying to read a byte[] in my Java application sent from a C# application. However, when I encode the string to byte[] in C# and reads it in Java, using the code below, I get all the characters but the last. Why is that? Java receiving code: int data = streamFromClient.read(); while(data != -1){ char theChar = (char) data; data = streamFromClient.read(); System.out.println("" + theChar); } C# sending code: public void WriteMessage(string msg){ byte[] msgBuffer = Encoding.Default.GetBytes(msg); sck.Send(msgBuffer, 0, msgBuffer.Length, 0); }
has comment: http://stackoverflow.com/comment/32910731
has answer: http://stackoverflow.com/a/21757606
answer count: 3
has answer: http://stackoverflow.com/a/21757951
tagged with: sockets
has comment: http://stackoverflow.com/comment/32911566
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21757951
has comment: http://stackoverflow.com/comment/32910685
type: Question
possible better answer: http://stackoverflow.com/a/21757530
tagged with: c#
has title: Java socket read bytes from C#

http://stackoverflow.com/comment/32819104
has text: This question is pretty broad. You're asking us to go through your code and rewrite it for you. Ultimately this is more of a logic issue than a java specific problem (you figure out how to build the birdhouse first, and worry about how to use the hammer later, to use an analogy). It would be better to ask a more specific question; give it a try yourself first and post when / if you encounter an issue or have a question that has not already been asked here before.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21704599

http://stackoverflow.com/q/21825605
has title: Google OAuth2 PlayGround returns "Unauthorized Client"
answer count: 1
score: 0
tagged with: oauth2client
has comment: http://stackoverflow.com/comment/33067965
linked to: http://stackoverflow.com/q/19766912
has answer: http://stackoverflow.com/a/21846338
has body: clientId = xxxxxx clientSecret = xxxxxxxx applicationHost = xxxxxxxxx My authorization code request: OAuthClientRequest oAuthClientRequest = OAuthClientRequest .authorizationProvider(OAuthProviderType.GOOGLE) .setResponseType("code") .setClientId(clientId) .setParameter("access_type", "online") .setRedirectURI(applicationHost + "auth/google/callback") .setScope("https://www.googleapis.com/auth/plus.login") .buildQueryMessage(); response.sendRedirect(oAuthClientRequest.getLocationUri()); I am getting an authorization code with this. but whenever I send a request for the access_token using this code I am getting an error. (Code 400) My access_token request: OAuthClientRequest oAuthClientRequest = OAuthClientRequest .tokenProvider(OAuthProviderType.GOOGLE) .setGrantType(GrantType.AUTHORIZATION_CODE) .setClientId(clientId) .setClientSecret(clientSecret) .setParameter("access_type", "online") .setRedirectURI(applicationHost + "auth/google/callback") .setCode(code) .buildQueryMessage(); GitHubTokenResponse oAuthResponse = oAuthClient.accessToken( oAuthClientRequest, GitHubTokenResponse.class); return oAuthResponse.getAccessToken(); OAuth2 Playground response: HTTP/1.1 400 Bad Request Alternate-protocol: 443:quic Content-length: 37 X-xss-protection: 1; mode=block X-content-type-options: nosniff X-google-cache-control: remote-fetch -content-encoding: gzip Server: GSE Via: HTTP/1.1 GWA Pragma: no-cache Cache-control: no-cache, no-store, max-age=0, must-revalidate Date: Mon, 17 Feb 2014 09:03:52 GMT X-frame-options: SAMEORIGIN Content-type: application/json Expires: Fri, 01 Jan 1990 00:00:00 GMT { "error": "unauthorized_client" } Please help me out. Thanks in advance.
type: UnansweredQuestion
tagged with: oauth-2.0
tagged with: web-applications
type: Question
tagged with: java
tagged with: google-oauth

http://stackoverflow.com/q/21691356
upvote count: 11
tagged with: c++
type: UnansweredQuestion
score: 11
has comment: http://stackoverflow.com/comment/37474012
tagged with: android-ndk
type: Question
has title: NDK: Does GetByteArrayElements copy data from Java to C++?
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has body: I've read this link about the GetByteArrayElements: FAQ: How do I share raw data with native code? http://developer.android.com/training/articles/perf-jni.html It said that GetByteArrayElements will return a actual pointers to the raw data in the Dalvik heap. So I can manipulate the raw source in C++ and speed up the process, am I right? And so, ReleaseByteArrayElements won't copy the data also? Or since GetByteArrayElements return a pointer and I don't even need to release it after manipulation of data just like using GetDirectBufferAddress for FloatBuffer? If it doesn't have to copy any data from Java to C++, is that possible to pass in and manipulate float array via GetByteArrayElements? Plz answer at NDK: Passing Jfloat array from Java to C++ via GetByteArrayElements?
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21693632
linked to: http://stackoverflow.com/q/21691152
tagged with: android

http://stackoverflow.com/q/21755787
type: Question
score: 5
tagged with: jpa
upvote count: 5
linked to: http://stackoverflow.com/q/11043712
has body: I have a server function which is called by many clients, many times exactly at the same time. The server function does the following: get param1 from client creat object x (new objectx(param1)) check if object x exists in db (jpa select query) if not exists add object x (jpa store entity) add y (jpa store entity) This goes wrong when two or more clients run the function at the same time, multiple x objects get added to the database. I simply solved this by creating a singleton manager class with a synchronized method which does the above. Works nicely, cause now the function can only be called by one client at a time. (but i do get a problem when there are 2 servers, but that isn't the case yet) But i was wondering is there a better way to solve this problem with jpa?
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/21756139
favorite count: 0
linked to: http://stackoverflow.com/q/18093735
has answer: http://stackoverflow.com/a/21756000
has title: JPA multithreaded Add if Not Exist?
has answer: http://stackoverflow.com/a/21756727
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21756139
possible better answer: http://stackoverflow.com/a/21756727
linked to: http://stackoverflow.com/q/2538786

http://stackoverflow.com/a/35158079
answers question: http://stackoverflow.com/q/21752264
type: Answer
downvote count: 0
score: 2
has body: Please try with this: Add "The assembly:" before the . Hope this will work. </project> The assembly: jar-with-dependencies jar false true *.properties target/classes
upvote count: 2

http://stackoverflow.com/a/21798982
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32986097
has comment: http://stackoverflow.com/comment/32985720
type: Answer
has body: I want to save the collectionID so I can use it elsewhere Use mButton Button onClick event for saving EditText text in SharedPreferences as : mButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { collectionID = mEdit.getText().toString(); Log.d("EditText", collectionID); // save value here in SharedPreferences SharedPreferences settings = ConfigPage.this.getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString(collectionID, collectionID); editor.commit(); } });
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21798883
has comment: http://stackoverflow.com/comment/32985986
has comment: http://stackoverflow.com/comment/32986154
answers question: http://stackoverflow.com/q/21798883
upvote count: 2
has comment: http://stackoverflow.com/comment/32985265

http://stackoverflow.com/q/21715216
has comment: http://stackoverflow.com/comment/32837007
downvote count: 1
type: Question
tagged with: jgrasp
tagged with: java
has title: How to fix the compiler error in this program?
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/32836911
has comment: http://stackoverflow.com/comment/32836855
has comment: http://stackoverflow.com/comment/32836885
score: 2
has comment: http://stackoverflow.com/comment/32836828
upvote count: 3
has answer: http://stackoverflow.com/a/69682719
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25699897
has body: So i'm a student in high school new to the Java language and i'm using this program called jgrasp, which we use to program java. I just got the program for home to try to finish off a lab I was working on and when I compile, this shows up: ----jGRASP exec: javac -g EqualToThree.java ----jGRASP wedge2 error: command "javac" not found. ---- This command must be in the current working directory or ---- on the current system PATH or jGRASP PATH to use this function. ---- System + jGRASP PATH is "C:\Program Files\Java;C:\WINDOWS\system32;C:\WINDOWS\system32\wbem;C:\Program Files\QuickTime\QTSystem;C:\Documents and Settings\Andrew\My Documents\Downloads;C:\WINDOWS\system32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\". ---- Use Settings &gt; PATH/CLASSPATH &gt; Workspace (PATHS tab) ---- to add directories to the jGRASP PATH. ----jGRASP: operation complete. I just recently upgraded my java to the latest version, and I honestly have no idea how to fix this. I did go to the class path, and selected the selected files it wants, but still no luck. Any idea?
has comment: http://stackoverflow.com/comment/32836860

http://stackoverflow.com/comment/32878564
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21738669
has text: @PeterLawrey I am looking to get a `Method` object or something like it I can use for reflection like `getName()`, `getParameterTypes()` etc.

http://stackoverflow.com/a/21699606
has comment: http://stackoverflow.com/comment/32895842
accepted answer of: http://stackoverflow.com/q/21681784
answers question: http://stackoverflow.com/q/21681784
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/32901515
has body: If you want to control and limit the number of certain actions performed by a distributed system, then your distributed nodes will have to communicate to make that happen. The easiest is to have one central actor which keeps track of all requests made to a certain target web service and handing out tickets allowing them to happen (delaying or dropping requests when going over the configured limit). If you do not want to incur the overhead of inter-node communication, then you will have to partition your quota such as to guarantee that by throttling all nodes individually their sum cannot exceed the limit, but this is obviously wasteful unless the request originators are perfectly balanced.
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21757309
accepted answer: http://stackoverflow.com/a/21757542
tagged with: type-conversion
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32910792
has answer: http://stackoverflow.com/a/21757542
tagged with: hex
has answer: http://stackoverflow.com/a/21757435
tagged with: android
has comment: http://stackoverflow.com/comment/32910997
has comment: http://stackoverflow.com/comment/32910683
type: AnsweredQuestion
tagged with: java
has body: I'm parsing an XML file with some entries like this one: FF FF FF FF FF FF FF FF I save them into a HashMap and now I want to convert the String that I get into an int[]. But I'm not sure how to do it. I tried to parse it with this: Interger.parseInt(mEntry.getValue().toString(), 16);, but it failed with error NumberFormatExceptoin: Invalid int: "FF FF FF FF FF FF FF FF" I googled my problem but did not find any solution for my problem. Is there anything to get this done? Maybe to saved it already in the Hashmap as an int[] Here the code for parsing: public static Map<String, String> paramListConf1(Context c, int listResID) { Map<String, String> map = null; XmlResourceParser parser = c.getResources().getXml(listResID); String key = "", value = ""; try { int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_DOCUMENT) { } else if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("map")) { boolean isLinked = parser.getAttributeBooleanValue( null, "linked", false); map = isLinked ? new LinkedHashMap<String, String>() : new HashMap<String, String>(); } else if (parser.getName().equals("windowcontrol")) { key = parser.getAttributeValue(null, "key"); if (null == key) { parser.close(); return null; } } } else if (eventType == XmlPullParser.TEXT) { if (null != key) { value = parser.getText(); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("windowcontrol")) { map.put(key, value); key = null; value = null; } } eventType = parser.next(); } } catch (Exception e) { e.printStackTrace(); return null; } return map; } The XML file: <?xml version="1.0" encoding="utf-8"?> FF FF FF FF FF FF FF FF EE EE EE EE EE EE EE EE DD DD DD DD DD DD DD DD 00 00 00 00 00 00 00 00 and the implementation: public void getXMLResourceInput() { @SuppressWarnings("rawtypes") Map keyMap = ResourceUtils.paramListConf1(WindowControlActivity.this, R.xml.config1); @SuppressWarnings("rawtype…
type: Question
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/21757435
has title: Convert String (FF FF FF FF FF FF FF FF FF) into int array java

http://stackoverflow.com/q/21757653
accepted answer: http://stackoverflow.com/a/21757854
answer count: 1
tagged with: encryption
has answer: http://stackoverflow.com/a/21757854
type: AnsweredQuestion
has body: I have the following line of code that is taking less than a second on my computer (windows 7) and about 20 seconds on a Redhat server : Cipher cipher = Cipher.getInstance(TRANSFORMATION); where TRANSFORMATION is defind as : private static final String TRANSFORMATION = "Blowfish/ECB/PKCS5Padding"; What could be the source of such behaviour ? Thanks.
score: 0
tagged with: java
has title: Cipher.getInstance is too slow
tagged with: blowfish
type: Question

http://stackoverflow.com/a/29082820
type: Answer
answers question: http://stackoverflow.com/q/21712997
has body: You need to add this: writer.newLine();
score: 0

http://stackoverflow.com/q/21828206
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21828235
has comment: http://stackoverflow.com/comment/33036629
possible better answer: http://stackoverflow.com/a/21828249
has body: I have compiled the following code, import java.lang.*; public class Test { public static void main(String[] args) { int x=010; System.out.println("x(010):="+x); } } After compiling the code, i got the value 8 but the actual value of x is 10, how it happens to print the value 8, could you please someone explain me the reason.
upvote count: 2
has title: how the value changes dynamically
has answer: http://stackoverflow.com/a/21828249
downvote count: 1
accepted answer: http://stackoverflow.com/a/21828235
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21828267
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/32962601
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21770806
has text: Strange because when I edit my response, my war target is in the response. I will post 'another' answer with just that target.

http://stackoverflow.com/q/21813188
has body: for example : public static String s(Object o) return o; this method doesn't work/compile. To solve it I can write return o.toString() but I don't want that. I want to change the apparent type of o which is Object to the real type of o which is I know it is String. How can I do that? I know there is a command that I can use it but I forget it. Anyone know it? Thank you
tagged with: java
has title: How can I change the apparent type to a real type in Java?
type: Question
has answer: http://stackoverflow.com/a/21813210
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21813207
has answer: http://stackoverflow.com/a/21813211
type: UnansweredQuestion

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/21814390

http://stackoverflow.com/comment/33055933
score: 0
comment on: http://stackoverflow.com/q/21838379
type: QuestionComment
type: Comment
has text: I fixed it, just made a variable int called gear and set it to values based on user input. Then in my getTransmission i used if(gear == 1) etc..

http://stackoverflow.com/comment/32937920
has text: [Using nextInt() before nextLine()](http://christprogramming.wordpress.com/2014/01/30/java-common-mistakes-1/)
type: QuestionComment
comment on: http://stackoverflow.com/q/21772174
type: Comment
score: 2

http://stackoverflow.com/a/21692831
answers question: http://stackoverflow.com/q/21692810
score: 1
accepted answer of: http://stackoverflow.com/q/21692810
type: AcceptedAnswer
downvote count: 0
has body: In order to use Generics you will need to type your ArrayList, that is ArrayList&lt;Integer&gt;
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32850931
score: 0
type: Comment
has text: you right my request may be a problem, but it seems normal
type: QuestionComment
comment on: http://stackoverflow.com/q/21723474

http://stackoverflow.com/q/21773887
upvote count: 3
has comment: http://stackoverflow.com/comment/32941087
has body: I want to generate a string according to given pattern. Let's suppose: %i denotes for incremental number %.3r denotes for a random number with 3 characters %dd denotes current day %mm denotes current month %yyyy denotes current year Then, for example IBM_%.3r =&gt; IBM_233, IBM_765.. ID_%i =&gt; ID_0, ID_1, ID_2... %dd/%mm/%yyyy =&gt; 14/03/2014 %dd%mm%yyyy_interface.log =&gt; 14022014_interface.log Please let me know whether there are any existing java library for this. Otherwise, what is the correct way to implement this ?
answer count: 2
tagged with: random
possible better answer: http://stackoverflow.com/a/21774148
accepted answer: http://stackoverflow.com/a/21775784
favorite count: 0
tagged with: pattern-matching
tagged with: string-formatting
has answer: http://stackoverflow.com/a/21775784
tagged with: regex
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32940826
type: Question
score: 3
has title: Custom pattern layout
has answer: http://stackoverflow.com/a/21774148

http://stackoverflow.com/comment/32805838
has text: @CoderShei now check it
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21697816

http://stackoverflow.com/comment/33028266
has text: show us what you have tried, and what errors you are getting.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21823196

http://stackoverflow.com/q/21738420
type: Question
type: AnsweredQuestion
tagged with: dependency-injection
tagged with: java
has answer: http://stackoverflow.com/a/21740228
tagged with: jboss
tagged with: struts
tagged with: ejb
has body: @Override protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DataSource dataSource = (DataSource) new InitialContext().lookup("java:jboss/STRUTS-DS"); dataSource.getConnection(); SessionBean sessionBean = new SessionBean(); sessionBean.testConnection(); return mapping.findForward("list"); } in the Action, works with lookup, problem occurred in SessionBean @Stateless public class SessionBean { @PersistenceContext(???) EntityManager entityManager; @Resource(???) DataSource dataSource; public void testConnection() { PreparedStatement preparedStatement = null; Connection connection = null; try { connection = dataSource.getConnection(); preparedStatement = connection.prepareStatement("drop table test"); preparedStatement.execute(); preparedStatement = connection.prepareStatement("CREATE TABLE example (id INT,data VARCHAR(100));"); preparedStatement.execute(); System.out.println("Done"); } catch (SQLException sqlE) { throw new EJBException(sqlE); } finally { try { if (preparedStatement != null) { preparedStatement.close(); } } catch (Exception e) {} try { if (connection != null) { connection.close(); } } catch (Exception e) {} } } } I'm trying inject this. In my datasource never injected, what I put in Resource ?
answer count: 1
downvote count: 0
has title: How to inject dependency in datasource with ejb3 and annotations
favorite count: 0
accepted answer: http://stackoverflow.com/a/21740228
has comment: http://stackoverflow.com/comment/32915553
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32877660

http://stackoverflow.com/comment/33016634
score: 0
comment on: http://stackoverflow.com/q/21816328
type: QuestionComment
type: Comment
has text: Have you tried using a debugger to see what's happening?

http://stackoverflow.com/a/21821556
type: Answer
has body: Yes. You are right. Each call to toCharArray() actually creates a new array instance with the characters in the string. In the case of aArr, you actually refer to the new array instance, you use aArr to sort. Its the array instances referred by the variable aArr which gets sorted. But when you pass a.toCharArray() to Array.sort() method, you are passing array instance which you don't have a variable referring to. The array instance gets sorted but you don't have any reference. When you you call println using a.toCharArray() again a new array instance is created and passed to println which is obviously unsorted.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21821477
accepted answer of: http://stackoverflow.com/q/21821477
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21761007
has title: Allow only one specific untrusted certificate by the TrustManager
favorite count: 0
has body: I'm building a small wrapper java class around some rest webservices we use internally. we use a secured HTTPS connection. Normally, only trusted certificates are allowed by SSL. I would like the user of the wrapper class to be able to give a X509Certificate object as input to the wrapper constructor. This certificate is typically unsecured, but that's the whole point - we want to test internally without hacing a secured one. public ServicesWrapper(String serviceURL, X509Certificate additionalCertificate) { //Add the certificate to the trustmanager of the sslcontext. } I've seen the "trust all certificates" TrustManager hack multiple times (like here), but this is not what I need. I would really like to specify that the given (untrusted) certificate should now be considered trusted. Other untrusted certificates are not good. So I implemented my own TrustManager, but I'm stuck at the checkTrusted step: public class NaiveTrustManager implements X509TrustManager { //The extra certificate that should be trusted. private X509Certificate additionalCertificate; //Constructor public NaiveTrustManager(X509Certificate _additionalCertificate) { additionalCertificate = _additionalCertificate; } ...other methods here... public void checkServerTrusted(java.security.cert.X509Certificate[] certificateChain, String authType) { for(X509Certificate c : certificateChain) { **?????????????????** pseudocode: if (c is equal to additionalcertificate) stop execution, we trust it! if (nothing matches) throw certificatEexception } } } what is the correct syntax for checking a certificate against a chain of certificates? I checked some attributes but certificates don't seem to have a name or id or anything to match for equality or compare them.
tagged with: x509certificate
score: 2
has answer: http://stackoverflow.com/a/21765778
downvote count: 0
linked to: http://stackoverflow.com/q/1201048
type: UnansweredQuestion
tagged with: https
tagged with: java
tagged with: ssl
has comment: http://stackoverflow.com/comment/32920135
type: Question
upvote count: 2
answer count: 1

http://stackoverflow.com/comment/32915297
type: Comment
type: QuestionComment
score: 1
has text: Look at line 76 of the Student class and see what could be null there.
comment on: http://stackoverflow.com/q/21759939

http://stackoverflow.com/comment/32973959
score: 0
has text: Are you clear on the use of *while* constructs? Because your usage of them do distinguish player turns doesn't make very much sense to me.
type: Comment
comment on: http://stackoverflow.com/q/21792422
type: QuestionComment

libgdx
tags question: http://stackoverflow.com/q/21840692
tags question: http://stackoverflow.com/q/21764257
tags question: http://stackoverflow.com/q/21741469
tags question: http://stackoverflow.com/q/21800833
tags question: http://stackoverflow.com/q/21839302
tags question: http://stackoverflow.com/q/21754817
tags question: http://stackoverflow.com/q/21810372
tags question: http://stackoverflow.com/q/21690547
tags question: http://stackoverflow.com/q/21818152
tags question: http://stackoverflow.com/q/21814772
tags question: http://stackoverflow.com/q/21796534
tags question: http://stackoverflow.com/q/21819536
tags question: http://stackoverflow.com/q/21751270
tags question: http://stackoverflow.com/q/21784173
tag name: libgdx
tags question: http://stackoverflow.com/q/21819397
tags question: http://stackoverflow.com/q/21815623
tags question: http://stackoverflow.com/q/21693307
tags question: http://stackoverflow.com/q/21825959
tags question: http://stackoverflow.com/q/21806778
tags question: http://stackoverflow.com/q/21802994
tags question: http://stackoverflow.com/q/21813680
tags question: http://stackoverflow.com/q/21768793
type: Tag
tags question: http://stackoverflow.com/q/21749483
tags question: http://stackoverflow.com/q/21718873
tags question: http://stackoverflow.com/q/21806485
tags question: http://stackoverflow.com/q/21690767
tags question: http://stackoverflow.com/q/21814778
tags question: http://stackoverflow.com/q/21702347
tags question: http://stackoverflow.com/q/21796293
tags question: http://stackoverflow.com/q/21841679
tags question: http://stackoverflow.com/q/21816153
tags question: http://stackoverflow.com/q/21769943
tags question: http://stackoverflow.com/q/21835062
tags question: http://stackoverflow.com/q/21804877
tags question: http://stackoverflow.com/q/21816000
tags question: http://stackoverflow.com/q/21795261
tags question: http://stackoverflow.com/q/21696559
tags question: http://stackoverflow.com/q/21812703
tags question: http://stackoverflow.com/q/21781161
tags question: http://stackoverflow.com/q/21697790
tags question: http://stackoverflow.com/q/21803881

http://stackoverflow.com/comment/32897400
has text: @MD sorry for that i forgot to add the first line, now look at the updates
comment on: http://stackoverflow.com/q/21749662
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42481741
type: Comment
comment on: http://stackoverflow.com/a/26965423
has text: Sorry buddy, there was some mistake in pasting the code, since it might have become multiple times. I have edited explanation for what I posted. Hope that looks fine now???
score: 0
type: AnswerComment

http://stackoverflow.com/q/21822861
answer count: 0
type: UnansweredQuestion
score: 2
favorite count: 0
type: Question
tagged with: android
upvote count: 3
tagged with: java
has body: I am creating a twitter client for Android using twitter4j library. I want the client to show "true" on some items of a Listview only if the item is Retweet. Then I coded like below: private class TweetAdapter extends ArrayAdapter&lt;Status&gt; { private LayoutInflater mInflater; public TweetAdapter(Context context) { super(context, android.R.layout.simple_list_item_1); mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.list_item_tweet, null); } Status item = getItem(position); // setStatus(convertView, getItem(position)); TextView name = (TextView) convertView.findViewById(R.id.name); name.setText(item.getUser().getName()); TextView screenName = (TextView) convertView.findViewById(R.id.screen_name); screenName.setText("@" + item.getUser().getScreenName()); TextView text = (TextView) convertView.findViewById(R.id.text); text.setText(item.getText()); SimpleDateFormat sdf = new SimpleDateFormat("M/d(E) H:mm:ss"); TextView time = (TextView) convertView.findViewById(R.id.time); time.setText(sdf.format(item.getCreatedAt().getTime())); SmartImageView icon = (SmartImageView) convertView.findViewById(R.id.icon); icon.setImageUrl(item.getUser().getProfileImageURL()); if(item.isRetweet()){ TextView rt = (TextView) convertView.findViewById(R.id.rted_by); rt.setText(String.valueOf(item.isRetweet())); } return convertView; } } To my surprise, I get an extra amount of "true" even on some items which are not "Retweet". And once I remove the if statement like below, I can get an appropriate amount of "true" or "false" on the appropriate items. //if(item.isRetweet()){ TextView rt = (TextView) convertView.findViewById(R.id.rted_by); rt.setText(String.valueOf(item.isRetweet())); //} So the problem is that the if statement doesn't work as I intend it to do.
downvote count: 1
has title: How to use twitter4j.Status.isRetweet() method
tagged with: twitter4j

http://stackoverflow.com/comment/33024322
has text: @Killrawr ya...not .JAR. just API to connect to a third party server. Let me try what you said tomorrow when I am in the office. I will let you know what I find.
comment on: http://stackoverflow.com/q/21820621
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21755216
downvote count: 0
has answer: http://stackoverflow.com/a/21879520
favorite count: 0
tagged with: logging
answer count: 4
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/36945236
tagged with: java
accepted answer: http://stackoverflow.com/a/21879520
has answer: http://stackoverflow.com/a/29005433
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21866267
has title: (ILOG) IBM ODM 8.5 Logging a name of the rule in execution time
tagged with: ibm-odm
possible better answer: http://stackoverflow.com/a/21866267
has body: I want to create a log such as System.out.println("RuleName : "+ruleName); in IBM ODM rule engine. So these are what i did; 1- Create BOM virtual methods which are static and get parameter of instance which is the object of ilog.rules.engine.IlrRuleInstance. instance ilog.rules.engine.IlrRuleInstance 2- Create BOM to XOM mapping by the following System.out.println("Log icinde"); String ruleName = ""; if (instance != null ) ruleName = instance.getRuleName(); else System.out.println("instance null!"); if (ruleName != null) { System.out.println("RuleName: "+ ruleName); } return; 3- Call it in rule flow as an initial or final action. utility.logla(ruleInstance); But when i execute the flow my log doesnt work instance is null and ruleName also is null; How should i configure and set logging feature by using bom. Could you give me an example of it? Thanks.

http://stackoverflow.com/a/21785926
has comment: http://stackoverflow.com/comment/32961617
has body: disclaimer - I've figured out that my solution could work except if I used STDIN and STDOUT redirection with &lt; and >. So I am using the same solution presented here Running external program with redirected stdin and stdout from Java import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Runner { public static void pipeStream(InputStream input, OutputStream output) throws IOException { byte buffer[] = new byte[1024]; int numRead = 0; do { numRead = input.read(buffer); output.write(buffer, 0, numRead); } while (input.available() &gt; 0); output.flush(); } public static void main(String[] argv) { File dir = new File("C:\\Users\\Leo\\workspace\\STackOverflow\\src\\"); FileInputStream fileIn = null; FileOutputStream fileOut = null; OutputStream procIn = null; InputStream procOut = null; try { fileIn = new FileInputStream(new File(dir, "input.txt")); fileOut = new FileOutputStream(new File(dir, "output.txt")); Process process = Runtime.getRuntime().exec("C:\\jdk1.7.0_51\\bin\\java Hello", null, dir); procIn = process.getOutputStream(); procOut = process.getInputStream(); pipeStream(fileIn, procIn); pipeStream(procOut, fileOut); } catch (IOException ioe) { System.out.println(ioe); } } } given import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Hello { /** * @param args */ public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input; while((input=br.readLine())!=null){ System.out.println("processed"+input); } }catch(IOException io){ io.printStackTrace(); } } } this is pretty much the same as "java Hello &lt; input.txt &gt; output.txt" given input.txt like 1 2 3 4 it generates output.txt like processed1 processed2 processed3 processed4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32962779
type: Answer
answers question: http://stackoverflow.com/q/21785626
has comment: http://stackoverflow.com/comment/32961661
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32961596
has comment: http://stackoverflow.com/comment/32961560
accepted answer of: http://stackoverflow.com/q/21785626
has comment: http://stackoverflow.com/comment/32972256
has comment: http://stackoverflow.com/comment/32961950

http://stackoverflow.com/comment/32867594
type: Comment
type: QuestionComment
has text: ah right, that's made it a lot clearer.
comment on: http://stackoverflow.com/q/21731365
score: 0

http://stackoverflow.com/a/21767862
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32955483
has comment: http://stackoverflow.com/comment/32959984
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21761881
accepted answer of: http://stackoverflow.com/q/21761881
type: Answer
has body: Before your "Download file" action, add a "Set a variable" action. In the action's configuration change the "Script" to return the desired URL string: // Get some user input from some screen's input field. String userInput = (String)context.getVariable("sometextbox"); // Call your custom code with user input and return a url String url = com.mycompany.getDownloadFileUrl(userInput); // Set it to the runtime variable. return url; Set the "Variable" property to a recognizable name. Then, go back to your "Download file" action and click the arrow that appears if you click within the entry field for "URL". Click insert runtime variable -> Bound variables and click the variable you created in the earlier step.

http://stackoverflow.com/a/21747212
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: You can achive that with help of MouseListener, try next example: import java.awt.Cursor; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; import javax.swing.JPanel; public class Example extends JFrame{ private JPanel pane; public Example(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); addMouseListener(getListener()); setSize(200,200); pane = (JPanel) getContentPane(); setVisible(true); } private MouseListener getListener() { return new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { super.mousePressed(e); pane.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); } @Override public void mouseReleased(MouseEvent e) { super.mouseReleased(e); pane.setCursor(Cursor.getDefaultCursor()); } }; } public static void main(String... s){ new Example(); } }
accepted answer of: http://stackoverflow.com/q/21745317
answers question: http://stackoverflow.com/q/21745317
downvote count: 0

http://stackoverflow.com/comment/33023563
comment on: http://stackoverflow.com/a/21815653
score: 0
type: AnswerComment
type: Comment
has text: @ peeskillet Thank You, for having patience and pointing me in the right direction. I will post up my finished code tomorrow in order for you to see how I went about completing this code.

http://stackoverflow.com/comment/32841426
type: QuestionComment
has text: "Import" copies, if anything, it does not move.
comment on: http://stackoverflow.com/q/21717609
score: 1
type: Comment

servlets
tags question: http://stackoverflow.com/q/21825013
tags question: http://stackoverflow.com/q/21764549
tags question: http://stackoverflow.com/q/21806403
tags question: http://stackoverflow.com/q/21812352
tags question: http://stackoverflow.com/q/21732436
tags question: http://stackoverflow.com/q/21702227
tags question: http://stackoverflow.com/q/21807691
tags question: http://stackoverflow.com/q/21686569
tags question: http://stackoverflow.com/q/21694457
tags question: http://stackoverflow.com/q/21801813
tags question: http://stackoverflow.com/q/21694655
tags question: http://stackoverflow.com/q/21683212
tags question: http://stackoverflow.com/q/21821617
tags question: http://stackoverflow.com/q/21805971
tags question: http://stackoverflow.com/q/21769196
tags question: http://stackoverflow.com/q/21766247
tags question: http://stackoverflow.com/q/21719214
tags question: http://stackoverflow.com/q/21727038
tags question: http://stackoverflow.com/q/21822753
tags question: http://stackoverflow.com/q/21719379
tags question: http://stackoverflow.com/q/21696857
tags question: http://stackoverflow.com/q/21823835
tags question: http://stackoverflow.com/q/21693362
tags question: http://stackoverflow.com/q/21718659
tags question: http://stackoverflow.com/q/21788971
tags question: http://stackoverflow.com/q/21782791
tags question: http://stackoverflow.com/q/21704641
tags question: http://stackoverflow.com/q/21827548
tags question: http://stackoverflow.com/q/21780053
tags question: http://stackoverflow.com/q/21707570
tags question: http://stackoverflow.com/q/21683732
tags question: http://stackoverflow.com/q/21782789
tags question: http://stackoverflow.com/q/21710363
tags question: http://stackoverflow.com/q/21722372
tags question: http://stackoverflow.com/q/21731428
tags question: http://stackoverflow.com/q/21734273
tags question: http://stackoverflow.com/q/21778163
tags question: http://stackoverflow.com/q/21771702
tags question: http://stackoverflow.com/q/21759275
tags question: http://stackoverflow.com/q/21718025
tags question: http://stackoverflow.com/q/21731614
tags question: http://stackoverflow.com/q/21810187
tags question: http://stackoverflow.com/q/21802904
tags question: http://stackoverflow.com/q/21757179
tags question: http://stackoverflow.com/q/21684988
tags question: http://stackoverflow.com/q/21758829
tags question: http://stackoverflow.com/q/21792096
tags question: http://stackoverflow.com/q/21757773
tags question: http://stackoverflow.com/q/21724688
tags question: http://stackoverflow.com/q/21813005
tags question: http://stackoverflow.com/q/21752571
tags question: http://stackoverflow.com/q/21801246
tags question: http://stackoverflow.com/q/21827474
tags question: http://stackoverflow.com/q/21711908
tags question: http://stackoverflow.com/q/21785439
tags question: http://stackoverflow.com/q/21720397
tags question: http://stackoverflow.com/q/21837961
tags question: http://stackoverflow.com/q/21760135
tags question: http://stackoverflow.com/q/21762650
tags question: http://stackoverflow.com/q/21726392
tags question: http://stackoverflow.com/q/21787047
tags question: http://stackoverflow.com/q/21756473
tag name: servlets
tags question: http://stackoverflow.com/q/21721449
tags question: http://stackoverflow.com/q/21826046
tags question: http://stackoverflow.com/q/21797526
type: Tag
tags question: http://stackoverflow.com/q/21694154
tags question: http://stackoverflow.com/q/21720952
tags question: http://stackoverflow.com/q/21796512
tags question: http://stackoverflow.com/q/21793532
tags question: http://stackoverflow.com/q/21752305
tags question: http://stackoverflow.com/q/21800380
tags question: http://stackoverflow.com/q/21693377
tags question: http://stackoverflow.com/q/21773527
tags question: http://stackoverflow.com/q/21835097
tags question: http://stackoverflow.com/q/21776742
tags question: http://stackoverflow.com/q/21682666
tags question: http://stackoverflow.com/q/21786747
tags question: http://stackoverflow.com/q/21695519

http://stackoverflow.com/comment/32892537
comment on: http://stackoverflow.com/q/21746574
type: Comment
type: QuestionComment
has text: @MehulJoisar how?...................................
score: 0

http://stackoverflow.com/comment/32979145
type: AnswerComment
type: Comment
score: 1
has text: That's just it, it's not a tiny problem. Luckily for you it's been solved thousands of times and you can benefit from the solutions if you want to do a little bit of reading. Here's a more straight forward example: http://old.koalateam.com/jml/java/tricks/double-buffering.html
comment on: http://stackoverflow.com/a/21795473

http://stackoverflow.com/q/21800803
has comment: http://stackoverflow.com/comment/32988764
score: 0
has body: I am trying to complete my programming assignment, I have to create a "Password verifier" that has 1 uppercase, 1 lowercase, 1 number, and 1 special character. If invalid, it must show "invalid" plus the rule that it has shown as false. The problem I have, is not an error message, but I always get a positive response, plus all the violated rules, plus it reads them twice. Little help here? import java.util.Scanner; public class PasswordVerifier { public static void main(String[] args) { System.out.println("Password Verifier"); System.out.println("Enter a password that meets the following rules: "); System.out.println("-Must be at least 8 characters long" + '\n' + "-Must contain at least 1 lower case character" + '\n' + "-Must contain at least 1 upper case character" + '\n' + "-Must contain at least 1 numeric digit" + '\n' + "-Must contain at least 1 special character from the set: !@#$%^&amp;*" + '\n' + "-Must not contain the word 'and' or the word 'end'"); String password; String contains1 = "and"; String contains2 = "end"; String special = "!@#$%^&amp;*"; Scanner stdIn = new Scanner(System.in); boolean digit = false; //Has at least 1 digit boolean upper = true; //Has at least 1 upper case letter boolean lower = true; //Has at least 1 lower case letter boolean hasspecial = true; //Has at least 1 special character boolean length = true; //Has at least 8 digits boolean endand = true; //Does not contain end or and boolean valid = false; //Is the password valid? System.out.println("Enter password: "); password = stdIn.nextLine(); int result; result = password.indexOf(contains1); if (result == -1) { System.out.println(""); } else { System.out.println("Must not contain the word 'and'"); } int result2; result2 = password.indexOf(contains2); if (result2 == -1) { System.out.println(""); } else { System.out.println("Must not contain the word 'end'"); } if (password.length() &lt; 8) { System.out.println("Must be at least 8 characters long."); } else { System.out.print(""); } …
answer count: 1
has comment: http://stackoverflow.com/comment/32992399
tagged with: string
has title: Password verifier problems
has comment: http://stackoverflow.com/comment/32997590
has answer: http://stackoverflow.com/a/21804703
has comment: http://stackoverflow.com/comment/32988594
accepted answer: http://stackoverflow.com/a/21804703
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/21721267
answers question: http://stackoverflow.com/q/21720128
score: 7
upvote count: 7
has body: Here we go you can do like this.... BeanOne.java import java.util.Map; public class BeanOne { private String fieldOne; private Map&lt;String,BeanTwo&gt; fieldTwo; public Map&lt;String, BeanTwo&gt; getFieldTwo() { return fieldTwo; } public void setFieldTwo(Map&lt;String, BeanTwo&gt; fieldTwo) { this.fieldTwo = fieldTwo; } public String getFieldOne() { return this.fieldOne; } public void setFieldOne(String fieldOne) { this.fieldOne = fieldOne; } } BeanTwo.java public class BeanTwo { private String fieldOne; public String getFieldOne() { return this.fieldOne; } public void setFieldOne(String fieldOne) { this.fieldOne = fieldOne; } } Tester.java import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; import org.apache.commons.beanutils.BeanUtils; public class Tester { public static void main(String[] args) throws IllegalAccessException, InvocationTargetException { Map beanTwoMap = new HashMap(); beanTwoMap.put("fieldOne", "fieldOne2222Value"); Map beanOneMap = new HashMap(); beanOneMap.put("fieldOne", "fieldOneValue"); beanOneMap.put("fieldTwo", beanTwoMap); BeanOne beanOne = new BeanOne(); BeanUtils.populate(beanOne, beanOneMap); System.out.println(beanOne.getFieldOne()); System.out.println(beanOne.getFieldTwo().get("fieldOne")); } } output will be:- fieldOneValue fieldOne2222Value
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32900045
has text: @orourkedd, this is clearly a Linux question, elevating the UAC isn't particularly relevant here. Anyway, there's something wrong with the question, since it can't possibly throw this exception there.
comment on: http://stackoverflow.com/a/21750102
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32816337
type: QuestionComment
comment on: http://stackoverflow.com/q/21698939
has text: You should add mappedBy="links" to the relationship @ManyToOne(cascade = CascadeType.ALL)
score: 0
type: Comment

http://stackoverflow.com/a/61729768
type: Answer
upvote count: 0
has body: Here str will be the given string. This is Javascript code function maxCharacter(str){ let str1 = str; let reptCharsCount=0; let ele='';let maxCount=0; let charArr = str1.split(''); for(let i=0; i&lt; str1.length; i++){ reptCharsCount=0; for(let j=0; j&lt; str1.length; j++){ if(str1[i] === str1[j]) { reptCharsCount++; } } if(reptCharsCount &gt; maxCount) { ele = str1[i]; maxCount = reptCharsCount; } } return ele; }
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/21750365

http://stackoverflow.com/a/21839030
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/33327308
upvote count: 1
has body: Because the data type in Oracle is set to BYTE alignment instead of CHAR alignment you end up with any multi-byte characters eating up multiple "slots" out of the available 14. For example, VARCHAR2(2 BYTE) will hold two 1-byte characters or only one 2-byte character (and won't hold a 3-byte character at all). In Java, however, substring() will count even 2-byte characters as a single character so you end up sending too much data for the Oracle column to hold. You can use VARCAHR2(14 CHAR) in oracle (which will hold 14 multi-byte characters) and make your Java programming easy, or you can come up with an algorithm in Java that counts the number of bytes used by a string and then trim accordingly (making sure not to cut multi-byte characters in the middle).
accepted answer of: http://stackoverflow.com/q/21838196
answers question: http://stackoverflow.com/q/21838196

android-listview
tags question: http://stackoverflow.com/q/21782769
tags question: http://stackoverflow.com/q/21776669
tags question: http://stackoverflow.com/q/21732164
tags question: http://stackoverflow.com/q/21707618
tags question: http://stackoverflow.com/q/21830682
tags question: http://stackoverflow.com/q/21757950
tags question: http://stackoverflow.com/q/21788571
tags question: http://stackoverflow.com/q/21759626
tags question: http://stackoverflow.com/q/21745600
tags question: http://stackoverflow.com/q/21801401
tags question: http://stackoverflow.com/q/21807722
tags question: http://stackoverflow.com/q/21687183
tags question: http://stackoverflow.com/q/21839955
tags question: http://stackoverflow.com/q/21695064
tags question: http://stackoverflow.com/q/21744002
tags question: http://stackoverflow.com/q/21761720
tag name: android-listview
type: Tag
tags question: http://stackoverflow.com/q/21783863
tags question: http://stackoverflow.com/q/21716499
tags question: http://stackoverflow.com/q/21799464
tags question: http://stackoverflow.com/q/21706521

http://stackoverflow.com/a/21834537
upvote count: 1
has body: I would personally use Java DOM to checks your nodes. Using regex for XML is a nightmare, and any code attempting it is very likely to break in the future. Try something like this to get the string contents of your 'variant-items' nodes. File xmlFile = new File("your_xml.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(xmlFile); NodeList nList = doc.getElementsByTagName("variant-items"); for (int i = 0; i &lt; nList.getLength(); i++) { Node node = nList.item(i); System.out.println(node.getNodeValue()); } The above code prints the values of all 'variant-items' nodes in an xml file. If resources/speed considerations are an issue (like when your_xml.xml is huge), you might be better off using SAX, which is faster (a little more code intensive) and doesn't store the XML in memory.
score: 1
has comment: http://stackoverflow.com/comment/33078049
answers question: http://stackoverflow.com/q/21834286
downvote count: 0
has comment: http://stackoverflow.com/comment/33074517
type: Answer

http://stackoverflow.com/q/21809453
has answer: http://stackoverflow.com/a/21809515
has comment: http://stackoverflow.com/comment/33003893
has body: So some background information, I'm new to programming and am still learning, so I apologize for my trivial error making. I am making my own text based game just to further practice etc. Here is the link to everything on dropbox for more context: https://www.dropbox.com/sh/uxy7vafzt3fwikf/B-FQ3VXfsR I am currently trying to implement the combat system for my game, and I am running into the issue of the combat sequence not ending when required. The 'combat sequence' is a while loop as follows: public void startCombat() { inCombat = true; while(inCombat != false)// &amp;&amp; herohealth &gt; 0 &amp;&amp; monsterhealth &gt; 0) { checkAlive(); heroHitMonster(); checkAlive(); monsterHitHero(); } attackinghero.setHeroHealth(herohealth); attackedmonster.setMonsterHealth(monsterhealth); } where the checkAlive() method is as follows: public void checkAlive() { if(herohealth &lt;= 0) { System.out.println("You have died."); attackinghero.clearInventory(); inCombat = false; } else if(monsterhealth &lt;= 0) { System.out.println("You have killed the "+attackedmonster.getmonsterName()+"!"); inCombat = false; combatlocation.removeMonster(attackedmonster.getmonsterName()); } else { // } } I am trying to get it to end the combat sequence when either the 'hero' or 'monster' health become &lt;= 0, however it is currently finishing the while loop and therefore producing the result of the hero being hit even if he killed the monster in his first hit. This is what is currently being 'printed to screen' rat loses 5 health! You have killed the rat! Hero loses 1 health! Any help is much appreciated, thanks in advance.
tagged with: text-based
has answer: http://stackoverflow.com/a/21809534
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21809524
tagged with: java
has comment: http://stackoverflow.com/comment/33003911
type: UnansweredQuestion
tagged with: bluej
has title: while loop not ending when required
has comment: http://stackoverflow.com/comment/33003913
tagged with: while-loop
type: Question

http://stackoverflow.com/comment/33021888
comment on: http://stackoverflow.com/a/21816974
score: 0
type: Comment
has text: "The important part which is tripping me up is that I cannot declare the background in draw(), because I have other functions which place images."
type: AnswerComment

http://stackoverflow.com/q/21792899
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/32974802
has comment: http://stackoverflow.com/comment/32975626
tagged with: java
score: 0
has title: How to add views in Android through java and give separate ids
tagged with: button
tagged with: android
has comment: http://stackoverflow.com/comment/32975462
tagged with: http://stackoverflow.com/tag/xml
has body: I am working on an application in which the user is allowed to make certain edited versions of a running piece of music (a "Taal") repeatedly. My problem is that I want to be able to create a new RelativeLayout with textViews and Buttons when the user create a new "Taal". For this, I would need to create a new RelativeLayout and Buttons through the Java side of the code rather than the xml, but I do not know how exactly I would be able to assign separate ids for each button when it is created, because Java requires an id in the form R.id.* Example XML code: &lt;RelativeLayout android:id="@+id/RelativeLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="TaalName" android:textSize="28dp" /&gt; &lt;ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_alignParentTop="true" android:layout_gravity="right" android:layout_toLeftOf="@+id/imageButton2" android:background="#00000000" android:paddingRight="15dp" android:src="@android:drawable/ic_menu_edit" /&gt; &lt;ImageButton android:id="@+id/imageButton2" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_gravity="right" android:background="#00000000" android:paddingRight="15dp" android:src="@android:drawable/ic_menu_delete" /&gt; &lt;/RelativeLayout&gt; In this code, I have the Relative layout that would be repeated for each "Taal" that the user creates. The main thing is that I would require separate ids for the ImageButtons so that clicking one would not delete all of the "Taals" at once Here is the Java code I am currently using for some of the initialization of the Buttons, note that the delete "Taal" and the relati…
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32855270
comment on: http://stackoverflow.com/q/21726378
type: QuestionComment
type: Comment
has text: What does your project-structure look like? Is A the parent of B or C? If yes, this is probably not what you want. What do you expect as result (i.e. what should be the outcome - an EAR-file?). If all three "modules" are within the same "project", you could make one parent-pom which has these three modules as children.
score: 0

http://stackoverflow.com/comment/33059717
score: 0
comment on: http://stackoverflow.com/a/21840869
has text: @helloMundo: It **is** possible to gain access to the data if you give Connect4 appropriate getter and setter methods that allow this access. Just don't make the data public.
type: Comment
type: AnswerComment

triangulation
tags question: http://stackoverflow.com/q/21706947
tag name: triangulation
tags question: http://stackoverflow.com/q/21756058
tags question: http://stackoverflow.com/q/21803408
tags question: http://stackoverflow.com/q/21752543
type: Tag

http://stackoverflow.com/comment/32814684
type: AnswerComment
has text: basically, what happens is that all asynctasks are run by a manager on dedicated threads. those threads are being reused and when the app requires more threads, more are created to make that happen. then, `Runnable` objects are posted into those threads and return their result
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21703007

http://stackoverflow.com/a/21823236
has comment: http://stackoverflow.com/comment/33028921
upvote count: 1
score: 1
has body: As the output of free command shows above, 5 GB of data is cached. This is a part of Hard Disk which is cached in RAM. Linux will free the memory as the applications need them. More information is available in this answer. Trust linux, he knows the memory management and will free the cached space, as an application needs RAM.
has comment: http://stackoverflow.com/comment/33028568
has comment: http://stackoverflow.com/comment/33029085
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21823001
accepted answer of: http://stackoverflow.com/q/21823001
type: Answer

http://stackoverflow.com/q/21702396
has comment: http://stackoverflow.com/comment/32812875
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32818127
has comment: http://stackoverflow.com/comment/32814413
tagged with: java
has title: Using property file vs Database table to store Locale specific data
has body: We have a case where certain class has 4 property out of which one (description) is locale specific . Class is something like Class Abc { private int id; private String name; private String description; private String value; } For now, we have 3 of them in a database table, and description in a property file, where id is key and description is value. We have roughly 800 data. Recently, we have a requirement where we need to search this class based on their properties , mixed . I was just thinking to move even the description in database tables, where we have locale specific tables. Any suggestions ?
type: Question

http://stackoverflow.com/q/21737726
has comment: http://stackoverflow.com/comment/32876986
has comment: http://stackoverflow.com/comment/32876486
has title: Find and delete specific objects from a Set with minimal iteration using Java
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32877171
tagged with: list
has answer: http://stackoverflow.com/a/21737816
upvote count: 3
tagged with: multithreading
downvote count: 1
has body: I have a set of objects and each object has its own id... I also have a list of ids, each denoting the id of an object to be removed from the set.. Unfortunately I need the most efficient approach to do this... Obviously, I could iterate through the set, and for each entry iterate through the list to see if the ids match... But is there a quicker way? I was wondering if it might be faster to use a Map to map ids to each object's placement within the set? It would be more to keep track of, but the efficiency here is the top priority - the set itself is dynamic and this operation will occur often... The situation is essentially that I have a server thread that is closing sockets that another thread has determined are idle, and the server thread needs to get this done as quickly as possible, so it can resume its normal duties... Unfortunately the server thread is the only thread allowed to close sockets to avoid concurrency issues... Are there better ways to do this?
type: Question
has comment: http://stackoverflow.com/comment/32876391
tagged with: object
has comment: http://stackoverflow.com/comment/32876525
has comment: http://stackoverflow.com/comment/32876500
tagged with: java
has comment: http://stackoverflow.com/comment/32876239
accepted answer: http://stackoverflow.com/a/21737816
has comment: http://stackoverflow.com/comment/32876492
has comment: http://stackoverflow.com/comment/32876442
has comment: http://stackoverflow.com/comment/32876394
answer count: 1
has comment: http://stackoverflow.com/comment/32876321
has comment: http://stackoverflow.com/comment/32876468
tagged with: iteration
favorite count: 0

http://stackoverflow.com/q/21698569
answer count: 1
has answer: http://stackoverflow.com/a/21698978
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/32806205
has comment: http://stackoverflow.com/comment/32806583
type: Question
has body: i wanted to write uploaded image to some folder, but hear for the first try i thought to write it to the same path which i get by using " request.getRealPath("") " , after executing the program flow went smoothly with out any error but i not able to find the image where it wrote...!. When i checked by debugging the program i come to know some odd path which i not able to find i.e " /home/Software/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/elibrary/roronoa-zoro-wallpapers.jpg " i able to find only "/home/Software/workspace/ " and "last => /elibrary/" is my project name. Currently i am using Spring mvc 3.2 this is my controller code @RequestMapping(value = "/catalogue/catalogueImageUpload.action",method=RequestMethod.POST) public void getimportedImage(USerDetails uploadItem,HttpServletRequest request) { try { MultipartFile file = uploadItem.getFileData(); String fileName = null; InputStream inputStream = null; OutputStream outputStream = null; inputStream = file.getInputStream(); fileName = request.getRealPath("") + file.getOriginalFilename(); System.out.println(request.getRealPath("") + file.getOriginalFilename()); outputStream = new FileOutputStream(file.getOriginalFilename()); int readBytes = 0; byte[] buffer = new byte[40000]; while ((readBytes = inputStream.read(buffer, 0, 10000)) != -1) { outputStream.write(buffer, 0, readBytes); } outputStream.close(); inputStream.close(); } catch (Exception e) { e.printStackTrace(); } } what i wanted ...? => i wanted to write image in specific folder which i able to find, it might be in project work space , or any of the drive , or with in the project with some folder say image folder
has title: Writing image to specific folder using OutputStream in java
score: 0

http://stackoverflow.com/q/21715716
accepted answer: http://stackoverflow.com/a/21715794
has title: Complexity of this for loop
has comment: http://stackoverflow.com/comment/32837758
has comment: http://stackoverflow.com/comment/32837730
has comment: http://stackoverflow.com/comment/32837690
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21715806
tagged with: java
has answer: http://stackoverflow.com/a/21715806
has comment: http://stackoverflow.com/comment/32837767
type: Question
has answer: http://stackoverflow.com/a/21715794
linked to: http://stackoverflow.com/q/9313572
has comment: http://stackoverflow.com/comment/32837700
has comment: http://stackoverflow.com/comment/32837761
has body: I am confused as to the run time for a method. The method is given below: public void remove(List&lt;String&gt; list){ for(int i = 0; i &lt; list.size(); i++) list.remove(0); } Can someone please explain to me why this will only run N/2 times rather than N times?
has comment: http://stackoverflow.com/comment/32837749
score: 0
has comment: http://stackoverflow.com/comment/32837684
has answer: http://stackoverflow.com/a/21715905
has comment: http://stackoverflow.com/comment/32837637
has answer: http://stackoverflow.com/a/21715827

http://stackoverflow.com/q/21749088
has comment: http://stackoverflow.com/comment/32896864
score: 0
has comment: http://stackoverflow.com/comment/32901571
has title: Eclipse - web app Tomcat deployment borked
has comment: http://stackoverflow.com/comment/32896805
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32897861
tagged with: tomcat7
type: Question
has comment: http://stackoverflow.com/comment/32902991
tagged with: java
has body: Any help will be much appreciated. I am running a web application which depends on two other projects in my work space. These two projects further depend on 3 other projects in my workspace. There are no errors with any of the projects within the work space. Running the web app within Tomcat produces the following error: java.lang.NoClassDefFoundError: com/tele/misc/DefaultApplicationModule Which is a class within the first level of dependent projects. All was working fine up until recently. This is obviously some sort of classpath issue? Any suggestions on how to find this within Eclipse metadata and fix this? More detail: Console: ******************************************************************* *** WARNING: Apache MyFaces-2 is running in DEVELOPMENT mode. *** *** ^^^^^^^^^^^ *** *** Do NOT deploy to your live server(s) without changing this. *** *** See Application#getProjectStage() for more information. *** ******************************************************************* Feb 13, 2014 1:41:18 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart Feb 13, 2014 1:41:18 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/CRGen] startup failed due to previous errors Feb 13, 2014 1:41:18 PM org.apache.catalina.core.StandardContext listenerStop SEVERE: Exception sending context destroyed event to listener instance of class za.co.huge.processor.CRToolContextListener java.lang.NoClassDefFoundError: com/tele/misc/DefaultApplicationModule at za.co.huge.processor.ReportProcessor.<init>(ReportProcessor.java:30) at za.co.huge.processor.ReportProcessor.getInstance(ReportProcessor.java:41) at za.co.huge.processor.CRToolContextListener.contextDestroyed(CRToolContextListener.java:22) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4927) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5573) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) at…
has answer: http://stackoverflow.com/a/21749175
tagged with: eclipse
tagged with: classpath
has comment: http://stackoverflow.com/comment/32896943
has comment: http://stackoverflow.com/comment/32905870
answer count: 1

http://stackoverflow.com/comment/32969430
type: Comment
score: 7
comment on: http://stackoverflow.com/q/21789964
type: QuestionComment
has text: Do be aware that, when using System.out, output from different threads may not appear in the "correct" order.

http://stackoverflow.com/comment/65246966
comment on: http://stackoverflow.com/a/21778759
score: 1
type: AnswerComment
type: Comment
has text: @KisnardOnline Regarding images, I once created this example http://stackoverflow.com/a/23971327/3182664 and I basically combined them to build http://codereview.stackexchange.com/a/83455/41175 , **BUT** the latter uses multiple lights to achieve (somewhat) soft shadows, and this, is too slow to be used in practice. (However, combining both approaches with a *single* light (and thus "hard shadows") is perfectly feasible. Maybe I'll just throw all this on GitHub one day, there seems to be a demand for that....

http://stackoverflow.com/comment/32983730
type: Comment
has text: @T.J.Crowder Yes, and m stuck here
type: QuestionComment
comment on: http://stackoverflow.com/q/21798202
score: 0

http://stackoverflow.com/comment/32954395
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21781486
has text: @Dukeling You're right, I did mean NP-hard. I don't think it is possible to verify that a solution is optimal in polynomial time. Made the proper adjustments.

http://stackoverflow.com/a/32184978
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21810697
has body: Yes, and we have! Please use the latest version of Crawler4j as I have added many methods to catch different types of exceptions. Now, when you extend WebCrawler, just override the many methods you can override: https://github.com/yasserg/crawler4j/blob/master/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java Like the following for example: onPageBiggerThanMaxSize onUnexpectedStatusCode onContentFetchError onUnhandledException etc. just please note that those methods were called and the page wasn't processed due to a reason, so adding it again as a seed shouldn't change the problem... Anyway, the latest version of crawler4j, handles many pages much better, so by just upgrading to v4.1 (currently) or later you will be able to crawl many more pages.
type: Answer
answers question: http://stackoverflow.com/q/21810697
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/32885902
comment on: http://stackoverflow.com/q/21742757
has text: @mangusta You use `malloc` in C++? Tsk, tsk.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21686670
type: Answer
answers question: http://stackoverflow.com/q/21686352
has body: well make getHostServices a static method if it suites your design, or make an arrangement to call it from a non-static method or block.
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/32786357
score: -1
has comment: http://stackoverflow.com/comment/32785324

http://stackoverflow.com/comment/33037947
type: Comment
type: QuestionComment
has text: classnotfound sometimes means "can't load this class"
comment on: http://stackoverflow.com/q/21828846
score: 0

http://stackoverflow.com/comment/33024080
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21820624
score: 0
has text: @Quincrunx How does your suggestion of using an integral type help with the OP's rounding problem?

http://stackoverflow.com/a/27802117
accepted answer of: http://stackoverflow.com/q/21726119
upvote count: 60
score: 60
type: AcceptedAnswer
downvote count: 0
has body: I use ${@environment.getProperty('myPropertyName')}
type: Answer
has comment: http://stackoverflow.com/comment/92655726
answers question: http://stackoverflow.com/q/21726119
has comment: http://stackoverflow.com/comment/91683979

geotools
type: Tag
tags question: http://stackoverflow.com/q/21732794
tag name: geotools

http://stackoverflow.com/a/21721304
upvote count: 5
has comment: http://stackoverflow.com/comment/32848321
has comment: http://stackoverflow.com/comment/32848309
answers question: http://stackoverflow.com/q/21721242
type: AcceptedAnswer
downvote count: 0
has body: This wont work because you are calculating the result and then do the cast. double result = (double)(someValue/3600); But why didnt this work? For me it works fine, because you cast the values to double before calculating. double result = (double)((double)someValue/(double)3600); But there is no need for casting the result again! Or for casting both values to double. And its enough if you add an d to the end of the number to tell the compiler that this number should be a dobule value: double result = someValue/3600d;
has comment: http://stackoverflow.com/comment/32847038
has comment: http://stackoverflow.com/comment/32846779
type: Answer
accepted answer of: http://stackoverflow.com/q/21721242
has comment: http://stackoverflow.com/comment/32846746
score: 5

http://stackoverflow.com/q/21837724
has title: Storing an array - MYSQL
score: 0
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/21837800
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33053906
has body: Given a Profile table containing details about the user - what are the best ways to store in the database the optional pictures they are allowed. Every user has one main profile picture - an then three optional extra pictures. For sake of potential expandability and maintainability i thought maybe the three optional images could be stored as an array of some sort (~and this could also be a nullable field if they choose not to have any) Please could someone advise on the best approach. Thanks
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/21837832

http://stackoverflow.com/comment/32818427
type: Comment
has text: +1 Thanks for the help. I'm pretty sure the regex is good. I'm going to look elsewhere for the problem
type: AnswerComment
comment on: http://stackoverflow.com/a/21704768
score: 0

http://stackoverflow.com/a/21826354
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21825148
upvote count: 2
type: AcceptedAnswer
has body: The Windows Explorer favorites are stored in the registry under HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Favorites. The Apple Finder favorites are stored in the file ~/Library/Preferences/com.apple.sidebarlists.plist. Attention: This file may be in XML or in binary format, depending on OS version (10.0-10.4 uses XML, 10.4 introduced a binary format, 10.7 allows JSON). There is no easy way in Java to access these resources.
type: Answer
answers question: http://stackoverflow.com/q/21825148
score: 2

http://stackoverflow.com/a/21769110
type: Answer
has body: Before the TimerTask's run method,you can set a flag. eg: if the flag is true, execute the run method else don't execute the run method.
answers question: http://stackoverflow.com/q/21768663
has comment: http://stackoverflow.com/comment/32932381
score: 0

http://stackoverflow.com/comment/32792985
comment on: http://stackoverflow.com/a/21690591
has text: I don't get what you say. Can you please modify my code and explain?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21715324
upvote count: 15
accepted answer of: http://stackoverflow.com/q/21714977
has body: I think this would work for you. webdriver.wait().until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='some_input'][contains(@style, 'display: block')]")));
downvote count: 0
answers question: http://stackoverflow.com/q/21714977
has comment: http://stackoverflow.com/comment/92032973
has comment: http://stackoverflow.com/comment/86723373
type: AcceptedAnswer
score: 15
type: Answer

http://stackoverflow.com/comment/32796551
comment on: http://stackoverflow.com/a/21692861
has text: Thanks for the post... the color has to be in what form? What has to be in the `color=?`
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21828123
score: 0
has body: When specifying your URL, make sure to pass "https://..." url.openConnection(); will return you an object that has the type of the established connection. It will always be URLConnection, but it can be a class that extends URLConnection as well. Such classes are HttpURLConnection and HttpsURLConnection (and others). You should verify that the returned object is of type HttpsURLConnection. And if it's not, you should stop the connection (in case you want to avoid non secure connections). if (connection instanceof HttpsURLConnection)
type: Answer
answers question: http://stackoverflow.com/q/21827216

http://stackoverflow.com/q/21709711
answer count: 1
favorite count: 0
tagged with: visualvm
type: AnsweredQuestion
downvote count: 0
tagged with: jvisualvm
has answer: http://stackoverflow.com/a/21752965
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21752965
has body: atm I use the following java params to enable remote access for a java application. But everyone who does a port scan can get access. I couldn´t find the params to set a user and password or ip whitelist. How can I do this ? java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false class
type: Question
has title: Remote VisualVM secure authentication
upvote count: 1

http://stackoverflow.com/q/21757091
possible better answer: http://stackoverflow.com/a/21757240
score: 0
has answer: http://stackoverflow.com/a/21757240
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has title: How do I add an onClickLIstener to my code to carry out a method I already have implemented
type: AnsweredQuestion
tagged with: onclicklistener
has answer: http://stackoverflow.com/a/21757325
tagged with: java
tagged with: methods
type: Question
has body: Hello this is my first ever post in stack overflow and I am a complete beginner at programming so your help would be greatly appreciated! Ok so I am following a tutorial on making a TicTacToe (noughts and crosses) Game in java for android and in the tutorial the person makes a Reset Game button in a menu however I want to make an actual button below the game area. I have added the buttons (see bottom of XML) and their is already a method that resets the game, so I need so help to figure out how and where I add code in my java so that when I click one of my buttons it resets the game for me (clears the board) Thank you in advance! package com.C05025.noughtsandcrosses; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.widget.Button; import android.widget.TextView; import android.view.View; public class NoughtsAndCrossesGame extends Activity { private NoughtsAndCrosses Game; private Button PASButtons[]; private TextView InfoTextView; private TextView UserCount; private TextView DrawCount; private TextView AICount; private int UserCounter = 0; private int DrawCounter = 0; private int AICounter = 0; private boolean UserFirst = true; private boolean GameOver = false; Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.playarea); PASButtons = new Button[NoughtsAndCrosses.getPLAY_AREA_SIZE()]; PASButtons[0] = (Button) findViewById(R.id.one); PASButtons[1] = (Button) findViewById(R.id.two); PASButtons[2] = (Button) findViewById(R.id.three); PASButtons[3] = (Button) findViewById(R.id.four); PASButtons[4] = (Button) findViewById(R.id.five); PASButtons[5] = (Button) findViewById(R.id.six); PASButtons[6] = (Button) findViewById(R.id.seven); PASButtons[7] = (Button) findViewById(R.id.eight); PASButtons[8] = (Button) findViewById(R.id.nine); InfoTextView = (TextView) findViewById(R.id.information); UserCount = (TextView) findViewById(R.id.userCount)…
answer count: 2
accepted answer: http://stackoverflow.com/a/21757325

class
tags question: http://stackoverflow.com/q/21701923
tags question: http://stackoverflow.com/q/21721820
tags question: http://stackoverflow.com/q/21823419
tags question: http://stackoverflow.com/q/21717568
tags question: http://stackoverflow.com/q/21814770
tags question: http://stackoverflow.com/q/21801136
tags question: http://stackoverflow.com/q/21701405
tags question: http://stackoverflow.com/q/21822168
tags question: http://stackoverflow.com/q/21816764
tags question: http://stackoverflow.com/q/21796784
tags question: http://stackoverflow.com/q/21766221
tags question: http://stackoverflow.com/q/21730982
tags question: http://stackoverflow.com/q/21814830
tags question: http://stackoverflow.com/q/21809933
tags question: http://stackoverflow.com/q/21766810
tags question: http://stackoverflow.com/q/21755138
tags question: http://stackoverflow.com/q/21697428
tags question: http://stackoverflow.com/q/21794159
tags question: http://stackoverflow.com/q/21801311
tags question: http://stackoverflow.com/q/21800018
tags question: http://stackoverflow.com/q/21789571
tags question: http://stackoverflow.com/q/21747061
tags question: http://stackoverflow.com/q/21810240
tags question: http://stackoverflow.com/q/21683783
type: Tag
tags question: http://stackoverflow.com/q/21788097
tags question: http://stackoverflow.com/q/21760930
tags question: http://stackoverflow.com/q/21807474
tags question: http://stackoverflow.com/q/21734841
tag name: class
tags question: http://stackoverflow.com/q/21745925
tags question: http://stackoverflow.com/q/21829652
tags question: http://stackoverflow.com/q/21719220
tags question: http://stackoverflow.com/q/21807061
tags question: http://stackoverflow.com/q/21746201
tags question: http://stackoverflow.com/q/21686970
tags question: http://stackoverflow.com/q/21732952
tags question: http://stackoverflow.com/q/21818588
tags question: http://stackoverflow.com/q/21725227
tags question: http://stackoverflow.com/q/21694021
tags question: http://stackoverflow.com/q/21807210
tags question: http://stackoverflow.com/q/21723766
tags question: http://stackoverflow.com/q/21805287

http://stackoverflow.com/a/21712887
has comment: http://stackoverflow.com/comment/32833395
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32832961
answers question: http://stackoverflow.com/q/21712833
accepted answer of: http://stackoverflow.com/q/21712833
type: Answer
has comment: http://stackoverflow.com/comment/32833440
has body: It looks like your import statement containing FileUtils is commented out (org.apache.commons.io.*).. uncomment it, recompile and try again: package Lynda.Essential_training; import java.io.*; import org.apache.commons.io.*; //&lt;-- the problem public class fileHandlingCommons { public static void main(String[] args) throws Exception { File f1 = new File("/home/kusur/java_programs/source.txt"); File f2 = new File("target2.txt"); FileUtils.copyFile(f1,f2); } }
score: 2
has comment: http://stackoverflow.com/comment/32833090
upvote count: 2

http://stackoverflow.com/q/21713573
tagged with: session
has comment: http://stackoverflow.com/comment/32834901
possible better answer: http://stackoverflow.com/a/21713675
has answer: http://stackoverflow.com/a/21713675
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21713654
tagged with: generics
has comment: http://stackoverflow.com/comment/32834221
has comment: http://stackoverflow.com/comment/32834278
has comment: http://stackoverflow.com/comment/32835731
tagged with: dictionary
has comment: http://stackoverflow.com/comment/32834575
type: AnsweredQuestion
has title: How to cast a Session object to Map?
has body: I am converting old java code to support generics and came across this line of code which was trying to cast an object retrieved from the session into a TreeMap: TreeMap allTransactions = (TreeMap) pageContext.getSession() .getAttribute("allTransactions"); When I tried to convert it to specific type: TreeMap&lt;String, MyDataBean&gt; allTransactions = (TreeMap&lt;String, MyDataBean&gt;) pageContext.getSession().getAttribute("allTransactions"); It gave me a warning: Type safety: Unchecked cast from Object to TreeMap&lt;String,MyDataBean&gt; In an effort to get rid of the warning completely, I wrote a method to cast it to Map: public static &lt;K,V&gt; Map&lt;K,V&gt; castToMap(Class&lt;? extends K&gt; clazz1, Class&lt;? extends V&gt; clazz2, Map&lt;?,?&gt; c) { Map&lt;K,V&gt; map = new TreeMap&lt;K,V&gt;(); for (Map.Entry&lt;?,?&gt; entry : c.entrySet()) { Object key = entry.getKey(); Object value = entry.getValue(); map.put(clazz1.cast(key), clazz2.cast(value)); } return map; } Goodnews: This time I did not get any error when I modified the initial code to call this method: Map&lt;String, MyDataBean&gt; allTransactions = MyUtilityClass.castToMap(String.class, MyDataBean.class, (Map&lt;?,?&gt;)pageContext.getSession().getAttribute("allTransactions")); But I still had to cast it ^^^here to call my function. Question 1: Why it does not show any errors now when I am still using the cast (Map&lt;?,?&gt;) versus what I tried before (TreeMap&lt;String,MyDataBean&gt;)? Question 2: My app is broken as of now since other developers have not committed the code yet, and so I am in no position to run the App and verify its correctness. Can anyone tell just by looking at it, if this casting will behave the same way as before?
accepted answer: http://stackoverflow.com/a/21713654
tagged with: java
has comment: http://stackoverflow.com/comment/32835266
has comment: http://stackoverflow.com/comment/32834509
has comment: http://stackoverflow.com/comment/32834787
type: Question
tagged with: casting

http://stackoverflow.com/a/21774440
has body: In java Applet's Paint method is called infinite number of times to provide an consistent UI for user , just try it out by adding System.out.println() inside Paint, So avoid calling those methods inside Paint.
type: Answer
answers question: http://stackoverflow.com/q/21774340
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/32941528
downvote count: 0
has comment: http://stackoverflow.com/comment/32941565

http://stackoverflow.com/a/21829224
has body: As long as we are talking about HotSpot JVM ... Object itself IS NOT marked as finalized. Each time when you create new finalize object, JVM creates an extra object FinalizerRef (which is somewhat similar with Weak/Soft/Phantom references). Once your object is proven to unreachable with strong references special references to this object are processed. FinalizerRef for you object will be added to finalizer queue (which is linked list, same as with other reference types). When finalizer thread consumes FinalizerRef from queue it would null its null pointer to object (though thread will keep strong reference to object until finalizer is finished). Once FinalizerRef is nullified, object cannot get to finalizer queue any more. BTW You can see preference processing times (and number of references) in GC logs with -XX:+PrintReferenceGC (see more GC diagnostic JVM options)
answers question: http://stackoverflow.com/q/21809922
upvote count: 5
type: Answer
downvote count: 0
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33222233
accepted answer of: http://stackoverflow.com/q/21809922

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/21686744
tags question: http://stackoverflow.com/q/21826957
type: Tag

http://stackoverflow.com/q/21799499
tagged with: java
has answer: http://stackoverflow.com/a/21799758
has comment: http://stackoverflow.com/comment/32985841
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21799608
has title: bizzarre char[] issiu in java. can't copy the values and skip white spaces
has body: B's and G's this is driving me nuts. I am hoping one of you guru's can save me from stuff my head int he toilet and singing! I am trying to copy one array fo char's to another without copying the whitespaces. This is not final code in the sense that it only accounts for ' ' and not the various other forms of whitespace i.e \t. But that is not the main issue. import java.io; import java.util.*; public class tester { public static void main(String args[]) throws Exception { Scanner in = new Scanner(new File("intxt.txt")); String x = ""; while(in.hasNext()) { x = in.nextLine(); } System.out.println("This line has " + x.length() + "characters."); char[] charAr = x.toCharArray(); for(int i = 0; i&lt;charAr.length; i++) { //prints the int representation of all values System.out.print((int)charAr[i] + " "); } char[] out = new char[charAr.length]; for(int i =0; i&lt;out.length; i++) { char y = ' '; if(charAr[i] != y) { System.out.println("in here " + (int)y); out[i] = charAr[i]; } } for(int i = 0; i&lt;out.length; i++) { //should print hellothere System.out.print(out[i]+" "); } } }
has answer: http://stackoverflow.com/a/21799595
type: UnansweredQuestion

http://stackoverflow.com/comment/32892084
has text: it was commented as it would crash the code.. cant figure out what its problem is.. the log cat wen code is active has vbeen posted
comment on: http://stackoverflow.com/a/21746278
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21712604
has comment: http://stackoverflow.com/comment/32831880
has body: I keep getting: illegal start of expression,';" expected System.exit(0), and reached end of file while parsing This is the description of what its suppose to do and the code. Problem to Solve: How much should I study outside of class? Issue: Your fellow students need help. This is their first year in college and they need to determine how many hours they need to study to get good grades. Study Hrs Per Week Per Credit Grade 5: A, 4: B, 3: C, 2: D, 0: F, Project Specifications: The user enters either the number of hours they plan on studying per week or the grade they want based on the number of credit hours they enter. (Note: Your program must provide the user both options.) The program displays the user’s name, number of credits, total number of study hours, and grade they should expect to receive. You may use any programming technique covered in the Intro to Programming Logic course to complete this project. That will require, however, that you read ahead in your textbook for instructions on how to implement the technique in the Java programming language. Below is my code: import javax.swing.JOptionPane; //Needed for the dialogue box /** This program shows the student the grade they will receive or how much to study for a certain grade. */ public class MoultonAlainaProject1 { public static void main(String[] args) { string wantedGrade, desiredGrade, name, input; char finalGrade; int gradeA = 5; int gradeB = 4; int gradeC = 3; int gradeD = 2; int gradeF = 0; float studyHrs; int creditHrs, userChoice; //Scanner for keyboard input Scanner keyboard = new Scanner(System.in); name = JOptionPane.showInputDialog("Please enter your name."); input = JOptionPane.showInputDialog("How many credit hours do you plan on taking this semester?"); creditHrs = integer.parseInt(input); input = JOption.showInputDialog("If you would like to know the amount of hours you should study for the amount of" + "credit hours press 1. If you would like to know the grade you would receive by" + "en…
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/21712677
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32831910
tagged with: java
tagged with: system.exit
type: Question
answer count: 2
has title: error illegal start of expression
has answer: http://stackoverflow.com/a/21712679
score: 0

http://stackoverflow.com/comment/33010665
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21810763
has text: Thanks. I did it this way, in the end. You would think Spring would provide a concurrent package for MAVEN/GRADLE builds

http://stackoverflow.com/comment/32870676
type: AnswerComment
comment on: http://stackoverflow.com/a/21732589
score: 0
type: Comment
has text: @Prince that's how the `Collections.sort` method works. It requires a `Comparator`, which is an interface that guarantees the presence of a `compare(o1, o2)` method.

http://stackoverflow.com/q/21707894
linked to: http://stackoverflow.com/q/859111
accepted answer: http://stackoverflow.com/a/21714472
answer count: 3
has title: How to add multiple truststore paths to “java.net.ssl.trustStore”?
has body: I want my Java Code to search for CA certificate of the server in one keystore... if it is unable to find the specific certificate (which I think will be known only when I try to connect via LDAP to Directory Server), it should look for the certificate in another keystore, whose path I know. I tried this: System.setProperty("javax.net.ssl.trustStore", System.getProperty("java.home") + "/lib/security/cacerts" + System.getProperty("path.separator") + path/to/second/keystore); But it didn't seem to work. Adding only one path (either of them) works, i.e. it runs like charm if certificate is found and fails if not. So my question is: Is there a method to add multpile keystore paths to javax.net.ssl.trustStore? If it is not possible how should I write my code (I am asking for the algorithm) so that it just not throw Exception after first search itself and fail? P.S. : I am not much familiar with Java. Below is the relevant section of my code: if(useSSL) { try { SSLContext se = SSLContext.getInstance("TLS"); Security.addProvider(se.getProvider()); } catch(NoSuchAlgorithmException e) { } System.setProperty("javax.net.ssl.trustStore", System.getProperty("java.home") + "/lib/security/cacerts"); com.org.ldap.LDAPSocketFactory ssf = new LDAPJSSESecureSocketFactory(); LDAPConnection.setSocketFactory(ssf); } try { lc = new LDAPConnection(); lc.connect( ldapServer, ldapPort); lc.bind( ldapVersion, ldapUser, (userInfo[1]).getBytes() ); } catch (LDAPException le) { le.printStackTrace(); }
downvote count: 0
favorite count: 0
upvote count: 25
has answer: http://stackoverflow.com/a/63937788
score: 25
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/24555890
has answer: http://stackoverflow.com/a/21715252
has answer: http://stackoverflow.com/a/21714472
tagged with: certificate
type: Question
possible better answer: http://stackoverflow.com/a/21715252
tagged with: ssl

http://stackoverflow.com/a/21838060
answers question: http://stackoverflow.com/q/21835345
type: Answer
has comment: http://stackoverflow.com/comment/33074820
accepted answer of: http://stackoverflow.com/q/21835345
has comment: http://stackoverflow.com/comment/33057688
has comment: http://stackoverflow.com/comment/33060106
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/33058456
has comment: http://stackoverflow.com/comment/33058832
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33102358
downvote count: 0
has body: Have you enabled transaction management? You need to use @EnableTransactionManagement on your config class otherwise @Transactional has no effect. A spring tutorial on Managing Transactions As a side note: making the controller layer transactional is usually not a good idea, especially when you have a proper separation of controller, service and repository layers. Consider moving @Transactional into the service layer. Since you are using JPA, also make sure you have a JpaTransactionManager configured: @Bean public PlatformTransactionManager transactionManager() { return new JpaTransactionManager(); } You might try extending the JpaRepository interface instead of CrudRepository then you can use saveAndFlush(entity) to make sure the changes are immediately flushed after merge.
has comment: http://stackoverflow.com/comment/33055967
has comment: http://stackoverflow.com/comment/33057096

http://stackoverflow.com/a/21753774
answers question: http://stackoverflow.com/q/21745697
type: Answer
upvote count: 4
has body: You can read the csv file in a private method like this http://groovy-almanac.org/csv-parser-with-groovy-categories/ and then you can assign the variables a and b like this: where: a &lt;&lt; [readCSVAMap[0],readCSVAMap[1],readCSVAMap[2]] b &lt;&lt; [readCSVBMap[0],readCSVBMap[1],readCSVBMap[2]]
score: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21745697

http://stackoverflow.com/a/21798547
has comment: http://stackoverflow.com/comment/57389871
has body: Spring boot try to start a web server, but did not findy any in the class path. Try to add this dependency org.springframework.boot spring-boot-starter-web <version>I Dont know</version Btw you pom does not look like a typical spring boot pom! Compare it with http://projects.spring.io/spring-boot/docs/README.html
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33010827
answers question: http://stackoverflow.com/q/21796811
accepted answer of: http://stackoverflow.com/q/21796811
type: Answer
upvote count: 14
score: 14
has comment: http://stackoverflow.com/comment/33093727
has comment: http://stackoverflow.com/comment/33092907

http://stackoverflow.com/comment/32862637
score: 1
has text: "Without having to rely on external libs"
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21706760

http://stackoverflow.com/a/21773188
has comment: http://stackoverflow.com/comment/32944157
has body: You can use Java SE standard utility java.nio.file.Files.copy(Path source, Path target, CopyOption... options)
answers question: http://stackoverflow.com/q/21773085
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32941812
has comment: http://stackoverflow.com/comment/32942346
score: 1
upvote count: 1

http://stackoverflow.com/comment/32889936
comment on: http://stackoverflow.com/a/21745188
has text: This is working but for some reason the orientation lock and the removal of the banner is not working?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21690194
type: Answer
answers question: http://stackoverflow.com/q/21690112
downvote count: 0
has body: I think you're looking for this pattern. public enum BookType { INVALID(0), HORROR(1), FANTASY(2), ACTION(3), ERROR(4); private int value; private BookType(int value) { this.value = value; } public int getValue() { return value; } public String toString(){ return super.toString().toLowerCase(); } public static BookType getInstance(int value) { for (BookType type : BookType.values()) { if (value == type.value) { return type; } } return INVALID; } public static void main(String[] args){ BookType b1 = BookType.HORROR; System.out.println(b1.toString()); BookType b2 = BookType.getInstance(3); System.out.println(b2.toString()); } }
score: 1
has comment: http://stackoverflow.com/comment/32792179
has comment: http://stackoverflow.com/comment/32792037
upvote count: 1

http://stackoverflow.com/comment/32849255
score: 1
type: QuestionComment
has text: I think what you need are *profiles*: you can define several of them and each of them may define the same property but with different values. Then you can use the property to specify which properties files you have to include in your current build.
type: Comment
comment on: http://stackoverflow.com/q/21718357

http://stackoverflow.com/comment/77448991
comment on: http://stackoverflow.com/q/21686036
score: 0
type: Comment
type: QuestionComment
has text: instead of the if...then...else inside the loop with the mod, you can declare a variable: double flip = 1; outside the loop, and inside the loop: flip *= -1;

jakarta-ee
tags question: http://stackoverflow.com/q/21826783
tags question: http://stackoverflow.com/q/21748079
tags question: http://stackoverflow.com/q/21796875
tags question: http://stackoverflow.com/q/21726815
tags question: http://stackoverflow.com/q/21748007
tags question: http://stackoverflow.com/q/21763829
tags question: http://stackoverflow.com/q/21832293
type: Tag
tags question: http://stackoverflow.com/q/21773767
tags question: http://stackoverflow.com/q/21698992
tags question: http://stackoverflow.com/q/21747518
tags question: http://stackoverflow.com/q/21773464
tags question: http://stackoverflow.com/q/21715139
tags question: http://stackoverflow.com/q/21751865
tags question: http://stackoverflow.com/q/21750203
tags question: http://stackoverflow.com/q/21818625
tags question: http://stackoverflow.com/q/21733018
tags question: http://stackoverflow.com/q/21761570
tags question: http://stackoverflow.com/q/21700565
tags question: http://stackoverflow.com/q/21687646
tags question: http://stackoverflow.com/q/21838950
tags question: http://stackoverflow.com/q/21694154
tags question: http://stackoverflow.com/q/21708114
tags question: http://stackoverflow.com/q/21817809
tags question: http://stackoverflow.com/q/21704779
tags question: http://stackoverflow.com/q/21837206
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/21755470
tags question: http://stackoverflow.com/q/21732611
tags question: http://stackoverflow.com/q/21752766
tags question: http://stackoverflow.com/q/21804268
tags question: http://stackoverflow.com/q/21774949
tags question: http://stackoverflow.com/q/21817936
tags question: http://stackoverflow.com/q/21752788
tags question: http://stackoverflow.com/q/21760180
tags question: http://stackoverflow.com/q/21694457
tags question: http://stackoverflow.com/q/21829176
tags question: http://stackoverflow.com/q/21801813
tags question: http://stackoverflow.com/q/21805971
tags question: http://stackoverflow.com/q/21752305
tags question: http://stackoverflow.com/q/21776742
tags question: http://stackoverflow.com/q/21708229
tags question: http://stackoverflow.com/q/21830494
tags question: http://stackoverflow.com/q/21703704
tags question: http://stackoverflow.com/q/21814136
tags question: http://stackoverflow.com/q/21717842
tags question: http://stackoverflow.com/q/21764549
tags question: http://stackoverflow.com/q/21720261
tags question: http://stackoverflow.com/q/21789972
tags question: http://stackoverflow.com/q/21766729
tags question: http://stackoverflow.com/q/21777299
tags question: http://stackoverflow.com/q/21686584
tags question: http://stackoverflow.com/q/21769800
tags question: http://stackoverflow.com/q/21715490
tags question: http://stackoverflow.com/q/21733150
tags question: http://stackoverflow.com/q/21680626
tags question: http://stackoverflow.com/q/21740003
tags question: http://stackoverflow.com/q/21720663
tags question: http://stackoverflow.com/q/21719444
tags question: http://stackoverflow.com/q/21809747
tags question: http://stackoverflow.com/q/21796019
tags question: http://stackoverflow.com/q/21685852
tags question: http://stackoverflow.com/q/21802575
tags question: http://stackoverflow.com/q/21810200
tags question: http://stackoverflow.com/q/21684988
tags question: http://stackoverflow.com/q/21682869
tags question: http://stackoverflow.com/q/21718018
tags question: http://stackoverflow.com/q/21782448

http://stackoverflow.com/comment/32862396
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21729406
has text: @MiserableVariable In my (proprietary) code for a library that processes expressions I un-overloaded the `visit` methods by lining up their names with the syntax of my expressions, rather than with the names of types in the expression tree, for example, `visitDotExpression(MemberAccessExpression e)`. As far as the second part of the question goes, I do not agree with the premise of the question that the DRY principle should be even considered in the context of method overloading, even when we are not talking the visitor pattern.

http://stackoverflow.com/comment/37128740
has text: It still a bug in 4.3.5, see https://hibernate.atlassian.net/browse/HHH-9141
score: 5
type: QuestionComment
comment on: http://stackoverflow.com/q/21693139
type: Comment

http://stackoverflow.com/q/21702950
answer count: 2
has answer: http://stackoverflow.com/a/21723110
favorite count: 0
has body: I have some data in csv format. eg K1,K2,data1,data2,data3 here my mapper passes the key to reducer as K1K2 &amp; Value as data1,data2,data3 I wanted to save this data in Multiple Files with file name being K1k2(or the key which reducer gets). Now If I'm using MultipleOutputs class, I have to mention the file names before mapper begins. But here , since only after reading the data from mapper, I can determine the key. How should i proceed? PS I'm new to this.
has title: How to generate Multiple File names in runtime in HADOOP?
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21703569
tagged with: java
tagged with: mapreduce
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21703569
tagged with: hadoop
possible better answer: http://stackoverflow.com/a/21723110
upvote count: 4

http://stackoverflow.com/q/21775626
tagged with: logback
score: 0
has title: Logging in different files with logback sharing packages
answer count: 0
type: UnansweredQuestion
has body: I have a batch application which executes two different logic depending on the parameter passed. My application uses Spring and I want to log in different log files each of this "different processes". As the classes are in different packages, I configured in logback.xml file the loggers to use its own appender <?xml version="1.0" encoding="UTF-8"?> <configuration> <property resource="batch.properties" /> %date [%thread] %-5level %logger - %message%n ${log.dir}/batch-${HOSTNAME}.log %date [%thread] %-5level %logger - %message%n 1 10 ${log.dir}/batch-${HOSTNAME}.log.%i 10MB ${log.dir}/batch-${HOSTNAME}.log %date [%thread] %-5level %logger - %message%n 1 10 ${log.dir}/batch-${HOSTNAME}.log.%i 10MB <appender-ref ref="appender1">/ <appender-ref ref="appender2">/ <appender-ref ref="console"/> But I want to log Spring information too, but "only" in the file of the process it's executing. How should I configure that? Thanks EDIT: posted my actual logback.xml. I know that with that configuration spring is not logging in any file, but I dont know how to configure it to log only in one.
has comment: http://stackoverflow.com/comment/32943559
tagged with: java
has comment: http://stackoverflow.com/comment/32947800
type: Question

http://stackoverflow.com/comment/32847501
has text: Ankit, you can edit your answer if you need to. Also, how does this change explain the previous `??` in the printed logger statement?
type: AnswerComment
comment on: http://stackoverflow.com/a/21720084
score: 0
type: Comment

http://stackoverflow.com/comment/32837216
has text: You don't really need to implement a dictionary, you just need to use one.
score: 1
comment on: http://stackoverflow.com/q/21715354
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32827880
comment on: http://stackoverflow.com/q/21710465
score: 0
type: QuestionComment
type: Comment
has text: @AnthonyAccioly I'll run that and update the question

http://stackoverflow.com/comment/32945499
type: Comment
comment on: http://stackoverflow.com/q/21776140
score: 0
has text: Have added that in. Thanks
type: QuestionComment

http://stackoverflow.com/comment/34783252
type: Comment
comment on: http://stackoverflow.com/a/22808466
type: AnswerComment
has text: I cannot for each one of them, I have way too many fields. I want something which will set for all of it... Sorry if i misunderstood it :P
score: 0

http://stackoverflow.com/comment/33001983
score: 0
has text: Can I suggest you flip the if to `if (message.equals("up"))`..trust me get in the habit of that if will save you one day
comment on: http://stackoverflow.com/q/21808288
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32893183
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21747038
has text: that's it., no issue.. have you tried with jar files?
type: AnswerComment

http://stackoverflow.com/comment/40328606
type: Comment
type: QuestionComment
has text: possible duplicate of [CreateProcess error=206, The filename or extension is too long when running main() method](http://stackoverflow.com/questions/10519558/createprocess-error-206-the-filename-or-extension-is-too-long-when-running-main)
comment on: http://stackoverflow.com/q/21709072
score: 0

http://stackoverflow.com/q/21820598
type: Question
has answer: http://stackoverflow.com/a/21820774
possible better answer: http://stackoverflow.com/a/21820624
answer count: 3
upvote count: 1
linked to: http://stackoverflow.com/q/3730019
favorite count: 0
has title: Java always wants to round when i am doing math
has answer: http://stackoverflow.com/a/21820624
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21820813
accepted answer: http://stackoverflow.com/a/21820813
score: 1
tagged with: java
has body: The problem is happening, I THINK, where the program uses the interest rate. Using the test data: Loan amount: $500,000.00 Yearly interest rate: 5.6% Number of years: 30 I should get the result: Monthly payment: $2,870.39 Instead, I get: Loan amount: $500,000.00 Yearly interest rate: 6% Number of years: 30.0 Monthly Payment: $34,783.54 Help please EDIT- This is for a homework assignment, and the professor has noted that he does not want us using BigDecimal objects. Why is beyond me, as I have demonstrated my ability to solve this using BigDecimal math in the past. Here is the code: /* * 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. */ package workbook5.pkg2; import java.util.Scanner; import java.text.*; /** * * @author Daniel */ public class Workbook52 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner sc = new Scanner(System.in); double loanAmount = getDouble(sc, "Enter loan amount: ", 0, 1000000); double interestRate = getDouble(sc, "Enter interest rate (5% as .05): ", 0, 20); double years = getInt(sc, "Enter amount of years: ", 0, 100); double payment = calculatePayment(loanAmount, interestRate, years); System.out.println("FORMATTED RESULTS"); System.out.println("Loan amount: " + NumberFormat.getCurrencyInstance().format(loanAmount)); System.out.println("Yearly interest rate: " + NumberFormat.getPercentInstance().format(interestRate)); System.out.println("Number of years: " + years); System.out.println("Monthly Payment: " + NumberFormat.getCurrencyInstance().format(payment)); } public static double getDouble(Scanner sc, String prompt, double min, double max){ double i = 0; boolean isValid = false; while (isValid == false) { System.out.println(prompt); if (sc.hasNextDouble()) { i = sc.nextDouble(); isValid=true; } else { System.out.println("Error! Invalid d…

http://stackoverflow.com/comment/32938787
comment on: http://stackoverflow.com/q/21772775
score: 2
has text: Have you heard of escape characters?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32816080
type: Comment
comment on: http://stackoverflow.com/a/21703381
score: 0
has text: @jankryss i found another error... you have to call `super.paintComponent()` when you make custom painting.
type: AnswerComment

http://stackoverflow.com/a/21772999
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32939728
has comment: http://stackoverflow.com/comment/32939572
has body: I have formatted your post. See your code carefully if (n1 &lt;= n2 || n1 &lt;= n3) { min = n1; if (n2 &lt;= n3) { mid= n2; max = n3; } else { mid = n3; max = n2; } else if(n2 &lt;= n3) { min = n2; } You are missing closing bracket of if (n1 &lt;= n2 || n1 &lt;= n3). Always practice properly indented and formatted coding to avoid these kinds of errors. You can auto format your whole code by pressing these keys in eclipse. Ctrl+Shift+F Or Ctrl+I to indent the selected part of you code.
has comment: http://stackoverflow.com/comment/32939529
answers question: http://stackoverflow.com/q/21772878
downvote count: 0
has comment: http://stackoverflow.com/comment/32939467

http://stackoverflow.com/comment/32984117
comment on: http://stackoverflow.com/q/21797500
score: 0
has text: I can do that. I know how to get the connection when the user logs in. I was wondering how to make use of Spring injection for this though.
type: Comment
type: QuestionComment

properties
tags question: http://stackoverflow.com/q/21726887
tags question: http://stackoverflow.com/q/21708123
type: Tag
tags question: http://stackoverflow.com/q/21777474
tag name: properties
tags question: http://stackoverflow.com/q/21711562
tags question: http://stackoverflow.com/q/21767161
tags question: http://stackoverflow.com/q/21733425

http://stackoverflow.com/q/21824669
has comment: http://stackoverflow.com/comment/37178675
has comment: http://stackoverflow.com/comment/44397926
score: 12
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33032053
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33032880
upvote count: 12
has body: I am using jackson.map.ObjectMapper API to convert map to json string. I am using writeValueAsString method to achieve this. I pass a map sorted on the basis of values to writeValueAsString method. The JSON string which I get is resorted on the basis of keys. Is there a way to convert maps to JSON string using jackson without disturbing the order of items in the map. I tried setting Feature.SORT_PROPERTIES_ALPHABETICALLY to false, but as per documentation it is applicable only for POJO types. Any idea to implement the said behavior.
answer count: 1
downvote count: 0
tagged with: jackson
favorite count: 0
has title: Jackson Object mapper to convert java map to json maintaining order of keys
has answer: http://stackoverflow.com/a/21825370

http://stackoverflow.com/a/21851975
upvote count: 3
has body: I think it should be target := base / "WEB-INF" or classDirectory := base / "WEB-INF" / "classes"
answers question: http://stackoverflow.com/q/21834922
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/a/21840070
type: Answer
has body: I don't think a TreeSet can do what you want for this search. You might want to try a Map&lt;School, List&lt;A&gt;&gt; that maps each school to a list of objects with that school.
score: 0
answers question: http://stackoverflow.com/q/21840015

http://stackoverflow.com/q/21712833
possible better answer: http://stackoverflow.com/a/21712910
has answer: http://stackoverflow.com/a/21712910
type: Question
has answer: http://stackoverflow.com/a/21712887
has title: Using a class from a .jar file
score: 0
answer count: 2
tagged with: file-io
has body: I am trying to use a class FileUtils.class from a commons-io-2.4.jar file. The code is as follows:- package Lynda.Essential_training; import java.io.*; //import Lynda.Essential_training.org.apache.commons.io.*; public class fileHandlingCommons { public static void main(String[] args) throws Exception { File f1 = new File("/home/kusur/java_programs/source.txt"); File f2 = new File("target2.txt"); FileUtils.copyFile(f1,f2); } } When I compile this program, with the command:- javac -cp /usr/sys/java_programs/Lynda/Essential_training/Commons-io-2.4.jar Lynda/Essential_training/fileHandlingCommons.java I get the following error:- Lynda/Essential_training/fileHandlingCommons.java:12: error: cannot find symbol FileUtils.copyFile(f1,f2); ^ symbol: variable FileUtils location: class fileHandlingCommons I am getting the same error when I am extracting all the files from the .jar folder and then compiling the program (in which case, the commented import statement in the program is used). Can you please help?
has comment: http://stackoverflow.com/comment/32832826
tagged with: jar
accepted answer: http://stackoverflow.com/a/21712887
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32828516
has text: And in what way is this related to editing text written in the command prompt? How are you visualizing the maze data?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21710889
type: QuestionComment

http://stackoverflow.com/a/21705402
has comment: http://stackoverflow.com/comment/32860289
has body: To prevent code duplication,you can define a non-static method which does all your initlization block for all your constructors.You can include this method below your call to super() to initialize your object.But the drawback is ..it can be called from any other method within the class.So it is not a good design pattern class TestEmployee extends Employee{ double bonus; TestEmployee(){ super(1000000); intialize(10000); } TestEmployee(double bonus){ super(bonus); intialize(bonus); } private void intialize(double bonus) { this.salary = bonus; } }
answers question: http://stackoverflow.com/q/21704696
score: 0
type: Answer

http://stackoverflow.com/a/21799343
type: Answer
has comment: http://stackoverflow.com/comment/32987925
upvote count: 1
answers question: http://stackoverflow.com/q/21799245
score: 1
has body: You could use this.getClass().getResourceAsStream("mypdf.pdf"); if the file is in directory where your class is.
downvote count: 0
has comment: http://stackoverflow.com/comment/32987348

http://stackoverflow.com/q/21806817
has title: Android : How to Declare static broadcast receiver
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/21807191
tagged with: android
type: UnansweredQuestion
tagged with: java
has body: i want to know how can we register static broadcast receiver through AndroidManifest.xml My class BroadcastReceiver class public class YourBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras(); if (bundle == null) return; String phoneNumber = null; // Incoming call String state = bundle.getString(TelephonyManager.EXTRA_STATE); if ((state != null)&&(state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_RINGING))) { phoneNumber = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER); // Here: do something with the number } // Outgoing call else if (state == null) { phoneNumber = bundle.getString(Intent.EXTRA_PHONE_NUMBER); // Here: do something with the number } } } My AnrdoidMainfest.xml files in which i get error ( class or interface expected ) on that line <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <category android:name="android.intent.category.LAUNCHER" /> about my project , it have two modules and this second module is entirely Asynctask thread run by mainactivity and i want this broadcast receiver for this second module . am using android studio 0.4.4 so need help

http://stackoverflow.com/comment/32935940
comment on: http://stackoverflow.com/a/21738044
type: Comment
has text: @user3303096 Please vote up and mark this answer as accepted. To show your problem is solved. If this answer is valid or and accordingly what you ask for. see [why voting is important](http://stackoverflow.com/help/why-vote)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32933972
comment on: http://stackoverflow.com/q/21769860
type: QuestionComment
has text: Also if you're using Hibernate as your provider I think the correct annotation for an embedded collection is `@CollectionOfElements` not `@ElementCollection`
type: Comment
score: 0

http://stackoverflow.com/q/21819531
has body: https://github.com/jgilfelt/android-sqlite-asset-helper I'm switching from SQLiteOpenHelper to SQLiteAssetHelper so i can use an existing DB stored in the /assests folder. My code is very basic, normally it creates a one table DB and can insert data into it and retrieve data from it. I switched to SQLiteAssetHelper, got rid of the onCreate method as it should now just use an already created one, and then ran the code again and it crashes as soon as i start the activity which creates an object of my SQLiteAssetHelper helper class, which makes me think the helper class has the problem, also because no database appears to have been copied to my app /data/data/packagename folder. Heres my code with the previous onCreate() method, whiched worked, left in comments. The only other change from it previously working is extending SQLiteOpenHelper instead of SQLiteAssetHelper. My database is in sourceprojectfolder/assests/databases/productsdb.db Helper Class package com.example.myfirstapp; import java.util.HashMap; import com.readystatesoftware.sqliteasset.SQLiteAssetHelper; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; class DbHelper extends SQLiteAssetHelper{ public static final String KEY_ROWID = "id"; public static final String KEY_NAME = "product_name"; public static final String KEY_DESC = "product_description"; private static final String DATABASE_NAME = "productsdb.db"; private static final String DATABASE_TABLE = "products"; private static final int DATABASE_VERSION = 1; public DbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } /* //this method isn't needed with SQLiteAssetHelper it says. Thats why its commented. @Override public void onCreate(SQLiteDatabase db) { String query = "CREATE TABLE products ( productId INTEGER PRIMARY KEY, productName TEXT, " + "productDesc TEXT)"; // Executes the qu…
tagged with: java
has answer: http://stackoverflow.com/a/21832376
type: Question
upvote count: 0
score: -2
answer count: 1
has title: SQLiteAssetHelper causes instant crash before even copying the database from the assets folder
tagged with: sqlite
favorite count: 0
type: UnansweredQuestion
tagged with: android
downvote count: 2

http://stackoverflow.com/comment/32953974
type: Comment
comment on: http://stackoverflow.com/a/21781471
type: AnswerComment
has text: You did not add the `, ns` to all the `prop.addContent(....)` like I have in the code, did you?
score: 0

http://stackoverflow.com/a/21815633
score: 1
accepted answer of: http://stackoverflow.com/q/21815562
answers question: http://stackoverflow.com/q/21815562
has body: Now the question: How can i do a ++ every 200ms for both locXbtnTrapMe and locYbtnTrapMe until the randX and randY get reached? Use a Swing Timer, and in the Timer's ActionListener's actionPerformed method, test the state of your watched fields, and increment them if below the maximum. Then make sure to call stop() on your Timer when the maximum has been reached. Some decent links to help you out: Java Swing Tutorial Swing Timer Tutorial One useful StackOverflow question re animation with Swing Timer. There are many more if you look for them.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/a/21747329
score: 28
type: Answer
has comment: http://stackoverflow.com/comment/66090179
has body: You need to set the project language level (default for all modules) and the module(s) language level
downvote count: 0
answers question: http://stackoverflow.com/q/21747254
upvote count: 28

http://stackoverflow.com/comment/32788487
score: 0
type: Comment
type: QuestionComment
has text: I don't see the difference.
comment on: http://stackoverflow.com/q/21688475

http://stackoverflow.com/comment/32855464
score: 0
type: Comment
has text: `Mapping is hardly the biggest hurdle`---not to OP, if he is at the level of considering RMI vs. raw Sockets as alternatives.
comment on: http://stackoverflow.com/a/21725681
type: AnswerComment

http://stackoverflow.com/comment/33044885
type: QuestionComment
has text: There is AOP, which manipulates the byte code, so you can intercept calls and such. A bit of heavy artillery.
score: 1
comment on: http://stackoverflow.com/q/21832620
type: Comment

http://stackoverflow.com/comment/32993616
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21802828
has text: It is just a folder on my mac. Something to do with it?
score: 0

http://stackoverflow.com/q/21752074
tagged with: java
tagged with: eclipse
has body: we are making an android application where the text retrieved from the image is to be integrated with other apps of an android phone. we are making this application using Eclipse IDE and the gui and the integration part is in java and xml, which is done We now are starting with the OCR engine and are confused about making it in java or Matlab.So please help us out as to using which language is better in accordance to the IDE and the rst of the project.
type: Question
downvote count: 0
has title: ocr engine ia better made in java or Matlab
has comment: http://stackoverflow.com/comment/32901937
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
tagged with: matlab
score: 2

http://stackoverflow.com/comment/32851111
type: AnswerComment
type: Comment
has text: Thank you.But i want it not as a direct query.Thats y i have moved to predicates.Do u know how to acheive the same in queryDsl predicates and spring jpa
score: 0
comment on: http://stackoverflow.com/a/21723768

http://stackoverflow.com/q/21760869
has comment: http://stackoverflow.com/comment/32917267
score: 0
has answer: http://stackoverflow.com/a/21761381
has comment: http://stackoverflow.com/comment/32917122
has comment: http://stackoverflow.com/comment/32917351
has body: Object data; try { File file = new File("medicamente.txt"); FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); String line; while ((line = bufferedReader.readLine()) != null) { int k = 0; for (int j = 0; (line = bufferedReader.readLine()) != null; j++) { for (int i = 0; i &lt; 8; i++) { data[i][k] = line.split(","); k++; } } } fileReader.close(); } catch (IOException e) { e.printStackTrace(); } it says: array required, but object found. I want to read the file medicamente.txt and put everything in an object so i can put the object in a JTable.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21761062
possible better answer: http://stackoverflow.com/a/21761381
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21761062
has title: i can't import what is contained in a file into an object so i can use it in a JTable

http://stackoverflow.com/a/40224023
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21799384
accepted answer of: http://stackoverflow.com/q/21799384
type: Answer
has body: What I needed was mySQLite, it's saved on the device as a single file and easily managed through java.

http://stackoverflow.com/a/21818231
answers question: http://stackoverflow.com/q/21785837
score: 3
has comment: http://stackoverflow.com/comment/33049302
has comment: http://stackoverflow.com/comment/33054351
upvote count: 3
has comment: http://stackoverflow.com/comment/33054507
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33040041
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21785837
has body: Unfortunately I can't say how you realised the implementation of the fullscreen app. But I tried a few things and came up with this: import java.awt.Color; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Gui extends JFrame { public Gui() { this.setDefaultCloseOperation(EXIT_ON_CLOSE); //this.setSize(java.awt.Toolkit.getDefaultToolkit().getScreenSize()); // Set some charateristics of the frame this.setExtendedState(Frame.MAXIMIZED_BOTH); this.setBackground(Color.black); this.setUndecorated(true); JButton a = new JButton("PRESS ME!"); a.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JFileChooser fc = new JFileChooser(); fc.showOpenDialog(getParent()); } }); this.add(a); this.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Gui(); } }); } } Pay attention to the fact, that I created a new JFileChooser with the parent of the current JFrame as parameter. EDIT: I now even tried to set java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(new Gui()); and without the this.setUndecorated(true); it worked for me (got a nice fullscreen view and the JFileChooser was in the front). I believe the problem with the window decoration is linked to my window manager (I'm using linux with gnome). Hopefully this solution works for you, if not: Could you explain a little bit more, how you create the fullscreen app?
has comment: http://stackoverflow.com/comment/33054431

http://stackoverflow.com/q/21833110
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Can DTOs be spring managed beans?
tagged with: spring
has answer: http://stackoverflow.com/a/21834112
tagged with: spring-3
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33047388
has comment: http://stackoverflow.com/comment/33046048
has comment: http://stackoverflow.com/comment/33045696
has body: I am using spring 3.0. I have few DTOs. Can I declare them as spring beans? If so what should be the bean scope?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33055614

http://stackoverflow.com/comment/33108883
comment on: http://stackoverflow.com/q/21826020
score: 0
type: Comment
type: QuestionComment
has text: You can use `[` and `]` instead of `<` and `>`. It is much better in my opinion. To use `[` and `]` just start your template with `[#ftl]`.

http://stackoverflow.com/q/21684192
type: Question
tagged with: java
has body: Does someone do loading font file in iTextPDF from database? When loading font, for example: BaseFont.createFont("res/mycustomfont.ttf", BaseFont.CP1250, BaseFont.EMBEDDED) it's loaded from local filesystem. I have read iText in action 2E, (especialy I have repeated chapter 11 now) but none about loading fonts from database, just how to load them from file system. Going through source code, looks that for true type font (example above) the real data read is done in TrueTypeFont#process(byte ttfAfm[], boolean preload) and it reads from local filesystem only. Curious if someone have override it for reading font data from DB?
has comment: http://stackoverflow.com/comment/32802960
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: iTextPDF BaseFont reading font from database
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/32802021
upvote count: 2
tagged with: itext

http://stackoverflow.com/q/21739368
answer count: 2
tagged with: nested-loops
score: 0
tagged with: while-loop
has answer: http://stackoverflow.com/a/21739415
has answer: http://stackoverflow.com/a/21739410
possible better answer: http://stackoverflow.com/a/21739415
has title: Nested While Loop Logical Error
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21739410
tagged with: java
has body: I am new to Java and I am trying to understand Nested while loops. I am trying to write a program that will print the following output: 999999999 on the top line, 88888888 on the next, 7777777 etc, 666666 etc, 55555 4444 333 22 1 I was easily able to do this using a for loop, but now I want to do the same with a While Loop. The issue is that my code, in its current state, only prints the first line of nines, and then it looks like the inner While loop doesn't run anymore afterwards. I am super perplexed, I don't think any of my criteria are Tautologies, but I don't understand tautologies that well. Please explain what is wrong with my loop logic. Loops are still a lot of mystical voodoo to me. int outer = 9; int inner = 1; while (outer &gt;= 1) { while(inner &lt;= outer) { System.out.print(outer); inner++; } System.out.println(); outer--; }
type: Question

http://stackoverflow.com/comment/32920806
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21761664
has text: Did you verify that the file org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader.**class** in your output.jar exists?
type: Comment

http://stackoverflow.com/comment/32952737
has text: You sir are quite knowledgable in this area! Thanks a ton. I tried the connection.getSchema() and verified the fields I wish to populate are available. They simply hold no values currently as you stated.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21773374

http://stackoverflow.com/comment/32993399
comment on: http://stackoverflow.com/q/21803513
has text: How stupid I am, welcome really turns null :\. Thanks a lot and sorry for stupid question.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33056281
comment on: http://stackoverflow.com/a/21838934
score: 0
type: Comment
has text: The enhanced for loop creates a local reference which is not assigned to any of the array elements
type: AnswerComment

http://stackoverflow.com/comment/32937281
type: QuestionComment
has text: Done. I will report to Google ;)
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21771568

http://stackoverflow.com/comment/32892938
has text: Yeah I never realized I had to actually make the jar file, i thought it came packaged in. And my command prompt lines work, so i think this question is done o,o
comment on: http://stackoverflow.com/q/21747052
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21782769
tagged with: android
type: AnsweredQuestion
has title: Access main class member variable from setOnItemClickListener
tagged with: java
has answer: http://stackoverflow.com/a/21782841
type: Question
has comment: http://stackoverflow.com/comment/32955932
has answer: http://stackoverflow.com/a/21782829
accepted answer: http://stackoverflow.com/a/21782829
score: 0
answer count: 2
tagged with: android-listview
possible better answer: http://stackoverflow.com/a/21782841
has body: I have implemented an activity with a simple ListView. In the java file, I have implemented OnItemClickListener() to respond to ListView item clicked. public class MainActivity extends Activity { private String value; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_screen); value = "Hello World"; final ListView listview = (ListView)findViewById(R.id.listview); final ArrayAdapter&lt;String&gt; aa; aa = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, ListValues); listview.setAdapter(aa); listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, final View view, int position, long id) { // Get Item Clicked String ItemSelected = (String)listview.getItemAtPosition(position); // Access "value" containing "Hello World" } } } I need to access member variable value of my MainActivity class in onItemClick(). Kindly tell me how to do it.

http://stackoverflow.com/q/21739552
tagged with: android
has title: Resizing bitmap image within imageview
tagged with: java
type: Question
tagged with: imageview
has body: I have an imageview that displays a photo taken with the phone's camera, which can be changed by the user. The problem I'm having is that the picture is scaling too small within the imageview, is there a way to force the bitmap to fit the imageview completely?
has comment: http://stackoverflow.com/comment/32879860
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21739748
has comment: http://stackoverflow.com/comment/32879921
type: UnansweredQuestion

http://stackoverflow.com/q/21709931
type: AnsweredQuestion
has body: I'm using Mule ESB 3.4. I want to develop a custom Java component that counts how many requests are received by a flow. The flow would e.g. be something like this: http inbound-endpoint -&gt; counter -&gt; vm-outbound-endpoint First of all, the actual variable containing the counter should be stored in memory. Then it might be printed to the log or inserted into a DB (It's not important for now). What I'm after is a clean design that I can later re-use to store a more complex application-global state (based on the number and the content of received messages) and implement a more complex logic.
has comment: http://stackoverflow.com/comment/32827497
possible better answer: http://stackoverflow.com/a/21711379
has comment: http://stackoverflow.com/comment/32827296
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22404983
tagged with: spring
has title: Count the requests processed by a Mule flow
tagged with: java
tagged with: mule
has answer: http://stackoverflow.com/a/22404983
has answer: http://stackoverflow.com/a/21711379

http://stackoverflow.com/comment/32945929
has text: in BaseAdapter getview method put condition
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21776669

http://stackoverflow.com/comment/32928374
type: QuestionComment
comment on: http://stackoverflow.com/q/21766703
type: Comment
score: 0
has text: @natez0r It was after onCreate. I paste it before onCreate and nothing has changed

http://stackoverflow.com/comment/32983294
score: 0
has text: You can do-it in any way but using Collections give you more flexibility because java Collection framework has large no of functions to do different operations.Your code is more customized than array oriented code.In case of array it will be fast and nothing more...
comment on: http://stackoverflow.com/q/21797421
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21727606
upvote count: 4
has title: CSRF token in GET method
favorite count: 0
has body: I am going to avoid CSRF atack in my web application. I've set up csrf configuration on my apache, like this: &lt;VirtualHost&gt; ... CSRF_Enable on CSRF_Action deny CSRF_EnableReferer off &lt;/VirtualHost&gt; Also, I've installed the following apache modules: mod_csrf-0.3 mod_parp-0.12 mod_setenvifplus-0.23 that have possibility to ignore CRSF in some cases. All stuff works fine, namely csrfpid add to all POST method and does not add to GET. But one issue was found. When I try to send GET method with parameter: www.example.com/test.jsp?csrfpid=some_csrf_id&amp;some_attribute=0, csrfpid token has attached to link. I've tried to play with: SetEnvIfPlus Request_Method "GET" CSRF_IGNORE=yes. But, it does not work in my case. Also, I've found, that the issue causes through mod_csrf.c file. It will be good to get some ideas or helpful link regarding to the described case.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/45205229
tagged with: csrf-protection
answer count: 0
tagged with: java
type: Question
tagged with: apache
downvote count: 0
tagged with: csrf
score: 4

http://stackoverflow.com/comment/32952532
score: 1
has text: @Kishore . . . In general, doing something with a `SELECT` statement is faster than using a cursor in a stored procedure.
type: Comment
comment on: http://stackoverflow.com/a/21754074
type: AnswerComment

http://stackoverflow.com/q/21805439
has answer: http://stackoverflow.com/a/21806035
accepted answer: http://stackoverflow.com/a/21806035
answer count: 1
downvote count: 0
favorite count: 0
has title: Global variables in the play framework / Keeping track of open streams
has body: I'm working on a twitter app right now using twitter4j. Basically I am allowing users to create accounts, add their personal keywords, and start their own stream. I'm trying to play as nice as possible with the twitter api. Avoid rate limits, don't be connecting the same account over and over etc. So what I think I need to do is have some object that contains a list of all the active TwitterStream object, but I don't know how to approach this. This is the controller to start the stream. public static Result startStream(){ ObjectNode result = Json.newObject(); if ( //openStreams is a Map&lt;Long,TwitterStream&gt; in the TwitterListener class TwitterListener.openStreams.containsKey(Long.parseLong(session().get("id"))) ){ result.put("status", "running"); return ok(result); } Cache.set("twitterStream", TwitterListener.listener( Person.find.byId( Long.parseLong(session().get("id")) ) ) ); result.put("status", "OK"); return ok(result); } As you can see I am putting them in Cache right now but I'd like to keep streams open for long periods of time, so cache won't suffice. What is the most appropriate way to structure my application for this purpose? Should I be using Akka? How could I implement Play's Global object to do this?
type: AnsweredQuestion
tagged with: playframework-2.0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: twitter4j

http://stackoverflow.com/a/21759426
answers question: http://stackoverflow.com/q/21759251
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21759251
has body: You are sending your onPreferenceClick as context, define Context context = this in your onCreate in the Activity and pass that as context instead.

http://stackoverflow.com/comment/32850014
type: Comment
has text: If you can't reproduce the issue, then the problem may be due to limited resources in the environment (e.g. CPU, memory, etc.) rather then logic in the code.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21723148

http://stackoverflow.com/comment/45188118
has text: Agreed. I've been messing with _Xstream_ for 2 hours to serialize my enum type correctly in xml. While I found _Gson_ solution in 10 mins
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21825263
type: QuestionComment

http://stackoverflow.com/q/21826046
tagged with: java
has answer: http://stackoverflow.com/a/21844580
tagged with: struts2
tagged with: servlets
type: Question
tagged with: radio-button
has comment: http://stackoverflow.com/comment/33056352
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/33033963
score: 0
has body: Can somebody please tell me how to set the default value of radio buttons blank and then get the value from client whatever user selects and accordingly update the table. I am using following code snippet but seems to be something wrong in it : var blnValue4 = false; for (var i=0; i &lt; document.forms[0].chkTeam.length; i++) { if (document.forms[0].chkTeam[i].checked) blnValue4 = document.forms[0].chkTeam[i].value; return blnValue4; } if(blnValue4 = false) { alert("Please answer question in team participation."); document.getElementById("chkTeam").focus(); return false; } and then this is how i assign default values : &lt;td colspan =2&gt; :&lt;html:radio property="chkTeam" value="" /&gt;Yes &lt;html:radio property="chkTeam" value="" /&gt;No &lt;/td&gt; Note that in form it is set to accept Boolean as return type.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33034090
has title: How to make a radio button deselected by default in Struts2

http://stackoverflow.com/a/21791191
type: Answer
has comment: http://stackoverflow.com/comment/32972297
has comment: http://stackoverflow.com/comment/32982536
has comment: http://stackoverflow.com/comment/32982349
upvote count: 1
has comment: http://stackoverflow.com/comment/32973627
answers question: http://stackoverflow.com/q/21791118
score: 1
has comment: http://stackoverflow.com/comment/32973702
has comment: http://stackoverflow.com/comment/32973413
has comment: http://stackoverflow.com/comment/32983298
has comment: http://stackoverflow.com/comment/32983702
has comment: http://stackoverflow.com/comment/32973971
downvote count: 0
has comment: http://stackoverflow.com/comment/32972399
has comment: http://stackoverflow.com/comment/32971827
has comment: http://stackoverflow.com/comment/32972089
has comment: http://stackoverflow.com/comment/32981283
has body: According to this, you can change getSherlockActivity to this.

http://stackoverflow.com/q/21788798
has title: How to create a custom language parser for NetBeans?
has comment: http://stackoverflow.com/comment/75877845
has body: I made a custom interpreter to write server-side code in javascript embedded in HTML, much like PHP, except for the actual programming language. It is implemented as a Servlet that parses Javascript using Rhino. The pages are defined as: &lt;% // Javascript code var world = "World"; %&gt; &lt;html&gt; &lt;body&gt; &lt;!-- the following code is a javascript expression --&gt; Hello &lt;%= world %&gt; &lt;/body&gt; &lt;/html&gt; How could I build support for this language into NetBeans? I see that NetBeans already parses HTML and Javascript perfectly. Is it possible to reuse/combine Netbeans' HTML+JS functionality to parse &amp; highlight these pages?
type: AnsweredQuestion
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/21789010
tagged with: rhino
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21789010
tagged with: javascript
tagged with: antlr
score: 0
answer count: 1

http://stackoverflow.com/q/21756058
has answer: http://stackoverflow.com/a/21757290
answer count: 1
has body: I am trying to create a triangulation method and I have the following: Coordinates of 3 access points needed for the triangulation method signal strength readings from each of the access points (dmb) So the first thing I am trying to do is create a triangle using two of the access points. I will need to do an approximation of distance vs signal strength to figure out where I am between the two access points. Could somebody help me with this procedure.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32909288
tagged with: triangulation
has comment: http://stackoverflow.com/comment/32908728
has title: create a triangle wit yourself using signal strength between two points (2 access points)
type: Question
tagged with: android
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32910545

http://stackoverflow.com/q/21798683
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32984680
linked to: http://stackoverflow.com/q/21800802
has title: change background of text field in searchview of android sdk
has answer: http://stackoverflow.com/a/38624043
has comment: http://stackoverflow.com/comment/32984578
answer count: 2
has answer: http://stackoverflow.com/a/21799171
downvote count: 0
possible better answer: http://stackoverflow.com/a/38624043
favorite count: 0
tagged with: searchview
has comment: http://stackoverflow.com/comment/32984601
has body: I am making an app and I have an activity with a searchview. My point is that I want to change the background color of the text field (the black rectangle in screnn shot). My drawable: <?xml version="1.0" encoding="utf-8"?> <solid android:color="#FFFFFF"/> <corners android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp"/> My layout: <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:fitsSystemWindows="true" tools:context=".SearchActivity" > <SearchView android:id="@+id/searchView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20sp" android:layout_marginRight="20sp" android:layout_marginTop="60sp" android:actionViewClass="android.widget.SearchView" android:background="@drawable/searchview" android:iconifiedByDefault="false" android:paddingLeft="10sp" android:paddingTop="5sp" android:scrollbarAlwaysDrawVerticalTrack="true" android:showAsAction="collapseActionView" android:focusable="false" > </SearchView> Screenshot: http://imageshack.com/a/img829/3203/pd85.png Can anybody help me with that? thanks
tagged with: android
has comment: http://stackoverflow.com/comment/32984755
tagged with: android-activity
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/21799171
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32984878
upvote count: 1

http://stackoverflow.com/q/21729233
tagged with: imageview
possible better answer: http://stackoverflow.com/a/21729369
score: 0
has title: Hide ImageView on clicks
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/21729352
has answer: http://stackoverflow.com/a/21729494
accepted answer: http://stackoverflow.com/a/21729494
has answer: http://stackoverflow.com/a/21729369
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21729420
tagged with: java
has answer: http://stackoverflow.com/a/21729373
has body: Thanks for all suggestion and thoughts i finally achieved it by yours suggestions and it was a simple logic work to solve the problem. I want to share it if any one want to create custom Health Bar , but it is not suitable for 100 HP because then you have to write 100 IF statements, Idea was to create simple custom Healthbar and decrease it by pressing button clicks. This link also help me a lot. HealthBar Code private TextView Message,result; private Button play; private float maxHP = 10; private float currentHP = maxHP; //private float percentHP = (float) (currentHP/maxHP); private int user_shield; private float healthBar; private ImageView shieldusb1,shieldusb2,shieldusb3; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_level_one); Initialize(); } private void Initialize(){ user_shield = R.raw.shield_blue; shieldusb2 = (ImageView) findViewById(R.id.shield_b2); shieldusb1 = (ImageView) findViewById(R.id.shield_b1); shieldusb3 = (ImageView) findViewById(R.id.shield_b3); result = (TextView) findViewById(R.id.result); play = (Button) findViewById(R.id.playButton); play.setOnClickListener(new OnClickListener(){ public void onClick(View arg0){ play(); } }); } public void play(){ { healthBar=0; currentHP = (float) (currentHP - 0.5); //currentHP -= 1; if(currentHP &lt;= 0) //if the player died { currentHP = 0; //set his HP to zero, (just in case) Message.setText("You died! :P"); //add any extra death-code here //update the healthBar result.setText ("WIN POINTS"); } updateHealthBar(); } } private void updateHealthBar() { // percentHP = currentHP / maxHP; healthBar = currentHP; if(healthBar&lt;9.6){ shieldusb1.setVisibility(View.GONE); } { if (healthBar&lt;=9){ shieldusb2.setVisibility(View.GONE); } if (healthBar&lt;=8.6){ shieldusb3.setVisibility(View.GONE); } } }
type: Question

http://stackoverflow.com/comment/32863660
has text: Yes I do use ServiceLoader. I tried Thread.currentThread().getContextClassLoader() but it still returned the class loader of the main application.
comment on: http://stackoverflow.com/a/21725890
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21790103
type: UnansweredQuestion
tagged with: java
has title: Create android native feature using Bayeux Protocol
tagged with: bayeux
type: Question
has comment: http://stackoverflow.com/comment/32969668
has body: I am trying to create an Android project and get the Bayeux Java Client library working for it. I have the cometd library imported in my eclipse and I also added the projects to the build path of my project. My project builds fine, but on execution, I keep getting the NoClassDefFound error. I am not sure, how to set my project up. Are there any examples that I can refer to? Any help is greatly appreciated. Thanks,
tagged with: eclipse
tagged with: cometd
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32970761
has comment: http://stackoverflow.com/comment/32969734
tagged with: android
has answer: http://stackoverflow.com/a/25189601

http://stackoverflow.com/comment/33052386
score: 3
type: QuestionComment
has text: So, you're trying to call a function which takes three arguments and you only provide one, then wonder why it doesn't work?
type: Comment
comment on: http://stackoverflow.com/q/21836894

http://stackoverflow.com/comment/32930609
type: Comment
type: QuestionComment
has text: Think about how you would perform each operation yourself, at a detailed level. Do you have to test all elements? Can you find the element quicker if the input is sorted? If `n` is doubled, how does that affect how many operations you must make? You find [A Beginner’s Guide to Big O Notation](http://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/) useful.
comment on: http://stackoverflow.com/q/21768074
score: 0

http://stackoverflow.com/q/21820705
has body: I'm making a program for my mother to repay here for all she did with me. I am trying to make a program similar to Cash Register Express. How would I make a GUI similar to it and linking to other pages? And if it doesn't work with Java, any other programming languages?
tagged with: java
downvote count: 1
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21820839
has title: How do you make GUI buttons that lead to different pages in the directory with Java?
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/33024336
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/21820739
type: UnansweredQuestion

http://stackoverflow.com/comment/32947891
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21723025
has text: beware: @peeskillet's solution is **wrong** in setting table's rowHeight in the renderer! Instead, listen to all changes that might require an adjustment and change it there.

http://stackoverflow.com/comment/32904995
has text: This question is about a bug in a non-released version of a product.
score: 4
comment on: http://stackoverflow.com/q/21751830
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32779444
score: 0
has text: wow that is not programming that is juggling :) joking only
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21682802

http://stackoverflow.com/q/21721910
answer count: 1
has comment: http://stackoverflow.com/comment/32849836
has comment: http://stackoverflow.com/comment/32849678
accepted answer: http://stackoverflow.com/a/21722030
has body: After reading many related posts on stackoverflow, I still haven't been able to find a solution to my question. If this question has already been asked, please kindly provide the link. I am new to creating a Java standalone program with GUI in Eclipse. My development platform has 64-bit Windows 7, 64-bit JRE, 64-bit JDK and 64-bit Eclipse. The program has to be able to run on both 32-bit and 64-bit Windows 7 / JRE. Will there be any compatibility issues if I run my program on a 32-bit Windows 7/ JRE platform? What kind of GUI plugin for Eclipse do I need to use in order to avoid the potential compatibility issues, if any? Thank you for you help.
has comment: http://stackoverflow.com/comment/32887543
has title: Creating Java standalone program with Eclipse, 32 vs 64 bit platforms
score: 0
type: AnsweredQuestion
tagged with: 32bit-64bit
has comment: http://stackoverflow.com/comment/32847881
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21722030

http://stackoverflow.com/a/21784369
answers question: http://stackoverflow.com/q/21783400
accepted answer of: http://stackoverflow.com/q/21783400
type: Answer
has body: Look at these topics, you may find a solution there: How to display over a Java applet in Chrome How to display pop-up content on top of an applet Java Applet z-index on Safari and beyond
has comment: http://stackoverflow.com/comment/32959429
has comment: http://stackoverflow.com/comment/33014821
has comment: http://stackoverflow.com/comment/32979562
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/32774738
has text: It's hard to say without more information, but if neither `true` nor `false` apply after your computation, it might make sense to `throw an Exception` rather than return null.
comment on: http://stackoverflow.com/q/21680808
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32865380
type: AnswerComment
has text: XPath 1.0 generally isn't as well documented as some people would like. No one is going to fix that.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21716149

http://stackoverflow.com/a/21829633
downvote count: 0
has body: No, the only thing you can create are temporary queues/topics. There is no ability in the JMS API to create a permanent queue/topic.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21823183
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21823183
type: Answer

http://stackoverflow.com/q/21799178
has title: Where to download Java Communications API
upvote count: 2
linked to: http://stackoverflow.com/q/7562565
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21799302
accepted answer: http://stackoverflow.com/a/21799302
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I want to build a Java application like callerID application. But I can't find the link to download three files: comm.jar win32com.dll javax.comm.properties Some forums said: can be found at http://java.sun.com/products/javacomm. But this link does not have them. Where are these files available?
tagged with: java
has comment: http://stackoverflow.com/comment/52086723
type: Question
tagged with: java-communication-api

http://stackoverflow.com/comment/32969503
type: QuestionComment
has text: Create a `Comparator` and write the necessary comparison logic there. Probably you will need to convert your location (latitude and longitude) in a numeric object e.g. using `BigDecimal` and then do the necessary operations.
comment on: http://stackoverflow.com/q/21790006
score: 0
type: Comment

http://stackoverflow.com/q/21763994
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/65929086
downvote count: 0
favorite count: 0
tagged with: jface
has body: I wrote very big an lazy tree model and can't expand it programmatically by given path Below is entire ViewPart code. Tree works fine interactively, i.e. I can open all levels up to 10. But I can't do that programmatically. I wrote custom ViewElementComparer to compare elements. package try_13_expandtreeview; import org.eclipse.jface.action.Action; import org.eclipse.jface.viewers.IElementComparer; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.ISharedImages; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.ViewPart; public class View extends ViewPart { public static final String ID = "Try_13_ExpandTreeView.view"; private TreeViewer viewer; private Action action1; /** * Each model element is a "triad", i.e. new Object[3] * * First element of a triad is a parent element * * Second number is a level, numbered from leafs to root * * Third number is numeric value (content) of an element * * @author dims * */ class ViewContentProvider implements ITreeContentProvider { public void inputChanged(Viewer v, Object oldInput, Object newInput) { } public void dispose() { } public Object[] getElements(Object parent) { return getChildren(parent); } @Override public Object[] getChildren(Object parent) { Object[] triade = (Object[]) parent; if( ((int)triade[1]) &gt; 0 ) { Object[] children = new Object[10]; Object[] child; for(int i=0; i&lt;10; ++i) { child = new Object[3]; child[0] = parent; child[1] = ((int)triade[1])-1; child[2] = i; children[i] = child; } return children; } else { return new Object[0]; } } @Override public Object getParent(Object element) { Object[] triade = (Object[]) element; return triade[0]; } @Override public boolean hasChildren(Object element) { Object[] triade = (Object[]…
has answer: http://stackoverflow.com/a/21764263
type: UnansweredQuestion
tagged with: swt
tagged with: treeview
score: 2
has title: How to expand given path in SWT/Tree and/or JFace/TreeViewer?
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/33015842
score: 0
comment on: http://stackoverflow.com/a/21815866
has text: @Hover: I have edited my new changes(added a string)..Im creating a new String which will be initialized to nulls. Im using it in a method before assigning any values to it but I dont get a NPE..
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21708860
type: Question
has comment: http://stackoverflow.com/comment/32824899
linked to: http://stackoverflow.com/q/19322827
tagged with: jpa
has comment: http://stackoverflow.com/comment/32826967
answer count: 1
downvote count: 0
favorite count: 0
has title: No Persistence provider for EntityManager named MyBuzzPersistence
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33257253
has answer: http://stackoverflow.com/a/21710046
has comment: http://stackoverflow.com/comment/32827914
score: 1
tagged with: java
has body: My JPA project runs fine on 32 bit windows 7 with 32 bit eclipse IDE but the same does not work with 64 bit Windows 8 with 32 bit eclipse IDE. In this project I am connecting to MS-Access by creating "User DSN" (named MyBuzzDB ). For 64 bit OS, I have created User DSN in its 32 bit ODBC dialogue. I do have all JARs in my project as well. Any help would be highly appreciated. Here is my persistence.xml : <?xml version="1.0" encoding="UTF-8"?> oracle.toplink.essentials.PersistenceProvider com.myBuzz.entity.AuthenticateEntity <property name="toplink.jdbc.url" value="jdbc:odbc:MyBuzzDB" /> <property name="toplink.jdbc.user" value="" /> <property name="toplink.jdbc.driver" value="sun.jdbc.odbc.JdbcOdbcDriver" /> <property name="toplink.jdbc.password" value="" /> Stack trace is : Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named MyBuzzPersistence at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source) at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source) at com.myBuzz.service.AuthenticationService.authenticateUser(AuthenticationService.java:17) at com.myBuzz.manager.AuthenticationManager.authenticateUser(AuthenticationManager.java:16) at com.myBuzz.test.DBTest.main(DBTest.java:21)
has comment: http://stackoverflow.com/comment/33257230
upvote count: 1

communication
tag name: communication
tags question: http://stackoverflow.com/q/21761333
type: Tag
tags question: http://stackoverflow.com/q/21697482

http://stackoverflow.com/comment/32899486
type: Comment
has text: Alternatively, do you have a second class of the same name without a main? That could cause your issue.
type: QuestionComment
comment on: http://stackoverflow.com/q/21750805
score: 0

http://stackoverflow.com/comment/32984192
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21798523
score: 3
has text: What do you mean by "false"? They all compile.

http://stackoverflow.com/comment/33055086
comment on: http://stackoverflow.com/a/21837667
has text: I am unfamiliar with Maven for this, however I see it is using a plugin called jimone.How can I ask for jars to be added into this destination file?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32942642
type: QuestionComment
has text: Download the tarball, extract, configure and run.
score: 0
comment on: http://stackoverflow.com/q/21767414
type: Comment

http://stackoverflow.com/q/21732407
has comment: http://stackoverflow.com/comment/32941198
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21756129
has body: I have problem with @PathVariable in SpringMVC controller. Whenever I pass string containing plus ('+'), plus gets replaced by space. Encoding the parameter doesn't help. So for example if I request url myapp/resend-validation/my+mail@gmail.com, I get "my mail@gmail.com" in my email variable. Same happens after requesting myapp/resend-validation/my%2Bmail@gmail.com My controller looks like this: @RequestMapping(value = "/resend-validation/{email:.+}") public String resendValidation(@PathVariable String email, HttpServletRequest request, Model model) { //controller code here } (the regular expresion in @RequestMapping's value is because of the dot in the email address, otherwise, value gets truncated after the dot. It doesn't affect my problem) Thanks in advance for any help.
favorite count: 0
has comment: http://stackoverflow.com/comment/32875152
has title: SpringMVC: @PathVariable value containing the plus (+) character
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32871841
has comment: http://stackoverflow.com/comment/32909423
upvote count: 9
has comment: http://stackoverflow.com/comment/32901289
accepted answer: http://stackoverflow.com/a/21756129
tagged with: java
score: 9
type: Question

http://stackoverflow.com/q/21699038
answer count: 2
tagged with: groovy
has comment: http://stackoverflow.com/comment/32807139
downvote count: 0
favorite count: 0
has title: How to configure pom.xml file- spring and hibernate
tagged with: spring
type: UnansweredQuestion
tagged with: maven
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32818725
has comment: http://stackoverflow.com/comment/32807070
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24765013
has body: This is my pom.xml file- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.albatrossoft wbpsc 1.0.0-SNAPSHOT war <war.file.name>wbpsc</war.file.name> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.source.version>1.6</java.source.version> <java.target.version>1.6</java.target.version> <commons-codec.version>1.7</commons-codec.version> <commons-dbcp.version>1.4</commons-dbcp.version> <commons-lang.version>3.1</commons-lang.version> <commons-pool.version>1.6</commons-pool.version> <commons-io.version>2.4</commons-io.version> <commons-httpclient.version>3.1</commons-httpclient.version> <javax-mail.version>1.4.5</javax-mail.version> <javax-jms.version>1.1</javax-jms.version> <postgresql.version>9.1-901.jdbc4</postgresql.version> <hsqldb.version>2.2.8</hsqldb.version> <spring.version>3.1.0.RELEASE</spring.version> <spring-data.version>1.2.0.RELEASE</spring-data.version> <spring-integration.version>2.2.0.RELEASE</spring-integration.version> <spring-security.version>3.1.3.RELEASE</spring-security.version> <junit.version>4.11</junit.version> <mockito.version>1.9.5</mockito.version> <hamcrest.version>1.3</hamcrest.version> <javax-servlet.version>2.5</javax-servlet.version> <jackson.version>1.9.2</jackson.version> <ehcache.version>4.1.7.Final</ehcache.version> <hibernate-core.version>4.1.7.Final</hibernate-core.version> <hibernate-validator.version>4.3.1.Final</hibernate-validator.version> <jersey.version>1.17</jersey.version> <freemarker.version>2.3.19</freemarker.version> <slf4j.version>1.7.1</slf4j.version> <perf4j.version>0.9.12</perf4j.version> <log4j.version>1.2.17</log4j.version> <jasypt.version>1.9.0</jasypt.version> <fop.version>1.0</fop.version> <lambdaj.version>2.3.2</lambdaj.version> <joda-time.version>2.1</joda-time.version> <quartz.version>1.8.6</quartz.version> <google.guava…
has answer: http://stackoverflow.com/a/56377466

http://stackoverflow.com/comment/32870396
comment on: http://stackoverflow.com/q/21734329
type: Comment
type: QuestionComment
score: 0
has text: @Smutje If you edit your main answer I'll accept it for visiblity.

http://stackoverflow.com/comment/34250969
type: Comment
has text: I have the same problem on CM 11. I'm developing in ADT v.22. Occurs when triggering 'Run' (Ctrl+F11), and if the app is in foreground.
comment on: http://stackoverflow.com/q/21836669
score: 0
type: QuestionComment

http://stackoverflow.com/q/21812289
tagged with: casting
downvote count: 0
favorite count: 0
tagged with: interface
has title: Casting an object to an interface which is not implemented
has answer: http://stackoverflow.com/a/21812423
type: UnansweredQuestion
has body: I found following question in my study book and a bit confused: Given the following code, which option, if used to replace /* INSERT CODE HERE */, will enable a reference variable of type Roamable to refer to an object of the Phone class? (Select 1 option.) interface Roamable{} class Phone {} class Tablet extends Phone implements Roamable { //INSERT CODE HERE } Options are: Roamable var = new Phone(); Roamable var = (Roamable)Phone(); Roamable var = (Roamable)new Phone(); Because interface Roamable and class Phone are unrelated, a reference variable of type Roamable can’t refer to an object of class Phone. I thought the correct option is 4, however it says it is 3. But, Phone doesn't implement Roamable interface, so you can't cast, can you?
has comment: http://stackoverflow.com/comment/33009038
upvote count: 9
tagged with: java
has answer: http://stackoverflow.com/a/21812334
has comment: http://stackoverflow.com/comment/33009272
score: 9
type: Question
answer count: 2

http://stackoverflow.com/q/21795514
linked to: http://stackoverflow.com/q/4801366
linked to: http://stackoverflow.com/q/1892020
tagged with: java
has body: Hi iam trying to do some program that allowed me to change my font color so if i have used a check box but the problem is the combination of the color . can i combine two colors to make it the color of my font ? Font font = new Font("Arial", Font.BOLD, 12); field.setFont(font); field.setForeground(Color.YELLOW);// can i do this Color.YELLOW+GREEN ?
has title: Font problems to change
linked to: http://stackoverflow.com/q/7708204
score: 0
tagged with: user-interface
answer count: 1
linked to: http://stackoverflow.com/q/4255973
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21795869
linked to: http://stackoverflow.com/q/726549
linked to: http://stackoverflow.com/q/9352124
linked to: http://stackoverflow.com/q/1618169
tagged with: fonts
type: Question

java-8
tags question: http://stackoverflow.com/q/21812623
tags question: http://stackoverflow.com/q/21697349
tags question: http://stackoverflow.com/q/21768229
tags question: http://stackoverflow.com/q/21758081
tags question: http://stackoverflow.com/q/21751253
tags question: http://stackoverflow.com/q/21786548
tags question: http://stackoverflow.com/q/21751830
tags question: http://stackoverflow.com/q/21782380
tags question: http://stackoverflow.com/q/21690568
tags question: http://stackoverflow.com/q/21833537
tag name: java-8
tags question: http://stackoverflow.com/q/21751954
tags question: http://stackoverflow.com/q/21776637
type: Tag

http://stackoverflow.com/comment/33026676
comment on: http://stackoverflow.com/a/21821973
type: AnswerComment
score: 0
has text: @Rahul The question didn't get downvoted (EDIT: by me). And while SO definitely helps to learn things it is not a collaborative learning environment.
type: Comment

http://stackoverflow.com/comment/33001127
comment on: http://stackoverflow.com/q/21807801
type: QuestionComment
type: Comment
score: 1
has text: `Class.forName(driverName);` need only be ran once. Put it in a `static` initializer block.

http://stackoverflow.com/a/21837954
has body: Stop using null layout and setBounds. While using null layout may seem to a newbie the better way to create complex GUI's, it's a fallacy, and more you create Swing GUI's the more you learn to respect and use the layout managers and see that these creatures help immensely in creating flexible, beautiful and if need be, complex GUI's. Then you can let them size them selves appropriately by calling pack() prior to setting them visible. Swap JPanels using a CardLayout. Tutorial link here. .... and what MadP has to say!
type: Answer
has comment: http://stackoverflow.com/comment/33054536
answers question: http://stackoverflow.com/q/21837899
upvote count: 4
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/33054602

http://stackoverflow.com/q/21743005
has title: .intersects always returning true?
has answer: http://stackoverflow.com/a/21764848
has body: I've been working on a game with a mix of awt and slick2d (Rendering is done via awt). Anyway, i'm having a problem with collision. Inside of entity class, I have a collision method: public boolean colidesWithWall(int idx, int idy) { //if(Level.solid) wall = new Rectangle(idx, idy, Tile.Size, Tile.Size); if (this.getBoundingBox() == null) { return false; } return this.getBoundingBox().intersects(wall); } Outside of this in my "Core.java" file, I have a for loop iterate the tiles through the colidesWithWall method. I also have an if statement in here so it will only check the tiles that are on the collision layer. (My map has four layers, Background, Collision, Items and Enemies). for (int i = 0; i &lt; entities.size(); i++) { Entity me = entities.get(i); for (int k = 0; k &lt; 100; k++) { for (int l = 0; l &lt; 100; l++) { if (Level.getColision(k, l)) { Entity entity = entities.get(i); if (entity.colidesWithWall(k, l)) { entity.collidedWithWall(); frameCounter = 0; } } } } } Well anyway, what happens is, the game always detects a collision going on. Also, the players X&amp;Y coordinates are defined by this: ((int) ((rouge.screenSize.width) / 2 - Tile.Size / 2 + rouge.oX)) / Tile.Size, ((int((rouge.screenSize.height) / 2 - Tile.Size / 2 + rouge.oY))/Tile.size rouge.oY and rouge.oX are my camera offsets Tile.Size is the size of my Tiles: 32 Here's a Screenshot of what happens: https://i.sstatic.net/BY6S7.png The grey tiles and the tree are supposed to be causing collision, where as the brown ones are not.
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: lwjgl
type: Question
tagged with: slick2d
answer count: 1

http://stackoverflow.com/comment/33016946
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21816717
type: Comment
has text: Thanks for the explanation :) will be accepted in 10 minutes.

tcp
type: Tag
tags question: http://stackoverflow.com/q/21822610
tags question: http://stackoverflow.com/q/21709750
tags question: http://stackoverflow.com/q/21795307
tag name: tcp

http://stackoverflow.com/comment/32832795
comment on: http://stackoverflow.com/q/21712543
has text: @SJuan76 thanks for your comment, I'll keep it in mind. In the past (2 years ago) I had to add a new functionality to an application which was entirely designed in this way. I had to modify at least 10 interfaces/classes to add a trivial feature. I hated the guy who made all those interfaces but now I'm in the same situation and I'm trying to avoid shooting myself in the foot.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21725748
linked to: http://stackoverflow.com/q/11721966
type: UnansweredQuestion
upvote count: 1
tagged with: tomcat7
has body: I have a situation here i have an application in jsf-2.1 which is deployed as http://localhost:8080/myWebApplication and in "META-INF" i have context.xml which has the following configuration &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Context antiJARLocking="true" path="/myWebApplication" /&gt; Now i want to shorten the name without loosing context => 'myWebApplication' like '/mwp' i tried to do the following but it did not work out as expected: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Context antiJARLocking="true" path="/myWebApplication" /&gt; &lt;Context antiJARLocking="true" path="/mwp" /&gt; Please advise if it is possible or is there any workaround to achieve this.
tagged with: java
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21726269
tagged with: contextpath
favorite count: 0
has comment: http://stackoverflow.com/comment/32893542
has title: Multiple context for java web application
score: 1
tagged with: deployment
has comment: http://stackoverflow.com/comment/32893969

http://stackoverflow.com/a/21835205
type: Answer
has body: I am not entirely familiar with the packages you are using but based on examples I've seen, it seems as though you are missing an inner class. Try updating the code as indicated below noting the DateEntry inner class at the very bottom: //Variables UnfoldingMap map; List&lt;Marker&gt;countryMarkers; HashMap&lt;String, DataEntry&gt; dataEntriesMap; //Core methods... void setup() { size(800, 600); smooth(); map = new UnfoldingMap(this); MapUtils.createDefaultEventDispatcher(this, map); //Read in GeoJSON File - Countries List&lt;Feature&gt; countries = GeoJSONReader.loadData(this, "countries.geo.json"); countryMarkers = MapUtils.createSimpleMarkers(countries); map.addMarkers(countryMarkers);//Add the countries to the map //External Data source - CSV file } void draw() { map.draw(); } public class DataEntry { String countryName; String id; Integer year; Float value; }
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33049308
accepted answer of: http://stackoverflow.com/q/21835043
answers question: http://stackoverflow.com/q/21835043
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/94501030
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/53826139
has text: add some explanation to the answer IN THE ANSWER
type: Comment

http://stackoverflow.com/q/21834212
has answer: http://stackoverflow.com/a/74920295
has comment: http://stackoverflow.com/comment/33047502
has body: I am trying to sort out a simple list of students mark with a simple java program however I am getting Exception in thread "main" java.lang.ClassCastException: Student cannot be cast to java.lang.Comparable public class Student { public String name; public int mark; public Student(String name, int mark){ this.name=name; this.mark=mark; } public int compareTo(Student o){ return this.mark-o.mark; } public String toString(){ String s = "Name: "+name+"\nMark: "+mark+"\n"; return s; } public static void main(String[] args) { Student Class[] = new Student[9]; Class[0] = new Student("Henry",100); Class[1] = new Student("Alex", 10); Class[2] = new Student("Danielle",100); Class[3] = new Student("Luke",10); Class[4] = new Student("Bob",59); Class[5] = new Student("Greg",76); Class[6] = new Student("Cass",43); Class[7] = new Student("Leg",12); Class[8] = new Student("Bobe",13); Arrays.sort(Class); for(int i = 0;i&lt;Class.length;i++){ System.out.println(Class[i]);
score: 0
answer count: 3
has title: Java CompareTO method issues
accepted answer: http://stackoverflow.com/a/21834239
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21834257
tagged with: java
has answer: http://stackoverflow.com/a/21834239
type: Question
possible better answer: http://stackoverflow.com/a/21834257

http://stackoverflow.com/q/21800518
linked to: http://stackoverflow.com/q/2353141
has comment: http://stackoverflow.com/comment/32987766
has title: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21805470
score: 0
tagged with: classnotfoundexception
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/33033248
has body: Can any one rescue my project please! I'm writing my first real/assignment - project in JSP, that is I lack experience in JSP but with basic knowledge of the language. I do suspect the error arises from the 'J Connector' bcoz it lacks the .jar extension or the problem is with the CLASSPATH or PATH or FILE PATH. I have created 'form.jsp' & 'login.jsp page' & 'registration.jsp page'. On testing I receive the message below: `HTTP Status 500 - An exception occurred processing JSP page /login.jsp at line 6 type Exception report message An exception occurred processing JSP page /login.jsp at line 6 description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 6 3: <% 4: String userid = request.getParameter("uname"); 5: String pwd = request.getParameter("pass"); 6: Class.forName("com.mysql.jdbc.Driver"); 7: Connection con = DriverManager.getConnection 8: ("jdbc:mysql://localhost:3306/REG", 9: "root", "password"); Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) root cause javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841) org.apache.jsp.login_jsp._jspService(login_jsp.java:93) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.…
tagged with: jdbc
duplicate of: http://stackoverflow.com/q/2353141
type: UnansweredQuestion

http://stackoverflow.com/comment/32783683
type: Comment
has text: Your answer is most helpful, and I do think Joda Time looks appealing. Could you perhaps show me, in your answer, how I would go about using it in my method? If I sound picky, it is not my intent. Your answer is really useful!
comment on: http://stackoverflow.com/a/21685777
score: 0
type: AnswerComment

http://stackoverflow.com/q/21703242
type: Question
score: 2
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
tagged with: asynchronous
has title: How can I test for the result of some asynchronous process?
upvote count: 2
has body: I'm testing a component which wraps a Quartz Scheduler object. My problem is that Quartz is doing some asynchronous processing internally and I can't write in my test code something like this: Mockito.when(configurationMock.getId()).thenReturn(CONFIG_ID); target.addJob(configurationMock); Scheduler sched = (Scheduler) Whitebox.getInternalState(target, "scheduler"); assertTrue(sched.checkExists(new JobKey(configurationMock.getId()))); because it is possible that when I check the job's existence it is not there yet. I checked the JUnit API but there is no assertWithTimeout() or something like that. Did I miss something?
type: AnsweredQuestion
tagged with: testing
has answer: http://stackoverflow.com/a/21703438
tagged with: java
accepted answer: http://stackoverflow.com/a/21703438

date
tags question: http://stackoverflow.com/q/21825358
tags question: http://stackoverflow.com/q/21678799
tags question: http://stackoverflow.com/q/21705366
tags question: http://stackoverflow.com/q/21737163
tag name: date
tags question: http://stackoverflow.com/q/21832728
tags question: http://stackoverflow.com/q/21797897
tags question: http://stackoverflow.com/q/21826613
tags question: http://stackoverflow.com/q/21719208
tags question: http://stackoverflow.com/q/21691345
tags question: http://stackoverflow.com/q/21762056
tags question: http://stackoverflow.com/q/21810891
tags question: http://stackoverflow.com/q/21835981
tags question: http://stackoverflow.com/q/21777708
tags question: http://stackoverflow.com/q/21818835
tags question: http://stackoverflow.com/q/21796497
tags question: http://stackoverflow.com/q/21782785
type: Tag
tags question: http://stackoverflow.com/q/21829477
tags question: http://stackoverflow.com/q/21756505
tags question: http://stackoverflow.com/q/21695689
tags question: http://stackoverflow.com/q/21721197
tags question: http://stackoverflow.com/q/21791293
tags question: http://stackoverflow.com/q/21685591
tags question: http://stackoverflow.com/q/21687672
tags question: http://stackoverflow.com/q/21711030
tags question: http://stackoverflow.com/q/21679148
tags question: http://stackoverflow.com/q/21778657
tags question: http://stackoverflow.com/q/21682448

http://stackoverflow.com/q/21836366
tagged with: onclicklistener
downvote count: 0
tagged with: android-fragments
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33051500
possible better answer: http://stackoverflow.com/a/21836421
has answer: http://stackoverflow.com/a/21836421
upvote count: 2
has body: I've been asked to open a new question. I have a sliding menu showing fragments. On one of those fragments is a set of buttons which play audio when pressed. The OnClickListener for the buttons is causing NullPointer errors in logcat and is crashing the application. Can anyone tell me why? The buttons are being referenced through the correct xml relating to the fragment so I'm unsure what's causing the error. These lines are causing the problem. button1.setOnClickListener(this); button2.setOnClickListener(this); SoundsFragment.java which has the buttons and code hosted on it. import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.app.Activity; import android.media.AudioManager; import android.media.MediaPlayer; import android.view.Menu; import android.view.View.OnClickListener; import android.widget.Button; public class SoundsFragment extends Fragment implements OnClickListener{ public SoundsFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_sounds, container, false); return rootView; } private MediaPlayer mp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_sounds); setVolumeControlStream(AudioManager.STREAM_MUSIC); Button button1=(Button)findViewById(R.id.button_1); Button button2=(Button)findViewById(R.id.button_2); button1.setOnClickListener(this); button2.setOnClickListener(this); } private Button findViewById(int button1) { // TODO Auto-generated method stub return null; } private void setVolumeControlStream(int streamMusic) { // TODO Auto-generated method stub } private void setContentView(int activityMain) { // TODO Auto-generated method stub } public void onClick(View v) { int resId; switch (v.getId()) { case R.id.button_1: resId = R.raw.a; break; case…
has answer: http://stackoverflow.com/a/21836391
answer count: 3
accepted answer: http://stackoverflow.com/a/21836391
has title: button1.setOnClickListener(this); Causing NullPointer
favorite count: 0
has answer: http://stackoverflow.com/a/21836466
tagged with: android
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/21695963
score: 0
answer count: 0
type: UnansweredQuestion
has title: jsp how to set the selected value?
type: Question
has comment: http://stackoverflow.com/comment/32802085
has body: I want to set the selected value of a select element from server side, but not getting idea how can I set the value, here is my code. java code model.addAttribute("dataSources", dataSourceRepository.findByDestinationId(sDestination.getId())); jsp code: &lt;form:select onchange="refreshHistoryPage()" path="id" items="${dataSources}" itemLabel="name" itemValue="id"/&gt;
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/9616065
tagged with: java
has comment: http://stackoverflow.com/comment/32801896
tagged with: jsp

http://stackoverflow.com/a/21726093
downvote count: 0
type: AcceptedAnswer
score: 1
accepted answer of: http://stackoverflow.com/q/21723860
answers question: http://stackoverflow.com/q/21723860
type: Answer
upvote count: 1
has body: You can use the AdvancedSearch on http://search.maven.org/ For a class name like ApplicationContext, you'll get many results, so you might want to limit your query by groupId. For example, you could search for: g:org.springframework c:ApplicationContext

http://stackoverflow.com/comment/32973978
score: 0
type: Comment
has text: Thanks Marco13. I will have to read up on that. Hopefully it is not terribly complicated. If it will allow me to have more freedom to draw in different threads then it might be worth the effort. At least now I have something to go on.
comment on: http://stackoverflow.com/a/21792001
type: AnswerComment

http://stackoverflow.com/comment/33010372
has text: `val` is a method parameter that in this case holds the Boolean visibility value of widgets. This question indicates you need to go back and learn more about basic Java programming before Swing programming will make much sense. Your starting code was typical of folks who are trying to cut-and-paste from Internet examples to get to a working solution. Nothing wrong with cut-and-paste, but the basic language understanding must be there before it will work.
comment on: http://stackoverflow.com/a/21806929
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21803017
type: Answer
has body: Call repaint in the ActionListener public void actionPerformed(ActionEvent e) { //Execute when button is pressed fixtureList(); System.out.println("Loading the fixtures screen"); repaint(); }
accepted answer of: http://stackoverflow.com/q/21802840
score: 0
answers question: http://stackoverflow.com/q/21802840
type: AcceptedAnswer

http://stackoverflow.com/comment/33050253
type: Comment
has text: More significant than Magma's higher precision was it's higher accuracy.
comment on: http://stackoverflow.com/a/21835457
score: 0
type: AnswerComment

http://stackoverflow.com/a/21742241
downvote count: 0
has comment: http://stackoverflow.com/comment/32929495
answers question: http://stackoverflow.com/q/21739139
has comment: http://stackoverflow.com/comment/32963649
has comment: http://stackoverflow.com/comment/32932379
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32885126
has body: The command line smbarbour used to run the application includes a jfxrt.jar location of: /usr/lib/jvm/java-7-oracle/jre/lib/jfxrt.jar As mentioned in EulerGeek's answer to Compile code using JavaFX 2.0 (using command line), on OS X, this location needs to be: java -cp ".:/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre/lib/jfxrt.jar" &lt;app class&gt; Replace jdk1.7.0_09.jdk with whatever version of java is installed on the machine, or require Java 8 when it is released (which does not require jfxrt.jar to be manually added to the classpath). Deployment Recommendation If you are deploying applications to users, even with Java 8, it is recommended that you package applications using relevant packaging tools (e.g. JavaFX ant tasks, javafxpackager, javafx-maven-plugin or javafx-gradle-plugin).

http://stackoverflow.com/a/35753293
downvote count: 1
has comment: http://stackoverflow.com/comment/59180825
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/21771566
score: -1
has body: public class WordFrequencyProblem { public static void main(String args[]){ String s="the quick brown fox jumps fox fox over the lazy dog brown"; String alreadyProcessedWords=""; boolean isCount=false; String[] splitWord = s.split("\\s|\\."); for(int i=0;i&lt;splitWord.length;i++){ String word = splitWord[i]; int count = 0; isCount=false; if(!alreadyProcessedWords.contains(word)){ for(int j=0;j&lt;splitWord.length;j++){ if(word.equals(splitWord[j])){ count++; isCount = true; alreadyProcessedWords=alreadyProcessedWords+word+" "; } } } if(isCount) System.out.println(word +"Present "+ count); } } }

http://stackoverflow.com/q/21743823
favorite count: 0
tagged with: cdi
has answer: http://stackoverflow.com/a/21749132
accepted answer: http://stackoverflow.com/a/21749132
tagged with: weld
upvote count: 4
has title: CDI Injecting services into JPA managed Entities
has comment: http://stackoverflow.com/comment/32887462
has comment: http://stackoverflow.com/comment/32893038
type: AnsweredQuestion
downvote count: 0
has body: I'm sure this is strongly related to this question but the op on that question has a bit of a scenario that I'm not sure even makes sense for DI. So here's what I understand, it's generally not a good idea to try to mix a JPA Entity with a CDI Bean because both are generally done by creating proxy objects. Here's what I envisioned, but from what I've read this is not possible. @Entity public class MyUniqueObject implements Serializable { @Inject private transient Logger log; @Inject private transient Event&lt;MyUniqueObjectEvent&gt; events; @Id private long id; @NotNull private String text; public void setText( final String text ) { log.debug( "updating text {}", this ); this.text = text; events.fire( new MyUniqueObjectEvent( this ) ); // consumed by an @Observes method } } What's the best way to do what I'm trying to accomplish? which is fundamentally things like events firing from within JPA persisted entities, access to log objects. Code examples helpful.
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32893791
linked to: http://stackoverflow.com/q/8512628
has comment: http://stackoverflow.com/comment/32888075
type: Question
has comment: http://stackoverflow.com/comment/32888057
tagged with: jpa
has comment: http://stackoverflow.com/comment/32887695
score: 4
answer count: 1
has comment: http://stackoverflow.com/comment/32892732

platform-independent
tags question: http://stackoverflow.com/q/21829295
tag name: platform-independent
type: Tag

http://stackoverflow.com/q/21795451
upvote count: 4
tagged with: sqlite
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32981753
type: Question
tagged with: jdbc
score: 4
has comment: http://stackoverflow.com/comment/32979016
has title: How to make a portable app (jar+sqlite) in Java?
answer count: 1
has body: I made a tiny Java app (yes, tiny, 2 forms and a SQLite database) with Eclipse. It works when I run it in Eclipse. I'll try to export it, and to make it a portable app (and put in an usb-key), but nothing works. Here's my code to connect database: DriverManager.getConnection("jdbc:sqlite:"+this.dbName); DatabaseSQLite ConnBDD = new DatabaseSQLite("BDD/bdd.sqlite") What must I change? Here's my schema under Eclipse [projects] src |-class lib |-sqlite-jdbc-3.7.2.jar BDD |-database.sqlite
tagged with: java
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/21795668

http://stackoverflow.com/comment/33762691
has text: probably your app dosent rely on the windows fetched tickets at all and by some means getting its own ticket. Can you tell me what the app is? It might be programatically getting it. I wrote some software which does that so its worth a shot investigating.
type: Comment
comment on: http://stackoverflow.com/q/21705205
score: 0
type: QuestionComment

http://stackoverflow.com/a/21793707
accepted answer of: http://stackoverflow.com/q/21793628
upvote count: 2
has body: I'm running your code and it works fine. What I did Created New -> JavaFx Main Class -> AdStudent -> Copy/Pasted your code Right click on Project -> Properties -> Run -> Browse Application Class -> Select class addstudent.AddStudent Clean and Build Run Project I have a feeling the first 2 are fine for you. You may just need to Clean and Build.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21793628
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32976052

http://stackoverflow.com/comment/32882651
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21741171
has text: Yep, agree with @Warlord: you want to increase cohesion and reduce coupling.

http://stackoverflow.com/a/21719463
score: 0
has body: I think you need another servlet with a url mapping to "/*" to do the redirection in your situation
type: Answer
answers question: http://stackoverflow.com/q/21717670

http://stackoverflow.com/q/21684419
has comment: http://stackoverflow.com/comment/32788030
downvote count: 0
has comment: http://stackoverflow.com/comment/32787931
favorite count: 0
tagged with: jarsigner
type: UnansweredQuestion
has title: Verify and Sign a Jar programmatically
has comment: http://stackoverflow.com/comment/32812943
has comment: http://stackoverflow.com/comment/32786789
has body: I am new to this topic, therefore I hope I use the right vocabulary. Is it possible to get the possibility of Jarsigner within Java self? I need the possibility to do the following things programatically: verify if a jar is signed with a certain private key from a keystore if the jar is verified: unsign the jar sign the jar with another private key from an official certificate authority, which is in the same or in another keystore In pseudo-code I imagine something like this: JarVerifier verifier = new JarVerifier(/*all needed parameters like the location of the keystore*/); verifier.verify(jarFile); //returns a value which indicates the result (an Enum or an integer value) Signing the jar should work in a similar way: JarSigner signer = new JarSigner(/*all needed parameters like the location of the keystore, passwords, alias*/); signer.sign(jarFile); I know that this is a duplicate of many other questions, but I am not happy with their answers. The solution of these answers is in most cases a self-written class, a modification of a class found from OpenJDK or a hint that the code needs still to be written and how this can be done. This is not acceptable for me, because they are not maintained (or I have to write and maintain the classes myself), I know nothing about their correctness (especially if I have to write the code myself) and license issues. What I don't get is that there seems to be no easy solution provided by Oracle, especially as it is such a critical topic, where an error might lead to an insecure system.
tagged with: java
tagged with: signing
has comment: http://stackoverflow.com/comment/32788373
type: Question
score: 5
upvote count: 5
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/22179077
has comment: http://stackoverflow.com/comment/32786454

http://stackoverflow.com/q/21807900
tagged with: java
has comment: http://stackoverflow.com/comment/33001701
type: Question
has answer: http://stackoverflow.com/a/21808084
score: 0
answer count: 1
has title: How do I add code to print "Success" or "Failure" based on return values from a move in navigating the maze?
type: UnansweredQuestion
has body: public class P4 { public static void main( String[ ] args ){ // Create maze String fileName = args[0]; Maze maze = new Maze(fileName); System.out.println("Maze name: " + fileName); // Get dimensions int mazeWidth = maze.getWidth(); int mazeHeight = maze.getHeight(); System.out.println("Maze width: " + mazeWidth); System.out.println("Maze height: " + mazeHeight); I asked this question earlier, but I do not think I added enough detail. The exact instructions for this part of the project are: Add code to print "Success" or "Failure" based on the return value from each move. The maze object also has a method called maze.isDone() that returns a boolean. The boolean is true when the student has found the Java icon, otherwise it is false. Add enough calls to maze.moveRight() to make the student find the Java icon. Add a call maze.isDone() before and after the last move, and print the result. I entered an "if (true)" statement and then had it print out the word "Success", but I do not think that is correct because it is not printing "Failure" if a move is not legal in the maze (ie. entering a move that would move out of the boundaries of the maze). So when I enter "maze.moveRight(); to move the little person in the maze, it prints "Success", but it prints it after all of my moves, like if I input "maze.moveRight(); and then "maze.moveLeft();" it prints "success" after both moves rather than after each, how do I get it to print after each? Also, it prints the word "Success" the line after it states what row the character moved to, like Moved to row 0, column 1 Moved to row 0, column 0 Success how do I get it to print something like "Moved to row 0, column 0: Success"? I appreciate all the help, you do not have to give me answers because I want to understand this, so helpful tips would be more appreciated. Thank you!

http://stackoverflow.com/q/21724072
upvote count: 12
has answer: http://stackoverflow.com/a/21726730
has answer: http://stackoverflow.com/a/21724149
has answer: http://stackoverflow.com/a/57720122
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32858286
type: Question
has comment: http://stackoverflow.com/comment/32851804
tagged with: object
has body: Can someone please tell me how many objects will be created on executing the System.out.println statement in the below code int i=0; int j=1; System.out.print("i value is "+ i + "j value is "+j);
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/21724148
has answer: http://stackoverflow.com/a/21725978
has answer: http://stackoverflow.com/a/41033276
has answer: http://stackoverflow.com/a/21724125
downvote count: 2
tagged with: string
has answer: http://stackoverflow.com/a/21724742
favorite count: 0
has comment: http://stackoverflow.com/comment/32862023
has title: Number of objects created during string concatenation
has answer: http://stackoverflow.com/a/21724184
has answer: http://stackoverflow.com/a/21724118
has comment: http://stackoverflow.com/comment/32851409
answer count: 10

http://stackoverflow.com/a/21835895
accepted answer of: http://stackoverflow.com/q/21835824
answers question: http://stackoverflow.com/q/21835824
has comment: http://stackoverflow.com/comment/33050778
has comment: http://stackoverflow.com/comment/33050879
score: 0
type: AcceptedAnswer
type: Answer
has body: array size variables should be of type int only.Other are not allowed. In your code rowSize,columnSize should be of type int.

http://stackoverflow.com/a/21774446
answers question: http://stackoverflow.com/q/21773926
score: 2
has body: Additional to the above findings, Even you can use LinkedHashMap as given below,LinkedHashMap will make sure values stored in the order of insertion. public static void main(String[] args) { Map&lt;Integer, String&gt; map = new LinkedHashMap&lt;Integer, String&gt;(); Map&lt;Integer, String&gt; map2 = new HashMap&lt;Integer, String&gt;(); map.put(1, "oneone"); map.put(3, "twoone"); map.put(2, "threeone"); map2.put(1, "oneone"); map2.put(3, "twoone"); map2.put(2, "threeone"); for(Entry&lt;Integer, String&gt; entry:map.entrySet()){ System.out.println(entry.getKey()); } for(Entry&lt;Integer, String&gt; entry:map2.entrySet()){ System.out.println(entry.getKey()); } } Here result will be, 1 3 2 1 2 3
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/a/21828843
score: 0
answers question: http://stackoverflow.com/q/21828466
type: Answer
has body: This is also working :-) package com.test; import java.util.LinkedList; import java.util.List; public class NumbersFollowedByAlphabet { public static void main(String[] args) { String s = "5N7BS is having a number 33 and 55c"; char [] ch = s.toCharArray(); int consecutive = 0; List&lt;String&gt; list = new LinkedList&lt;String&gt;(); String consecutiveNumber = ""; for(char c : ch) { if(Character.isDigit(c)) { consecutive++; consecutiveNumber += c; } else if(c == ' ' || Character.isLetter(c)) { if(consecutive &gt;= 2 &amp;&amp; c != ' ') { list.add(consecutiveNumber); } consecutive = 0; consecutiveNumber = ""; } } System.out.println(list); } }

http://stackoverflow.com/comment/33009213
has text: would you mind to post some code to illustrate what you're looking for?
score: 0
comment on: http://stackoverflow.com/q/21812352
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33009530
type: Comment
has text: It is not a "static loop", but a static block which just happens to contain a loop.
comment on: http://stackoverflow.com/q/21812544
score: 0
type: QuestionComment

http://stackoverflow.com/a/21759391
answers question: http://stackoverflow.com/q/21758112
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21758112
score: 2
has body: Open the "Run Configurations" editor. There is a category "Maven Build". Create a new configuration in there. That will give you a JRE tab on the right side of the dialog. Select whatever JRE you want in there. You can save this launch config in the project using the "Share file" option in the tab "Common". You may also want to check the Maven enforcer plugin, especially requireJavaVersion. That allows you to add checks to the build that fail when the wrong JRE is used.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32954058

http://stackoverflow.com/q/21838945
tagged with: itext
type: Question
has answer: http://stackoverflow.com/a/21846547
answer count: 2
score: 2
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
has title: finding out required fields to fill in pdf file
has body: I'm starting with new functionality in my android application which will help to fill certain PDF forms. I find out that the best solution will be to use iText library. I can read file, and read AcroFields from document but is there any possibility to find out that specific field is marked as required? I tried to find this option in API documentation and on Internet but there were nothing which can help to solve this issue.
upvote count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/47597963
accepted answer: http://stackoverflow.com/a/21846547
has answer: http://stackoverflow.com/a/47597963
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21698514
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21699007
has comment: http://stackoverflow.com/comment/32806281
score: 0
has body: Am getting following error in AndroidManifest.xml The markup in the document following the root element must be well-formed. And my xml is : <?xml version="1.0" encoding="utf-8"?> <<<<<<< Original <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> ======= >>>>>>> Added
has answer: http://stackoverflow.com/a/21700709
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27606072
tagged with: android
has answer: http://stackoverflow.com/a/21698660
tagged with: java
has comment: http://stackoverflow.com/comment/32806110
has title: ERROR ! in Android - java developer - The markup in the document following the root element must be well-formed

http://stackoverflow.com/comment/32922489
type: Comment
has text: That's not the problem. Seems like OP gets the connection through `DriverManager.getConnection(url1, user, password);` thus not need to open the connections manually =\
comment on: http://stackoverflow.com/a/21763850
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32916874
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21759499
has text: Implementing serialized writing might remove any benefit you have from multiple consumers as most of the delay will be in the database.
score: 1

http://stackoverflow.com/a/21689265
has comment: http://stackoverflow.com/comment/32875140
has body: Looks like you've got the right idea. It doesn't matter how many Runnables you've handed over to the ExecutorService to run or how big a thread pool you've allocated, you only need to call shutdown() once. That will allow all tasks to complete but will not allow you to add any new ones. You may want to call try { executorService.awaitTermination(5, TimeUnit.MINUTES); } catch (InterruptedException e) { // do stuff } to block while all tasks are completed depending on your usage scenario. If you want to shutdown and attempt to kill all running tasks, instead call the shutdownNow() method. Note that there is no guarantee that it will be able to interrupt running tasks.
has comment: http://stackoverflow.com/comment/32817998
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21689174
has comment: http://stackoverflow.com/comment/32790561
answers question: http://stackoverflow.com/q/21689174

http://stackoverflow.com/comment/32923720
comment on: http://stackoverflow.com/q/21764299
has text: Do keep in mind that if you compare "binary" (non-text) files with this algorithm there may be no newline characters in the files and you may end up reading the entire file into heap before even beginning the actual compare.
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32940809
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21773916
has text: AWS S3 could be an alternative but do you find difference in performance while I serve it via app engine blobstore api and amazon S3. Price on both are comaparable to me.

http://stackoverflow.com/comment/32905513
score: 0
type: Comment
has text: There is no such thing as "2D arrays" in Java. Those are just arrays whose elements are themselves arrays.
type: QuestionComment
comment on: http://stackoverflow.com/q/21754540

http://stackoverflow.com/a/21801288
upvote count: 2
has comment: http://stackoverflow.com/comment/32989320
answers question: http://stackoverflow.com/q/21801203
has comment: http://stackoverflow.com/comment/32989535
has comment: http://stackoverflow.com/comment/32989377
downvote count: 0
has comment: http://stackoverflow.com/comment/32989821
has comment: http://stackoverflow.com/comment/32989445
has comment: http://stackoverflow.com/comment/32989658
type: Answer
has comment: http://stackoverflow.com/comment/32989234
has body: you can define the map as follows: Map&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;(); And check if it contains a non-zero value as follows : for ( Integer value: map.values()) { if ( value != 0) { // non-zero value found in the map } }
score: 2

http://stackoverflow.com/q/21768496
answer count: 3
linked to: http://stackoverflow.com/q/157944
has comment: http://stackoverflow.com/comment/32931258
has answer: http://stackoverflow.com/a/21768539
accepted answer: http://stackoverflow.com/a/21768744
has comment: http://stackoverflow.com/comment/32931344
tagged with: input
possible better answer: http://stackoverflow.com/a/21768539
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21768627
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32931269
has answer: http://stackoverflow.com/a/21768744
has title: Arrays with user input
tagged with: arrays
has body: I am trying to write a program that repeatedly asks the user to supply scores (out of 10) on a test.It needs to continue until a negative value is supplied. Values higher than 10 should be ignored. I also calculated the average of the inputs. After the scores have been inputted, i need to use a single array to produce a table that automatically fills the test scores and the number of occurrences of the certain test score. I wanted it to look something like this: Score | # of Occurrences 0 3 1 2 2 4 3 5 4 6 and so on.. P I am a beginner and this is my first question, so i am sorry if i made a mistake in posting the question or something. import java.io.*; import java.util.*; public class Tester1 { public static void main() { Scanner kbReader= new Scanner (System.in); int score[] = new int [10];//idk what im doing with these two arrays int numofOcc []= new int [10]; int counter=0; int sum=0; for (int i=0;i&lt;10;i++)// Instead of i&lt;10... how would i make it so that it continues until a negative value is entered. { System.out.println("Enter score out of 10"); int input=kbReader.nextInt(); if (input&gt;10) { System.out.println("Score must be out of 10"); } else if (input&lt;0) { System.out.println("Score must be out of 10"); break; } else { counter++; sum+=input; } } System.out.println("The mean score is " +(sum/counter)); } }
has comment: http://stackoverflow.com/comment/32931543
score: 0

http://stackoverflow.com/comment/32870267
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21734508
has text: @Vivin, If I know which class to use to access the remote path ,then I would have not asked any question mostly.
score: 0

http://stackoverflow.com/a/21749713
answers question: http://stackoverflow.com/q/21745711
has comment: http://stackoverflow.com/comment/32899073
score: 4
has body: Right click on your "Application" class, you should be able to run/debug it. Select "Debug", of course :-) To set a breakpoint, just click on the left of line you are interested in, it should display a red dot. When this code is executed, you should enter debug mode!
type: Answer
has comment: http://stackoverflow.com/comment/56366097
downvote count: 1
upvote count: 5

http://stackoverflow.com/q/21731268
tagged with: java
tagged with: eclipse
upvote count: 4
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21732135
has comment: http://stackoverflow.com/comment/32865062
score: 4
has comment: http://stackoverflow.com/comment/32865720
favorite count: 0
has comment: http://stackoverflow.com/comment/32864634
tagged with: decompiler
has body: I'm currently trying to debug an issue with our web application - I can see an error message in the logs but I can't tell where it originates, though I suspect it's coming from one of the classes provided by the closed-source ecommerce platform we use. I have the JD-Eclipse decompiler - is there some way I can search for a piece of text contained in one of the compiled classes through Eclipse?
has title: Search for text inside decompiled classes using JD and Eclipse
has answer: http://stackoverflow.com/a/21732135
has comment: http://stackoverflow.com/comment/32865666
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/21826695
has comment: http://stackoverflow.com/comment/33034635
has comment: http://stackoverflow.com/comment/33034484
has comment: http://stackoverflow.com/comment/33034878
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21826996
tagged with: java
has answer: http://stackoverflow.com/a/21826779
upvote count: 1
has body: I need for my app this int[] format as I wrote in the title. I'm fetching the value out of a HashMap which is filled out of an XML file with this format [00, 00, 00, 00], but I need it for every int with 0xin front. I tried to "convert" it via a for-loop: for(int i = 0; i &lt; value.length; i++){ value[i] = "0x" + value[i]; } but I cant convert from String to int this way. Then I tried to change it directly in the XML file, but then my app crashes with an NPE. Now I want to know if there is a solution to my problem. EDIT: For further explanation: I tried this before, but it did not work: public int[] getValue(Map map, String key) { Map keyMap = map; int[] value = {}; @SuppressWarnings("rawtypes") Iterator iter = keyMap.entrySet().iterator(); while (iter.hasNext()) { @SuppressWarnings("rawtypes") Map.Entry mEntry = (Map.Entry) iter.next(); if (mEntry.getKey().equals(key)) { value = (int[]) mEntry.getValue(); } } return value; } Then I tried one of the answers and added for(int i = 0; i &lt; value.length; i++){ value[i] = Integer.valueOf(String.valueOf(value[i]), 16); } before the return. Now it works... but I dont know why it works :(
downvote count: 1
has comment: http://stackoverflow.com/comment/33048746
type: Question
has comment: http://stackoverflow.com/comment/33034537
has comment: http://stackoverflow.com/comment/33034377
possible better answer: http://stackoverflow.com/a/21826779
tagged with: arrays
has title: Converting Integer To Hex Java
has comment: http://stackoverflow.com/comment/33068704
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33034591
has answer: http://stackoverflow.com/a/21826996
favorite count: 0
has comment: http://stackoverflow.com/comment/33034619
has comment: http://stackoverflow.com/comment/33034697
tagged with: android

http://stackoverflow.com/a/21683147
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21683031
type: Answer
has comment: http://stackoverflow.com/comment/32779086
has body: Although a failure cannot happen without throwing an exception, a command can complete with the effect that does not match your expectations, but without actually failing. For example, if you issue a command to update a row, but the ID that you have specified for the update does not exist in the table, the command will technically succeed, but from your point of view the update would fail, because no rows were changed: PreparedStatement upd = con.prepareStatement( "UPDATE mytable SET complete=1 WHERE id=?" ); upd.setInt(1, 12345); // If 12345 does not exist... upd.executeUpdate(); // ...this update does not change anything To detect situations like that you can check how many rows a command has updated, and do something when the number of updates is zero: int changed = upd.executeUpdate(); if (changed != 1) { // Something didn't go according to our expectations }
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21683031
score: 5

http://stackoverflow.com/a/21824548
answers question: http://stackoverflow.com/q/21824402
downvote count: 0
upvote count: 19
type: Answer
score: 19
has body: Technically speaking, you can only extend one class at a time and implement multiple interfaces, but when laying hands on software engineering, I would rather suggest a problem specific solution not generally answerable. By the way, it is good OO practice, not to extend concrete classes/only extend abstract classes to prevent unwanted inheritance behavior - there is no such thing as an "animal" and no use of an animal object but only concrete animals.

http://stackoverflow.com/comment/32933708
score: 0
type: AnswerComment
has text: **public static class C implements A**. and **public static class D implements B**. Does that change your answer
type: Comment
comment on: http://stackoverflow.com/a/21769758

http://stackoverflow.com/comment/32963963
score: 1
comment on: http://stackoverflow.com/q/21787198
has text: these ones:~/Desktop/Master_Bioinformatik/Data_Mining_in Bioinformatics/Project/stockori/joint.csv 2 3.2 euclidean
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21716830
downvote count: 1
tagged with: string
duplicate of: http://stackoverflow.com/q/11544966
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11544966
has body: I am supposed to write a code that reads a sentence from the user and prints the characters of the words in the sentence backwards. It should include a helper method that takes a String as a parameter and returns a new String with the characters reversed. The individual words are reversed, for example the sentence "Hi dog cat". would print "iH god tac". I can make the entire sentence reverse but i cant figure out how to reverse individual words. Thanks! Also, i know how to return the String once i have found it, but i just cant get the right string import java.util.Scanner; import java.util.Stack; public class ReverseStack { public static void main(String[] args) { String sentence; System.out.println("Enter a sentence: "); Scanner scan = new Scanner(System.in); sentence = scan.nextLine(); String k = PrintStack(sentence); } private static String PrintStack(String sentence) { String reverse; String stringReversed = ""; Stack&lt;String&gt; stack= new Stack&lt;String&gt;(); sentence.split(" "); for(int i=0;i&lt;sentence.length(); i++) { stack.push(sentence.substring(i, i+1)); } while(!stack.isEmpty()) { stringReversed += stack.pop(); } System.out.println("Reverse is: " + stringReversed); return reverse; } }
has answer: http://stackoverflow.com/a/21717049
has answer: http://stackoverflow.com/a/21717454
upvote count: 0
tagged with: stack
tagged with: java
has title: Java Using a stack to reverse the words in a sentence
type: Question
has answer: http://stackoverflow.com/a/21716936
has comment: http://stackoverflow.com/comment/32839544
score: -1
answer count: 3
linked to: http://stackoverflow.com/q/196830

http://stackoverflow.com/comment/32787532
has text: Make sure you commit after you delete everything in the table. If the table was empty, the query wouldn't return anything. You could print the result list (or examine its content using your debugger) to have more details. Also, see https://gist.github.com/jnizet/8924228 for a more readable (and efficient, and correct) version of your code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21687646
score: 1

http://stackoverflow.com/q/21693987
tagged with: c++
has comment: http://stackoverflow.com/comment/32798431
has comment: http://stackoverflow.com/comment/32798559
has comment: http://stackoverflow.com/comment/32798276
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32798397
has comment: http://stackoverflow.com/comment/32799202
linked to: http://stackoverflow.com/q/4176328
linked to: http://stackoverflow.com/q/11311140
has comment: http://stackoverflow.com/comment/32798415
tagged with: java
has body: I ran below program in C++(Dec-c++) : int k = 5; k = k++; cout&lt;&lt;"Value of K :"&lt;&lt;k&lt;&lt;endl; int l = 5; l = l++ + l++; cout&lt;&lt;"Value of L :"&lt;&lt;l&lt;&lt;endl; int m = 5; m = m++ + m++ + m++; cout&lt;&lt;"Value of M :"&lt;&lt;m&lt;&lt;endl; and got 5,12 and 18 for variables k,l and m.. But same program when I ran in java -- int k = 5; k = k++; System.out.println("Value of K :"+k); int l = 5; l = l++ + l++; System.out.println("Value of L :"+l); int m = 5; m = m++ + m++ + m++; System.out.println("Value of M :"+m); I got 5,11 and 18 for variables k,L and M.. Explain why there is difference in calculations of unary post operators ? I am aware of operator's precedence and priority rules. But every thing fails here. But answer from c++ seems rational according to rules. Confused how java is calculating ? It's well known C++ and Java are different. Please Suggest how operator-precedence and operator-priority is handled in Java.
has answer: http://stackoverflow.com/a/21694263
has comment: http://stackoverflow.com/comment/32798422
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/32799160
has title: Why do Unary Post Operators behave differently in C++ and Java?
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32798381
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/32798867
has comment: http://stackoverflow.com/comment/32799158
has comment: http://stackoverflow.com/comment/32798480
has comment: http://stackoverflow.com/comment/32798341

http://stackoverflow.com/comment/32946882
score: 0
has text: @PostConstruct public void loadContent() { user = kwet.findByName(gebruiker); name = user.getName();
type: QuestionComment
comment on: http://stackoverflow.com/q/21776828
type: Comment

http://stackoverflow.com/a/21710728
has comment: http://stackoverflow.com/comment/32829850
score: 2
accepted answer of: http://stackoverflow.com/q/21710655
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21710655
type: Answer
has comment: http://stackoverflow.com/comment/32828447
upvote count: 2
has body: You could decompile the jar files with JAD (http://varaneckas.com/jad/), import the project into Eclipse and debug from there (see http://www.vogella.com/tutorials/EclipseDebugging/article.html). Is this what you are looking for?

http://stackoverflow.com/q/21756509
has body: So I have this file in which the apostrophe and double quotes are not getting displayed properly. I tried changing the encoding to UTF-8 but still it didn't help.Problem is that the change is not consistent throughout, so I cannot simply replace the characters with apostrophe or double quotes. Please help me with this. So basically I want to read this text in java and do some further processing for NLP application. When I read these files in java by explicitly setting the encoding to UTF-8, I still get junk characters, though different from what I see in the file. Here are two sample text : It&lt;92>s easy enough, however, to define oneself in whatever way one wants especially when no one in the media challenges you on it. The real test of moral courage is how one acts&lt;97>not just talks&lt;97>in real-life situations. And in the one concrete instance when the Illinois senator was called upon to stand up for justice, he was nowhere to be seen. Another sample text : I would have researched everything beforehand and known exactly what kind of tests to expect at each appointment and what the normal range is supposed to be for those tests. It?~@~Ys not that I don?~@~Yt worry that something will happen or that one or more of the tests will come back abnormal. I do. I thought that with all these good appointments I have had in the last few months, I would start feeling less fearful of something going wrong. But my fear level stays about the same.
type: Question
linked to: http://stackoverflow.com/q/361975
has comment: http://stackoverflow.com/comment/32909748
has comment: http://stackoverflow.com/comment/32910665
linked to: http://stackoverflow.com/q/21735328
score: 0
has comment: http://stackoverflow.com/comment/32909439
has answer: http://stackoverflow.com/a/21756798
answer count: 1
tagged with: unix
has comment: http://stackoverflow.com/comment/32916292
type: UnansweredQuestion
tagged with: java
has title: Inconsistent Character encoding
has comment: http://stackoverflow.com/comment/32917165

post
tags question: http://stackoverflow.com/q/21759202
tags question: http://stackoverflow.com/q/21721449
tags question: http://stackoverflow.com/q/21699745
tag name: post
tags question: http://stackoverflow.com/q/21769551
type: Tag
tags question: http://stackoverflow.com/q/21752843
tags question: http://stackoverflow.com/q/21792201

http://stackoverflow.com/a/21768938
score: 2
has body: I would avoid declaring anything public like suggested by daentech as this bypasses the much acclaimed encapsulation and data protection mechanisms of Java. Instead try pedromss' link. Also... Bundles is another option, have a look at this: https://stackoverflow.com/a/6681784/3199478
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21768687

http://stackoverflow.com/comment/32889612
type: Comment
has text: @cpburnz i hope you got the answer
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21693868

http://stackoverflow.com/q/21789972
answer count: 1
downvote count: 0
has body: I have a select that has to populate its options with a list of String. The option value and text are to be equals. I know that I'm sending the list correctly because the select render a number of elements equals to the size of the list. &lt;s:select name="status" list="status" headerKey="" headerValue="-- Select --" id="status" listKey="" listValue="" /&gt; What happens is that the options are rendered without value and text because I don't have a clue about what I should refer to in listKey and listValue attributes of the select tag of Struts2 taglib. The method in the action: public List&lt;String&gt; getStatus() { return Arrays.asList("Active", "Inactive"); }
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/21790165
score: 2
type: AnsweredQuestion
has title: Struts2 - How to populate a select tag with a list of String?
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: struts2
has answer: http://stackoverflow.com/a/21790165

http://stackoverflow.com/q/21758203
upvote count: 0
has title: Java game programming - angles
score: -1
has comment: http://stackoverflow.com/comment/32912183
has comment: http://stackoverflow.com/comment/32912389
has comment: http://stackoverflow.com/comment/32913038
possible better answer: http://stackoverflow.com/a/21758851
favorite count: 0
has comment: http://stackoverflow.com/comment/32913047
has comment: http://stackoverflow.com/comment/32912601
has answer: http://stackoverflow.com/a/21758851
has body: I am trying to learn game programming and about angles. I'm trying to make a game in which you kick a ball, and when it hits a wall it should bounce away from the wall at a certain angle, depending on the speed of the ball when it hits. After trying to do it for several days now, I don't even really know where to start. I have looked at a lot of other questions, but when I read the code I don't even know what it's supposed to mean. I have always been good in math, but I don't know how to implement it into game programming. I would really appreciate it if you would give me slight push in the right direction.
tagged with: angle
has answer: http://stackoverflow.com/a/21759107
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32912070
has comment: http://stackoverflow.com/comment/32914118
accepted answer: http://stackoverflow.com/a/21759107
tagged with: math
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32912408
tagged with: game-physics
tagged with: graphics
answer count: 2

http://stackoverflow.com/comment/32954298
has text: Say you defined the type, then the compiler would complain immediately as it would then enforce the type - see the example added –
comment on: http://stackoverflow.com/a/21780206
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21735721
has title: Loop will not add total
upvote count: 2
score: 0
downvote count: 2
has answer: http://stackoverflow.com/a/21735834
answer count: 3
has comment: http://stackoverflow.com/comment/32872589
favorite count: 0
has answer: http://stackoverflow.com/a/21735845
has comment: http://stackoverflow.com/comment/32872333
has body: Making a grade book that will work for one student, it take student's name as input. Then they are asked to input grades into three categories: Homework, Quizzes, and Tests. The grades in each category will each be averaged and at the end, the formula "Final Average = 0.25*HomeworkAvg + 0.25QuizAvg + 0.50TestAvg = 65 Everything is working properly BUT -1 is not ending the process! It's frustrating! import java.util.Scanner; public class Assignment3 { public static void main( String[] args ) { Scanner input = new Scanner( System.in ); int homeworkGrades; int quizGrades; int testGrades; int choice; int total; double average; String name; total = 0; homeworkGrades = 0; System.out.println( "Enter 1 or 2: \n 1 - Average grades \n 2 - Quit" ); choice = input.nextInt(); if ( choice == 1 ) { System.out.println( "Enter the students name" ); name = input.next(); System.out.println( " What would you like to do? \n 1 - Homework grades \n 2 - Quiz grades \n 3 - Test grades " ); choice = input.nextInt(); { while ( choice == 1 ) { System.out.println( "Enter a homework grade. Press -1 when finished" ); homeworkGrades += input.nextInt(); if ( homeworkGrades != -1 ) //it's something going on right here :s if ( homeworkGrades == -1 ) System.out.println("Total for homework grades is " + homeworkGrades ); } } } else if ( choice == 2 ) { System.out.println( "Exiting program" ); } else { System.out.println( "Invalid response, exiting program." ); } } }
possible better answer: http://stackoverflow.com/a/21735845
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21735881
accepted answer: http://stackoverflow.com/a/21735834

http://stackoverflow.com/q/21695004
has comment: http://stackoverflow.com/comment/32829545
tagged with: java
tagged with: thrift
has body: I need to generate a java array with apache thrift idl. Can someone tell me how can I do that thing? I have tride it with List. here the code struct subscription{ 1:list&lt;string&gt; control_data 2:string callback_url 3:bool post_notification } Can I do the same thing with an array as It's difficult to deal with a list in my project.
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/32846631
answer count: 1
favorite count: 0
has title: How can I generate a array with apache thrift
has answer: http://stackoverflow.com/a/21730434
type: UnansweredQuestion
downvote count: 1
score: 3

http://stackoverflow.com/comment/32841146
type: AnswerComment
comment on: http://stackoverflow.com/a/21703891
has text: Do I need use openejb-jar.xml? I did not do anything just add the open ejb dependency and run the unit test. Is it correct? I did not deploy or did nothing. Just run the unit test class.
type: Comment
score: 0

http://stackoverflow.com/q/21747885
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32899895
has body: Select Box with autocomplete is too slow when it is loading more than 1000 entries.Is there any other way to load data into select box with less time delay. &lt;sj:select href="%{remoteurl1}" id="fstlvel" formIds="formSelectReload" onChangeTopics="reloadsecondlist" name="firstLevelFltrtype" list="fltrLst" indicator="indicator" loadingText="Loading" loadMinimumCount="2" emptyOption="true" autocomplete="true" selectBoxIcon="true" /&gt;
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32898360
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/32898521
has title: Select box with autocomplete is too slow
answer count: 0

http://stackoverflow.com/comment/32953713
has text: DPI is the dots per inch, not the size of the screen. The same asset will appear roughly the same size in real-world inches on all devices.
comment on: http://stackoverflow.com/q/21779571
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21807944
has comment: http://stackoverflow.com/comment/33001367
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21808025
tagged with: java
has comment: http://stackoverflow.com/comment/33001389
tagged with: nodes
type: Question
has comment: http://stackoverflow.com/comment/33001398
has body: I have an interesting situation: When I add a node into a queue, only two nodes added. Here's how I add nodes into a queue: Queue queue = new Queue(); Node a = new Node("1"); Node b = new Node("2"); Node c = new Node("3"); Node d = new Node("4"); queue.add(a); queue.add(b); queue.add(c); queue.add(d); Now, here's the add method: public void add(Node newNode) { // assigning first Node if (head == null){ head = newNode; return; } // since first Node assigned, assigning second one if (head.next == null){ head.next = newNode; } } It prints: 1 2 I want to print all of them, but only first two are printed. Also, it is like stack, but FIFO, not LIFO. Here's the print if it helps: public void print() { Node p; // Display all the nodes in the stack for( p = head; p != null; p = p.next ) p.print(); } Please let me know if additional info needed. Thanks!
has answer: http://stackoverflow.com/a/21808030
has answer: http://stackoverflow.com/a/21808024
accepted answer: http://stackoverflow.com/a/21808030
score: 0
has answer: http://stackoverflow.com/a/21807992
possible better answer: http://stackoverflow.com/a/21808025
has comment: http://stackoverflow.com/comment/33001424
has comment: http://stackoverflow.com/comment/33001558
has title: Java - issue with assigning Node
has comment: http://stackoverflow.com/comment/33001458
answer count: 4

http://stackoverflow.com/comment/32772358
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21679298
has text: I've looked at it once before, can I use SharedPreferences the same way as I do with java on android? The app uses a LOT of saving strings - so having a good storage is a must

http://stackoverflow.com/a/21709703
score: 1
has comment: http://stackoverflow.com/comment/32832762
has comment: http://stackoverflow.com/comment/32829985
has comment: http://stackoverflow.com/comment/32835125
has comment: http://stackoverflow.com/comment/32832502
accepted answer of: http://stackoverflow.com/q/21707570
has comment: http://stackoverflow.com/comment/32832892
has comment: http://stackoverflow.com/comment/32835379
answers question: http://stackoverflow.com/q/21707570
has body: If the location of the config is known, you can pass it as a servlet parameter. In your web.xml where you declare your servlet (I refer to configFile as the file you wish to get a reference to): ConfigParser foo.baar.ConfigParser configFilePath /path/to/the/config/file I guess you know where the web.xml file is because you are already using servlet. Then in your servlet, you can you ServletConfig.getInitParameter("configFilePath") to get the location of the config file. e.g. in your servlet: public void init(ServletConfig config) throws ServletException { super.init(config); String path_to_config_file=config.getInitParameter("configFilePath"); } Container will call this method with the ServletConfig where you get your reference to the config file. That means, you are not required to have that file in eclipse at all. With this approach, you don't have to do anything special on your server, the only thing to take care of is that the file is copied over and the path you declare on your web.xml is correct. If the location of the file can be constructed dynamically, you can use ServletContext.getRealPath("/") that returns the absolute path of the webapp. ---UPDATE--- Answer to the updated question. I don't know what is the best practice to do it, but there is a workaround. You create a file (conf_location.txt) in the tomcat home directory which contains one line with the location of the file you want to pass to the servlet. In your servlet, you can get access to the file with this hack (given your war is in $TOMCAT_HOME/webapps/mywar.war): public void init() throws ServletException{ String contextPath=getServletContext().getRealPath("/"); File tomcatHome=new File(contextPath).getParentFile().getParentFile(); File configFile=new File(tomcatHome,"conf_location.txt"); try { String config_location = new Scanner(configFile).useDelimiter("\\Z").next(); } catch (Exception e) {} }
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32832609
has comment: http://stackoverflow.com/comment/32854486
has comment: http://stackoverflow.com/comment/32828145
has comment: http://stackoverflow.com/comment/32833096
type: Answer
downvote count: 0

http://stackoverflow.com/a/21792543
answers question: http://stackoverflow.com/q/21792476
has body: I like the @PersistenceContext annotation that injects an EntityManager into my Spring beans. If you are familiar with the SoC ideology, it makes everything a lot clearer to use Spring, but some find it confusing and too magic I guess. I for sure would totally advise you against using hibernate/jpa/persistence manually without any IoC framework.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32974202
has comment: http://stackoverflow.com/comment/32979553

http://stackoverflow.com/comment/39301509
score: 1
type: Comment
comment on: http://stackoverflow.com/a/21828565
has text: View view=l.getChildAt(i) what is the purpose of this line ? view is not used
type: AnswerComment

http://stackoverflow.com/comment/32894258
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21747829
type: AnswerComment
has text: Wait, I don't get it. So I have to set the Value "manually" from Class B, and not class A? How do I get the value from class A then? o.o

http://stackoverflow.com/a/21756019
score: 1
upvote count: 1
downvote count: 0
has body: The static keyword has two meanings that are actually quite different and that can be confusing. Static on a variable/method means that it exists at the class level, not the instance level. This means that you only have one copy of that variable/method no matter how many instances of the class you create. Static on an inner class though just means that the class does not depend upon its outer class. In your example you can create a new B() without having an A. If you didn't have the static keyword on the class you could not create a new B() unless it was within an instance of A.
answers question: http://stackoverflow.com/q/21755815
type: Answer

http://stackoverflow.com/comment/33009273
type: QuestionComment
type: Comment
has text: But the idea is, that if the device is level, the sprite doesn't move. The device actually is supposed to be flat. I'm new to LibGdx, so I will have to look into the frame thing. Thanks!
comment on: http://stackoverflow.com/q/21806485
score: 0

http://stackoverflow.com/comment/77439504
has text: @Ori Dar, we have domain classes which has "id" property, but it does not have annotation. When I checked in mongo db document, id and _id have different values, but when I retrieve the data through spring data, id property is set with value of _id. how I can get actual value of id which is there in mongo? Note: our system is not inserting the data into db here.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21709825

moqui
tags question: http://stackoverflow.com/q/21796019
tag name: moqui
type: Tag

http://stackoverflow.com/q/21787249
has comment: http://stackoverflow.com/comment/32965321
tagged with: animated
linked to: http://stackoverflow.com/q/10836832
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/32964295
answer count: 1
has answer: http://stackoverflow.com/a/21788104
tagged with: http://stackoverflow.com/tag/gif
has comment: http://stackoverflow.com/comment/32965521
type: AnsweredQuestion
has title: Animating a .GIF image on a JPanel
has body: I have some code that should be making a player animate, walk, but for some reason it doesn't work. This is my code: import javax.swing.*; import java.awt.*; /** * Created by evengultvedt on 14.02.14. */ import javax.swing.*; import java.awt.*; //The board class, which the drawing is on class Board extends JPanel { //The image of the player private Image imgPlayer; public Board() { setPreferredSize(new Dimension(400, 400)); setBackground(Color.WHITE); setVisible(true); //getting the player.gif file ImageIcon player = new ImageIcon("player.gif"); //and put in the imgPlayer variable imgPlayer = player.getImage(); } public void paintComponent(Graphics graphics) { Graphics2D graphics2D = (Graphics2D) graphics; //this doesn't work graphics2D.drawImage(imgPlayer, 10, 10, 100, 100, null); //this works graphics2D.drawString("Test drawing", 120, 120); } } //The JFrame to put the panel on class AnimatePlayer extends JFrame{ public AnimatePlayer() { Board board = new Board(); add(board); setTitle("PlayerTestAnimation"); setResizable(false); setLocationRelativeTo(null); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setSize(400, 400); setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new AnimatePlayer(); } }); } } The player.gif file is two pictures in one file, and is saved in the same directory as the java file. Any help is appreciated, thank you. And I'm sorry for posting only code, but I don't know what more information you need. Please ask if there is something.
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21788104
type: Question

http://stackoverflow.com/a/21718571
answers question: http://stackoverflow.com/q/21717795
type: Answer
downvote count: 0
score: 1
has body: Pass in a specific userAgent when you connect to request the desktop version of the site instead of the mobile version, for example: Document AllGames = Jsoup.connect(AllGamesURL) .userAgent("Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36") .get(); To confirm, I also tried the same thing but passed in an Android userAgent instead and it retrieved different content (which is what will be happening on Android by default). You can use the code I provided, or see a list of user agents here: http://www.useragentstring.com/pages/useragentstring.php
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21717795

http://stackoverflow.com/q/21703003
has answer: http://stackoverflow.com/a/21703298
tagged with: parent-child
tagged with: abstract-class
answer count: 3
upvote count: 1
favorite count: 0
tagged with: static
tagged with: android
has title: Java - get information into library project from project which includes this library
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21703562
has comment: http://stackoverflow.com/comment/32816031
downvote count: 0
accepted answer: http://stackoverflow.com/a/21703562
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32823783
has comment: http://stackoverflow.com/comment/32813932
has body: I am developing a library which needs some configuration information from project which would include this library. What I was thinking is to having some abstract methods in my library and force application to implement these methods. What I am looking for is: Class A in library having some static abstract methods, say having a method named getURL(); A class B implements these static methods in actual application and implement method getURL() from class A. In my library, I called A.getURL(), it should call method implementation from class B which extends class A and should return me the url. But an abstract method can't be static in Java. Is there some workaround to achieve same like functionality.
type: Question
possible better answer: http://stackoverflow.com/a/21703298
has answer: http://stackoverflow.com/a/21709344
has comment: http://stackoverflow.com/comment/32824834

http://stackoverflow.com/comment/32974444
comment on: http://stackoverflow.com/a/21792696
score: 1
type: AnswerComment
type: Comment
has text: [I don't think that would be a good idea](http://stackoverflow.com/questions/6592468/why-is-it-frowned-upon-to-use-a-null-layout-in-swing)

http://stackoverflow.com/comment/40174604
type: Comment
comment on: http://stackoverflow.com/a/21711330
has text: @Suvasis OCI is just the protocol the driver talks. There aren't settings to configure on the application side or the server side besides username, password, address, port and name (usually in tnsnames.ora). Basically, AFAIK, if you can connect it's correctly configured.
score: 0
type: AnswerComment

sockets
tags question: http://stackoverflow.com/q/21812830
tags question: http://stackoverflow.com/q/21829391
tags question: http://stackoverflow.com/q/21703970
tags question: http://stackoverflow.com/q/21718736
tags question: http://stackoverflow.com/q/21709750
tags question: http://stackoverflow.com/q/21729191
tags question: http://stackoverflow.com/q/21780438
tags question: http://stackoverflow.com/q/21778781
tags question: http://stackoverflow.com/q/21732602
tags question: http://stackoverflow.com/q/21771003
tags question: http://stackoverflow.com/q/21728274
tags question: http://stackoverflow.com/q/21817303
tags question: http://stackoverflow.com/q/21764079
tags question: http://stackoverflow.com/q/21714188
tags question: http://stackoverflow.com/q/21822610
tags question: http://stackoverflow.com/q/21823938
tags question: http://stackoverflow.com/q/21735427
tags question: http://stackoverflow.com/q/21698550
tags question: http://stackoverflow.com/q/21835100
tags question: http://stackoverflow.com/q/21811761
tags question: http://stackoverflow.com/q/21835200
tags question: http://stackoverflow.com/q/21758697
tags question: http://stackoverflow.com/q/21810276
tags question: http://stackoverflow.com/q/21820635
tags question: http://stackoverflow.com/q/21733399
tags question: http://stackoverflow.com/q/21816744
tags question: http://stackoverflow.com/q/21683191
tags question: http://stackoverflow.com/q/21816005
type: Tag
tags question: http://stackoverflow.com/q/21680916
tags question: http://stackoverflow.com/q/21702783
tags question: http://stackoverflow.com/q/21770394
tags question: http://stackoverflow.com/q/21756994
tags question: http://stackoverflow.com/q/21757376
tags question: http://stackoverflow.com/q/21742575
tags question: http://stackoverflow.com/q/21692255
tags question: http://stackoverflow.com/q/21788676
tags question: http://stackoverflow.com/q/21761333
tags question: http://stackoverflow.com/q/21727235
tags question: http://stackoverflow.com/q/21734590
tags question: http://stackoverflow.com/q/21683171
tag name: sockets
tags question: http://stackoverflow.com/q/21834839
tags question: http://stackoverflow.com/q/21725581
tags question: http://stackoverflow.com/q/21840587
tags question: http://stackoverflow.com/q/21818076
tags question: http://stackoverflow.com/q/21809155
tags question: http://stackoverflow.com/q/21699467
tags question: http://stackoverflow.com/q/21799873
tags question: http://stackoverflow.com/q/21746833
tags question: http://stackoverflow.com/q/21683296
tags question: http://stackoverflow.com/q/21700284
tags question: http://stackoverflow.com/q/21808572
tags question: http://stackoverflow.com/q/21770106

http://stackoverflow.com/q/21830474
downvote count: 0
has comment: http://stackoverflow.com/comment/33041458
tagged with: sql
score: 1
tagged with: ms-access
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33040748
has comment: http://stackoverflow.com/comment/33041219
answer count: 0
tagged with: java
has title: DSN-less connection sql-MS Access
upvote count: 1
tagged with: odbc
type: Question
has body: I am trying to make a dsn-less connection in a java app i am working on but when i try to connect to the DB i get this error : ava.sql.SQLException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. here's the code public void connection(){ (*.mdb,*.accdb)};DBQ=C:\\Users\\Κίμων try{ Driver d =(Driver)Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance(); Connection c = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\Users\\Κίμων\\Documents\\NetBeansProjects\\HairStyle\\HDB.accdb"); }catch(Exception e){ e.printStackTrace(); } } i've noticed that if i place the accdb file to me E: drive the error is gone.. can someone help me plz?

http://stackoverflow.com/comment/32938987
comment on: http://stackoverflow.com/q/21772878
score: 0
type: QuestionComment
has text: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html
type: Comment

http://stackoverflow.com/q/21803719
answer count: 1
has comment: http://stackoverflow.com/comment/32993749
has answer: http://stackoverflow.com/a/21804937
has body: I have a HashMap wich contains a HashMap, and this second HashMap contains another HashMap : public static final Map&lt;String, Map&lt;String, Map&lt;String, Boolean&gt;&gt;&gt; questionnaireData; I want my HashMap to be static and final and contains data, so I did the following : public static final Map&lt;String, Map&lt;String, Map&lt;String, Boolean&gt;&gt;&gt; questionnaireData; static { Map&lt;String, Map&lt;String, Map&lt;String, Boolean&gt;&gt;&gt; data = new HashMap&lt;&gt;(); data.put( "Architecture des ordinateurs", new HashMap&lt;String, Map&lt;String, Boolean&gt;&gt;() {{ put( "1. La partie du processeur spécialisée pour les calculs est :", new HashMap&lt;String, Boolean&gt;() {{ put("L’unité mathématique", false); put("Les Registres", false); put("L’unité arithmétique et logiqueue et logique", true); put("UCC", false); }} ); put( "2. Dans un ordinateur, les données sont présentées par un signal électrique de la forme :", new HashMap&lt;String, Boolean&gt;() {{ put("Analogique", false); put("Numérique", true); put("Alphanumérique", false); put("Alphabétique", false); }} ); put( "3. Les différents éléments d’un ordinateur (mémoire, processeur, périphériques…) sont reliés entre eux par des:", new HashMap&lt;String, Boolean&gt;() {{ put("Fils/câbles", true); put("Registres", false); put("Cartes d’extensions", false); put("Bus", false); }} ); }} ); data.put( "Bureautique", new HashMap&lt;String, Map&lt;String, Boolean&gt;&gt;() {{ put( "1. Quelles sont les fonctions d’un logiciel de traitement de texte ?", new HashMap&lt;String, Boolean&gt;() {{ put("Mise en page d’un texte", true); put("Compilation d’un texte", false); put("Présentation d’un texte sous forme de diaporama ", false); put("Edition d’un texte", true); }} ); put( "2. Insérer des lignes supplémentaires dans un tableau Word :", new HashMap&lt;String, Boolean&gt;() {{ put("Cela n'est pas possible et il faut calculer dès le départ le nombre de lignes qui seront nécessaires.", false); put("Peut se fa…
has title: Populate Nested HashMaps
has comment: http://stackoverflow.com/comment/32994542
has comment: http://stackoverflow.com/comment/32993804
has comment: http://stackoverflow.com/comment/32994624
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32994295
accepted answer: http://stackoverflow.com/a/21804937
has comment: http://stackoverflow.com/comment/32993752
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/32994172
has comment: http://stackoverflow.com/comment/32993753
has comment: http://stackoverflow.com/comment/33001700
score: 0
has comment: http://stackoverflow.com/comment/32994210

jpa
tags question: http://stackoverflow.com/q/21827538
tags question: http://stackoverflow.com/q/21769860
tags question: http://stackoverflow.com/q/21751624
tags question: http://stackoverflow.com/q/21792476
tags question: http://stackoverflow.com/q/21715490
tags question: http://stackoverflow.com/q/21693139
tags question: http://stackoverflow.com/q/21718467
tags question: http://stackoverflow.com/q/21701154
tags question: http://stackoverflow.com/q/21822663
tags question: http://stackoverflow.com/q/21746791
tags question: http://stackoverflow.com/q/21681257
tags question: http://stackoverflow.com/q/21764323
tags question: http://stackoverflow.com/q/21821958
tags question: http://stackoverflow.com/q/21708860
tags question: http://stackoverflow.com/q/21776828
tags question: http://stackoverflow.com/q/21838078
tags question: http://stackoverflow.com/q/21824922
tags question: http://stackoverflow.com/q/21837833
tags question: http://stackoverflow.com/q/21804438
tags question: http://stackoverflow.com/q/21717252
tags question: http://stackoverflow.com/q/21731343
tags question: http://stackoverflow.com/q/21721818
tags question: http://stackoverflow.com/q/21801605
tags question: http://stackoverflow.com/q/21713377
tags question: http://stackoverflow.com/q/21724051
tags question: http://stackoverflow.com/q/21827081
tags question: http://stackoverflow.com/q/21779537
tags question: http://stackoverflow.com/q/21765097
tags question: http://stackoverflow.com/q/21735957
tags question: http://stackoverflow.com/q/21819901
tags question: http://stackoverflow.com/q/21784295
type: Tag
tags question: http://stackoverflow.com/q/21737173
tags question: http://stackoverflow.com/q/21816983
tags question: http://stackoverflow.com/q/21750369
tags question: http://stackoverflow.com/q/21731118
tags question: http://stackoverflow.com/q/21827064
tags question: http://stackoverflow.com/q/21697329
tags question: http://stackoverflow.com/q/21840890
tags question: http://stackoverflow.com/q/21755787
tags question: http://stackoverflow.com/q/21803253
tags question: http://stackoverflow.com/q/21805846
tags question: http://stackoverflow.com/q/21698585
tags question: http://stackoverflow.com/q/21776829
tags question: http://stackoverflow.com/q/21719164
tags question: http://stackoverflow.com/q/21818625
tags question: http://stackoverflow.com/q/21754562
tags question: http://stackoverflow.com/q/21834340
tags question: http://stackoverflow.com/q/21681905
tags question: http://stackoverflow.com/q/21750701
tags question: http://stackoverflow.com/q/21746637
tags question: http://stackoverflow.com/q/21737876
tags question: http://stackoverflow.com/q/21693071
tags question: http://stackoverflow.com/q/21779577
tags question: http://stackoverflow.com/q/21783222
tags question: http://stackoverflow.com/q/21821429
tag name: jpa
tags question: http://stackoverflow.com/q/21765881
tags question: http://stackoverflow.com/q/21703419
tags question: http://stackoverflow.com/q/21719201
tags question: http://stackoverflow.com/q/21698939
tags question: http://stackoverflow.com/q/21681921
tags question: http://stackoverflow.com/q/21698731
tags question: http://stackoverflow.com/q/21727293
tags question: http://stackoverflow.com/q/21689260
tags question: http://stackoverflow.com/q/21764131
tags question: http://stackoverflow.com/q/21713722
tags question: http://stackoverflow.com/q/21762328
tags question: http://stackoverflow.com/q/21767488
tags question: http://stackoverflow.com/q/21831721
tags question: http://stackoverflow.com/q/21729050
tags question: http://stackoverflow.com/q/21832573
tags question: http://stackoverflow.com/q/21795895
tags question: http://stackoverflow.com/q/21752912
tags question: http://stackoverflow.com/q/21788741
tags question: http://stackoverflow.com/q/21780117
tags question: http://stackoverflow.com/q/21700900
tags question: http://stackoverflow.com/q/21743823

http://stackoverflow.com/q/21838130
tagged with: usernametoken
upvote count: 5
downvote count: 0
linked to: http://stackoverflow.com/q/14266237
answer count: 1
has body: I'm in the process of creating a Java web services client from a wsdl. I used Eclipses's Dynamic Web Project and new Web Services Client to generate the code with wsdl2java with Apache Axis 1.4. I need to add SOAP authentication to this code in order for it to work with the service. I couldn't find a place to do that in the generated code. After copious research I found this, which I've used as the backbone for my code so far. Adding ws-security to wsdl2java generated classes Before I was getting a "Error occurred while processing security for the message" or something along those lines. Now I am getting "Exception: Did not understand "MustUnderstand" header(s):{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security Message: null" I've tried many things to get past this exception. This is the code I've arrived at now. javax.xml.namespace.QName headerName = new javax.xml.namespace.QName( "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security"); org.apache.axis.message.SOAPHeaderElement header = new org.apache.axis.message.SOAPHeaderElement(headerName); header.setActor(null); header.setMustUnderstand(true); // Add the UsernameToken element to the WS-Security header javax.xml.soap.SOAPElement utElem = header.addChildElement("UsernameToken"); utElem.setAttribute("Id", "uuid-3453f017-d595-4a5b-bc16-da53e5831cd1-1"); javax.xml.soap.SOAPElement userNameElem = utElem.addChildElement("Username"); userNameElem.setValue("username"); javax.xml.soap.SOAPElement passwordElem = utElem.addChildElement("Password"); passwordElem.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"); passwordElem.setValue("password"); header.setProcessed(true); // Finally, attach the header to the binding. setHeader(header) This code is located in my Binding_ServiceStub class (in its' createCall method). We have created clients in both C# and VB with this wsdl, …
has answer: http://stackoverflow.com/a/22159128
accepted answer: http://stackoverflow.com/a/22159128
favorite count: 0
tagged with: soapheader
tagged with: soap
type: AnsweredQuestion
has title: Adding soap header authentication to wsdl2java generated code
tagged with: java
tagged with: wsdl2java
type: Question
score: 5

http://stackoverflow.com/a/21684160
accepted answer of: http://stackoverflow.com/q/21684159
answers question: http://stackoverflow.com/q/21684159
has body: Buried in the EasyMock 1.2 documentation is a single setence that explains this issue: The following code configures the MockObject to answer 42 to voteForRemoval("Document") once and -1 for subsequent calls as well as all other arguments to voteForRemoval(): mock.voteForRemoval("Document"); control.setReturnValue(42); control.setDefaultReturnValue(-1); (Empahsis mine) In other words, setDefaultReturnValue() not only returns -1 for voteForRemoval("Document") after the first time, but also returns -1 if any other parameter is passed in. It looks like the person who wrote the test you're looking at knew this and just figured he'd throw in a placeholder, not caring about the actual parameter. The EasyMock 2/3 equivalent of your code would be: expect(service.convertValue(isA(String.class))).andReturn(new Integer(1)).anyTimes(); EasyMock 2 cleaned up a lot of ambiguities like this and forced developers to explicitly define what they were looking for. It's probably for the best, given the unintended side effects that can occur with the old style.
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/21758116
upvote count: 14
tagged with: java
has comment: http://stackoverflow.com/comment/32919957
type: Question
downvote count: 0
has body: We have a Spring web application we're porting from Spring 3.2 to Spring 4. Our application has several sub-contexts assembled into a single runtime context when the web application is started. We use separate TaskSchedulers in two of our sub-contexts. With Spring 3.2 this works fine; when using Spring 4 we get an exception with the following message: java.lang.IllegalStateException: More than one TaskScheduler and/or ScheduledExecutorService exist within the context. Remove all but one of the beans; or implement the SchedulingConfigurer interface and call ScheduledTaskRegistrar#setScheduler explicitly within the configureTasks() callback. Found the following beans: [commonScheduler, communicationTaskScheduler] at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:289) ~[spring-context-4.0.1.RELEASE.jar:4.0.1.RELEASE] at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:72) ~[spring-context-4.0.1.RELEASE.jar:4.0.1.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) ~[spring-context-4.0.1.RELEASE.jar:4.0.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) ~[spring-context-4.0.1.RELEASE.jar:4.0.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:776) ~[spring-context-4.0.1.RELEASE.jar:4.0.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485) ~[spring-context-4.0.1.RELEASE.jar:4.0.1.RELEASE] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web-4.0.1.RELEASE.jar:4.0.1.RELEASE] at org.springframework.web.context.ContextLoader.in…
answer count: 3
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31759135
has answer: http://stackoverflow.com/a/21816235
has answer: http://stackoverflow.com/a/37378873
has title: Why does Spring 4 only allow one TaskScheduler in a context?
tagged with: spring
score: 14

http://stackoverflow.com/a/21891112
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21706415
has comment: http://stackoverflow.com/comment/33179271
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33179928
has body: If JsonDeserializer (and DateTimeDeserializer too) was an interface, you could easily "JMock" it, pass mocked instance to JsonMapperFactory#createObjectMapper and then expect exactly 1 invocation of your custom "serialize" method; e.g. DateTimeSerializer serializer = context.mock(DateTimeSerializer.class); DateTimeDeserializer serializer = context.mock(DateTimeDeserializer.class); ObjectMapper mapper = JacksonMapperFactory.createObjectMapper(deserializer, serializer); exactly(1).of(jsonDeserializer).serialize(myDateTime, with(any(JsonGenerator.class), with(any(SerializerProvider.class))) Being a concrete class, you can instead define a new (test-scoped) De/Serializer that extends your custom DateTime(De)serializer, and simply count invocation on that: private static class DateTimeDeserializerWithCounter extends DateTimeDeserializer { public int counter = 0; @Override public DateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { counter++; return super.deserialize(jsonParser, deserializationContext); } } @Test public void usageTest(){ //init mapper with the above DateTimeDeserializerWithCounter - see below mapper.readValue("...", DateTime.class); Assert.assertEquals(1, deserializer.counter); } Below a snapshot of a more "test-oriented" Factory: //package visibility, to allow passing different De/Serializers while testing static ObjectMapper createObjectMapper(JsonDeserializer deserializer, JsonSerializer serializer) { final SimpleModule module = new SimpleModule("customerSerializationModule", new Version(1, 0, 0, "static version")); module.addDeserializer(DateTime.class, deserializer); module.addSerializer(DateTime.class, serializer); final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(module); return objectMapper; } //production method: no-args, as in the original version public static ObjectMapper createObjectMapper() { return createObjectMapper(new DateTimeDeserializer(), new Da…

http://stackoverflow.com/comment/32785241
score: 0
type: AnswerComment
type: Comment
has text: Which implementation is that, Jon? In my experience SDF has always populated the Calendar fully, but I haven't tested all JDKs
comment on: http://stackoverflow.com/a/21685887

tags
tags question: http://stackoverflow.com/q/21720173
type: Tag
tags question: http://stackoverflow.com/q/21806768
tag name: tags

http://stackoverflow.com/a/21698208
has body: Check the condition before entering into loop. For example: boolean statusIsNotReady = true; while(statusIsNotReady) { // do your fty; if(someCondition) { statusIsNotReady = false; // If the status changed } }
answers question: http://stackoverflow.com/q/21698038
score: 0
type: Answer

http://stackoverflow.com/comment/32819105
has text: You are correct Marco13, sorry about the terminology. I have an isEdge method which checks for the existence of an edge when given indicies of vertices, an addEdge method which checks for the existence of an edge using isEdge before adding, a removeEdge method, and a toString method for output. I can put the code for them in the post if it's helpful (didn't want to make it too long).
comment on: http://stackoverflow.com/q/21705171
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32905887
has text: That data coming from DB is a online form with some default values, like name and address... Every user must change it according to his needs. Thats way it must be editable. And if one user change it, the other user should not see the changes of the first user. Thats way I've to make a copy for every user.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21752771

http://stackoverflow.com/comment/32982620
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21797539
has text: try clean and then build
score: 0

http://stackoverflow.com/a/21732468
score: 1
answers question: http://stackoverflow.com/q/21732357
has comment: http://stackoverflow.com/comment/32866634
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21732357
downvote count: 0
has comment: http://stackoverflow.com/comment/32866493
type: Answer
has comment: http://stackoverflow.com/comment/32866469
has comment: http://stackoverflow.com/comment/32866857
has comment: http://stackoverflow.com/comment/32868294
upvote count: 1
has body: If you have a List&lt;RQEntry&gt; you can sort it now using this comparator. The RQEntry objects will be compared based on their handled dates. This is what this call here is doing. Collections.sort(list, new MyComparator()); Behind the scenes, when the sort algorithm needs to compare two RQEntry objects, it will call the compare method of your comparator. That's all.

http://stackoverflow.com/a/21797075
type: AcceptedAnswer
type: Answer
upvote count: 15
has comment: http://stackoverflow.com/comment/69769676
downvote count: 0
has body: There are several issues when using a JTextArea as rendering component (and most if not all of them already explained in several QA's on this site). Trying to sum them up: Adjust individual row height to the size requirements of the rendering component Basically, the way to go is to loop through the cells as needed, then configure its renderer with the data ask the rendering component for its preferred size set the table row height to the pref height The updateRowHeight method in the OP's edited question is just fine. JTextArea's calculation of its preferredSize to get a reasonable sizing hint for one dimension, it needs to be "seeded" with some reasonable size in the other dimension. That is if we want the height it needs a width, and that must be done in each call. In the context of a table, a reasonable width is the current column width: public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { ... // configure visuals setText((String) value); setSize(table.getColumnModel().getColumn(column).getWidth(), Short.MAX_VALUE); return this; }// getTableCellRendererComponent Dynamic adjustment of the height The row height it fully determined in some steady state of the table/column/model. So you set it (call updateRowHeight) once after the initialization is completed and whenever any of the state it depends on is changed. // TableModelListener @Override public void tableChanged(TableModelEvent e) { updateRowHeights(); } // TableColumnModelListener @Override public void columnMarginChanged(ChangeEvent e) { updateRowHeights(); } Note As a general rule, all parameters in the getXXRendererComponent are strictly read-only, implementations must not change any state of the caller. Updating the rowHeight from within the renderer is wrong.
accepted answer of: http://stackoverflow.com/q/21723025
score: 15
answers question: http://stackoverflow.com/q/21723025

http://stackoverflow.com/comment/33019707
comment on: http://stackoverflow.com/a/21818227
has text: Thanks, but as I said, I'm on Android and the it uses older versions(?) of HttpClient in which consumeContent() is not Deprecated and EntityUtils.consumeContent(HttpEntity) does not exist!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33058413
type: QuestionComment
comment on: http://stackoverflow.com/q/21840006
has text: What is the type of `timer` and `timerplus`? int or double?
score: 0
type: Comment

http://stackoverflow.com/comment/32866369
comment on: http://stackoverflow.com/a/21731951
has text: Alright that seemed to help! Also, instead of having them enter all the integers at once, can I make the "Enter a homework grade. Press -1 when finished" loop? How would I go about doing that? For example: Enter a homework grade. Press -1 when finished 56 Enter a homework grade. Press -1 when finished 76 Enter a homework grade. Press -1 when finished 84 Enter a homework grade. Press -1 when finished -1 Homework Grade average is "homework" I also want to add that grade to the total int
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21707131
type: Answer
has comment: http://stackoverflow.com/comment/32830946
score: 1
upvote count: 1
has body: set setOnClickListener() to your checkboxs. checkBox1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (((CheckBox) v).isChecked()) { ccp1 = Onorario1 * 2 / 100; Iva1 = (Onorario1 + ccp1)*22/100; Rit1 = (Onorario1+ccp1+Iva1+SpeseD1)*20/100; CostI1 = (Onorario1+ccp1+SpeseD1); Deb1 = (Onorario1+ccp1+Iva1+SpeseD1); Netto1 = (Onorario1+ccp1+Iva1+SpeseD1) - Rit1; // ccp.setText(Double.toString(round(ccp1,2))); Iva.setText(Double.toString(round(Iva1,2))); Rit.setText(Double.toString(round(Rit1,2))); CostI.setText(Double.toString(round(CostI1,2))); Deb.setText(Double.toString(round(Deb1,2))); Netto.setText(Double.toString(round(Netto1,2))); } } }); checkBox2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (((CheckBox) v).isChecked()) { ccp1 = Onorario1 * 4 / 100; Iva1 = (Onorario1 + ccp1)*22/100; Rit1 = (Onorario1+ccp1+Iva1+SpeseD1)*20/100; CostI1 = (Onorario1+ccp1+SpeseD1); Deb1 = (Onorario1+ccp1+Iva1+SpeseD1); Netto1 = (Onorario1+ccp1+Iva1+SpeseD1) - Rit1; // ccp.setText(Double.toString(round(ccp1,2))); Iva.setText(Double.toString(round(Iva1,2))); Rit.setText(Double.toString(round(Rit1,2))); CostI.setText(Double.toString(round(CostI1,2))); Deb.setText(Double.toString(round(Deb1,2))); Netto.setText(Double.toString(round(Netto1,2))); } } }); or setOnCheckedChangeListener(). checkBox1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked){ ccp1 = Onorario1 * 2 / 100; Iva1 = (Onorario1 + ccp1)*22/100; Rit1 = (Onorario1+ccp1+Iva1+SpeseD1)*20/100; CostI1 = (Onorario1+ccp1+SpeseD1); Deb1 = (Onorario1+ccp1+Iva1+SpeseD1); Netto1 = (Onorario1+ccp1+Iva1+SpeseD1) - Rit1; // ccp.setText(Double.toString(round(ccp1,2))); Iva.setText(Double.toString(round(Iva1,2))); Rit.setText(Double.toString(round(Rit1,2))); CostI.setText(Double.toString(round(CostI1,2))); Deb.setText(Double.toString(round(De…
answers question: http://stackoverflow.com/q/21706613
has comment: http://stackoverflow.com/comment/32830739
downvote count: 0
has comment: http://stackoverflow.com/comment/32830091
has comment: http://stackoverflow.com/comment/32827152

http://stackoverflow.com/q/21823610
upvote count: 1
answer count: 1
tagged with: button
downvote count: 0
tagged with: frame
has body: I am creating a Swing based application , which actually consist of two buttons as shown below - now what i want is when first button is clicked it must perform a action like showing a panel containing label, textfields , and some buttons in the same frame as shown below - and when second button is clicked it will show another panel in the same frame as shown below .. the thing is i am not understanding how to make this interface in action by providing event handler and action listener .. So please letme me know how can i archive this . Any help would be appreciated .. Thanks
tagged with: panel
favorite count: 0
has answer: http://stackoverflow.com/a/21823819
accepted answer: http://stackoverflow.com/a/21823819
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33030057
tagged with: swing
type: Question
has title: show one panel after button is clicked and other panel when second button is clicked in the same frame
has comment: http://stackoverflow.com/comment/33029245

http://stackoverflow.com/q/21756666
type: UnansweredQuestion
has title: Parser exception for /google-play-services_lib/AndroidManifest.xml: Premature end of file
tagged with: eclipse
score: 3
downvote count: 0
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21756769
has answer: http://stackoverflow.com/a/22252539
upvote count: 3
has answer: http://stackoverflow.com/a/23593031
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/58170594
has body: I'm trying to import the google-play-services_lib in Eclipse like they say in this tutorial (http://developer.android.com/google/play-services/setup.html) but it gives the error below and I can't seem to find a decent solution. I've imported a copy not the original one, it's on the same disk... Parser exception for /google-play-services_lib/AndroidManifest.xml: Premature end of file.

http://stackoverflow.com/a/21769843
has comment: http://stackoverflow.com/comment/32934516
type: Answer
has comment: http://stackoverflow.com/comment/32934224
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/32934574
has body: File outputfile = new File("image.jpg"); ImageIO.write(bufferedImage, "jpg", outputfile); Is this what you are looking for?
has comment: http://stackoverflow.com/comment/32934410
has comment: http://stackoverflow.com/comment/32934558
downvote count: 0
has comment: http://stackoverflow.com/comment/32934376
answers question: http://stackoverflow.com/q/21769586

http://stackoverflow.com/q/21782964
tagged with: javac
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21783051
has comment: http://stackoverflow.com/comment/32956599
upvote count: 0
tagged with: java
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/32956650
score: -1
has title: Cannot find symbol in java, both .java files are in the same directory when compiling
tagged with: symbols
has body: I have 2 files, tweet.java and Account.java. When I compile tweet.java it's goes through but when I compile Account.java it says this error C:\Users\Nolan\Documents\OBJECTP\Java\tweet&gt;javac tweet.java C:\Users\Nolan\Documents\OBJECTP\Java\tweet&gt;javac Account.java Account.java:8: error: cannot find symbol private tweet[] UserTweets; ^ symbol: class tweet location: class Account Account.java:10: error: cannot find symbol private final tweet[] EMPTY_TWEET; ^ symbol: class tweet location: class Account Account.java:17: error: cannot find symbol this.UserTweets = new tweet[20]; ^ symbol: class tweet location: class Account Account.java:18: error: cannot find symbol this.EMPTY_TWEET = new tweet[0]; ^ symbol: class tweet location: class Account Account.java:38: error: cannot find symbol this.UserTweets[TweetCount] = new tweet(message); ^ symbol: class tweet location: class Account 5 errors I've asked my professor and alot of friends and they don't know what's the problem is! I'm on the edge here because I have to result to using compiler's from my university's lab (apparently it works there when I compile it). I'll cut the methods in the source codes to shorten it. tweet.java file: //tweet.java import java.util.Calendar; public class tweet { private String message; private int D; private int M; private int Y; private int H; private Calendar now; private int Min; public tweet(String Mes){ this.message=Mes; this.now=Calendar.getInstance(); this.D=now.get(Calendar.DATE)+1; this.M=now.get(Calendar.MONTH); this.Y=now.get(Calendar.YEAR); this.H=now.get(Calendar.HOUR); this.Min=now.get(Calendar.MINUTE); } //Method's here } Account.java file: //Account.java file import java.util.Calendar; public class Account { private String Username; private String Password; private String FirstName; private String LastName; private tweet[] UserTweets; private int TweetCount; private final tweet[] EMPTY_TWEET; public Account(String UserName,String Password,String FName,String LName){ this.…
has comment: http://stackoverflow.com/comment/32957245
answer count: 1
downvote count: 1
favorite count: 0
tagged with: compiler-errors

http://stackoverflow.com/a/21731443
has body: NOTA: I hope this discussion will be an help for the casual reader and/or googler and will be "a window of peace" in the war of Regex vs HTML Parser. Solution #1: With Regex Sample code import java.util.regex.Matcher; import java.util.regex.Pattern; public class HelloWorld { public static void main(String []args){ String sentence = "Most implementations provide ASDF as a module, and you can simply (require \"asdf\")."; String RegEx = "(?is)(\\w+|[\u00E0\u00C0\u00E2\u00C2\u00E4\u00C4\u00E1\u00C1\u00E9\u00C9\u00E8\u00C8\u00EA\u00CA\u00EB\u00CB\u00EC\u00CC\u00EE\u00CE\u00EF\u00CF\u00F2\u00D2\u00F4\u00D4\u00F6\u00D6\u00F9\u00D9\u00FB\u00DB\u00FC\u00DC\u00E7\u00C7\u2019\u00F1]+)(<[^>]+>)?"; Pattern mypattern = Pattern.compile(RegEx); Matcher myMatcher = mypattern.matcher(sentence); String output=myMatcher.replaceAll("$1$2"); System.out.println(output); } } Output Most implementations provide ASDF as a module, and you can simply (require "asdf"). Solution #2: With Jsoup Sample code import org.jsoup.Jsoup; import org.jsoup.nodes.Element; import org.jsoup.nodes.TextNode; public class HelloWorldWithJsoup { public static void main(String[] args) { String sentence = "Most implementations provide ASDF as a module, and you can simply (require \"asdf\")."; Element body = Jsoup.parse(sentence).body(); for (TextNode textNode : body.textNodes()) { textNode.wrap(""); } System.out.println(body.html()); } } Output Most implementations provide ASDF as a module, and you can simply (require "asdf"). Discussion Let's compare both approaches: Quantitatively Except the imports, both codes share the same lines of code count. Excluding the core classes offered by the JDK and classes instanciated under the cover, Solution#2 needs 3 additional classes (Jsoup, Element and TextNode) while Solution#1 needs 2 (Matcher,Pattern). Solution#2 requires that you put a dependency inside your code while Solution#1 is ready out of box with a JDK. Qualitatively From the readability point of view, they are bot…
score: 8
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/32898962
has comment: http://stackoverflow.com/comment/102144754
accepted answer of: http://stackoverflow.com/q/21724440
answers question: http://stackoverflow.com/q/21724440
has comment: http://stackoverflow.com/comment/32898690
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21875556
upvote count: 7
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/21717609
has body: To achieve what you want, you need to do the following: Create a new Eclipse workspace (like you have done already) Import the projects you want to move using File/Import/General/Existing Projects and select the check box "copy projects into workspace" Delete the now copied projects from the original workspace in Eclipse and select the check box "delete project contents on disk" After that you will have completely moved the projects from one workspace to another, including the underlying folders. I would also like to ask your recommendations whether I should have a same workspace and projects folder(like what I want to do) or different directories for my workspace and projects folder. It depends on your own preferences and, how the projects are going to be used. I prefer to have my main project folders separate from my workspaces, because some of them will reside on either SVN, GIT or also Dropbox. Especially library projects, that might be used by more than one other projects, are better kept in a separate workspace and/or folder. This allows one to keep the overview and one can simply include these library projects in other workspaces when needed.

http://stackoverflow.com/comment/32852014
comment on: http://stackoverflow.com/a/21724184
score: 0
type: Comment
has text: Just tested it, it does call `temp.append(i)`. Edited answer.
type: AnswerComment

http://stackoverflow.com/comment/32989157
has text: I thnk its not possible because once the request send to server its not possible meanwhile to check the client is available or not.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21801246

http://stackoverflow.com/a/21714237
score: 3
has body: Use a List for the suits: List&lt;String&gt; suits = new ArrayList&lt;String&gt;(); suits.add("CLUBS"); suits.add("DIAMONDS"); suits.add("HEARTS"); suits.add("SPADES"); Card[] cards = new Card[52]; int i = 0; for (String suit : suits) { for (int y = 2; y &lt; 15; y++) { cards[i] = new Card(y, suit); i++; } } You could also consider defining the suits in an enum: public enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES; } In this case your loop would change to: for (Suit suit : Suit.values()) { for (int y = 2; y &lt; 15; y++) { cards[i] = new Card(y, suit.name()); i++; } }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21714062
type: Answer
accepted answer of: http://stackoverflow.com/q/21714062
upvote count: 3

http://stackoverflow.com/q/21777205
has comment: http://stackoverflow.com/comment/33103702
accepted answer: http://stackoverflow.com/a/21867762
has comment: http://stackoverflow.com/comment/32960500
tagged with: mysql
has comment: http://stackoverflow.com/comment/33070522
has body: I am using hibernate in my project and I am getting random Apparent Deadlocks for very simple database operations. There is one of the Stack Traces: https://gist.github.com/knyttl/8999006 – What confuses me, that the first Exception is RollbackException and then there are LockAquisition Exceptions. The problem happens often on similar clauses: @Transactional public void setLastActivity() { User user = em.findById(...); user.setLastActivity(new Date()); em.merge(user); em.flush(); } I am quite stuck as I don't know whether it is problem of Hibernate, MySQL or C3P0. My Hibernate configuration: ${database.dialect} ${database.structure} ${database.connection} ${database.username} ${database.password} ${database.driver} true 0 UTF-8 UTF-8 ${database.show_sql} false disabled org.hibernate.connection.C3P0ConnectionProvider 0 50 120 0 0 0 120 1 8 EDIT1: I wrote above there were Apparent Deadlocks happening - that was wrong, only "Deadlock found when trying to obtain lock" happen. EDIT2: This happens also on these methods - those NEEDS to be annotated with @Transactional: @Transactional public void setLastActivity() { em.insertNative("table") .values(...) .execute(); }
type: Question
has comment: http://stackoverflow.com/comment/33057866
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/5178473
score: 15
has comment: http://stackoverflow.com/comment/32952965
upvote count: 15
has comment: http://stackoverflow.com/comment/33057793
answer count: 2
possible better answer: http://stackoverflow.com/a/21825563
has comment: http://stackoverflow.com/comment/33028929
downvote count: 0
tagged with: c3p0
has answer: http://stackoverflow.com/a/21825563
has comment: http://stackoverflow.com/comment/32953375
linked to: http://stackoverflow.com/q/1951275
favorite count: 0
has comment: http://stackoverflow.com/comment/32963339
has comment: http://stackoverflow.com/comment/33070639
has comment: http://stackoverflow.com/comment/32949082
has comment: http://stackoverflow.com/comment/33035805
has answer: http://stackoverflow.com/a/21867762
has title: Hibernate: Deadlock found when trying to obtain lock
has comment: http://stackoverflow.com/comment/33071033
type: AnsweredQuestion

http://stackoverflow.com/q/21774816
has comment: http://stackoverflow.com/comment/32942187
score: 0
has answer: http://stackoverflow.com/a/21904801
has comment: http://stackoverflow.com/comment/32942559
has body: I am in need of the json package, these are the imports i need to resolve: import org.json.simple.JSONObject; //import net.sf.json.JSONObject; class json { public static void main(String[] args) { JSONObject obj=new JSONObject(); obj.put("name","foo"); obj.put("num",new Integer(100)); obj.put("balance",new Integer(1000)); obj.put("is_vip",new Boolean(true)); System.out.print(obj); } } i have downloaded the json package (json-simple-1.1.1.jar) from google code. Now i don't know how to install it in my fedora 14. I am using java version 1.6.0_20. Is there any specific version of json that i could download for this java version? I have tried to execute it using the command java -jar json-simple-1.1.1.jar but i got a message showing "Failed to load Main-Class manifest attribute from json-simple-1.1.1.jar"
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32942460
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32942329
has comment: http://stackoverflow.com/comment/32942641
has comment: http://stackoverflow.com/comment/32942297
type: Question
linked to: http://stackoverflow.com/q/2096283
has answer: http://stackoverflow.com/a/21775093
has title: how to add json library to fedora14
answer count: 2
has comment: http://stackoverflow.com/comment/32942475

http://stackoverflow.com/comment/32987300
comment on: http://stackoverflow.com/q/21800165
score: 0
type: Comment
type: QuestionComment
has text: Same for `getDBConnection`

http://stackoverflow.com/a/21824843
upvote count: 1
downvote count: 1
has body: Have a look at google-json and its user-guide. Unless you want something jackson specifically. Hope this would help you get going
answers question: http://stackoverflow.com/q/21824657
score: 0
type: Answer

http://stackoverflow.com/q/21704538
has comment: http://stackoverflow.com/comment/32826325
has comment: http://stackoverflow.com/comment/32826598
tagged with: java
has body: I'm working on Xamarin for Android, and i need to enable/disable the ethernet connection (RJ45 Cable), i've been looking for it from about 3 days and can't find anything that help me out with this. Does anyone know a way to do it?? Today i found this: http://developer.oesf.biz/em/developer/reference/durian/android/net/ethernet/EthernetManager.html But i can't find either Java.Lang.Object nor Android.Net.Ethernet on Xamarin. Even on Eclipse i can't find it and i have the SDK updated and complete (From API 2 to API 19).
has comment: http://stackoverflow.com/comment/32826549
type: Question
upvote count: 4
downvote count: 0
score: 4
tagged with: ethernet
has comment: http://stackoverflow.com/comment/32827307
answer count: 3
has answer: http://stackoverflow.com/a/21881699
tagged with: android
tagged with: xamarin
has answer: http://stackoverflow.com/a/21704883
favorite count: 0
has title: How can i enable/disable the Ethernet connection on Android?
has answer: http://stackoverflow.com/a/21706543
linked to: http://stackoverflow.com/q/16929957
type: UnansweredQuestion

http://stackoverflow.com/a/21772518
has comment: http://stackoverflow.com/comment/32939607
has comment: http://stackoverflow.com/comment/32938433
has comment: http://stackoverflow.com/comment/32938482
has comment: http://stackoverflow.com/comment/32939693
has comment: http://stackoverflow.com/comment/32938742
has comment: http://stackoverflow.com/comment/32938983
has comment: http://stackoverflow.com/comment/32938654
score: 0
answers question: http://stackoverflow.com/q/21772316
type: Answer
has body: Your Java class is creating InputStreamReader inside the loop for every line of input. When you create a new InputStreamReader every time it just reads the input line first time and then keep reading null. Move them before do loop to fix this problem. try { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); do { System.out.println("&lt;cmd&gt;"); String s = br.readLine(); if (s != null) { System.out.println("cmd=" + s); if (s.equals("quit")) return; } } while (true); isr.close(); } catch(Exception e) { System.err.println("Exception: " + e); }

http://stackoverflow.com/a/21706687
answers question: http://stackoverflow.com/q/21706319
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: There are quite some resources about this pattern on the web, and it's hard to guess what might be the best way of explaining its purpose in a way that sounds "plausible" for you. But I think that the key point is: With this pattern, someone who wants to create an instance of a particular implementation of an interface does not need to know what this particular implementation is. The call to the new operator is hidden inside the factory, and the user of the factory does not need to know the concrete class. This makes it easier to switch the implementation later: You don't have to find and adjust all places where new ConcreteClass() was called and change it to new OtherConcreteClass() in order to use a different implementation. You just pass a different factory around, and everybody who uses this factory automatically creates instances of OtherConcreteClass (without even knowing that he does so...)

http://stackoverflow.com/comment/32985035
comment on: http://stackoverflow.com/a/21797063
has text: You could use [DataOutputStream](http://developer.android.com/reference/java/io/DataOutputStream.html) . DataOutputStream out = new DataOutputStream(new FileOutputStream(yourFile)); out.writeInt(yourInt);
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21834630
type: AcceptedAnswer
type: Answer
has body: There is a way that you could do this without setting 24 separate timers. You could create one, with the time interval being 1. Then, you could add one to a number every time the timer runs. Like this: int loops; this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ public void run() { loops++;//add one to the loops } },1, 1); Then, for every time interval, you could set up a check to see if loops is divisible by the interval... For example, let's say that you would like to have a fly check every 5 ticks, and your withdraw timer every 7 ticks. You could do this: int loops; this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ public void run() { loops++;//add one to the loops if(loops % 5 == 0){//if loops is divisible by 5 //fly check code } if(loops % 7 == 0){//if loops is divisible by 7 //withdraw code } } },1, 1); //make the timer repeat every 1 tick Just make sure that you only use if statements, not else if. If you use else if above, and loops is 35, which is divisible by 5 and 7, it will run the first statement, but not the second, because you are telling it to run that statement only if the above ones are false. Therefor, if you only use if statements, then it will be able to check every single one of them, and multiple will be able to be called.
accepted answer of: http://stackoverflow.com/q/21814390
score: 0
answers question: http://stackoverflow.com/q/21814390

http://stackoverflow.com/a/21750062
has comment: http://stackoverflow.com/comment/32898229
has comment: http://stackoverflow.com/comment/32898359
type: Answer
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/32898141
has comment: http://stackoverflow.com/comment/32899514
has body: Try this : File file = new File("/opt/image.tiff"); Runtime runtime = Runtime.getRuntime(); runtime.exec(new String[] { "/bin/chmod", "777",file.getPath()}); This will execute full permission on the file.
has comment: http://stackoverflow.com/comment/32900779
answers question: http://stackoverflow.com/q/21749862
has comment: http://stackoverflow.com/comment/32899609

http://stackoverflow.com/comment/35455887
type: QuestionComment
comment on: http://stackoverflow.com/q/21696653
has text: If I have same war file & same AIX but different WebSphere versions and it appears in 7 and not in 8.5.5 then it is a WebSphere issue. either configuration, class loading, etc...
score: 0
type: Comment

http://stackoverflow.com/comment/32877726
comment on: http://stackoverflow.com/a/21713954
type: Comment
has text: I got: java.lang.NoClassDefFoundError: com.loopj.android.http.RequestParams. That's my external library I'm compiling with mine.
type: AnswerComment
score: 2

http://stackoverflow.com/q/21760135
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/32923146
has body: I am creating a web application in java. On client side I have a bar chart that display some data stored in a tsv file created by the java server page. By clicking on a button the server updates these data in the file. Now I want to read the refreshed data, but I get the older ones. It seems that the browser cached the file so it can't get the changed file. This is my servlet code: public class GetDataServlet extends HttpServlet { private static final long serialVersionUID = 1L; private User user; Utility utility; public void init() throws ServletException { reset(); } public void doGet (HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { response.setHeader("Cache-Control", "no-cache"); response.setHeader("Pragma", "no-cache"); PrintWriter out = response.getWriter(); user.getProfile().get(0).setWeigth(user.getProfile().get(0).getWeigth()+0.03); user.getProfile().get(1).setWeigth(user.getProfile().get(1).getWeigth()+0.02); user.getProfile().get(5).setWeigth(user.getProfile().get(5).getWeigth()+0.01); utility.createTsvFile(user, "/usr/local/apache-tomcat-7.0.50/webapps/Visualizer/data.tsv"); String message = String.format("data.tsv"); i++; out.print(message); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getParameter("reset").compareTo("yes")==0) reset(); } private void reset(){ List&lt;Concept&gt; children = new ArrayList&lt;Concept&gt;(); Concept food = new Concept(); food.setWeigth(0.10); food.setLabel("food"); food.setColor("#98abc5"); Concept dish = new Concept(); dish.setWeigth(0.08); dish.setLabel("dish"); dish.setParent(food); dish.setColor("#8a89a6"); Concept cuisine = new Concept(); cuisine.setWeigth(0.06); cuisine.setLabel("cuisine"); cuisine.setParent(food); cuisine.setColor("#8a89a6"); children.add(dish); children.add(cuisine); food.setChildren(children); children.clear(); Concept pizza = new Concept(); pizza.setWeigth(0.05); pizz…
tagged with: d3.js
type: UnansweredQuestion
has title: read updated data on client from file created by server JSP
linked to: http://stackoverflow.com/q/4194207
has comment: http://stackoverflow.com/comment/32915943
has comment: http://stackoverflow.com/comment/32917903
tagged with: java
has answer: http://stackoverflow.com/a/21771360
type: Question
has comment: http://stackoverflow.com/comment/32916624
tagged with: browser-cache
tagged with: servlets
score: 0
linked to: http://stackoverflow.com/q/1046966

http://stackoverflow.com/comment/33046404
comment on: http://stackoverflow.com/a/21832426
type: Comment
has text: Just a question, will the super.paint will enter in conflict with the missiles that we want to add after that? Because i saw that this command clean all the window and THEN add the square ? Tahnks anyway it's working :)
score: 0
type: AnswerComment

http://stackoverflow.com/q/21762056
has comment: http://stackoverflow.com/comment/32920071
favorite count: 0
has comment: http://stackoverflow.com/comment/32921703
has title: How can I setting parameters to query based on quarter date
has comment: http://stackoverflow.com/comment/32920022
type: UnansweredQuestion
tagged with: java
has body: I need to find the start of the quarter startQ1,startQ2 ect. run a query that takes 6 query parameters. I dont really know a way of doing this. So if I can use a calendar to find that today is March1st (startq1) I wan't to run the query with the q1 array ... Hope that's clearer. Calendar cal = Calendar.getInstance(); java.sql.Date startQ1 = java.sql.Date.valueOf("2014-03-01"); java.sql.Date startQ2 = java.sql.Date.valueOf("2014-06-01"); java.sql.Date startQ3 = java.sql.Date.valueOf("2014-09-01"); java.sql.Date startQ4 = java.sql.Date.valueOf("2014-12-01"); java.sql.Date [][] q1 = new java.sql.Date[3][2]; q1[0][0] = java.sql.Date.valueOf("2014-07-01"); q1[0][1] = java.sql.Date.valueOf("2014-09-30"); q1[1][0] = java.sql.Date.valueOf("2014-10-01"); q1[1][1] = java.sql.Date.valueOf("2014-12-31"); q1[2][0] = java.sql.Date.valueOf("2015-04-01"); q1[2][1] = java.sql.Date.valueOf("2015-06-30"); java.sql.Date [][] q2 = new java.sql.Date[3][2]; q2[0][0] = java.sql.Date.valueOf("2014-10-01"); q2[0][1] = java.sql.Date.valueOf("2014-12-31"); q2[1][0] = java.sql.Date.valueOf("2015-01-01"); q2[1][1] = java.sql.Date.valueOf("2015-03-31"); q2[2][0] = java.sql.Date.valueOf("2015-07-01"); q2[2][1] = java.sql.Date.valueOf("2015-09-30"); java.sql.Date [][] q3 = new java.sql.Date[3][2]; q3[0][0] = java.sql.Date.valueOf("2015-01-01"); q3[0][1] = java.sql.Date.valueOf("2015-03-31"); q3[1][0] = java.sql.Date.valueOf("2015-04-01"); q3[1][1] = java.sql.Date.valueOf("2015-06-30"); q3[2][0] = java.sql.Date.valueOf("2015-10-01"); q3[2][1] = java.sql.Date.valueOf("2015-12-31"); java.sql.Date [][] q4 = new java.sql.Date[3][2]; q4[0][0] = java.sql.Date.valueOf("2015-04-01"); q4[0][1] = java.sql.Date.valueOf("2015-06-30"); q4[1][0] = java.sql.Date.valueOf("2015-07-01"); q4[1][1] = java.sql.Date.valueOf("2015-09-30"); q4[2][0] = java.sql.Date.valueOf("2016-01-01"); q4[2][1] = java.sql.Date.valueOf("2016-03-31"); if(cal.getTime() == startQ1) { // I know can't actually test this way. for(int i = 0; i &…
downvote count: 1
has answer: http://stackoverflow.com/a/21773548
tagged with: prepared-statement
type: Question
has comment: http://stackoverflow.com/comment/32921185
score: -1
tagged with: date
upvote count: 0
has comment: http://stackoverflow.com/comment/32919694
answer count: 1
tagged with: schedule

http://stackoverflow.com/comment/32995266
type: QuestionComment
type: Comment
score: 1
has text: Place an answer for your own question and mark it as correct one after two days instead placing SOLVED in the question title
comment on: http://stackoverflow.com/q/21796674

http://stackoverflow.com/comment/32971232
score: 0
has text: Do yourself a favor, install the Android Studio instead.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21789381

http://stackoverflow.com/a/21730910
score: 1
downvote count: 0
has body: Your file seems to be read only. You cannot write to a read only file!!!
answers question: http://stackoverflow.com/q/21730776
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32990664
type: Comment
type: QuestionComment
has text: This is a floating point number problem, not java specific. If you are just learning java it will be hard to explain thoroughly but its related to the maximum precision of floating point numbers, to solve this you will have to account for the loss of precision
score: 4
comment on: http://stackoverflow.com/q/21802084

http://stackoverflow.com/comment/42349315
type: Comment
comment on: http://stackoverflow.com/a/21727269
score: 1
type: AnswerComment
has text: @Bhaskar have a look at this link http://www.liquid-technologies.com/XML/EscapingData.aspx

http://stackoverflow.com/q/21782877
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/21783404
type: Question
has body: What are the best way to test my return value if its the value that i selected, Somehow i'm stuck with the concept on how to get the value selected... what my function does right now ,its that i added all the button that i wanted in my GUI and i return the value menu based on the button that i clicked. private JMenu getOrdreMenu(){ JMenu menu = new JMenu(MENU_ORDRE_TITLE); ButtonGroup group = new ButtonGroup(); JRadioButtonMenuItem item = new JRadioButtonMenuItem(MENU_ORDRE_NSEQC); item.setSelected(true); group.add(item); menu.add(item); item = new JRadioButtonMenuItem(MENU_ORDRE_NSEQD); group.add(item); menu.add(item); item = new JRadioButtonMenuItem(MENU_ORDRE_FORMEC); group.add(item); menu.add(item); item = new JRadioButtonMenuItem(MENU_ORDRE_FORMED); group.add(item); menu.add(item); item = new JRadioButtonMenuItem(MENU_ORDRE_TYPENORMAL); group.add(item); menu.add(item); item = new JRadioButtonMenuItem(MENU_ORDRE_TYPEINVERSE); group.add(item); menu.add(item); item = new JRadioButtonMenuItem(MENU_ORDRE_DISTANCEC); group.add(item); menu.add(item); add(menu); return menu; }
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21783404
tagged with: return
tagged with: jradiobutton
tagged with: swing
has title: How to test if my jradiomenubutton it's the value that i wanted
type: AnsweredQuestion

http://stackoverflow.com/a/21816458
has body: The errors you're seeing are Web Service Interoperability (WS-I) compliance errors. Your WSDL document is valid. You can disable WS-I validation under Window->Preferences->Web Services->Profile Compliance and Validation. Set both WS-I AP and WS-I SSBP to Ignore compliance. If you do want to get rid of the errors try removing the import for the schema for schema. &lt;xsd:import namespace="http://www.w3.org/2001/XMLSchema"/&gt; This line is unncessary as the schema types are implicitly imported and I've seen this cause problems with tools before.
answers question: http://stackoverflow.com/q/21778733
score: 0
type: Answer

http://stackoverflow.com/comment/32979894
type: AnswerComment
has text: You should prefer `Integer.valueOf` over the constructor because it uses an internal cache to prevent unnecessary object creation.
score: 6
type: Comment
comment on: http://stackoverflow.com/a/21795412

http://stackoverflow.com/comment/32810577
type: QuestionComment
has text: no, it isn't. It's a streaming server of an ip live camera
score: 0
comment on: http://stackoverflow.com/q/21698010
type: Comment

http://stackoverflow.com/comment/32778968
score: 0
type: Comment
type: QuestionComment
has text: Thanks for sharing! Do you have a specific question?
comment on: http://stackoverflow.com/q/21683212

http://stackoverflow.com/comment/32986908
has text: @fmodos Yes I was trying to load all the object to memory. I am new to hibernate I have written simple queries like `Criteria crit = session.createCriteria(XYZ.class); crit.add( Restrictions.eq("DocumentStatus", 0)); criteria.setProjection(Projections.rowCount()); Integer count = criteria.uniqueResult();` But if I will use this type of queries I need to hit 2 hibernate queries to get count with status 0 and with status 1. Can I write a hibernate query to get both in a single query ?
type: Comment
comment on: http://stackoverflow.com/q/21794310
score: 0
type: QuestionComment

http://stackoverflow.com/a/23593031
upvote count: 1
answers question: http://stackoverflow.com/q/21756666
type: Answer
score: 1
downvote count: 0
has body: This problem will occur if you copy the library project in your project workspace. While doing the import ... import it as an existing android code from the adt installation... for me it's something like... D:\Android Dev\adt-bundle-windows-x86_64\sdk\extras\google\google_play_services\libproject\google-play-services_lib and then tick the option of copying it current workspace during the import. This solved the problem for me and it will not clear manifest or resources file. Secondly... don't forget that this line in manifest should have the same android:minSdkVersion as your main android project

http://stackoverflow.com/comment/33052652
has text: please everybody, I am not new to SparseArray. I know put shut and gut mutt. .append method dont insert at the end. I need to put an object at the last index of the array with a special key!!!!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21836653

http://stackoverflow.com/a/21748514
accepted answer of: http://stackoverflow.com/q/21747910
answers question: http://stackoverflow.com/q/21747910
type: Answer
has body: public class Triangle { public static void main(String[] args) { print(5, 3, 'w'); } private static void print(int h, int H, char x) { //h for height of the triangle, H for the height of pattern and x the char. for(int n = 1; n &lt;= H; n++) { printTriangle(n, h, x); } } private static void printTriangle(int numTriangles, int h, char x) { for(int i = 0; i &lt; h; i++) { //Let's print the line in the triangles with spaces. for(int n = 0; n &lt; numTriangles - 1; n++) { for(int j = 0; j &lt;= i; j++) { System.out.print(x); } for(int j = i+1; j &lt; h; j++) { System.out.print(" "); } } //The last one has no spaces so: for(int j = 0; j &lt;= i; j++) { System.out.print(x); } System.out.println(); } } } Here you are.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/21709344
answers question: http://stackoverflow.com/q/21703003
type: Answer
downvote count: 0
has body: Based on your answers to questions I would recommend the following: Define an interface for a class that retrieves the properties like so: interface LibaryDetails { URL getURL(); String getName(); } Then create a Factory method of some kind which causes your Library to run and do it's thing. Refactor your code out of the main so it can be accessed from here. Have this method take the interface as a parameter: public class LibraryFactory{ public static void startLibrary(LibaryDetails details){ URL url = details.getURL(); String name = details.getName(); // start Library things } } Now your Library only needs to expose the interface and the static Factory. Your Applications just needs to pass it's implementation of the LibraryDetails interface to the factory method and your library can access the information.
score: 1
upvote count: 1

http://stackoverflow.com/a/21734241
has body: If you're just trying to send back the image data in response to a client image request, don't use a JSP. It doesn't really make sense because you're not returning any markup. Just write the image data straight to the output stream from the controller. Here's an example, refactored a little: @RequestMapping("/catalogue/displayCatalogueImage.action") public ResponseEntity getDisplayImage(String catalogueTitleNumber, HttpServletResponse response) throws Exception { System.out.println("Image Display Title number = &gt; "+catalogueTitleNumber); if (StringUtils.isNotEmpty(catalogueTitleNumber)) { response.setHeader("Content-Type", "image/png"); FileInputStream fin = new FileInputStream("images/"+catalogueTitleNumber); ServletOutputStream out = response.getOutputStream(); IOUtils.copy(fin, out); IOUtils.closeQuietly(fin); response.flushBuffer(); return new ResponseEntity(HttpStatus.OK); } return new ResponseEntity(HttpStatus.NOT_FOUND); }
accepted answer of: http://stackoverflow.com/q/21723938
answers question: http://stackoverflow.com/q/21723938
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/21753149
has comment: http://stackoverflow.com/comment/32905214
has comment: http://stackoverflow.com/comment/32908151
type: Answer
upvote count: 1
score: 1
has body: This could work. Or maybe preferably this: If you use Eclipse (or any other IDE) it's fairly simple creating a .class file to a .jar.
downvote count: 0
answers question: http://stackoverflow.com/q/21753013

http://stackoverflow.com/q/21833287
score: 0
answer count: 0
has title: Get pressed mouse-button withous AWT or SWING component?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33068438
has comment: http://stackoverflow.com/comment/33063701
tagged with: swing
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33068599
has body: Is there a way to obtain mouse-button status (if they are pressed or not) when I am not using any Swing or AWT components? So far I have something like this: while(true) { Point point = MouseInfo.getPointerInfo().getLocation(); //mouse movement if (point.x != prevX || point.y != prevY) { prevX = point.x; prevY = point.y; try { //do sth here with the movement } catch (IOException e) { e.printStackTrace(); } } } Is it possible to use MouseAdapter somehow even without Swing JFrame etc?
tagged with: awt

http://stackoverflow.com/a/21710747
answers question: http://stackoverflow.com/q/21710370
upvote count: 1
type: Answer
has body: Q1 and Q2 I will try explaining how the variables get stored in JAVA, thus u can see how GC works. If you declare Object a ; you have created a pointer to an object. It gets stored in the STACK but not in the HEAP. If you later say a = new Object(); The object gets placed into the HEAP. The pointer in the stack points to the place in the heap where your object is. Further more, if you later write a = null; you have set the pointer in the STACK to nowhere. GC will destroy the item in the HEAP. Please note that the pointer is still in the STACK. Now if that all was a local variable ( inside function ) and the function exits at some time, the pointer in the STACK will be removed too, if it points at something in the heap, it gets removed too. However if the variable belongs to an object that is let's say instance variable, the pointer will stay until the object itself exists - the object has memory allocated in the HEAP. I hope you see what's going on here. It's a bit like chain reaction. Q3 - You can make an object last until the program exits by making it STATIC. About Q4 I am not quite sure.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32828373

http://stackoverflow.com/comment/32838564
comment on: http://stackoverflow.com/q/21716162
type: Comment
type: QuestionComment
has text: funny how the question now looks like my answer
score: 2

http://stackoverflow.com/a/23141214
answers question: http://stackoverflow.com/q/21832221
score: 0
type: Answer
has body: have you tried to use the same technique as doMkCol() does: parentResource.addMember(resource, getInputContext(request, null));

http://stackoverflow.com/comment/32827835
score: 3
comment on: http://stackoverflow.com/q/21710465
type: QuestionComment
type: Comment
has text: @rgettman That was a potential thought, but `Arrays` simply wraps the array in a static (fake) ArrayList class that is immutable, it doesn't construct an entirely new list.

http://stackoverflow.com/comment/32932351
has text: Thanks daentech, totally worth it, I know that have some restrictions about private and public, but how I'm not too familiar with java, this is not a issue for me, and I hope its not one for for my teacher too. Many thanks!
comment on: http://stackoverflow.com/a/21768764
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32914952
has text: yeah.. the computer has to do some math. it may be because of the two timers running at the same time. or android buffering the song as it skips and plays through the song. @GhostDerfel. i dont know whats slowing it down. i added the other timer. the one you wrote. because my timer would not stop it. i had to rewrite how i create the media player... what is annoying is when i use the music player on my phone and start a song,. i can skip through the song easily. but in my app the sample sometimes clips if i press a lot of buttons. skipping around the track slows it down
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21737048
score: 0

http://stackoverflow.com/q/21782427
upvote count: 5
has answer: http://stackoverflow.com/a/30831487
answer count: 3
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21782481
downvote count: 0
has body: I would like when I click on a &lt;p:commandButton&gt; ,a Bean for processing is called and at the same time, the page should be redirected to another page. In other words, I would like to combine: &lt;p:commandButton actionListener="#{processBean.process}" &gt; &lt;/p:commandButton&gt; And: &lt;h:link outcome="redirection"&gt; &lt;/h:link&gt; where "redirection" is configured in faces-config.xml How should I do ? Is there a better way to achieve this ?
has title: primefaces: actionListener and redirection at the same time
has answer: http://stackoverflow.com/a/48796923
type: Question
has answer: http://stackoverflow.com/a/21782481
tagged with: primefaces
tagged with: java
score: 5
favorite count: 0
possible better answer: http://stackoverflow.com/a/30831487
linked to: http://stackoverflow.com/q/21785344

http://stackoverflow.com/comment/32913488
comment on: http://stackoverflow.com/q/21758276
score: 0
type: Comment
type: QuestionComment
has text: Your code is incomplete. You show how you create the `resultModel` varialble and you show the code adding data to the TableModel. But you don't add the TableModel to the table. Post your [MCTRE](http://stackoverflow.com/help/mcve) if you need more help.

http://stackoverflow.com/q/21694460
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/32799683
has comment: http://stackoverflow.com/comment/32800398
type: Question
has answer: http://stackoverflow.com/a/21694530
has comment: http://stackoverflow.com/comment/32799246
answer count: 1
score: -1
has comment: http://stackoverflow.com/comment/32799430
has comment: http://stackoverflow.com/comment/32799264
accepted answer: http://stackoverflow.com/a/21694530
has body: I have created an application. It is working fine on Android 2.2. When I use emulator with API higher than 2.2, it's running properly, but some downloading code is not executing. It didn't store any data in SQLite. All functions works properly on Android 2.2 though. Is the mistake on my code or the emulator? &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /&gt; This is My code helper=new DBHelper(this); try { XMLParser parser = new XMLParser(); String xml = parser.getXmlFromUrl(URL); // getting XML Document doc = parser.getDomElement(xml); // getting DOM element NodeList nl = doc.getElementsByTagName(KEY_TAG); db=helper.getReadableDatabase(); Cursor c=db.query(DBHelper.Old_Data, new String [] {DBHelper.Old_id,DBHelper.OLD_NUM}, DBHelper.Old_id+"=?",new String [] {1+""}, null, null, null); if(c != null) { c.moveToFirst(); } String strIndex = c.getString(1); int index = Integer.parseInt(strIndex); c.close(); i=0; Log.d("Index , Length ",index + " , " + nl.getLength()); for (i = index; i &lt; nl.getLength(); i++) { Element e = (Element) nl.item(i); ContentValues val = new ContentValues(); val.put(DBHelper.TEST, parser.getValue(e, TEST)); val.put(DBHelper.FILE, parser.getValue(e, FILE)); val.put(DBHelper.TEST_NO, parser.getValue(e, TEST_NO)); val.put(DBHelper.FILE_URL, parser.getValue(e, EXAM_URL)); db=helper.getWritableDatabase(); db.insert(DBHelper.EXAM_DATA, null, val); db.close(); } if(i != index) { db=helper.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(DBHelper.OLD_NUM, i); db.update(DBHelper.Old_Data, values, DBHelper.Old_id+"=?", new String [] {1+""}); db.close(); } else { Toast.makeText(UserProfile.this, "No Exam Available", Toast.LENGTH_LONG).show(); } } catch (NullPointerException ne) { Toast.makeText(this, "NPE", Toast.LENGTH_LONG).show(); } catch (Exception e) { Toast.makeText(this, "E", Toast.LENGTH_LONG).show(); }
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/32799780
favorite count: 0
upvote count: 2
has title: Application not working on emulator other than 2.2 API level
has comment: http://stackoverflow.com/comment/32799946
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32799241

http://stackoverflow.com/comment/32814608
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21702880
type: Comment
has text: You can define list of allowed and chars "+-.0123456789" and check whether allowed chars were enrered. I would recomment to use regular expression (see for example http://stackoverflow.com/questions/9011524/javascript-regexp-number-only-check)

http://stackoverflow.com/q/21816582
tagged with: arrays
has title: How to read a text file into an array with private fields using mutators in Java
has answer: http://stackoverflow.com/a/21816944
type: UnansweredQuestion
tagged with: mutators
tagged with: java
linked to: http://stackoverflow.com/q/6100148
has answer: http://stackoverflow.com/a/21817476
has body: I have Googled this for a couple of days without much luck. I am trying to read a text file and use that information to populate the private fields of an array for a class object. I am new to Java and pretty new to programming in general. What I've come up with for reading into the array seems really clunky and I feel there must be a better way, but I cannot find a good example for this particular kind of case case. Creating a bunch of string variables was the only way I could get this to work. Perhaps main is a bad place to do this; perhaps Scanner is a poor choice here? What better ways are there to implement this situation? My text file that contains Strings and integers separated by whitespace on lines is similar to this: Joe 2541 555-1212 345 1542 Type Bob 8543 555-4488 554 1982 Type ... etc. Here's my majority of my code thus far which is within main: Scanner in = new Scanner(new FileReader("accounts.txt")); //filename to import Accounts [] account = new Accounts [10]; int i = 0; while(in.hasNext()) { account[i] = new Accounts(); String name = in.next(); String acct_num = in.next(); String ph_num = in.next(); String ss_num = in.next(); int open_bal = in.nextInt(); String type = in.next(); account[i].setName(name); account[i].setAcctNum(acct_num); account[i].setPhoneNum(ph_num); account[i].setSSNum(ss_num); account[i].setOpenBal(open_bal); account[i].setType(type); i++; } class Accounts { public Accounts() { } public Accounts(String n, String a_num, String ph_num, String s_num, int open_bal, String a_type, double close_bal) { name = n; account_number = a_num; phone_number = ph_num; ssn = s_num; open_balance = open_bal; type = a_type; close_balance = close_bal; } public String getName() { return name; } public void setName(String field) { name = field; } public String getAcctNum() { return account_number; } public void setAcctNum(String field) { account_number = field; } //And so forth for the rest of the mutators and accessors //Private fields private String na…
type: Question
score: 0
linked to: http://stackoverflow.com/q/691184
answer count: 2

http://stackoverflow.com/a/21776510
has comment: http://stackoverflow.com/comment/33047712
has comment: http://stackoverflow.com/comment/32949933
has comment: http://stackoverflow.com/comment/32950148
upvote count: 1
has comment: http://stackoverflow.com/comment/32946031
answers question: http://stackoverflow.com/q/21775370
type: Answer
has body: Here is how I manage layers of canvas: public abstract class Layer extends Composite { /** * The canvas used in this layer */ private Canvas m_canvas; public Layer() { m_canvas = Canvas.createIfSupported(); initWidget( m_canvas ); } /** * Get the name of the layer (debug purpose only) * @return the name of the layer */ protected abstract String getLayerName(); /** * Set the z-index of the layer * @param zindex the new z-index */ public void setZ( int zindex ) { m_canvas.getElement().getStyle().setZIndex( zindex ); } public int getZ() { return Integer.parseInt( m_canvas.getElement().getStyle().getZIndex() ); } @Override public void setPixelSize( int width, int height ) { super.setPixelSize( width, height ); m_canvas.setCoordinateSpaceWidth( width ); m_canvas.setCoordinateSpaceHeight( height ); } /** * Draw the layer */ public void draw() { } /** * Get the context2d where this layer will be drawn * * @return the Context2d */ public final Context2d getContext2d() { return m_canvas.getContext2d(); } /** * Clear the layer */ public void clear() { Context2d context2d = getContext2d(); if ( m_canvas != null &amp;&amp; m_canvas.isAttached() ) { context2d.clearRect( 0, 0, m_canvas.getOffsetWidth(), m_canvas.getOffsetHeight() ); } } public LayoutPanel getEnclosingLayoutPanel() { return (LayoutPanel)getParent(); } } and to add it: public void addLayer( Layer layer, int zindex ) { // m_main is a LayoutPanel int width = m_main.getOffsetWidth(); int height = m_main.getOffsetHeight(); m_layers.add( layer ); layer.setZ( zindex ); if ( m_main.getWidgetCount() &gt; 0 ) { m_main.insert( layer, 1 ); } else { m_main.add( layer ); } layer.setPixelSize( width, height ); (...)
downvote count: 0
score: 1

http://stackoverflow.com/comment/32820270
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21706260
has text: Why not get a read only Connection to your database? (Connection.setReadOnly(true);)

http://stackoverflow.com/q/21798257
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21801719
type: Question
tagged with: google-play-services
has body: I've just added google play services leaderboard to my game, but there are some problems. I can't start leaderboard activity. Here is my code startActivityForResult(Games.Leaderboards.getLeaderboardIntent(getApiClient(), "leaderboard_id"), 5000); problem is that there isn't any getApiClient() method. Any idea?
has answer: http://stackoverflow.com/a/21802566
tagged with: google-play-games
answer count: 3
upvote count: 1
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/31396558
type: UnansweredQuestion
has title: No getApiClient() in google play game services BaseGameUtils
downvote count: 0

http://stackoverflow.com/q/21759592
answer count: 1
tagged with: httpurlconnection
favorite count: 0
has body: I have to upload a binary image file to the server using multi-part, I open the connection to the https url and write diretly to to the outputstream. I have tried the SSLSocket, apache http client, but in all ways I get the error message, java.io.IOException: Error writing to server. I have to write post params with the multi-part binary file. The code is given below, where am I failing to see the mistake in this code below? And, I have given the sample data to write the data to the connection. I would be glad if anyone could give some idea how to do this with apache http client, which I do not know. example packet data header part -------------- --aabbaabbaabbxx Content-Disposition: form-data; name="to" &lt;recipient&gt; --aabbaabbaabbxx Content-Disposition: form-data; name="from" &lt;sender&gt; --aabbaabbaabbxx Content-Disposition: form-data; name="file"; filename="&lt;file_hash&gt;.jpg" Content-Type: image/jpeg footer ----------- --aabbaabbaabbxx-- Are these request parameters? ----------------------------- POST &lt;full_url&gt; Content-Type: multipart/form-data; boundary=aabbaabbaabbxx Host: &lt;host_name&gt; User-Agent: &lt;agent&gt; Content-Length: &lt;file_size&gt; The code final URL uri = new URL(uploadUrl); String boundary = "aabbaabbaabbxx"; HttpURLConnection connection = (HttpURLConnection) uri.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); connection.setAllowUserInteraction(false); connection.setRequestMethod("POST"); connection.setUseCaches(false); OutputStream writer = null; try { writer = connection.getOutputStream(); // post writer.write(MessageFormat .format("POST {0}\r\n", uploadUrl) .getBytes("UTF-8")); writer.write(MessageFormat .format("Content-Type: multipart/form-data; boundary={0}\r\n", boundary).getBytes("UTF-8")); writer.write(MessageFormat.format("Host: {0}\r\n",uri.getHost()).getBytes("UTF-8")); writer.write(MessageFormat.format("User-Agent: {0}\r\n",Constants.Use…
tagged with: apache-httpclient-4.x
tagged with: io
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: https
type: Question
accepted answer: http://stackoverflow.com/a/21762955
has answer: http://stackoverflow.com/a/21762955
has title: Uploading file in a https url in post method - java.io.IOException: Error writing to server - Java
upvote count: 1

button
tags question: http://stackoverflow.com/q/21810137
tags question: http://stackoverflow.com/q/21836124
tags question: http://stackoverflow.com/q/21823610
tags question: http://stackoverflow.com/q/21767217
tags question: http://stackoverflow.com/q/21688475
tags question: http://stackoverflow.com/q/21702628
tags question: http://stackoverflow.com/q/21695997
tags question: http://stackoverflow.com/q/21800543
tags question: http://stackoverflow.com/q/21812591
tags question: http://stackoverflow.com/q/21779290
tags question: http://stackoverflow.com/q/21804478
tags question: http://stackoverflow.com/q/21832803
type: Tag
tags question: http://stackoverflow.com/q/21841545
tags question: http://stackoverflow.com/q/21787733
tag name: button
tags question: http://stackoverflow.com/q/21792899
tags question: http://stackoverflow.com/q/21794591

http://stackoverflow.com/a/21800651
type: Answer
score: 3
downvote count: 0
upvote count: 3
has body: The code that is causing your error is not shown in your code above. It is where you call the assign method. When you are calling it, the String is empty, and so you're trying to convert "" into a number which makes sense should throw this exception. Note the exception message is telling you all this: Exception in thread "main" java.lang.NumberFormatException: empty String: The String is empty -- no number in it. at fksdfs.test1.assign(test1.java:69) It's occurring at line 69 of test1.java where you all assign. The fix: don't do this, don't try to parse an empty String. Test if the String is empty first, or do your parsing in a try/catch block. As an aside, please put in the effort to post well formatted code when asking questions here. We're volunteers and as such expect you to do put in the effort so that it isn't unduly hard to read and understand your code if you're asking us for help. Also, avoid doing all this stuff in the main method or using static methods such as your assign method. This method should be an instance method, and most all of your code should be in a proper OOP class. You will want to learn how to create classes and basics of Java before trying to create complex GUI's, and the Java Tutorials can help.
answers question: http://stackoverflow.com/q/21800606

http://stackoverflow.com/comment/33024932
comment on: http://stackoverflow.com/q/21821114
score: 0
type: Comment
type: QuestionComment
has text: Edit this question http://stackoverflow.com/questions/21820588/summing-up-a-2d-array instead of posting a whole new question about the same problem.

http://stackoverflow.com/a/57373937
downvote count: 1
score: 3
answers question: http://stackoverflow.com/q/21725093
upvote count: 4
type: Answer
has body: Rest-assured provide an as(java.lang.reflect.Type) next to the version expecting a Class used in the question. java.lang.reflect.Type type; //TODO defines the type. Response response = get("/artwork"); List&lt;Artwork&gt; returnedArtworks = response.getBody().as(type) In my opinion the way the type variable depends from the serialization lib that is used. If using Gson, as pointed out by Purushotham's answer, TypeToken can be used. I prefer using it directly in rest-assured: Type type = new TypeToken&lt;List&lt;Artwork&gt;&gt;(){}.getType(); Response response = get("/artwork"); List&lt;Artwork&gt; returnedArtworks = response.getBody().as(type) When using Jackson, the solution is to use the TypeFactory (javadoc, source) to tell to which type it should be de-serialized: Type type = TypeFactory.defaultInstance().constructCollectionLikeType(ArrayList.class, Artwork.class); Response response = get("/artwork"); List&lt;Artwork&gt; returnedArtworks = response.getBody().as(type)

http://stackoverflow.com/q/21807811
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21807827
tagged with: java
tagged with: andengine
has title: weird warning in my disposeSplashScene
has body: I am new Programmer , And I using andengine to develope a game, i juss keep on gettin this weird warning called The method disposeSplashScene() from the type SceneManager is never used locally i wanted to initialize my splash scene and dispose is when its no longer required here is the code public void createSplashScene(OnCreateSceneCallback pOnCreateSceneCallback) { ResourcesManager.getInstance().loadSplashScreen(); splashScene = new SplashScene(); currentScene = splashScene; pOnCreateSceneCallback.onCreateSceneFinished(splashScene); } private void disposeSplashScene() { ResourcesManager.getInstance().unloadSplashScreen(); splashScene.disposeScene(); splashScene = null; }
type: Question
has answer: http://stackoverflow.com/a/21807827
answer count: 1
score: 0
tagged with: android

http://stackoverflow.com/q/21802212
has title: Java: Why isn't this JFrame button displaying?
has body: Basically, all i wan't is for this button to display. It was working in another program I had earlier but it doesn't seem to be working in this one and i have no idea why. If anyone could help that would be great. public void fixtureList() { JButton editButton; setLayout(null); editButton = new JButton("Edit"); editButton.setBounds(200, 200, 100, 100); add(editButton); } public void loginPanel() { setLayout(null); JButton loginButton; loginButton = new JButton("Login"); loginButton.setBounds(10, 10, 100, 100); add(loginButton); loginButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //Execute when button is pressed fixtureList(); System.out.println("Loading the fixtures screen"); } }); }
score: 0
has answer: http://stackoverflow.com/a/21802235
possible better answer: http://stackoverflow.com/a/21802274
tagged with: swing
has answer: http://stackoverflow.com/a/21802274
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21802235
answer count: 2

http://stackoverflow.com/comment/32875152
type: QuestionComment
has text: I can't reproduce it either with 4.0.0+. Works for 3.0.5 as well.
comment on: http://stackoverflow.com/q/21732407
score: 0
type: Comment

http://stackoverflow.com/comment/32913659
type: Comment
type: QuestionComment
has text: There is a typo: Cookies.setCookie**t**("myapp-tour-done", "yes"); If the typo is not the problem could you tell us what the problem is ? Do you mean the cookie is not saved or that you can't retrieve it ?
comment on: http://stackoverflow.com/q/21758811
score: 0

http://stackoverflow.com/comment/33053566
has text: @solvator the performance cost is not so high as you may think...
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21837420

http://stackoverflow.com/a/21751709
has body: Have you looked at DecimalFormat (a derivation of the abstract NumberFormat)? You can customise the format to your needs. DecimalFormat myFormatter = new DecimalFormat("###,###.###"); String output = myFormatter.format(value); Note also that you can determine formatting based upon the locale.
upvote count: 2
answers question: http://stackoverflow.com/q/21751658
type: Answer
downvote count: 0
score: 2

http://stackoverflow.com/comment/32890974
type: AnswerComment
type: Comment
has text: As an example, it gets called three times and returns three 0's (through the randomness) - the fourth time it gets caught by the threshold and automatically returns a 1 (no need to repeatedly ask `Random` until you get a 1 since it's the only other result - return it and reset the counter. Next time you call the function it will delegate to `Random` again, and may return a 1 (increment the counter), or 0 (reset the counter)
comment on: http://stackoverflow.com/a/21745921
score: 0

http://stackoverflow.com/comment/33216761
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21820644
type: QuestionComment
has text: Please don't hesitate to update the official JogAmp wiki when your ported tutorials are ready. We would be glad to look at your source code and some other beginners could benefit of it.

http://stackoverflow.com/a/21795546
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/21789548
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21789548
score: 4
has body: Well, JSON format of your response doesn't fit your interface, it should be: interface service { @GET("/muzei.php") Map&lt;String,Photo&gt; getPopularPhotos(); static class Photo { int id; String user; String title; String url; } } And response: Map&lt;String, Photo&gt; response = service.getPopularPhotos(); Then just re-write your code after you get response to iterate through it
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32979445

http://stackoverflow.com/q/21800790
answer count: 2
upvote count: 1
tagged with: sh
has answer: http://stackoverflow.com/a/31375463
tagged with: java
type: UnansweredQuestion
downvote count: 0
tagged with: runtime
has answer: http://stackoverflow.com/a/23630561
has body: I have a game, and I am going to enable auto-restarting features. It will happen every 24 hours, which is easy to make. However, the problem is, I don't know how to open run "run.sh" (which executes the Java Game Server). The code is going to shut down everything first, and right before System.exit is called, it should open the run.sh in a new terminal. How would I do this? This is the method I am currently using, but it's giving me this error. public static boolean start() { try { List&lt;String&gt; command = new ArrayList&lt;String&gt;(); command.add("cd /root/Dropbox/[SALLESY] 742 Server"); command.add("java -Xmx1024m -Xss2m -Dsun.java2d.noddraw=true -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=16 -XX:+UseParallelGC -classpath bin:data/libs/* com.sallesy.Application"); ProcessBuilder builder = new ProcessBuilder(command); Process proc = builder.start(); BufferedReader read = new BufferedReader(new InputStreamReader( proc.getInputStream())); try { proc.waitFor(); } catch (InterruptedException e) { System.out.println(e.getMessage()); } while (read.ready()) { System.out.println(read.readLine()); } } catch (Exception e) { System.out.println(e.getMessage()); return false; } return true; } Error: sh script.sh Cannot run program "cd /root/Dropbox/[SALLESY] 742 Server": error=2, No such file or directory Could not start a new session...
score: 1
favorite count: 0
tagged with: terminal
tagged with: linux
type: Question
linked to: http://stackoverflow.com/q/525212
has comment: http://stackoverflow.com/comment/32988353
has title: Run A .sh script from java

http://stackoverflow.com/q/21701736
has comment: http://stackoverflow.com/comment/32813183
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32813609
type: Question
has comment: http://stackoverflow.com/comment/32825128
has comment: http://stackoverflow.com/comment/32811860
has body: I am attempting to save a bitmap image as base64 then write the base64 to a file, this all appears to work but when I attempt to load the output in a .net application I get an error 'The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.' The image is created from a canvas using: mBitmap = Bitmap.createBitmap (mContent.getWidth(), mContent.getHeight(), Bitmap.Config.RGB_565);; I use to encode the base64 string: String ba1= encodeTobase64(mBitmap); Is it writing the base 64 to a file that is causing the error or is my method incorrect?
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/32813019
has comment: http://stackoverflow.com/comment/32812207
has title: Base 64 string corrupt
has comment: http://stackoverflow.com/comment/32812127
has comment: http://stackoverflow.com/comment/32883619

http://stackoverflow.com/a/21722446
answers question: http://stackoverflow.com/q/21722018
has body: exec(String command, String[] envp, File dir) Executes the specified string command in a separate process with the specified environment and working directory. command is the location of the .exe envp can be null dir is the directory of your .exe With respect to your question it should be... Runtime.getRuntime().exec("c:\\program files\\chrome\\chrome.exe", null, new File("c:\\program files\\chrome");
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/33011279
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21813168
has text: See also http://stackoverflow.com/questions/40480/is-java-pass-by-reference

http://stackoverflow.com/q/21696987
has title: how to pass parameter to camel custom datafotmat?
answer count: 0
has comment: http://stackoverflow.com/comment/32842665
score: 1
tagged with: java
has body: I am new to camel i have implemented custom dataformat Now i want to use custom property in marshel or unmarshal method. Is this possible to do this in camel? please give example if there is any way. My custom dataformat code is as follows package com.camel.spring.test.dataFormat; import groovy.xml.MarkupBuilder; import java.io.InputStream; import java.io.OutputStream; import java.io.StringWriter; import java.util.HashMap; import org.apache.camel.Exchange; import org.apache.camel.spi.DataFormat; import com.predic8.wsdl.Definitions; import com.predic8.wsdl.WSDLParser; import com.predic8.wstool.creator.RequestCreator; import com.predic8.wstool.creator.SOARequestCreator; public final class SOAPDataFormat implements DataFormat { public void marshal(Exchange exchange, Object dataDefination, OutputStream stream) throws Exception { WSDLParser parser = new WSDLParser(); Definitions wsdl = parser .parse("http://localhost:8081/Myservice/services/TestService?wsdl"); StringWriter writer = new StringWriter(); HashMap&lt;String, Object&gt; formParams = new HashMap&lt;String, Object&gt;(); SOARequestCreator creator = new SOARequestCreator(wsdl, new RequestCreator(), new MarkupBuilder(writer)); creator.setBuilder(new MarkupBuilder(writer)); creator.setDefinitions(wsdl); creator.setFormParams(formParams); creator.setCreator(new RequestCreator()); creator.createRequest("TestService", "getApplication","TestServiceHttpBinding"); stream.write(writer.toString().getBytes()); } public Object unmarshal(Exchange exchange, InputStream stream) throws Exception { return null; } } my route configuration is &lt;camel:route&gt; &lt;from uri="file:d:/inbox/wsJson?noop=true" /&gt; &lt;marshal &gt; &lt;custom ref="soapDataFormat" /&gt; &lt;/marshal&gt; &lt;to uri="cxf://http://localhost:8081/Myservice/services/TestService?wsdlURL=http://localhost:8081//Myservice/services/TestService?wsdl&amp;amp;serviceName={http://service.application.atpl.com}TestService&amp;amp;portName={http://service.application.…
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32819231
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/33116643
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33101641
tagged with: spring

http://stackoverflow.com/q/21700467
downvote count: 0
has answer: http://stackoverflow.com/a/21700504
favorite count: 0
upvote count: 30
has body: Example code: modifyMyList(myList); public void modifyMyList(List someList){ someList.add(someObject); } or: List myList = modifyMyList(myList); public List modifyMyList(List someList){ someList.add(someObject) return someList; } There is also a 3rd option I believe: You can create a new List in modifyMyList method and return this new List... ( 3rd option is here, I was too lazy but someone already added it in the answers: ) List myList = modifyMyList(myList); public List modifyMyList(List someList){ List returnList = new ArrayList(); returnList.addAll(someList); returnList.add(someObject); return Collections.unmodifiableList(returnList); } Is there any reason why I should choose one over another? What should be considered in such case?
has comment: http://stackoverflow.com/comment/32826929
accepted answer: http://stackoverflow.com/a/21700657
score: 30
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/72828205
tagged with: list
has answer: http://stackoverflow.com/a/21700558
has comment: http://stackoverflow.com/comment/32812425
tagged with: java
has comment: http://stackoverflow.com/comment/32809376
has answer: http://stackoverflow.com/a/21700653
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/21702942
has comment: http://stackoverflow.com/comment/32810393
has answer: http://stackoverflow.com/a/21702054
has title: Which is good practice - Modifying a List in the method, or returning a new List in the method?
linked to: http://stackoverflow.com/q/11561817
possible better answer: http://stackoverflow.com/a/21702942
has answer: http://stackoverflow.com/a/21700657
has answer: http://stackoverflow.com/a/21700822

http://stackoverflow.com/comment/32802968
comment on: http://stackoverflow.com/q/21696502
score: 0
type: Comment
has text: Chris: in the constructor, it doesnt specify how it creates an empty list so I still cant figure out how.
type: QuestionComment

http://stackoverflow.com/comment/32916799
score: 2
has text: It looks to me you are (at least) missing a curly bracket around the code after `if(filter1[i][j] == 0)` in the double `for` loop. And shouldnt your first row be `1 2 1 2 1 1 2` ... not all `2`s?
comment on: http://stackoverflow.com/q/21760286
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21804170
upvote count: 3
has comment: http://stackoverflow.com/comment/32998738
has comment: http://stackoverflow.com/comment/33016462
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33017570
has comment: http://stackoverflow.com/comment/32998732
has comment: http://stackoverflow.com/comment/33004375
answers question: http://stackoverflow.com/q/21803831
type: Answer
has comment: http://stackoverflow.com/comment/33017604
has comment: http://stackoverflow.com/comment/33013446
has body: The dependency is not include because you don't create a distribution of you project. In Maven it is called an assembly. If you call your application directly from the commandline it is not a matter of Gradle. Anyway there is a Gradle plugin which creates a distribution and adds shell scripts to execute your application. So when you add the following line to the gradle script. apply plugin: 'application' you will get some new tasks to create a distribution.
accepted answer of: http://stackoverflow.com/q/21803831
has comment: http://stackoverflow.com/comment/33016429
score: 3

http://stackoverflow.com/comment/91934202
comment on: http://stackoverflow.com/a/21712184
score: 0
type: Comment
has text: Awesome, thanks! Looks like you inlined the standard `DateTime.parse()` method, and inserted that extra `withChronology()` call.
type: AnswerComment

http://stackoverflow.com/comment/32786822
type: QuestionComment
type: Comment
has text: Read up on recursion because this is what you will want to use. You'll need to create your own method and not just use a main method for this to work.
score: 0
comment on: http://stackoverflow.com/q/21687576

http://stackoverflow.com/a/21763206
has body: Not sure what happened but I just moved the saving of cookie from the EntryPoint class into some other page and it works fine now.
answers question: http://stackoverflow.com/q/21758811
score: 0
type: Answer

http://stackoverflow.com/comment/32894895
type: Comment
comment on: http://stackoverflow.com/q/21745356
score: 0
has text: Have you installed the correct version of the native library as well?
type: QuestionComment

http://stackoverflow.com/comment/32826980
type: QuestionComment
comment on: http://stackoverflow.com/q/21709997
has text: The image is located in the same package of .java files
score: 0
type: Comment

http://stackoverflow.com/comment/33208569
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21723663
has text: That could help, but as I mentioned in my question I'm using Spring AOP(limited pointcut designators) not the pure implementation of AspectJ.

http://stackoverflow.com/comment/32953283
comment on: http://stackoverflow.com/a/21780654
has text: So you are saying that the SQLException#iterator method performs a depth first traversal of the Exception tree? Cause it's really a tree, as theoretically the `getCause` of a SQLException instance (at some depth) could return another SQLException, with its own chained exceptions. Now, I only wish for method to stringify all that exception tree both in deptn (like Apache lang3 ExceptionUtils#getStackTrace which keeps digging on the #getCause method) and in breadth (along the chained SQLExceptions) so I can log a single, all-encompassing `String` object.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21821651
has title: list of java mqtt brokers and its scalability in windows
type: Question
score: 0
answer count: 2
has body: I want to achieve push notifications in android. I don't want to use GCM for some reasons and hence started working with MQTT. I am currently using Mosquitto MQTT broker. I need to know the limit on number of clients connections that the Mosquitto broker can handle on windows? I am in need of a Java MQTT Broker and found HiveMQ and Moquette. Is there any other? HiveMQ allows only 25 simultaneously connected clients for free and hence i don't want to use that. I need details regarding how to use Moquette and how scalable it is on Windows? Thanks in Advance! Expecting some quick and clear replies please..Thanks again.
has answer: http://stackoverflow.com/a/21823458
tagged with: mqtt
tagged with: mosquitto
tagged with: android
tagged with: windows
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27562188
tagged with: java

http://stackoverflow.com/q/21787198
has comment: http://stackoverflow.com/comment/32963904
has comment: http://stackoverflow.com/comment/32964102
has comment: http://stackoverflow.com/comment/32964149
has comment: http://stackoverflow.com/comment/32964086
has answer: http://stackoverflow.com/a/21787236
has title: Java main: args.length incorrect?
favorite count: 0
has body: I print args.length, it says 5. I also print the arguments via for(int i = 0; i &lt; args.length;i++) and i see 4 arguments. What's wrong here? Heres the code: System.out.println(args.length); for(int i = 0; i &lt; args.length; i++){ System.out.println(args[i]); } and my arguments are: ~/Desktop/Master_Bioinformatik/Data_Mining_in Bioinformatics/Project/stockori/joint.csv 2 3.2 euclidean EDIT: okay i oversaw something, actually the output is: 5Exception in thread "main" ~/Desktop/Master_Bioinformatik/Data_Mining_in Bioinformatics/Project/stockori/joint.csv 2 3.2 euclidean that exception phrase is written in red. i thought it was some graphics error. but it reappears. why is that?
has comment: http://stackoverflow.com/comment/32963950
has answer: http://stackoverflow.com/a/21787339
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/32963983
has comment: http://stackoverflow.com/comment/32963963
tagged with: java
has comment: http://stackoverflow.com/comment/32964839
type: Question
has comment: http://stackoverflow.com/comment/32964993
answer count: 2
upvote count: 0
score: -2

http://stackoverflow.com/q/21792140
tagged with: rsyntaxtextarea
score: -1
has body: I'm trying to add a custom language to RSyntaxTextArea and I keep getting NullPointerException, I don't know the reason since I followed all the steps on http://fifesoft.com/rsyntaxtextarea/doc/CustomSyntaxHighlighting.html The custom syntax class: http://pastie.org/private/ttadaprzxe9ad0vtgnfeyg My main class: http://pastie.org/private/kshg6cnrbm495ruipxla#26 I get the NullPointerException on line 26. I didn't change anything from the Developer's Documentation, besides getWordsToHighlight, So I don't really know what may be causing the error. I tried to figure what caused the Exception, but cant figure it out :/
upvote count: 0
answer count: 1
favorite count: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/21792158
accepted answer: http://stackoverflow.com/a/21792158
type: AnsweredQuestion
tagged with: java
downvote count: 1
has title: RSyntaxTextArea NullPointerException when adding new language
type: Question

http://stackoverflow.com/comment/32974474
has text: You would create implementation of the interface for every different thing that you do inside for loop. Then you would call your method with those different implementations depending on your needs.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21792631
type: AnswerComment

http://stackoverflow.com/q/21798292
has comment: http://stackoverflow.com/comment/34452187
type: Question
has title: Map Reduce Job in Apache Hadoop 2.0
tagged with: mapreduce
has answer: http://stackoverflow.com/a/21808453
tagged with: hadoop
score: 0
answer count: 2
tagged with: apache
tagged with: hadoop-streaming
has answer: http://stackoverflow.com/a/21814698
has body: I am following Michael Noll tutorial for setting up Multi-Node cluster and running a sample MapReduce Program. I am setting up Hadoop version 2.2.0. There is no contrib directory in Hadoop 2.2.0. I searched for jars using find command from the current directory. The search result was My Question is How to run a mapreduce program in Hadoop Multi-Node Cluster Environment ?
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/21696108
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21695917
has body: Clearly a MusicEvent is not a Rating, a MusicEvent has a Rating, so that gives you your answer. However, what you might want to do later is to have an interface called Rateable, or something like that, with setRating() and getRating() abstract methods. This might be useful if you at some point in future have lots of different classes, some of which carry a rating and some don't.

http://stackoverflow.com/q/21832872
tagged with: java
has comment: http://stackoverflow.com/comment/33046460
has comment: http://stackoverflow.com/comment/33048383
type: Question
has comment: http://stackoverflow.com/comment/33047192
score: 0
has comment: http://stackoverflow.com/comment/33046805
linked to: http://stackoverflow.com/q/7705510
has comment: http://stackoverflow.com/comment/33046795
has title: Infinite scroll like behaviour on loop
answer count: 0
type: UnansweredQuestion
tagged with: android
has body: I have in my android app a code snippet that uses a loop for making/drawing rectangles. int total_rect = 2000;//This nr should not have to be here. float rect_positions[][] = new float[total_rect][2]; for(int i =0;i&lt;total_rect;i++){ rect_positions[i][0] = 600 + i*300 ; rect_positions[i][1] = rand.nextFloat() * 0.8f + 0.1f; } They appear every 300 DP when the game scrolls. The reason is that i wanted it to be endless of rectangles so i dont want to set a specific nr to it. But i have(?) to make an initial nr to run the loop. (not really sure about this...) So what i want to know is: Is there any other(better) way to do this because now i get REALLY low fps and it is lagging like h3ll due to all the calculations for the loop. Maybe something in the lines of : int total_rect = 5; when i&gt;4 run loop again //This is what i dont know how to code... That should work i think. Or maybe something like when rect_positions&gt;last_rectposition + 1500 run loop again //This is the one i think would be the best alternative because that would meen that the further you get the more loops it will be. Or is it anyone that have a different idea?
has comment: http://stackoverflow.com/comment/33047092
has comment: http://stackoverflow.com/comment/33045137
tagged with: performance

http://stackoverflow.com/q/21682666
favorite count: 0
has title: Problematic Cookie class binding with Jetty 8
has comment: http://stackoverflow.com/comment/32865346
tagged with: jetty-8
has body: I'm trying to upgrade Jetty version from 7.4 to one compliant with servlet 3.0 specification like 8.1.4, as well as GWT from 2.3 to 2.5. While doing so, I found that jetty's Response.addCookie(Cookie) method calls for a method in Cookie class that hasn't been declared or implemented, resulting in the following error: javax.servlet.http.Cookie.isHttpOnly()Z at org.eclipse.jetty.server.Response.addCookie(Response.java:161) I already checked, and servlet-3.0's Cookie class has the isHttp() method, but gwt-user.jar has another implementation not compliant with servlet 3.0(meaning it doesn't define that method, as well as some others). At this point, I'm not sure to what code it's binding, and I can't debug the code(it is executed in a server for which I can only access log files and jars) Changing the order of dependencies in the pom file proved unsuccessful, so I've run out of ideas. PD: There is also a dependency for j2ee-1.4 jar, which has a Cookie class not compliant with Servlet 3.0
score: 2
linked to: http://stackoverflow.com/q/21888983
answer count: 0
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/33148327
tagged with: cookies
has comment: http://stackoverflow.com/comment/32866751
tagged with: java
tagged with: servlets
downvote count: 0
has comment: http://stackoverflow.com/comment/32779461

http://stackoverflow.com/a/21752239
answers question: http://stackoverflow.com/q/21752156
type: Answer
score: 2
downvote count: 0
has body: The Exception pretty much says it all - check your credentials (which you obviously have not given) with the database.
upvote count: 2

http://stackoverflow.com/a/21799014
score: 0
has body: Yes something its not quite right here because as i see you are saving nothing. on shared pref you should have a "key" which will be use to identify the saved value in your example it should be something like this public class ConfigPage extends Activity { public static final String PREFS_NAME = "MyPrefsFile"; public static final String COLLECTIONID_KEY = "COLLECTIONID_KEY"; Button mButton; EditText mEdit; String collectionID; String savedID; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.config); getActionBar().hide(); mButton = (Button)findViewById(R.id.setCollection); mEdit = (EditText)findViewById(R.id.collectionName); mButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { collectionID = mEdit.getText().toString(); Log.d("EditText", collectionID); } }); SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString(COLLECTIONID_KEY, collectionID); editor.commit(); Log.d("Saved as", COLLECTIONID_KEY); } } then to retrieve it : SharedPreferences sharedPreferences = getSharedPreferences(PREFS_NAME, 0); String mySavedCollectionID = sharedPreferences.getString(COLLECTIONID_KEY); and make sure that its done on the Onclick event otherwise you might end up with crash again because after the on-click event in your code the lines below will run anyway and save null!
type: Answer
answers question: http://stackoverflow.com/q/21798883

http://stackoverflow.com/q/21678327
tagged with: service
has comment: http://stackoverflow.com/comment/32769981
has comment: http://stackoverflow.com/comment/32771067
type: UnansweredQuestion
score: 1
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32769985
has body: I'm try to use the onStop() method, but the code is not executed when it's called. I'm using a TabHost to move from an activity to another. This code should work when I move to another tab. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_battery); SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(BatteryActivity.this); prefs.edit().putInt("BatteryActivity", Answer).apply(); prefs.edit().putInt("Battery", 10).apply(); } @Override protected void onStop() { super.onStop(); Toast.makeText(getApplicationContext(), "600", Toast.LENGTH_LONG).show(); ((MyApplication) BatteryActivity.this.getApplication()).setAnswerList(200); int radioButtonID = radioGroup.getCheckedRadioButtonId(); View radioButton = radioGroup.findViewById(radioButtonID); int idx = radioGroup.indexOfChild(radioButton); // ID of selected radiobutton switch(idx){ case R.id.RadioButton11: BatteryActivity.this.Answer = 23 ; break; case R.id.RadioButton08: BatteryActivity.this.Answer = 24 ; break; }
has comment: http://stackoverflow.com/comment/32770062
answer count: 1
downvote count: 0
has title: Onstop() not working
has answer: http://stackoverflow.com/a/21678972
favorite count: 0
has comment: http://stackoverflow.com/comment/32770073
tagged with: android
has comment: http://stackoverflow.com/comment/32770224

http://stackoverflow.com/q/21802840
answer count: 1
downvote count: 0
favorite count: 0
has body: So, i'm using Java and JFrame and i would like the end user to be able to click the button "Login" and it should display another saying "Edit". For some odd reason when the end-user clicks "Login" it doesn't show the "Edit" box but it displays the "System.out.println" import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main extends JFrame{ public void fixtureList() { JButton editButton; editButton = new JButton("Edit"); editButton.setBounds(100, 200, 100, 100); add(editButton); } public void loginPanel() { setLayout(null); JButton loginButton; loginButton = new JButton("Login"); loginButton.setBounds(10, 10, 100, 100); add(loginButton); loginButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //Execute when button is pressed fixtureList(); System.out.println("Loading the fixtures screen"); } }); } public static void main(String[] args) { Main window = new Main(); window.setTitle("PE Fixtures v1.0"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setSize(250, 430); window.loginPanel(); window.getContentPane().setBackground(new Color(53, 56, 64)); window.setVisible(true); } }
has comment: http://stackoverflow.com/comment/32992163
has answer: http://stackoverflow.com/a/21803017
upvote count: 1
has title: Java: Button isn't showing up
accepted answer: http://stackoverflow.com/a/21803017
tagged with: swing
has comment: http://stackoverflow.com/comment/32992078
has comment: http://stackoverflow.com/comment/32992516
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/32957257
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21783479
has text: Seems everybody posts the same answer simultaneously. +1 because you were first.
score: 0

http://stackoverflow.com/comment/33043510
type: Comment
has text: I don't understand why whenever I enter let's say a 1, it doesn't execute the code for Case 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21831590
score: 0

http://stackoverflow.com/q/21773967
has answer: http://stackoverflow.com/a/21775182
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/32941501
type: Question
possible better answer: http://stackoverflow.com/a/21774099
has answer: http://stackoverflow.com/a/21774186
has comment: http://stackoverflow.com/comment/32942239
score: 0
has answer: http://stackoverflow.com/a/21774904
accepted answer: http://stackoverflow.com/a/21774904
has comment: http://stackoverflow.com/comment/32941642
has body: I have seen numerous similar questions on stackoverflow but I can not figure out what I am doing wrong. I have made a very simple app to replicate the error. The app does the following: it adds a fragment in the MainActivty's onCreate. user can add another fragment from a dialog. when the dialog calls the MainActivity's addFragment method an exception is thrown on the commit of the transaction. Here is the MainActivity package com.example.testapp; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; import android.view.View; import android.widget.Button; public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button button = (Button) findViewById(R.id.add_button); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { AddButtonDialog addButtonDialog = new AddButtonDialog(); addButtonDialog.show(getSupportFragmentManager(), "ADD"); } }); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); CustomFragment fragment = new CustomFragment(); transaction.add(R.id.fragment_container, fragment); transaction.commit(); } public void addButton() { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); CustomFragment fragment = new CustomFragment(); transaction.add(R.id.fragment_container, fragment); transaction.commit(); // &lt;-- Exception } } and here is the AddButtonDialog that calls the MainActivity public class AddButtonDialog extends DialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); final LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.new_button_dialog, null); builder.setView(view) .setPositiveButton("Add", new DialogInterface.…
has comment: http://stackoverflow.com/comment/32941441
has answer: http://stackoverflow.com/a/21774099
has comment: http://stackoverflow.com/comment/32940887
tagged with: android
linked to: http://stackoverflow.com/q/9212574
has title: Android: IllegalStateException: Activity has been destroyed
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32942047

http://stackoverflow.com/comment/32792094
score: 0
comment on: http://stackoverflow.com/q/21687423
type: Comment
type: QuestionComment
has text: And sicachester, thank you for the help also!

http://stackoverflow.com/comment/33094041
has text: @DavidDossot I was able to solve this using the MEL expression you provided. Along the lines of #[app.registry.smtpConnector.contentType='#[header:mimetype]']. I'll edit in the final solution tomorrow.
comment on: http://stackoverflow.com/a/21832825
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/21797211
score: 3
has comment: http://stackoverflow.com/comment/32982340
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21797167
answers question: http://stackoverflow.com/q/21797167
type: Answer
downvote count: 0
has body: You're reading every char as a substring, and parse it as an int. So, you get for example "4" as the substring, and parse it to get the int 4. If you use charAt(), you'll get the char '4' instead. To transform it to the integer 4, you just need to subtract '0' from it: String en = encrypt_code[ch - '0']; Note that replacing the whole string by a new one at each iteration is time consuming. You should use a StringBuilder instead: StringBuilder x = new StringBuilder(); for (...) { x.append(en); } return x.toString();

http://stackoverflow.com/comment/32903641
comment on: http://stackoverflow.com/a/21746642
score: 0
type: AnswerComment
has text: @kleopatra Thanks for your suggestion. I asked for an example over my posted code. It seemed to me little complex as I am a beginner to programming java swing and the node also contains a component that is complex too. And sure I will try and if come up with a problem I will come to you.
type: Comment

http://stackoverflow.com/q/21784173
has body: So I have two separate programs, but I'm having trouble loading images on one and not the other. In the first one I have an image that I load as a texture in the mainGameScreen.java that is 800x480 pixels. Texture img1; img1= new Texture(Gdx.files.internal("bg1.png")); And it loads with no problem at all So first question why does one load and the other not even though the first is just kind of a landscape version of the second. In my second program I have an image that is 480x800. I load it however in Images.java. public class Images{ public static Texture img2; public static void load(){ img2 = new Texture (Gdx.files.internal("bg2.PNG")) It raises an error Texture width and height must be a power of 2 But then if I change the size of the image to 512x512 then it won't raise any errors, but I then get a blank screen with kind of static colors going through it when I render it. And then in my MyRenderer.java file I have a batch that I draw it to my batch. public class MyRenderer{ OrthographicCamera camera; public MyRenderer(){ camera = new OrthographicCamera(); camera.position.set(0, 0, 0); public void update; camera.update(); batch.SetProjectionMatrix(camera.combined) batch.begin(); batch.draw(Images.img2, 0, 0); batch.end ();
accepted answer: http://stackoverflow.com/a/21785477
has title: Loading images libgdx
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32959704
tagged with: android
tagged with: textures
has comment: http://stackoverflow.com/comment/32960317
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21785477
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: libgdx

http://stackoverflow.com/a/21776185
score: 2
accepted answer of: http://stackoverflow.com/q/21776096
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21776096
type: Answer
upvote count: 2
has body: Considering your example "zzz":"(*)+", here (*)+ doesn't mean anything to your example. You can replace it with "[^"]+" to match anything between quotes except the quote itself. For example: "zzz":"[^"]+" + for at least a character in it. If you replace + with * it will be zero or more character.

http://stackoverflow.com/a/21791366
has comment: http://stackoverflow.com/comment/32972087
has body: %10s tells the formatter to put spaces in front of the String if it is smaller than 10 characters. That's why you see no difference. If you put %15s you ask the formatter to put enough spaces to fill 15 characters with your String, and it will in your example put 3 spaces in front of it.
type: Answer
has comment: http://stackoverflow.com/comment/32972042
answers question: http://stackoverflow.com/q/21791317
has comment: http://stackoverflow.com/comment/32972008
accepted answer of: http://stackoverflow.com/q/21791317
has comment: http://stackoverflow.com/comment/32972106
has comment: http://stackoverflow.com/comment/32972028
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/21715634
has comment: http://stackoverflow.com/comment/32840348
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21715572
upvote count: 2
answers question: http://stackoverflow.com/q/21715572
has body: if(rs.next()) { JOptionPane.showMessageDialog(null, sql); You are displaying the SQL query text here, not the results from it. You need to get the results from the returned result set rs.

http://stackoverflow.com/a/21755583
has body: Well, to automate the black counter, you'd need to write some procedure that intelligently picks a move for the AI player. Ideally, that procedure would produce the BEST move the black player could make. Let's call that procedure makeBestMoveForBlack(). Then, you'd need to have your game identify when it was black's turn (which you're clearly doing through my1Turn) and instead of waiting for the player to make a move, it would call makeBestMoveForBlack(). Once the AI makes its move, it's the player's turn again. NOTE: This is not actual code, just a concept.
type: Answer
answers question: http://stackoverflow.com/q/21755289
score: 0

http://stackoverflow.com/comment/32898974
comment on: http://stackoverflow.com/a/21750377
type: AnswerComment
score: 0
type: Comment
has text: this usually happens because of class path. check your class path and make sure `catalina-ant.jar` is added correctly.

http://stackoverflow.com/comment/35894703
type: Comment
comment on: http://stackoverflow.com/a/21718267
score: 0
type: AnswerComment
has text: @Warde how did you fill this database? for example I have questions but they're in Text. Do you know any easy trick for text to sqlite or Are there any program for doing it automatic?

http://stackoverflow.com/comment/33021979
type: Comment
comment on: http://stackoverflow.com/a/21819527
score: 1
type: AnswerComment
has text: This answer, as written, is not useful. The OP already knows about `LinkedHashMap`.

http://stackoverflow.com/comment/33010523
comment on: http://stackoverflow.com/a/21813058
has text: I cant change in MongoDb is there a way to access it that way in Java?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21822257
has body: No, the HashMap will increase in size automatically to keep its load factor under the default of 0.75 if you don't specify anything. Even if you don't do anything explicitly about it, your HashMap will grow as you populate it, while keeping appropriately small if you don't use all 64 entries. The reason you'd want to specify in initial capacity is really just if you know in advance that you're going to fill it with at least that many entries, so that it won't have to rehash and reallocate while you're filling it up. In short: If you just leave HashMap to its defaults, it's usually alright. :)
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21822159
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21822159
type: Answer
downvote count: 0
score: 3

http://stackoverflow.com/comment/32994869
comment on: http://stackoverflow.com/q/21804233
score: 0
type: QuestionComment
has text: Try looking here: https://help.github.com/articles/set-up-git#platform-mac
type: Comment

http://stackoverflow.com/comment/32888517
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21743974
score: 0
has text: I have modified my question. Hope it helps. But I am sorry I cant give compilable code and whole details as it is very big and confidential too.

http://stackoverflow.com/comment/33016322
type: Comment
has text: Can you show us Person class?
comment on: http://stackoverflow.com/q/21816241
score: 0
type: QuestionComment

http://stackoverflow.com/q/21690413
favorite count: 0
has comment: http://stackoverflow.com/comment/32792647
has answer: http://stackoverflow.com/a/54174969
has title: Decoding floating point number in simple.json Java
type: UnansweredQuestion
tagged with: json-simple
has comment: http://stackoverflow.com/comment/32792784
score: 2
has comment: http://stackoverflow.com/comment/32792378
has comment: http://stackoverflow.com/comment/32793058
has body: I am trying to read and parse a json file using simple.json in Java. However, on floating point numbers I get error. How should I parse floating point numbers? The JSON File is like: [ { "region":"NF", "destination":"d1", "source":"s1", "time":2003, "value":0.1 }, { "region":"NF", "destination":"d2", "source":"s2", "time":2004, "value":0.002 }, ] My code to parse it is: JSONArray jsonArray = (JSONArray)obj; Iterator&lt;JSONObject&gt; iterator = jsonArray.iterator(); while(iterator.hasNext()){ JSONObject jsonObject = iterator.next(); String region = (String) jsonObject.get("region"); String src = (String) jsonObject.get("source"); String dst = (String) jsonObject.get("destination"); long time = (long) jsonObject.get("time"); long val = (long) jsonObject.get("value"); }
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 3
type: Question
upvote count: 5
has comment: http://stackoverflow.com/comment/32793009
has comment: http://stackoverflow.com/comment/32792377
has answer: http://stackoverflow.com/a/21690535
has comment: http://stackoverflow.com/comment/32792670
has comment: http://stackoverflow.com/comment/32792705
answer count: 3
has comment: http://stackoverflow.com/comment/32792676
has comment: http://stackoverflow.com/comment/32792502
has answer: http://stackoverflow.com/a/21690578
has comment: http://stackoverflow.com/comment/32792604

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/21763957
tag name: httpsurlconnection

http://stackoverflow.com/q/21713414
has answer: http://stackoverflow.com/a/32937484
tagged with: windows
downvote count: 0
has answer: http://stackoverflow.com/a/53391479
favorite count: 0
has answer: http://stackoverflow.com/a/71429977
has answer: http://stackoverflow.com/a/39512399
has answer: http://stackoverflow.com/a/35004003
has answer: http://stackoverflow.com/a/37131354
has answer: http://stackoverflow.com/a/57129729
has answer: http://stackoverflow.com/a/65196796
accepted answer: http://stackoverflow.com/a/21713480
has answer: http://stackoverflow.com/a/53505857
has body: I just installed IntelliJ IDEA and I'm trying to set it up. I've gotten to the part where I need to select my home directory for my JDK. I tried navigating to my Java installation, C:\Program Files (x86)\Java, and clicked okay but it told me the message above. So, I tried C:\Program Files (x86)\Java\jre7 and that didn't work either. I tried reinstalling the latest JDK (from here) and I still couldn't choose my JDK. I even dragged the .jar installer I got from the website and the file selector window wouldn't recognize it. I'm at a standstill and I don't know what to do.
score: 90
upvote count: 90
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/60347493
has answer: http://stackoverflow.com/a/72517813
has answer: http://stackoverflow.com/a/44349964
tagged with: java
has answer: http://stackoverflow.com/a/51007245
has title: IntelliJ IDEA "The selected directory is not a valid home for JDK"
has answer: http://stackoverflow.com/a/75697085
type: Question
possible better answer: http://stackoverflow.com/a/69410018
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/21713480
has answer: http://stackoverflow.com/a/69410018
answer count: 16

http://stackoverflow.com/q/21719081
linked to: http://stackoverflow.com/q/21276350
has comment: http://stackoverflow.com/comment/32844054
tagged with: java
tagged with: selenium
type: Question
tagged with: javascript
has body: Working with Selenium WebDriver and Java. I have tab name called PR Per Product. I have many tabs under PR Reports tab.. In that PR tab i used WebElement menuHoverLink = driver.findElement(By.id("ext-pr")); actions.moveToElement(menuHoverLink).perform(); But the same format i tried to click PR Per Product tab it is clicking some other tab. The element is targeting through the ID. Per Prod/SW Pack/RDT Group If i use this method it is exactly clicking the tab. But the problem it is not hovering and clicking. JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("arguments[0].click();", driver.findElement(By.id("Per Prod/SW Pack/RDT Group") )); Please help me for the issue..
tagged with: jquery
score: 0
has title: How can i create mouse event for clicking a tab- Selenium WebDriver?
has comment: http://stackoverflow.com/comment/32843406
answer count: 1
tagged with: tabs
has answer: http://stackoverflow.com/a/21722219
type: UnansweredQuestion

ejbca
type: Tag
tag name: ejbca
tags question: http://stackoverflow.com/q/21746163

http://stackoverflow.com/comment/33043039
type: AnswerComment
type: Comment
has text: There is nothing called "Java 4". It is Java 1.4. Sun start to call it Java 5 starting from Java 1.5. However, from 1.2 to 1.4, they are all Java 2. And, no, there is no alternative of String.fromat before Java 5, because there is no vararg support before Java 5
score: 1
comment on: http://stackoverflow.com/a/21831637

http://stackoverflow.com/a/21680300
has body: The argument passed to mark() is the readAheadLimit. From the documentation: readAheadLimit - Limit on the number of characters that may be read while still preserving the mark. An attempt to reset the stream after reading characters up to this limit or beyond may fail. A limit value larger than the size of the input buffer will cause a new buffer to be allocated whose size is no smaller than limit. Therefore large values should be used with care. Since you have specified 0, and the next readLine() call ends up reading something from the stream, the subsequent reset has a possibility of failing since you are over the limit. When you tell the stream to "mark" a location, you specify a read-ahead limit, which basically tells the stream to "remember" that many characters. As long as you don't read past the limit, you can call reset() how many ever times you want and it will reset it back to the beginning of that "remembered" set of characters. Once you read past that limit however, the mark is invalid and so subsequent calls to reset() will fail. In your case, you have specified a read-ahead limit of 0, which means any read past the current point will invalidate the mark, which is what you are seeing. To get around this, specify a non-zero read-ahead limit.
type: Answer
has comment: http://stackoverflow.com/comment/32773800
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21680035
score: 1
answers question: http://stackoverflow.com/q/21680035
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/32788890
type: Comment
type: QuestionComment
has text: Eclipse, at least, seems to want the description to be a string resource, IIRC.
comment on: http://stackoverflow.com/q/21688516
score: 0

http://stackoverflow.com/a/23836768
answers question: http://stackoverflow.com/q/21835352
has body: As per your flow registry flow definitions: 1) make sure all your flow definition files are under WEB-INF/pageFlows and 2) all your flow file names are ending in -flow.xml
type: Answer
score: 0

http://stackoverflow.com/q/21815279
tagged with: imageview
has title: Failed to show Default Images when passed imagename is not found in assets in Android?
score: 0
has answer: http://stackoverflow.com/a/21815365
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: Here is my code i have written to get images from assets folder by passing imagename from database.But when passedImage name is not found in assets folder then i want to show some dummy images my code is throwing only catch block when no image is found but its not showing default image and no log is print in case of image not found ..... private Bitmap getBitmapFromAsset(String strName) { AssetManager assetManager = getAssets(); InputStream istr = null; Bitmap bitmap = null; try { istr = assetManager.open(strName); if(istr.equals("null")) { Log.i("getBitmapFromAsset isStr",""+istr); bitmap = BitmapFactory.decodeStream(assetManager.open("save_fatwa.jpg")); } else { bitmap = BitmapFactory.decodeStream(istr); } } catch (Exception e) { Log.i("getBitmapFromAsset",""+bitmap); e.printStackTrace(); } return bitmap; }
tagged with: bitmap
tagged with: java
type: Question

http://stackoverflow.com/comment/32921803
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21763423
has text: Have you done a search for this on StackOverflow? Try http://stackoverflow.com/a/21540553/763080
type: Comment

http://stackoverflow.com/comment/32875362
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21737252
has text: List<T> query(String query, Map<String, ?> parametros); @JB Nizet
type: Comment

http://stackoverflow.com/comment/32909354
has text: tried out that workaround too but not succeed
score: 0
comment on: http://stackoverflow.com/q/21756309
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21697729
has body: I would rather use JSON object or Custom Java Object like: Class Flower{ List&lt;String&gt; Petal_length; List&lt;String&gt; Petal_Width; List&lt;String&gt; Sepal_length; List&lt;String&gt; Sepal_Width; } If you want say, range of petal length, at 0 index then, we can do some thing like String range = flower.Petal_length.get(0) With Object it is more flexible, if later you get new file or you plan to add new attribute
answers question: http://stackoverflow.com/q/21697520
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/32846639
score: 0
type: Comment
type: QuestionComment
has text: is there editText1 in xml?
comment on: http://stackoverflow.com/q/21721154

http://stackoverflow.com/comment/32940567
comment on: http://stackoverflow.com/q/21773446
score: 2
has text: The servlet API decodes parameters for you. The problem is on the client side. Show us the request.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32906252
type: QuestionComment
has text: Everyone: please see my update which includes a WARNing message I am getting just before the exception occurs.
comment on: http://stackoverflow.com/q/21734014
score: 0
type: Comment

gradle
tags question: http://stackoverflow.com/q/21803831
tags question: http://stackoverflow.com/q/21711395
tags question: http://stackoverflow.com/q/21721119
tags question: http://stackoverflow.com/q/21822869
tags question: http://stackoverflow.com/q/21764128
type: Tag
tag name: gradle
tags question: http://stackoverflow.com/q/21801765
tags question: http://stackoverflow.com/q/21700580
tags question: http://stackoverflow.com/q/21686930
tags question: http://stackoverflow.com/q/21686783
tags question: http://stackoverflow.com/q/21790033

http://stackoverflow.com/q/21790137
has answer: http://stackoverflow.com/a/21790227
type: Question
has answer: http://stackoverflow.com/a/21790319
has comment: http://stackoverflow.com/comment/32970049
has title: having trouble with arrays and maybe split
has comment: http://stackoverflow.com/comment/32969867
has comment: http://stackoverflow.com/comment/32969711
has comment: http://stackoverflow.com/comment/32969696
possible better answer: http://stackoverflow.com/a/21790319
score: 0
has answer: http://stackoverflow.com/a/21790199
tagged with: java
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/32969828
downvote count: 1
has comment: http://stackoverflow.com/comment/32969796
tagged with: split
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21790199
type: AnsweredQuestion
has body: String realstring = "&amp;&amp;&amp;.&amp;&amp;&amp;&amp;"; Double value = 555.55555; String[] arraystring = realstring.split("."); String stringvalue = String.valueof(value); String [] valuearrayed = stringvalue.split("."); System.out.println(arraystring[0]); Sorry if it looks bad. Rewrote on my phone. I keep getting ArrayIndexOutOfBoundsException: 0 at the System.out.println. I have looked and can't figure it out. Thanks for the help.
favorite count: 0

http://stackoverflow.com/q/21723655
has answer: http://stackoverflow.com/a/21723704
type: UnansweredQuestion
has title: How do I make the Input Exception for this method?
has answer: http://stackoverflow.com/a/21723942
type: Question
tagged with: java
has body: In method public void setYear (int yearPassed) (must be 1886 to 2014 inclusive) - what is the test for this part? I am really stuck here. I have just a while loop so how do you make it so you must enter 1886 to 2014. The scanner has to stay in this method and I'd like do it as simple as possible: public void setYear(int yearPassed) { Scanner keyboard = new Scanner(System.in); while(yearPassed &lt;=0) //must be 1886 to 2014 (inclusive) How do I make it inclusive? { System.out.println("Number of years must be &gt;= 0"); System.out.println("Enter the number of years, must be &gt;= 0"); yearPassed = keyboard.nextInt(); } year = yearPassed; }
score: 0
answer count: 2

http://stackoverflow.com/a/21729888
answers question: http://stackoverflow.com/q/21729108
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21729108
type: AcceptedAnswer
downvote count: 0
has body: This is sort of an expensive query to write, but it's pretty straightforward. You need something like this: select ?subject (count(?property) as ?numProperties) where { values ?property { dbpedia-owl:country dbpedia-owl:elevation dbpedia-owl:leader dbpprop:area dbpprop:flag dbpprop:name } ?subject ?property ?object } group by ?subject order by desc(?numProperties) limit 10 <a href="http://dbpedia.org/sparql?default-graph-uri=http://dbpedia.org&amp;query=select%20?subject%20%28count%28?property%29%20as%20?numProperties%29%20where%20%7B%0D%0A%20%20values%20?property%20%7B%0D%0A%20%20%20%20dbpedia-owl:country%20dbpedia-owl:elevation%0D%0A%20%20%20%20dbpedia-owl:leader%20dbpprop:area%20dbpprop:flag%0D%0A%20%20%20%20dbpprop:name%0D%0A%20%20%7D%0D%0A%20%20?subject%20?property%20?object%20%0D%0A%7D%0D%0Agroup%20by%20?subject%20%0D%0Aorder%20by%20desc%28?numProperties%29%0D%0Alimit%2010%0D%0A&amp;format=text/html&amp;timeout=30000&amp;debug=on" rel="nofollow noreferrer">SPARQL results This says to find triples with any of the properties that you've enumerated and, for each ?subject, count the number of properties that there were values for and call it ?numProperties, and present the results ordered by ?numProperties (with greatest number of properties first). Those numbers look rather high, but it's because those list pages have lots of values defined for certain properties. For instance, List of Advanced Dungeons &amp; Dragons 2nd edition monsters really does have a whole bunch of dbpprop:name values: select (count(distinct ?name) as ?numNames) where { &lt;http://dbpedia.org/resource/List_of_Advanced_Dungeons_&amp;_Dragons_2nd_edition_monsters&gt; dbpprop:name ?name } 1971 SPARQL results
type: Answer

http://stackoverflow.com/q/21700785
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/67154789
upvote count: 3
tagged with: sharedpreferences
type: Question
score: 3
has answer: http://stackoverflow.com/a/48097253
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 2
downvote count: 0
has title: Is it somehow bad practice to store Objects as JSON Strings in SharedPreferences in Android?
favorite count: 0
accepted answer: http://stackoverflow.com/a/48097253
has answer: http://stackoverflow.com/a/39936565
tagged with: android
has body: As someone who recently discovered the beauty of simplicity of a NoSQL document store (namley CouchDB) I find myself very tempting when needing to persistently store simple Objects or small Arrays to use a Json serializer to store this data as a JSON String in the shared preferences. The advantages I see are: No added complexity, since (in my project) I already have a JSON Framework for my REST API that easily converts JSON/Objects I additionally would argue: less complexity since I can just use a POJO and don't have to take care of key/values manually In contrast to Java serilization or Androids parcable it is more or less a universal format easy to understand even for humans and easy to parse troughout different Frameworks With the correct tooling its easy to handle the update case where the data model changes and the config must be migrated (ignore unkown properties and set new defaults in Jackson e.g.) Again with the correct tooling, serialization can be done in a single line of code: mapper.writeValueAsString(myObject); The disadvantages I see: Slow if using the comfortable way of serialzition (Databinding in Jackson e.g.) - but I'm not sure this plays any role in the "save config" use case Needs marginally more space - again I guess this negligible Im aware that this approach is only feasible with reasonable small data (but the same applies for SharedPreferences in general, I guess) and the performance hit is negligible if this is only used on a "save config" or similar use cases where writes/reads are sparse. Im looking for an argument for/against this approach in the depicted scenario or for problems I overlooked or may arise.
possible better answer: http://stackoverflow.com/a/39936565

http://stackoverflow.com/comment/32897627
type: Comment
type: QuestionComment
has text: I'm in the making of a Arduino and Java program that communicates using the WiFi Shield. You might wanna take a look here for an example of my code: http://stackoverflow.com/questions/21287087/maintaining-communication-between-arduino-and-java-program
score: 0
comment on: http://stackoverflow.com/q/21738838

ssl
tags question: http://stackoverflow.com/q/21678655
tags question: http://stackoverflow.com/q/21707894
tags question: http://stackoverflow.com/q/21762991
tags question: http://stackoverflow.com/q/21834318
type: Tag
tags question: http://stackoverflow.com/q/21791604
tags question: http://stackoverflow.com/q/21689780
tags question: http://stackoverflow.com/q/21818575
tags question: http://stackoverflow.com/q/21695585
tags question: http://stackoverflow.com/q/21812981
tag name: ssl
tags question: http://stackoverflow.com/q/21798329
tags question: http://stackoverflow.com/q/21691977
tags question: http://stackoverflow.com/q/21751503
tags question: http://stackoverflow.com/q/21704989
tags question: http://stackoverflow.com/q/21734900
tags question: http://stackoverflow.com/q/21687125
tags question: http://stackoverflow.com/q/21761007
tags question: http://stackoverflow.com/q/21735951
tags question: http://stackoverflow.com/q/21775408
tags question: http://stackoverflow.com/q/21783553
tags question: http://stackoverflow.com/q/21691373
tags question: http://stackoverflow.com/q/21833732
tags question: http://stackoverflow.com/q/21727079
tags question: http://stackoverflow.com/q/21756419
tags question: http://stackoverflow.com/q/21814328
tags question: http://stackoverflow.com/q/21728577
tags question: http://stackoverflow.com/q/21786821

http://stackoverflow.com/a/21810050
type: Answer
has body: this.school.getStudents().toArray() creates a temporary array instance and Array.sort() sorts the temporary array, not your actual ArrayList. You could use Collections.sort(this.school.getStudents()); instead
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21810009
downvote count: 0

http://stackoverflow.com/q/21738787
has comment: http://stackoverflow.com/comment/32878745
has comment: http://stackoverflow.com/comment/32879382
upvote count: 5
tagged with: java
tagged with: keylistener
tagged with: key-events
answer count: 1
downvote count: 0
tagged with: awt
favorite count: 0
has body: I'm writing a simulation of an old machine in Java and I'd like my keyboard handling to treat the left- and right-SHIFT keys independently. I have a standard AWT KeyListener registered and process the KeyPressed() and KeyReleased() methods. Here's the problem: 1) Press Left-SHIFT -&gt; get KeyPressed() for VK_SHIFT with location=LEFT ... good! 2) Keep Left-SHIFT held down, press Right-SHIFT too -&gt; get KeyPressed() for VK_SHIFT with location=RIGHT ... good! 3) Release Right-SHIFT (left-SHIFT still held down) -&gt; get ... absolutely nothing ... bad! 4) Release Left-SHIFT -&gt; get KeyReleased() for VK_SHIFT with location=LEFT ... good. So, I have lost the KeyReleased()information for right-SHIFT. This fails in this way when running on Windows, but works correctly (I see all events) on Linux. Any ideas? Is this just a Windows anomaly I have to live with. Curiously it doesn't fail like this with the two Ctrl keys&mdash;I see all events as I'd hope. It is easy to reproduce this behaviour using the standard Sun KeyEventDemo.java program.
type: UnansweredQuestion
has title: Problems detecting SHIFT keys in Java on Windows
score: 5
has answer: http://stackoverflow.com/a/21786251
type: Question

http://stackoverflow.com/a/21745986
accepted answer of: http://stackoverflow.com/q/21745929
has body: If your list is declared as List&lt;Vehicle&gt;, then that's the right way to do it - you can't tell without checking if an individual item is a Truck, or a Car, or something else. If it makes sense for Vehicle to have the method, you could declare doStuff there, and have it do nothing by default, and put a real implementation in Car. This is generally a sign of bad design though. Another option would be to get a List&lt;Car&gt; instead, so you don't have to check each item in the list for it's type. You could also put doStuff as part of an interface CanDoStuff, so it's not Car you're checking for - this way you can easily apply it to other classes as well.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21745929
has comment: http://stackoverflow.com/comment/32891143
type: Answer
score: 0

http://stackoverflow.com/q/21734962
type: Question
score: 0
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/21735177
has title: Multiple tables join via Spring JdbcTemplate returns an empty result
has body: Trying to join 3 tables within a query returns an empty result. Strange enough, having one table removed (two tables join) returns some set. Here is what I do: String sql = "SELECT\n" + " tc.constraint_name, tc.table_name, kcu.column_name, \n" + " ccu.table_name AS foreign_table_name,\n" + " ccu.column_name AS foreign_column_name, constraint_type \n" + "FROM \n" + " information_schema.table_constraints AS tc \n" + " JOIN information_schema.key_column_usage AS kcu\n" + " ON tc.constraint_name = kcu.constraint_name\n" + " JOIN information_schema.constraint_column_usage AS ccu\n" + " ON ccu.constraint_name = tc.constraint_name\n" + "WHERE constraint_type = 'FOREIGN KEY'"; List&lt;Map&lt;String, Object&gt;&gt; foreignTable1 = jdbcTemplate(getShardId(sku)).queryForList(sql); Would always return an empty set.
tagged with: spring-jdbc
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/32957664
type: Comment
comment on: http://stackoverflow.com/a/21723585
has text: yes list_type_tournee.xml represent each row of my listView.
type: AnswerComment
score: 0

cucumber
tags question: http://stackoverflow.com/q/21814256
tags question: http://stackoverflow.com/q/21738543
tags question: http://stackoverflow.com/q/21753267
type: Tag
tag name: cucumber

http://stackoverflow.com/q/21827923
type: Question
tagged with: resize
tagged with: grouplayout
score: 0
has title: Java Swing - Dynamic JPanel GroupLayout Resizing Issue
has body: These images show a chat box that needs to be resized with the application frame. I'm using GroupLayout to do so. The hierarchy of the frame goes something like this chatDiv(JPanel, GroupLayout)-&gt;chatTabbedPane(JTabbedPane, GroupLayout) -&gt;chatPanel(extended JPanel, GroupLayout) But, these individual chat_tabs(chatPanel) are added to the chatTabbedPane dynamically during application runtime. Problem is: These chatPanel(s) are expanding with the expansion of application frame but they are not shrinking with the shrink in width of application frame. initialized frame and when I expand and again shrink the application frame this happens (size of chatPanel doesn't shrink leading to invisible overflown region).. expanded and again shrinked frame Here is the class chatPanel that extends JPanel: class chatPanel extends JPanel{ private static final long serialVersionUID = 1L; GroupLayout gl_panel; JTextArea textArea; JTextField textField; JButton sendTextButton; JButton closeChatButton; int replyRef; public chatPanel(int ref){ //this.setLayout(null); closeChatButton = new JButton(""); sendTextButton = new JButton("SEND"); textField = new JTextField(); textArea = new JTextArea(); replyRef = ref; textArea.setWrapStyleWord(true); textArea.setEditable(false); textArea.setLineWrap(true); //textArea.setBounds(0, 0, 370, 99); this.add(textArea); //textField.setBounds(0, 101, 290, 20); //textField.setColumns(10); this.add(textField); sendTextButton.setFont(new Font("Tahoma", Font.PLAIN, 10)); //sendTextButton.setBounds(290, 101, 60, 19); this.add(sendTextButton); closeChatButton.setIcon(new ImageIcon("files/close.png")); closeChatButton.setSelectedIcon(null); closeChatButton.setToolTipText("CLOSE"); closeChatButton.setFont(new Font("Tahoma", Font.PLAIN, 5)); //closeChatButton.setBounds(350, 101, 20, 19); this.add(closeChatButton); gl_panel = new GroupLayout(this); gl_panel.setHorizontalGroup( gl_panel.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel.createSequentialG…
answer count: 1
tagged with: jtabbedpane
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33038475
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/23052786

http://stackoverflow.com/comment/32875440
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21736959
score: 0
has text: so whats the problem? Seems like you are doing string comparisons for each string that you retrieve from DB `A` to all strings you retrieve from DB `B`.

http://stackoverflow.com/q/21808991
has comment: http://stackoverflow.com/comment/33008828
tagged with: maven-3
has title: Put resources in a modular project maven
has comment: http://stackoverflow.com/comment/33007489
answer count: 0
type: UnansweredQuestion
type: Question
has body: I split my java web application in a few modules. I have five modules: model, services, util, rest and web-app. Now each of these modules use resources, for example in the web-app module there are a few images, in the service module there are a jasper files .... I want to ask you what is the best place to put these resources? I saw a few plugin like maven-shared-resources maven-shared-resources Is this a used strategy to manage different kind of resources in a maven modular project? I ask you this why I'm not able not get a few resources from a model I use a few resource contained in the util module for the login . My trouble is that when i call the class contained also it in the util module from the web-app module i get a FileNotFoundException why it try to get a resource from the util-module.jar. I use the following line code to try to get a resource InputStream inStr = getClass().getResourceAsStream( "/myFile.jks");
tagged with: java
has comment: http://stackoverflow.com/comment/33004590
score: 0

max
tags question: http://stackoverflow.com/q/21692659
tag name: max
type: Tag

http://stackoverflow.com/q/21714342
favorite count: 0
has comment: http://stackoverflow.com/comment/32835704
tagged with: javac
type: UnansweredQuestion
tagged with: package
has comment: http://stackoverflow.com/comment/32835672
has answer: http://stackoverflow.com/a/21714580
has title: how to compile interdependent packages in Java?
has comment: http://stackoverflow.com/comment/32835583
tagged with: java
downvote count: 1
tagged with: classpath
type: Question
linked to: http://stackoverflow.com/q/19776266
score: -1
has body: I have two packages in my project folder: src/main/java/com/scg/domain/* and src/main/java/com/scg/util/*. Both of them have classes that import others. eg: import com.scg.util.Address in one of the Class in src/main/java/com/scg/domain/ and import com.scg.domain.TimeCard in one of the Class in src/main/java/com/scg/util/. Now I want to compile all the Java files in both packages. To compile all the Java files in src/main/java/com/scg/util/ I tried this: javac -cp src/main/java/com/scg/domain/*:src/main/java/com/scg/util/* src/main/java/com/scg/util/* but it gave me 72 errors. I am pasting a sample of it: src/main/java/com/scg/domain/ClientAccount.java:11: error: cannot find symbol public final class ClientAccount implements Account { ^ symbol: class Account src/main/java/com/scg/domain/ConsultantTime.java:16: error: cannot find symbol private Account account; ^ symbol: class Account location: class ConsultantTime src/main/java/com/scg/domain/ConsultantTime.java:35: error: cannot find symbol public ConsultantTime(final Date date, final Account account, ^ symbol: class Account location: class ConsultantTime src/main/java/com/scg/domain/ConsultantTime.java:66: error: cannot find symbol public Account getAccount() { what is the easiest way to compile all the java files in two packages where there is dependency (I mean import here).
linked to: http://stackoverflow.com/q/21711020
has comment: http://stackoverflow.com/comment/32835402
upvote count: 0
has comment: http://stackoverflow.com/comment/32835814
answer count: 1
duplicate of: http://stackoverflow.com/q/21711020

http://stackoverflow.com/comment/32835010
has text: Why though do we need to make the method static if we are accessing a method from the same class without creating an object? What is the reason behind this? I am not seeing the need or benefit from this.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21713809
type: AnswerComment

http://stackoverflow.com/comment/32996164
has text: thanks but unfortunately i get `java.lang.IllegalStateException: Cipher not initialized`
comment on: http://stackoverflow.com/a/21805065
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/21832567
has answer: http://stackoverflow.com/a/21854636
answer count: 1
has comment: http://stackoverflow.com/comment/33045890
has comment: http://stackoverflow.com/comment/33045029
favorite count: 0
upvote count: 2
tagged with: emf
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21854636
has comment: http://stackoverflow.com/comment/33083100
score: 1
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33045723
has title: EMF: Generate Editor Code
has body: I just started using Eclipse Modeling Framework (EMF), and I'm having some troubles with the following tutorial: http://www.vogella.com/tutorials/EclipseEMF/article.html Everything was going smooth until I tried to Generate Editor Code (step 5.1). When I did that, the newly generated code just came out filled of errors because Eclipse couldn't find most of the required classes. I already imported EMF libraries from multiple ways, but probably my problem is that I'm not using the correct ones. Can anyone tell me where to download the correct ones? Or simply spot what I may be doing wrong? Below you have the list of imports that are messing up with Eclipse.... Thanks in advance! EDIT: I am supposed to use RAP as a target application! import org.eclipse.emf.common.ui.viewer.IViewerProvider; import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IContributionManager; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; import org.e…
tagged with: eclipse-emf

http://stackoverflow.com/a/21723215
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21722365
has body: You can try to define a method in the session scope bean and mark it as @PostConstruct. When the bean is ready the method is invoked. UPDATE or use public class MyLoginSuccessfullHandler extends SimpleUrlAuthenticationSuccessHandler { @Override public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { //your code } and define &lt;beans:bean id="usernamePasswordAuthenticationFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"&gt; &lt;beans:property name="authenticationSuccessHandler" ref="yourSuccessHandlerBean"/&gt; &lt;/beans:bean&gt;
type: Answer

http://stackoverflow.com/comment/90675868
score: 0
has text: If this really is java code, `>>=` is not a comparison operator. It is the bit-shift assign operator.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21761875

http://stackoverflow.com/a/21805445
answers question: http://stackoverflow.com/q/21804676
type: Answer
upvote count: 1
score: 1
has body: I tried CardLayout earlier and wasn't too happy with it. I urge you to revisit CardLayout, described here and illustrated here. It's designed for exactly the effect you describe. As an an aid to understanding, compare this more primitive approach that removes components and uses revalidate() to mark components as needing to be laid out again.
downvote count: 0

http://stackoverflow.com/a/21765498
accepted answer of: http://stackoverflow.com/q/21764305
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
has body: Yes, it is possible, and easy. In all likelihood, you want to move those common files to your "common components" project, or possibly to a new project. So long as jdoconfig.xml and any other common xml files are in src/main/resources (so that they're in the root of your classpath), and the packaging of your chosen project is "jar", you should be able to use those files without a problem.
downvote count: 0
answers question: http://stackoverflow.com/q/21764305

http://stackoverflow.com/q/21710727
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32840423
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32830447
has title: Why is JasperReports truncating pdf text from jdk 1.5 to jdk1.7?
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/21728949
accepted answer: http://stackoverflow.com/a/21728949
upvote count: 2
has comment: http://stackoverflow.com/comment/32855389
answer count: 1
tagged with: tomcat
favorite count: 0
has body: We are currently migrating a project from jdk1.5.0_22 to jdk1.7.0_51, tomcat 5.5.35 to tomcat 7.0.50 and from Ant to Maven3, in a separate SVN branch. With the new project, we are facing an issue where some labels in pdf reports generated with jasperreports ((&lt;staticText&gt; in the jrxml file) are being truncated, whereas in the project with jdk1.5, tomcat 5.5 and Ant it does not. From this, I've had these hypotheses for the problem's cause: Maven; JDK 7 compiler; JDK 7 runtime; Tomcat; These are the steps I've done to investigate the problem: I've checked if the jasper libs (including itext and struts-jasper-reports-plugin) matched the versions declared in the pom; In Maven, I ran dependency:list and dependency:tree to check if a different version of jasperreports was being used; I've rebuilt and redeployed the project using different settings and compared the results: | jdk compiler | 1.7 | 1.7 | 1.5 | 1.5 | 1.5 | 1.7 | | runtime jdk | 1.7 | 1.7 | 1.5 | 1.7 | 1.7 | 1.7 | | Maven | Yes | No | Yes | Yes | Yes | Yes | | Tomcat | 7 | 7 | 5.5 | 5.5 | 7 | 7 | | JasperReports | 3.7.2 | 3.7.2 | 3.7.2 | 3.7.2 | 3.7.2 | 5.5 | | truncates | Y | Y | N | Y | Y | Y | From the results above, it seems that the source of the problem is the jdk1.7 runtime. From this hypothesis, there are two possibilities: The jdk 1.5 version we were using with jasperreports had a bug where it ignored the staticText width, fixed in the following jdk versions; jasperreports has some incompatibility with jdk 7 that wasn't yet fixed; Opening the report with JasperSoft Studio Plugin showed that indeed, the text in the jrxml file was truncated, which indicates it could be a jdk 1.5 bug we were unaware of (and happily exploited). In any case, I was wondering if anyone knows why this is happening and if there is a way to avoid truncating the text without having to edit and recompile all the reports we have. Thanks!
tagged with: maven

http://stackoverflow.com/comment/33054134
type: Comment
comment on: http://stackoverflow.com/a/21837775
has text: @Tanner11 No, you need to read the data out of the file in the order that its in there. Based on what you've provided, its: String, String, int, int. However, your eof indicator is an int, in the location where a String is expected, so you need to read up on how to use the `java.util.Scanner` class' methods. Specifically, how to determine the next data type to be read.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21798275
tagged with: java
downvote count: 3
tagged with: eclipse
type: Question
upvote count: 0
answer count: 1
score: -3
tagged with: macos
has title: How recover deleted project in eclipse - I checked ( delete content on disk)
favorite count: 0
has comment: http://stackoverflow.com/comment/32983780
has comment: http://stackoverflow.com/comment/32984178
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21798318
has comment: http://stackoverflow.com/comment/32984077
has body: I delete project from eclipse ( delete content from disk was checked) :( so, I do not find file in the 'local history'. and when I undo the deletion I found only the bin folder is empty.. Is there any way to recover the files?? Does the system recovery tools can help?? *I'm using mac.

http://stackoverflow.com/comment/32918383
has text: I know :P , but i'd still like to hinder the appearance of clones if i happened to stumble on something good. Of course inevitably if the application was good it would be recreated/developed again in some way.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21761576

http://stackoverflow.com/q/21819959
has answer: http://stackoverflow.com/a/21820007
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/21820008
favorite count: 0
has title: Java Regular expression to find out the number of matching words
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/21820364
score: 1
tagged with: java
has body: I am learning regular expression.Suppose, If I have two String like abcd &amp; bcdd. To make them equal Strings I have to remove a from first and d from last string. is this possible to count the matched number like bcd=> (3). Currently, I am doing this Pattern p= Pattern.compile("["+abcd+"]{2}"); Matcher m= p.matcher("abcd bcdd"); My current solution doesn't provide me the correct result. So, my question 1) Is this possible ? 2) If possible, then how can I achieve that ? Hope, you will help to increase my regular expression knowledge.
upvote count: 1
type: Question

http://stackoverflow.com/a/21834812
score: 0
has body: We use Servlet Filters here to achieve basically the same result. I'm pretty sure Spring MVC has its own Filter concept. The concept is to start a stopwatch on the inbound side stop and record it as the response goes outbound. Expose this kid through JMX MBean or something and now you're monitoring it with only an hour or two of work. Works like a champ. The challenge then becomes not keeping track of the latency but "classifying" the request as the filter grabs all the requests and you usually need to know stuff like "/somerequest2 averages 2ms while /somerequest3 averages 8ms". List of compiled regex'es here with some "catch all" to handle the case where we have some API that we don't care much about. Primitive, but effective.
has comment: http://stackoverflow.com/comment/33058439
answers question: http://stackoverflow.com/q/21834523
has comment: http://stackoverflow.com/comment/33058342
type: Answer

http://stackoverflow.com/comment/32792929
score: 1
has text: @Bohemian I was referring to your initial answer of `List<? extends A & IB>`. Now I think the issue is that the OP doesn't want to parameterize `Z` with a specific type, but have it maintain a heterogenous list of objects that subtype `A` and `IB`.
type: AnswerComment
comment on: http://stackoverflow.com/a/21690431
type: Comment

http://stackoverflow.com/comment/32981746
score: 1
has text: "it's not the case" doesn't tell us what you've tried or what went wrong. We have no idea how you're trying to do this, so we can't comment on what the mistake is. Please edit your question to show your code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21795688

http://stackoverflow.com/comment/39268858
comment on: http://stackoverflow.com/a/25188646
score: 0
has text: Let me incorporate this and test it out. Thanks
type: AnswerComment
type: Comment

jar
tags question: http://stackoverflow.com/q/21684419
tags question: http://stackoverflow.com/q/21695520
tags question: http://stackoverflow.com/q/21769196
tags question: http://stackoverflow.com/q/21838872
tags question: http://stackoverflow.com/q/21711395
tags question: http://stackoverflow.com/q/21791489
tags question: http://stackoverflow.com/q/21721119
tags question: http://stackoverflow.com/q/21681044
tags question: http://stackoverflow.com/q/21798924
tags question: http://stackoverflow.com/q/21771632
tags question: http://stackoverflow.com/q/21757463
tags question: http://stackoverflow.com/q/21723860
type: Tag
tags question: http://stackoverflow.com/q/21827032
tags question: http://stackoverflow.com/q/21801840
tags question: http://stackoverflow.com/q/21738324
tags question: http://stackoverflow.com/q/21685852
tags question: http://stackoverflow.com/q/21716943
tags question: http://stackoverflow.com/q/21786147
tags question: http://stackoverflow.com/q/21761134
tags question: http://stackoverflow.com/q/21718357
tag name: jar
tags question: http://stackoverflow.com/q/21789636
tags question: http://stackoverflow.com/q/21683214
tags question: http://stackoverflow.com/q/21774995
tags question: http://stackoverflow.com/q/21832945
tags question: http://stackoverflow.com/q/21724145
tags question: http://stackoverflow.com/q/21708972
tags question: http://stackoverflow.com/q/21707934
tags question: http://stackoverflow.com/q/21712833
tags question: http://stackoverflow.com/q/21684572
tags question: http://stackoverflow.com/q/21786585
tags question: http://stackoverflow.com/q/21836950
tags question: http://stackoverflow.com/q/21827149
tags question: http://stackoverflow.com/q/21713574
tags question: http://stackoverflow.com/q/21712714
tags question: http://stackoverflow.com/q/21761664
tags question: http://stackoverflow.com/q/21688759
tags question: http://stackoverflow.com/q/21769800

http://stackoverflow.com/q/21814486
type: Question
has answer: http://stackoverflow.com/a/21814656
accepted answer: http://stackoverflow.com/a/21814656
has comment: http://stackoverflow.com/comment/33013055
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/33013306
has body: there seems to be many ways to access a REST web service. but different documentation out there states they all have problems and now i am confused what to use. Here are our options: HTTPClient - from apache, but deprecated. However Apache does provide some alternative HttpURLConnection - has bugs in it. AndroidHttpClient - includes the workaround for a major bug in HttpURLConnection I really don’t know which one to use from the list above. Is there one which I am missing that I should be using to access a REST web service ?
linked to: http://stackoverflow.com/q/4799151
answer count: 1
favorite count: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/33013161
tagged with: android
tagged with: web-services
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/33013372
score: 1
tagged with: java
has title: new to android - what technology should be used to access web service?
downvote count: 1

http://stackoverflow.com/comment/32939089
score: 0
type: Comment
has text: Its not my code it was sent to me by my organization, I would have done it a completely different way, but my boss insists it be done as such.
type: QuestionComment
comment on: http://stackoverflow.com/q/21772878

http://stackoverflow.com/comment/33035175
score: 0
type: Comment
has text: Oh my god, you are right! I must have pressed some hotkey. It was driving me crazy, thank you so much!
type: AnswerComment
comment on: http://stackoverflow.com/a/21815507

http://stackoverflow.com/comment/32901289
comment on: http://stackoverflow.com/q/21732407
type: Comment
type: QuestionComment
has text: We are on Spring 3.1.3. I'll try to test other versions and fiddle with some special configuration we might be using. Thanks for reactions.
score: 0

http://stackoverflow.com/a/21869688
upvote count: 1
type: Answer
has body: You have your .flex file formatted wrong. As defined by the JFlex manual, you have to organize the file like this: UserCode %% Options and declarations %% Lexical rules You currently have no UserCode, so you would start off your file with a %%, indicating that the file starts right off the bat with Options and declarations. So the start of the file would look like this: %% %class Lexer %line %column
answers question: http://stackoverflow.com/q/21837308
downvote count: 0
score: 1

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/21680462
tags question: http://stackoverflow.com/q/21825029
type: Tag
tags question: http://stackoverflow.com/q/21749695
tags question: http://stackoverflow.com/q/21836618
tags question: http://stackoverflow.com/q/21729520
tags question: http://stackoverflow.com/q/21823120
tags question: http://stackoverflow.com/q/21728577

http://stackoverflow.com/a/21770944
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21770790
type: Answer
has body: What parameters are you using? http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html For example related to your case: -Xms : sets initial Java heap size -Xmx : sets maximum Java heap size If you are using the -Xmx parameter then you will see 4G in your task manager, ONLY IF your application really needs it. On the other hand if your are using the -Xms parameter (in that case you also need to need to set -Xmx parameter at an equal or larger value) then you should expect to see that value on the task manager. So, only if you set -Xms4096M and -Xmx4096M and the JVM fails to start then you have an issue. If it starts normally then you do not have a problem. Also regardless of the RAM you are having (not in your case since we are only talking 4G) even Windows 7 (64bit) have different limits according to their edition. http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx#physical_memory_limits_windows_7
accepted answer of: http://stackoverflow.com/q/21770790
score: 0

http://stackoverflow.com/comment/32871940
type: QuestionComment
comment on: http://stackoverflow.com/q/21734371
has text: I have looked at that already. Android holo colors generates the proper 9 patch images and the 2 drawable selector files, and they are definitely in there, but not showing up.
score: 0
type: Comment

http://stackoverflow.com/q/21731365
type: Question
has comment: http://stackoverflow.com/comment/32864880
has comment: http://stackoverflow.com/comment/32867278
tagged with: java
has comment: http://stackoverflow.com/comment/32867594
has body: import java.io.*; import java.util.* class assmm { public static void main(String args[]) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s1,s2,s3,s4,s5,s6,s7,s8,s9; /*s1=new String("JOHN START 0"); s2=new String("USING *,15"); s3=new String("L 1,FIVE"); s4=new String("A 1,FOUR"); s5=new String("ST 1,TEMP"); s6=new String("FOUR DC F,4"); s7=new String("FIVE DC F,15"); s8=new String("TEMP DS 1F"); s9=new String("END"); System.out.println(s1); System.out.println(s2); System.out.println(s3); System.out.println(s4); System.out.println(s5); System.out.println(s6); System.out.println(s7); System.out.println(s8); System.out.println(s9);*/ String mot[][]=new String[4][2]; mot[0][0]="mot table"; mot[1][0]="L"; mot[1][1]="4"; mot[2][0]="A"; mot[2][1]="4"; mot[3][0]="ST"; mot[3][1]="4"; for(int i=0;i&lt;=3;i++) { for(int j=0;j&lt;=1;j++) { System.out.print(mot[i][j]); System.out.print("\t"); } System.out.println(); } String pot[]=new String[6]; pot[0]="pot"; pot[1]="Start"; pot[2]="Using"; pot[3]="DC"; pot[4]="DS"; pot[5]="END"; for(int i=0;i&lt;6;i++) { System.out.println(pot[i]); } /*System.out.println("PROGRAM"); String pgm[]=new String[9]; pgm[0]="JOHN START 0"; pgm[1]="USING *,15"; pgm[2]="L 1,FIVE"; pgm[3]="A 1,FOUR"; pgm[4]="ST 1,TEMP"; pgm[5]="FOUR DC F,4"; pgm[6]="FIVE DC F,15"; pgm[7]="TEMP DS 1F"; pgm[8]="END";*/ String str[]={"JOHN","START","0","spr","USING","*",",","15","spr","L","1",",","FIVE","spr","A","1",",","FOUR","spr","ST","1",",","TEMP","spr","FOUR","DC","F","'4'","spr","FIVE","DC","F","'5'","spr","TEMP","DS","'1'","F","spr","END"}; int len=str.length; System.out.println(len); for(int i=0;i&lt;len;i++) { for(int j=0;j&lt;=(mot.length)-1;j++) { if(str[i]==mot[j][0]) { System.out.println(str[i]+"found in mot"); } } for(int j=0;j&lt;=(pot.length)-1;j++) { if(str[i]==pot[j]) { System.out.println(str[i]+"found in pot"); } } } /*for(int i=0;i&lt;pgm.length;i++) { System.out.println(pgm[i]); }*/ /*int len=pgm.leng…
score: 0
tagged with: arrays
type: UnansweredQuestion
has title: want to cmp pot and mot array with string array and insert missing value into new array
answer count: 0

http://stackoverflow.com/comment/32783444
type: QuestionComment
has text: Why are you mixing-'n-matching GLSL `#version`s?
score: 0
comment on: http://stackoverflow.com/q/21685555
type: Comment

http://stackoverflow.com/q/21679148
has comment: http://stackoverflow.com/comment/32771653
has comment: http://stackoverflow.com/comment/32771749
type: AnsweredQuestion
tagged with: java
has body: I am trying to calculate the differences in days between two dates by pressing a button. This is what I've done public void CalcolaG(View view) { long DataI1; long DataF1; long oneDay; long Risultato1; // Risultato1 = 0; // EditText DataI = (EditText) findViewById(R.id.DataI); EditText DataF = (EditText) findViewById(R.id.DataF); TextView Risultato = (TextView) findViewById(R.id.Risultato); DataI1 = Long.parseLong(DataI.getText().toString()); DataF1 = Long.parseLong(DataF.getText().toString()); oneDay = 1000 * 60 * 60 * 24; Risultato1 = (DataF1 - DataI1) / oneDay; // Risultato.setText(Double.toString(Risultato1)); } } But when I press the button nothing happens, where's the error?
tagged with: date
tagged with: eclipse
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21680606
tagged with: android
has title: Days between two dates with grorian calendar in Eclipse
has comment: http://stackoverflow.com/comment/32780528
accepted answer: http://stackoverflow.com/a/21680606
has comment: http://stackoverflow.com/comment/32771824

http://stackoverflow.com/comment/33049308
has text: Perfect, solved the issue for me thanks very much. Will accept answer in 5 mins when I can.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21835205

http://stackoverflow.com/comment/47265638
type: Comment
score: 1
has text: It's wrong. It should be OneToMany. JoinColumn is used to specify the name of the join column. If you don't specify one, Hibernate will use a defaukt name (How this default name is constructed name is specified in the JPA spec)
type: AnswerComment
comment on: http://stackoverflow.com/a/21762450

http://stackoverflow.com/a/21778952
has comment: http://stackoverflow.com/comment/32949685
answers question: http://stackoverflow.com/q/21777756
has body: Here is your answer! your class Hotel public class Hotel { public java.util.HashSet&lt;HotelPackage&gt; packages; public java.util.HashSet&lt;HotelPackage&gt; getPackages() { return packages; } public void setPackages(java.util.HashSet&lt;HotelPackage&gt; packages) { this.packages = packages; } } your class public class HotelPackage { public java.util.HashSet&lt;String&gt; items; public java.util.HashSet&lt;String&gt; getItems() { return items; } public void setItems(java.util.HashSet&lt;String&gt; items) { this.items = items; } } your jstl code &lt;% HashSet items = new HashSet(); Hotel hotel = new Hotel(); HashSet hotelPackSet = new HashSet(); HotelPackage hp1 = new HotelPackage(); HashSet items1 = new HashSet(); items1.add("Buffet"); items1.add("Luxury Rooms"); hotelPackSet.add(hp1); HotelPackage hp2 = new HotelPackage(); HashSet items2 = new HashSet(); hp2.setItems(items2); items2.add("Swimming Pool"); items2.add("Common Rooms"); hotelPackSet.add(hp1); hotelPackSet.add(hp2); hotel.setPackages(hotelPackSet); %&gt; &lt;c:set property="hotel" scope="page" value="&lt;%= hotel%&gt;" var="hotel"/&gt; &lt;c:forEach var="pack" items="${hotel.packages}"&gt; &lt;c:set property="packItem" scope="page" value="${pack.items}" var="pack"/&gt; &lt;c:forEach var="product_item" items="${pack}"&gt; ${product_item} &lt;/c:forEach&gt; &lt;/c:forEach&gt; So you are doing a big mistake by not setting up var in set variable.Cheers :)
type: Answer
has comment: http://stackoverflow.com/comment/32949583
score: 0

http://stackoverflow.com/comment/32933579
has text: Great! Glad to be of help.
type: AnswerComment
comment on: http://stackoverflow.com/a/21743888
type: Comment
score: 0

http://stackoverflow.com/comment/32889982
score: 0
type: AnswerComment
has text: @stacktome check another answer, it can be the case
comment on: http://stackoverflow.com/a/21697295
type: Comment

http://stackoverflow.com/a/21820657
has comment: http://stackoverflow.com/comment/33024127
answers question: http://stackoverflow.com/q/21820575
has body: Replace a class inheriting from ArrayList&lt;A&gt; with an interface and a class containing the list: interface ListA extends List&lt;A&gt; { // Put additional methods here } class ListAImpl implements ListA { private List&lt;A&gt; content; public ListAImpl(List&lt;A&gt; content) { this.content = content; } // Use delegation for all methods of the List&lt;A&gt; interface, calling through // to the content list. } Now the synchronization of your ListA object depends on what you pass to its constructor: pass a "plain" ArrayList&lt;A&gt; to have a non-synchronized ListA, or pass a synchronized one to have a synchronized ListA. Now your code snippet when you make a synchronized ListA from a non-synchronized one like this: ListA a = new ListAImpl(new ArrayList&lt;A&gt;()); ListA sync = new ListAImpl(Collections.synchronizedList(a));
upvote count: 2
has comment: http://stackoverflow.com/comment/33024171
type: AcceptedAnswer
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21820575
downvote count: 0

http://stackoverflow.com/q/21696502
type: Question
has comment: http://stackoverflow.com/comment/32804585
has answer: http://stackoverflow.com/a/21696593
tagged with: linked-list
has comment: http://stackoverflow.com/comment/32802728
score: 0
tagged with: java
has body: So I was wondering how I could create a new empty linked list, using my class definition of List and node, with a first head node pointing to null without having to hold any integer value. The thing is I'm not allowed to change the given methods or add any to the definition, so whenever I create a list, in the constructor I'm not sure how I'm supposed to asign head to null. Here's part of the codes: public class Node { private Node next; private int key; Node(Node nxt, int keyValue) { key = keyValue; next = nxt; } Node getNext() { return next; } int getKey() { return key; } void putNext(Node nxt) { next = nxt; } } Class List public class List { private Node head; List() { head = new Node(null, -1); // arbitary value for head head.putNext(null); } This is what I came up with. I just assign a random value to variable key in head node. But if I do this, it will kinda mess up with my later methods that used recursive like deletion or finding sum or find max, min, etc Is there any other way around I can do to deal with this issue?
has comment: http://stackoverflow.com/comment/32803055
answer count: 1
has comment: http://stackoverflow.com/comment/32802954
has comment: http://stackoverflow.com/comment/32802719
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32802968
has comment: http://stackoverflow.com/comment/32804094
has title: Head node of Linked List

http://stackoverflow.com/q/21814389
tagged with: arrays
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33012920
has body: My program is supposed to evaluate the user input against the capital array. It looks like i keep getting error messages like this one: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 19 Any one can help? package Capitol; import java.util.Scanner; public class Capitol { static Scanner input = new Scanner(System.in).useDelimiter("\r\n"); public static void main(String[] args) { int correctAnswer = 0; String [][] grid = { {"Alabama", "California", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Kansas", "Lousiana", "Maryland", "New Mexico", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "Texas", "Utah", "Virgina", "West Virginia"}, {"Montgomery", "Sacramento", "Dover", "Tallahassee", "Atlanta", "Honolulu", "Boise", "Topeka", "Baton Rouge", "Annapolis", "San Jose", "Salem", "Harrisburg", "Providence", "Columbia", "Austin", "Salt Lake City", "Richmond", "Charleston"}}; for(int i = 0; i&lt; grid.length; i++){ System.out.println("What is the capital of ?"); String capital = input.next(); for(int k =0; k &lt;20; k++ ){ String answer = null; grid[i][k] = answer; if(capital.equalsIgnoreCase(answer)){ correctAnswer ++; System.out.println("Your answer is correct"); } else System.out.println("The correct answer should be" + grid[i]); } } System.out.println("The correct count is " + correctAnswer); } }
has title: Java code outOfBoundsException
has comment: http://stackoverflow.com/comment/33012839
has answer: http://stackoverflow.com/a/21814412
tagged with: java
type: Question
tagged with: 2d
has answer: http://stackoverflow.com/a/21814429
score: 0
answer count: 2

http://stackoverflow.com/comment/33053367
has text: (The above code you posted is obviously just random junk, unrelated to the assignment.) (And if you don't understand that you should practice saying "Will you have fries with that?")
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21837360

http://stackoverflow.com/a/21789120
has body: You would do it the same way in a Java application: String sql = "INSERT INTO location(address1, address2, postcode, town, type)"; + " VALUES (:address1, :address2, :postcode, :town," + " (SELECT id FROM location_type WHERE type='main'))"; Map parameters = new HashMap(); parameters.put("address1", address1); parameters.put("address2", address2); parameters.put("postcode", postcode); parameters.put("town", town); this.namedParameterJdbcTemplate.update(sql, parameters); There's no reason the database accepts a SQL query from the command line and rejects it when it comes from a Java application. If the hard-coded main above is in fact another parameter, you would set it the same way as all the other parameters: String sql = "INSERT INTO location(address1, address2, postcode, town, type)"; + " VALUES (:address1, :address2, :postcode, :town," + " (SELECT id FROM location_type WHERE type= : type))"; Map parameters = new HashMap(); parameters.put("address1", address1); parameters.put("address2", address2); parameters.put("postcode", postcode); parameters.put("town", town); parameters.put("type", type); this.namedParameterJdbcTemplate.update(sql, parameters);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32969325
type: Answer
accepted answer of: http://stackoverflow.com/q/21786943
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32969305
answers question: http://stackoverflow.com/q/21786943

http://stackoverflow.com/a/43933330
answers question: http://stackoverflow.com/q/21839182
has body: you should use an instance of the class and not the class if you want to call your getter function without setting the attribute static.
type: Answer
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/21836460
answer count: 5
has answer: http://stackoverflow.com/a/21836610
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/11327514
tagged with: oop
linked to: http://stackoverflow.com/q/18138397
tagged with: java
has answer: http://stackoverflow.com/a/21836492
type: Question
possible better answer: http://stackoverflow.com/a/21836563
accepted answer: http://stackoverflow.com/a/21836505
tagged with: inheritance
has answer: http://stackoverflow.com/a/21836585
upvote count: 3
has body: I think we already discussed this issue in this post here Inheritance in Java simple clarification But since the example here is a bit simpler and the point i want to be clarified is different i´ll give it a shot. First, the two classes to discuss: public class SuperClass{ SuperClass() { foo(); } public void foo() { System.out.println("Super.foo()"); } public static void main(String[] args) { SuperClass tn = new DerivedClass(); tn.foo(); } } public class DerivedClass extends SuperClass{ String i; TrickyB() { i = "aksjhdf"; } public void foo() { System.out.println("In derived.foo() --&gt; " + i); } } I (at least I think) understand the concepts of polymorphism and i know why DerivedClass.foo() is called when invoking new DerivedClass(); I see an inconsistency here: At the time we invoke the c´tor of DerivedClass the c´tor of the SuperClass is called implicitly (so to say as the first line of the Derived c´tor). So in the Super c´tor, DerivedClass is not fully initialised, which makes working with this class useless. This point is reflected in the output of this program In derived.foo() --&gt; null In derived.foo() --&gt; aksjhdf The first line reflects my confusion: Why is DerivedClass.foo() called? The object is not ready yet, so doing anything with it is nonsense in my eyes. Can anyone explain the reasons to me. I think this absolutely counter intuitive. BTW: I would have expected SuperClass.foo() to be called, since, as I said, it doesnt make any sense to work with an "unready" object. On the other Hand: As I think of it. It doesn´t make any sense to me neither, that, while I´m in the c´tor of SuperClass, DerivedClass.foo() is called! How would I call SuperClass.foo() in my case?
has title: Java inconsistent inheritance mechanics?
has answer: http://stackoverflow.com/a/21836505
favorite count: 0
has answer: http://stackoverflow.com/a/21836563
downvote count: 0

http://stackoverflow.com/comment/32936148
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21771276
has text: It works for me. Select all classes in package `folder_a`. Copy them. Paste them in package `folder_b`. Is your `src` folder designated as a source folder?

http://stackoverflow.com/comment/32775880
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21681052
has text: I meant modifying it would mean i would have to go and change a lot of other things.

http://stackoverflow.com/a/21728697
upvote count: 1
has body: There are two issues here: Your method setPiece() changes only one square in the board. You need to iterate the entire board if you want to change everything in the board - but that does not make sense for the method's name and arguments. Your toString() method mutates the array and set it back to ' '. for each element.This behavior is usually unadvised.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21728608
score: 1

http://stackoverflow.com/q/21756990
has body: Here is the original vba code: For i = 0 To M St(i) = i * dS ' C(N, i) = Max(0, z * (St(i) - X)) Next For j = N - 1 To 0 Step -1 For i = 1 To M - 1 pu = 0.5 * (v ^ 2 * i ^ 2 + b * i) * dt pm = 1 - v ^ 2 * i ^ 2 * dt pd = 0.5 * (v ^ 2 * i ^ 2 - b * i) * dt C(j, i) = Df * (pu * C(j + 1, i + 1) + pm * C(j + 1, i) + pd * C(j + 1, i - 1)) If AmeEurFlag = "a" Then C(j, i) = Max(z * (St(i) - X), C(j, i)) End If Next If z = 1 Then C(j, 0) = 0 C(j, M) = (St(i) - X) Else C(j, 0) = X C(j, M) = 0 End If Next and I want to convert to java here is my code: for (int i = 0; i &lt; M; i++) { St[i] = i * dS; C[(int) N][i] = Math.max(0, z * (St[i] - X)); } for (int j = (int) (N - 1); j &lt; 0; j--) { for (int i = 1; i &lt; M-1; i++) { pu = 0.5 * (Math.pow(v, 2) * Math.pow(i, 2)+ b * i) * dt; pm = 1 - Math.pow(v, 2) * Math.pow(i, 2)* dt; pd = 0.5 * (Math.pow(v, 2)* (Math.pow(i, 2) - b * i) * dt); C[j] [i] = Df * (pu * C[j + 1] [i + 1] + pm * C[j + 1] [i] + pd * C[j + 1] [i - 1]); if (AmeEurFlag == "a" ) { C[j] [i] = Math.max(z * (St[i] - X), C[j][i]); } } if (z == 1) { C[j][0] = 0; C[j][M] = (St[i] - X); } else { C[j][0] = X; C[j][M] = 0; } } I have an error in this line C[j][M] = (St[i] - X); Because there no "i" variable. I'm out of first loop. So eclipse says that you should create a variable. In vba I can create a variable beginning of the code like: "Dim i As Integer" but in java is it possible? How can I solve this problem? Thanks in advance
type: UnansweredQuestion
has title: VBA to Java convert the loops
has answer: http://stackoverflow.com/a/21757369
has comment: http://stackoverflow.com/comment/32910189
tagged with: java
has comment: http://stackoverflow.com/comment/32910154
type: Question
has comment: http://stackoverflow.com/comment/32910282
has comment: http://stackoverflow.com/comment/32910129
score: 0
answer count: 1
tagged with: vba

http://stackoverflow.com/a/21820393
upvote count: 2
answers question: http://stackoverflow.com/q/21819987
type: Answer
has comment: http://stackoverflow.com/comment/33023930
score: 2
has body: Find what percentage of the experience the player has, and multiply it by the bar's maximum width. int currentXP; int lastLevelXP; int nextLevelXP; int xpBetweenLevels = nextLevelXP - lastLevelXP; int xpSinceLevelUp = currentXP - lastLevelXP; float percentageOfXP = xpSinceLevelUp / (float) xpBetweenLevels; int barWidth = (int) (percentageOfXP * maxWidth); // maxWidth would be the screen's width // rendering must use 4 unique points glColor3f(1f, 0f, 1f); glBegin(GL_QUADS); glVertex2i(x, y); glVertex2i(x + (percentageOfXP * maxWidth), y); glVertex2i(x + (percentageOfXP * maxWidth), y + height); // where y = 10 glVertex2i(x, y + height); glEnd(); This way, if the player is at level 2, which starts at 70 XP, has 120 XP, and level 3 starts at 170 XP: currentXP = 120 lastLevelXP = 70 nextLevelXP = 170 xpBetweenLevels = 170 - 70 = 100 xpSinceLevelUp = 120 - 70 = 50 percentageOfXP = 50 / 100 = 0.5 barWidth = 0.5 * 1280 = 640 = half of screen's width Also note that, whereas your code only used 2 different vertices, which would result in a line, mine uses 4 which draws a quad. edit Since your code resets XP to 0 every level, and simply increases the required amount, the only modification needed is to set lastLevelXP to 0 and nextLevelXP to the amount of XP needed to level up. Thus, xpBetweenLevels becomes nextLevelXP - 0, which is the total XP needed to level up; likewise, xpSinceLevelUp becomes just currentXP. All you need to do is replace the non-rendering code with int currentXP; int xpNeeded; float percentageOfXP = currentXP / (float) xpNeeded; int barWidth = (int) (percentageOfXP * maxWidth);
has comment: http://stackoverflow.com/comment/33023761
has comment: http://stackoverflow.com/comment/33023709
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21819987

http://stackoverflow.com/comment/33028911
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21782023
type: AnswerComment
has text: If you want to know if the actual bytecode is different, you can disassemble your class files with the `javap` tool and compare them.

http://stackoverflow.com/a/21795414
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21795376
has body: try this: list.remove(list.indexOf(2));
score: 4

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/21731614
tag name: session-timeout

http://stackoverflow.com/comment/32797017
type: Comment
comment on: http://stackoverflow.com/a/21693007
type: AnswerComment
score: 0
has text: All you needed was LenghtOfString h=new LengthOfString(); h.start();

http://stackoverflow.com/q/21764299
tagged with: while-loop
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32923431
has comment: http://stackoverflow.com/comment/32923720
has comment: http://stackoverflow.com/comment/32924168
has comment: http://stackoverflow.com/comment/32923439
has title: Comparing two files in java
tagged with: java
has comment: http://stackoverflow.com/comment/32923609
has answer: http://stackoverflow.com/a/30055093
tagged with: file
has comment: http://stackoverflow.com/comment/32925988
upvote count: 1
has answer: http://stackoverflow.com/a/21764528
downvote count: 1
has answer: http://stackoverflow.com/a/21765062
type: Question
has answer: http://stackoverflow.com/a/45757756
has answer: http://stackoverflow.com/a/21764514
has comment: http://stackoverflow.com/comment/32923378
has comment: http://stackoverflow.com/comment/32923346
has comment: http://stackoverflow.com/comment/32923596
score: 0
has body: I am trying to compare two .txt files (i.e their contents), but when I execute this code my application goes into an infinite loop. Why? public int compareFile(String fILE_ONE2, String fILE_TWO2)throws Exception { File f1 = new File(fILE_ONE2); //OUTFILE File f2 = new File(fILE_TWO2); //INPUT FileReader fR1 = new FileReader(f1); FileReader fR2 = new FileReader(f2); BufferedReader reader1 = new BufferedReader(fR1); BufferedReader reader2 = new BufferedReader(fR2); String line1 = null; String line2 = null; int flag=1; while ((flag==1) &amp;&amp;((line1 = reader1.readLine()) != null)&amp;&amp;((line2 = reader2.readLine()) != null)) { if (!line1.equalsIgnoreCase(line2)) flag=0; else flag=1; } reader1.close(); reader2.close(); return flag; }
has comment: http://stackoverflow.com/comment/32923451
has comment: http://stackoverflow.com/comment/32923409
favorite count: 0

http://stackoverflow.com/comment/32937651
has text: The finalizer order cannot be defined. The last two objects may reference each other. One has to come first.
type: Comment
comment on: http://stackoverflow.com/a/21771999
score: 0
type: AnswerComment

http://stackoverflow.com/q/21815839
upvote count: 5
has comment: http://stackoverflow.com/comment/33346239
has comment: http://stackoverflow.com/comment/33015777
answer count: 3
score: 5
has answer: http://stackoverflow.com/a/21818297
downvote count: 0
has comment: http://stackoverflow.com/comment/33015514
possible better answer: http://stackoverflow.com/a/61748373
has answer: http://stackoverflow.com/a/61748373
has comment: http://stackoverflow.com/comment/33015486
favorite count: 0
accepted answer: http://stackoverflow.com/a/21818297
tagged with: maze
tagged with: multidimensional-array
linked to: http://stackoverflow.com/q/36592057
tagged with: depth-first-search
has comment: http://stackoverflow.com/comment/56208994
type: AnsweredQuestion
tagged with: java
has body: I am working or understanding how to create a simple java 2d maze that should look like this: int [][] maze = { {1,1,1,1,1,1,1,1,1,1,1,1,1}, {1,0,1,0,1,0,1,0,0,0,0,0,1}, {1,0,1,0,0,0,1,0,1,1,1,0,1}, {1,0,0,0,1,1,1,0,0,0,0,0,1}, {1,0,1,0,0,0,0,0,1,1,1,0,1}, {1,0,1,0,1,1,1,0,1,0,0,0,1}, {1,0,1,0,1,0,0,0,1,1,1,0,1}, {1,0,1,0,1,1,1,0,1,0,1,0,1}, {1,0,0,0,0,0,0,0,0,0,1,0,1}, {1,1,1,1,1,1,1,1,1,1,1,1,1} }; Ones this has been created the idea is to set a starting point and goal point and by using recursive depth first find the path. but must say i am having difficulties to create the maze. Do you have any suggestion on how to do it? Or perhaps a link to a tutorial? The main focus for me right now is just to create the maze.
has answer: http://stackoverflow.com/a/21817084
has title: Simple Java 2d array maze sample
has comment: http://stackoverflow.com/comment/33015590
has comment: http://stackoverflow.com/comment/33016716
type: Question
has comment: http://stackoverflow.com/comment/60798032

http://stackoverflow.com/comment/32926920
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21765702
has text: Is the format always the same? That is, you will always have the string "Team ID:", followed by a new-line, followed by the value you want?

http://stackoverflow.com/comment/33147764
has text: 2) We are developing a SWING-application and going to use JavaFX for rebuilding of our SWING-project, and for a start as prototype to build a ribbon-toolbar inside SWING. The application is using also as RCP-plug-in by Eclipse and the worst behavior is, when the application is opened many times in plug-in multi-windows environment - the combobox from the first instance has only the problem above, but the same combobox from other instances get location at the first combobox independently, where the owner window is located...They are flying nearby the first started window.
type: QuestionComment
comment on: http://stackoverflow.com/q/21838909
type: Comment
score: 0

http://stackoverflow.com/a/53636385
answers question: http://stackoverflow.com/q/21714594
has body: I would like to add to the previous answer that apart from Java Optional not being integrated into standard java library (and other libraries of course), there is another big difference. Java Optional is not Serializable and as such cannot be used in fields of any Java Beans which should be serializable. Java Optional spec: https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html Scala Option spec: https://www.scala-lang.org/api/2.12.x/scala/Option.html
type: Answer
score: 0

http://stackoverflow.com/comment/32892193
has text: `double MontlyInterest = this.balance * getMontlyInterestRate();` - Did you even do the changes I did? I clearly changed your code. Without making the changes, you'll obviously get these errors. Replace your methods in your code with the once I've provided.
type: AnswerComment
comment on: http://stackoverflow.com/a/21746267
type: Comment
score: 0

http://stackoverflow.com/comment/33421755
type: QuestionComment
has text: have a look [here][1] it will help you [1]: http://stackoverflow.com/questions/19804233/android-autofocuscallback-is-not-being-called-or-not-returning/19921582#19921582
score: 0
comment on: http://stackoverflow.com/q/21768205
type: Comment

http://stackoverflow.com/q/21730183
has answer: http://stackoverflow.com/a/38937524
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21789195
type: Question
upvote count: 12
has body: Is it possible to specify an exclusive start key when querying a DynamoDB table via global secondary index? I'm using the aws-java-sdk version 1.6.10 and executing queries with a QueryExpression and a DynamoDBMapper. Here's the gist of what I'm trying to do: MappedItem key = new MappedItem(); item.setIndexedAttribute(attributeValue); Map&lt;String, AttributeValue&gt; exclusiveStartKey = new HashMap&lt;String, AttributeValue&gt;(); exclusiveStartKey.put(MappedItem.INDEXED_ATTRIBUTE_NAME, new AttributeValue().withS(attributeValue)); exclusiveStartKey.put(MappedItem.TIMESTAMP, new AttributeValue().withN(startTimestamp.toString())); DynamoDBQueryExpression&lt;MappedItem&gt; queryExpression = new DynamoDBQueryExpression&lt;MappedItem&gt;(); queryExpression.withIndexName(MappedItem.INDEX_NAME); queryExpression.withConsistentRead(Boolean.FALSE); queryExpression.withHashKeyValues(key); queryExpression.setLimit(maxResults * 2); queryExpression.setExclusiveStartKey(exclusiveStartKey); This results in a 400 error saying that the specified start key is invalid. The TIMESTAMP is the range key for the table index and for the global secondary index, and the attribute value pair is valid (i.e. there is an item in the table with the values passed as the hash and range key for the index, and the attribute passed as the index is the hash key of the global secondary index). Is there something I missed or is this not possible?
has title: DynamoDB Global Secondary Index with Exclusive Start Key
tagged with: amazon-web-services
score: 12
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/21789195
has answer: http://stackoverflow.com/a/59548080
favorite count: 0
possible better answer: http://stackoverflow.com/a/38937524
tagged with: amazon-dynamodb

http://stackoverflow.com/comment/32878692
type: Comment
comment on: http://stackoverflow.com/a/21738669
score: 0
type: AnswerComment
has text: This `Method fooMethod = A.getMethod("foo");` is the functionality OP wants. How do you get that with a method reference?

http://stackoverflow.com/a/21687182
has comment: http://stackoverflow.com/comment/32790982
answers question: http://stackoverflow.com/q/21686978
has body: In client-side GWT applications, all types must be known at compile time. Having a generic method like the one you've described simply won't work. You could try something like the following public interface CommandService extends RemoteService { public Result&lt;Serializable&gt; execute(Command command, Serializable target); } You will lose some type-safety and restrict you a bit, but that should work. Request Factory may be a better fit in this situation. It offers a lot of leniency as to where the server-side code does the actual work. There is a Request Factory sample project available in the GWT source. The gwtproject.org website has pretty clear instructions on getting the source code, here. Look at the README file in the eclipse directory. That will help you get started. Edit: As @ColinAlworth pointed out, you should be VERY CAREFUL when using simple interfaces in your RPC methods. The method above is telling the compiler that it should be able to send every Serializable object over the wire which it has access to, and will create serializers and deserializers for each and every single one!
score: 5
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32840803
has text: I just a method to determint a string is english word
comment on: http://stackoverflow.com/q/21715354
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33060660
has text: You can find some info on lists [here](http://docs.oracle.com/javase/7/docs/api/java/util/List.html)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21841419

http://stackoverflow.com/comment/32982401
type: Comment
comment on: http://stackoverflow.com/a/21685503
has text: And i have updated the question with expected behavior needed to achieve. Do you have any suggestion?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32950101
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21757107
has text: Refer this Tutorial [link](http://adanware.blogspot.in/2012/04/android-custom-tab-layouts-just-using.html)
type: AnswerComment

http://stackoverflow.com/q/21810076
tagged with: arraylist
score: 0
accepted answer: http://stackoverflow.com/a/21810307
has comment: http://stackoverflow.com/comment/33005247
has comment: http://stackoverflow.com/comment/33005169
answer count: 1
has title: Why is my ArrayList being populated with duplicate node values?
has comment: http://stackoverflow.com/comment/33005311
has body: It should simply be 5=[6] for node 5, why 3 different values. Also, I know, this current code is buggy big time, because it would even do 2=[3,3] when I add in edges like 2,1 and 2,3. It just keeps replacing the old values with the last one and duplicates it. Here's an image with the results. Graph.java import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; public class Graph { HashMap &lt;Integer, ArrayList&lt;Integer&gt;&gt; adj =new HashMap&lt;Integer, ArrayList&lt;Integer&gt;&gt;(); public void addEdge(int source, int destination) { ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); adj.put(source,list); list.add(destination); for(Entry&lt;Integer, ArrayList&lt;Integer&gt;&gt; entry: adj.entrySet()) { int existing = entry.getKey(); System.out.println("Existing: "+existing); System.out.println("Source: " +source); if (source != existing) { //adj.get(2).add(9); //System.out.println(source +": "+ destination); adj.get(source).add(destination); } } } public void print() { System.out.println(adj); } } AdjacencyList.java import java.util.Scanner; public class AdjacencyList { public static void main(String[] args) { Scanner in = new Scanner (System.in); System.out.println("Enter nodes below like (u,v):"); Graph g = new Graph(); for (int i=0; i&lt;3; i++) { String nodes = in.nextLine(); String[] data = nodes.split(","); String u = data[0]; String v = data[1]; int inNode = Integer.parseInt(u); int outNode =Integer.parseInt(v); g.addEdge(inNode,outNode); System.out.println("Added to list"); } g.print(); } }
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21810307
type: Question
has comment: http://stackoverflow.com/comment/33005280
has comment: http://stackoverflow.com/comment/33005215
has comment: http://stackoverflow.com/comment/33005245

http://stackoverflow.com/comment/33010447
has text: Check if required classes are in your classpath
comment on: http://stackoverflow.com/q/21813069
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/33021876
has text: there is no code in those two methods
comment on: http://stackoverflow.com/q/21818824
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21810307
has comment: http://stackoverflow.com/comment/33005758
answers question: http://stackoverflow.com/q/21810076
type: AcceptedAnswer
downvote count: 0
has body: From what I can tell you have a Map of source -&gt; List&lt;destination&gt; which you are updating. You add a new source node and you map it to all the existing sources as a destination. So, for example I have 1 -&gt; [2,3] 2 -&gt; [1,3] 3 -&gt; [1,2] If I add a new mapping by calling addEdge(4, 5) I should end up with 1 -&gt; [2,3,5] 2 -&gt; [1,3,5] 3 -&gt; [1,2,5] 4 -&gt; [5] Is that correct? In this case your code is flawed. First note that here: adj.get(source).add(destination); You always add the destination to the List&lt;destination&gt; belonging to the source node. So when you call addEdge(4, 5) in the above example (assuming iteration in order for simplicity): entry.key() is 1, 1 != 4, add 5 to adj.get(4) entry.key() is 2, 2 != 4, add 5 to adj.get(4) entry.key() is 3, 3 != 4, add 5 to adj.get(4) entry.key() is 4, 4 == 4, noop. So you end up with: 1 -&gt; [2,3] 2 -&gt; [1,3] 3 -&gt; [1,2] 4 -&gt; [5,5,5] To fix this I would need to know what you expected output is for a given initial state and inputs - i.e. I would need to algorithm. At a guess I would say you want to do this: Map&lt;Integer, List&lt;Integer&gt;&gt; adj = new HashMap&lt;&gt;(); public void addEdge(int source, int destination) { List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); adj.put(source, list); list.add(destination); for (final Entry&lt;Integer, List&lt;Integer&gt;&gt; entry : adj.entrySet()) { if (source != entry.getKey()) { entry.getValue().add(destination); } } } i.e. entry.key() is 1, 1 != 4, add 5 to adj.get(1) entry.key() is 2, 2 != 4, add 5 to adj.get(2) entry.key() is 3, 3 != 4, add 5 to adj.get(3) entry.key() is 4, 4 == 4, noop. I have also changed the code to program to the interface and use Java 7 diamond syntax for readability. In this case, the only reason that you need to do the check at all is that you put the destination into the new List you create before you loop. May I suggest: public void addEdge(int source, int destination) { if (adj.get(source) == null) { adj.put…
type: Answer
has comment: http://stackoverflow.com/comment/33006042
has comment: http://stackoverflow.com/comment/33005883
has comment: http://stackoverflow.com/comment/33005805
has comment: http://stackoverflow.com/comment/33005906
has comment: http://stackoverflow.com/comment/33006091
has comment: http://stackoverflow.com/comment/33005838
has comment: http://stackoverflow.com/comment/33005622
accepted answer of: http://stackoverflow.com/q/21810076
upvote count: 1
score: 1

http://stackoverflow.com/comment/32831789
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21686202
type: Comment
has text: but how can i call my class if i add constructor? i called like BackGroundTask doItInBackGround = new BackGroundTask(); doItInBackGround.execute(); and how can i call it now?

http://stackoverflow.com/comment/32945073
comment on: http://stackoverflow.com/q/21776462
type: Comment
type: QuestionComment
has text: This strings do not seem to be very large "1048576" = 7 chars, or do you mean that there are 1048576 chars in the string?
score: 0

http://stackoverflow.com/comment/32810281
comment on: http://stackoverflow.com/q/21700988
type: Comment
type: QuestionComment
has text: use a debugger and find out what is the value of `$F{t3}` passed to `SimpleDateFormat#format()`
score: 1

http://stackoverflow.com/comment/33025006
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21821185
score: 0
has text: I'm surprised that decimalFormatSymbols.setDecimalSeparator(','); isn't acting like we'd expect, whereas setGroupingSeparator does work. Either this is a bug in Java (which I tend to think is unlikely, but you never know) or there's an assumption here that we are missing.

http://stackoverflow.com/q/21696900
possible better answer: http://stackoverflow.com/a/21697264
tagged with: android
answer count: 4
favorite count: 0
has body: I use a GridLayout in an Android application but I have a display problem, I used setColumnCount to have 3 column because I have to add 3 elements per line, so it should be aligned. layout1 = new GridLayout(this); layout1.setColumnCount(3); //In a loop later in the code : layout1.addView(textView1); layout1.addView(cb); layout1.addView(textView2); 3 items are not aligned with the lines, but they are all in the first column, I do not really understand the problem.
has answer: http://stackoverflow.com/a/21697423
upvote count: 1
has answer: http://stackoverflow.com/a/21697264
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21697116
accepted answer: http://stackoverflow.com/a/21697116
has answer: http://stackoverflow.com/a/21697345
downvote count: 0
has title: Android Grid Layout display

http://stackoverflow.com/q/21762406
linked to: http://stackoverflow.com/q/14935755
type: Question
tagged with: apache-kafka
has title: Kafka High Level Consumer Fetch All Messages From Topic Using Java API (Equivalent to --from-beginning)
tagged with: consumer
score: 7
tagged with: java
upvote count: 7
downvote count: 0
favorite count: 0
has body: I am testing the Kafka High Level Consumer using the ConsumerGroupExample code from the Kafka site. I would like to retrieve all the existing messages on the topic called "test" that I have in the Kafka server config. Looking at other blogs, auto.offset.reset should be set to "smallest" to be able to get all messages: private static ConsumerConfig createConsumerConfig(String a_zookeeper, String a_groupId) { Properties props = new Properties(); props.put("zookeeper.connect", a_zookeeper); props.put("group.id", a_groupId); props.put("auto.offset.reset", "smallest"); props.put("zookeeper.session.timeout.ms", "10000"); return new ConsumerConfig(props); } The question I really have is this: what is the equivalent Java api call for the High Level Consumer that is the equivalent of: bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
has answer: http://stackoverflow.com/a/43605417
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21842197
has answer: http://stackoverflow.com/a/34170593
answer count: 4
has answer: http://stackoverflow.com/a/33797631

http://stackoverflow.com/comment/32919873
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21762438
has text: Do you add the Labels to the ContentPane or do you have an extra JPanel for the Labels?

http://stackoverflow.com/comment/32942935
comment on: http://stackoverflow.com/q/21774883
score: 0
has text: @Joe I am asking if this particular jsp is showing error or all are.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32932001
type: AnswerComment
comment on: http://stackoverflow.com/a/21768764
score: 0
has text: If you look a little more to the bottom of the list, there's an answer with twice more upvotes than the actual accepted one, that's the proper way to do it, having statics referenced this way is the first step of crappy code...
type: Comment

http://stackoverflow.com/comment/32786906
has text: Just a note: manually entered date strings are for the birds, even if you can force format with a `JFormattedTextField`. I suggest using [JDateChooser](http://toedter.com/jcalendar/) instead.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21681914

http://stackoverflow.com/comment/33013547
type: Comment
has text: GC can track the object wherever it is in the JVM - so that is not the problem. In this particular case caching Color instances will help reduce some object instantiation and GC. However, none of them are causing any significant problem in this code. As I have demonstrated paint cycle runs in 0-1 millisecond on a i5 processor. Paint cycles completing in less than 30-40 milliseconds are not at all problem because that allows us to repaint the screen at least 25 times a second surpassing persistence of vision. Whatever problem kmes40505 has observed has got nothing to do with painting.
comment on: http://stackoverflow.com/a/21807019
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32935713
score: 0
type: Comment
has text: Your answer was better before you edited it. There's no need for a whole array, when all the OP wants to do is print the values. Just do the `a[i] & 0xff` part and print what comes out.
type: AnswerComment
comment on: http://stackoverflow.com/a/21770994

http://stackoverflow.com/comment/32875258
has text: ad 2. the converter will still have to access privite fields of domain objects, right?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21699965

http://stackoverflow.com/a/21798790
downvote count: 0
answers question: http://stackoverflow.com/q/21798538
type: Answer
upvote count: 1
has body: How do I reference the class? By its fully.qualified.class.name.IncludingThePackage. Note that you may need to teach ProGuard not to obfuscate the name of this class for your release builds.
score: 1

http://stackoverflow.com/q/21733031
answer count: 1
has comment: http://stackoverflow.com/comment/32868462
type: UnansweredQuestion
tagged with: scala
tagged with: intel
has body: I am using eclipse with java and scala via the package link: http://downloads.typesafe.com/scalaide-pack/3.0.2.vfinal-210-20131028/scala-SDK-3.0.2-vfinal-2.10-win32.win32.x86_64.zip I imported some libraries that use openCL, and when I attempt to use them, I get the run-time error: can not create command queue on CLDevice [id: 8791129068288 name: Intel(R) HD Graphics 4000 type: GPU profile: FULL_PROFILE] with properties: [OUT_OF_ORDER_MODE] [error: CL_INVALID_QUEUE_PROPERTIES] com.jogamp.opencl.CLException$CLInvalidQueuePropertiesException: can not create command queue on CLDevice [id: 8791129068288 name: Intel(R) HD Graphics 4000 type: GPU profile: FULL_PROFILE] with properties: [OUT_OF_ORDER_MODE] [error: CL_INVALID_QUEUE_PROPERTIES] I have an 'Intel(R) HD Graphics 4000', (Under 'device manager'>'display adapters') I have also installed the runtime and application SDKs for Intel via: http://registrationcenter.intel.com/irc_nas/3782/intel_sdk_for_ocl_applications_2013_r3_runtime_x64_setup.msi http://registrationcenter.intel.com/irc_nas/3782/intel_sdk_for_ocl_applications_2013_r3_x64_setup.exe
has comment: http://stackoverflow.com/comment/32867919
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32868290
type: Question
has answer: http://stackoverflow.com/a/22031799
has title: Use OpenCL with scala, java and eclipse
score: 0
tagged with: opencl

http://stackoverflow.com/comment/32969612
has text: Any particular reason why you didn't use the install from the Eclipse site?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21789381

http://stackoverflow.com/comment/32898070
type: Comment
type: QuestionComment
has text: Have you tried with full path to file? Probably the issue is with cwd not being what you think it is. Privilege elevation is never an answer.
comment on: http://stackoverflow.com/q/21749862
score: 0

http://stackoverflow.com/comment/33086703
has text: Hi Dmitry, thanks for the tip I added for all Dispatch calls the appropriate "safeRelease()" Method and added to the java call "-Dcom.jacob.autogc=true". Interesting, is that it crashes the same way but when I add the Debug Method for JACOB as wall (-Dcom.jacob.autogc=true). It runs as expected and is releasing the objects and connections. Some suggestion?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21808727

http://stackoverflow.com/q/21782568
has comment: http://stackoverflow.com/comment/74561858
tagged with: java
tagged with: swing
type: Question
has body: public String runMsg(String fileName, File Path, int option) { int x = 0; String name = " ", ret = ""; if (option == 1) { x = fileName.indexOf(".c"); name = fileName.substring(0, x); command = name + ".exe &lt; C:\\iptest\\input.txt &gt; C:\\outtest\\" + name + ".txt"; } else if (option == 2) { x = fileName.indexOf(".cpp"); name = fileName.substring(0, x); command = name + ".exe &lt; C:\\iptest\\input.txt &gt; C:\\outtest\\" + name + ".txt"; } else { x = fileName.indexOf(".java"); name = fileName.substring(0, x); command = "java " + name + " &lt; C:\\iptest\\input.txt &gt; C:\\outtest\\" + name + ".txt"; } String output = executeCommand(command, Path); } private String executeCommand(String command, File Path) { StringBuffer output = new StringBuffer(); Process p; try { p = Runtime.getRuntime().exec(command, null, Path); p.waitFor(); BufferedReader reader1 = new BufferedReader(new InputStreamReader(p.getErrorStream())); BufferedReader reader2 = new BufferedReader(new InputStreamReader(p.getInputStream())); // BufferedReader reader3 = new BufferedReader(new InputStreamReader(p.getOutputStream())); String line = ""; while ((line = reader1.readLine()) != null) { output.append(line + "\n"); } while ((line = reader2.readLine()) != null) { output.append(line + "\n"); } } catch (Exception e) { e.printStackTrace(); } return output.toString(); } I am trying to execute a .class file from another java file. The .java file will take input from a txt file located at C:\iptest\input.txt and will produce an output file at the following location C:\outputtest\out.txt but when I run this application nothing happens and the application goes into some kind of infinite loop.
has comment: http://stackoverflow.com/comment/32956095
score: 0
has comment: http://stackoverflow.com/comment/32955857
has comment: http://stackoverflow.com/comment/32956428
has comment: http://stackoverflow.com/comment/32956301
has title: executing java commands from another java file
has comment: http://stackoverflow.com/comment/32956878
type: UnansweredQuestion
tagged with: command-line
has comment: http://stackoverflow.com/comment/120795140
answer count: 0

http://stackoverflow.com/comment/32802979
has text: I would like to thank a lot for your time and to find bug I made. I am grateful to you.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21696420

http://stackoverflow.com/comment/33016815
type: QuestionComment
has text: if you're using the actual code there, it contains an infinite loop that spins the CPU as fast as it can. I'd do a Thread.Sleep(1000); call in the run() method.
comment on: http://stackoverflow.com/q/21816244
score: 0
type: Comment

http://stackoverflow.com/comment/32989287
type: Comment
score: 0
has text: too bad it isn't primefaces, otherwise you could use this http://leonotepad.blogspot.com.br/2014/01/primefaces-datatable-lazy-loading-with.html
type: QuestionComment
comment on: http://stackoverflow.com/q/21801248

http://stackoverflow.com/a/30831487
downvote count: 0
type: Answer
upvote count: 2
has body: Use action attribute, but don't keep actionListener anymore. &lt;p:commandButton action="#{processBean.process}" /&gt; To perform the action without validating the form (eg. DELETE), you could then use process attribute as follows: &lt;p:commandButton action="#{processBean.process}" process="@this" /&gt; Note returning the target link with faces-redirect=true public String process() { ... return "/path/to/some.xhtml?faces-redirect=true"; }
answers question: http://stackoverflow.com/q/21782427
score: 2

http://stackoverflow.com/a/21685677
has body: Assuming as per your question you need one class instantiation at a time as per radio button selection ,I would suggest you should create a valueChangeListener to your radio button.I have hardcoded the values of radio selectItem you can use any way either by bean-binding or hardcoded. &lt;h:selectOneRadio value="#{myBean.myRadioValue}" ... onclick="this.form.submit();" valueChangeListener="#{myBean.generatePDF}"&gt; &lt;f:selectItem itemValue="Radio1" itemLabel="Primary-radio" /&gt; &lt;f:selectItem itemValue="Radio2" itemLabel="Secondary-radio" /&gt; &lt;/h:selectOneRadio&gt; This code will submit the form where the radio button are contained when the onclick Javascript event is detected. On the server side, the action generatePDF will be executed. In this method, you can do your requiste as on Submit action getter and setter will be called and you can check which radio is selected by comparing using if () and do your stuff: public void generatePDF(ValueChangeEvent evt) { if(getMyRadioValue.equals(Radio1)){ Primary pr = new Primary(); pr.name = xxxxx; pr.age = yyyyy; } else if(getMyRadioValue.equals(Radio2)){ Secondary s = new Secondary(); s.dept = xxx; s.hour = yyyy;} ... ... }
has comment: http://stackoverflow.com/comment/32783543
has comment: http://stackoverflow.com/comment/32783396
type: Answer
answers question: http://stackoverflow.com/q/21684178
has comment: http://stackoverflow.com/comment/32783866
score: 0

http://stackoverflow.com/q/21696070
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32802102
has comment: http://stackoverflow.com/comment/32802078
downvote count: 0
has title: Why is java.util.RandomAccessSubList not serializable?
has comment: http://stackoverflow.com/comment/32808201
favorite count: 0
tagged with: serialization
has body: Yesterday I had an odd exception that a class cannot be cast to itself - which took me several headbanging hours to solve. Long story short, the reason turned out to be that my EJB service returns a RandomAccessSubList for some cases, which (after checking the source out) I noticed was not Serializable. Of course I realize the guys who created this are probably much smarter than me but I couldn't help thinking that this is not a particularly good design decision. I understand that not all List implementations are Serializable, but why doesn't then the subList method take care of this by providing a SubList instance which implements Serializable for parents that also implement Serializable? It certainly does provide this for the RandomAccess interface. Or why not just mark the RandomAccessSubList as Serializable and let the original implementation (which RandomAccessSubList has a reference to) worry about the Serialization?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1883049
score: 6
upvote count: 6

http://stackoverflow.com/a/21840540
score: 2
has comment: http://stackoverflow.com/comment/33214475
upvote count: 2
has comment: http://stackoverflow.com/comment/33136576
has body: You can specify tweets (by status id) using Paging to get the tweets that were posted in between using the sinceId and maxId methods. since_id: returns elements which id are bigger than the specified id max_id: returns elements which id are smaller than the specified id For example: Paging paging = new Paging(1, 10).sinceId(258347905419730944L).maxId(258348815243960320L); List&lt;Status&gt; statuses = twitter.getHomeTimeline(paging); You can find lots of things here : , and also you can use sthg like that; Query query = new Query("from:somebody").since("2011-01-02"); Twitter twitter = new TwitterFactory().getInstance(); QueryResult result = twitter.search(query);
downvote count: 0
answers question: http://stackoverflow.com/q/21831641
has comment: http://stackoverflow.com/comment/33068232
type: Answer
has comment: http://stackoverflow.com/comment/33114387

http://stackoverflow.com/a/21873023
type: Answer
score: 14
downvote count: 0
has body: System.out.println(UI.getCurrent().getPage().getLocation().getHost()); System.out.println(UI.getCurrent().getPage().getLocation().getPath()); System.out.println(UI.getCurrent().getPage().getLocation().getPort());
upvote count: 14
answers question: http://stackoverflow.com/q/21788023

http://stackoverflow.com/q/21713660
has comment: http://stackoverflow.com/comment/46468163
has comment: http://stackoverflow.com/comment/32834657
has answer: http://stackoverflow.com/a/29494551
possible better answer: http://stackoverflow.com/a/22968928
has answer: http://stackoverflow.com/a/26543441
tagged with: intellij-idea
has title: Android Studio with JUnit testing
tagged with: junit
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32837168
linked to: http://stackoverflow.com/q/2422378
tagged with: android
answer count: 4
tagged with: android-studio
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21792544
has body: UPDATE According to the new build system, the hierarchy should look like: MyProject/ src/ androidTest/ java/ com.example.app.test/ ... (source code for tests) ... main/ AndroidManifest.xml java/ com.example.app/ ... (source code for main application) ... res/ ... (resources for main application) ... However, I don't have access to the package private classes in the com.example.app package. The build.gradle android object looks like: android { compileSdkVersion 19 buildToolsVersion '19.0.1' defaultConfig { minSdkVersion 14 targetSdkVersion 19 testPackageName "com.example.app.test" testInstrumentationRunner "android.test.InstrumentationTestRunner" testFunctionalTest true } } I've also tried using the old structure, and get the error "Main Manifest missing from App/AndroidManifest.xml": sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } instrumentTest.setRoot('tests') } Do I need to use the old structure? What's missing from the new structure that would put the tests in scope of the com.example.app package? UPDATE 2: I'm seeing an error in the instrumentTest folders AndroidManifest.xml file: "Cannot resolve symbol 'com.example.app'" in the element &lt;instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.example.app"/&gt; This is the test class: package com.example.app.test; import junit.framework.TestCase; public class SimpleTest extends TestCase { public SimpleTest(String name) { super(name); } protected void setUp() throws Exception { super.setUp(); assertTrue(true); } public void alwaysPasses() { } } I've also tried extending AndroidTestCase and received this error with both parent classes: !!! JUnit version 3.8 or later expected: java.lang.RuntimeException: Stub! at junit.runner.BaseTestRunner.&lt;init&gt;(BaseTestRunner.java:5) at junit.textui.TestRunner.&lt;…
upvote count: 3
accepted answer: http://stackoverflow.com/a/21792544
type: Question
score: 3
has answer: http://stackoverflow.com/a/22968928
tagged with: java

filewriter
tag name: filewriter
type: Tag
tags question: http://stackoverflow.com/q/21781002
tags question: http://stackoverflow.com/q/21733699

http://stackoverflow.com/comment/32942218
type: QuestionComment
has text: It took @Newbi3 about 10 seconds. The question he put up was the first entry on google. You've clearly not looked that hard.
score: 0
comment on: http://stackoverflow.com/q/21774693
type: Comment

http://stackoverflow.com/q/21705821
possible better answer: http://stackoverflow.com/a/21705864
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21706169
score: 1
tagged with: java
upvote count: 1
has body: considering the following file "sample.txt" as input for a java program which contains the following information: #1|77|1391436891|1|1|00:1e:58:f4:15:f7|Nexus 4, 4.4, MAKOZ30d $1|1391436893 ?[176.08179, -13.839829, -1.0054213] %PKKV7|00:7f:28:3f:17:9d|-67|2437 %DC2VJ|f8:e4:fb:a0:06:f8|-71|2412 %VVWSP|00:7f:28:d5:92:65|-71|2462 %SVT8H|f8:e4:fb:8e:d6:9b|-77|2437 %ThreeBestFriends|20:10:7a:14:6a:f7|-66|2452 %2X4C8|00:7f:28:44:23:da|-75|2437 %STDGD|f8:e4:fb:70:86:f4|-82|2462 %DeathStar|00:7f:28:be:c8:94|-84|2412 %Freeinternet|00:1e:58:f4:15:f7|-59|2437 %QB657|00:26:62:b7:16:4b|-88|2462 %375F2|00:26:b8:3e:0a:14|-70|2412 %E1K38|00:26:62:cf:90:37|-81|2412 I'm trying to get an "output.txt" file as following: 00:7f:28:3f:17:9d|-67 f8:e4:fb:a0:06:f8|-71 00:7f:28:d5:92:65|-71 f8:e4:fb:8e:d6:9b|-77 20:10:7a:14:6a:f7|-66 00:7f:28:44:23:da|-75 f8:e4:fb:70:86:f4|-82 00:7f:28:be:c8:94|-84 00:1e:58:f4:15:f7|-59 00:26:62:b7:16:4b|-88 00:26:b8:3e:0a:14|-70 00:26:62:cf:90:37|-81 any recommendations on how to achieve this in java?
type: Question
has title: extract information separated with pipes from file and save it to another file
has answer: http://stackoverflow.com/a/21705864
answer count: 3
has answer: http://stackoverflow.com/a/21706169
downvote count: 0
has answer: http://stackoverflow.com/a/21706180

automation
tags question: http://stackoverflow.com/q/21785324
tags question: http://stackoverflow.com/q/21705218
tags question: http://stackoverflow.com/q/21777606
tag name: automation
tags question: http://stackoverflow.com/q/21751703
tags question: http://stackoverflow.com/q/21744552
type: Tag

http://stackoverflow.com/q/21764244
tagged with: java
answer count: 3
tagged with: javascript
has body: I'm trying to convert the following JS to Java: serializeSig:function(r,s){ var rBa=r.toByteArraySigned(); var sBa=s.toByteArraySigned(); var sequence=[]; sequence.push(2); sequence.push(rBa.length); sequence=sequence.concat(rBa); sequence.push(2); sequence.push(sBa.length); sequence=sequence.concat(sBa); sequence.unshift(sequence.length); sequence.unshift(48); return sequence } I think push would translate to add, concat to some kind of addAll, but what is unshift? And of what type would my variables in java be?
upvote count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21764409
favorite count: 0
has answer: http://stackoverflow.com/a/21764354
type: Question
accepted answer: http://stackoverflow.com/a/21764409
has answer: http://stackoverflow.com/a/21764406
possible better answer: http://stackoverflow.com/a/21764354
score: 4
has title: What are java equivalents to JS push, concat, unshift?

http://stackoverflow.com/q/21805435
favorite count: 0
upvote count: 5
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/33264718
type: AnsweredQuestion
tagged with: facebook-sdk-3.0
has comment: http://stackoverflow.com/comment/33263758
tagged with: java
has answer: http://stackoverflow.com/a/22050436
accepted answer: http://stackoverflow.com/a/22050436
has title: failing to do fb like to postId I have just shared successfully
has comment: http://stackoverflow.com/comment/33265248
type: Question
has comment: http://stackoverflow.com/comment/33264221
has comment: http://stackoverflow.com/comment/33264388
has comment: http://stackoverflow.com/comment/33263990
score: 4
has comment: http://stackoverflow.com/comment/33264145
has comment: http://stackoverflow.com/comment/33258487
has comment: http://stackoverflow.com/comment/33264363
has body: I have shared a url from my android app to FB: I then save aside (hard coded) the postId I try to do "fb like" to that post using this code, but get an error: Button socialBtn3 = (Button) dialog .findViewById(R.id.socialBtn3); socialBtn3.setOnClickListener(new OnClickListener() { String fbPostId = "685560152_10153809399380153"; @Override public void onClick(View v) { new LikeFbPostAsyncTask().execute(fbPostId); } }); and this: public class LikeFbPostAsyncTask extends AsyncTask&lt;String, Void, Void&gt; { public LikeFbPostAsyncTask() { } @Override protected void onPreExecute() { Log.i("LikeFbPostAsyncTask", "Starting web task..."); } @Override protected Void doInBackground(String... fbPostId) { Request likeRequest = new Request(Session.getActiveSession(), fbPostId + "/likes", null, HttpMethod.POST, new Request.Callback() { @Override public void onCompleted(Response response) { Log.i(TAG, response.toString()); // how to return to ui thread? // return response; } }); Request.executeBatchAndWait(likeRequest); return null; } @Override protected void onPostExecute(Void res) { } } {Response: responseCode: 404, graphObject: null, error: {HttpStatus: 404, errorCode: 803, errorType: OAuthException, errorMessage: (#803) Some of the aliases you requested do not exist: [Ljava.lang.String;@4284cd10}, isFromCache:false} how can i solve this?
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33264132
tagged with: facebook-graph-api

http://stackoverflow.com/a/21690797
score: 1
type: Answer
has body: As @Claus suggested, if you could pass the File object, you can make it work. That's the correct way. public class MyClass { public boolean isMp3(File file) { Pattern pattern; final String FILE_PATTERN = "([^\\s]+(\\.(?i)(mp3))$)"; pattern = Pattern.compile(FILE_PATTERN); Matcher matcher = pattern.matcher(file.toString()); if (matcher.find()) { return true; } else { return false; } } public void myMethod() { File file = new File("file1.mp3"); if (isMp3(file)) { System.out.println("is an MP3"); } else { System.out.println("not an MP3"); } } } In your example, the calling code might look like this, File directoryItem; // you get 'directoryItem' from somewhere. directoryItem of type 'File' if (directoryItem.isFile() &amp;&amp; isMp3(directoryItem)) { resultListOfFiles.add(directoryItem); }
upvote count: 1
answers question: http://stackoverflow.com/q/21690220
accepted answer of: http://stackoverflow.com/q/21690220
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32949287
type: Comment
has text: my database containing data like "you can" (coloum value) not "you" "can" like this means it contains phrase
type: AnswerComment
comment on: http://stackoverflow.com/a/21777657
score: 0

http://stackoverflow.com/q/21757346
type: Question
upvote count: 1
has title: How to compare two check box values on android?
favorite count: 0
tagged with: android
answer count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/21778892
accepted answer: http://stackoverflow.com/a/21758230
possible better answer: http://stackoverflow.com/a/21758086
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21757464
has answer: http://stackoverflow.com/a/21758086
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21758230
has body: I am new to Android, please help me. How can I accomplish that a value gets printed, if both check boxes in the following code are enabled? public EditText output; Button one; int a; CheckBox check,check1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); output =(EditText)findViewById(R.id.editText1); one=(Button)findViewById(R.id.button1); check = (CheckBox)this.findViewById(R.id.checkbox1); check1 = (CheckBox)this.findViewById(R.id.checkbox2); check.setOnClickListener(new OnClickListener() { public void onClick(View v) { //is chkIos checked? if (((CheckBox) v).isChecked()) { a=100; } else{ a=0; } } }); check1.setOnClickListener(new OnClickListener() { public void onClick(View v) { //is chkIos checked? if (((CheckBox) v).isChecked()) { a=100; } else{ a=0; } } }); //this statment is wrong. if((check.isChecked() == true)&amp;&amp;(check.isChecked() == true)){ a=200; } one.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(v==one){ output.setText(""+a); } } }); } @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; } }

http://stackoverflow.com/a/21768584
answers question: http://stackoverflow.com/q/21767982
has comment: http://stackoverflow.com/comment/32933733
score: 0
type: Answer
has body: The use of the variable argument operator (...) itself is creating an array local to your method (in this case dubbed "original"), so anything you pass to it will become an array. So are you planning on passing both multi and single dimensional arrays to this method, and then have the method distinguish between the types? If you are not declaring any multi dimensional arrays in your class, then checking for them would be entirely unnecessary. If you do have singles and multis that you want to type cast I might suggest overloading methods, and have the method arguments themselves do the separating. So something like: public static long[] doubleToLong(double[][] original, int index){ //your conversion logic here that will type cast your second dimension array long[] ret = new long[original.length]; for(int i = 0; i &lt; ret.length; i++) ret[i] = (long)original[index][i]; return ret; } public static long[] doubleToLong(double[] original){ //your conversion logic here that type casts a single dimension array long[] ret = new long[original.length]; for(int i = 0; i &lt; ret.length; i++) ret[i] = (long)original[i]; return ret; } That compiled for me, see if it does for you, and also test it to make sure it does what you want. But the method arguments will sort through which arrays are single, and which are multidimensional. Hope it helps! Happy coding!

nexus
type: Tag
tags question: http://stackoverflow.com/q/21805536
tag name: nexus

http://stackoverflow.com/a/21749087
accepted answer of: http://stackoverflow.com/q/21742186
answers question: http://stackoverflow.com/q/21742186
score: 2
type: AcceptedAnswer
downvote count: 0
has body: The code you have picked up from Stanford NLP website performs all the annotations on the text variable. In order to perform specific annotations you have to change the code accordingly. To perform tokenization, this would be sufficient Properties props = new Properties(); props.put("annotators", "tokenize"); StanfordCoreNLP pipeline = new StanfordCoreNLP(props); Annotation document = new Annotation(text); pipeline.annotate(document); for (CoreLabel token: document.get(TokensAnnotation.class)) { String word = token.get(TextAnnotation.class); } This line of code would return Null if annotators doesn't include Sentence Splitter("ssplit") document.get(SentencesAnnotation.class); And so you were encountering NullPointerException.
type: Answer
upvote count: 2

http://stackoverflow.com/a/25421628
type: Answer
has body: One could use somewhat "higher" level sockets - ZeroMQ for this. Here are client and server implementations: You could start with a server to implement jframe.hide API call. Note: if you don't like native C transport implementation, then you could just switch to pure java version without additional changes to your code.
score: 0
answers question: http://stackoverflow.com/q/21777606

http://stackoverflow.com/comment/32925962
type: QuestionComment
has text: @Everton Agner I use this line to the file name will add a ramdom and thus more difficult than the file name this repeated and is replaced. And the file uploaded with the ramdom + the name of the original file, but I need to get this value in jsp fileName to save that value in DB
comment on: http://stackoverflow.com/q/21762650
score: 0
type: Comment

http://stackoverflow.com/comment/32917390
type: Comment
score: 1
has text: Finally the problem was on the way I was sending the variables by POST through PHP. IT shouldn't be in an array but in an string of the type `param1=value&param2=value2`. I will accept this answer as you helped me to reach to the solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/21760139

http://stackoverflow.com/q/21787289
accepted answer: http://stackoverflow.com/a/21792035
has comment: http://stackoverflow.com/comment/32964137
tagged with: java
has comment: http://stackoverflow.com/comment/32964302
possible better answer: http://stackoverflow.com/a/21787373
has comment: http://stackoverflow.com/comment/32964282
type: Question
score: 5
has answer: http://stackoverflow.com/a/21792035
has comment: http://stackoverflow.com/comment/32964125
downvote count: 0
has comment: http://stackoverflow.com/comment/32964256
has answer: http://stackoverflow.com/a/21787807
has comment: http://stackoverflow.com/comment/32964057
answer count: 3
has comment: http://stackoverflow.com/comment/32964093
has comment: http://stackoverflow.com/comment/32964347
has comment: http://stackoverflow.com/comment/32964176
has answer: http://stackoverflow.com/a/21787373
has comment: http://stackoverflow.com/comment/32964267
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/32964166
upvote count: 5
has comment: http://stackoverflow.com/comment/32964207
has comment: http://stackoverflow.com/comment/32964084
has body: Out of curiosity I wrote Hello World and set a break point on my print statement. public class Program { public static void main(String[] args) { System.out.println("Hello"); } } When the break point was hit, I pulled up Task Manager in windows to see how many threads were allocated by that JVM process. I was shocked to see 22. Why are there so many threads spawned for this simple program?
has title: Why does my single threaded hello world app use 22 OS threads?
type: AnsweredQuestion

http://stackoverflow.com/a/21822700
downvote count: 0
has comment: http://stackoverflow.com/comment/33053890
answers question: http://stackoverflow.com/q/21821275
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33040880
has comment: http://stackoverflow.com/comment/33061034
has body: Don't hard-code the newline character, use the system newline character: System.getProperty("line.separator"); How do I get a platform-dependent new line character?
has comment: http://stackoverflow.com/comment/33061048
upvote count: 1

http://stackoverflow.com/comment/33044859
comment on: http://stackoverflow.com/q/21832487
score: 1
type: Comment
type: QuestionComment
has text: And please don't make modifications to the non-comment portion of your code. It took me a second to realize you hadn't confused Java with C.

web-hosting
tags question: http://stackoverflow.com/q/21786016
tag name: web-hosting
type: Tag

http://stackoverflow.com/comment/137624577
comment on: http://stackoverflow.com/a/37657923
has text: The practical advice though, is to not use the same variable name in both child and parent, and that is true for both languages.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21784204
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21784127
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21784127
has comment: http://stackoverflow.com/comment/32958707
has body: You can try creating a String using format specifiers (%.3f) to indicate how many numbers after the decimal point will be showed: double number = 10.123124123; String str = String.format("%.3f", number); // 3 decimals System.out.println(str); // 10,123
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32958926

http://stackoverflow.com/comment/32990263
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21795642
score: 0
has text: @DimaGoltsman For the most implementations yes (and actually some JVM implementations starts by interpreting the bytecode before compiling it). Anyway that does not alter my original statement which was that if you want to comment something, comment it well (is that so hard to use the right terms?).

http://stackoverflow.com/q/21775389
tagged with: android
has comment: http://stackoverflow.com/comment/32943422
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32944916
has comment: http://stackoverflow.com/comment/32944006
tagged with: chartboost
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22939412
score: 0
has answer: http://stackoverflow.com/a/22939412
answer count: 1
has title: loading chartboost Interstitial in android error force closed
has body: Here is my chartboost Mainactivity.java class code // Configure Chartboost this.cb = Chartboost.sharedChartboost(); String appId = "52f48e072d42da4746c0d6e9"; String appSignature = "4198d0da78055b13dc80fc937c1df8b44a498927"; this.cb.onCreate(this, appId, appSignature, null); // Show an interstitial this.cb.showInterstitial(); @Override protected void onStart() { super.onStart(); this.cb.onStart(this); // Notify the beginning of a user session. Must not be dependent on user actions or any prior network requests. this.cb.startSession(); // Show an interstitial this.cb.showInterstitial(); } @Override protected void onStop() { super.onStop(); this.cb.onStop(this); } @Override protected void onDestroy() { super.onDestroy(); this.cb.onDestroy(this); } @Override public void onBackPressed() { // If an interstitial is on screen, close it. Otherwise continue as normal. if (this.cb.onBackPressed()) return; else super.onBackPressed(); } I also include chartboost.jar in my libs folder and also add dependencies in gradle. dependencies { compile 'com.android.support:appcompat-v7:+' compile files ('libs/jsoup-1.7.3.jar') compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar') compile files('libs/chartboost.jar') } also add activity in androidManifest.xml ie &lt;activity android:name="com.chartboost.sdk.CBImpressionActivity" android:excludeFromRecents="true" android:theme="@android:style/Theme.Translucent.NoTitleBar" /&gt; But when I launch my add it just show force closed. Please help me. Thanx in advance.
has comment: http://stackoverflow.com/comment/32944567

http://stackoverflow.com/a/23332484
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21822188
has body: Make sure that URL you are passing is sending IMAGE as response not an full html page. i was passing URL that was sending me a whole html page, so i was unable to see images. But now its fixed. Please visit below link: https://answers.atlassian.com/questions/2907/how-to-access-image-generated-via-velocity-template-confluence
accepted answer of: http://stackoverflow.com/q/21822188
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/32981909
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21797138
has text: Why java does not support the concept of '.exe' file? This is question is in my text book. Can you please answer it.
score: 1

http://stackoverflow.com/comment/32776407
comment on: http://stackoverflow.com/q/21681620
type: Comment
has text: Have you looked into any VBA/Office scripting?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32800663
type: Comment
score: 1
has text: Because that's the way they designed it. There is plenty of material on this topic available.
comment on: http://stackoverflow.com/q/21695205
type: QuestionComment

http://stackoverflow.com/comment/32906356
score: 0
comment on: http://stackoverflow.com/q/21754107
type: Comment
type: QuestionComment
has text: @Piyush Gupta nothing has changed after adding on .setOnCheckedChangeListener

http://stackoverflow.com/q/21782378
tagged with: spring-ws
score: 1
tagged with: java
tagged with: jdom-2
has answer: http://stackoverflow.com/a/21810534
has comment: http://stackoverflow.com/comment/32958018
type: Question
tagged with: jdom
has comment: http://stackoverflow.com/comment/33005917
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/21810534
tagged with: web-services
type: AnsweredQuestion
has title: spring-ws jdom wrong response
has body: I'm struggling with Spring-WS, used with JDOM. Code: @Endpoint @Namespace(uri = "http://example.pl/gb/schemas", prefix = "gb") public class PdfCheckStatusEndPoint { private static final String NAMESPACE_URI = "http://example.pl/gb/schemas"; ... @PayloadRoot(namespace = NAMESPACE_URI, localPart = "PdfStatusRequest") @Namespace(uri = NAMESPACE_URI, prefix = "sch") @ResponsePayload public Element getPdfStatus(@XPathParam("//sch:policyNr") String policyNr) { org.jdom2.Namespace javaxml2Namespace = org.jdom2.Namespace.getNamespace("http://example.pl/gb/schemas"); Element responseElement = new Element("PersonResponse", javaxml2Namespace); Element childElement1 = new Element("FullName"); childElement1.setText("john doe"); Element childElement2 = new Element("SSN"); childElement2.setText("12345"); responseElement.addContent(childElement1); responseElement.addContent(childElement2); return responseElement; } } The endpoint works itself, but the response is other than expected: &lt;env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;env:Header/&gt; &lt;env:Body&gt; &lt;PersonResponse xmlns="http://example.pl/gb/schemas"/&gt; &lt;/env:Body&gt; &lt;/env:Envelope&gt; As you can see, no children are returned, just the root element. Any ideas?
has comment: http://stackoverflow.com/comment/32958076

http://stackoverflow.com/comment/32950076
has text: @JB Nized thats it what I want regarding that last post about How to read Java ArrayList sub-items
type: QuestionComment
comment on: http://stackoverflow.com/q/21779577
type: Comment
score: 0

http://stackoverflow.com/a/21832825
downvote count: 0
has comment: http://stackoverflow.com/comment/33045325
has comment: http://stackoverflow.com/comment/33094041
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21832049
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21832049
has body: Define a separate smtp:connector like in the Jira description and try to set the content type in a Groovy script somewhere inside the flow like this: muleContext.getRegistry().lookupObject('smtpConnector').setContentType('text/html')

http://stackoverflow.com/comment/32828079
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21710703
has text: Have you looked into the src code of Arrays.asList(), There is no iterator. It calls the constructor of java.util.Arrays.ArrayList (not java.util.ArrayList)
type: Comment

http://stackoverflow.com/comment/32936450
score: 0
type: QuestionComment
type: Comment
has text: Are you given the option to name the nested target package when you CTRL+V?
comment on: http://stackoverflow.com/q/21771276

http://stackoverflow.com/comment/32962801
type: Comment
has text: Thanks! It's still telling me that every spot in the cp[][] array is null when I try to use it in the getPixel method. I can access the array fine in setPixel. Have any idea why that would be?
comment on: http://stackoverflow.com/a/21775356
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33043193
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21831703
type: AnswerComment
has text: The behavior is not the same if there is any number of rows, I use this all the time. If you want to see how many rows there are, see Cursor.getCount(), that should let you verify the number of rows.

http://stackoverflow.com/comment/33001191
type: QuestionComment
has text: @SotiriosDelimanolis: Not sure how this is a string comparison issue? As I explained before, I've used several other conditions (i.e. "while (st2.hasMoreTokens)" or "while ((st2.nextToken) != null)" all with the same result.
type: Comment
comment on: http://stackoverflow.com/q/21807792
score: 0

http://stackoverflow.com/comment/32906595
comment on: http://stackoverflow.com/q/21755067
score: 0
type: Comment
has text: In what? **eclipse IDE** for a **maven** project? Add key words. Maven itself has a `pom.xml` with `<dependency>` for every jar.
type: QuestionComment

http://stackoverflow.com/q/21795636
tagged with: android
has body: Example: public int testing(){ return 1; } public void main(){ int getnum = testing(); } int getnum = testing(); basically calls the testing method and it returns 1 and asigns the value of 1 to the variable getnum which is of type int. Does this same logic also apply to the following code in eclipse?: public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return true; } So does this basically do the same thing as the code at the top? does it create an object of type MenuInflater called inflater and then calls getMenuInflater method which returns an object of type MenuInflater? as i understand it, this code is equivalent to the following getMenuInflater().inflate(R.menu.main,menu); so inflater is now getMenuInflater()? I don't understand. Any help would be much appreciated. thanks.
has title: confusion regarding menu inflater and object properties in general
tagged with: menu
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32979292
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32989768
type: Question
has comment: http://stackoverflow.com/comment/32989685
score: 0

minecraft
tags question: http://stackoverflow.com/q/21712888
tags question: http://stackoverflow.com/q/21681066
type: Tag
tags question: http://stackoverflow.com/q/21744679
tags question: http://stackoverflow.com/q/21731765
tags question: http://stackoverflow.com/q/21837890
tag name: minecraft

http://stackoverflow.com/a/21681220
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21681094
type: Answer
has comment: http://stackoverflow.com/comment/116463153
score: 1
has body: What I understand that Abstract classes may contain abstract (empty without implementation) methods. If we instantiate an object and call the empty method, It's not going to work and may cause problem, hence compiler forces this RULE. any further in-sighter ?

http://stackoverflow.com/comment/32928336
comment on: http://stackoverflow.com/a/21766858
has text: So any class that implements an interface automatically ISA that interface? (When I read that out loud it makes me laugh).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32875861
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21714988
type: AnswerComment
has text: @TeddHopp so it doesn't matter what it says after int it could say number but could say anything. Have I got that right?

http://stackoverflow.com/q/21692850
tagged with: android
has title: java.lang.ClassNotFoundException for package com.twilio.sdk
downvote count: 1
has body: This is in continuation to my previous question: Getting compile error: package com.twilio.sdk does not exist I got to resolve the complie error and now trying to run the uiautomator test on an android device. However, I am getting java.lang.ClassNotFoundException as the android device would not have Twilio API jars/classes. So, I searched for solutions where I could build my final jar with Twilio API jar or the classes within that. I came across 'jar-jar' and 'one-jar' approaches to do so but did not work. I may be doing something wrong here. I'd really appreciate if someone could give a sample how to use any of these approaches. I also found couple of other suggestions to do it via 'build.xml' such as adding the following line to the '-jar' task: &lt;zipgroupfileset dir="${jar.libs.dir}" includes="*.jar"/&gt; The above approached did include the Twilio classes to my final jar (my final jar size got increased by the size of the Twilio jar), however, my final jar could not persist the directory strucure for the Twilio classes within it. My final jar had all the classes at the root directory and all the folders were blank. So, I am not aware of any more approaches to resolve this. If anyone of you have any suggestions/idea, please share. Regards, Rumit
favorite count: 0
has answer: http://stackoverflow.com/a/21692924
linked to: http://stackoverflow.com/q/21588186
type: UnansweredQuestion
score: 2
tagged with: build
tagged with: ant
tagged with: java
has answer: http://stackoverflow.com/a/21692955
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32796644
upvote count: 3

http://stackoverflow.com/a/21719301
accepted answer of: http://stackoverflow.com/q/21717824
type: AcceptedAnswer
downvote count: 0
has body: IntelliJ IDEA > Preferences... > Maven > Runner Or you can add -Denvironment=env to VM Options.
answers question: http://stackoverflow.com/q/21717824
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/32828675
score: 0
type: AnswerComment
type: Comment
has text: I added the warmup I used, but it appears that the number of elements may have been the suspect case
comment on: http://stackoverflow.com/a/21710742

http://stackoverflow.com/comment/33037720
type: AnswerComment
comment on: http://stackoverflow.com/a/21813430
score: 0
type: Comment
has text: for one thing, the BorderLayout based solution recommended above will NOT work if there's any other component in the other compartments of the parent container. doLayout while I agree is a questionable solution is actually quite handy in a few situations. and as a non final method, the API design does not suggest that one should not use it.

http://stackoverflow.com/comment/33030148
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21824213
type: Comment
has text: Yeah, that is the problem with PCI modems. They are no HW but SW modems. Try to get a true serial modem (even USB). You will safe a lot of headache.

http://stackoverflow.com/a/21792919
accepted answer of: http://stackoverflow.com/q/21792768
answers question: http://stackoverflow.com/q/21792768
type: AcceptedAnswer
score: 0
has body: Here's a basic implementation of sorting and binary-searching a list of ints. import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; /** &lt;P&gt;{@code java OrderIntListXmpl}&lt;/P&gt; **/ public class OrderIntListXmpl { public static final void main(String[] igno_red) { int[] aiNums = new int[] {1, 11, 29, 12, 13, 19, 7, 2, 6, 16, 10, 15, 112, 18, 20, 3, 8, 5, 9, 14}; System.out.println("Unsorted: " + Arrays.toString(aiNums)); ArrayList&lt;Integer&gt; alNums = new ArrayList&lt;Integer&gt;(aiNums.length); for(int i : aiNums) { alNums.add(i); } Collections.sort(alNums); System.out.println("Sorted: " + Arrays.toString(alNums.toArray())); int ixOf12 = Collections.&lt;Integer&gt;binarySearch(alNums, 12); System.out.println("Index of number 12: " + ixOf12); } } Output: [C:\java_code\]java OrderIntListXmpl Unsorted: [1, 11, 29, 12, 13, 19, 7, 2, 6, 16, 10, 15, 112, 18, 20, 3, 8, 5, 9, 14] Sorted: [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 29, 112] Index of number 12: 10 Javadoc for sort and binarySearch
type: Answer

http://stackoverflow.com/a/21730861
upvote count: 3
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/32864041
accepted answer of: http://stackoverflow.com/q/21730776
score: 3
answers question: http://stackoverflow.com/q/21730776
downvote count: 0
has body: Isn't this: java.io.FileNotFoundException: /jokesBody.bjk: open failed: EROFS (Read-only file system) the issue ? You're writing to a non-writeable area. Change where you're writing to (perhaps creating a temporary file would be a simple first step - I'm not familiar with Android but I assume this is possible)

http://stackoverflow.com/a/21780460
has comment: http://stackoverflow.com/comment/32954648
downvote count: 1
has body: OK, besides the equals fix, you want to keep the original order of words: String orig = "hellow hello hello how how he ho" ; //String orig = "how are you how do you do"; String[] arr = orig.split(" "); //Arrays.sort(arr); for(int j1 = 0; j1 &lt; arr.length; j1++){ if (arr[j1] != null) { int counter = 1; for(int j2 = j1+1; j2 &lt; arr.length; j2++) { if(arr[j2] != null &amp;&amp; arr[j1].equals(arr[j2])){ counter++; arr[j2] = null; } } System.out.println(arr[j1]+" "+counter); } } The trick is that I run through the array, count all occurrences, null the occurrences, so they don't count again, and print the count. No need to sort the array.
type: Answer
has comment: http://stackoverflow.com/comment/32952204
score: 2
has comment: http://stackoverflow.com/comment/32952603
has comment: http://stackoverflow.com/comment/32951693
has comment: http://stackoverflow.com/comment/32952358
answers question: http://stackoverflow.com/q/21780424
upvote count: 3
has comment: http://stackoverflow.com/comment/32952851
has comment: http://stackoverflow.com/comment/32965831

http://stackoverflow.com/comment/32841419
type: QuestionComment
comment on: http://stackoverflow.com/q/21717824
type: Comment
has text: What context are you wanting to set this in--is this for the Maven build? For executing the code?
score: 0

http://stackoverflow.com/comment/32983778
has text: @Aquillo Yeah, something like that, so..
comment on: http://stackoverflow.com/q/21798202
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/89549443
type: AnswerComment
has text: Luyten is very nice. However, it doesn't decompile .war files, whereas JD-GUI does.
type: Comment
comment on: http://stackoverflow.com/a/21732135
score: 0

http://stackoverflow.com/comment/33031973
has text: Why? JSP is only defined to run inside a Servlet container. You've got a large task in front of you if you're reimplementing Tomcat, or Glassfish, or JBoss.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21779241
score: 2

http://stackoverflow.com/comment/32863252
score: 0
type: Comment
type: QuestionComment
has text: SO helps those who help themselves... what do you have so far?
comment on: http://stackoverflow.com/q/21730620

http://stackoverflow.com/a/21738719
accepted answer of: http://stackoverflow.com/q/21729755
type: Answer
score: 2
downvote count: 0
has body: You can supply a connection property to the JDBC driver that will return invalid dates as NULL. The property is named zeroDateTimeBehavior For details see the manual: http://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21729755

http://stackoverflow.com/q/21813998
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21814020
tagged with: java
has answer: http://stackoverflow.com/a/21814011
has comment: http://stackoverflow.com/comment/33012266
type: Question
has answer: http://stackoverflow.com/a/21814093
upvote count: 2
has title: Comparing two distinct characters based only on their case
favorite count: 0
has body: I want to compare two separate characters on their case only. For example 'a' == 'b' would return true. Where as 'A' == 'a' would be false. What's the best way to do this?
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/21814072
has comment: http://stackoverflow.com/comment/33012087

locking
tags question: http://stackoverflow.com/q/21761878
type: Tag
tags question: http://stackoverflow.com/q/21725410
tags question: http://stackoverflow.com/q/21785925
tags question: http://stackoverflow.com/q/21712413
tag name: locking

http://stackoverflow.com/a/21758838
type: Answer
has body: Android and GL contexts are different and they run on different(manages) threads in their own way so if you want to create a square on the touch you've to create object, you have to do it in GLcontext like this http://pastebin.com/zAav7jpu Initialize your object in touch/or where you want to do public static isAddedBody = false; //declare globally in touch_class public void touch(int.. whateva){ mSquare = new Square(); isAddedBody = true; } in render()/or draw() loop if (touch_class.isAddedBody){ mSquare.createBody(); touch_class.isAdded = false; }
answers question: http://stackoverflow.com/q/21682801
score: 0

http://stackoverflow.com/q/21752443
has comment: http://stackoverflow.com/comment/32933725
has comment: http://stackoverflow.com/comment/32915882
has answer: http://stackoverflow.com/a/21769875
tagged with: spring
type: AnsweredQuestion
tagged with: java
has title: spring security custom session timeout stuck in infinite loop
type: Question
accepted answer: http://stackoverflow.com/a/21769875
tagged with: spring-security
score: 0
has body: I am trying to implement a custom session timeout handler using spring security to add a dynamic parameter onto the redirect url and I have a problem where I am getting into an infinite loop but I don't know why. I was wondering if someone could enlighten me on this? &lt;http use-expressions="true" auto-config="false" entry-point-ref="loginUrlAuthenticationEntryPoint"&gt; &lt;!-- custom filters --&gt; &lt;custom-filter position="FORM_LOGIN_FILTER" ref="twoFactorAuthenticationFilter" /&gt; &lt;custom-filter after="SECURITY_CONTEXT_FILTER" ref="securityLoggingFilter"/&gt; &lt;custom-filter before="SESSION_MANAGEMENT_FILTER" ref="sessionManagementFilter" /&gt; &lt;!-- session management --&gt; &lt;session-management session-fixation-protection="none" /&gt; &lt;!-- error handlers --&gt; &lt;access-denied-handler error-page="/accessDenied.htm"/&gt; &lt;!-- logout --&gt; &lt;logout invalidate-session="false" delete-cookies="JSESSIONID" success-handler-ref="customUrlLogoutSuccessHandler"/&gt; &lt;!-- authorize pages --&gt; &lt;intercept-url pattern="/home.htm" access="isAuthenticated()" /&gt; &lt;intercept-url pattern="/shortsAndOvers.htm" access="isAuthenticated()" /&gt; &lt;intercept-url pattern="/shortsAndOversDaily.htm" access="isAuthenticated()" /&gt; &lt;intercept-url pattern="/birtpage.htm" access="isAuthenticated()" /&gt; &lt;intercept-url pattern="/reports/show.htm" access="isAuthenticated()" /&gt; &lt;/http&gt; &lt;beans:bean id="sessionManagementFilter" class="org.springframework.security.web.session.SessionManagementFilter"&gt; &lt;beans:constructor-arg name="securityContextRepository" ref="httpSessionSecurityContextRepository" /&gt; &lt;beans:property name="invalidSessionStrategy" ref="customSimpleRedirectInvalidSessionStrategy" /&gt; &lt;/beans:bean&gt; &lt;beans:bean id="customSimpleRedirectInvalidSessionStrategy" class="com.myer.reporting.security.CustomSimpleRedirectInvalidSessionStrategy"&gt; &lt;beans:constructor-arg name="invalidSessionUrl" value="/sess…
answer count: 1

http://stackoverflow.com/comment/32800740
score: 0
has text: The javadoc for `.getLocalHost()` says that it is "[...] achieved by retrieving the name of the host from the system, then resolving that name into an InetAddress.". Unavailable/slow name resolution?
comment on: http://stackoverflow.com/q/21694805
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33105806
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21829639
score: 0
has text: 1) 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/). 2) Why AWT rather than Swing? See my answer on [Swing extras over AWT](http://stackoverflow.com/a/6255978/418556) for many good reasons to abandon using AWT components.

http://stackoverflow.com/a/21786801
has comment: http://stackoverflow.com/comment/40106646
score: 0
answers question: http://stackoverflow.com/q/21739760
has body: My version looks like this... private URL mockURL() throws IOException{ final URLConnection mockConnection = PowerMock.createMock(URLConnection.class); InputStream i = IOUtils.toInputStream(XSLT, "UTF-8"); EasyMock.expect(mockConnection.getInputStream()).andReturn(i); EasyMock.replay(mockConnection); final URLStreamHandler handler = new URLStreamHandler() { @Override protected URLConnection openConnection(final URL arg0) throws IOException { return mockConnection; } }; return new URL("http://foo.bar", "foo.bar", 80, "", handler); }
type: Answer

http://stackoverflow.com/comment/32921745
type: Comment
comment on: http://stackoverflow.com/a/21762676
has text: Yes, you can. You can't put a JSP tag into another JSP tag. But everything that is not a JSP tag or a scriptlet expression is considered as text by the JSP engine. "It", I guess, is your IDE. But your IDE is dumb. Deploy your app and test it. And if you don't like it, you can also use ` `
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32795627
comment on: http://stackoverflow.com/a/21692078
score: 0
type: AnswerComment
type: Comment
has text: +1 This is more or less what I was going to say. You could use the ternary instead of `Math.max`: `a.length < b.length ? b.length : a.length`. Not sure which one is more obvious. Most people would also recommend some braces for the `if` statements, or at least put the then block on the same line. Regardless of the nitpicks, much simpler and shorter this way.

http://stackoverflow.com/q/21770875
score: 0
has comment: http://stackoverflow.com/comment/32935405
answer count: 2
has comment: http://stackoverflow.com/comment/32935470
has answer: http://stackoverflow.com/a/21770938
has title: Converting ArrayList into JSON Array, Java Programming
has comment: http://stackoverflow.com/comment/32935461
has body: Hi there i know maybe this is stupid mistake, but i need your help. i have code like this that getting an object from db using ArrayList then convert it to JSONArray protected JSONArray statisticPesanan(){ List<ListPesanan> det = new ArrayList(); JSONArray jsonArray = new JSONArray(); try { //create JSONObject to executed String sql = "SELECT * FROM vstatisticpesanan"; Connection conn; conn = datman.logOn(); Statement statement = (Statement) conn.createStatement(); ResultSet rs = statement.executeQuery(sql); //add list to Array while (rs.next()) { ListPesanan psn = new ListPesanan(rs.getString(1), rs.getInt(2)); det.add(psn); } //convert to JSON array for (int i=0; i < det.size(); i++) { jsonArray.add(det.get(i).jsonobject()); } } catch (SQLException se) { Logger.getLogger(Analytics.class.getName()).log(Level.SEVERE, null, se); java.lang.System.out.println("Error on Analytics Generate JSON Pesanan Statistics : " + se.toString()); } finally { datman.logOff(); } return jsonArray; } the output from servlet execution using this code public class chartGetTransaction 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 { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* Execution of JSON Chart */ Analytics show = new Analytics(); JSONArray array = show.getStatisticPesanan(); for(int i = 0; i < array.size(); i++){ out.print(array.get(i).toString()); } } finally { out.close(); } } the RESULT OUTPUT is like this: {"1":"2013-10-12","2":3}{"1":"2013-11-16","2":2}{"1":"2013-12-23","2":4}{"1":"2014-02-11","2":10} but i need the format like this:: [{"1":"2013-10-12","2":3},{"1":"2013-11-16","2":2},{…
has comment: http://stackoverflow.com/comment/32935393
has comment: http://stackoverflow.com/comment/32935382
has answer: http://stackoverflow.com/a/21770929
accepted answer: http://stackoverflow.com/a/21770929
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32935370
type: Question
has comment: http://stackoverflow.com/comment/32935420
possible better answer: http://stackoverflow.com/a/21770938
tagged with: arrays
has comment: http://stackoverflow.com/comment/32935467

http://stackoverflow.com/comment/33108186
has text: how can I put it in the ChannelBuffer? like bufcmd.writeBytes(buf);
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21836770
type: Comment

http://stackoverflow.com/q/21772738
accepted answer: http://stackoverflow.com/a/21775040
has title: Why is calling a function faster than not calling a function?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32938997
tagged with: function
has answer: http://stackoverflow.com/a/21773069
has comment: http://stackoverflow.com/comment/32939052
has body: I tried the following code: public class Test { public static void main(String[] args) { int x = 9, y = 9, z = 0; long startTime = System.currentTimeMillis(); // System.out.println("loop one start time = " + startTime); for (int i = 0; i &lt; 10000; i++) { for (int j = 0; j &lt; 10000; j++) { z = x + y; } } System.out.println("loop one use time = " + (System.currentTimeMillis() - startTime) + ",z = " + z); startTime = System.currentTimeMillis(); // System.out.println("loop two start time = " + startTime); for (int i = 0; i &lt; 10000; i++) { for (int j = 0; j &lt; 10000; j++) { z = sum(x, y); } } System.out.println("loop two use time = " + (System.currentTimeMillis() - startTime) + ",z = " + z); } public static int sum(int x, int y) { int t; t = x + y; return t; } } The output to the console is: loop one use time = 216,z = 18 loop two use time = 70,z = 18. It seems that the second loop took less time, than the first one! I don't understand why this happens. Thanks for you help. Update: I exchanged the two loops, now loop one takes less time!! loop two use time = 219,z = 18 loop one use time = 69,z = 18
score: 0
possible better answer: http://stackoverflow.com/a/21773069
has comment: http://stackoverflow.com/comment/32938801
has comment: http://stackoverflow.com/comment/32938985
linked to: http://stackoverflow.com/q/504103
favorite count: 0
has answer: http://stackoverflow.com/a/21775040
upvote count: 2
has comment: http://stackoverflow.com/comment/32939672
downvote count: 2
type: AnsweredQuestion
tagged with: microbenchmark
has comment: http://stackoverflow.com/comment/32938768
tagged with: java
tagged with: methods

http://stackoverflow.com/q/21679135
has body: public static void doDecrypt(String source,String dest ){ Runtime rt = Runtime.getRuntime(); GPGDecrypt rte = new GPGDecrypt(); Process proc; StreamWrapper error, output = null ; try { proc = rt.exec("gpg --output "+dstfile +" --batch --passphrase "+ResourcePropertyManager.get("Passphrase")+ " --decrypt "+srcfile); System.out.println("After Passing"); error = rte.getStreamWrapper(proc.getErrorStream(), "ERROR"); output = rte.getStreamWrapper(proc.getInputStream(), "OUTPUT"); int exitVal = 0; error.start(); output.start(); error.join(3000); output.join(3000); exitVal = proc.waitFor(); System.out.println("Output: " + output.message + "\nError: "+ error.message); } catch (IOException e) { System.out.println("IO "+e.getMessage()); e.printStackTrace(); } catch (InterruptedException e) { System.out.println("IEX"+e.getMessage()); // TODO Auto-generated catch block e.printStackTrace(); } finally{ rt = null; rte = null; proc = null; error = null; output = null; } } While passing the values dynamically through the above code the output file is not generated. I am running this in windows.
linked to: http://stackoverflow.com/q/14993223
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32810421
has title: GPG decryption in JAVA
answer count: 0
has comment: http://stackoverflow.com/comment/32771828
tagged with: java
tagged with: gnupg
type: Question
has comment: http://stackoverflow.com/comment/32803576
score: 0

http://stackoverflow.com/a/21749938
answers question: http://stackoverflow.com/q/21749815
score: 0
has comment: http://stackoverflow.com/comment/32898195
has body: You can't directly use the output of nextLine() for a switch-case, because nextLine() returns a String, not a char. However, if you are only reading in a single char, you can do: String userInput = scanner.nextLine(); switch(userInput.charAt(0)) { scanner.nextInt() will obviously throw an Exception if the next token is not parseable to an int. You should wrap these statements in try-catch block and do something appropriate if a non-number is entered.
has comment: http://stackoverflow.com/comment/32898404
type: Answer

http://stackoverflow.com/comment/33021060
type: Comment
type: QuestionComment
has text: It seems like you are running `java start` instead of `java Start`.
comment on: http://stackoverflow.com/q/21819026
score: 0

http://stackoverflow.com/a/21825332
type: Answer
upvote count: 1
has body: std::map&lt;> isn't a HashTable map, it's a tree map afair. There's hash_map class, but it's not in the C++ Standard yet. See Is hash_map part of the STL?
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21825215

http://stackoverflow.com/comment/32796854
type: Comment
comment on: http://stackoverflow.com/q/21692775
score: 0
type: QuestionComment
has text: same line but 2 different point

http://stackoverflow.com/comment/32972529
comment on: http://stackoverflow.com/q/21791356
has text: Matrix addition requires that the two input matrices have the same dimensions, and the result has the same dimensions as the inputs. You don't add the dimensions in that case. So I still don't know what you're going for.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32826108
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21702776
has text: @duffymo Sometimes the execution freezes.. That is it just showing the blinking cursor after some more iterations .... Why... ?
score: 0

http://stackoverflow.com/q/21679057
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32771754
has comment: http://stackoverflow.com/comment/32772777
favorite count: 0
has comment: http://stackoverflow.com/comment/32771976
has body: As the title suggests, I'm getting memory leaks and I suspect their origin lies within the creation of new images. The memory leak is of type java.util.Hashtable$Entry. Google searches haven't provided me with anything relating to image creation. The project is an interpolator - the user inputs a number of points and the program joins them together with curves. When this is done, the curves are drawn on an image. This necessitates that each time the interpolation is generated, the image is recreated with the new width and height before it's drawn over. I believe that I've narrowed down the leak to this method: public void reset(int width, int height){ if (width &gt;= 15){ i_width = width; } else { i_width = 15; } if (height &gt;= 15){ i_height = height; } else { i_height = 15; } try { image.flush(); } catch (Exception e) {} image = new BufferedImage(i_width, i_height, BufferedImage.TYPE_INT_ARGB); graphics = image.createGraphics(); Color color = new Color(1f, 0f, 1f, 0f); graphics.setColor(color); for(int y = 0; y &lt; i_height; y++){ for(int x = 0; x &lt; i_width; x++){ graphics.fillRect((x), (y), 1, 1); } } } Above, image is the BufferedImage I'm writing to whilst graphics is the Graphics2D instance. As you can probably guess, *i_width* and *i_height* represent the image's new width and height respectively. I determined that this method is the main source since the leaks are only noticeable when it's called. As you can see above, I've tried flushing the image, and in another section I also disposed of the graphics. That is as far as I managed, unfortunately, and it didn't solve the memory leak problem. How should I avoid this memory leak?
type: UnansweredQuestion
tagged with: memory-leaks
has answer: http://stackoverflow.com/a/21680421
has comment: http://stackoverflow.com/comment/32771520
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32772033
tagged with: bufferedimage
type: Question
has comment: http://stackoverflow.com/comment/32772593
has title: Java - Correctly Removing an Image to avoid Memory Leaks

http://stackoverflow.com/comment/32883708
type: Comment
type: QuestionComment
score: 0
has text: @John It's not clear that that's what the OP wants.
comment on: http://stackoverflow.com/q/21741672

http://stackoverflow.com/q/21796021
has title: Refresh jtable after Delete An item from database
has comment: http://stackoverflow.com/comment/32980024
answer count: 1
has body: Delete an item from jtable auto refresh is not working... here is the code @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == btnEdit) { } else if (e.getSource() == btnDelete) { String str = JOptionPane.showInputDialog(null, "Enter The Reason : ", "", 1); if (str != null) { Book updatebook = new Book(); updatebook.setName(book.getName()); updatebook.setAuthor(book.getAuthor()); updatebook.setPublisher(book.getPublisher()); updatebook.setDelete(true); ServiceFactory.getBookServiceImpl().updateBook(updatebook); JOptionPane.showMessageDialog(null, "You entered the Reason : "+ str, "", 1); **Refresh code** listPanel.removeAll(); listPanel.repaint(); listPanel.revalidate(); getBooks(); getListBookPanel(); booktable.repaint(); booktable.revalidate(); } else JOptionPane.showMessageDialog(null, "You pressed cancel button.", "", 1); } } getBooks() function public JTable getBooks() { booktable = new JTable(); String[] colName = { "Name", "Author ", "Publisher" }; List&lt;Book&gt; books = ServiceFactory.getBookServiceImpl().findAllBook(); data = new Object[books.size()][100000]; for (Book book : books) { data[i][0] = book.getName(); data[i][1] = book.getAuthor(); data[i][2] = book.getPublisher(); i++; } DefaultTableModel dtm = new DefaultTableModel(data, colName); booktable = new JTable(); booktable.setModel(dtm); dtm.fireTableDataChanged(); booktable.setCellSelectionEnabled(true); booktable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { int row = booktable.getSelectedRow(); CallNo = (booktable.getValueAt(row, 0).toString()); } }); return booktable; } Error "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 2 i don't know why this error occured if u knew about this please share here..
has comment: http://stackoverflow.com/comment/32980085
accepted answer: http://stackoverflow.com/a/21796124
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/32980063
tagged with: swing
has comment: http://stackoverflow.com/comment/32980053
type: Question
tagged with: refresh
tagged with: java
has answer: http://stackoverflow.com/a/21796124
tagged with: jtable

http://stackoverflow.com/q/21731343
tagged with: java
has comment: http://stackoverflow.com/comment/32864989
accepted answer: http://stackoverflow.com/a/24750785
has comment: http://stackoverflow.com/comment/32864729
score: 20
linked to: http://stackoverflow.com/q/36834537
has answer: http://stackoverflow.com/a/37532536
has answer: http://stackoverflow.com/a/54481524
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/77626045
possible better answer: http://stackoverflow.com/a/54342772
favorite count: 0
has answer: http://stackoverflow.com/a/54342772
has comment: http://stackoverflow.com/comment/32864731
has comment: http://stackoverflow.com/comment/32865422
answer count: 5
has comment: http://stackoverflow.com/comment/32865196
has comment: http://stackoverflow.com/comment/32864558
linked to: http://stackoverflow.com/q/8211195
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24750785
has title: JPA Native Query set null parameter
has body: Here is my code part: Query q = em.createNativeQuery("insert into table_name (value_one, value_two, value_three) values (?,?,?)"); q.setParameter(1, value1); q.setParameter(2, value2); q.setParameter(3, value3); q.executeUpdate(); value3 sometimes can be null (Date class object). And if it is null the following exception is thrown: Caused by: org.postgresql.util.PSQLException: ERROR: column "value_three" is of type timestamp without time zone but expression is of type bytea Hint: You will need to rewrite or cast the expression. Position: 88 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334) at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:189) ... 11 more How is it possible to get this code working and to persist null value into database?
type: Question
has comment: http://stackoverflow.com/comment/32865683
upvote count: 20

http://stackoverflow.com/comment/33058991
comment on: http://stackoverflow.com/q/21839302
type: QuestionComment
score: 0
has text: See http://stackoverflow.com/questions/16129903/how-do-you-sort-actors-in-a-libgdx-stage for some ideas
type: Comment

http://stackoverflow.com/q/21745044
tagged with: operating-system
has comment: http://stackoverflow.com/comment/32906896
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: process
has comment: http://stackoverflow.com/comment/32889538
tagged with: virtual-machine
type: Question
has title: JVM memory mapping over a Linux Process
score: 1
tagged with: java
upvote count: 1
has body: I am trying to understand how JVM's memory maps to that of the underlying Linux process. Here is my understanding of JVM's memory architecture: https://dl.dropboxusercontent.com/u/38889378/jvm_arch.jpg Now the next diagram shows the mapping of memory when a JVM instance is scheduled over a Linux process. https://dl.dropboxusercontent.com/u/38889378/OS_Process.jpg Here I have taken the following assumptions: The JVM Stack is actually part of the Linux Process HEAP, and hence we can say all Java user program is held over the Linus Process HEAP. Linux Process Stack is used for Native Stack and also used by JVM's internal native procedure calls. Please help me figure out if my assumptions are correct. Please excuse me for putting up Image URL's, I don't have enough reputation to have them embedded. I am a new user, sorry for the inconvenience and thanks for all the help.
tagged with: jvm
favorite count: 0

http://stackoverflow.com/comment/32844527
comment on: http://stackoverflow.com/a/21719949
type: Comment
has text: You should really vote to close on these types of questions. They are not helpful in any way.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33084332
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21837250
has text: Updated my answer. It should give you an idea how to solve your problem.

http://stackoverflow.com/comment/32787733
comment on: http://stackoverflow.com/q/21683128
score: 0
type: Comment
type: QuestionComment
has text: "I have read...": Can you provide a reference?

http://stackoverflow.com/comment/32853446
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21724693
type: AnswerComment
has text: that will work because contains checks if a String contains another string. "abcd".contains("bc") -> true

http://stackoverflow.com/comment/32936241
has text: @Opal still you have problem ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21770908

http://stackoverflow.com/q/21733024
type: Question
tagged with: decimal
has comment: http://stackoverflow.com/comment/32867479
has comment: http://stackoverflow.com/comment/32867526
has body: I have the following code in Java: int hex = 0x63; The decimal value of 6316 is equal to 9910. I would like to convert this hex value to a decimal that is equal to 6310.
answer count: 3
has comment: http://stackoverflow.com/comment/32867570
favorite count: 0
tagged with: hex
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21733200
has answer: http://stackoverflow.com/a/21733378
upvote count: 1
downvote count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21733524
has title: How to convert a hex to a number that looks the same when printed in decimal?

http://stackoverflow.com/comment/32833372
score: 0
comment on: http://stackoverflow.com/q/21712714
type: Comment
type: QuestionComment
has text: [This bug](https://code.google.com/p/android/issues/detail?id=58287) describes a deficiency in the Android gradle plugin that prevents easily hacking the gradle buildfile to add a jar target...

http://stackoverflow.com/q/21771215
answer count: 2
tagged with: bufferstrategy
tagged with: graphics2d
downvote count: 0
has comment: http://stackoverflow.com/comment/32936078
favorite count: 0
accepted answer: http://stackoverflow.com/a/21771615
tagged with: swing
has body: I'm trying to draw Images with Graphics2D on JFrame. But this code only displays blank background. How to do that? Java Version: SE-1.6 IDE: Eclipse My code looks like this: import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferStrategy; import java.awt.geom.Line2D; import java.util.TimerTask; import javax.swing.JFrame; public class GraphicTest extends JFrame{ public static void main(String[] args) { GraphicTest gt = new GraphicTest(); gt.start(); } JFrame frame; BufferStrategy strategy; GraphicTest(){ int width = 320; int height = 240; this.frame = new JFrame("test"); this.frame.setSize(width, height); this.frame.setLocationRelativeTo(null); this.frame.setLocation(576, 336); this.frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); this.frame.setUndecorated(true); this.frame.setBackground(new Color(0, 0, 0, 50)); this.frame.setVisible(true); this.frame.setIgnoreRepaint(true); this.frame.createBufferStrategy(2); this.strategy = this.frame.getBufferStrategy(); } public void onExit(){ System.exit(0); } void start(){ java.util.Timer timer = new java.util.Timer(); timer.schedule(new RenderTask(), 0, 16); } class RenderTask extends TimerTask{ int count = 0; @Override public void run() { GraphicTest.this.render(); } } void render() { // Some moving images Graphics2D g2 = (Graphics2D)this.strategy.getDrawGraphics(); g2.setStroke(new BasicStroke(5.0f)); Line2D line = new Line2D.Double(20, 40, 120, 140); g2.draw(line); this.strategy.show(); } } Thank you for any help you can provide.
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/21581671
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21772123
type: Question
has answer: http://stackoverflow.com/a/21771615
has comment: http://stackoverflow.com/comment/105360369
has title: How to draw images on transparent window?
possible better answer: http://stackoverflow.com/a/21772123

http://stackoverflow.com/comment/32884230
has text: Don't forget to accept/upvote answers and questions as they help you. Not just mine, but in general.
type: Comment
comment on: http://stackoverflow.com/a/21741667
score: 0
type: AnswerComment

http://stackoverflow.com/q/21796180
has title: How to replace a char with a String using its index
possible better answer: http://stackoverflow.com/a/21796304
has answer: http://stackoverflow.com/a/21796842
score: 0
tagged with: java
answer count: 3
accepted answer: http://stackoverflow.com/a/21796541
has comment: http://stackoverflow.com/comment/32980318
tagged with: replace
type: AnsweredQuestion
tagged with: string
has answer: http://stackoverflow.com/a/21796541
has answer: http://stackoverflow.com/a/21796304
has body: Hi what is the best way to replace a char with a string : for example : In my case i have a string containing latin caracters and symbols i'm printing it with intermec printer.I have to pass the code ASCII of the char using the following printer instruction : instruction CHR$(&lt;dec. ascii value&gt;) Example : This text : N°Box will be transformed like this : "N\""+";CHR$(179); \""+"Box" I wrote this : if (!isValid(str)) { Map charsAsciiCode = new HashMap(); for (int i = 0; i &lt; str.length(); i++) { String c = String.valueOf(str.charAt(i)); if (specialCharsMap.containsKey(c)) { String decimalString = (String) specialCharsMap.get(c); charsAsciiCode.put(new Integer(i), " \";CHR$(" + decimalString + ");\""); } } Iterator iter = charsAsciiCode.entrySet().iterator(); while (iter.hasNext()) { Map.Entry mapEntry = (Map.Entry) iter.next(); int charIndex = (int) mapEntry.getKey(); String charAscii = (String) mapEntry.getValue(); // Here i want to replace every char with the correspondant Ascii value } } static boolean isValid(String input) { Matcher m = p.matcher(input); return m.matches(); } final static Pattern p = Pattern.compile("\\p{Alpha}+"); private static Map specialCharsMap = new HashMap(); static { specialCharsMap.put("é", "123"); specialCharsMap.put("è", "125"); specialCharsMap.put("à", "64"); specialCharsMap.put("ç", "92"); specialCharsMap.put("^", "94"); specialCharsMap.put("'", "39"); }
has comment: http://stackoverflow.com/comment/32980317
type: Question

http://stackoverflow.com/comment/33037984
comment on: http://stackoverflow.com/q/21828799
type: QuestionComment
has text: Another theme for this error is that there is an older version of a spring jar on the classpath.
type: Comment
score: 1

http://stackoverflow.com/a/21733481
has comment: http://stackoverflow.com/comment/32869227
type: Answer
has body: First of all: Within an instance method or a constructor, this is a reference to the current object — the object whose method or constructor is being called. You can refer to any member of the current object from within an instance method or a constructor by using this. Here instead of this you should use your instantiated array list members. Also in the toString you have not added return statement as it returns String as per your method definition.I have made changes to remove those errors you may now change as per your requirement. import java.util.ArrayList; import java.util.*; class Set { private ArrayList&lt;Integer&gt; members; private static int quantity = 0; // Constructors public Set() { new ArrayList&lt;Integer&gt;(); } public Set(int member){ new ArrayList&lt;Integer&gt;(); addMember(member); quantity++; } // Accessors public static int getQuantity() { return quantity; } // Mutators public void addMember(int member) { members.add(member); } // toString() method public String toString() { StringBuilder string = new StringBuilder(); int i; System.out.print("["); string.append("["); for(i=0; i&lt;getQuantity(); i++){ System.out.print(members.get(i)); string.append(members.get(i)); if(i+1 == getQuantity()) System.out.println("]"); else System.out.print(", "); } String returnString = string.toString(); return returnString; } // Return true if 'this' is a subset of 'set', // otherwise return false. public boolean isSubset(Set set) { if(members.contains(set)) return true; else return false; } // Return true if 'this' is equals to 'obj', // Otherwise return false public boolean equals(Set set) { return (members.contains(set)); } }
has comment: http://stackoverflow.com/comment/32912668
score: 0
has comment: http://stackoverflow.com/comment/32868562
answers question: http://stackoverflow.com/q/21732952

http://stackoverflow.com/q/21817301
has comment: http://stackoverflow.com/comment/33018360
has answer: http://stackoverflow.com/a/21817526
tagged with: string
has comment: http://stackoverflow.com/comment/33018080
has comment: http://stackoverflow.com/comment/33018231
has title: Why do i get this error message when using recursion?
has comment: http://stackoverflow.com/comment/33018002
tagged with: recursion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33018018
accepted answer: http://stackoverflow.com/a/21817526
tagged with: java
has body: I got this message: the left-hand side of an assignment must be a variable when i finished to resolve an excercise about printing a string reversely in recursively-looping. I just want to know if someone could provide an explanation of it? The error message appears in the last line...I don't understand, WHY? There is my code: import java.util.Scanner; public class Excersise { public static void main(String[] args) { // Create a Scanner Scanner input = new Scanner(System.in); //Prompt the user to enter a string System.out.print("Enter a string: "); String s = input.nextLine(); reverseDisplay(s); } public static void reverseDisplay(String value) { //Base case if (value.length() &lt; 2) { System.out.println(value); } else { //Recursion reverseDisplay(value.substring(1)) + value.charAt(0); &lt;--error } } }
type: Question
has answer: http://stackoverflow.com/a/21817531
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21817531

http://stackoverflow.com/comment/32872522
has text: How can I make it to where if they enter -1, then it will end, show them the total and allow them to move on
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21735834
type: AnswerComment

http://stackoverflow.com/comment/33052958
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21833809
has text: You should really break up some of the tasks into separate targets, like clean, compile and jar. It makes the process easier to build and reuse the targets potentially.

http://stackoverflow.com/a/21690540
has comment: http://stackoverflow.com/comment/32794159
has body: In your code, you are only calling hasNextToken() once at the start of the while condition. You need to call hasNextToken() as many times as nextToken(), to make sure that nextToken() will work. The reason you don't have any more tokens on the line is that there are only 4 tokens per line (apparently) but you have two for loops that will try to call nextToken() a total of 50*4=200 times. Alternatively to how you are doing this: you could just split the currentLine on ";" with the split() method and then loop through the returned String[] elements.
answers question: http://stackoverflow.com/q/21690438
score: 0
has comment: http://stackoverflow.com/comment/33055463
has comment: http://stackoverflow.com/comment/32792978
type: Answer

http://stackoverflow.com/a/21719771
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/99374098
has comment: http://stackoverflow.com/comment/32846842
score: 1
answers question: http://stackoverflow.com/q/21718736
has comment: http://stackoverflow.com/comment/32856706
downvote count: 0
has body: You're misusing available(). It is not valid as a test for end of stream. See the Javadoc. You don't need all that array copying either. Try this: ByteArrayOutputStream out = new ByteArrayOutputStream(); while ((count = in.read(buffer)) &gt; 0) { out.write(buffer, 0, count); } byte[] data = out.toByteArray(); If you're storing the image at the receiving end you should just write direct to a FileOutputStream instead of the ByteArrayOutputStream above, and forget about data altogether.
has comment: http://stackoverflow.com/comment/32861364

http://stackoverflow.com/comment/32897657
comment on: http://stackoverflow.com/q/21749689
has text: You cannot achieve that. What is it you want to do with the result of `invoke(..)`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33007106
comment on: http://stackoverflow.com/q/21811192
has text: Based on the information you've provided, these two code snippets are equivalent.
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/116577280
comment on: http://stackoverflow.com/a/47579506
score: 0
type: AnswerComment
has text: Thank you for this answer. It is very insightful, could you provide any reference on where I could further read it? Pretty new to java and has been stuck on a similar issue. Still could not figure out the exact reason
type: Comment

http://stackoverflow.com/comment/32987483
type: Comment
has text: @user3026356 see the code sample I edited in my answer, maybe it clarifies this a bit
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21800052

http://stackoverflow.com/comment/32863975
type: Comment
comment on: http://stackoverflow.com/a/21731164
has text: Ok, so the next thing should be to set another try/catch block to catch NULLPOINTEREXCEPTION where the variable takes ta value, right?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32999037
has text: you don't add getText(). It is a method of the JTextField Class. So just replacing the last line of the actionPerformed method with the line I wrote should work :). Hope that helps! I also added some more info to my answer, so maybe you understand better.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21806616

http://stackoverflow.com/comment/32831595
score: 0
has text: How is your data sorted? What elements do you want to extract? You only want temperatures for the first 10 days? Or maybe you wanted the 10 coldest days in a month? You should specify your problem better, else the answer can range from "keep a counter and break out of the loop when it hits 10" all the way to "build a `NavigableMap`" or even "use Guava".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21711839

http://stackoverflow.com/a/21831992
has body: -Go to http://www.genymotion.com/ download the genymotion emulator -make an account for free -install what device you needed and test again the app
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/21831392
score: -1
upvote count: 0

http://stackoverflow.com/a/21836741
type: Answer
answers question: http://stackoverflow.com/q/21836548
has body: For "lightweight" maintenance changes, you can simply make a check on a flag at the beginning of the service methods to know if you should process the request or not.This technique is widely used for feature flipping for example.
score: 0

http://stackoverflow.com/comment/32789729
comment on: http://stackoverflow.com/a/21688525
has text: So simply and yet so helpful! Thanks :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21697386
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32804583
answer count: 1
downvote count: 0
favorite count: 0
has body: I am doing a multi threading . I am unable to get the output i want. I have no compilation error . But I cant get the result I want. Can someone advise me ? This is my Test program import java.util.*; public class Test { public static void main(String[] args) { int totalShares = 0; double totalCost = 0.0; double profit = 0.0; int rand1 = 0; double rand2 = 0.0; Thread bt[] = new Thread[2]; Thread st[] = new Thread[2]; for (int i = 0; i &lt; 2; i++) { try { bt[i].join(); bt[i] = new BuyThread(rand1, rand2); bt[i].start(); } catch (InterruptedException e) { } } for (int i = 0; i &lt; 2; i++) { try { st[i].join(); st[i] = new SellThread(rand1, rand2); st[i].start(); } catch (InterruptedException e) { } } System.out.printf("Tracking of stock : FCS"); System.out.println("Total shares now" + totalShares + "at total cost" + totalCost); System.out.printf("At$ 36.00 per share, profit is" + profit); } } This is my Stock Class import java.util.*; public class Stock { String name; int totalShares; double totalCost; double totalProfitLoss; public Stock(String theName) { name = theName; totalShares = 0; totalCost = 0.00; totalProfitLoss = 0.00; } public String getName() { return name; } public double getTotalShares() { return totalShares; } public double getTotalCost() { return totalCost; } public void buy(int shares, double pricePerShare) { totalShares += shares; totalCost += shares * pricePerShare; } public boolean sell(int shares, double pricePerShare) { double sellCost = shares * pricePerShare; if (shares &lt;= totalShares &amp;&amp; sellCost &lt;= totalCost) { totalShares -= shares; totalCost -= sellCost; return true; } else { return false; } } public double profit() { totalProfitLoss = 36 * totalShares; return totalProfitLoss - totalCost; } } enter code here This is my BuyThread program import java.util.*; public class BuyThread extends Thread { private int share; private double cost; private Stock stock; public BuyThread(int share, double cost) { this.share = share; this.co…
has comment: http://stackoverflow.com/comment/32804459
has answer: http://stackoverflow.com/a/21697433
has comment: http://stackoverflow.com/comment/32804393
has title: Java Stocks Program Random Multi Threading
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/32804291
has comment: http://stackoverflow.com/comment/32804317
has comment: http://stackoverflow.com/comment/32813514
type: Question

http://stackoverflow.com/q/21769425
has title: CXF client class cast exception in tomcat but not in jetty
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: jetty
type: Question
linked to: http://stackoverflow.com/q/5670343
tagged with: java
has body: I have a Spring Maven web app which contains a number of RESTful web services. Within this I'm running a custom built client jar which interacts with a number of older SOAP services - the jar project hides a lot of the complexity for interacting with the SOAP services behind some simplified java objects. When running in jetty everything works fine. However when deploying the jar to tomcat, both on a different server and locally on the same machine as jetty, I get the following error com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy So the issue looks to be that in TC the sun jar is been called ahead of the cxf one. I found multiple similar issues online - I tried the solution in a previous SO question (below), which actually was very similar to my problem, along with reading the referenced links in the answers but no luck CXF - ClassCastException (SEIStub/ClientProxy) I also came across the below article http://forum.mulesoft.org/mulesoft/topics/cxf_jaxws_client_java_lang_classcastexception_com_sun_xml_ws_client_sei_seistub_cannot_be_cast_to_org_apache_cxf So as I also am referencing chemistry-opencmis in my project I thought this may have been causing the classpath error. I tried loading these jars externally and then also tried removing the opencmis references and code from the project completely and rebuilt but was seeing the same behavior - worked fine in jetty but not in tomcat. I've also looked at similar issues on the apache mail forums https://issues.apache.org/jira/browse/CXF-2237 The contents of my web.xml file are below xxx com.fmr.xtrac.forms.web.init.WebConfigurer gzipFilter net.sf.ehcache.constructs.web.filter.GzipFilter gzipFilter /rest/* gzipFilter *.css gzipFilter *.html gzipFilter *.js gzipFilter *.jsp gzipFilter *.zip cors xxx.CorsFilter cors.allowOrigin * cors.supportedMethods GET, POST, HEAD, PUT, DELETE cors.supportedHeaders Accept, Origin, X-Requested-With, Content-Type, Last-Modified cors.exposedHeaders S…
downvote count: 0
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/comment/33022863
type: QuestionComment
has text: @mohammedmomn could i even check for the color of the marker? becasue the Lat Lng are constantly changing and are not totally reliable.
score: 0
comment on: http://stackoverflow.com/q/21819835
type: Comment

http://stackoverflow.com/comment/32915953
type: QuestionComment
has text: I think the problem lies in the context of this combobox. I wrote a little test to simulate this and could not reproduce your problem. After setSelectedItem(null) my combo box text is cleared (with editable false or true). You should provide more source code.
comment on: http://stackoverflow.com/q/21759649
score: 0
type: Comment

http://stackoverflow.com/q/21799775
has comment: http://stackoverflow.com/comment/32987444
favorite count: 0
has comment: http://stackoverflow.com/comment/32988978
has comment: http://stackoverflow.com/comment/32989222
has comment: http://stackoverflow.com/comment/32988920
tagged with: utf-8
has comment: http://stackoverflow.com/comment/32986358
tagged with: parsing
has comment: http://stackoverflow.com/comment/32986903
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32988943
upvote count: 1
has title: UTF-8 : characters not recognized
has body: I am trying to parse a text file using HashMap. The problem is that I have special characters like Ș and Ț and my application didn't recognize them. This is my code: Map&lt;String, String&gt; m = new LinkedHashMap&lt;String, String&gt;(); FileInputStream fin = null; InputStreamReader isr = null; BufferedReader br = null; try { fin = new FileInputStream("inferredflexforms.txt"); isr = new InputStreamReader(fin, "UTF-8"); br = new BufferedReader(isr); String line = br.readLine(); while (line != null) { String[] toks = line.split("\\s+"); m.put(toks[0], toks[1]); line = br.readLine(); } } finally { if (br != null) { br.close(); } if (isr != null) { isr.close(); } if (fin != null) { fin.close(); } } System.out.println(m); My text file contains: dănțaseși dansa And my output is: dăn?ase?i=dansa The "ș" and "ț" was replaced by "?". What should I do? Thank you.
has comment: http://stackoverflow.com/comment/32987206
score: 1
tagged with: java
type: Question
tagged with: hashmap
downvote count: 0

http://stackoverflow.com/a/21696783
answers question: http://stackoverflow.com/q/21696619
score: 0
has body: Oracle Thin Type 4 Driver is the best for database connection .Below is the code for connection.Hope u'll find it useful and btw Welcome to JAVA !! Connection con=null; try{ Class.forName("oracle.jdbc.OracleDriver"); con=DriverManager.getConnection("jdbc:oracle:thin:@IP:PortNo:SID","USER","PWD"); } catch(SQLException e){ e.printStackTrace(); }catch(ClassNotFoundException e){ e.printStackTrace(); }
type: Answer
has comment: http://stackoverflow.com/comment/32803329

http://stackoverflow.com/comment/32887606
comment on: http://stackoverflow.com/a/21743933
type: Comment
has text: thats one of my problem since the structure of my code is not consistent which i can hardly produce consistent results. Because i'm not following the proper build up of codes which is very frustrating.
score: 0
type: AnswerComment

self-signed
type: Tag
tags question: http://stackoverflow.com/q/21712656
tag name: self-signed

http://stackoverflow.com/comment/49314149
has text: This is not generic at all. The point of using Retrofit, is to be able to request several api overone defined endpoint. What is the point of loosing the ability to parse answer independently ?
comment on: http://stackoverflow.com/a/30621901
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32934127
comment on: http://stackoverflow.com/q/21769727
score: 1
has text: declare global variables instead of local ones and thread can use them
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32832579
has text: Show us what you've tried, don't just ask for a solution.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21712919
type: Comment

http://stackoverflow.com/q/21830970
has answer: http://stackoverflow.com/a/21831060
has comment: http://stackoverflow.com/comment/33041778
has answer: http://stackoverflow.com/a/21831050
tagged with: java
has answer: http://stackoverflow.com/a/21831134
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/21831271
has comment: http://stackoverflow.com/comment/33042103
has comment: http://stackoverflow.com/comment/33041825
tagged with: arraylist
upvote count: 3
score: 0
has comment: http://stackoverflow.com/comment/33041831
has body: It is known that if I would like to find whether an object is in an arraylist I can either use the contains() method: if(arraylist.contains(obj)) { // do things } or I could use a for loop (providing that I have overloaded the equals() method): for(Object o : arraylist) { if(obj.equals(o)) { // do things } } As it is referred in other posts, contains() actually makes use internally of a for loop and the equals() method. Therefore, my question is: is it logical to expect contains() to take more time when the arraylist is larger? I am asking this because in my code I use contains() in order to avoid "for loops" and therefore keep the run time low and constant, but I notice that the code runs significantly slower as the arraylist size becomes larger.
tagged with: contains
downvote count: 3
linked to: http://stackoverflow.com/q/2885846
favorite count: 0
has answer: http://stackoverflow.com/a/21831089
has comment: http://stackoverflow.com/comment/33041722
answer count: 5
type: UnansweredQuestion
has title: Java Arraylist contains vs. for loop

http://stackoverflow.com/a/21810336
type: Answer
answers question: http://stackoverflow.com/q/21810240
has comment: http://stackoverflow.com/comment/75654755
has body: Its always better to store values which you want to use multiple times in one of the following ways:- Shared Preferences Singleton classes Write it to a file SQLite Database Store on the web-server
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/21750128
upvote count: 0
answer count: 1
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/32898068
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21750442
tagged with: java
has comment: http://stackoverflow.com/comment/32898117
downvote count: 1
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/32898193
has body: I want to get the value within the [" "] of the below expression in Java. ["*Friends"] Could you please help me, How to get the *Friends as result from the above string.
accepted answer: http://stackoverflow.com/a/21750442
has title: How to get the value within the below expression in java

http://stackoverflow.com/comment/33025720
type: Comment
comment on: http://stackoverflow.com/a/21818931
score: 0
type: AnswerComment
has text: Create an instance variable of a `JLabel`, instantiate in your constructor, add it to your frame and then simply use `setText` or `setIcon` to change its values when `actionPerformed` is called...You got your button onto the screen, so the concept it very simular

http://stackoverflow.com/q/21703867
tagged with: arrays
downvote count: 0
answer count: 6
has comment: http://stackoverflow.com/comment/32815323
has answer: http://stackoverflow.com/a/21705035
tagged with: random
has comment: http://stackoverflow.com/comment/32815347
has body: I just want to know how to limit to number of times a random number appears. I have generated random numbers of 1 to 10 and want to limit each number to appear 4 times. myArray[i][j] = rand.nextInt(11); for (int i=0; i &lt; myArray.length; i++) { for (int j=0; j &lt; myArray[i].length; j++) { myArray[i][j] = rand.nextInt(11); System.out.print(" " + myArray[i][j]); The code above creates the randoms numbers. Just want to limit them.
favorite count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/21703988
type: AnsweredQuestion
has title: Limiting duplicate random numbers
has comment: http://stackoverflow.com/comment/32815369
has comment: http://stackoverflow.com/comment/32815433
has answer: http://stackoverflow.com/a/21704326
has answer: http://stackoverflow.com/a/21703988
has comment: http://stackoverflow.com/comment/32815769
has answer: http://stackoverflow.com/a/21704077
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21704529
has comment: http://stackoverflow.com/comment/32815385
has comment: http://stackoverflow.com/comment/32815326
linked to: http://stackoverflow.com/q/2339508
accepted answer: http://stackoverflow.com/a/21704326
type: Question
has answer: http://stackoverflow.com/a/21705107
has comment: http://stackoverflow.com/comment/32818358

http://stackoverflow.com/comment/32820930
comment on: http://stackoverflow.com/q/21706825
score: 0
type: Comment
type: QuestionComment
has text: can you post your code?

http://stackoverflow.com/comment/108657716
type: AnswerComment
has text: @DmitryKaltovich ad 1) it wasn't legacy at the time of writing; ad 2) ok, removed.
score: 0
comment on: http://stackoverflow.com/a/34293357
type: Comment

http://stackoverflow.com/comment/32993221
type: Comment
comment on: http://stackoverflow.com/q/21803118
type: QuestionComment
has text: Make sure that when you are holding down 2 keys that you have a array of boolean's, keys that are already pressed. So if you have 2 true boolean's then you do both actions one by one. Once you let go of the which ever key the boolean gets set to false.
score: 0

http://stackoverflow.com/q/21806134
has body: I have this method: //not related to the error, but included for reference ArrayList&lt;ArrayList&lt;Color&gt;&gt; a = new ArrayList&lt;ArrayList&lt;Color&gt;&gt;(); void addColorToList(float[] j) //this array always length 3 { float[] k = Arrays.copyOf(j, 3); Arrays.sort(k); //Error in the following line a.get(Arrays.asList(j).indexOf(k[0])).add(new Color(j[0], j[1], j[2])); } and this error: Exception in thread "AWT-EventQueue-1" java.lang.ArrayIndexOutOfBoundsException: -1 I've determined that my code always calls a.get() with -1, because Arrays.asList(j). indexOf(k[0]) does not find the element. However, I cannot figure out why this doesn't work as I would expect it to. I tried printing out the result of Arrays.asList(j), but I'm not really sure what to make of the result: [[F@307af497]. Can anybody tell me what the issue is?
has answer: http://stackoverflow.com/a/21806210
tagged with: java
downvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/21806210
linked to: http://stackoverflow.com/q/4962361
score: -2
tagged with: arrays
tagged with: sorting
upvote count: 0
answer count: 1
favorite count: 0
has title: Strange Arrays.asList() behavior
has comment: http://stackoverflow.com/comment/32998186
type: AnsweredQuestion

http://stackoverflow.com/comment/32896015
type: Comment
has text: The message is correct. Before the constructor chained reached the `java/lang/Object` type, the variable array value at index `0` contains a value of the JVM type `undefined`. This type does not know of the method `$javassist_write_this$0` (you can however set fields on this type). Only after the constructor chain is called, you can invoke methods on this type as it was replaced by its actual type.
score: 1
comment on: http://stackoverflow.com/a/21744298
type: AnswerComment

http://stackoverflow.com/comment/32942888
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21774773
has text: @ZouZou, yeah, you're right again. Thank you, master

http://stackoverflow.com/comment/32893521
comment on: http://stackoverflow.com/a/21747300
has text: I've done #s 1 - 4 and I am currently running the Spring application in my Eclipse and I do not use jUnit tests. The output of `System.out.println(PATH_FILES);` is `${dir.local}` :( How do I solve this?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21711388
has body: Think of Hexadecimal as just another format to display any data type (uint8_t, or char or int...) stored in memory. In memory, its all binary, or hexadecimal. Just depends on how you want to look at it. For example: the following statements: long int A = 34; uint8_t B = 34; char C = 34; int D = 34; printf("0x%02x\n", 'A'); // surrounded with '' gives ASCII value of 65, then displayed in Hex printf("0x%02x\n", A); printf("0x%02x\n", B); printf("0x%02x\n", C); printf("0x%02x\n", D); Results in: Breaking any string into its fundamental elements, (char, or uint8_t) and printing them as shown above will yield similar results for you. Edit: For this input file (call it in.txt, in the executable directory): lkjahldfkjghlskjhlskjhlakdjgglsjkahlkj4hl5k6jh67=83kjhlkjshdf8f7s698s7dfgbslfkjbg And using this code: int main(void) { FILE *fp; char filename[]=".\\in.txt"; uint8_t c; int length=0, i=0; uint8_t *array; //Get number of entries in file: fp=fopen(filename, "r"); c= fgetc(fp); while(c&lt;255) { length++; c= fgetc(fp); } fclose(fp); //give array sufficient space array = malloc(sizeof(uint8_t)*length); fp=fopen(filename, "r"); //read file into array, and display as hexadecimal c = fgetc(fp); while(c&lt;255) { array[i++]= c; printf("0x%02x\n", c); c = fgetc(fp); } fclose(fp); getchar();//stop execution to view files (hit any key to exit) return 0 } You should see this output: (only first 20 or so values shown...)
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/21710744
answers question: http://stackoverflow.com/q/21710744
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21796511
upvote count: 1
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21796625
favorite count: 0
tagged with: static
has body: hi guys i got this variable in my first class public static double credit; in the constructor of the first class i got credit=0.0; then i got this listener-code that shows me the value on the graphic window after the user adds the funds Catalogo.addCredit(credit); creditLabel.setText("Credito: " + getCredit()+"€"); using those 2 static methods, this for the value return ( in the first class) public static double getCredit() { return credit; } and for increase the funds i use this one of another class public static void addCredit(double creditl) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String cred = JOptionPane.showInputDialog(frame, "Inserisci l'importo da aggiungere:"); if (cred == null) { return; } if ((cred.matches("[0-9]*\\.[0-9]+")) || (cred.matches("[0-9]+"))) { //checks if the string is a valid double value or an int value double credits = (double) Double.parseDouble(cred); //conversion into double if (credits &gt;= 0.0) { JOptionPane.showMessageDialog(frame, "Credito aggiornato con successo"); creditl = creditl + credits;} } if (!(cred.matches("[0-9]+")) &amp;&amp; !(cred.matches("[0-9]*\\.[0-9]+"))) { //checks if the user didn't insert a correct double or int JOptionPane.showMessageDialog(frame, "Importo inserito errato"); addCredit(creditl); } } now the problem is that the credit variable doesn't increase at all and i don't know why it seems that all is good, or maybe am i missing something ? the input goes wel in the mean that it checks for the proper value and then it says that the credit has been updated but it's not and i don't know why this is happening NOTE: i have tried to make this variable a non static var and renaming all methods to non static but it seems that it's the same thing, same problem
has title: how to change the value of a static variable from a static method of another class
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21796625

http://stackoverflow.com/comment/32879158
has text: Right, the example didn't work, because it serializes the hole column object. I'll have a deeper look into this...those darn cross-plattform serialisations... ;)
comment on: http://stackoverflow.com/a/21730309
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/21831822
has body: It looks like you have to start at the beginning of the linked list and go through each node comparing the bundle ID to the categories node ID. Good luck!
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21831597

http://stackoverflow.com/comment/32870963
type: Comment
has text: Thank you for your help sir, in the future I will try to post crash logs (don't know what those are, but will look them up in the future to grab them to help you guys help me out!). I did get my question answered though, i really appreciate you taking the time out to help though.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21734938

http://stackoverflow.com/comment/32852429
score: 0
has text: No, ts1 is released when synchronizedTimerMethod returns. That's how synchronized methods work - the object is locked when the method is called, and released when it returns.
type: Comment
comment on: http://stackoverflow.com/a/21724365
type: AnswerComment

http://stackoverflow.com/comment/33016029
score: 0
comment on: http://stackoverflow.com/a/21802830
type: Comment
has text: entry.getValue().getRandomNumber();
type: AnswerComment

http://stackoverflow.com/a/21760767
type: Answer
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/21760531
answers question: http://stackoverflow.com/q/21760531
has body: As noted by other people, there are two problems in your current code: Months are zero based. So, month 7 is August, not July =\ Year doesn't start by default at 1900 but at 1970, but if you set the year by yourself you'll get as year the same number you're setting, in this case, 75 (not 1975 as expected). To solve this, you may create the GregorianCaledar as new GregorianCaledar(1975, 6, 3). Or even better, stop working directly with this class and instead use the abstract class Calendar: Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 1975); calendar.set(Calendar.MONTH, Calendar.JULY); calendar.set(Calendar.DATE, 3); SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy"); String result = df.format(calendar.getTime()); System.out.println("fmt: " + result); Why to use Calendar instead of GregorianCalendar? Because you should always work with abstract class/interface instead of class implementation.
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/q/21743104
tagged with: compilation
type: Question
has title: javac(compile) and java(run) package work at different directory structure levels?
has answer: http://stackoverflow.com/a/21743170
answer count: 1
score: 0
tagged with: javac
type: UnansweredQuestion
has body: I just noticed that for compiling I need to specify the exact path from my current location for the java source files that needs to be compiled, but to run the class file, all I need is the class qualified name. Does the java command recursively look inside all the folders in my current directory to find the class and execute it? if so why doesn't the javac work similarly but expects to have the absolute path? From my project folder location, javac -cp ".:/Users/page/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar:target/classes" src/main/java/app/Assignment04.java java -cp ".:/Users/page/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar:target/classes" app.Assignment04 EDIT: when I explicitly mentioned path like this; java -cp ".:/Users/page/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar:src/main/java/com/scg/util/*:src/main/java/com/scg/domain/*:src/main/java/app/*" app.Assignment04 I get Error: Could not find or load main class app.Assignment04 although I give src/main/java/app/ in my classpath
tagged with: classpath
tagged with: java

http://stackoverflow.com/comment/32852469
comment on: http://stackoverflow.com/q/21724192
has text: @MD - thank you sir. No errors. But I don't know why I can't see any "newfolder" folder in my sdcard. I guess I'll just ask another question about this problem..
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32800779
has text: look at the answer from npinti that is a better solution.
comment on: http://stackoverflow.com/q/21695100
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32907355
score: 0
has text: This is not a problem. I don't see what's wrong with static fields here. They are fine for utility functions and constants.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21755470

http://stackoverflow.com/comment/32939607
score: 0
type: AnswerComment
type: Comment
has text: No it doesn't fail using heredoc also if you have code as I showed in my answer.
comment on: http://stackoverflow.com/a/21772518

http://stackoverflow.com/a/21733995
has body: As Jon commented you explictly need the class due to type erasure. E.g. if you have a generic method, you'll have to do it like this: public void &lt;T&gt; myMethod(Class&lt;T&gt; clazz) { T foo = clazz.newInstance(); } If it's a generic class it basically works the same. You just have to pass the class object to the metod or even to the constructor.
has comment: http://stackoverflow.com/comment/32869920
upvote count: 5
has comment: http://stackoverflow.com/comment/32869194
has comment: http://stackoverflow.com/comment/32869873
score: 5
accepted answer of: http://stackoverflow.com/q/21733811
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32869732
downvote count: 0
answers question: http://stackoverflow.com/q/21733811
has comment: http://stackoverflow.com/comment/32869785
type: Answer

http://stackoverflow.com/a/21694070
type: Answer
accepted answer of: http://stackoverflow.com/q/21694021
upvote count: 2
answers question: http://stackoverflow.com/q/21694021
has body: Person is non static inner class which means it is member of instance of outer class (BasicClass) and without this instance you cant use it (just like methods or fields). Since you are using this class in static method and in static method there is no default this reference consider making Person class static or creating instance of your outer class via which you will create instance of Person class, like BasicClass basic = new BasicClass(); Person p = basic.new Person(); or placing code of your Person class outside BasicClass class.
score: 2
has comment: http://stackoverflow.com/comment/32798777
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21757179
tagged with: servlets
score: 0
has answer: http://stackoverflow.com/a/75204444
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/37508671
answer count: 4
type: AnsweredQuestion
tagged with: java
has title: Use an existing Servlet Class or JSP - Servlet list is empty
has answer: http://stackoverflow.com/a/74824471
accepted answer: http://stackoverflow.com/a/21778633
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/32948313
has body: I have the following problem with a small Spring MVC project I'm trying to create. I'd like to create the DispatcherServlet, but the wizard list is empty. I believe I have all the necessary dependencies covered: spring-core spring-beans spring-context spring-jdbc spring-web spring-webmvc I read on similar questions that the wizard can only be used on Dynamic Web projects. I checked the Project Facets and it seems to be OK. Dynamic Web Module v3.0 Java v1.6 JavaScript v1.0 Also, web.xml has been created and the project has been updated with the Maven dependencies. As far as I know this should work, but it doesn't. Any help would be much appreciated.
has comment: http://stackoverflow.com/comment/32916990
has answer: http://stackoverflow.com/a/21778633
possible better answer: http://stackoverflow.com/a/37508671

http://stackoverflow.com/q/21779004
has comment: http://stackoverflow.com/comment/32980195
favorite count: 0
has body: XStream refuses to add the "resultState" field as attribute in the output xml below (see screenshot), yet it does it correctly for the "order" and "name" fields. Any idea why? Code: xstream.useAttributeFor(Result.class, "name"); xstream.useAttributeFor(Result.class, "order"); xstream.useAttributeFor(Result.class, "resultState"); With: - Result.class, the parent class of ScenarioResult, TestCaseResult, PhaseResult and TaskResult shown in the xml output below. - "resultState", a field of Result.class and of type ResultState (it's an enum type) XML output (please see screenshot attached as plain xml text doesn't show properly on the post):
has answer: http://stackoverflow.com/a/21818109
upvote count: 1
linked to: http://stackoverflow.com/q/3533894
type: AnsweredQuestion
has title: XStream useAttributeFor not working
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21818109
tagged with: xstream
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32983654

http://stackoverflow.com/comment/32791743
has text: No need to load you data into a database to just use %like%. Java has you covered. There are many ways to do it. We would need to know more about your data and how you've tried to do it to make recommendations.
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/21690032

http://stackoverflow.com/comment/32983758
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21797573
score: 2
has text: If you want to get a really fast solution to that problem you would btw have to skip `BufferedReader` & `Integer.parseInt()` completely. It's still creating an unnecessary temporary `String` object before you can convert it into an `int` and that takes a lot of time compared to building `int` directly from the stream.

http://stackoverflow.com/q/21728494
linked to: http://stackoverflow.com/q/4984013
possible better answer: http://stackoverflow.com/a/56193926
has comment: http://stackoverflow.com/comment/32859304
has answer: http://stackoverflow.com/a/56193926
duplicate of: http://stackoverflow.com/q/4984013
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/113052230
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21728930
downvote count: 0
score: 6
favorite count: 0
has title: java.sql.SQLException: ResultSet closed
tagged with: sqlite
has body: I cant not do the further process because I get ResultSet closed while running this code. I am adding the value after 15 row of the sqlite database table and I want to find average value of 15 row and that should be store in ArrayList. Here is the code:- try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:test.db"); c.setAutoCommit(false); System.out.println("Opened database successfully3"); stmt = c.createStatement(); rs = stmt .executeQuery("SELECT TIME,BID,ASK FROM '" + title + "' ;"); System.out.println("Opened database successfully 20"); while (rs.next()) { i++; System.out.println(i); if (i &gt; 15) { System.out.println("i am in"); List&lt;String&gt; stocklist = new ArrayList&lt;String&gt;(); String main = rs.getString(1); System.out.println(rs.getString(1)); String s[] = main.split(" ", 2); String date = s[0]; String time = s[1]; stocklist.add(date); stocklist.add(time); stocklist.add(df.format(rs.getFloat("BID"))); stocklist.add(df.format(rs.getFloat("ASK"))); rs1 = stmt .executeQuery("SELECT ASK FROM '" + title + "' ;"); int j = 1; while (rs1.next()) { if (j &lt; i) { System.out.println(rs1.getFloat("ASK")); avg = avg + rs1.getFloat("ASK"); } j++; } rs1.close(); System.out.println("i am out"); avg = avg / 15; changepercent = ((rs.getFloat("ASK") - avg) / avg) * 100; stocklist.add(df.format(changepercent)); stocklist.add("ETE"); stocklist.add("HUN"); stocklist.add("ALU"); stocklist.add("ETE"); stocklist.add("HUN"); stocklist.add("ALU"); stocklist.add("ETE"); stocklist.add("HUN"); hntm.addRow(stocklist); } } rs.close(); stmt.close(); c.close(); } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); }
upvote count: 6
accepted answer: http://stackoverflow.com/a/21728930

http://stackoverflow.com/q/21706493
has body: I am developing an Inventory managemant System using Java Swing and Oracle. In that I have an Internal frame called Purchase.In this, when a user press ENTER button after filling up the form, data get inserted into actual table. But I want the data to be stored in a temporary table or temporarily in JTable until user press SAVE button. After pressing the SAVE button, the data from JTable or temporary table(may contain multiple rows) should get inserted into actual table. Please share your experience or idea on this.
answer count: 2
has answer: http://stackoverflow.com/a/21706772
has title: Storing Data Temporarily in JTable or Temporary table in Oracle
score: 0
has answer: http://stackoverflow.com/a/21707077
accepted answer: http://stackoverflow.com/a/21707077
tagged with: swing
possible better answer: http://stackoverflow.com/a/21706772
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: oracle10g

http://stackoverflow.com/q/21835181
downvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/21835263
favorite count: 0
has title: Whats the right way to use Jersey with hibernate DAOs?
has comment: http://stackoverflow.com/comment/33050073
has answer: http://stackoverflow.com/a/21835263
upvote count: 4
score: 2
has body: I´m developing a Jersey application with hibernate, but i don't know the right way to use these tecnologies without getting a messy code. I have just created a class that I call DataProvider. It is an abstract class that gets a generic POJO and performs actions on like save, list, update, delete and listAll. Then I created DAO classes for every table that extends DataProvider. These DAO´s are called in a JSONService class that serves JSON with the Jersey API. Anyone have some idea about whats the right way?
tagged with: java
type: Question
type: AnsweredQuestion
tagged with: jersey
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33049915

selenium
tags question: http://stackoverflow.com/q/21768688
tags question: http://stackoverflow.com/q/21703405
tags question: http://stackoverflow.com/q/21720075
tags question: http://stackoverflow.com/q/21729218
tags question: http://stackoverflow.com/q/21694279
tags question: http://stackoverflow.com/q/21775039
tags question: http://stackoverflow.com/q/21777112
tags question: http://stackoverflow.com/q/21779642
tags question: http://stackoverflow.com/q/21698202
tags question: http://stackoverflow.com/q/21713345
tags question: http://stackoverflow.com/q/21687354
tags question: http://stackoverflow.com/q/21747220
tags question: http://stackoverflow.com/q/21759781
tags question: http://stackoverflow.com/q/21841098
tags question: http://stackoverflow.com/q/21821521
tags question: http://stackoverflow.com/q/21714977
tags question: http://stackoverflow.com/q/21796588
tag name: selenium
tags question: http://stackoverflow.com/q/21785627
tags question: http://stackoverflow.com/q/21719081
tags question: http://stackoverflow.com/q/21829517
tags question: http://stackoverflow.com/q/21679357
tags question: http://stackoverflow.com/q/21758392
tags question: http://stackoverflow.com/q/21770373
tags question: http://stackoverflow.com/q/21684236
tags question: http://stackoverflow.com/q/21721061
tags question: http://stackoverflow.com/q/21788091
tags question: http://stackoverflow.com/q/21699441
tags question: http://stackoverflow.com/q/21785324
tags question: http://stackoverflow.com/q/21713280
tags question: http://stackoverflow.com/q/21757746
tags question: http://stackoverflow.com/q/21743350
tags question: http://stackoverflow.com/q/21715193
tags question: http://stackoverflow.com/q/21825661
type: Tag
tags question: http://stackoverflow.com/q/21729464
tags question: http://stackoverflow.com/q/21839183
tags question: http://stackoverflow.com/q/21702196
tags question: http://stackoverflow.com/q/21685020
tags question: http://stackoverflow.com/q/21751703
tags question: http://stackoverflow.com/q/21747223
tags question: http://stackoverflow.com/q/21694570

http://stackoverflow.com/q/21813425
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/18603318
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/21813808
accepted answer: http://stackoverflow.com/a/21813808
has answer: http://stackoverflow.com/a/21813450
tagged with: between
answer count: 2
has title: How to convert date to mysql date format
upvote count: 1
has body: Table1 id int pk searchdate datetime amount float Data for Table1 id searchdate amount 1 2014-02-05 100 2 2014-02-02 245 3 2014-02-11 344 here i want data between 2014-02-01 to 2014-02-10, but what i want from datetime picker is "01-02-2014" (dd-mm-yyyy format). please help me to create MySQL between query.
favorite count: 0
possible better answer: http://stackoverflow.com/a/21813450

http://stackoverflow.com/q/21700233
has title: How to run a package from other package?
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21700261
downvote count: 1
tagged with: java
has body: I want to run a package from other package of the same project, more exactly, I have 2 files(the first is a simple file, the second is a JFrameForm), I created a button in JFrameForm, and when it is pressed, I want Java to run "the first file". And a don't know how to do this. Please help.
score: -1
type: Question
has comment: http://stackoverflow.com/comment/32808926
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32809541
has comment: http://stackoverflow.com/comment/32808912

http://stackoverflow.com/comment/33006076
has text: Ah, I see! Books, article, internet and... literally everything tells us that Java is 'WORA' when learning about Java. I guess I have to read this book more thoroughly!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21810575

http://stackoverflow.com/comment/32892191
type: QuestionComment
comment on: http://stackoverflow.com/q/21746686
has text: @Pied Piper please look into this question.
score: 0
type: Comment

http://stackoverflow.com/comment/32792378
type: QuestionComment
has text: Can you show us something that would enable someone to answer this? Like the JSON file that you're trying to parse? Or the code that you're using? Maybe even the error message? Anything, so we can see what the problem is. Thank you.
score: 0
comment on: http://stackoverflow.com/q/21690413
type: Comment

http://stackoverflow.com/a/21739511
answers question: http://stackoverflow.com/q/21733220
type: Answer
upvote count: 6
has body: malabar-mode was added to MELPA so you do not need to install it by hand anymore. To install (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) (package-initialize) (package-install 'malabar-mode) (package-install 'flycheck) ;; This is optional but nice to have In .emacs. Because malabar-mode takes so long to load (over 30 seconds on my box), I have it delay loading until I try and find a .java file. (defun malabar-mode-bootstrap () (require 'cedet) (require 'semantic) (load "semantic/loaddefs.el") (semantic-mode 1);; (require 'malabar-mode) (load "malabar-flycheck") (malabar-mode) (flycheck-mode)) (add-to-list 'auto-mode-alist '("\\.java\\'" . malabar-mode-bootstrap)) Also, take a look at https://github.com/m0smith/maven-pom-mode for editing the pom.xml.
score: 6
downvote count: 0

http://stackoverflow.com/comment/32937889
comment on: http://stackoverflow.com/a/21771885
score: 0
type: Comment
has text: I think the download speed is reasonable, 10 seconds for 10 MB and 32 seconds for 24 MB so nothing to do with the InputStream. But even if getContentLength() and getResponseCode() download the whole file, it is weird to take almost 5 mins. Moreover, why it only takes 0.107s for 1.mp4 but 279.565s for 2.mp4? It is reproducible so I do think it is because of the quality of connection.
type: AnswerComment

jframe
tags question: http://stackoverflow.com/q/21790021
tags question: http://stackoverflow.com/q/21807086
tags question: http://stackoverflow.com/q/21832378
tags question: http://stackoverflow.com/q/21701332
tag name: jframe
tags question: http://stackoverflow.com/q/21696882
tags question: http://stackoverflow.com/q/21816283
tags question: http://stackoverflow.com/q/21839821
tags question: http://stackoverflow.com/q/21697601
tags question: http://stackoverflow.com/q/21727652
tags question: http://stackoverflow.com/q/21820161
tags question: http://stackoverflow.com/q/21770342
tags question: http://stackoverflow.com/q/21837328
tags question: http://stackoverflow.com/q/21818380
tags question: http://stackoverflow.com/q/21745317
tags question: http://stackoverflow.com/q/21840094
tags question: http://stackoverflow.com/q/21793960
tags question: http://stackoverflow.com/q/21753769
tags question: http://stackoverflow.com/q/21709619
tags question: http://stackoverflow.com/q/21684503
tags question: http://stackoverflow.com/q/21691086
tags question: http://stackoverflow.com/q/21835581
tags question: http://stackoverflow.com/q/21783798
tags question: http://stackoverflow.com/q/21800834
tags question: http://stackoverflow.com/q/21840006
tags question: http://stackoverflow.com/q/21681914
tags question: http://stackoverflow.com/q/21813279
tags question: http://stackoverflow.com/q/21710929
tags question: http://stackoverflow.com/q/21812501
tags question: http://stackoverflow.com/q/21813610
tags question: http://stackoverflow.com/q/21686146
tags question: http://stackoverflow.com/q/21818582
tags question: http://stackoverflow.com/q/21691884
type: Tag
tags question: http://stackoverflow.com/q/21799731
tags question: http://stackoverflow.com/q/21690064
tags question: http://stackoverflow.com/q/21708752
tags question: http://stackoverflow.com/q/21709375
tags question: http://stackoverflow.com/q/21791627

http://stackoverflow.com/q/21734101
type: Question
has body: I have created a password field using JOptionPane. When I run the program, the JOptionPane comes up and looks great, however the focus always goes to the OK button. I want the focus start on the password field. I've tried requestFocus(), requestFocusInWindow(), but this doesn't seem to work. Is there something special that I need to go to get the focus on password field? See my code below : JPasswordField pf = new JPasswordField(); pf.requestFocusInWindow(); int okCxl = JOptionPane.showConfirmDialog(null, pf, "ENTER SUPERUSER PASSWORD", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
accepted answer: http://stackoverflow.com/a/21734425
linked to: http://stackoverflow.com/q/6478394
upvote count: 1
has answer: http://stackoverflow.com/a/21734425
answer count: 1
favorite count: 0
has title: Setting focus in JOptionPane JPasswordField
tagged with: joptionpane
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/32870823

http://stackoverflow.com/a/21760139
has comment: http://stackoverflow.com/comment/32917390
has comment: http://stackoverflow.com/comment/32916881
type: Answer
has comment: http://stackoverflow.com/comment/32916234
has comment: http://stackoverflow.com/comment/32916100
has comment: http://stackoverflow.com/comment/32916577
accepted answer of: http://stackoverflow.com/q/21759808
upvote count: 5
answers question: http://stackoverflow.com/q/21759808
score: 5
has comment: http://stackoverflow.com/comment/32916447
type: AcceptedAnswer
has body: You can do something like this @Post("json") public void someMethod(Representation rep){...} You can substitute json for the content type you can handle. If the post is from a simple html form then you can get the Form object from the representation and extract the parameters from that. @Post public void someMethod(Representation entity){ final Form form = new Form(entity); String name = form.getFirstValue("name")); } Note you can also construct Form objects from query strings.
downvote count: 0
has comment: http://stackoverflow.com/comment/32916490
has comment: http://stackoverflow.com/comment/126282480
has comment: http://stackoverflow.com/comment/32916592

http://stackoverflow.com/a/21679258
upvote count: 6
has comment: http://stackoverflow.com/comment/32772194
answers question: http://stackoverflow.com/q/21679203
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21679203
has comment: http://stackoverflow.com/comment/116932855
type: Answer
score: 6
downvote count: 0
has body: Try to wrap the scrollPathToVisible call in SwingUtilities.invokeLater() to let all listeners to process add node event and refresh internal structures accordingly.

http://stackoverflow.com/q/21727961
upvote count: 1
has body: I have two projects where apps project |----> depends on Library project I have an icon(a.png) and layout(b.xml) in library project. I copied a new iconwith the same name a.png and the same layout(b.xml) which is from the library project into apps project then the application is picking the new icon(a.png, a modified one). I deleted the layout(b.xml) file from apps projects as there is no code change, just the icon is changed. Now the application is not picking the new a.png file which is a modified one in apps, it is still showing the one from library project. Is there a way to ask/push the layout present in library project to pick the a.png from apps project? I'm supposed to copy the layout and paste it in the apps project for to pick the new a.png file.
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Drawables of main project are not picked up by library project in android
has comment: http://stackoverflow.com/comment/32858193
tagged with: http://stackoverflow.com/tag/xml
downvote count: 0
answer count: 0
score: 1
type: Question
has comment: http://stackoverflow.com/comment/32858439
has comment: http://stackoverflow.com/comment/32858283
has comment: http://stackoverflow.com/comment/32857943
tagged with: java
tagged with: eclipse

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/21696592
tags question: http://stackoverflow.com/q/21796674

http://stackoverflow.com/comment/33001788
has text: What is scroll and how is it created before? Unless you explicitly set the size of preferred size, don't assume it's set for ANYTHING.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21808104

http://stackoverflow.com/a/21756104
type: Answer
has comment: http://stackoverflow.com/comment/32908794
accepted answer of: http://stackoverflow.com/q/21754645
answers question: http://stackoverflow.com/q/21754645
type: AcceptedAnswer
has body: Assuming your project code is actually in subdirectories, you probably want: grant codeBase "file:/home/myself/NetBeansProjects/-" { (which grants permission recursively to all sub-directories).
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/21827478
has body: This sounds like Eclipse bug 392818. Comments in the bug report say: Not sure if this can be considered a bug; the guide for installing software using the p2 director application (1) states that if you want to run the provisioning operation from within the target you're provisioning into you're not supposed to use the -destination argument. The problem you're facing most likely stems from the fact that you're trying to modify the platform while it is running. The -destination flag assumes that the target you're provisioning into is not started. (1) http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_director.html - "Running inside the target application" section.
score: 1
accepted answer of: http://stackoverflow.com/q/21826552
answers question: http://stackoverflow.com/q/21826552
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33037239
type: Answer
downvote count: 0

http://stackoverflow.com/a/21818691
has comment: http://stackoverflow.com/comment/33054297
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21818640
has body: Create a Vector&lt;TableItem&gt; For each element selected in the table, check Vector.contains(tableItem) If present, do nothing. If not present, add it. Use the Vector&lt;TableItem&gt; to establish a new DefaultComboBoxModel Call JComboBox.setModel(ComboBoxModel).
score: 3
has comment: http://stackoverflow.com/comment/33059255

http://stackoverflow.com/comment/32864039
type: Comment
has text: I've added more detail to the question. As you can see, I am wrapping my method in invokeLater() and am stumped as to why it would not be working.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21712118

http://stackoverflow.com/a/21830297
has comment: http://stackoverflow.com/comment/33041234
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21827492
upvote count: 2
has comment: http://stackoverflow.com/comment/33045386
has comment: http://stackoverflow.com/comment/33040922
score: 2
has body: You need to flush()/close() the FileWriter to ensure all the data is written to the file. The problem is that you have 2 "top-level" elements in your xml result (2 "array" elements). xml can only have one top-level element. UPDATE: Try this for converting the json to xml: String xml = XML.toString(jsonArray, "doc");
has comment: http://stackoverflow.com/comment/33054372
has comment: http://stackoverflow.com/comment/33045849

http://stackoverflow.com/a/37235225
answers question: http://stackoverflow.com/q/21771225
score: 0
has body: I had a similar issue, my error was: Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException:org.glassfish.jersey.servlet.ServletContainer from [Module "deployment.RESTful_Services_CRUD.war:main" from Service Module Loader] I use jboss and glassfish so I changed the web.xml to the following: org.apache.catalina.servlets.DefaultServlet Instead of: org.glassfish.jersey.servlet.ServletContainer Hope this work for you.
type: Answer

http://stackoverflow.com/comment/33054057
type: Comment
has text: I did add the dynamicUpdate=true to MyEntity right where the annotation of the class is located. It states that it is deprecated. But it did not work. @Entity @org.hibernate.annotations.Entity(dynamicUpdate = true) public class MyEntity {
type: AnswerComment
comment on: http://stackoverflow.com/a/21833258
score: 0

http://stackoverflow.com/comment/32933570
type: Comment
type: QuestionComment
has text: Yes. This code is to save an generic file, and and I'm adapting it to be able to image processing. This code is inside a FileItem for, and this File is created to store the information and later be used by FileItem Object to save the file to disk.
comment on: http://stackoverflow.com/q/21769586
score: 0

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/21774816
tags question: http://stackoverflow.com/q/21686424
tags question: http://stackoverflow.com/q/21815261
tags question: http://stackoverflow.com/q/21683335
tags question: http://stackoverflow.com/q/21755169
tags question: http://stackoverflow.com/q/21679829
tags question: http://stackoverflow.com/q/21689892
tags question: http://stackoverflow.com/q/21770875
tags question: http://stackoverflow.com/q/21719817
tags question: http://stackoverflow.com/q/21743194
tags question: http://stackoverflow.com/q/21824669
tags question: http://stackoverflow.com/q/21832429
tags question: http://stackoverflow.com/q/21750116
tags question: http://stackoverflow.com/q/21694477
tags question: http://stackoverflow.com/q/21707059
tags question: http://stackoverflow.com/q/21833536
tags question: http://stackoverflow.com/q/21772221
tags question: http://stackoverflow.com/q/21827492
tags question: http://stackoverflow.com/q/21788434
tags question: http://stackoverflow.com/q/21725093
tags question: http://stackoverflow.com/q/21760930
tags question: http://stackoverflow.com/q/21698003
tags question: http://stackoverflow.com/q/21769353
tags question: http://stackoverflow.com/q/21700785
tags question: http://stackoverflow.com/q/21741777
tags question: http://stackoverflow.com/q/21720277
tags question: http://stackoverflow.com/q/21839819
tags question: http://stackoverflow.com/q/21831124
tags question: http://stackoverflow.com/q/21774622
tags question: http://stackoverflow.com/q/21773926
tags question: http://stackoverflow.com/q/21704852
tags question: http://stackoverflow.com/q/21816387
tags question: http://stackoverflow.com/q/21751615
tags question: http://stackoverflow.com/q/21710402
tags question: http://stackoverflow.com/q/21748101
tags question: http://stackoverflow.com/q/21840802
tags question: http://stackoverflow.com/q/21740241
tags question: http://stackoverflow.com/q/21797051
tags question: http://stackoverflow.com/q/21718075
type: Tag
tags question: http://stackoverflow.com/q/21746827
tags question: http://stackoverflow.com/q/21749777
tags question: http://stackoverflow.com/q/21803563
tags question: http://stackoverflow.com/q/21771982
tags question: http://stackoverflow.com/q/21751915
tags question: http://stackoverflow.com/q/21821791
tags question: http://stackoverflow.com/q/21825403
tags question: http://stackoverflow.com/q/21739668
tags question: http://stackoverflow.com/q/21762888
tags question: http://stackoverflow.com/q/21825263
tags question: http://stackoverflow.com/q/21838887
tags question: http://stackoverflow.com/q/21723033
tags question: http://stackoverflow.com/q/21749122
tags question: http://stackoverflow.com/q/21733974
tags question: http://stackoverflow.com/q/21789548
tags question: http://stackoverflow.com/q/21793584
tags question: http://stackoverflow.com/q/21780900
tags question: http://stackoverflow.com/q/21694655
tags question: http://stackoverflow.com/q/21748780
tags question: http://stackoverflow.com/q/21793494
tag name: json
tags question: http://stackoverflow.com/q/21712202
tags question: http://stackoverflow.com/q/21751956
tags question: http://stackoverflow.com/q/21824657
tags question: http://stackoverflow.com/q/21720759
tags question: http://stackoverflow.com/q/21734689
tags question: http://stackoverflow.com/q/21811789
tags question: http://stackoverflow.com/q/21695064
tags question: http://stackoverflow.com/q/21694216
tags question: http://stackoverflow.com/q/21760891
tags question: http://stackoverflow.com/q/21686159
tags question: http://stackoverflow.com/q/21690413
tags question: http://stackoverflow.com/q/21695490
tags question: http://stackoverflow.com/q/21781540
tags question: http://stackoverflow.com/q/21690879
tags question: http://stackoverflow.com/q/21812671
tags question: http://stackoverflow.com/q/21775590
tags question: http://stackoverflow.com/q/21730999
tags question: http://stackoverflow.com/q/21709558
tags question: http://stackoverflow.com/q/21749766

http://stackoverflow.com/q/21755138
has answer: http://stackoverflow.com/a/21755204
answer count: 3
has body: How can I use variables from one class in my other classes? For example, I have Class 1 public class maintype { public int A = 1, B = 2, C = 3, D = 4; public String E, F, G public static void main(String args[]) { } } Class 2 public class subclass { public numbers() { AB = A + B; } } I want to use the variable a and b in my second class but it is giving me an error. saying no such variable exist but I don't want to create that variable again in my second class.
has answer: http://stackoverflow.com/a/21755166
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/32906722
has comment: http://stackoverflow.com/comment/32906675
type: AnsweredQuestion
tagged with: java
downvote count: 3
has title: How to use variables from one class in other classes?
has comment: http://stackoverflow.com/comment/32906598
accepted answer: http://stackoverflow.com/a/21755166
type: Question
score: -2
has answer: http://stackoverflow.com/a/31617123
tagged with: variables
possible better answer: http://stackoverflow.com/a/21755204
tagged with: class

http://stackoverflow.com/q/21769655
downvote count: 1
tagged with: android-ndk
type: Question
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/32934569
has answer: http://stackoverflow.com/a/30399033
has comment: http://stackoverflow.com/comment/49755894
answer count: 3
has title: JNI UnsatisfiedLinkError - Native method not found
has comment: http://stackoverflow.com/comment/32957108
has answer: http://stackoverflow.com/a/27438772
has body: I'm trying to use JNI in Android but keep getting 'UnsatisfiedLinkError - Native method not found'. I've spent some hours searching for solutions, but still having trouble. Thanks for any help. My code is as follows: Java class: package com.example.icam; public class Native { static{ System.loadLibrary("nativeLib"); } public static native int nativeFunction(); } Header file (generated using javah): /* DO NOT EDIT THIS FILE - it is machine generated */ #include &lt;jni.h&gt; /* Header for class com_example_icam_Native */ #ifndef _Included_com_example_icam_Native #define _Included_com_example_icam_Native #ifdef __cplusplus extern "C" { #endif /* * Class: com_example_icam_Native * Method: nativeFunction * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_example_icam_Native_nativeFunction (JNIEnv *, jclass); #ifdef __cplusplus } #endif #endif C++ source file: #include "com_example_icam_Native.h" JNIEXPORT jint JNICALL Java_com_example_icam_Native_nativeFunction(JNIEnv * env, jclass clazz){ return (jint)1; } My Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) OPENCV_CAMERA_MODULES:=on OPENCV_INSTALL_MODULES:=on #OPENCV_LIB_TYPE:=SHARED APP_ABI := armeabi-v7a LOCAL_SRC_FILES := native.cpp include C:\OpenCV-2.4.8-android-sdk\sdk\native\jni\OpenCV.mk LOCAL_LDLIBS += -llog -ldl LOCAL_MODULE := nativeLib include $(BUILD_SHARED_LIBRARY) I'm very new to JNI, maybe I'm missing something? Error message: 02-14 03:44:37.501: E/AndroidRuntime(23484): java.lang.UnsatisfiedLinkError: Native method not found: com.example.icam.Native.nativeFunction:()I 02-14 03:44:37.501: E/AndroidRuntime(23484): at com.example.icam.Native.nativeFunction(Native Method) 02-14 03:44:37.501: E/AndroidRuntime(23484): at com.example.icam.MainActivity.onCreate(MainActivity.java:81) 02-14 03:44:37.501: E/AndroidRuntime(23484): at android.app.Activity.performCreate(Activity.java:5231) 02-14 03:44:37.501: E/AndroidRuntime(23484): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.j…
score: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/32989886
has answer: http://stackoverflow.com/a/21769801
upvote count: 2
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/21729758
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32864347
downvote count: 0
has body: You need only the Server Connection channel and the MCA user can be set using the MQ Explorer or the command line (runmqsc). Here is the link to runmqsc: http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.amqzag.doc%2Ffa11160_.htm Here is the link to the ALTER command that can be used to change the MCA user on the channel : http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzaj.doc/sc10480_.htm
answers question: http://stackoverflow.com/q/21728896

http://stackoverflow.com/comment/32814540
type: Comment
type: QuestionComment
has text: See this: http://stackoverflow.com/questions/3342984/jstl-in-jsf2-facelets-makes-sense
comment on: http://stackoverflow.com/q/21703424
score: 0

http://stackoverflow.com/q/21700310
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32828036
has comment: http://stackoverflow.com/comment/32812944
upvote count: 1
has body: I have the following info with me: NATIVE MEMORY USAGE Type, Memory Used (bytes), Object Count ByteCode, 3015540, 28000 Const Pool, 1978128, 3412 UTF8 Strings, 6089367, 89281 UTF16 Strings, 1934, 8 Offscreen Images, 0, 0 Static Data, 52624, 1393 Bitmaps, 0, 0 CWT, 288172, 579 VTables, 468764, 3629 CVTables, 469712, 3629 ITables, 273504, 2814 Class Meta, 59484, 2835 GCTables, 64940, 2052 GCStaticTables, 31864, 1372 Method Blocks, 1575440, 3392 (num methods : 32821) Field Blocks, 345888, 2035 (num fields : 17294) VM Chunk Data TYPE_MMPOINTER, 0, 0 VM Chunk Data TYPE_OBJECTREF, 12292, 1 VM Chunk Data TYPE_PURGEPROCPTR, 0, 0 VM Chunk Data TYPE_FORWARDREF, 0, 0 VM Chunk Data TYPE_MONITORCACHE, 6422724, 49 VM Chunk Data TYPE_PROFTHREADINFO, 0, 0 VM Chunk Data TYPE_CODEFIXUP, 0, 0 VM Chunk Data TYPE_WIDGET, 8196, 1 VM Chunk Data TYPE_MEMTRACKER, 0, 0 VM Chunk Data TYPE_GRAPHICSCONTEXT, 0, 0 VM Hashes, 17432, 2 Generated Code, 0, 0 JAR File Name Tables, 4424, 7 JAR File Tables, 6720, 7 Unspecified, 3201427, 9318 But I would like to know how to map this to the JVM memory map, for understanding this more clearly. I searched through the internet, but was unable to find a proper map diagram which could resemble everything in this. All pointers are welcome.
has title: How to map the native meory usage statistics for heap dump to JVM memory map diagram
tagged with: jvm
has comment: http://stackoverflow.com/comment/32810583
favorite count: 0
tagged with: memory-mapping
has comment: http://stackoverflow.com/comment/32810213
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32810550
downvote count: 0
answer count: 0

opengl-es
tags question: http://stackoverflow.com/q/21828714
type: Tag
tags question: http://stackoverflow.com/q/21687044
tag name: opengl-es
tags question: http://stackoverflow.com/q/21802451
tags question: http://stackoverflow.com/q/21682801
tags question: http://stackoverflow.com/q/21833715
tags question: http://stackoverflow.com/q/21721428

http://stackoverflow.com/q/21786547
has body: I'm new to Mule, Whenever i'm adding 'Poll' with fixed-frequency scheduler to mule flow, getting namespace error.Shouldn't mule keep adding the namespace whenever we add new component to flow through editor ? Do i have explicitly add the namespace related with 'poll'? I was expecting namespace for poll to be available in Mule core. I'm using Mule studio-3.5.0. Invalid content was found starting with element 'fixed-frequency-scheduler' Here is the mule configuration - &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey" version="EE-3.4.1" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/jersey http://www.mulesoft.org/schema/mule/jersey/3.4/mule-jersey.xsd http://jersey.apache.org/core http://jersey.apache.org/schemas/core.xsd http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd http://www.mulesoft.org/schema/mule/jms http://www.muleso…
tagged with: java
tagged with: mule
has answer: http://stackoverflow.com/a/21787033
tagged with: mule-studio
type: Question
has title: Namespace issue while adding new component to Mule flow
answer count: 1
accepted answer: http://stackoverflow.com/a/21787033
score: 0
tagged with: namespaces
type: AnsweredQuestion

http://stackoverflow.com/comment/32992121
comment on: http://stackoverflow.com/a/21802188
type: Comment
score: 0
has text: @JakeSylvestre: You don't need nor want it to say "checker1". Use an array or ArrayList and use `checkerArray[0]` or `checkerList.get(0)`. Again, you would be well served to learn to use these guys.
type: AnswerComment

http://stackoverflow.com/q/21697341
has comment: http://stackoverflow.com/comment/34661644
upvote count: 12
has comment: http://stackoverflow.com/comment/34663057
has answer: http://stackoverflow.com/a/22878253
has comment: http://stackoverflow.com/comment/34926348
has answer: http://stackoverflow.com/a/22859616
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22741217
tagged with: awt
has comment: http://stackoverflow.com/comment/34797449
has comment: http://stackoverflow.com/comment/34783533
has answer: http://stackoverflow.com/a/22837657
tagged with: user-interface
has answer: http://stackoverflow.com/a/22745448
downvote count: 0
has answer: http://stackoverflow.com/a/22808466
favorite count: 0
has answer: http://stackoverflow.com/a/34444545
has comment: http://stackoverflow.com/comment/34662812
linked to: http://stackoverflow.com/q/6777135
type: Question
has answer: http://stackoverflow.com/a/22837846
has comment: http://stackoverflow.com/comment/34662945
has body: Now what I am doing in my program is that I am using setundecorated = true and MAXIMIZED_BOTH So it makes it go full screen and the display looks very nice, But the problem is that there are images (border) on the left and the right side of my screen and also a blue background. What happens is that in changing screens and resolutions these get disturbed and are not shown properly. Those grey patches come up again History: I have a java program which I wanted to always open in full screen; I was not able to find a way to do it properly so I had adjusted the minimum to (1370, 727) and maximum size. Thus, it started opening properly on my laptop, but when I changed my laptop's display to LCD, it started giving problems: It opens in a smaller window: If I then click on the maximize button, a grey area comes on the side and bottom (I wanted the items on screen to get stretched or center themselves): And here for example, there is a grey patch at the bottom. Instead, I want the background to cover the whole screen. Update 1 If I change to stretchable gridbaglayout, this is the code I used and what happens: Menu.setExtendedState(MAXIMIZED_BOTH); GridBagLayout gbl = new GridBagLayout(); Menu.setLayout(gbl); JButton component = new JButton("1"); gbl.layoutContainer(Menu); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.NONE; gbl.setConstraints(component, gbc); Menu.add(component); Menu.pack(); Menu.setVisible(true); Question How do I set "this" frame to setExtendedState(MAXIMIZED_BOTH) as I have done to others? (if I do this in main function, I get an error; even if I make a function for this and call it in main I get an error) How do I get everything to stretch/rearrange themselves according to the extra grey space? Update 2 My files in this project: Update 3 This is the current file I am working on "FormTTS.java" Search for "MAXIMIZED_BOTH" in there and you will find the code I think you will want to check.
has comment: http://stackoverflow.com/comment/34662887
linked to: http://stackoverflow.com/q/3680221
answer count: 11
linked to: http://stackoverflow.com/q/15493219
score: 12
has comment: http://stackoverflow.com/comment/34783213
has answer: http://stackoverflow.com/a/21697526
tagged with: java
has answer: http://stackoverflow.com/a/22877365
linked to: http://stackoverflow.com/q/16343098
has answer: http://stackoverflow.com/a/22885103
has comment: http://stackoverflow.com/comment/34661590
has comment: http://stackoverflow.com/comment/34661757
has comment: http://stackoverflow.com/comment/34661707
has title: How to output java full screen properly
tagged with: swing
tagged with: fullscreen
has comment: http://stackoverflow.com/comment/34782988

http://stackoverflow.com/comment/32771096
has text: `sentence.ownText()` returns the right set of strings but there's some spacing issues. Any way to resolve this?
comment on: http://stackoverflow.com/a/21678654
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32894401
score: 0
has text: Only these:02-13 00:27:42.537: E/eglCodecCommon(3019): glUtilsParamSize: unknow param 0x00000b44 02-13 00:27:42.547: E/eglCodecCommon(3019): glUtilsParamSize: unknow param 0x00000bd0 02-13 00:27:42.557: E/eglCodecCommon(3019): **** ERROR unknown type 0xab58af31 (glSizeof,72)
type: QuestionComment
comment on: http://stackoverflow.com/q/21746530
type: Comment

http://stackoverflow.com/q/21747310
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21752782
has title: How to print the string without duplicate?
has answer: http://stackoverflow.com/a/21747428
tagged with: java
has comment: http://stackoverflow.com/comment/32893555
has comment: http://stackoverflow.com/comment/32893367
type: Question
has comment: http://stackoverflow.com/comment/32893401
has comment: http://stackoverflow.com/comment/32893312
has body: I tried to print the string without duplicate but i not getting the proper output and here I exposed my code snippets. class Duplicatestring { public static void main(String [] args) { String word = ""; String[] ip ={"mani" ," manivannan","raghv ","mani"}; for(int i =0; i&lt;ip.length; i++) { for(int j = i+1; j&lt;=ip.length; j++) { if(ip[i].equals(ip[j])){ word = word+ip[i]; } } System.out.println(word); } } } And one more thing is I don't want use the collections that is my task and pleas give any proper solution for this. Example: Input -&gt; {mani, manivanna,raghv, mani}; output -&gt; {mani, manivanna,raghv}
has comment: http://stackoverflow.com/comment/32893445
has comment: http://stackoverflow.com/comment/32893382
has answer: http://stackoverflow.com/a/21747695
score: 0
has answer: http://stackoverflow.com/a/21747517
tagged with: arrays
tagged with: string
has answer: http://stackoverflow.com/a/21747421
has comment: http://stackoverflow.com/comment/32893297

http://stackoverflow.com/a/21809618
has comment: http://stackoverflow.com/comment/33006623
score: 0
type: Answer
has body: A HashMap with name as the key will give you O(1) performance when matching the elements, keep a TreeSet with a rating Comparator and you'll have the items in order. Although you'll need to reinsert an element if the rating changes.
answers question: http://stackoverflow.com/q/21809051

http://stackoverflow.com/q/21805787
has comment: http://stackoverflow.com/comment/32997469
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26598590
accepted answer: http://stackoverflow.com/a/26598590
tagged with: java
has comment: http://stackoverflow.com/comment/32997691
type: Question
tagged with: graphics
has body: I'm following a Java game programming series on youtube, and all have been going well until we add some code to the program. The code for the program is: package com.fagyapong.rain; import javax.swing.*; import java.awt.*; import java.awt.image.*; public class Game extends Canvas implements Runnable{ private static final long serialVersionUID = -247215114548172830L; public static int width = 300; public static int height = width / 16 * 9; public static int scale = 3; private JFrame frame; public Thread thread; private boolean running = false; public Game() { // Setup Game window Dimension size = new Dimension(width * scale, height * scale); setPreferredSize(size); frame = new JFrame(); } public synchronized void start() { running = true; thread = new Thread(this, "Display"); thread.start(); } public synchronized void stop() { running = false; try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } public void run() { while (running) { update(); render(); } } public void update() { } public void render() { // Get the canvas' BufferStragy object BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g.setColor(Color.GRAY); g.fillRect(0, 0, getWidth(), getHeight()); g.dispose(); bs.show(); } public static void main(String[] args) { Game game = new Game(); game.frame.setResizable(false); game.frame.setTitle("Rain"); game.frame.add(game); game.frame.pack(); game.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); game.frame.setLocationRelativeTo(null); game.frame.setVisible(true); game.start(); } } Below is code that causes the system freeze(it has been commented out in the above code) Graphics g = bs.getDrawGraphics(); g.setColor(Color.GRAY); g.fillRect(0, 0, getWidth(), getHeight()); g.dispose(); bs.show();
score: 0
has title: System Freezes upon Running this code
answer count: 1
has comment: http://stackoverflow.com/comment/32997773
has comment: http://stackoverflow.com/comment/32997507
tagged with: linux
has comment: http://stackoverflow.com/comment/32997678

http://stackoverflow.com/a/21753672
answers question: http://stackoverflow.com/q/21744005
downvote count: 0
type: Answer
score: 2
has body: I know very litle about Java or unit testing specifically in Java, so my observation here is a purely general one vis-a-vis Unit testing in general. It looks like your class is doing too much internally. If there's a reason why you need to make 4 private method calls as a result of a single public call, you could well be in the region of violating SRP (not that this rule isn't inviolate, but it's a good indicator of a design smell) Now we don't have too much context on what your "outer" class is doing, but given the information presented, perhaps you could consider instead refactoring the work done in each of these 4 private methods into 4 separate classes, which you can supply as dependencies to your main class; you then change your test approach to have multiple, smaller tests each of which just checks that a particular dependency was invoked e.g your method names might look like PublicMethod_InvokesService1(){} PublicMethod_InvokesService2(){} PublicMethod_InvokesService3(){} PublicMethod_InvokesService4(){} Which means you avoid having all those huge mock/ assert chains in a single method. You might think that this is naive because - what about the order of operations - surely it gets too messy to make sure that the order of invocation is correct, what about passing return values from Method1 into Method 2 via Mocks, etc. In that case, if these services need to be invoked in a strict order, then you can also consider that instead of a flat list of dependencies, you really ought to use a hierarchy i.e instead of PublicClass depends on Service 1 (depends on Service2,3 and 4) you have PublicClass depends on Service 1 (depends on Service2 (depends on Service 3 (depends on Service 4)))) This means that order of operations is N/A; each Service from the public on down only invokes a single dependency, meaning you don't need to worry about order. In fact you are already enforcing the logical order of operations structurally before you even write your public method. Just…
upvote count: 2

http://stackoverflow.com/comment/32778055
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21682392
has text: You can try creating final String(s) of application names and then their locations on the computer. Then, check the user input for the <appName> and if that is within the text, open the app by the certain final String. Is this going to be only windows? or both mac/windows?

http://stackoverflow.com/a/21714006
type: Answer
upvote count: 190
score: 190
accepted answer of: http://stackoverflow.com/q/21713280
has comment: http://stackoverflow.com/comment/104311032
has body: I don't think barak manos's answer has fully explained it. Imagine we have few elements as the followings: &lt;div class="value test"&gt;&lt;/div&gt; &lt;div class="value test "&gt;&lt;/div&gt; &lt;div class="first value test last"&gt;&lt;/div&gt; &lt;div class="test value"&gt;&lt;/div&gt; How XPath matches Match only 1 (exact match), barak's answer driver.findElement(By.xpath("//div[@class='value test']")); Match 1, 2 and 3 (match class contains value test, class order matters) driver.findElement(By.xpath("//div[contains(@class, 'value test')]")); Match 1, 2, 3 and 4 (as long as elements have class value and test) driver.findElement(By.xpath("//div[contains(@class, 'value') and contains(@class, 'test')]")); Also, in cases like this, Css Selector is always in favor of XPath (fast, concise, native). Match 1 driver.findElement(By.cssSelector("div[class='value test']")); Match 1, 2 and 3 driver.findElement(By.cssSelector("div[class*='value test']")); Match 1, 2, 3 and 4 driver.findElement(By.cssSelector("div.value.test"));
answers question: http://stackoverflow.com/q/21713280
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21723967
has title: write logs to oldest file in directory
type: Question
tagged with: java.util.logging
answer count: 1
score: 0
tagged with: file-io
has body: I want to do some tweaks to my logging for my application... I would like some help to enhance what I have below in main method: public static void main(String[] args) { try { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Handler h = new FileHandler("../logs/MyLogFile_" + sdf.format(date) + ".log", true); h.setFormatter(new SingleLineFormatter()); h.setLevel(Level.ALL); logger.setUseParentHandlers(false); logger.addHandler(h); } //... } It creates a log file with date stamp everytime I run the application. But I want to achieve something like this in my Unix Directory: -rw-r--r-- 1 r787848 dev 45271 Feb 4 11:31 MyLogFile.log.06 -rw-r--r-- 1 r787848 dev 45308 Feb 5 11:36 MyLogFile.log.05 -rw-r--r-- 1 r787848 dev 44336 Feb 6 06:50 MyLogFile.log.04 -rw-r--r-- 1 r787848 dev 44379 Feb 7 08:41 MyLogFile.log.03 -rw-r--r-- 1 r787848 dev 44409 Feb 10 08:45 MyLogFile.log.02 -rw-r--r-- 1 r787848 dev 44446 Feb 11 12:36 MyLogFile.log.01 I want to define a set of lets say 6 log files to capture logging of daily run of the application. When it comes to logging, I want the application to write to the log file that is oldest, so in the above instance, running the application on Feb 12 08:45 should clear MyLogFile.log.06 and write fresh for feb 12. How can this be achieved with java.util.logging on top of what I have. Unfortunately, I am not able to configure log4j properties and want to use java.util.logging only.
has answer: http://stackoverflow.com/a/22414403
type: UnansweredQuestion
tagged with: logging
has comment: http://stackoverflow.com/comment/34081792
tagged with: java
tagged with: file

http://stackoverflow.com/q/21703774
type: Question
answer count: 2
score: 5
has title: Overriding pre/post execute in AsyncTask and calling super.onPre/PostExecute
downvote count: 0
has body: Is it mandatory to call super.onPreExecute when overriding onPreExecute in an AsyncTask? What does AsyncTask.onPreExecute and other methods actually do? Same question for onPostExecute and onCancelled public class MyAsyncTask extends AsyncTask&lt;Void, Void, Boolean&gt; { @Override protected void onCancelled(Boolean result) { super.onCancelled(result); //&lt;-DO I HAVE TO? //My onCancelled code below } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); //&lt;-DO I HAVE TO? //My onPostExecute code below } @Override protected void onPreExecute() { super.onPreExecute(); //&lt;-DO I HAVE TO? //My onPreExecute code below } @Override protected Boolean doInBackground(Void... params) { return null; }
favorite count: 0
has answer: http://stackoverflow.com/a/21704150
tagged with: android
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/21703849
accepted answer: http://stackoverflow.com/a/21703849
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21704150
upvote count: 5
tagged with: java

http://stackoverflow.com/comment/33044452
comment on: http://stackoverflow.com/q/21832487
type: QuestionComment
score: 2
has text: You must start your program with parameters.
type: Comment

http://stackoverflow.com/a/21681887
has comment: http://stackoverflow.com/comment/32777103
has comment: http://stackoverflow.com/comment/32779463
score: 0
answers question: http://stackoverflow.com/q/21681044
type: Answer
has body: I assume you may use plenty of memory to do that or memory is not a concern for you. Now as you want only the top 25 entries for any category, I would suggest the following: Have a HashSet of Player objects. Player objects have the info like name, games won, money etc. Now have a HashMap of category name vs TreeSet of top 25 player objects in that category. The category name may be a checksum of some columns say gamewon, money, achievent etc. HashMap&lt;String /*for category name */, TreeSet /*Sort based on the criteria */&gt; ...... Whenever you update a player object, you update the common HashSet first and then check if the player object is a candidate for top 25 entries in any of the categories. If it is a candidate, some player object unfortunately may lose their ranking and hence may get kicked out of the corresponding treeset. >> if you make the TreeSet sorted by the score, it'll break whenever the score changes (and the player will not be found in it Correct. Now I got the point :) . So, I will do the following to mitigate the problem. The player object will have a field that indicate whether it is already in some categories, basically a set of categories it is already in. While updating a player object, we have to check if the player is already in some categories, if it is in some categories already, we will rearrange the corresponding treeset first; i.e. remove the player object and readjust the score and add it back to the treeset. Whenever a player object is kicked out of a category, we remove the category from the field which is holding a set of categories the player is in Now, what you do if the look-up is done with a brand new search criteria (means the top 25 is not computed for this criteria already) ? ------ Traverse the HashMap and build the top entries for this category from "scratch". This will be expensive operation, just like indexing something afresh.

http://stackoverflow.com/q/21685591
answer count: 2
accepted answer: http://stackoverflow.com/a/21685659
tagged with: date
has answer: http://stackoverflow.com/a/21685790
score: 0
has answer: http://stackoverflow.com/a/21685659
tagged with: android
possible better answer: http://stackoverflow.com/a/21685790
type: AnsweredQuestion
tagged with: android-edittext
tagged with: java
has body: I'm trying to input date values from an editText, but i keep making error, what i should do? EditText DataI = (EditText) findViewById(R.id.DataI); EditText DataF = (EditText) findViewById(R.id.DataF); calendar1.setTime(DataI); calendar2.setTime(DataF);
has title: Date input from EditText
type: Question

http://stackoverflow.com/comment/32936921
has text: does Compartment entity have any large data associated with it e.g. blob or image which is persisted in database?
comment on: http://stackoverflow.com/q/21771298
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33036693
type: QuestionComment
comment on: http://stackoverflow.com/q/21828200
score: 0
has text: Are you getting the time in a fixed format? then what about splitting the string.
type: Comment

http://stackoverflow.com/q/21838565
has answer: http://stackoverflow.com/a/21838707
has comment: http://stackoverflow.com/comment/33057205
answer count: 1
tagged with: user-interface
tagged with: netbeans
has comment: http://stackoverflow.com/comment/33055685
type: UnansweredQuestion
has body: Working on learning the GUI builder for netbeans, and I'm pretty confused. I'm writing a basic LoginUI class with the GUI builder. If I run the class as standalone, the window I want pops up as expected. However if I attempt to create a new instance of it, it does not. My flow of control is as follows: public static void main(String[] args) { LoginCntl theLoginCntl = new LoginCntl(); } public class LoginCntl { public LoginCntl(){ LoginUI theLoginUI = new LoginUI(); } } public LoginUI() { initComponents(); System.out.println("Are we here?"); //This prints out, so I know the program gets here. The problem is the window does not show up here. } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new LoginUI().setVisible(true); } }); I'm really not sure why I can run it standalone and get the window I want then when I create a new instance of it the window does not appear. I get the feeling I'm missing something pretty basic. Any help would be greatly appreciated. Edit: Added some more of the generated code that netbeans provides. It does call setVisible(). That being said, while looking for setVisible() I noticed that the GUI builder added public static void main(String args[]) { in some of its generated code. As far as I'm aware you should only ever have 1 main class in a project. Could this be my problem?
score: 0
tagged with: java
has title: Can't call UI classes with netbeans GUI builder
type: Question

http://stackoverflow.com/comment/33059608
comment on: http://stackoverflow.com/q/21840818
type: Comment
type: QuestionComment
has text: is an array not a collection?
score: 0

http://stackoverflow.com/a/21683183
has body: Try this: engine.load(getClass() .getResource("/com/interpro/emmeclipse/html/PageCreator.html") .toExternalForm()); It should run for a JAR-packaged application too, but test it anyway...
answers question: http://stackoverflow.com/q/21680957
score: 0
type: Answer

http://stackoverflow.com/comment/32780663
type: AnswerComment
has text: i know its off topic but fixing one error caused another.
type: Comment
comment on: http://stackoverflow.com/a/21683836
score: 0

http://stackoverflow.com/comment/32873643
comment on: http://stackoverflow.com/q/21736162
has text: Why don't you use XML and AndroidManifest to add the AdMob? It's easier that way.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32842239
type: Comment
comment on: http://stackoverflow.com/a/21714393
score: 0
type: AnswerComment
has text: You are indeed using the random function twice. You are starting two JVMs, so the field is initialized twice, once per JVM, and so you get two different random numbers. That's what you're supposed to get with random number generators. If you want to debate this point further you will need to trace the numbers you're getting and post them here as evidence of your claim.

http://stackoverflow.com/a/21736553
upvote count: 3
has body: I find this tutorial and code in jboss site. It works as well. Try this and enjoy. public class WebSphereMQMessageSendServiceBean implements MessageSendService { private static Logger logger = Logger.getLogger(WebSphereMQMessageSendServiceBean.class); private Connection connection = null; private Session session = null; private MessageProducer producer = null; public boolean sendMessage(String xmlMsg, String instrumentId) throws QueueServiceAdaptorException{ boolean success = false; String destinationType = "QUEUE"; String destinationName = "PRO.QDX.QDX.MSG.QDC"; String channel = "PROQDIB.SVRCONN"; String hostName = "localhost"; Integer port = "1414"; String queueManager = "REFDMQ01"; String uid = "nuwan"; String provider = "com.ibm.msg.client.wmq"; try { JmsFactoryFactory jmsFactoryFactory = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER); JmsConnectionFactory jmsConnectionFactory = jmsFactoryFactory.createConnectionFactory(); // Set the properties jmsConnectionFactory.setStringProperty(WMQConstants.WMQ_HOST_NAME, hostName); jmsConnectionFactory.setIntProperty(WMQConstants.WMQ_PORT, port); jmsConnectionFactory.setStringProperty(WMQConstants.WMQ_CHANNEL, channel); jmsConnectionFactory.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT); jmsConnectionFactory.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, queueManager); // Create JMS objects connection = jmsConnectionFactory.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = null; if (destinationType.equals("QUEUE")) { destination = session.createQueue(destinationName); } else { destination = session.createTopic(destinationName); } producer = session.createProducer(destination); //connection.setExceptionListener(this); connection.start(); TextMessage message = session.createTextMessage(); // If WMQ_MESSAGE_BODY is set to WMQ_MESSAGE_BODY_MQ, no additional header is added to the message body. ((MQDestination) destinatio…
score: 3
answers question: http://stackoverflow.com/q/21699187
downvote count: 0
type: Answer

http://stackoverflow.com/q/21702776
has answer: http://stackoverflow.com/a/21742078
has comment: http://stackoverflow.com/comment/32827387
type: AnsweredQuestion
tagged with: extract
possible better answer: http://stackoverflow.com/a/21703692
has answer: http://stackoverflow.com/a/21703692
type: Question
tagged with: ioexception
tagged with: java
accepted answer: http://stackoverflow.com/a/21742078
has comment: http://stackoverflow.com/comment/32826341
has comment: http://stackoverflow.com/comment/32839797
tagged with: pdfbox
has body: I created a program to read and extract text from PDF files... But it producing this exception during execution.. java.io.IOException: Error: Expected a long type, actual='930[299' at org.apache.pdfbox.pdfparser.BaseParser.readLong(BaseParser.java:1669) at org.apache.pdfbox.pdfparser.PDFObjectStreamParser.parse(PDFObjectStreamParser.java:100) at org.apache.pdfbox.cos.COSDocument.dereferenceObjectStreams(COSDocument.java:632) at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:244) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1205) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1172) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1097) at PatentAdder.main(PatentAdder.java:60) This is my code : import java.awt.Rectangle; import java.io.File; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.TrueFileFilter; import org.apache.commons.io.filefilter.WildcardFileFilter; import org.apache.pdfbox.exceptions.InvalidPasswordException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.util.PDFTextStripperByArea; public class PatentAdder { /** * @param args */ public static String patno,patit,patdate,patfilled,appno; private static int File; public static void main(String[] args) { // TODO Auto-generated method stub try { int cnt=0; if( args.length == 1 ) { // usage(); } else { PDDocument document = null; try { File dataDir = new File("F:/patents/test/tittest/USP2002w17/06/378/pdfs"); File[] files = dataDir.listFiles(); // String[] files = dataDir.list(); int count=0; // System.out.println ("Satrt1"); for (File file : files) { // System.out.println ("Satrt2"); File f = file; if (!f.isDirectory()) { document = PDDocument.load(f.getA…
has comment: http://stackoverflow.com/comment/32826108
score: 0
has comment: http://stackoverflow.com/comment/32813376
has title: What is this java.io.IOException: Error: Expected a long type, actual='930[299' tells?
answer count: 2
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/32813448

http://stackoverflow.com/comment/133620145
has text: According to the documentation it is not recommended to use the annotation. See https://projectlombok.org/features/experimental/Delegate
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/52806174

http://stackoverflow.com/comment/32831005
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21693525
has text: I have tried putting total.setText(((yearNow-year)*365)+((monthNow-month)*30)+(dayNow-day))
score: 0

http://stackoverflow.com/a/21690472
has body: Because Java is a strictly-typed language, it has to be careful about covariance and how types work together. Erasure is not an excuse to break the type rules. For example: class BaseGood&lt;T&gt; { public void doStuff(T elem) { // ... } } class DerivedGood&lt;T&gt; extends BaseGood { public void doStuff(Object elem) { super.doStuff(elem); } } class BaseBad { public void doStuff(List&lt;Double&gt; list) { // ... } } class DerivedBad extends BaseBad { public void doStuff(List&lt;Integer&gt; list) { super.doStuff(list); // ... } } Here, we have two different cases for erasure. With the BaseGood and DerivedGood classes, the two methods have the same erasure: void doStuff(Object elem) and it can be known that T will always be of type Object and therefore the function is type-safe. With the BaseBad and DerivedBad classes, the two methods have the same erasure: void doStuff(List list); however, the type system cannot convert from a List&lt;Integer&gt; to a List&lt;Double&gt; safely (or to and from any List for that matter). Allowing this conversion would potentially allow attempts to put Doubles into lists of Integers (or the issue that generics moves detection of to compile-time). Having the methods override friendly after erasure does not mean that the type system cannot check for incompatibilities pre-erasure. EDIT Also, real erasure as applied to class/method definitions does not occur at compile-time, it occurs at runtime. Code that references generic methods just compile as if the function was called without generics, with type-safety enforced by the compiler and by run-time checking. See: Java generics - type erasure - when and what happens There is also another case where you pass a type-erased generic class to an override and because the type system is unable to check whether you passed a proper list based on the type of the method, it must allow it.
downvote count: 0
answers question: http://stackoverflow.com/q/21690268
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32796733
has comment: http://stackoverflow.com/comment/32794650

http://stackoverflow.com/a/26612461
has body: To see state of SIM1 type in console: adb shell dumpsys telephony.registry To see state of SIM2 type in console: adb shell dumpsys telephony.registry2 mCallState changed on incoming/outgoing call. It allow to let you know which SIM card used for call When you invoke dumpsys from Java-application, you need android.permission.DUMP in manifest. But it does not work on some new devices (they fail with "Permission Denial").
downvote count: 0
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/21746686
score: 3

http://stackoverflow.com/comment/33010892
type: Comment
has text: It would have to be `HashMap<String, Integer>`.
comment on: http://stackoverflow.com/a/21813328
type: AnswerComment
score: 0

http://stackoverflow.com/q/21691931
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21691946
score: 0
has answer: http://stackoverflow.com/a/21691979
answer count: 3
has comment: http://stackoverflow.com/comment/32795150
has title: ArrayIndexOutOfBounds Exception with a 2-dimensional array
has body: Here we go... when I try an example with 3 students and 3 classes, the input works fine until the last class, where it throws an exception. This doesn't make sense because the length should fit the for loop... Can anyone find what's wrong here? import java.io.*; public class Application { public static void main() { int studentNum = 0; int courseNum = 0; System.out.println("\f------GRADE CALCULATOR------\n"); try { BufferedReader buffin = new BufferedReader(new InputStreamReader (System.in)); System.out.print("Enter number of students: "); System.out.flush(); studentNum = Integer.parseInt(buffin.readLine()); System.out.print("Enter number of courses to compute grades for: "); System.out.flush(); courseNum = Integer.parseInt(buffin.readLine()); int grades[][] = {new int[studentNum], new int[courseNum]}; System.out.println("\nEntering grades for " + studentNum + " students for " + courseNum + " classes.\n"); System.out.println(grades.length); for (int i = 0; i &lt; studentNum; i++) { System.out.println("Entering grades for student #" + (i+1) + "..."); for (int k = 0; k &lt; courseNum; k++) { System.out.print("Enter grade recieved in course #" + (k+1) + ": "); System.out.flush(); char letterGrade = (buffin.readLine()).charAt(0); if (letterGrade == 'A' || letterGrade == 'a') grades[i][k] = 4; else if (letterGrade == 'B' || letterGrade == 'b') grades[i][k] = 3; else if (letterGrade == 'C' || letterGrade == 'c') grades[i][k] = 2; else if (letterGrade == 'D' || letterGrade == 'd') grades[i][k] = 1; else if (letterGrade == 'F' || letterGrade == 'f') grades[i][k] = 0; else { System.out.println("\nInvalid entry! Acceptable inputs are A, B, C, D, or F.\n"); k--; } } } } catch (IOException e) { } } }
has comment: http://stackoverflow.com/comment/32795059
has answer: http://stackoverflow.com/a/21691954
has comment: http://stackoverflow.com/comment/32795085

http://stackoverflow.com/q/21708114
has title: Support for multiple cookie-domains in weblogic
has body: We have a weblogic application that needs to support being served from multiple domains (e.g. "foo.com" and "bar.com"). Once a user initiates a session on one of these domains they can visit to subdomains off that primary domain (e.g. "a.foo.com", "b.foo.com") and share that session across all of these subdomains. If a user jumps from "foo.com" to "bar.com", they will lose their session, which is fine. We were able to successfully implement this on JBoss/Tomcat by customizing a 'Valve' to rewrite the session cookie to always be at the top level domain for the serverName that is being requested (i.e. request.getServerName()). However, we are currently in the process of migrating our application from JBoss to Weblogic and are trying to figure out how to support the same requirement. We have found that weblogic does allow for sharing sessions across multiple subdomains of a single domain by setting the 'cookie-domain' property within the weblogic.xml: /store .foo.com However, we haven't figured out how to configure support for multiple domains (i.e. both foo.com and bar.com). From what we can tell, the weblogic.xml file doesn't support this. If we only configure one of the domains in the weblogic.xml, sessions do not work properly for the domain that is not configured (i.e. every request leads to a new session). Any ideas on how we can support sessions across different domains for a single web-app on weblogic? We are running on Weblogic 12c.
favorite count: 0
has answer: http://stackoverflow.com/a/31375071
possible better answer: http://stackoverflow.com/a/31375071
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25150569
tagged with: weblogic12c
downvote count: 0
tagged with: java
tagged with: session-cookies
has comment: http://stackoverflow.com/comment/32906484
type: Question
upvote count: 2
tagged with: jakarta-ee
tagged with: weblogic
has answer: http://stackoverflow.com/a/25150569
answer count: 2

http://stackoverflow.com/a/21725686
has comment: http://stackoverflow.com/comment/32854436
has comment: http://stackoverflow.com/comment/32856378
type: Answer
has comment: http://stackoverflow.com/comment/32854426
has comment: http://stackoverflow.com/comment/32858616
has comment: http://stackoverflow.com/comment/32862494
answers question: http://stackoverflow.com/q/21725594
has comment: http://stackoverflow.com/comment/32855039
has comment: http://stackoverflow.com/comment/32854353
upvote count: 2
has body: You need to clone the object. So your code would look like: public final class ImmutableWrapper&lt;T extends Number&gt; { private final T value; public ImmutableWrapper(T value) { this.value = value.clone(); } public T getValue() { return value.clone(); } }
score: 0
downvote count: 2

http://stackoverflow.com/a/21790575
type: Answer
score: 0
has body: Maybe this will help you out. I know its not exactly what your looking for, but it demonstrates how to use the GB layout fairly well I guess: public class MainF extends JFrame { public static void main(String[] args) { MainF f = new MainF(); f.setVisible(true); } public MainF() { this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setBounds(100, 100, 600, 300); Dimension tfSize = new Dimension(200, 25); JPanel dataP = new JPanel(); dataP.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); JLabel label = new JLabel("Name:"); c.gridx = 1; c.gridy = 1; c.anchor = GridBagConstraints.NORTHEAST; dataP.add(label, c); JTextField tf = new JTextField(30); tf.setMinimumSize(tfSize); tf.setMaximumSize(tfSize); tf.setPreferredSize(tfSize); c = new GridBagConstraints(); c.gridx = 2; c.gridy = 1; c.gridwidth = 3; dataP.add(tf, c); label = new JLabel("Address:"); c = new GridBagConstraints(); c.gridx = 1; c.gridy = 2; c.anchor = GridBagConstraints.NORTHEAST; dataP.add(label, c); tf = new JTextField(30); tf.setMinimumSize(tfSize); tf.setMaximumSize(tfSize); tf.setPreferredSize(tfSize); c = new GridBagConstraints(); c.gridx = 2; c.gridy = 2; c.gridwidth = 3; dataP.add(tf, c); label = new JLabel("Amount Paid:"); c = new GridBagConstraints(); c.gridx = 1; c.gridy = 3; c.anchor = GridBagConstraints.NORTHEAST; dataP.add(label, c); tf = new JTextField(30); tf.setMinimumSize(tfSize); tf.setMaximumSize(tfSize); tf.setPreferredSize(tfSize); c = new GridBagConstraints(); c.gridx = 2; c.gridy = 3; c.gridwidth = 3; dataP.add(tf, c); JButton button = new JButton("Add Member"); c = new GridBagConstraints(); c.gridx = 2; c.gridy = 5; dataP.add(button, c); button = new JButton("Remove Member"); c = new GridBagConstraints(); c.gridx = 3; c.gridy = 5; dataP.add(button, c); button = new JButton("Remove All Members"); c = new GridBagConstraints(); c.gridx = 4; c.gridy = 5; dataP.add(button, c); this.add(dataP); } }
answers question: http://stackoverflow.com/q/21790254

http://stackoverflow.com/comment/33059311
type: QuestionComment
has text: Try searching for this problem on stack overflow -- there are literally dozens of similar questions and answers.
type: Comment
comment on: http://stackoverflow.com/q/21840655
score: 1

http://stackoverflow.com/comment/32869103
type: AnswerComment
comment on: http://stackoverflow.com/a/21733640
score: 0
type: Comment
has text: In the case you need age on all the fruit sub classes.